CFD OpenFoam Sauna: Difference between revisions

From wikiluntti
 
(4 intermediate revisions by the same user not shown)
Line 31: Line 31:
ls $FOAM_TUTORIALS
ls $FOAM_TUTORIALS


=== Installation ===
=== Installation and using ===
Installation is a long process, it takes many hours using yay.  
Installation is a long process, it takes many hours using yay.  


<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
ofoam
ofoam
</syntaxhighlight>
<syntaxhighlight lang="bash">
source /opt/OpenFOAM/OpenFOAM-13/etc/bashrc
</syntaxhighlight>
Create an OpenFOAM case directory
<syntaxhighlight lang="bash">
mkdir -p ~/Documents/ofoam/constant/polyMesh
mkdir -p ~/Documents/ofoam/system
mkdir -p ~/Documents/ofoam/0
</syntaxhighlight>
Put your Gmsh mesh there:
<syntaxhighlight lang="bash">
cp thermal_test.msh ~/Documents/ofoam/
cd ~/Documents/ofoam
</syntaxhighlight>
Copy the tutorials to start easier
<syntaxhighlight lang="bash">
cp -r $FOAM_TUTORIALS/heatTransfer/chtMultiRegionFoam/* ~/Documents/ofoam/
</syntaxhighlight>
Then convert:
<syntaxhighlight lang="bash">
gmshToFoam thermal_test.msh
</syntaxhighlight>
This will populate:
<syntaxhighlight lang="bash">
constant/polyMesh/
</syntaxhighlight>
</syntaxhighlight>


Line 53: Line 82:
<syntaxhighlight lang="Bash">
<syntaxhighlight lang="Bash">
gmsh model.geo -3
gmsh model.geo -3
gmshToFoam model.msh
</syntaxhighlight>
</syntaxhighlight>
generates 3d triangulation.  
generates 3d triangulation and converts it.  


<syntaxhighlight lang="Bash">
<syntaxhighlight lang="Bash">

Latest revision as of 22:28, 14 July 2026

Introduction

Use OpenFOAM to analyze the heating of water above sauna's oven. The problem is during the winter when the water freezes.

Other possibilities would be to create a simple Laplacian solver. but I'd like to include Navier-Stokes equations and perhaps energy equation: ice melts into water, water freezes, latent heat is released and the interfaces move.

OpenFOAM

1

1

1

Workflow

  1. Generate mesh
    • For example: blockMesh
  2. Run solver
    • Example: laplacianFoam or: buoyantSimpleFoam
  3. View results
    • paraFoam

Use foamSearch <keyword> or find $FOAM_TUTORIALS -type f | grep <keyword> . For example: find $FOAM_TUTORIALS -type f | grep laplacian will show every diffusion example. Start with laplacianFoam → buoyantSimpleFoam → conjugate heat transfer examples.

Tutorials

ls $FOAM_TUTORIALS

Installation and using

Installation is a long process, it takes many hours using yay.

ofoam
source /opt/OpenFOAM/OpenFOAM-13/etc/bashrc

Create an OpenFOAM case directory

mkdir -p ~/Documents/ofoam/constant/polyMesh
mkdir -p ~/Documents/ofoam/system
mkdir -p ~/Documents/ofoam/0

Put your Gmsh mesh there:

cp thermal_test.msh ~/Documents/ofoam/
cd ~/Documents/ofoam

Copy the tutorials to start easier

cp -r $FOAM_TUTORIALS/heatTransfer/chtMultiRegionFoam/* ~/Documents/ofoam/

Then convert:

gmshToFoam thermal_test.msh

This will populate:

constant/polyMesh/

Creating the mesh

Images

gmsh

Gmsh to generate the triangles.

The command

gmsh model.geo -3
gmshToFoam model.msh

generates 3d triangulation and converts it.

yay -S gmsh-bin

Analyzing

Results