Slides
Slides
February 2022
1
Copyright and disclaimer
This offering is not approved or endorsed by OpenCFD Limited, the producer of the
OpenFOAM software and owner of the OPENFOAM® and OpenCFD® trademarks.
Wolf Dynamics makes no warranty, express or implied, about the completeness, accuracy,
reliability, suitability, or usefulness of the information disclosed in this training material. This
training material is intended to provide general information only. Any reliance the final user
place on this training material is therefore strictly at his/her own risk. Under no
circumstances and under no legal theory shall Wolf Dynamics be liable for any loss, damage
or injury, arising directly or indirectly from the use or misuse of the information contained in
this training material.
Revision 1-2022
JG 2
Before we begin
On the training material
• This training is based on OpenFOAM 9 and OpenFOAM 2106 or newer (for overset meshes).
• In the USB key/downloaded files you will find all the training material (tutorials, slides, and lectures notes).
• You can extract the training material wherever you want. From now on, this directory will become:
• $TM
(abbreviation of Training Material)
• To uncompress the tutorials go to the directory where you copied the training material ($TM) and then type in
the terminal,
• $> tar –zxvf file_name.tar.gz
• In the case directory of every single tutorial, you will find a few scripts with the extension .sh, namely,
run_all.sh, run_mesh.sh, run_sampling.sh, run_solver.sh, and so on.
• These scripts can be used to run the case automatically by typing in the terminal, for example,
• $> sh run_all.sh
• These scripts are human-readable, and we highly recommend you open them, get familiar with the steps, and
type the commands in the terminal. In this way, you will get used with the command line interface and
OpenFOAM commands.
• If you are already comfortable with OpenFOAM, run the cases automatically using these scripts.
• In the case directory, you will also find the README.FIRST file. In this file, you will find some additional
comments.
3
Conventions used
The following typographical conventions are used in this training material
• Text in Courier new font indicates Linux commands that should be typed literally by the user
in the terminal.
• Text in Courier new bold font indicates directories.
• Text in Courier new italic font indicates human readable files or ascii files.
• Text in Arial bold font indicates program elements such as variables, function names, classes,
statements and so on. It also indicates environment variables, and keywords. They also
highlight important information.
• Text in Arial underline in blue font indicates URLs and email addresses.
• This icon indicates a warning or a caution.
• This icon indicates a tip, suggestion, or a general note.
• This icon indicates a folder or directory.
• This icon indicates a human readable file (ascii file).
• This icon indicates that the figure is an animation (animated gif).
• These characters $> indicate that a Linux command should be typed literally by the user in the
terminal.
4
Conventions used
The following typographical conventions are used in this training material
• Large code listing, ascii files listing, and screen outputs can be written in a square box, as
follows:
1 #include <iostream>
2 using namespace std;
3
4 // main() is where program execution begins. It is the main function.
5 // Every program in c++ must have this main function declared
6
7 int main ()
8 {
9 cout << "Hello world"; //prints Hello world
10 return 0; //returns nothing
11 }
6
Roadmap
7
Introduction – What are dynamic meshes?
What are dynamic meshes?
• Dynamic meshes are models that allows the mesh to change during a simulation.
• The changes of the mesh can be due to a prescribed motion, rigid body motion, fluid structure
interaction or refinement/unrefinement.
• In practice, dynamic meshes are compatible with all physical models.
• But you should for check models compatibility and be aware of potential exceptions and
limitations.
• Dynamic meshes can be used to:
• Morph the mesh to accommodate the body motion.
• Add remove new cells according to a criterion.
• Add/remove layers (layering).
• Sliding meshes.
• Interpolate the solution at matching patches.
• Compute the solution in overset meshes.
• Deform bodies.
• Fluid structure interaction (FSI).
8
Introduction – What are dynamic meshes?
What are dynamic meshes?
• In dynamic meshes (specifically when working with moving/deforming bodies), the integral form
of the general transport equation is written as follows,
Mesh velocity
• Also, the boundary condition of the moving/deforming walls takes into account the mesh velocity.
• In the FVM, we want to solve the general transport equation for the transported quantity in a
given domain, with given boundary conditions BC and initial conditions IC.
• As you can see, the only difference with the standard general transport equation is the addition
of the mesh velocity.
• The rest of the FVM formulation remains the same, except for a few considerations related to
the moving mesh, as we will see.
9
NOTE: starting from this equation we can write down the Navier-Stokes equations (NSE).
Introduction – What are dynamic meshes?
What are dynamic meshes?
• In dynamic meshes (specifically when working with moving/deforming bodies), the integral form
of the general transport equation is written as follows,
• Notice that as the mesh changes in dynamic meshes, the volume dV is a function of time.
• This implies that the shape of the cells is changing in time.
• And this might introduce mesh quality problems and discretization issues.
10
NOTE: remember, starting from this equation we can write down the Navier-Stokes equations (NSE).
Introduction – What are dynamic meshes?
What are dynamic meshes?
• Where n and n+1 denote the respective quantity at the current and next time level.
• Therefore, it is important to choose a time-step that does not result in large volume changes
between iterations.
11
Introduction – What are dynamic meshes?
What are dynamic meshes?
• The (n+1) time level volume Vn+1 can be computed as follows (volume update),
• In order to satisfy the grid conservation law GCL (also known as space conservation law and
geometric conservation law), the volume time derivative dV/dt of the control volume can be
computed as follows,
12
Introduction – What are dynamic meshes?
What are dynamic meshes?
• In order to satisfy the grid conservation law GCL (also known as space conservation law and
geometric conservation law), the volume time derivative dV/dt of the control volume can be
computed as follows,
• To avoid stability and accuracy problems due to cell quality (as the cells are changing in time),
the time step should be chosen in such a way that it does not result in large volume changes
between iterations.
13
Introduction – What are dynamic meshes?
A few examples of dynamic meshes in OpenFOAM
http://www.wolfdynamics.com/training/mphase/image2.gif http://www.wolfdynamics.com/training/mphase/image3.gif
14
Introduction – What are dynamic meshes?
A few examples of dynamic meshes in OpenFOAM
http://www.wolfdynamics.com/training/dynamicMeshes/sloshingCylinder.gif
15
Introduction – What are dynamic meshes?
A few examples of dynamic meshes in OpenFOAM
http://www.wolfdynamics.com/training/dynamicMeshes/waveMaker.gif
16
Introduction – What are dynamic meshes?
A few examples of dynamic meshes in OpenFOAM
http://www.wolfdynamics.com/training/dynamicMeshes/meshMotion1 http://www.wolfdynamics.com/training/dynamicMeshes/meshMotion2
17
Introduction – What are dynamic meshes?
A few examples of dynamic meshes in OpenFOAM
http://www.wolfdynamics.com/training/dynamicMeshes/layeringMesh.gif
18
Introduction – What are dynamic meshes?
A few examples of dynamic meshes in OpenFOAM
www.wolfdynamics.com/training/mphase/image8.gif http://www.wolfdynamics.com/training/movingbodies/image13.gif
19
Introduction – What are dynamic meshes?
A few examples of dynamic meshes in OpenFOAM
http://www.wolfdynamics.com/training/dynamicMeshes/sliding_particles.gif
20
Introduction – What are dynamic meshes?
A few examples of dynamic meshes in OpenFOAM
http://www.wolfdynamics.com/training/dynamicMeshes/relativeMotion.gif
21
Introduction – What are dynamic meshes?
A few examples of dynamic meshes in OpenFOAM
http://www.wolfdynamics.com/training/dynamicMeshes/seakeeping.gif 22
Introduction – What are dynamic meshes?
A few examples of dynamic meshes in OpenFOAM
http://www.wolfdynamics.com/training/dynamicMeshes/twisting_column.gif http://www.wolfdynamics.com/training/dynamicMeshes/fish_deforming.gif
23
Introduction – What are dynamic meshes?
A few examples of dynamic meshes in OpenFOAM
Mesh morphing together with mesh remeshing and rigid body motion.
http://www.wolfdynamics.com/training/dynamicMeshes/falling1.gif
http://www.wolfdynamics.com/training/dynamicMeshes/falling2.gif 24
Introduction – What are dynamic meshes?
A few examples of dynamic meshes in OpenFOAM
http://www.wolfdynamics.com/training/dynamicMeshes/overset1.gif
http://www.wolfdynamics.com/training/dynamicMeshes/overset2.gif 25
Introduction – What are dynamic meshes?
A few examples of dynamic meshes in OpenFOAM
http://www.wolfdynamics.com/training/dynamicMeshes/overtake1.gif http://www.wolfdynamics.com/training/dynamicMeshes/overtake2.gif
26
Introduction – What are dynamic meshes?
Dynamic meshes in OpenFOAM
• In OpenFOAM, all dynamic meshes capabilities are controlled by a single dictionary, the
dynamicMeshDict dictionary, which is located in the directory constant.
• Several types of dynamic meshes can be simulated in OpenFOAM, we will address the following
cases:
• Prescribed motion.
• Rigid body motion.
• Sliding meshes.
• Adaptive mesh refinement (AMR).
• Setting moving bodies simulations is not so different from setting cases with fixed meshes.
• The main difference is that if the body is moving, we must assign a motion type to a surface
patch, a cell region, or the whole domain.
• If we are using AMR, we must choose the refinement criterion based in a scalar field.
27
Introduction – What are dynamic meshes?
Dynamic meshes in OpenFOAM
28
Introduction – What are dynamic meshes?
Dynamic meshes in OpenFOAM
29
Introduction – What are dynamic meshes?
Dynamic meshes in OpenFOAM
• To find which solvers work with dynamic meshes, go to the solvers directory by typing sol in the
command line interface. Then type in the terminal:
• $> grep -r dynamicFvMesh.H
The solvers that include the header file dynamicFvMesh.H support dynamic meshes.
30
Introduction – What are dynamic meshes?
Dynamic meshes in OpenFOAM
• To find which solvers work with dynamic meshes, go to the solvers directory by typing sol in the
command line interface. Then type in the terminal:
• $> grep -r dynamicFvMesh.H
The solvers that include the header file dynamicFvMesh.H support dynamic meshes.
31
Introduction – What are dynamic meshes?
Dynamic meshes in OpenFOAM
• You will find the source code of all the mesh motion libraries in the directories:
• OpenFOAM-9/src/dynamicFvMesh
• OpenFOAM-9/src/dynamicMesh
• OpenFOAM-9/src/fvMotionSolver
• OpenFOAM-9/src/rigidBodyDynamics
• OpenFOAM-9/src/rigidBodyMeshMotion
• OpenFOAM-9/src/rigidBodyState
• OpenFOAM-9/src/sixDoFRigidBodyMotion
• OpenFOAM-9/src/sixDoFRigidBodyState
• OpenFOAM-9/src/topoChangerFvMesh
• You will find the source code of the prescribed patch motions in the directory:
• OpenFOAM-9/src/fvMotionSolver/pointPatchFields/derived
32
Introduction – What are dynamic meshes?
Dynamic meshes in OpenFOAM
• You will find the source code of the restraints/constraints of the rigid body motion solvers (6DoF
and rigid body dynamics approaches) in the directory:
• OpenFOAM-9/src/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion
• OpenFOAM-9/src/rigidBodyDynamics
• You will find the source code of the mesh diffusivity models in the directory:
• OpenFOAM-9/src/fvMotionSolver/motionDiffusivity
• You will find the source code of the mesh motion solvers in the directory
• OpenFOAM-9/src/fvMotionSolver/fvMotionSolvers
• If you are using version 2106, you will find the libraries in the same locations, but instead of the
directory OpenFOAM-9, they will be in the directory OpenFOAM-v2106, that is:
• OpenFOAM-v2106/src/...
33
Introduction – What are dynamic meshes?
Dynamic meshes in OpenFOAM
http://www.wolfdynamics.com/training/dynamicMeshes/overset3.gif 34
Introduction – What are dynamic meshes?
A short note on the numerics required for dynamic meshes in OpenFOAM
• Dynamic meshes have tighter stability and accuracy requirements than static meshes.
• During simulations with moving bodies, the boundaries/mesh/domain will experience strong
instantaneous accelerations, large displacements/deformations, and fluctuations in
linear/angular velocities.
• This requires the use of a robust and accurate numerics.
• During AMR simulations, the meshes will change, cells will become smaller and smaller (hence
cell’s volume). Therefore, the CFL number will change from refinement level to refinement level.
• Again, this requires the use of a robust and accurate numerics.
• It is extremely important to control the CFL number and be sure that it remains constant within
the limits of stability.
• It is also recommended to always monitor the mesh quality when dealing with morphing meshes
and adjust the numerical method accordingly.
• No need to say that dynamic meshes are intrinsically unsteady.
• However, you might get your way around using LTS (pseudo-transient simulations).
• Simulations with dynamics meshes are computationally expensive and very time consuming.
35
Introduction – What are dynamic meshes?
A short note on the numerics required for dynamic meshes in OpenFOAM
• For the fvSolution dictionary:
nNonOrthogonalCorrectors 1;
correctPhi yes;
36
Introduction – What are dynamic meshes?
A short note on the numerics required for dynamic meshes in OpenFOAM
• For the fvSolution dictionary:
nCorrector 3;
• It is recommended to do at least 1 corrector
step.
• Increase the value to at least 2 for bad
nNonOrthogonalCorrectors 1; quality meshes.
• Increase the value to at least 2 if you expect
large mesh deformations.
correctPhi yes;
37
Introduction – What are dynamic meshes?
A short note on the numerics required for dynamic meshes in OpenFOAM
• For the fvSolution dictionary:
momentumPredictor yes;
nOuterCorrectors 2;
nCorrector 3;
• Flux corrections to ensure continuity.
• Default value is yes.
nNonOrthogonalCorrectors 1; • Required during start-up, restart, mesh-
motion, etc., when non-conservative fluxes
may adversely affect the solution.
correctPhi yes; • This is particularly important for VoF and
other multi-phase solvers in which non-
conservative fluxes cause unboundedness
of the phase-fraction.
38
Introduction – What are dynamic meshes?
A short note on the numerics required for dynamic meshes in OpenFOAM
• For the fvSolution dictionary and if you are dealing with overset meshes:
nNonOrthogonalCorrectors 1;
correctPhi no;
oversetAdjustPhi no;
39
Introduction – What are dynamic meshes?
A short note on the numerics required for dynamic meshes in OpenFOAM
• For the fvSolution dictionary and if you are dealing with overset meshes:
nCorrector 3;
oversetAdjustPhi no;
40
Introduction – What are dynamic meshes?
A short note on the numerics required for dynamic meshes in OpenFOAM
• For the fvSolution dictionary and if you are dealing with overset meshes:
momentumPredictor yes;
nOuterCorrectors 1;
• Flux corrections to ensure continuity.
• In overset meshes the default value is no.
• It is recommended to leave it always off
nCorrector 3; (no) in overset meshes.
nNonOrthogonalCorrectors 1;
• Flux corrections in overset meshes.
• Use with incompressible flows in closed
correctPhi no; domains and if you are experiencing
pressure fluctuations.
oversetAdjustPhi no; • Default value is no.
• The benefits of this correction are not very
clear. 41
Introduction – What are dynamic meshes?
A short note on the numerics required for dynamic meshes in OpenFOAM
• In OpenFOAM, there are two types of unsteady loops, standard PISO (non-iterative marching or NITA), and
PIMPLE (PISO with iterative marching or ITA).
• When dealing with moving bodies or overset meshes, it is extremely recommended to use the PISO-ITA
method (or PIMPLE) with at least five outer correctors.
divSchemes
{
default none; • For stability, use slope limiters for gradients.
div(phi,U) Gauss linearUpwindV grad(U);
} • The leastSquares method is more accurate but a little
bit oscillatory for bad quality meshes.
laplacianSchemes
{
default Gauss linear limited 0.5;
}
interpolationSchemes
{
default linear;
}
snGradSchemes
{
default limited 0.5;
} 43
Introduction – What are dynamic meshes?
A short note on the numerics required for dynamic meshes in OpenFOAM
• For the fvSchemes dictionary (overset and body fitted meshes)
ddtSchemes
{
default Euler;
}
gradSchemes
{
default cellLimited Gauss linear 1; • For good accuracy use at least second order accurate
grad(U) cellLimited Gauss linear 1;
} methods.
• The second order upwind method is a good choice for
divSchemes
{
the momentum term (stable and accurate).
default none;
div(phi,U) Gauss linearUpwind grad(U);
}
snGradSchemes
{
default limited 0.5;
} 44
Introduction – What are dynamic meshes?
A short note on the numerics required for dynamic meshes in OpenFOAM
• For the fvSchemes dictionary (overset and body fitted meshes)
ddtSchemes
{
default Euler;
}
gradSchemes
{
default cellLimited Gauss linear 1;
grad(U) cellLimited Gauss linear 1;
}
divSchemes
{
default none;
div(phi,U) Gauss linearUpwindV grad(U);
}
• This entry refers to the method used to interpolate
laplacianSchemes
values from cell centers to face centers.
{
default Gauss linear limited 0.5; • It is unlikely that you will need to use something
}
different from linear.
interpolationSchemes
{
default linear;
}
snGradSchemes
{
default limited 0.5; Use same option as for laplacianSchemes
} 45
Introduction – What are dynamic meshes?
A short note on the numerics required for dynamic meshes in OpenFOAM
• As the mesh is changing in dynamic meshes, it is advisable to fix the CFL number.
• To ensure that we have a constant CFL number, or we do not exceed a given CFL value as the mesh
changes, we can use adaptive time stepping (adjustableTimeStep).
• This option is set in the dictionary controlDict, and it is supported by all solvers with dynamic meshes
capabilities.
...
...
...
...
...
...
46
Introduction – What are dynamic meshes?
A short note on the numerics required for dynamic meshes in OpenFOAM
• As the mesh is changing in dynamic meshes, it is advisable to fix the CFL number.
• However, it is better to fix the time-step in order to avoid oscillations introduced due to the adaptive time-
stepping.
• However, keeping the CFL number below one or close to a target value, is difficult as the mesh is changing.
...
...
...
...
...
...
47
Roadmap
49
Adaptive mesh refinement in OpenFOAM
• Adaptive mesh refinement or AMR, consist in automatically refining the mesh according to a
predefined criterion and given control parameters (refinement levels, unrefinement levels,
expansion ratio and so on).
• AMR in OpenFOAM is compatible with all solvers supporting dynamic meshes capabilities.
• AMR in OpenFOAM is only supported for hexahedral meshes (it is fully 3D).
Some of the previous statements are the author’s personal opinion (J. Guerrero). 53
Adaptive mesh refinement in OpenFOAM
• AMR simulation with different OpenFOAM versions.
• The results correspond to serial computations.
OpenFOAM 8 OpenFOAM 9
http://www.wolfdynamics.com/training/dynamicMeshes/OF8_serial.gif http://www.wolfdynamics.com/training/dynamicMeshes/OF9_serial.gif
54
Adaptive mesh refinement in OpenFOAM
• AMR simulation with different OpenFOAM versions.
• The results correspond to serial computations.
55
Adaptive mesh refinement in OpenFOAM
• AMR simulation with different OpenFOAM versions.
• We have found that in some cases (in particular when using interFoam), the refinement levels
will be different (sometimes very different) depending on the parallel decomposition method
and number of processors used (at least in OpenFOAM 8 and 9).
56
Adaptive mesh refinement in OpenFOAM
$TM/AMR_mesh/cavity3d
• In the case directory, you will find a few scripts with the extension .sh, namely, run_all.sh, run_mesh.sh,
run_sampling.sh, run_solver.sh, and so on.
• These scripts can be used to run the case automatically by typing in the terminal, for example,
• $> sh run_solver
• These scripts are human-readable, and we highly recommend you open them, get familiar with the steps, and type the
commands in the terminal. In this way, you will get used with the command line interface and OpenFOAM commands.
• If you are already comfortable with OpenFOAM, run the cases automatically using these scripts.
• In the case directory, you will also find the README.FIRST file. In this file, you will find some additional comments.
57
Adaptive mesh refinement in OpenFOAM
3D driven cavity with AMR
• Hereafter we will use the driven cavity case to introduce the AMR capabilities available in
OpenFOAM.
• Remember, all dynamic mesh capabilities are controlled in the dictionary dynamicMeshDict,
this dictionary is located in the directory constant.
• In this case, we will initialize a passive scalar which we will use as the base field for the AMR.
• It is important to mention that AMR works only with scalar fields and hexahedral meshes.
http://www.wolfdynamics.com/training/dynamicMeshes/amr1.gif http://www.wolfdynamics.com/training/dynamicMeshes/amr2.gif
58
Adaptive mesh refinement in OpenFOAM
3D driven cavity with AMR
• Let us open the dynamicMeshDict dictionary.
...
...
...
dynamicRefineFvMeshCoeffs
{
refineInterval 1; How often refine/unrefine (time-step or iteration)
lowerRefineLevel 0.4;
Refine the field between these two levels
upperRefineLevel 1;
...
...
...
dynamicFvMesh dynamicRefineFvMesh;
dynamicRefineFvMeshCoeffs
{
refineInterval 1;
field T;
unrefineLevel 10
lowerRefineLevel 0.4; http://www.wolfdynamics.com/training/dynamicMeshes/amr6.gif
• A large positive value (in
upperRefineLevel 1;
reference to the maximum scale)
will apply unrefinement to the
refined cells.
unrefineLevel 10;
• A large negative value (in
nBufferLayers 1; reference to the minimum scale)
will not apply unrefinement to the
maxRefinement 2; refined cells.
maxCells 100000;
...
...
... unrefineLevel -10
http://www.wolfdynamics.com/training/dynamicMeshes/amr6a.gif 60
Adaptive mesh refinement in OpenFOAM
3D driven cavity with AMR
• Let us open the dynamicMeshDict dictionary.
...
...
...
Flux field and corresponding velocity field. Fluxes
on changed faces get recalculated by interpolating
correctFluxes the velocity.
( Use 'none’ on surfaceScalarFields that do not need
( phi U ) to be reinterpolated.
//( phi none )
//( alphaPhi none )
);
61
Adaptive mesh refinement in OpenFOAM
3D driven cavity with AMR
• This case is ready to run, we are going to work in parallel.
• To run the case, in the terminal window type:
1. $> foamCleanTutorials
2. $> blockMesh
4. $> setFields
5. $> decomposePar
62
Adaptive mesh refinement in OpenFOAM
3D driven cavity with AMR
• To reconstruct the parallel case, we proceed as follows:
1. $> reconstrucParMesh
2. $> reconstructPar
3. $> paraFoam
63
Adaptive mesh refinement in OpenFOAM
3D driven cavity with AMR
T based refinement
Region 1 Region 2 2 levels
Refinement based on T Refinement based on p
p based refinement
1 level
http://www.wolfdynamics.com/training/dynamicMeshes/OF9_multiregion_AMR.gif
64
Adaptive mesh refinement in OpenFOAM
3D driven cavity with AMR
• Let us explore the dynamicMeshDict dictionary for multi-region refinement.
...
...
...
refineInterval 1;
refinementRegions
{
nBufferLayers 1;
maxCells 100000;
correctFluxes
( Note:
( phi none )
The options outside the refinementRegions block
);
are the same as in the previous slides
dumpLevel true;
...
...
...
65
Adaptive mesh refinement in OpenFOAM
3D driven cavity with AMR
• Let us explore the dynamicMeshDict dictionary for multi-region refinement.
...
refinementRegions
{
...
66
Adaptive mesh refinement in OpenFOAM
3D driven cavity with AMR
• To create the cellZone used in the dynamicMeshDict dictionary, we use the utility topoSet that reads the
dictionary topoSetDict.
• The dictionary topoSetDict is located in the directory system, and the basic entries read are as follows,
...
actions
(
{
name refinementRegion1;
type cellZoneSet;
Create a new set, using the cellZoneSet
action new;
source boxToCell; method, with the name refinementRegion1,
sourceInfo using the selection method boxToCell, with the
{ bounds defined in sourceInfo for the object box.
box (-1 -1 -1) (0.5 1 1);
}
}
{
name refinementRegion2;
type cellZoneSet; Create a new set, using the cellZoneSet
action new; method, with the name refinementRegion2,
source boxToCell;
using the selection method boxToCell, with the
sourceInfo
{ bounds defined in sourceInfo for the object box.
box (0.5 -1 -1) (1 1 1);
}
}
Note:
); You need to execute the command topoSet
before running the simulation
... 67
Roadmap
68
Sliding meshes in OpenFOAM
• In sliding meshes simulations, the solution is interpolated back-and-forth between topologically
separated regions.
• The interpolation is done at the mesh interface. In OpenFOAM, this patch type is called
arbitrary mesh interface or AMI.
• To reduce interpolation errors at the AMI patches, the meshes should be similar in the master
and slave patches.
http://www.wolfdynamics.com/training/movingbodies/image8.gif
Rotating domain
Rotating patch Fix patch
Master patch Slave patch
69
Sliding meshes in OpenFOAM
• The different regions (i.e., fix and rotating), must be created at meshing time.
• The mesh can be generated using OpenFOAM meshing capabilities or any external mesher.
• Single and multiple rotating bodies are supported.
• Sliding meshes are compatible with all physical modeling capabilities implemented in
OpenFOAM.
Impeller
http://www.wolfdynamics.com/training/meshing/image5.gif
70
Sliding meshes in OpenFOAM
• Sliding meshes are intrinsically unsteady.
• No need to say that in order to use sliding meshes you need axial symmetry.
• An alternative to sliding meshes is MRF (steady and unsteady).
• In the MRF approach, the mesh is fixed. The rotation is accounted by adding source terms to
the region of interest.
• MRF solvers are mush faster than sliding meshes solvers.
$TM/sliding_MRF_meshes/CSTR/sliding_piso/
• In the case directory, you will find a few scripts with the extension .sh, namely, run_all.sh, run_mesh.sh,
run_sampling.sh, run_solver.sh, and so on.
• These scripts can be used to run the case automatically by typing in the terminal, for example,
• $> sh run_solver
• These scripts are human-readable, and we highly recommend you open them, get familiar with the steps, and type the
commands in the terminal. In this way, you will get used with the command line interface and OpenFOAM commands.
• If you are already comfortable with OpenFOAM, run the cases automatically using these scripts.
• In the case directory, you will also find the README.FIRST file. In this file, you will find some additional comments.
72
Sliding meshes in OpenFOAM
CSTR – Continuous stirring tank reactor mesh
• Let us open the snappyHexMesh dictionary.
• Explaining the whole dictionary is outside of the scope of this training, we will focus our attention in the
section where we create the different zones (a cell zone and a face zone).
• Let us take a look at the castellatedMeshControls section of the dictionary snappyHexMeshDict. In this
block we define the cellZone and faceZone, as follows,
castellatedMeshControls
{
... Using the surface inner_volume geometry (that
...
...
was loaded in the geometry section of the
snnapyHexMeshDict dictionary), we create a
//Surface based refinement mesh zone that we will use at a later time to split
inner_volume the whole mesh in two regions.
(
level (1 1);
1. $> foamCleanTutorials
2. $> foamCleanPolymesh
3. $> surfaceFeatures
4. $> blockMesh
5. $> decomposePar
9. $> paraFoam
74
Sliding meshes in OpenFOAM
CSTR – Continuous stirring tank reactor mesh
• Using paraFoam let us take a look at the newly created mesh, including the zones (face and
cells).
face_inner_volume cell_inner_volume
75
Sliding meshes in OpenFOAM
CSTR – Continuous stirring tank reactor mesh
• To visualize the zones in paraFoam you will need to enable the option Include Zones
• Then select the mesh parts cell_inner_volume and face_inner_volume.
1. 2.
76
Sliding meshes in OpenFOAM
CSTR – Continuous stirring tank reactor mesh
• At this point and if you run checkMesh, you will get the following information:
• $> checkMesh
…
…
…
Checking topology…
Boundary definition OK.
Cell to face addressing OK.
Point usage OK.
UPPER triangular ordering OK.
Face vertices OK.
Number of regions: 1 (OK).
…
…
…
• As you can see we only have one region, but we are interested in having two regions.
• Up to this point the mesh is valid to be used with the MRF approach.
• For sliding meshes, we still need to split the mesh in two or more regions.
• We will use the following utilities:
• createBaffles
• mergeOrSplitBaffles 77
Sliding meshes in OpenFOAM
CSTR – Continuous stirring tank reactor mesh
• The utility createBaffles, reads the dictionary createBafflesDict.
• With this utility we create the interface patches between the fix zone and the rotating zone.
baffles
{
rotating Name of the baffle group (user defined)
{
type faceZone; Use faceZone
zoneName face_inner_volume; Face to use to construct the AMI patches.
The name was defined in snappyHexMeshDict
patches
{
master Parameters for the master patch
{
name AMI1; Name of the master patch (user defined)
Boundary condition type cyclicAMI;
for sliding grids matchTolerance 0.0001;
neighbourPatch AMI2; Neighbour patch (slave patch or AMI2)
transform none;
}
slave Parameters for the slave patch
{
Boundary condition name AMI2; Name of the slave patch (user defined)
type cyclicAMI;
for sliding grids matchTolerance 0.0001;
neighbourPatch AMI1; Neighbour patch (master patch or AMI1)
transform none;
}
}
}
} The master and slave patches
share a common face
78
Sliding meshes in OpenFOAM
CSTR – Continuous stirring tank reactor mesh
• To create the two regions, we proceed as follows (notice that we are going to work in serial from
now on):
79
Sliding meshes in OpenFOAM
CSTR – Continuous stirring tank reactor mesh
• So, what did we do?
• Step 1:
• Splits the mesh in regions using the baffles (faceZone), created during the meshing
stage.
• We also create the cyclicAMI patches AMI1 and AMI2.
• At this point we have two regions and one zone. However, the two regions are stich
together via the patches AMI1 and AMI2.
• Step 2: topologically split the patches AMI1 and AMI2. As we removed the link between
AMI1 and AMI2, the regions are free to move.
• Step 3 (optional): gets rid of zero faced patches if hey exist. These are the patches
remaining from the base mesh, as they are empty, we do not need them.
• Step 4 (optional):
• Splits mesh into multiple zones. It will create automatically the sets and zones.
• At this point we have two regions and two zones.
• Step 5 (optional): just to show the regions and names.
• Step 6 (optional): scales the mesh.
80
Sliding meshes in OpenFOAM
CSTR – Continuous stirring tank reactor mesh
• At this point and if you run checkMesh, you will get the following information:
• $> checkMesh
…
…
…
Checking topology…
Boundary definition OK.
Cell to face addressing OK.
Point usage OK.
UPPER triangular ordering OK.
Face vertices OK.
*Number of regions: 2
The mesh has multiple regions which are not connected by any face.
<<Writing region information to ”0/cellToRegion”
<<Writing region 0 with 136187 cells to cellSet region0
Regions name
<<Writing region 1 with 67682 cells to cellSet region1
…
…
…
• To preview the region motion and check the quality of the AMI interfaces, in the terminal type:
• $> moveDynamicMesh -checkAMI -noFunctionObjects
• In our YouTube channel you can find an step-by-step video explaining this case.
82
Sliding meshes in OpenFOAM
CSTR – Continuous stirring tank reactor mesh
Shaft
type rotatingWallVelocity;
origin (0 0 0);
axis (0 0 1);
omega constant 12.566370;
value uniform (0 0 0);
Impeller
type movingWallVelocity;
value uniform (0 0 0); Inner region and arbitrary mesh
interface (AMI patches)
Impeller
type movingWallVelocity;
value uniform (0 0 0); Inner region and arbitrary mesh
interface
cellZone cell_inner_volume;
dynamicFvMesh dynamicMotionSolverFvMesh; active yes;
motionSolverLibs ( "libfvMotionSolvers.so" );
motionSolver solidBody; // Fixed patches (by default they move’ with the MRF zone)
cellZone cell_inner_volume; nonRotatingPatches ();
solidBodyMotionFunction rotatingMotion;
origin (0 0 0); origin (0 0 0);
axis (0 0 1); axis (0 0 1);
omega constant 12.566370; omega constant 12.566370;
84
Sliding meshes in OpenFOAM
CSTR – Continuous stirring tank reactor mesh
Calculating AMI weights between owner patch: AMI1 and neighbour patch: AMI2
Number of faces in
AMI: Creating addressing and weights between 2476 source faces and 2476 target faces the AMI patches
AMI: Patch source sum(weights) min/max/average = 0.94746705, 1.0067199, 0.99994232 AMI1 patch weights
AMI: Patch target sum(weights) min/max/average = 0.94746692, 1.0004497, 0.99980782 AMI2 patch weights
…
…
…
85
Sliding meshes in OpenFOAM
CSTR – Continuous stirring tank reactor mesh
• Additionally, to this case, in the directory $TM/sliding_MRF_meshes/CSTR/, you will find
additional cases dealing with MRF and importing a mesh from an external mesher.
• ./fluent_mesh – Importing a mesh from fluent
• ./case1 – Zones/regions already defined
• ./case2 – No zones/regions defined, it requires topological modifications
• ./MRF_piso – Unsteady MRF approach
• ./MRF_simple – Steady MRF approach
• ./sliding_piso – Sliding meshes approach
86
Sliding meshes in OpenFOAM
CSTR – Continuous stirring tank reactor with two impellers
• And of course, it is possible to put several regions into motion (sliding meshes).
• Remember, for a single zone you can use the solver solidBody.
• For multiple regions, you will need to use the solver multiSolidBodyMotionSolver.
• You will need to create the cellZones and the AMI patches.
• The solver multiSolidBodyMotionSolver lets you use a single cellZone or multiple cellZone,
so it is more general.
shaft1
rotatingWallVelocity
(fixed patch) impeller2
movingWallVelocity
shaft2 (rotating patch)
rotatingWallVelocity
(fixed patch) impeller1
movingWallVelocity
(rotating patch)
http://www.wolfdynamics.com/training/dynamicMeshes/sliding1.gif 87
Sliding meshes in OpenFOAM
CSTR – Continuous stirring tank reactor with two impellers
• For multiple regions, the dictionary dynamicsMeshDict looks like as follows:
dynamicFvMesh dynamicMotionSolverFvMesh;
89
Morphing meshes in OpenFOAM
Oscillating cylinder – Prescribed motion
Moving boundary
http://www.wolfdynamics.com/training/dynamicMeshes/meshMotion3.gif
http://www.wolfdynamics.com/training/dynamicMeshes/meshMotion5.gif http://www.wolfdynamics.com/training/dynamicMeshes/meshMotion6.gif
http://www.wolfdynamics.com/training/dynamicMeshes/meshMotion7.gif http://www.wolfdynamics.com/training/dynamicMeshes/meshMotion8.gif92
Morphing meshes in OpenFOAM
Oscillating cylinders – Prescribed motion with multiple bodies
http://www.wolfdynamics.com/training/dynamicMeshes/meshMotion9.gif http://www.wolfdynamics.com/training/dynamicMeshes/meshMotion10.gif
• With morphing meshes, large displacements with large time-steps (hence large CFL number), will likely result
in low quality meshes or invalid meshes.
• The time-step must be chosen in such a way that it allows for a smooth mesh motion diffusion in the domain.
• When using mesh morphing, the solver will report the mesh quality.
• Remember to always check the mesh quality while the simulation is running, and it the case of low quality
meshes, stop the simulation and fix the problems. 93
Morphing meshes in OpenFOAM
$TM/morphing_mesh/1_oscillatingCylinder/meshMotion
• In the case directory, you will find a few scripts with the extension .sh, namely, run_all.sh, run_mesh.sh,
run_sampling.sh, run_solver.sh, and so on.
• These scripts can be used to run the case automatically by typing in the terminal, for example,
• $> sh run_solver
• These scripts are human-readable, and we highly recommend you open them, get familiar with the steps, and type the
commands in the terminal. In this way, you will get used with the command line interface and OpenFOAM commands.
• If you are already comfortable with OpenFOAM, run the cases automatically using these scripts.
• In the case directory, you will also find the README.FIRST file. In this file, you will find some additional comments.
94
Morphing meshes in OpenFOAM
Oscillating cylinder – Prescribed motion
• In the dictionary constant/dynamicMeshDict we select the mesh morphing method and the
boundary patch that it is moving.
• There are many mesh morphing methods implemented in OpenFOAM.
• Remember, to know all options available just misspelled something.
• Mesh morphing is based in diffusing or propagating the mesh deformation all over the domain.
• You will need to find the best method for your case.
• But in general, the setup used in this case works fine most of the times.
Mesh diffusion method – Many options available Patch name – Can add multiple patches, e.g., (body1 body2) 95
Morphing meshes in OpenFOAM
Oscillating cylinder – Prescribed motion
• Effect of different diffusivity methods (mesh morphing).
in
{
type fixedValue;
This is a fixed patch
value uniform (0 0 0);
}
cylinder Patch name – Different patches can have different prescribed motions
{
Built-in motion functions
type oscillatingDisplacement;
Many options available.
cylinder
{
type movingWallVelocity;
value uniform (0 0 0);
}
• And as usual, you will need to adjust the numerics according to your physics.
• In this case we need to solve the new fields cellDisplacement and diffusivity, which are
related to the mesh motion and morphing.
• In the dictionary fvSolution, you will need to add a linear solver for the field
cellDisplacement.
• In the dictionary fvSchemes, you will need to add the discretization schemes related to the
mesh morphing diffusion method laplacian(diffusivity, cellDisplacement). You can use the
default discretization method (e.g., Gauss linear limited 1.0).
98
Morphing meshes in OpenFOAM
Oscillating cylinder – Prescribed motion
• At this point, we are ready to run the simulation.
• Before running the simulation, you can check the mesh motion.
• During this check, you can use large time-steps as we re not computing the solution, we are only interested in
checking the motion.
• To check the mesh motion, type in the terminal:
• We leave to the reader to play around with the different options for mesh motion method, mesh diffusion
method, and prescribed mesh motion.
101
Morphing meshes in OpenFOAM
What about if my mesh is static?
• If a solver supporting dynamic meshes (e.g., pimpleFoam, interFoam, rhoPimpleFoam)
finds the dictionary file constant/dynamicMeshDict, it will parse it and use the dynamic
meshes definition declared.
• If your mesh is static, you can erase the dictionary file constant/dynamicMeshDict, and the
solver will assume that the mesh is neither moving nor changing.
• Alternatively, you can leave the dictionary file constant/dynamicMeshDict, and modify it as
follows, so your mesh is static,
FoamFile
{
format ascii;
class dictionary;
object motionProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// ************************************************************************* //
102
Morphing meshes in OpenFOAM
$TM/morphing_mesh/2_fallingObject/mesh1
• In the case directory, you will find a few scripts with the extension .sh, namely, run_all.sh, run_mesh.sh,
run_sampling.sh, run_solver.sh, and so on.
• These scripts can be used to run the case automatically by typing in the terminal, for example,
• $> sh run_solver
• These scripts are human-readable, and we highly recommend you open them, get familiar with the steps, and type the
commands in the terminal. In this way, you will get used with the command line interface and OpenFOAM commands.
• If you are already comfortable with OpenFOAM, run the cases automatically using these scripts.
• In the case directory, you will also find the README.FIRST file. In this file, you will find some additional comments.
103
Morphing meshes in OpenFOAM
Falling-floating body – Rigid body motion
ertical postion m
o
http://www.wolfdynamics.com/training/dynamicMeshes/dof1.gif
ime s
elocity m s
ertical
o
http://www.wolfdynamics.com/training/dynamicMeshes/dof2.gif
ime s 104
Morphing meshes in OpenFOAM
Falling-floating body – Rigid body motion
• As for prescribed motion, in rigid body motion the mesh morphing is based in diffusing or propagating the
mesh deformation all over the domain.
• In the dictionary constant/dynamicMeshDict we select the mesh morphing library and rigid body motion
library.
• The rigid motion solver will compute the response of the body to external forces.
• In the dictionary constant/dynamicMeshDict we define all the inputs required by the rigid motion solver.
• In this case we are using the dynamic motion library sixDoFRigidBodyMotion, this library works with a single
body.
• To work with multiple bodies, you will need to use the library rigidBodyMotion. We will use this library during
the overset tutorials.
sixDoFRigidBodyMotionCoeffs
{
patches (floatingObject); Moving patch
innerDistance
Set it to zero if you do not want to
… apply mesh morphing to the inner
… region
106
Morphing meshes in OpenFOAM
Falling-floating body – Rigid body motion
• The dictionary constant/dynamicMeshDict (continuation).
sixDoFRigidBodyMotionCoeffs
{
…
…
… Relaxation factor used to stabilize the rigid body motion
solver.
For no relaxation set it to 1. Typical values are
accelerationRelaxation 0.7; between 0.9-0.3
107
Morphing meshes in OpenFOAM
Falling-floating body – Rigid body motion
• The dictionary constant/dynamicMeshDict (continuation).
constraints
{
fixedAxis
{
sixDoFRigidBodyMotionConstraint axis; Motion constraints
axis (0 1 0); If you do not give any
} constraint, the body is free
to move in all directions.
fixedLine
{ If you assign a constraint,
sixDoFRigidBodyMotionConstraint line; the body is free to move in
centreOfRotation (0.5 0.5 0.5); the specified direction
direction (0 0 1);
}
}
Body restraints
restraints Restraints can be used to
{ damp the acceleration of the
body.
}
In this case, we are not
} using restraints
108
Morphing meshes in OpenFOAM
Falling-floating body – Rigid body motion
• In the dictionary 0/pointDisplacement we select the body motion.
• For rigid body motion, the body motion is computed by the solver, therefore, we use the
boundary condition calculated.
floatingObject
{
type calculated;
value uniform (0 0 0);
}
• And as the patch is moving, we need to use the boundary condition movingWallVelocity.
• This is done in the dictionary 0/U.
floatingObject
{
type movingWallVelocity;
value uniform (0 0 0);
}
109
Morphing meshes in OpenFOAM
Falling-floating body – Rigid body motion
• And as usual, you will need to adjust the numerics according to your physics.
• In the case directory, you will also find the script extractData. This script can be used to
extract the position of the body during the simulation.
• In order to use the extractData script, you will need to save the log file of the simulation.
• At this point, we are ready to run the simulation.
• Remember, in the case directory you will find the scripts run_mesh.sh, run_solver.sh and
run_all.sh, you can use these scripts to run the case automatically. To run all the steps, type
in the terminal:
• $> sh run_all.sh
• You will find the instructions of how to run the cases in the file README.FIRST located
in the case directory.
110
Morphing meshes in OpenFOAM
Falling-floating body – Rigid body motion
• In this case and because the body is experiencing large displacements, the mesh will become
too distorted.
• Still the overall quality is acceptable, but it might be better to address this issue.
• To tackle this problem, it is possible to use mesh morphing with remeshing.
• That is, when the quality of the mesh is too low, you can stop the simulation, get the position of
the body, remesh the domain, map the solution and keep computing.
• It is also recommended to reduce the number of interpolated solutions, so the errors introduced
when restarting the simulation are reduced.
http://www.wolfdynamics.com/training/dynamicMeshes/dof1.gif http://www.wolfdynamics.com/training/dynamicMeshes/dof3.gif
111
Morphing meshes in OpenFOAM
Falling-floating body – Rigid body motion
• Mesh morphing with remeshing requires manual work and craftmanship, as the user should
intervene when the mesh quality is deemed low or when problems are identified.
• The steps are as follow:
• Start the simulation and continuously monitor the solution.
• Stop the simulation when the mesh quality is deemed low.
• Extract body position and body dynamics.
• Remesh the domain using the extracted body.
• Map the solution of the previous mesh into the new mesh.
• Restart the simulation using the extracted body dynamics.
Initial position. Low mesh quality – Stop the simulation – Remesh the domian– Map solution – Apply
Get body position and body dynamics. body Dynamics – Continue the simulation.
112
Morphing meshes in OpenFOAM
Falling-floating body – Rigid body motion
• Mesh morphing with remeshing workflow.
http://www.wolfdynamics.com/training/dynamicMeshes/dof3.gif
No remesh Remesh
http://www.wolfdynamics.com/training/dynamicMeshes/dof2.gif http://www.wolfdynamics.com/training/dynamicMeshes/dof4.gif 115
Roadmap
116
Moving meshes in OpenFOAM
Moving meshes/domain – Sloshing tank
http://www.wolfdynamics.com/training/dynamicMeshes/sloshing1.gif http://www.wolfdynamics.com/training/dynamicMeshes/sloshing2.gif
117
Moving meshes in OpenFOAM
Moving meshes/domain – Sloshing tank
Solid body – Different prescribed motions
Combination of oscillating rotating and oscillating linear Arbitrary motion using a tabular input
http://www.wolfdynamics.com/training/dynamicMeshes/motion3.gif http://www.wolfdynamics.com/training/dynamicMeshes/motion4.gif 118
Moving meshes in OpenFOAM
$TM/moving_mesh/sloshing_tank_baffles/baffles_multimotion/
• In the case directory, you will find a few scripts with the extension .sh, namely, run_all.sh, run_mesh.sh,
run_sampling.sh, run_solver.sh, and so on.
• These scripts can be used to run the case automatically by typing in the terminal, for example,
• $> sh run_solver
• These scripts are human-readable, and we highly recommend you open them, get familiar with the steps, and type the
commands in the terminal. In this way, you will get used with the command line interface and OpenFOAM commands.
• If you are already comfortable with OpenFOAM, run the cases automatically using these scripts.
• In the case directory, you will also find the README.FIRST file. In this file, you will find some additional comments.
119
Moving meshes in OpenFOAM
Sloshing tank
• Contrary to morphing meshes, in these simulations we do not morph the mesh, we only move
the domain (similar to what we did in sliding meshes).
• In the dictionary constant/dynamicMeshDict we select the mesh motion libraries and
prescribed motions.
• In the solidBodyMotionFunction entry you can define a singe motion. But using multiMotion
is more general as it let you choose multiple prescribed motions.
• Remember, to know all options available just misspelled something.
motionSolver solidBody; Solid body Motion library – Use it to move the whole domain
120
Moving meshes in OpenFOAM
Sloshing tank
• Definition of multiple prescribed motions using the multiMotion solid body function.
121
Moving meshes in OpenFOAM
Sloshing tank
• As all the walls are moving, we need to use the boundary condition movingWallVelocity.
• This is done in the dictionary 0/U.
cylinder
{
type movingWallVelocity;
value uniform (0 0 0);
}
• We leave to the reader to play around with the different options for solidBodyMotionFunction.
Moving walls with movingWallVelocity boundary condition Moving walls with fixedvalue boundary condition
http://www.wolfdynamics.com/training/dynamicMeshes/sloshing1.gif http://www.wolfdynamics.com/training/dynamicMeshes/sloshing3_badbc.gif
124
Roadmap
125
Overset meshes in OpenFOAM
126
Overset meshes in OpenFOAM
• If you are working with unstructured meshes and there are no moving bodies, it
makes no sense paying the extra computational cost inherent to overset meshes.
• Have in mind that overset meshes can add numerical diffusion to the solution,
not to mention that the interpolation is non-conservative.
• Do not take overset meshes as a silver bullet. Simulations using overset meshes
require careful planning and expertise.
127
Overset meshes in OpenFOAM
Overset mesh example in OpenFOAM
Rigid body motion with multiple bodies and VOF
http://www.wolfdynamics.com/training/dynamicMeshes/floating_overset1.gif
http://www.wolfdynamics.com/training/dynamicMeshes/floating_overset2.gif 128
Overset meshes in OpenFOAM
Overset mesh example in OpenFOAM
Store separation – Rigid body motion
http://www.wolfdynamics.com//wiki/of_conf2019/f15.gif http://www.wolfdynamics.com//wiki/of_conf2019/f17.gif
129
Overset meshes in OpenFOAM
Overset mesh example in OpenFOAM
Space shuttle – Booster release – Prescribed motion
http://www.wolfdynamics.com//wiki/of_conf2019/f19.gif http://www.wolfdynamics.com//wiki/of_conf2019/f20.gif
130
Overset meshes in OpenFOAM
Overset mesh example in OpenFOAM
Ahmed body – Overtaking simulation
http://www.wolfdynamics.com/training/movingbodies/ahmed1.gif http://www.wolfdynamics.com/training/movingbodies/ahmed2.gif
131
Overset meshes in OpenFOAM
Overview of overset meshes – Development timeline
132
Overset meshes in OpenFOAM
Overview of overset meshes – Development timeline
133
Overset meshes in OpenFOAM
Overview of overset meshes – Development timeline
Overset symposium
Dragon grids (Kao, Liou, Zheng)
AMR
Dougherty, Meakin, Steger, Suhs.
DES-LES
• Since the 1990’s it has been heavily used to deal with
complex geometries and moving bodies (Benek, Boger,
2000 Bunning, Chan, Chesshire, Dougherty, Gomez, Henshaw,
Unstructured meshes
many).
• Since 2000’s, the use of overset meshes with unstructured
2010 meshes gained popularity.
Pervasive use
Space shuttle
Figure credit: P. Buning, W. Chan,
R. Gomez, S. Pandya.
Copyright on the images is held by the
contributors. Apart from Fair Use,
permission must be sought for any
other purpose.
V-22 Osprey
Figure credit: W. Chan, R. Meakin,
W. Wissink.
Copyright on the images is held by the
contributors. Apart from Fair Use,
permission must be sought for any
other purpose.
135
Overset meshes in OpenFOAM
The grammar of overset meshes in OpenFOAM
• These steps are common for every CFD solver that uses overset meshes.
• The difference is the tools and methods used to merge meshes, assign zones, define grid
priorities, compute stencils, and diagnosing the overset assembly.
• Let us illustrated these steps using an overset set with three component meshes. For this, we
will use the classical cylinder case (Re = 200).
136
Overset meshes in OpenFOAM
The grammar of overset meshes in OpenFOAM
• Step 1 → Generate component meshes and merge them together (done by the user).
mergeMeshes
137
Overset meshes in OpenFOAM
The grammar of overset meshes in OpenFOAM
zoneID 2
zoneID 1
zoneID 0
zoneID 0
zoneID 2 138
Overset meshes in OpenFOAM
The grammar of overset meshes in OpenFOAM
zoneID 2
zoneID 1
zoneID 0
zoneID 0
zoneID 2 139
Overset meshes in OpenFOAM
The grammar of overset meshes in OpenFOAM
• Step 4 → Compute stencils and assign cell type (done by the overset library).
Hole 2
Hole Interpolation fringe and hole cells
(computed by the library) Interpolated 1
Interpolated Calculated 0
Calculated 140
Overset meshes in OpenFOAM
The grammar of overset meshes in OpenFOAM
• Step 4 → Compute stencils and assign cell type (done by the overset library).
141
Overset meshes in OpenFOAM
The grammar of overset meshes in OpenFOAM
First merge operation → cylinder + all Second merge operation → refinementZone + previous merged mesh
142
Overset meshes in OpenFOAM
The grammar of overset meshes in OpenFOAM
http://www.wolfdynamics.com//wiki/of_conf2019/f4.gif http://www.wolfdynamics.com//wiki/of_conf2019/f3.gif
• In this case, the order of the zoneID or
grid priorities does not make any
difference as the cylinders CM are
identical.
cellTypes Index
Hole 2
Interpolated 1
Calculated 0
144
Overset meshes in OpenFOAM
The grammar of overset meshes in OpenFOAM
$PTOFC/overset/2D/1_cylinder_fixed
• In the case directory, you will find a few scripts with the extension .sh, namely, run_all.sh, run_mesh.sh,
run_sampling.sh, run_solver.sh, and so on.
• These scripts can be used to run the case automatically by typing in the terminal, for example,
• $> sh run_solver
• These scripts are human-readable, and we highly recommend you open them, get familiar with the steps, and type the
commands in the terminal. In this way, you will get used with the command line interface and OpenFOAM commands.
• If you are already comfortable with OpenFOAM, run the cases automatically using these scripts.
• In the case directory, you will also find the README.FIRST file. In this file, you will find some additional comments.
147
Overset meshes in OpenFOAM
Case setup in the overset framework
• In the overset framework, a crucial (and mandatory) step is to create zones for handling the
different component meshes. This is done using the field zoneID.
• To create the zones and assign the field zoneID to each zone, we use the topoSet and
setFields utilities:
• topoSet: creates a cellSet for each component mesh.
• setFields: assigns to the cellSet the proper value of zoneID
• The zoneID field is also useful for postprocessing overset meshes.
• It is recommended to set the coarsest level to zoneID = 0 (according to developers).
• In overset meshes, when initializing the zoneID field, it is recommended to do it independently
from other fields (e.g., alpha.water), as you may experience problems with the initialization.
zoneID = 0
zoneID = 1
148
Overset meshes in OpenFOAM
Case setup in the overset framework
• The new patch type overset is used for patches involved in the overset interpolation.
• It can be assigned at meshing time (e.g., in blockMeshDict).
• If you import a third-party mesh, it is possible to manually edit the type in the boundary file
(located in the constant/polyMesh directory).
• The overset patches should precede the other patches in the boundary file, that is, it should be
the first in the list (as recommended by the developers).
149
Overset meshes in OpenFOAM
Case setup in the overset framework
• You also need to assign the overset patch type to the boundary patches in the boundary
conditions files located in the 0 folder (i.e., U, p, k, omega, epsilon, nut, alpha.water,
zoneID, and so on).
boundaryField
{
#includeEtc "caseDicts/setConstraintTypes" This entry is optional. It is
used to automatically assign
base type patches(e.g. empty,
yourOversetPatchName symmetry)
{
type overset; Specification of overset patch type
value $internalField; Dummy value for paraview.
} Be careful to made the distinction between scalar
and vector fields
...
...
...
150
Overset meshes in OpenFOAM
Case setup in the overset framework
boundaryField
{
#includeEtc "caseDicts/setConstraintTypes" This entry is optional. It is
used to automatically assign
base type patches(e.g. empty,
yourOversetPatchName symmetry)
{
patchType overset; patchType keyword instead of type
type zeroGradient; type to be assigned is zeroGradient
}
...
...
...
151
Overset meshes in OpenFOAM
Running parallel cases in the overset framework
• According to the developers, when using overset mesh it is suggested to choose the
hierarchical or simple decomposition methods instead of scotch:
numberOfSubdomains 4;
method hierarchical;
coeffs
{
n (2 2 1); Decomposition matrix
}
152
Overset meshes in OpenFOAM
dynamicMeshDict in the overset framework
• In the overset framework, the dynamicMeshDict is always required, even if the meshes are
not moving.
• For static meshes (fixed bodies), this dictionary is defined as follows:
motionSolverLibs ( "libfvMotionSolvers.so" );
solver displacementLaplacian;
Dummy definition of a mesh motion method.
displacementLaplacianCoeffs
This method is doing nothing as it has not been
{ assigned to a patch or body.
diffusivity uniform 1;
}
dynamicOversetFvMeshCoeffs
{ Advanced options related to the overset library.
This sub-dictionary can also be used with
moving bodies. In this case the entry is empty.
}
153
Overset meshes in OpenFOAM
dynamicMeshDict in the overset framework
• For cases with moving bodies, generally you can use the same dictionaries entries used with
mesh morphing.
• The main difference is that we need to use the dynamicOversetFvMesh library instead of
dynamicMotionSolverFvMesh.
• For example, to assign a prescribed motion:
solver multiSolidBodyMotionSolver;
multiSolidBodyMotionSolverCoeffs
{
movingZone Prescribed motion.
Defined in the same was as
{
for morphing meshes
solidBodyMotionFunction linearMotion;
velocity (1 0 0);
}
}
154
Overset meshes in OpenFOAM
dynamicMeshDict in the overset framework
• For cases with moving bodies, generally you can use the same dictionaries entries used with
mesh morphing.
• The main difference is that we need to use the dynamicOversetFvMesh library instead of
dynamicMotionSolverFvMesh.
• For example, to use rigid body motion:
motionSolverLibs ("librigidBodyMeshMotion.so");
motionSolver rigidBodyMotion;
…
…
…
155
Overset meshes in OpenFOAM
Postprocessing in ParaView
• Visualization of a mesh and solution in ParaView is similar but somehow tricker compared to
body fitted mesh cases.
• When launching paraFoam, all the meshes will appear as merged.
• In order to visualize separately each component mesh, you can use the Threshold filter
applied on the variable zoneID with the corresponding assigned value,
e.g., 0 for background, 1 for first inner/moving mesh, 2 for another moving mesh, and so on
• In this way, you can hide/show each mesh layer at your choice.
zoneID = 0
zoneID = 1
156
Overset meshes in OpenFOAM
Postprocessing in ParaView
• The variable cellTypes gives information on the role of the cell in the overset treatment.
• The cellTypes values are: 0 → calculated, 1 → interpolated, 2 → masked (not used).
cellTypes = 0 (calculated)
cellTypes = 1 (interpolated)
cellTypes = 2 (masked)
cellTypes = 0 (calculated)
cellTypes = 1 (interpolated)
cellTypes = 2 (masked)
Inner mesh
158
Overset meshes in OpenFOAM
Postprocessing in ParaView
• The variable cellTypes gives information on the role of the cell in the overset treatment.
• The cellTypes values are: 0 → calculated, 1 → interpolated, 2 → masked (not used).
• Thresholding on this quantity let us remove background cells in holes, for the sake of
visualization, so that the final result looks like:
$PTOFC/dynamicMeshes/overset_mesh/2D/2_flapping_airfoil
• In the case directory, you will find a few scripts with the extension .sh, namely, run_all.sh, run_mesh.sh,
run_sampling.sh, run_solver.sh, and so on.
• These scripts can be used to run the case automatically by typing in the terminal, for example,
• $> sh run_solver
• These scripts are human-readable, and we highly recommend you open them, get familiar with the steps, and type the
commands in the terminal. In this way, you will get used with the command line interface and OpenFOAM commands.
• If you are already comfortable with OpenFOAM, run the cases automatically using these scripts.
• In the case directory, you will also find the README.FIRST file. In this file, you will find some additional comments.
160
Overset meshes in OpenFOAM
Flapping airfoil – Prescribed motion with overset mesh
• Remember, in all cases the overset mesh is created by merging different meshes created
separately.
• In this case, we also use the trasformPoints utility to shift the inner mesh (this is needed for
providing the initial kinematic condition of the airfoil).
162
Overset meshes in OpenFOAM
Flapping airfoil – Prescribed motion with overset mesh
• In the dictionary constant/dynamicMeshDict we specify the motion library, along with the
assignment of the overset class to the dynamic mesh treatment.
• Here we use the multiSolidBodyMotionSolver which handles multiple moving objects (so that
we could add a second flapping airfoil, for instance).
• The related source code can be found here:
dynamicMesh/motionSolvers/displacement/solidBody/solidBodyMotionFunctions
dynamicOversetFvMeshCoeffs
{
}
…
…
…
163
Overset meshes in OpenFOAM
Flapping airfoil – Prescribed motion with overset mesh
• Each moving object has to be associated with a zone (created with topoSet), to which we can
assign a number of different kinds of motion laws.
• In this case, we employ the tabulated6DoFMotion class that can be used for arbitrary motions,
providing an input text file in the case directory.
• Details on how to generate this input file containing oscillating motion can be found in the
gen6DoF directory.
• Data appearing in the file 6DoF.dat are (ordering by column):
time; (translation along x, along y, along z); (rotation around x, around y, around z).
multiSolidBodyMotionSolverCoeffs
{ Name of zone to put in motion (it was created
movingZone using the utility topoSet)
{
solidBodyMotionFunction tabulated6DoFMotion; Initial position of the center of gravity, with
CofG (0.33 -0.5 0); respect to which rotation is performed
timeDataFileName "$FOAM_CASE/constant/6DoF.dat"; Input file for tabulated motion
}
}
164
Overset meshes in OpenFOAM
Flapping airfoil – Prescribed motion with overset mesh
• At this point, we are ready to run the simulation.
• We will use the solver overPimpleDyMFoam.
• You will find the instructions of how to run the cases in the file README.FIRST located in the
case directory.
• Before running the simulation, you can check the mesh motion.
• During this check, you can use large time-steps as we are not going to compute the solution, we
are only interested in checking the motion.
• To check the mesh motion, type in the terminal:
165
Overset meshes in OpenFOAM
$PTOFC/dynamicMeshes/overset_mesh/2D/3_twoCylinders_VIV
• In the case directory, you will find a few scripts with the extension .sh, namely, run_all.sh, run_mesh.sh,
run_sampling.sh, run_solver.sh, and so on.
• These scripts can be used to run the case automatically by typing in the terminal, for example,
• $> sh run_solver
• These scripts are human-readable, and we highly recommend you open them, get familiar with the steps, and type the
commands in the terminal. In this way, you will get used with the command line interface and OpenFOAM commands.
• If you are already comfortable with OpenFOAM, run the cases automatically using these scripts.
• In the case directory, you will also find the README.FIRST file. In this file, you will find some additional comments.
166
Overset meshes in OpenFOAM
VIV of two cylinders – Rigid body motion with overset meshes
http://www.wolfdynamics.com/training/dynamicMeshes/viv1.gif
http://www.wolfdynamics.com/training/dynamicMeshes/viv2.gif 167
Overset meshes in OpenFOAM
VIV of two cylinders – Rigid body motion with overset meshes
• In this tutorial, the meshes will be created using blockMesh (for the background mesh) and
extrudeMesh (for the inner meshes).
• Then we will use the utility trasformPoints to translate the second cylinder mesh a given
distance with respect to the first cylinder.
• The three meshes will be then merge together using mergeMeshes twice.
• Finally, three values of zoneID will be assigned using the utility setFields (zoneID 0 =
background, zoneID 1 = cylinder1, zoneID 2 = cylinder2).
168
Overset meshes in OpenFOAM
VIV of two cylinders – Rigid body motion with overset meshes
• In this case, both cylinders obey to rigid body dynamics.
• In the dictionary constant/dynamicMeshDict we thus need to select a solver library able to
handle multiple rigid bodies.
• As in the previous case, we need to assign the dynamicOversetFvMesh entry to
dynamicFvMesh.
• Hence, we choose the rigidBodyMotion solver that fits to our goal.
…
…
…
169
Overset meshes in OpenFOAM
VIV of two cylinders – Rigid body motion with overset meshes
• Properties of each body are assigned in the corresponding part of the dictionary.
bodies
{
cylinder1 First cylinder
{
type rigidBody;
parent root;
…
…
…
} Second cylinder
cylinder2
{
type rigidBody;
parent root;
…
…
…
• Let us see which are the main parameters to set with this kind of rigid body motion solver.
170
Overset meshes in OpenFOAM
The rigidBodyMeshMotion library
• The rigidBodyMeshMotion library handles the dynamics of multiple rigid bodies.
• If you already were familiar the sixDoFRigidBodyMotion library, you will find many analogies
and few but major differences, the most important ones being the possibility of handling multiple
bodies.
• The user can define one or multiple bodies. In case of multiple bodies, kinematic joints between
them can be specified as well.
• The rigid motion solver will compute the response of the body (or the system of multiple and
connected bodies) to external forces.
• In general, you will use this solver if you are dealing with for mesh-motion of multiple articulated
rigid-bodies with joints, restraints and external forces.
• You will find the source code of the rigidBodyMeshMotion library in the directory:
• OpenFOAM-v2012/src/rigidBodyDynamics
• OpenFOAM-v2012/src/rigidBodyMeshMotion
171
Overset meshes in OpenFOAM
The rigidBodyMeshMotion library
• The dictionary constant/dynamicMeshDict contains the selection of the dynamic mesh
library and rigid body motion library to be used.
• Here, we also define all the inputs required by the rigid motion solver.
…
…
…
172
Overset meshes in OpenFOAM
The rigidBodyMeshMotion library
• The dictionary constant/dynamicMeshDict (continuation).
bodies
{
cylinder
{
type rigidBody; Other types are: cuboid, sphere, masslessBody, compositeBody
parent root; Parent body
patches (cylinder); Moving patch
Mesh deformation limits when using morphing. Still to be assigned,
innerDistance 100;
we put high values so that this will not be active.
outerDistance 101;
centreOfMass (0.0 0.0 0.0); Quantity intended in local coordinate system, it is used for transposing
mass 5; the moment of inertia and not to initialize the position of the body
inertia (1 0 0 1 0 1); Intended as the inertia tensor with respect to the origin
solver
{
type Newmark; Rigid body motion solver
}
…
You can find the theory behind this library in the following reference:
R. Featherstone. Rigid body dynamics algorithms. Springer, 2008. 173
Overset meshes in OpenFOAM
The rigidBodyMeshMotion library
• The dictionary constant/dynamicMeshDict (continuation).
…
…
…
joint
{
type composite;
joints
(
{ Motion DoFs, e.g.:
type Px; Px -> translation along x
} Py -> translation along y
…
{ Rz -> rotation around z
type Rz;
}
);
}
• The source code of the joints and restrains is located in the directory
• OpenFOAM-2012/src/sixDoFRigidBodyMotion/rigidBodyDynamics
You can find the theory behind this library in the following reference:
R. Featherstone. Rigid body dynamics algorithms. Springer, 2008. 174
Overset meshes in OpenFOAM
The rigidBodyMeshMotion library
• The dictionary constant/dynamicMeshDict (continuation).
…
…
…
restraints
{
in local CS
spring1 in global CS
{
type linearSpring;
refAttachmentPt (0 0 0); Body restraints can be used
anchor (1 1 0); to apply springs or dampers
stiffness 5.0; on the body.
damping 0.0;
restLength 1.0;
body cylinder;
}
• The source code of the joints and restrains is located in the directory
• OpenFOAM-2012/src/sixDoFRigidBodyMotion/rigidBodyDynamics
You can find the theory behind this library in the following reference:
R. Featherstone. Rigid body dynamics algorithms. Springer, 2008. 175
Overset meshes in OpenFOAM
The rigidBodyMeshMotion library
• In the dictionary 0/pointDisplacement we select the body motion.
• For rigid body motion, the body motion is computed by the solver, therefore, we use the
boundary condition calculated.
cylinder1
{
type calculated;
}
• As all the walls are moving, we need to use the boundary condition movingWallVelocity.
• This is done in the dictionary 0/U.
cylinder1
{
type movingWallVelocity;
value uniform (0 0 0);
}
176
Overset meshes in OpenFOAM
VIV of two cylinders – Rigid body motion with overset meshes
• At this point, we are ready to run the simulation.
• We will use the solver overPimpleDyMFoam.
• You will find the instructions of how to run the cases in the file README.FIRST located in the
case directory.
• Remember to adjust the numerics according to your physics.
• Also, have in mind that it is not possible to use the utility moveDynamicMesh with rigid body
motion, as the motion depends on the forces, which have not been computed yet.
177
Overset meshes in OpenFOAM
$PTOFC/dynamicMeshes/overset_mesh/3D/1_fallingbody_6DOF
• In the case directory, you will find a few scripts with the extension .sh, namely, run_all.sh, run_mesh.sh,
run_sampling.sh, run_solver.sh, and so on.
• These scripts can be used to run the case automatically by typing in the terminal, for example,
• $> sh run_solver
• These scripts are human-readable, and we highly recommend you open them, get familiar with the steps, and type the
commands in the terminal. In this way, you will get used with the command line interface and OpenFOAM commands.
• If you are already comfortable with OpenFOAM, run the cases automatically using these scripts.
• In the case directory, you will also find the README.FIRST file. In this file, you will find some additional comments.
178
Overset meshes in OpenFOAM
Floating body – Rigid body motion with overset meshes
Overset meshes
http://www.wolfdynamics.com/training/dynamicMeshes/overset_rbm1.gif
CofG z position vs. Time CofG y position vs. Time CofG x position vs. Time
CofG z linear velocity vs. Time CofG angular velocity about axis y vs. Time CofG position in the plane y-z vs. Time
181
Overset meshes in OpenFOAM
Floating body – Rigid body motion with overset meshes
• At this point, we can see how the setup of this case in the overset version is rather similar to that
using mesh morphing.
• In the dictionary constant/dynamicMeshDict, the only difference is in the selection of the
dynamic mesh solver.
…
…
…
182
Overset meshes in OpenFOAM
Floating body – Rigid body motion with overset meshes
• In the dictionary 0/pointDisplacement we select the body motion.
• For rigid body motion, the body motion is computed by the solver, therefore, we use the
boundary condition calculated.
floatingObject
{
type calculated;
value uniform (0 0 0);
}
• As all the walls are moving, we need to use the boundary condition movingWallVelocity.
• This is done in the dictionary 0/U.
floatingObject
{
type movingWallVelocity;
value uniform (0 0 0);
}
183
Overset meshes in OpenFOAM
Floating body – Rigid body motion with overset meshes
• Also, remember that during the mesh creation, we need to assign correctly the overset patches.
• In this case, these are the six faces of the external boundary of the inner mesh, and the
specification is provided in the dictionary blockMeshDict.
…
…
…
boundary
(
sides
{
type overset;
faces
(
(0 3 2 1)
(2 6 5 1)
(1 5 4 0)
(3 7 6 2)
(0 4 7 3)
(4 5 6 7)
);
}
…
…
…
184
Overset meshes in OpenFOAM
Floating body – Rigid body motion with overset meshes
• And as usual, you will need to adjust the numerics according to your physics.
• In the case directory, you will find the script extractData.
• This script can be used to extract the position of the body during the simulation.
• In order to use the extractData script, you will need to save the log file of the simulation.
• At this point, we are ready to run the simulation.
• We will use the solver overInterDyMFoam.
• You will find the instructions of how to run the cases in the file README.FIRST located in the
case directory.
185
Roadmap
187
Final remarks – General guidelines
Dynamic/Overset meshes guidelines and tips
• When dealing with prescribed motions, before running the solver test the mesh motion by running the utility
moveDynamicMesh. If there are functionObjects in the controlDict dictionary, remember to use the
option –noFunctionObjects, so you do not execute them.
• If you are dealing with rigid body motion, it is not possible to use the utility moveDynamicMesh as the motion
depends on the forces, which have not been computed yet.
• When walls are moving, remember to always use the movingWallVelocity boundary condition.
• To check the mesh courant number, add the entry checkMeshCourantNo yes. You can add this option to the
PIMPLE sub-dictionary in the fvSolution dictionary.
• For moving bodies, you can use the option moveMeshOuterCorrectors yes to gain more stability. This will
update the mesh every single outer iteration of the PIMPLE loop (with iterative marching enabled). You add
this option in the PIMPLE sub-dictionary of the fvSolution dictionary.
• The motion library solidBodyMotionFunction specifies the choice of prescribed motion, the source code is
located in the directory: OpenFOAM-9/src/dynamicMesh/motionSolvers/displacement/solidBody
• The following options of prescribed motions are available:
• axisRotationMotion • oscillatingRotatingMotion
• linearMotion • rotatingMotion
• multiMotion • SDA
• oscillatingLinearMotion • sixDoFMotion
188
Final remarks – General guidelines
Dynamic/Overset meshes guidelines and tips
• Remember, you can specify a variable as an input table. So, for example, if you want to specify omega or
velocity as a function of time, you can proceed as follows,
omega table velocity table
( (
(0 0) (0 (0 0 0) )
(0.5 1) (0.5 (1 0 0) )
(1.0 5) (1.0 (5 0 0) )
) )
• Moving bodies simulations are intrinsically unsteady, however, it is possible to reach a steady solution if you
are interested in finding a trim (equilibrium) condition. In these cases, use the LTS method (local time
stepping) for time discretization.
• When dealing with dynamic meshes and using any of the dynamic mesh methods studied, a robust and
accurate numerical setup is required.
• Also, as the bodies usually experienced strong accelerations, it is recommended to keep the CFL number
below one in order to avoid spurious oscillations.
• For time discretization, the Euler method is preferred over the backwards and CrankNicolson schemes as they
may give spurious oscillations with moving meshes.
• If you are not interested in capturing the initial transient, it is recommended to start moving bodies simulations
from a previously converged steady simulation (fixed body).
189
Final remarks – General guidelines
Dynamic/Overset meshes guidelines and tips
• Overset solvers are only available in the OpenFOAM version supported by ESI-OpenCFD. The following
solvers are available:
• overPotentialFoam, overLaplacianDyMFoam, overSimpleFoam, overPimpleDyMFoam,
overRhoSimpleFoam, overRhoPimpleDyMFoam, overInterDyMFoam
• In order to use the overset solvers, you will need to add the library liboverset.so to the controlDict
dictionary.
• In overset meshes, when initializing the zoneID field, it is recommended to do it independently from other
fields. That is, use two different setFields dictionaries.
• Also, the order of the zoneID is important. It is recommended to assign the zoneID 0 to the background mesh
(usually the mesh that it is not moving or the mesh holding the external boundary conditions).
• When working with overset meshes, the GAMG solver is not supported for pressure. Use PCG or PBiCGStab
instead.
• For turbulence modeling in overset meshes, the meshWave method is not supported for wall distance
calculation. Poisson and advectionDiffusion are supported.
• If you are running steady simulation with overset meshes, use tighter under-relaxation factors (for SIMPLE and
SIMPLEC).
190
Final remarks – General guidelines
Dynamic/Overset meshes guidelines and tips
• The overset interpolation method is set in the fvSchemes dictionary, the following methods are available (they
all are non-conservative):
• cellVolumeWeight – First order accurate. Fast. It has problems with hole detection.
• inverDistance – Second order accurate. Bounded. Computationally expensive.
• leastSquares – Second order accurate. Might become unbounded. Computationally expensive. Good
accuracy.
• To print detailed information about the interpolation in overset meshes, you can add the following entry to the
controlDict dictionary:
DebugSwitches
{
overset 1;
}
• In overset meshes, it is highly recommended to use the hierarchical decomposition method when running in
parallel.
• In overset meshes, cell size close to the overset patch should be of the same size to minimize interpolation
errors.
191
Final remarks – General guidelines
Dynamic/Overset meshes guidelines and tips
• It is recommended to use explicit interpolation for the turbulence variables (k, omega, epsilon, nut and so on),
and the volume of fraction field (alpha.*). This is done in the fvSchemes dictionary as follows:
oversetInterpolationRequired
{
k;
omega;
alpha.water;
}
• If the oversetInterpolationRequired entry is empty, means full implicit interpolation of all fields.
• When running transient simulations with overset meshes, use the Euler method with a CFL number below 1,
as backwards and CrankNicolson schemes may give spurious oscillations.
• In overset meshes, the time-step must be small enough to accommodate for a sequential change of the cell
type from blocked to interpolated and then calculated. Therefore, the mesh motion CFL number should be
kept ideally below 1.
• In overset meshes, there should be at least 5 or more cells between body patches in order to construct a good
interpolation stencil. Cells next to a patch are blocking the flow and cells next to the overset patch are used to
interpolate the solution.
• Place the overset interface appropriately, preferably where the field variables do not change much. Avoid
strong pressure gradient at the overset patches.
192
Final remarks – General guidelines
Dynamic/Overset meshes guidelines and tips
• We may sound like a broken record on this, but when dealing with dynamic meshes a robust numerical setup
is required.
• Use iterative marching for the P-V coupling (PIMPLE in OpenFOAM) and perform at least two outer iterations.
• For best results, do at least five outer iterations (in our personal experience).
PISO with non-iterative marching (NITA) PISO with iterative marching (ITA) – PIMPLE
193
Thank you for your attention
• We hope you have found this training useful and we hope to see you in one of our advanced
training sessions:
• OpenFOAM® – Multiphase flows
• OpenFOAM® – Naval applications
• OpenFOAM® – Turbulence Modeling
• OpenFOAM® – Compressible flows, heat transfer, and conjugate heat transfer
• OpenFOAM® – Advanced meshing
• DAKOTA – Optimization methods and code coupling
• Python – Programming, data visualization, and exploratory data analysis
• Python and R – Data science and big data
• ParaView – Advanced scientific visualization and python scripting
• And many more available on request
• Besides consulting services, we also offer ‘Mentoring Days’ which are days of one-on-one
coaching and mentoring on your specific problem.
• For more information, ask your trainer, or visit our website
http://www.wolfdynamics.com/
195
[email protected]
Let’s connect www.wolfdynamics.com
196