Professional Documents
Culture Documents
2-D Lid-Driven Cavity: (302.044) Numerical Methods in Fluid Dynamics
2-D Lid-Driven Cavity: (302.044) Numerical Methods in Fluid Dynamics
francesco.romano@tuwien.ac.at
Incompressible
Navier–
Stokes 1 Incompressible Navier–Stokes
Lid–Driven
Cavity
icoFoam
Meshing
2 Lid–Driven Cavity
Solver set-up
Mesh
Refinement
Solver Re-
initialization 3 icoFoam
PISO
Algorithm Meshing
Solver set-up
Mesh Refinement
Solver Re-initialization
PISO Algorithm
Incompressible
Navier–
Incompressible Navier–Stokes Equations
Stokes
Lid–Driven
Cavity
icoFoam
Meshing
Solver set-up
Mesh
Refinement
Solver Re-
initialization
PISO
Algorithm
Incompressible
Navier–
Incompressible Navier–Stokes Equations
Stokes
Lid–Driven
Cavity ∇ · u = 0
icoFoam
u,t +u · ∇u = −∇p + ν∆u
Meshing
+BC & IC
Solver set-up
Mesh
Refinement
Solver Re-
initialization
PISO
Algorithm
Incompressible
Navier–
Incompressible Navier–Stokes Equations
Stokes
Lid–Driven
Cavity ∇ · u = 0
icoFoam
u,t +u · ∇u = −∇p + ν∆u
Meshing
+BC & IC
Solver set-up
Mesh
Refinement
Solver Re-
initialization
PISO u = velocity field;
Algorithm
p = relative pressure field divided by ρ;
ν = kinematic viscosity.
Incompressible
Navier–
Lid–Driven Cavity Problem
Stokes
Lid–Driven
Cavity
icoFoam
Meshing
Solver set-up
Mesh
Refinement
Solver Re-
initialization
PISO
Algorithm
Incompressible
Navier–
Lid–Driven Cavity Problem
Stokes
Lid–Driven
Cavity ∇ · u = 0
u,t +u· ∇u = −∇p + ν∆
icoFoam
→ u = 0;
Meshing
left edge: No–Slip
Solver set-up
Mesh
Refinement
right edge: No–Slip → u = 0;
Solver Re-
BC :
bottom edge: No–Slip → u = 0;
initialization
PISO
top edge: No–Slip → u = U î;
Algorithm
IC : u = 0 , (p = 0);
u = velocity field;
p = relative pressure field divided by ρ;
ν = kinematic viscosity.
Incompressible
Navier–
OpenFOAM icoFoam solver
Stokes
Lid–Driven
Cavity
icoFoam
Meshing
Solver set-up
Mesh
Refinement
Solver Re-
initialization
PISO
Algorithm
Incompressible
Navier–
OpenFOAM icoFoam solver
Stokes
. icoFoam assumes an incompressible, unsteady flow and
Lid–Driven
Cavity ignores gravity, but it can be also set as a steady solver;
icoFoam
Meshing
Solver set-up
Mesh
Refinement
Solver Re-
initialization
PISO
Algorithm
Incompressible
Navier–
OpenFOAM icoFoam solver
Stokes
. icoFoam assumes an incompressible, unsteady flow and
Lid–Driven
Cavity ignores gravity, but it can be also set as a steady solver;
icoFoam
Meshing
. Because, in general, an exact solution of the analyzed
Solver set-up problems is not known, it is not possible to analytically
Mesh
Refinement validate the code. That is the case in which experimental
Solver Re-
initialization
PISO
data can be used as benchmark;
Algorithm
Incompressible
Navier–
OpenFOAM icoFoam solver
Stokes
. icoFoam assumes an incompressible, unsteady flow and
Lid–Driven
Cavity ignores gravity, but it can be also set as a steady solver;
icoFoam
Meshing
. Because, in general, an exact solution of the analyzed
Solver set-up problems is not known, it is not possible to analytically
Mesh
Refinement validate the code. That is the case in which experimental
Solver Re-
initialization
PISO
data can be used as benchmark;
Algorithm
. Another way to “validate” the code is to increase the cells
size showing a consistent decrement of the approximation
error. If the Lax’ theorem is applicable, the discrete solution
converges to the exact one decreasing the characteristic
size of each element.
Incompressible
Navier–
OpenFOAM icoFoam solver: Meshing
Stokes
Lid–Driven
Cavity
icoFoam
Meshing
Solver set-up
Mesh
Refinement
Solver Re-
initialization
PISO
Algorithm
Incompressible
Navier–
OpenFOAM icoFoam solver: Meshing
Stokes
. At first, an evenly distributed, orthogonal mesh is used;
Lid–Driven
Cavity
icoFoam
Meshing
Solver set-up
Mesh
Refinement
Solver Re-
initialization
PISO
Algorithm
Incompressible
Navier–
OpenFOAM icoFoam solver: Meshing
Stokes
. At first, an evenly distributed, orthogonal mesh is used;
Lid–Driven
Cavity
. Because the problem to solve is a 2–D case, in
icoFoam
Meshing
blockMeshDict an arbitrary thickness is given in z direction
Solver set-up and empty is used for the faces having as normal vector k̂;
Mesh
Refinement
Solver Re-
initialization
PISO
Algorithm
Incompressible
Navier–
OpenFOAM icoFoam solver: Meshing
Stokes
. At first, an evenly distributed, orthogonal mesh is used;
Lid–Driven
Cavity
. Because the problem to solve is a 2–D case, in
icoFoam
Meshing
blockMeshDict an arbitrary thickness is given in z direction
Solver set-up and empty is used for the faces having as normal vector k̂;
Mesh
Refinement
Solver Re-
initialization
. For a coarse grid set-up, the number of cells will be
PISO
Algorithm
Nx = 20 , Ny = 20 (and Nz = 1);
Incompressible
Navier–
OpenFOAM icoFoam solver: Meshing
Stokes
. At first, an evenly distributed, orthogonal mesh is used;
Lid–Driven
Cavity
. Because the problem to solve is a 2–D case, in
icoFoam
Meshing
blockMeshDict an arbitrary thickness is given in z direction
Solver set-up and empty is used for the faces having as normal vector k̂;
Mesh
Refinement
Solver Re-
initialization
. For a coarse grid set-up, the number of cells will be
PISO
Algorithm
Nx = 20 , Ny = 20 (and Nz = 1);
. Algorithm steps:
Incompressible
Navier–
OpenFOAM icoFoam solver: Meshing
Stokes
. At first, an evenly distributed, orthogonal mesh is used;
Lid–Driven
Cavity
. Because the problem to solve is a 2–D case, in
icoFoam
Meshing
blockMeshDict an arbitrary thickness is given in z direction
Solver set-up and empty is used for the faces having as normal vector k̂;
Mesh
Refinement
Solver Re-
initialization
. For a coarse grid set-up, the number of cells will be
PISO
Algorithm
Nx = 20 , Ny = 20 (and Nz = 1);
. Algorithm steps:
◦ create the geometry writing the blockMeshDict file and
locating it in <problem_folder>/constant/polyMesh/;
Incompressible
Navier–
OpenFOAM icoFoam solver: Meshing
Stokes
. At first, an evenly distributed, orthogonal mesh is used;
Lid–Driven
Cavity
. Because the problem to solve is a 2–D case, in
icoFoam
Meshing
blockMeshDict an arbitrary thickness is given in z direction
Solver set-up and empty is used for the faces having as normal vector k̂;
Mesh
Refinement
Solver Re-
initialization
. For a coarse grid set-up, the number of cells will be
PISO
Algorithm
Nx = 20 , Ny = 20 (and Nz = 1);
. Algorithm steps:
◦ create the geometry writing the blockMeshDict file and
locating it in <problem_folder>/constant/polyMesh/;
◦ run the command <problem_folder>$ blockMesh;
Incompressible
Navier–
OpenFOAM icoFoam solver: Meshing
Stokes
. At first, an evenly distributed, orthogonal mesh is used;
Lid–Driven
Cavity
. Because the problem to solve is a 2–D case, in
icoFoam
Meshing
blockMeshDict an arbitrary thickness is given in z direction
Solver set-up and empty is used for the faces having as normal vector k̂;
Mesh
Refinement
Solver Re-
initialization
. For a coarse grid set-up, the number of cells will be
PISO
Algorithm
Nx = 20 , Ny = 20 (and Nz = 1);
. Algorithm steps:
◦ create the geometry writing the blockMeshDict file and
locating it in <problem_folder>/constant/polyMesh/;
◦ run the command <problem_folder>$ blockMesh;
◦ check the mesh with <problem_folder>$ checkMesh;
Incompressible
Navier–
OpenFOAM icoFoam solver: Meshing
Stokes
. At first, an evenly distributed, orthogonal mesh is used;
Lid–Driven
Cavity
. Because the problem to solve is a 2–D case, in
icoFoam
Meshing
blockMeshDict an arbitrary thickness is given in z direction
Solver set-up and empty is used for the faces having as normal vector k̂;
Mesh
Refinement
Solver Re-
initialization
. For a coarse grid set-up, the number of cells will be
PISO
Algorithm
Nx = 20 , Ny = 20 (and Nz = 1);
. Algorithm steps:
◦ create the geometry writing the blockMeshDict file and
locating it in <problem_folder>/constant/polyMesh/;
◦ run the command <problem_folder>$ blockMesh;
◦ check the mesh with <problem_folder>$ checkMesh;
◦ visualize it with <problem_folder>$ paraFoam and the
Wireframe visualization option.
Incompressible
Navier–
OpenFOAM icoFoam solver: solver set-up
Stokes
Lid–Driven
Cavity
icoFoam
Meshing
Solver set-up
Mesh
Refinement
Solver Re-
initialization
PISO
Algorithm
Incompressible
Navier–
OpenFOAM icoFoam solver: solver set-up
Stokes
. For an incompressible, viscous flow, considering a laminar
Lid–Driven
Cavity regime, the only fluid property to specify is the kinematic
icoFoam viscosity (in transportProperties);
Meshing
Solver set-up
Mesh
Refinement
Solver Re-
initialization
PISO
Algorithm
Incompressible
Navier–
OpenFOAM icoFoam solver: solver set-up
Stokes
. For an incompressible, viscous flow, considering a laminar
Lid–Driven
Cavity regime, the only fluid property to specify is the kinematic
icoFoam viscosity (in transportProperties);
Meshing
Solver set-up . In writing the controlDict file, the setted ∆t should take
Mesh
Refinement into account numerical stability limits;
Solver Re-
initialization
PISO
Algorithm
Incompressible
Navier–
OpenFOAM icoFoam solver: solver set-up
Stokes
. For an incompressible, viscous flow, considering a laminar
Lid–Driven
Cavity regime, the only fluid property to specify is the kinematic
icoFoam viscosity (in transportProperties);
Meshing
Solver set-up . In writing the controlDict file, the setted ∆t should take
Mesh
Refinement into account numerical stability limits;
Solver Re-
initialization
PISO
Algorithm
. Because the employed grid is Orthogonal, the flag
nNonOrthogonalCorrectors in fvSolution is set to 0;
Incompressible
Navier–
OpenFOAM icoFoam solver: solver set-up
Stokes
. For an incompressible, viscous flow, considering a laminar
Lid–Driven
Cavity regime, the only fluid property to specify is the kinematic
icoFoam viscosity (in transportProperties);
Meshing
Solver set-up . In writing the controlDict file, the setted ∆t should take
Mesh
Refinement into account numerical stability limits;
Solver Re-
initialization
PISO
Algorithm
. Because the employed grid is Orthogonal, the flag
nNonOrthogonalCorrectors in fvSolution is set to 0;
. Starting from resting, homogeneous flow, homogeneous
initial conditions are stored for p and U in the folder
<problem_folder>/0/.
Incompressible
Navier–
OpenFOAM icoFoam solver: solver set-up
Stokes
Lid–Driven
Cavity
icoFoam
Meshing
Solver set-up
Mesh
Refinement
Solver Re-
initialization
PISO
Algorithm
Incompressible
Navier–
OpenFOAM icoFoam solver: solver set-up
Stokes
. Algorithm steps:
Lid–Driven
Cavity
icoFoam
Meshing
Solver set-up
Mesh
Refinement
Solver Re-
initialization
PISO
Algorithm
Incompressible
Navier–
OpenFOAM icoFoam solver: solver set-up
Stokes
. Algorithm steps:
Lid–Driven
Cavity ◦ set the fluid properties in transportProperties
icoFoam file and locating it in <problem_folder>/constant/;
Meshing
Solver set-up
Mesh
Refinement
Solver Re-
initialization
PISO
Algorithm
Incompressible
Navier–
OpenFOAM icoFoam solver: solver set-up
Stokes
. Algorithm steps:
Lid–Driven
Cavity ◦ set the fluid properties in transportProperties
icoFoam file and locating it in <problem_folder>/constant/;
Meshing
Solver set-up ◦ set the initial conditions writing the p and U files and
Mesh
Refinement locating them in <problem_folder>/0/;
Solver Re-
initialization
PISO
Algorithm
Incompressible
Navier–
OpenFOAM icoFoam solver: solver set-up
Stokes
. Algorithm steps:
Lid–Driven
Cavity ◦ set the fluid properties in transportProperties
icoFoam file and locating it in <problem_folder>/constant/;
Meshing
Solver set-up ◦ set the initial conditions writing the p and U files and
Mesh
Refinement locating them in <problem_folder>/0/;
Solver Re-
initialization ◦ set time step and data saving/storing options writing
PISO
Algorithm the controlDict file and locating it in
<problem_folder>/system/;
Incompressible
Navier–
OpenFOAM icoFoam solver: solver set-up
Stokes
. Algorithm steps:
Lid–Driven
Cavity ◦ set the fluid properties in transportProperties
icoFoam file and locating it in <problem_folder>/constant/;
Meshing
Solver set-up ◦ set the initial conditions writing the p and U files and
Mesh
Refinement locating them in <problem_folder>/0/;
Solver Re-
initialization ◦ set time step and data saving/storing options writing
PISO
Algorithm the controlDict file and locating it in
<problem_folder>/system/;
◦ set discretization and splitting scheme details writing
the fvSchemes and fvSolution files and locating them
in <problem_folder>/system/;
Incompressible
Navier–
OpenFOAM icoFoam solver: solver set-up
Stokes
. Algorithm steps:
Lid–Driven
Cavity ◦ set the fluid properties in transportProperties
icoFoam file and locating it in <problem_folder>/constant/;
Meshing
Solver set-up ◦ set the initial conditions writing the p and U files and
Mesh
Refinement locating them in <problem_folder>/0/;
Solver Re-
initialization ◦ set time step and data saving/storing options writing
PISO
Algorithm the controlDict file and locating it in
<problem_folder>/system/;
◦ set discretization and splitting scheme details writing
the fvSchemes and fvSolution files and locating them
in <problem_folder>/system/;
◦ run the icoFoam solver with the command
<problem_folder>$ icoFoam;
Incompressible
Navier–
OpenFOAM icoFoam solver: solver set-up
Stokes
. Algorithm steps:
Lid–Driven
Cavity ◦ set the fluid properties in transportProperties
icoFoam file and locating it in <problem_folder>/constant/;
Meshing
Solver set-up ◦ set the initial conditions writing the p and U files and
Mesh
Refinement locating them in <problem_folder>/0/;
Solver Re-
initialization ◦ set time step and data saving/storing options writing
PISO
Algorithm the controlDict file and locating it in
<problem_folder>/system/;
◦ set discretization and splitting scheme details writing
the fvSchemes and fvSolution files and locating them
in <problem_folder>/system/;
◦ run the icoFoam solver with the command
<problem_folder>$ icoFoam;
◦ visualize the results with the command
<problem_folder>$ paraFoam.
[302.044] – Univ. Assist. MSc. Francesco Romanò 8/13
Lid–Driven Cavity
OpenFOAM icoFoam solver
Incompressible
Navier–
OpenFOAM icoFoam solver: solver set-up
Stokes
. Case folder structure:
Lid–Driven
Cavity
→ <problem_folder>/
icoFoam
Meshing
→ 0/
Solver set-up U
Mesh
Refinement p
Solver Re-
initialization → constant/
PISO
Algorithm transportProperties
→ polyMesh/
blockMeshDict
→ system/
controlDict
fvSchemes
fvSolution
Incompressible
Navier–
OpenFOAM icoFoam solver: Mesh Refinement
Stokes
. As second try, because of the solution characteristics, a
Lid–Driven
Cavity
better result can be obtained refining the mesh in the
icoFoam
four corners of the cavity;
Meshing
Solver set-up
. To proceed, the blockMeshDict file will consist of four
Mesh
Refinement blocks whose simple grading will be used to cluster the
Solver Re-
initialization nodes nearby the domain corners:
PISO
Algorithm blocks
(
hex (<1st block vertices>) (<Nx Ny Nx>) simpleGrading (2.0 2.0 1.0)
hex (<2nd block vertices>) (<Nx Ny Nx>) simpleGrading (0.5 2.0 1.0)
hex (<3rd block vertices>) (<Nx Ny Nx>) simpleGrading (2.0 0.5 1.0)
hex (<4th block vertices>) (<Nx Ny Nx>) simpleGrading (0.5 0.5 1.0)
);
Incompressible
Navier–
OpenFOAM icoFoam solver: solver re-initialization
Stokes
. The set-up used for the solver in the case of a uniform mesh
Lid–Driven
Cavity can be kept unchanged;
icoFoam
Meshing
. The only necessary changing is in writing the controlDict
Solver set-up file. The selected ∆t should take into account numerical
Mesh
Refinement stability limits relative to the new mesh;
Solver Re-
initialization
PISO
Algorithm
. As initial condition, the solution of the previous simulation
can be used mapping it on the current grid:
Incompressible
Navier–
OpenFOAM icoFoam solver: solver set-up
Stokes
Lid–Driven
Cavity
icoFoam
Meshing
Solver set-up
Mesh
Refinement
Solver Re-
initialization
PISO
Algorithm
Incompressible
Navier–
OpenFOAM icoFoam solver: solver set-up
Stokes
. Algorithm steps:
Lid–Driven
Cavity
icoFoam
Meshing
Solver set-up
Mesh
Refinement
Solver Re-
initialization
PISO
Algorithm
Incompressible
Navier–
OpenFOAM icoFoam solver: solver set-up
Stokes
. Algorithm steps:
Lid–Driven
Cavity
◦ copy the previous results in an old problem folder:
icoFoam
Meshing
<problem_folder_Old>;
Solver set-up
Mesh
Refinement
Solver Re-
initialization
PISO
Algorithm
Incompressible
Navier–
OpenFOAM icoFoam solver: solver set-up
Stokes
. Algorithm steps:
Lid–Driven
Cavity
◦ copy the previous results in an old problem folder:
icoFoam
Meshing
<problem_folder_Old>;
Solver set-up ◦ set the new blockMeshDict and controlDict;
Mesh
Refinement
Solver Re-
initialization
PISO
Algorithm
Incompressible
Navier–
OpenFOAM icoFoam solver: solver set-up
Stokes
. Algorithm steps:
Lid–Driven
Cavity
◦ copy the previous results in an old problem folder:
icoFoam
Meshing
<problem_folder_Old>;
Solver set-up ◦ set the new blockMeshDict and controlDict;
Mesh
Refinement ◦ create the new mesh with the command
Solver Re-
initialization <problem_folder>/blockMesh;
PISO
Algorithm
Incompressible
Navier–
OpenFOAM icoFoam solver: solver set-up
Stokes
. Algorithm steps:
Lid–Driven
Cavity
◦ copy the previous results in an old problem folder:
icoFoam
Meshing
<problem_folder_Old>;
Solver set-up ◦ set the new blockMeshDict and controlDict;
Mesh
Refinement ◦ create the new mesh with the command
Solver Re-
initialization <problem_folder>/blockMesh;
PISO
Algorithm ◦ map the results on the new grid with the command
<problem_folder>/mapFields
..<problem_folder_Old> -consistent;
Incompressible
Navier–
OpenFOAM icoFoam solver: solver set-up
Stokes
. Algorithm steps:
Lid–Driven
Cavity
◦ copy the previous results in an old problem folder:
icoFoam
Meshing
<problem_folder_Old>;
Solver set-up ◦ set the new blockMeshDict and controlDict;
Mesh
Refinement ◦ create the new mesh with the command
Solver Re-
initialization <problem_folder>/blockMesh;
PISO
Algorithm ◦ map the results on the new grid with the command
<problem_folder>/mapFields
..<problem_folder_Old> -consistent;
◦ run the icoFoam solver with the command
<problem_folder>$ icoFoam;
Incompressible
Navier–
OpenFOAM icoFoam solver: solver set-up
Stokes
. Algorithm steps:
Lid–Driven
Cavity
◦ copy the previous results in an old problem folder:
icoFoam
Meshing
<problem_folder_Old>;
Solver set-up ◦ set the new blockMeshDict and controlDict;
Mesh
Refinement ◦ create the new mesh with the command
Solver Re-
initialization <problem_folder>/blockMesh;
PISO
Algorithm ◦ map the results on the new grid with the command
<problem_folder>/mapFields
..<problem_folder_Old> -consistent;
◦ run the icoFoam solver with the command
<problem_folder>$ icoFoam;
◦ visualize the results with the command
<problem_folder>$ paraFoam.
Incompressible
Navier–
OpenFOAM icoFoam solver: PISO algorithm
Stokes
Lid–Driven
Cavity
icoFoam
Meshing
Solver set-up
Mesh
Refinement
Solver Re-
initialization
PISO
Algorithm