45
[302.044] Numerical Methods in Fluid Dynamics 2D Lid-Driven Cavity Incompressible NavierStokes (icoFoam), PISO Algorithm and Mesh Remapping Univ. Assist. MSc. Francesco Roman [email protected] December 18th, 2014

[302.044] Numerical Methods in Fluid Dynamics 2–D Lid ...info.tuwien.ac.at/ViennaOpenFOAMUserGroup/NumOpenFOAM_P03.pdf · Cavity icoFoam Meshing Solverset-up Mesh Refinement SolverRe-initialization

  • Upload
    vutruc

  • View
    216

  • Download
    1

Embed Size (px)

Citation preview

Page 1: [302.044] Numerical Methods in Fluid Dynamics 2–D Lid ...info.tuwien.ac.at/ViennaOpenFOAMUserGroup/NumOpenFOAM_P03.pdf · Cavity icoFoam Meshing Solverset-up Mesh Refinement SolverRe-initialization

[302.044] Numerical Methodsin Fluid Dynamics

2–D Lid-Driven CavityIncompressible Navier–Stokes (icoFoam),PISO Algorithm and Mesh Remapping

Univ. Assist. MSc. Francesco Romanò

[email protected]

December 18th, 2014

Page 2: [302.044] Numerical Methods in Fluid Dynamics 2–D Lid ...info.tuwien.ac.at/ViennaOpenFOAMUserGroup/NumOpenFOAM_P03.pdf · Cavity icoFoam Meshing Solverset-up Mesh Refinement SolverRe-initialization

IncompressibleNavier–Stokes

Lid–DrivenCavity

icoFoamMeshingSolver set-upMeshRefinementSolver Re-initializationPISOAlgorithm

Outline

1 Incompressible Navier–Stokes

2 Lid–Driven Cavity

3 icoFoamMeshingSolver set-upMesh RefinementSolver Re-initializationPISO Algorithm

[302.044] – Univ. Assist. MSc. Francesco Romanò 2/13

Page 3: [302.044] Numerical Methods in Fluid Dynamics 2–D Lid ...info.tuwien.ac.at/ViennaOpenFOAMUserGroup/NumOpenFOAM_P03.pdf · Cavity icoFoam Meshing Solverset-up Mesh Refinement SolverRe-initialization

IncompressibleNavier–Stokes

Lid–DrivenCavity

icoFoamMeshingSolver set-upMeshRefinementSolver Re-initializationPISOAlgorithm

Incompressible Navier–Stokes Equations

Incompressible Navier–Stokes Equations

∇ · u = 0

u,t +u · ∇u = −∇p+ ν∆u+BC & IC

u = velocity field;p = relative pressure field divided by ρ;ν = kinematic viscosity.

[302.044] – Univ. Assist. MSc. Francesco Romanò 3/13

Page 4: [302.044] Numerical Methods in Fluid Dynamics 2–D Lid ...info.tuwien.ac.at/ViennaOpenFOAMUserGroup/NumOpenFOAM_P03.pdf · Cavity icoFoam Meshing Solverset-up Mesh Refinement SolverRe-initialization

IncompressibleNavier–Stokes

Lid–DrivenCavity

icoFoamMeshingSolver set-upMeshRefinementSolver Re-initializationPISOAlgorithm

Incompressible Navier–Stokes Equations

Incompressible Navier–Stokes Equations∇ · u = 0

u,t +u · ∇u = −∇p+ ν∆u+BC & IC

u = velocity field;p = relative pressure field divided by ρ;ν = kinematic viscosity.

[302.044] – Univ. Assist. MSc. Francesco Romanò 3/13

Page 5: [302.044] Numerical Methods in Fluid Dynamics 2–D Lid ...info.tuwien.ac.at/ViennaOpenFOAMUserGroup/NumOpenFOAM_P03.pdf · Cavity icoFoam Meshing Solverset-up Mesh Refinement SolverRe-initialization

IncompressibleNavier–Stokes

Lid–DrivenCavity

icoFoamMeshingSolver set-upMeshRefinementSolver Re-initializationPISOAlgorithm

Incompressible Navier–Stokes Equations

Incompressible Navier–Stokes Equations∇ · u = 0

u,t +u · ∇u = −∇p+ ν∆u+BC & IC

u = velocity field;p = relative pressure field divided by ρ;ν = kinematic viscosity.

[302.044] – Univ. Assist. MSc. Francesco Romanò 3/13

Page 6: [302.044] Numerical Methods in Fluid Dynamics 2–D Lid ...info.tuwien.ac.at/ViennaOpenFOAMUserGroup/NumOpenFOAM_P03.pdf · Cavity icoFoam Meshing Solverset-up Mesh Refinement SolverRe-initialization

IncompressibleNavier–Stokes

Lid–DrivenCavity

icoFoamMeshingSolver set-upMeshRefinementSolver Re-initializationPISOAlgorithm

Lid–Driven CavityMathematical Problem

Lid–Driven Cavity Problem

∇ · u = 0

u,t +u · ∇u = −∇p+ ν∆

BC :

left edge: No–Slip → u = 0;

right edge: No–Slip → u = 0;

bottom edge: No–Slip → u = 0;

top edge: No–Slip → u = U i;IC : u = 0 , (p = 0);

u = velocity field;p = relative pressure field divided by ρ;ν = kinematic viscosity.

[302.044] – Univ. Assist. MSc. Francesco Romanò 4/13

Page 7: [302.044] Numerical Methods in Fluid Dynamics 2–D Lid ...info.tuwien.ac.at/ViennaOpenFOAMUserGroup/NumOpenFOAM_P03.pdf · Cavity icoFoam Meshing Solverset-up Mesh Refinement SolverRe-initialization

IncompressibleNavier–Stokes

Lid–DrivenCavity

icoFoamMeshingSolver set-upMeshRefinementSolver Re-initializationPISOAlgorithm

Lid–Driven CavityMathematical Problem

Lid–Driven Cavity Problem

∇ · u = 0

u,t +u · ∇u = −∇p+ ν∆

BC :

left edge: No–Slip → u = 0;

right edge: No–Slip → u = 0;

bottom edge: No–Slip → u = 0;

top edge: No–Slip → u = U i;IC : u = 0 , (p = 0);

u = velocity field;p = relative pressure field divided by ρ;ν = kinematic viscosity.

[302.044] – Univ. Assist. MSc. Francesco Romanò 4/13

Page 8: [302.044] Numerical Methods in Fluid Dynamics 2–D Lid ...info.tuwien.ac.at/ViennaOpenFOAMUserGroup/NumOpenFOAM_P03.pdf · Cavity icoFoam Meshing Solverset-up Mesh Refinement SolverRe-initialization

IncompressibleNavier–Stokes

Lid–DrivenCavity

icoFoamMeshingSolver set-upMeshRefinementSolver Re-initializationPISOAlgorithm

Lid–Driven CavityOpenFOAM icoFoam solver

OpenFOAM icoFoam solver

. icoFoam assumes an incompressible, unsteady flow andignores gravity, but it can be also set as a steady solver;

. Because, in general, an exact solution of the analyzedproblems is not known, it is not possible to analyticallyvalidate the code. That is the case in which experimentaldata can be used as benchmark;

. Another way to “validate” the code is to increase the cellssize showing a consistent decrement of the approximationerror. If the Lax’ theorem is applicable, the discrete solutionconverges to the exact one decreasing the characteristicsize of each element.

[302.044] – Univ. Assist. MSc. Francesco Romanò 5/13

Page 9: [302.044] Numerical Methods in Fluid Dynamics 2–D Lid ...info.tuwien.ac.at/ViennaOpenFOAMUserGroup/NumOpenFOAM_P03.pdf · Cavity icoFoam Meshing Solverset-up Mesh Refinement SolverRe-initialization

IncompressibleNavier–Stokes

Lid–DrivenCavity

icoFoamMeshingSolver set-upMeshRefinementSolver Re-initializationPISOAlgorithm

Lid–Driven CavityOpenFOAM icoFoam solver

OpenFOAM icoFoam solver. icoFoam assumes an incompressible, unsteady flow and

ignores gravity, but it can be also set as a steady solver;

. Because, in general, an exact solution of the analyzedproblems is not known, it is not possible to analyticallyvalidate the code. That is the case in which experimentaldata can be used as benchmark;

. Another way to “validate” the code is to increase the cellssize showing a consistent decrement of the approximationerror. If the Lax’ theorem is applicable, the discrete solutionconverges to the exact one decreasing the characteristicsize of each element.

[302.044] – Univ. Assist. MSc. Francesco Romanò 5/13

Page 10: [302.044] Numerical Methods in Fluid Dynamics 2–D Lid ...info.tuwien.ac.at/ViennaOpenFOAMUserGroup/NumOpenFOAM_P03.pdf · Cavity icoFoam Meshing Solverset-up Mesh Refinement SolverRe-initialization

IncompressibleNavier–Stokes

Lid–DrivenCavity

icoFoamMeshingSolver set-upMeshRefinementSolver Re-initializationPISOAlgorithm

Lid–Driven CavityOpenFOAM icoFoam solver

OpenFOAM icoFoam solver. icoFoam assumes an incompressible, unsteady flow and

ignores gravity, but it can be also set as a steady solver;

. Because, in general, an exact solution of the analyzedproblems is not known, it is not possible to analyticallyvalidate the code. That is the case in which experimentaldata can be used as benchmark;

. Another way to “validate” the code is to increase the cellssize showing a consistent decrement of the approximationerror. If the Lax’ theorem is applicable, the discrete solutionconverges to the exact one decreasing the characteristicsize of each element.

[302.044] – Univ. Assist. MSc. Francesco Romanò 5/13

Page 11: [302.044] Numerical Methods in Fluid Dynamics 2–D Lid ...info.tuwien.ac.at/ViennaOpenFOAMUserGroup/NumOpenFOAM_P03.pdf · Cavity icoFoam Meshing Solverset-up Mesh Refinement SolverRe-initialization

IncompressibleNavier–Stokes

Lid–DrivenCavity

icoFoamMeshingSolver set-upMeshRefinementSolver Re-initializationPISOAlgorithm

Lid–Driven CavityOpenFOAM icoFoam solver

OpenFOAM icoFoam solver. icoFoam assumes an incompressible, unsteady flow and

ignores gravity, but it can be also set as a steady solver;

. Because, in general, an exact solution of the analyzedproblems is not known, it is not possible to analyticallyvalidate the code. That is the case in which experimentaldata can be used as benchmark;

. Another way to “validate” the code is to increase the cellssize showing a consistent decrement of the approximationerror. If the Lax’ theorem is applicable, the discrete solutionconverges to the exact one decreasing the characteristicsize of each element.

[302.044] – Univ. Assist. MSc. Francesco Romanò 5/13

Page 12: [302.044] Numerical Methods in Fluid Dynamics 2–D Lid ...info.tuwien.ac.at/ViennaOpenFOAMUserGroup/NumOpenFOAM_P03.pdf · Cavity icoFoam Meshing Solverset-up Mesh Refinement SolverRe-initialization

IncompressibleNavier–Stokes

Lid–DrivenCavity

icoFoamMeshingSolver set-upMeshRefinementSolver Re-initializationPISOAlgorithm

Lid–Driven CavityOpenFOAM icoFoam solver

OpenFOAM icoFoam solver: Meshing

. At first, an evenly distributed, orthogonal mesh is used;

. Because the problem to solve is a 2–D case, inblockMeshDict an arbitrary thickness is given in z directionand empty is used for the faces having as normal vector k;

. For a coarse grid set-up, the number of cells will beNx = 20 , Ny = 20 (and Nz = 1);

. Algorithm steps:

◦ create the geometry writing the blockMeshDict file andlocating 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.

[302.044] – Univ. Assist. MSc. Francesco Romanò 6/13

Page 13: [302.044] Numerical Methods in Fluid Dynamics 2–D Lid ...info.tuwien.ac.at/ViennaOpenFOAMUserGroup/NumOpenFOAM_P03.pdf · Cavity icoFoam Meshing Solverset-up Mesh Refinement SolverRe-initialization

IncompressibleNavier–Stokes

Lid–DrivenCavity

icoFoamMeshingSolver set-upMeshRefinementSolver Re-initializationPISOAlgorithm

Lid–Driven CavityOpenFOAM icoFoam solver

OpenFOAM icoFoam solver: Meshing. At first, an evenly distributed, orthogonal mesh is used;

. Because the problem to solve is a 2–D case, inblockMeshDict an arbitrary thickness is given in z directionand empty is used for the faces having as normal vector k;

. For a coarse grid set-up, the number of cells will beNx = 20 , Ny = 20 (and Nz = 1);

. Algorithm steps:

◦ create the geometry writing the blockMeshDict file andlocating 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.

[302.044] – Univ. Assist. MSc. Francesco Romanò 6/13

Page 14: [302.044] Numerical Methods in Fluid Dynamics 2–D Lid ...info.tuwien.ac.at/ViennaOpenFOAMUserGroup/NumOpenFOAM_P03.pdf · Cavity icoFoam Meshing Solverset-up Mesh Refinement SolverRe-initialization

IncompressibleNavier–Stokes

Lid–DrivenCavity

icoFoamMeshingSolver set-upMeshRefinementSolver Re-initializationPISOAlgorithm

Lid–Driven CavityOpenFOAM icoFoam solver

OpenFOAM icoFoam solver: Meshing. At first, an evenly distributed, orthogonal mesh is used;

. Because the problem to solve is a 2–D case, inblockMeshDict an arbitrary thickness is given in z directionand empty is used for the faces having as normal vector k;

. For a coarse grid set-up, the number of cells will beNx = 20 , Ny = 20 (and Nz = 1);

. Algorithm steps:

◦ create the geometry writing the blockMeshDict file andlocating 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.

[302.044] – Univ. Assist. MSc. Francesco Romanò 6/13

Page 15: [302.044] Numerical Methods in Fluid Dynamics 2–D Lid ...info.tuwien.ac.at/ViennaOpenFOAMUserGroup/NumOpenFOAM_P03.pdf · Cavity icoFoam Meshing Solverset-up Mesh Refinement SolverRe-initialization

IncompressibleNavier–Stokes

Lid–DrivenCavity

icoFoamMeshingSolver set-upMeshRefinementSolver Re-initializationPISOAlgorithm

Lid–Driven CavityOpenFOAM icoFoam solver

OpenFOAM icoFoam solver: Meshing. At first, an evenly distributed, orthogonal mesh is used;

. Because the problem to solve is a 2–D case, inblockMeshDict an arbitrary thickness is given in z directionand empty is used for the faces having as normal vector k;

. For a coarse grid set-up, the number of cells will beNx = 20 , Ny = 20 (and Nz = 1);

. Algorithm steps:

◦ create the geometry writing the blockMeshDict file andlocating 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.

[302.044] – Univ. Assist. MSc. Francesco Romanò 6/13

Page 16: [302.044] Numerical Methods in Fluid Dynamics 2–D Lid ...info.tuwien.ac.at/ViennaOpenFOAMUserGroup/NumOpenFOAM_P03.pdf · Cavity icoFoam Meshing Solverset-up Mesh Refinement SolverRe-initialization

IncompressibleNavier–Stokes

Lid–DrivenCavity

icoFoamMeshingSolver set-upMeshRefinementSolver Re-initializationPISOAlgorithm

Lid–Driven CavityOpenFOAM icoFoam solver

OpenFOAM icoFoam solver: Meshing. At first, an evenly distributed, orthogonal mesh is used;

. Because the problem to solve is a 2–D case, inblockMeshDict an arbitrary thickness is given in z directionand empty is used for the faces having as normal vector k;

. For a coarse grid set-up, the number of cells will beNx = 20 , Ny = 20 (and Nz = 1);

. Algorithm steps:

◦ create the geometry writing the blockMeshDict file andlocating 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.

[302.044] – Univ. Assist. MSc. Francesco Romanò 6/13

Page 17: [302.044] Numerical Methods in Fluid Dynamics 2–D Lid ...info.tuwien.ac.at/ViennaOpenFOAMUserGroup/NumOpenFOAM_P03.pdf · Cavity icoFoam Meshing Solverset-up Mesh Refinement SolverRe-initialization

IncompressibleNavier–Stokes

Lid–DrivenCavity

icoFoamMeshingSolver set-upMeshRefinementSolver Re-initializationPISOAlgorithm

Lid–Driven CavityOpenFOAM icoFoam solver

OpenFOAM icoFoam solver: Meshing. At first, an evenly distributed, orthogonal mesh is used;

. Because the problem to solve is a 2–D case, inblockMeshDict an arbitrary thickness is given in z directionand empty is used for the faces having as normal vector k;

. For a coarse grid set-up, the number of cells will beNx = 20 , Ny = 20 (and Nz = 1);

. Algorithm steps:

◦ create the geometry writing the blockMeshDict file andlocating 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.

[302.044] – Univ. Assist. MSc. Francesco Romanò 6/13

Page 18: [302.044] Numerical Methods in Fluid Dynamics 2–D Lid ...info.tuwien.ac.at/ViennaOpenFOAMUserGroup/NumOpenFOAM_P03.pdf · Cavity icoFoam Meshing Solverset-up Mesh Refinement SolverRe-initialization

IncompressibleNavier–Stokes

Lid–DrivenCavity

icoFoamMeshingSolver set-upMeshRefinementSolver Re-initializationPISOAlgorithm

Lid–Driven CavityOpenFOAM icoFoam solver

OpenFOAM icoFoam solver: Meshing. At first, an evenly distributed, orthogonal mesh is used;

. Because the problem to solve is a 2–D case, inblockMeshDict an arbitrary thickness is given in z directionand empty is used for the faces having as normal vector k;

. For a coarse grid set-up, the number of cells will beNx = 20 , Ny = 20 (and Nz = 1);

. Algorithm steps:

◦ create the geometry writing the blockMeshDict file andlocating 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.

[302.044] – Univ. Assist. MSc. Francesco Romanò 6/13

Page 19: [302.044] Numerical Methods in Fluid Dynamics 2–D Lid ...info.tuwien.ac.at/ViennaOpenFOAMUserGroup/NumOpenFOAM_P03.pdf · Cavity icoFoam Meshing Solverset-up Mesh Refinement SolverRe-initialization

IncompressibleNavier–Stokes

Lid–DrivenCavity

icoFoamMeshingSolver set-upMeshRefinementSolver Re-initializationPISOAlgorithm

Lid–Driven CavityOpenFOAM icoFoam solver

OpenFOAM icoFoam solver: Meshing. At first, an evenly distributed, orthogonal mesh is used;

. Because the problem to solve is a 2–D case, inblockMeshDict an arbitrary thickness is given in z directionand empty is used for the faces having as normal vector k;

. For a coarse grid set-up, the number of cells will beNx = 20 , Ny = 20 (and Nz = 1);

. Algorithm steps:

◦ create the geometry writing the blockMeshDict file andlocating 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 theWireframe visualization option.

[302.044] – Univ. Assist. MSc. Francesco Romanò 6/13

Page 20: [302.044] Numerical Methods in Fluid Dynamics 2–D Lid ...info.tuwien.ac.at/ViennaOpenFOAMUserGroup/NumOpenFOAM_P03.pdf · Cavity icoFoam Meshing Solverset-up Mesh Refinement SolverRe-initialization

IncompressibleNavier–Stokes

Lid–DrivenCavity

icoFoamMeshingSolver set-upMeshRefinementSolver Re-initializationPISOAlgorithm

Lid–Driven CavityOpenFOAM icoFoam solver

OpenFOAM icoFoam solver: Meshing. At first, an evenly distributed, orthogonal mesh is used;

. Because the problem to solve is a 2–D case, inblockMeshDict an arbitrary thickness is given in z directionand empty is used for the faces having as normal vector k;

. For a coarse grid set-up, the number of cells will beNx = 20 , Ny = 20 (and Nz = 1);

. Algorithm steps:

◦ create the geometry writing the blockMeshDict file andlocating 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.

[302.044] – Univ. Assist. MSc. Francesco Romanò 6/13

Page 21: [302.044] Numerical Methods in Fluid Dynamics 2–D Lid ...info.tuwien.ac.at/ViennaOpenFOAMUserGroup/NumOpenFOAM_P03.pdf · Cavity icoFoam Meshing Solverset-up Mesh Refinement SolverRe-initialization

IncompressibleNavier–Stokes

Lid–DrivenCavity

icoFoamMeshingSolver set-upMeshRefinementSolver Re-initializationPISOAlgorithm

Lid–Driven CavityOpenFOAM icoFoam solver

OpenFOAM icoFoam solver: solver set-up

. For an incompressible, viscous flow, considering a laminarregime, the only fluid property to specify is the kinematicviscosity (in transportProperties);

. In writing the controlDict file, the setted ∆t should takeinto account numerical stability limits;

. Because the employed grid is Orthogonal, the flagnNonOrthogonalCorrectors in fvSolution is set to 0;

. Starting from resting, homogeneous flow, homogeneousinitial conditions are stored for p and U in the folder<problem_folder>/0/.

[302.044] – Univ. Assist. MSc. Francesco Romanò 7/13

Page 22: [302.044] Numerical Methods in Fluid Dynamics 2–D Lid ...info.tuwien.ac.at/ViennaOpenFOAMUserGroup/NumOpenFOAM_P03.pdf · Cavity icoFoam Meshing Solverset-up Mesh Refinement SolverRe-initialization

IncompressibleNavier–Stokes

Lid–DrivenCavity

icoFoamMeshingSolver set-upMeshRefinementSolver Re-initializationPISOAlgorithm

Lid–Driven CavityOpenFOAM icoFoam solver

OpenFOAM icoFoam solver: solver set-up. For an incompressible, viscous flow, considering a laminar

regime, the only fluid property to specify is the kinematicviscosity (in transportProperties);

. In writing the controlDict file, the setted ∆t should takeinto account numerical stability limits;

. Because the employed grid is Orthogonal, the flagnNonOrthogonalCorrectors in fvSolution is set to 0;

. Starting from resting, homogeneous flow, homogeneousinitial conditions are stored for p and U in the folder<problem_folder>/0/.

[302.044] – Univ. Assist. MSc. Francesco Romanò 7/13

Page 23: [302.044] Numerical Methods in Fluid Dynamics 2–D Lid ...info.tuwien.ac.at/ViennaOpenFOAMUserGroup/NumOpenFOAM_P03.pdf · Cavity icoFoam Meshing Solverset-up Mesh Refinement SolverRe-initialization

IncompressibleNavier–Stokes

Lid–DrivenCavity

icoFoamMeshingSolver set-upMeshRefinementSolver Re-initializationPISOAlgorithm

Lid–Driven CavityOpenFOAM icoFoam solver

OpenFOAM icoFoam solver: solver set-up. For an incompressible, viscous flow, considering a laminar

regime, the only fluid property to specify is the kinematicviscosity (in transportProperties);

. In writing the controlDict file, the setted ∆t should takeinto account numerical stability limits;

. Because the employed grid is Orthogonal, the flagnNonOrthogonalCorrectors in fvSolution is set to 0;

. Starting from resting, homogeneous flow, homogeneousinitial conditions are stored for p and U in the folder<problem_folder>/0/.

[302.044] – Univ. Assist. MSc. Francesco Romanò 7/13

Page 24: [302.044] Numerical Methods in Fluid Dynamics 2–D Lid ...info.tuwien.ac.at/ViennaOpenFOAMUserGroup/NumOpenFOAM_P03.pdf · Cavity icoFoam Meshing Solverset-up Mesh Refinement SolverRe-initialization

IncompressibleNavier–Stokes

Lid–DrivenCavity

icoFoamMeshingSolver set-upMeshRefinementSolver Re-initializationPISOAlgorithm

Lid–Driven CavityOpenFOAM icoFoam solver

OpenFOAM icoFoam solver: solver set-up. For an incompressible, viscous flow, considering a laminar

regime, the only fluid property to specify is the kinematicviscosity (in transportProperties);

. In writing the controlDict file, the setted ∆t should takeinto account numerical stability limits;

. Because the employed grid is Orthogonal, the flagnNonOrthogonalCorrectors in fvSolution is set to 0;

. Starting from resting, homogeneous flow, homogeneousinitial conditions are stored for p and U in the folder<problem_folder>/0/.

[302.044] – Univ. Assist. MSc. Francesco Romanò 7/13

Page 25: [302.044] Numerical Methods in Fluid Dynamics 2–D Lid ...info.tuwien.ac.at/ViennaOpenFOAMUserGroup/NumOpenFOAM_P03.pdf · Cavity icoFoam Meshing Solverset-up Mesh Refinement SolverRe-initialization

IncompressibleNavier–Stokes

Lid–DrivenCavity

icoFoamMeshingSolver set-upMeshRefinementSolver Re-initializationPISOAlgorithm

Lid–Driven CavityOpenFOAM icoFoam solver

OpenFOAM icoFoam solver: solver set-up. For an incompressible, viscous flow, considering a laminar

regime, the only fluid property to specify is the kinematicviscosity (in transportProperties);

. In writing the controlDict file, the setted ∆t should takeinto account numerical stability limits;

. Because the employed grid is Orthogonal, the flagnNonOrthogonalCorrectors in fvSolution is set to 0;

. Starting from resting, homogeneous flow, homogeneousinitial conditions are stored for p and U in the folder<problem_folder>/0/.

[302.044] – Univ. Assist. MSc. Francesco Romanò 7/13

Page 26: [302.044] Numerical Methods in Fluid Dynamics 2–D Lid ...info.tuwien.ac.at/ViennaOpenFOAMUserGroup/NumOpenFOAM_P03.pdf · Cavity icoFoam Meshing Solverset-up Mesh Refinement SolverRe-initialization

IncompressibleNavier–Stokes

Lid–DrivenCavity

icoFoamMeshingSolver set-upMeshRefinementSolver Re-initializationPISOAlgorithm

Lid–Driven CavityOpenFOAM icoFoam solver

OpenFOAM icoFoam solver: solver set-up

. Algorithm steps:◦ set the fluid properties in transportProperties

file and locating it in <problem_folder>/constant/;◦ set the initial conditions writing the p and U files and

locating them in <problem_folder>/0/;◦ set time step and data saving/storing options writing

the controlDict file and locating it in<problem_folder>/system/;

◦ set discretization and splitting scheme details writingthe fvSchemes and fvSolution files and locating themin <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

Page 27: [302.044] Numerical Methods in Fluid Dynamics 2–D Lid ...info.tuwien.ac.at/ViennaOpenFOAMUserGroup/NumOpenFOAM_P03.pdf · Cavity icoFoam Meshing Solverset-up Mesh Refinement SolverRe-initialization

IncompressibleNavier–Stokes

Lid–DrivenCavity

icoFoamMeshingSolver set-upMeshRefinementSolver Re-initializationPISOAlgorithm

Lid–Driven CavityOpenFOAM icoFoam solver

OpenFOAM icoFoam solver: solver set-up. Algorithm steps:

◦ set the fluid properties in transportPropertiesfile and locating it in <problem_folder>/constant/;

◦ set the initial conditions writing the p and U files andlocating them in <problem_folder>/0/;

◦ set time step and data saving/storing options writingthe controlDict file and locating it in<problem_folder>/system/;

◦ set discretization and splitting scheme details writingthe fvSchemes and fvSolution files and locating themin <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

Page 28: [302.044] Numerical Methods in Fluid Dynamics 2–D Lid ...info.tuwien.ac.at/ViennaOpenFOAMUserGroup/NumOpenFOAM_P03.pdf · Cavity icoFoam Meshing Solverset-up Mesh Refinement SolverRe-initialization

IncompressibleNavier–Stokes

Lid–DrivenCavity

icoFoamMeshingSolver set-upMeshRefinementSolver Re-initializationPISOAlgorithm

Lid–Driven CavityOpenFOAM icoFoam solver

OpenFOAM icoFoam solver: solver set-up. Algorithm steps:◦ set the fluid properties in transportProperties

file and locating it in <problem_folder>/constant/;

◦ set the initial conditions writing the p and U files andlocating them in <problem_folder>/0/;

◦ set time step and data saving/storing options writingthe controlDict file and locating it in<problem_folder>/system/;

◦ set discretization and splitting scheme details writingthe fvSchemes and fvSolution files and locating themin <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

Page 29: [302.044] Numerical Methods in Fluid Dynamics 2–D Lid ...info.tuwien.ac.at/ViennaOpenFOAMUserGroup/NumOpenFOAM_P03.pdf · Cavity icoFoam Meshing Solverset-up Mesh Refinement SolverRe-initialization

IncompressibleNavier–Stokes

Lid–DrivenCavity

icoFoamMeshingSolver set-upMeshRefinementSolver Re-initializationPISOAlgorithm

Lid–Driven CavityOpenFOAM icoFoam solver

OpenFOAM icoFoam solver: solver set-up. Algorithm steps:◦ set the fluid properties in transportProperties

file and locating it in <problem_folder>/constant/;◦ set the initial conditions writing the p and U files and

locating them in <problem_folder>/0/;

◦ set time step and data saving/storing options writingthe controlDict file and locating it in<problem_folder>/system/;

◦ set discretization and splitting scheme details writingthe fvSchemes and fvSolution files and locating themin <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

Page 30: [302.044] Numerical Methods in Fluid Dynamics 2–D Lid ...info.tuwien.ac.at/ViennaOpenFOAMUserGroup/NumOpenFOAM_P03.pdf · Cavity icoFoam Meshing Solverset-up Mesh Refinement SolverRe-initialization

IncompressibleNavier–Stokes

Lid–DrivenCavity

icoFoamMeshingSolver set-upMeshRefinementSolver Re-initializationPISOAlgorithm

Lid–Driven CavityOpenFOAM icoFoam solver

OpenFOAM icoFoam solver: solver set-up. Algorithm steps:◦ set the fluid properties in transportProperties

file and locating it in <problem_folder>/constant/;◦ set the initial conditions writing the p and U files and

locating them in <problem_folder>/0/;◦ set time step and data saving/storing options writing

the controlDict file and locating it in<problem_folder>/system/;

◦ set discretization and splitting scheme details writingthe fvSchemes and fvSolution files and locating themin <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

Page 31: [302.044] Numerical Methods in Fluid Dynamics 2–D Lid ...info.tuwien.ac.at/ViennaOpenFOAMUserGroup/NumOpenFOAM_P03.pdf · Cavity icoFoam Meshing Solverset-up Mesh Refinement SolverRe-initialization

IncompressibleNavier–Stokes

Lid–DrivenCavity

icoFoamMeshingSolver set-upMeshRefinementSolver Re-initializationPISOAlgorithm

Lid–Driven CavityOpenFOAM icoFoam solver

OpenFOAM icoFoam solver: solver set-up. Algorithm steps:◦ set the fluid properties in transportProperties

file and locating it in <problem_folder>/constant/;◦ set the initial conditions writing the p and U files and

locating them in <problem_folder>/0/;◦ set time step and data saving/storing options writing

the controlDict file and locating it in<problem_folder>/system/;

◦ set discretization and splitting scheme details writingthe fvSchemes and fvSolution files and locating themin <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

Page 32: [302.044] Numerical Methods in Fluid Dynamics 2–D Lid ...info.tuwien.ac.at/ViennaOpenFOAMUserGroup/NumOpenFOAM_P03.pdf · Cavity icoFoam Meshing Solverset-up Mesh Refinement SolverRe-initialization

IncompressibleNavier–Stokes

Lid–DrivenCavity

icoFoamMeshingSolver set-upMeshRefinementSolver Re-initializationPISOAlgorithm

Lid–Driven CavityOpenFOAM icoFoam solver

OpenFOAM icoFoam solver: solver set-up. Algorithm steps:◦ set the fluid properties in transportProperties

file and locating it in <problem_folder>/constant/;◦ set the initial conditions writing the p and U files and

locating them in <problem_folder>/0/;◦ set time step and data saving/storing options writing

the controlDict file and locating it in<problem_folder>/system/;

◦ set discretization and splitting scheme details writingthe fvSchemes and fvSolution files and locating themin <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

Page 33: [302.044] Numerical Methods in Fluid Dynamics 2–D Lid ...info.tuwien.ac.at/ViennaOpenFOAMUserGroup/NumOpenFOAM_P03.pdf · Cavity icoFoam Meshing Solverset-up Mesh Refinement SolverRe-initialization

IncompressibleNavier–Stokes

Lid–DrivenCavity

icoFoamMeshingSolver set-upMeshRefinementSolver Re-initializationPISOAlgorithm

Lid–Driven CavityOpenFOAM icoFoam solver

OpenFOAM icoFoam solver: solver set-up. Algorithm steps:◦ set the fluid properties in transportProperties

file and locating it in <problem_folder>/constant/;◦ set the initial conditions writing the p and U files and

locating them in <problem_folder>/0/;◦ set time step and data saving/storing options writing

the controlDict file and locating it in<problem_folder>/system/;

◦ set discretization and splitting scheme details writingthe fvSchemes and fvSolution files and locating themin <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

Page 34: [302.044] Numerical Methods in Fluid Dynamics 2–D Lid ...info.tuwien.ac.at/ViennaOpenFOAMUserGroup/NumOpenFOAM_P03.pdf · Cavity icoFoam Meshing Solverset-up Mesh Refinement SolverRe-initialization

IncompressibleNavier–Stokes

Lid–DrivenCavity

icoFoamMeshingSolver set-upMeshRefinementSolver Re-initializationPISOAlgorithm

Lid–Driven CavityOpenFOAM icoFoam solver

OpenFOAM icoFoam solver: solver set-up. Case folder structure:

→ <problem_folder>/→ 0/

Up

→ constant/transportProperties→ polyMesh/

blockMeshDict→ system/

controlDictfvSchemesfvSolution

[302.044] – Univ. Assist. MSc. Francesco Romanò 9/13

Page 35: [302.044] Numerical Methods in Fluid Dynamics 2–D Lid ...info.tuwien.ac.at/ViennaOpenFOAMUserGroup/NumOpenFOAM_P03.pdf · Cavity icoFoam Meshing Solverset-up Mesh Refinement SolverRe-initialization

IncompressibleNavier–Stokes

Lid–DrivenCavity

icoFoamMeshingSolver set-upMeshRefinementSolver Re-initializationPISOAlgorithm

Lid–Driven CavityOpenFOAM icoFoam solver

OpenFOAM icoFoam solver: Mesh Refinement. As second try, because of the solution characteristics, a

better result can be obtained refining the mesh in thefour corners of the cavity;

. To proceed, the blockMeshDict file will consist of fourblocks whose simple grading will be used to cluster thenodes nearby the domain corners:

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)

);

[302.044] – Univ. Assist. MSc. Francesco Romanò 10/13

Page 36: [302.044] Numerical Methods in Fluid Dynamics 2–D Lid ...info.tuwien.ac.at/ViennaOpenFOAMUserGroup/NumOpenFOAM_P03.pdf · Cavity icoFoam Meshing Solverset-up Mesh Refinement SolverRe-initialization

IncompressibleNavier–Stokes

Lid–DrivenCavity

icoFoamMeshingSolver set-upMeshRefinementSolver Re-initializationPISOAlgorithm

Lid–Driven CavityOpenFOAM icoFoam solver

OpenFOAM icoFoam solver: solver re-initialization. The set-up used for the solver in the case of a uniform mesh

can be kept unchanged;

. The only necessary changing is in writing the controlDictfile. The selected ∆t should take into account numericalstability limits relative to the new mesh;

. As initial condition, the solution of the previous simulationcan be used mapping it on the current grid:

mapFields <folder to map from> -consistent

. As initial time, the final one of the prevoius solution is set.

[302.044] – Univ. Assist. MSc. Francesco Romanò 11/13

Page 37: [302.044] Numerical Methods in Fluid Dynamics 2–D Lid ...info.tuwien.ac.at/ViennaOpenFOAMUserGroup/NumOpenFOAM_P03.pdf · Cavity icoFoam Meshing Solverset-up Mesh Refinement SolverRe-initialization

IncompressibleNavier–Stokes

Lid–DrivenCavity

icoFoamMeshingSolver set-upMeshRefinementSolver Re-initializationPISOAlgorithm

Lid–Driven CavityOpenFOAM icoFoam solver

OpenFOAM icoFoam solver: solver set-up

. Algorithm steps:

◦ copy the previous results in an old problem folder:<problem_folder_Old>;

◦ set the new blockMeshDict and controlDict;◦ create the new mesh with the command

<problem_folder>/blockMesh;◦ 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.

[302.044] – Univ. Assist. MSc. Francesco Romanò 12/13

Page 38: [302.044] Numerical Methods in Fluid Dynamics 2–D Lid ...info.tuwien.ac.at/ViennaOpenFOAMUserGroup/NumOpenFOAM_P03.pdf · Cavity icoFoam Meshing Solverset-up Mesh Refinement SolverRe-initialization

IncompressibleNavier–Stokes

Lid–DrivenCavity

icoFoamMeshingSolver set-upMeshRefinementSolver Re-initializationPISOAlgorithm

Lid–Driven CavityOpenFOAM icoFoam solver

OpenFOAM icoFoam solver: solver set-up. Algorithm steps:

◦ copy the previous results in an old problem folder:<problem_folder_Old>;

◦ set the new blockMeshDict and controlDict;◦ create the new mesh with the command

<problem_folder>/blockMesh;◦ 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.

[302.044] – Univ. Assist. MSc. Francesco Romanò 12/13

Page 39: [302.044] Numerical Methods in Fluid Dynamics 2–D Lid ...info.tuwien.ac.at/ViennaOpenFOAMUserGroup/NumOpenFOAM_P03.pdf · Cavity icoFoam Meshing Solverset-up Mesh Refinement SolverRe-initialization

IncompressibleNavier–Stokes

Lid–DrivenCavity

icoFoamMeshingSolver set-upMeshRefinementSolver Re-initializationPISOAlgorithm

Lid–Driven CavityOpenFOAM icoFoam solver

OpenFOAM icoFoam solver: solver set-up. Algorithm steps:

◦ copy the previous results in an old problem folder:<problem_folder_Old>;

◦ set the new blockMeshDict and controlDict;◦ create the new mesh with the command

<problem_folder>/blockMesh;◦ 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.

[302.044] – Univ. Assist. MSc. Francesco Romanò 12/13

Page 40: [302.044] Numerical Methods in Fluid Dynamics 2–D Lid ...info.tuwien.ac.at/ViennaOpenFOAMUserGroup/NumOpenFOAM_P03.pdf · Cavity icoFoam Meshing Solverset-up Mesh Refinement SolverRe-initialization

IncompressibleNavier–Stokes

Lid–DrivenCavity

icoFoamMeshingSolver set-upMeshRefinementSolver Re-initializationPISOAlgorithm

Lid–Driven CavityOpenFOAM icoFoam solver

OpenFOAM icoFoam solver: solver set-up. Algorithm steps:

◦ copy the previous results in an old problem folder:<problem_folder_Old>;

◦ set the new blockMeshDict and controlDict;

◦ create the new mesh with the command<problem_folder>/blockMesh;

◦ 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.

[302.044] – Univ. Assist. MSc. Francesco Romanò 12/13

Page 41: [302.044] Numerical Methods in Fluid Dynamics 2–D Lid ...info.tuwien.ac.at/ViennaOpenFOAMUserGroup/NumOpenFOAM_P03.pdf · Cavity icoFoam Meshing Solverset-up Mesh Refinement SolverRe-initialization

IncompressibleNavier–Stokes

Lid–DrivenCavity

icoFoamMeshingSolver set-upMeshRefinementSolver Re-initializationPISOAlgorithm

Lid–Driven CavityOpenFOAM icoFoam solver

OpenFOAM icoFoam solver: solver set-up. Algorithm steps:

◦ copy the previous results in an old problem folder:<problem_folder_Old>;

◦ set the new blockMeshDict and controlDict;◦ create the new mesh with the command

<problem_folder>/blockMesh;

◦ 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.

[302.044] – Univ. Assist. MSc. Francesco Romanò 12/13

Page 42: [302.044] Numerical Methods in Fluid Dynamics 2–D Lid ...info.tuwien.ac.at/ViennaOpenFOAMUserGroup/NumOpenFOAM_P03.pdf · Cavity icoFoam Meshing Solverset-up Mesh Refinement SolverRe-initialization

IncompressibleNavier–Stokes

Lid–DrivenCavity

icoFoamMeshingSolver set-upMeshRefinementSolver Re-initializationPISOAlgorithm

Lid–Driven CavityOpenFOAM icoFoam solver

OpenFOAM icoFoam solver: solver set-up. Algorithm steps:

◦ copy the previous results in an old problem folder:<problem_folder_Old>;

◦ set the new blockMeshDict and controlDict;◦ create the new mesh with the command

<problem_folder>/blockMesh;◦ 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.

[302.044] – Univ. Assist. MSc. Francesco Romanò 12/13

Page 43: [302.044] Numerical Methods in Fluid Dynamics 2–D Lid ...info.tuwien.ac.at/ViennaOpenFOAMUserGroup/NumOpenFOAM_P03.pdf · Cavity icoFoam Meshing Solverset-up Mesh Refinement SolverRe-initialization

IncompressibleNavier–Stokes

Lid–DrivenCavity

icoFoamMeshingSolver set-upMeshRefinementSolver Re-initializationPISOAlgorithm

Lid–Driven CavityOpenFOAM icoFoam solver

OpenFOAM icoFoam solver: solver set-up. Algorithm steps:

◦ copy the previous results in an old problem folder:<problem_folder_Old>;

◦ set the new blockMeshDict and controlDict;◦ create the new mesh with the command

<problem_folder>/blockMesh;◦ 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.

[302.044] – Univ. Assist. MSc. Francesco Romanò 12/13

Page 44: [302.044] Numerical Methods in Fluid Dynamics 2–D Lid ...info.tuwien.ac.at/ViennaOpenFOAMUserGroup/NumOpenFOAM_P03.pdf · Cavity icoFoam Meshing Solverset-up Mesh Refinement SolverRe-initialization

IncompressibleNavier–Stokes

Lid–DrivenCavity

icoFoamMeshingSolver set-upMeshRefinementSolver Re-initializationPISOAlgorithm

Lid–Driven CavityOpenFOAM icoFoam solver

OpenFOAM icoFoam solver: solver set-up. Algorithm steps:

◦ copy the previous results in an old problem folder:<problem_folder_Old>;

◦ set the new blockMeshDict and controlDict;◦ create the new mesh with the command

<problem_folder>/blockMesh;◦ 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.

[302.044] – Univ. Assist. MSc. Francesco Romanò 12/13

Page 45: [302.044] Numerical Methods in Fluid Dynamics 2–D Lid ...info.tuwien.ac.at/ViennaOpenFOAMUserGroup/NumOpenFOAM_P03.pdf · Cavity icoFoam Meshing Solverset-up Mesh Refinement SolverRe-initialization

IncompressibleNavier–Stokes

Lid–DrivenCavity

icoFoamMeshingSolver set-upMeshRefinementSolver Re-initializationPISOAlgorithm

Lid–Driven CavityOpenFOAM icoFoam solver

OpenFOAM icoFoam solver: PISO algorithm

[302.044] – Univ. Assist. MSc. Francesco Romanò 13/13