Professional Documents
Culture Documents
Contact: cyprien.soulaine@stanford.edu
http://web.stanford.edu/~csoulain/
Stanford
November10,2014
Version 5.0
OpenFOAM initiation
For simple meshes, we can use blockMesh, otherwise we should use an external gridder or
snappyHexMesh.
Two different algorithms to solve Navier-Stokes equations : SIMPLE (simpleFoam...) and PISO
(icoFoam, pisoFoam...)
cyprien.soulaine@stanford.edu
OpenFOAM initiation
openfoam.com
openfoam.com
OpenFOAM initiation
cyprien.soulaine@stanford.edu
OpenFOAM initiation
openfoam.com
cyprien.soulaine@stanford.edu
outlet
inlet
OpenFOAM initiation
wall
wall
Detect the void space, remove the cells occupied by the solid and snap them to fit
as close as possible the initial surface object with snappyHexMesh.
cyprien.soulaine@stanford.edu
OpenFOAM initiation
$ run
$ cp -r
$FOAM_TUTORIALS/incompressible/simpleFoam/motorBike Exo5
$ cd Exo5
$ cp /data/cees/OF_training/Exo5/Exo5.stl .
$ paraview Exo5.stl
OpenFOAM initiation
$ surfaceCheck
$ gedit
Exo5.stl
grep
-i
'bounding box'
constant/polyMesh/blockMeshDict
$ blockMesh
$ paraFoam
To superimpose the background grid and the
surface mesh file, in ParaView:
Specify the boundaries top, bottom, left, right, frontAndBack
(see Part I, page 33)
file>open>Exo5.stl
cyprien.soulaine@stanford.edu
OpenFOAM initiation
$ mv Exo5.stl constant/triSurface/.
$ gedit system/snappyHexMeshDict
cyprien.soulaine@stanford.edu
OpenFOAM initiation
cyprien.soulaine@stanford.edu
10
OpenFOAM initiation
$ gedit system/snappyHexMeshDict
Eventually, we could have used the addLayers stage to add layers of cells around the
solid grains.
cyprien.soulaine@stanford.edu
11
outlet
inlet
OpenFOAM initiation
Solve the flow in the void space gridded in the previous exercise
Estimate the permeability of the porous medium
Solve a passive scalar transport in the void space
0.92 mm
The flow and the scalar transport are uncoupled. They can therefore be solved one
after the other.
The flow is obtained solving a Stokes problem with simpleFoam. The case can be setup
based on Exo3 (or $FOAM_TUTORIALS/incompressible/simpleFoam/pitzDaily)
$ run
$ cp -r
Exo3
Exo6a
The mesh is replaced by the grid of the previous exercise and scaled to the actual size
$ rm -r constant/polyMesh
$ cp -r ../Exo5/2/polyMesh ./constant/.
$ transformPoints -scale '(0.01
0.01 0.01)'
cyprien.soulaine@stanford.edu
12
$ gedit
0/p
OpenFOAM initiation
$ gedit
cyprien.soulaine@stanford.edu
13
OpenFOAM initiation
$ gedit
constant/transportProperties
system/fvSolution
PCG = Preconditioned
conjugate gradient solver
for symmetric matrices
constant/RASProperties
14
OpenFOAM initiation
$ gedit
system/controlDict
cyprien.soulaine@stanford.edu
15
OpenFOAM initiation
$ gedit
plotResiduals
plotResiduals
cyprien.soulaine@stanford.edu
16
OpenFOAM initiation
$ checkMesh | grep
-i
'volume'
Vvoid= 2.93x10-12 m3
$ checkMesh | grep
-i
'bounding box'
V=Lx*Ly*Lz=5.15x10-12 m3
= 0.57
OpenFOAM initiation
$ gedit
system/fvSolution
cyprien.soulaine@stanford.edu
18
OpenFOAM initiation
Once the flow is solved, we can use the velocity profile to transport (advection-diffusion) a
scalar T with the solver scalarTransportFoam,
Exo6b
We retreive the mesh and the resulting velocity profile from the previous simulation
$ cp
$ cp
-r ../Exo6a/constant/polyMesh
../Exo6a/latestTime/U 0/.
constant/.
cyprien.soulaine@stanford.edu
19
$ gedit
constant/transportProperties
$ gedit
system/controlDict
OpenFOAM initiation
$ gedit
cyprien.soulaine@stanford.edu
20
t=0.05s
OpenFOAM initiation
t=0.10s
t=0.15s
t=0.20s
cyprien.soulaine@stanford.edu
21
right >
log.patchAverage
$ cat
log.patchAverage
| grep -i
'right'
cut
-d' '
-f12 >
log.breaktrough
with lines lw 4
1.2
1
0.8
OpenFOAM initiation
Extract the values from the log file with the following command
D5e-6
D1e-6
D5e-7
0.6
0.4
0.2
0
0
time (s)
cyprien.soulaine@stanford.edu
22
OpenFOAM initiation
Part III: First programs, development of a heat tranfer solver in porous media
http://web.stanford.edu/~csoulain/
cyprien.soulaine@stanford.edu
23