Tutorial 5
Tutorial 5
1
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 10 and older versions, this patch type is called arbitrary mesh interface (AMI).
• Starting from OpenFOAM 11, this patch is called non-conformal coupling (NCC).
• To reduce interpolation errors at the AMI/NCC patches, the meshes should be similar in the
owner and neighbour patches.
http://www.wolfdynamics.com/training/movingbodies/image8.gif
Rotating domain
Rotating patch Fix patch
Owner patch Neighbour patch 2
Sliding meshes in OpenFOAM
• To connect regions of a domain with independent meshes for applications including rotating
geometry, we must use a boundary condition that it is able to interpolate the solution between
the different domains.
• The NCC approach offers a coupling that is fully conservative and second order accurate in
space, unlike the Arbitrary Mesh Interface (AMI) and associated ACMI and Repeat AMI
methods which NCC replaces.
• The process of creating NCC patches is very similar to creating AMI patches.
• Hereafter we will only address NCC boundary conditions.
http://www.wolfdynamics.com/training/meshing/image5.gif http://www.wolfdynamics.com/training/meshing/image6.gif
3
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
4
Sliding meshes in OpenFOAM
• Sliding meshes are intrinsically unsteady.
• No need to say that in order to use sliding meshes (for rotating bodies) 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.
http://www.wolfdynamics.com/training/meshing/train2.gif http://www.wolfdynamics.com/training/meshing/train3.gif 6
Sliding meshes in OpenFOAM
Other uses of NCC (and AMI) boundary conditions
http://www.wolfdynamics.com/training/meshing/train4.gif http://www.wolfdynamics.com/training/meshing/train5.gif 7
Sliding meshes in OpenFOAM
Non-conformal coupling (NCC) in OpenFOAM
• Starting from OpenFOAM 10 and in the developer version of OpenFOAM, the AMI patches
have been replaced by NCC patches (non-conformal coupling).
• This new patch, offers a coupling that is fully conservative (according to the developers) and
second order accurate in space, unlike the Arbitrary Mesh Interface (AMI) and associated ACMI
and Repeat AMI methods which NCC replaces.
• The process of meshing for NCC is very similar to existing processes for meshing for AMI.
• Coupling is instead achieved by running the new createNonConformalCouples utility, which
creates additional coupled patches of type nonConformalCyclic. These appear in the
constant/polyMesh/boundary file with zero faces; they are populated with faces in the
finite volume mesh during the connection process in NCC.
• More information at the following links,
• https://cfd.direct/openfoam/free-software/non-conformal-coupling/
• https://cfd.direct/openfoam/free-software/using-non-conformal-coupling/
• https://github.com/OpenFOAM/OpenFOAM-
dev/commit/569fa31d09f98e29d1aaf84d40bb16043f104ec6
8
Sliding meshes in OpenFOAM
Non-conformal coupling (NCC) in OpenFOAM
• For moving mesh cases, it may be necessary to correct the mesh fluxes that are changed as a
result of the connection procedure. If the connected patches do not conform perfectly to the
mesh motion, then failure to correct the fluxes can result in noise in the pressure solution.
• Correction for the mesh fluxes is enabled by the correctMeshPhi switch in the PIMPLE (or
equivalent) section of system/fvSolution. When it is enabled, solver settings are required
for MeshPhi.
• NCC replaces the functionality provided by AMI, ACMI and Repeat AMI.
• ACMI and Repeat AMI are insufficiently reliable to warrant further maintenance so are removed
in an accompanying commit to OpenFOAM-dev.
• AMI is more widely used so will be retained alongside NCC for the next version release of
OpenFOAM (that is, OpenFOAM 11) and then subsequently removed from OpenFOAM-dev.
• More information at the following links,
• https://cfd.direct/openfoam/free-software/non-conformal-coupling/
• https://cfd.direct/openfoam/free-software/using-non-conformal-coupling/
• https://github.com/OpenFOAM/OpenFOAM-
dev/commit/569fa31d09f98e29d1aaf84d40bb16043f104ec6
9
Sliding meshes in OpenFOAM
Using NCC in OpenFOAM
• The process of meshing for NCC is very similar to older workflow for meshing with AMI.
• We will cover the mesh preparation steps.
• We also invite you to carefully read the developers’ notes.
• https://cfd.direct/openfoam/free-software/using-non-conformal-coupling/
10
Sliding meshes in OpenFOAM
Using NCC in OpenFOAM
• Boundary conditions for NCC are very different from those for AMI.
• We will cover how to set boundary conditions,
• We also invite you to carefully read the notes from the developers.
• https://cfd.direct/openfoam/free-software/using-non-conformal-coupling/
11
Sliding meshes in OpenFOAM
Using NCC in OpenFOAM
• For moving mesh cases, it may be necessary to correct the mesh fluxes that are changed as a
result of the connection procedure
• We will cover how to define this correction.
• We also invite you to carefully read the notes from the developers.
• https://cfd.direct/openfoam/free-software/using-non-conformal-coupling/
12
Sliding meshes in OpenFOAM
Potential error with paraview/paraFOAM
• If you get the error below when post-processing a decomposed case with NCC patches, try to use a newer
version of paraview (5.13 or newer).
• The paraview version distributed with OpenFOAM 12 (paraview 5.11.2), will give you this error.
• It is worth stressing that you will get this error only when post-processing the decomposed case.
13
snappyHexMesh guided tutorials
NCC approach
14
snappyHexMesh guided tutorials
CSTR – Continuous stirring tank reactor mesh
• The workflow to create a mesh with NCC boundary conditions can be summarized as follows:
• A mesh is generated with an identifiable set of internal faces which coincide with the
surface through which the mesh will be coupled.
• These faces are then duplicated by running the createBaffles utility to create two
boundary patches.
• The points are then split using splitBaffles in order to permit independent motion of
the patches. Up to this point, the patches remain non-coupled, e.g. a wall type.
• Coupling is then achieved by running the createNonConformalCouples utility, which
creates additional coupled patches of type nonConformalCyclic. These appear in the
constant/polyMesh/boundary file with zero faces; they are populated with faces in
the finite volume mesh during the connection process in NCC.
15
snappyHexMesh guided tutorials
CSTR – Continuous stirring tank reactor mesh
• For a single couple, such as that which separates the rotating and stationary sections of the
current mesh, the utility can be called using the non-coupled patch names as arguments,
• createNonConformalCouples -overwrite rotatingZoneInner rotatingZoneOuter
• where rotatingZoneInner and rotatingZoneOuter are the names of the patches created using
the utility createBaffles.
• For multiple couples, and/or couples with transformations, createNonConformalCouples
should be run without arguments.
• Settings will then be read from a configuration file named
createNonConformalCouplesDict and located in the system directory.
• You can find a template at the following directory,
• $FOAM_ETC/caseDicts/annotated/createNonConformalCouplesDict
• It is worth noting that the process of meshing for NCC is very similar to existing processes for
meshing for AMI.
16
snappyHexMesh guided tutorials
CSTR – Continuous stirring tank reactor mesh
• Let us open the snappyHexMesh dictionary.
• Let us focus our attention on the section where we create the different zones (a cellZone and a faceZone).
• Zones are created in the castellatedMeshControls section of the dictionary snappyHexMeshDict.
• In this block we define the cellZone and faceZone, as follows,
castellatedMeshControls
{ Using the surface inner_volume object (that
... was loaded in the geometry section of the
... dictionary snappyHexMeshDict), we create a
...
mesh zone (cellZone and faceZone) that we
//Surface based refinement will use at a later time to split the whole mesh in
inner_volume two regions.
(
level (1 1);
1. $> sh run_all.sh
18
snappyHexMesh guided tutorials
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
19
snappyHexMesh guided tutorials
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.
20
snappyHexMesh guided tutorials
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, as the cell zone exist.
21
snappyHexMesh guided tutorials
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).
…
…
…
• For sliding meshes, we still need to split the mesh in two or more regions.
• We will use the following utilities:
• createBaffles
• splitBaffles
22
snappyHexMesh guided tutorials
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
{
nonCouple Name of the baffle group (user defined)
{
23
snappyHexMesh guided tutorials
CSTR – Continuous stirring tank reactor mesh
• To create the NCC interface and the two regions (if they don’t exist), we proceed as follows
(notice that we are going to work in serial from now on):
24
snappyHexMesh guided tutorials
CSTR – Continuous stirring tank reactor mesh
• So, what did we do?
• Step 1 (compulsory):
• Splits the mesh in regions using the baffles (faceZone), created during the meshing
stage.
• We also create the NCC1 and NCC2 boundary patches.
• At this point we have two regions and one zone.
• However, the two regions are stich together via the patches NCC1 and NCC2.
25
snappyHexMesh guided tutorials
CSTR – Continuous stirring tank reactor mesh
• So, what did we do?
• Step 2 (compulsory):
• Topologically split the patches NCC1 and NCC2.
• As we removed the link between NCC1 and NCC2, the regions are free to move.
• If you run checkMesh, you will notice that we have two regions.
• This mesh is a valid mesh to be used with the sliding meshes approach.
26
snappyHexMesh guided tutorials
CSTR – Continuous stirring tank reactor mesh
• So, what did we do?
• Step 3 (compulsory):
• Creates the non-conformal coupling NCC from patches NCC1 and NCC2.
• The utility createNonConformalCouples creates additional coupled patches of
type nonConformalCyclic.
• These appear in the constant/polyMesh/boundary file with zero faces; they are
populated with faces in the finite volume mesh during the connection process in NCC.
• For a single couple, such as that which separates the rotating and stationary sections
of the mesh, the utility can be called using the non-coupled patch names as
arguments,
• createNonConformalCouples -overwrite NCC1 NCC2
• Where NCC1 and NCC2 are the names of the patches crated in step 1.
27
snappyHexMesh guided tutorials
CSTR – Continuous stirring tank reactor mesh
• So, what did we do?
• Step 3 (compulsory):
• For multiple couples, and/or couples with transformations,
createNonConformalCouples should be run without arguments.
• Settings will then be read from a configuration file named
system/createNonConformalCouplesDict.
28
snappyHexMesh guided tutorials
CSTR – Continuous stirring tank reactor mesh
• Optional steps that can be used when creating NCC patches (after steps 1, 2, 3)
• Step 4 (optional): gets rid of zero faced patches if they exist. These are the patches remaining
from the base mesh, as they are empty, we do not need them.
• Step 5 (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 6 (optional): just to show the regions and names.
29
snappyHexMesh guided tutorials
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
…
…
…
31
snappyHexMesh guided tutorials
CSTR – Continuous stirring tank reactor mesh
• At this point the mesh is ready to be used with the sliding meshes approach.
• You can visualize the mesh using paraFoam.
• If you use checkMesh, it will report that there are two regions.
• In the dictionary constant/dynamicsMeshDict we set which region will move and the
rotation parameters.
• To preview the region motion, in the terminal type:
• movingMesh is the new solver module to move the mesh that replaces the moveMesh and
earlier moveDynamicMesh utilities.
• You can find more information at this link,
• https://github.com/OpenFOAM/OpenFOAM-
dev/commit/260a8502f01309562da2d20990951787f9ffa469
32
snappyHexMesh guided tutorials
CSTR – Continuous stirring tank reactor mesh
• At initialization time, all geometrical errors are computed for the initial position of the NCC
boundaries.
• For perfectly matching meshes (assuming that it is the case for the initial position), the
coverage error is one.
• Whereas the other quantities (openness/error/depth/angle) are close to zero.
…
…
…
patchToPatch: Calculating couplings between 2673 source faces and 2673 target faces
Source min/average/max coverage = 1/1/1
Target min/average/max coverage = 1/1/1
Source average openness/error/depth/angle = 5.834244807e-17/6.875966547e-16/2.521867865e-16/1.519253592e-07
Source max openness/error/depth/angle = 4.159709791e-16/9.618110783e-15/4.937357051e-15/1.707547293e-06
5436 couplings calculated in 0.349823s
fvMeshStitcher: Connecting
45/48 small couplings removed/added to nonConformalCyclic_on_NCC1
Cell min/avg/max openness = 0/5.962531112e-17/1.300296905e-15
Selecting fvMeshMover motionSolver
Selecting motion solver: solidBody
Selecting solid-body motion function rotatingMotion
- selecting cells using cellZone cell_inner_volume
Selecting solver incompressibleFluid
…
…
…
33
snappyHexMesh guided tutorials
CSTR – Continuous stirring tank reactor mesh
• After the first iteration, all geometrical and conservation errors at the NCC boundaries starts to
deviate from the initial state (perfectly matching meshes).
• As the mesh starts to move (and the NCC patches are not perfectly matching),
• Coverage error should be close to one.
• The quantities openness/error/depth/angle should be close to zero or small.
• Volume conservation error should be close to zero.
…
…
…
PIMPLE: Iteration 1
- selected 276112 cell(s) with volume 9.38694684
patchToPatch: Calculating couplings between 2673 source faces and 2673 target faces
Source min/average/max coverage = 0.9901658013/0.9999905173/1
Target min/average/max coverage = 0.9813063398/0.9999884681/1
Source average openness/error/depth/angle = 1.417206755e-16/2.275616069e-05/0.0001066612949/0.05170070351
Source max openness/error/depth/angle = 6.693809928e-16/0.012167691/0.01294920104/3.721198216
23956 couplings calculated in 0.112453s
fvMeshStitcher: Connecting
DICPCG: Solving for MeshPhi, Initial residual = 1, Final residual = 0.009794065886, No Iterations 16
Cell min/avg/max openness = 0/5.957575079e-17/3.381574629e-16
Cell min/avg/max volume conservation error = -6.250542767e-15/-2.310225538e-19/6.740386637e-15
- selecting all cells
- selected 276112 cell(s) with volume 9.38694684
DICPCG: Solving for pcorr, Initial residual = 1, Final residual = 9.729626295e-07, No Iterations 134
DICPCG: Solving for pcorr, Initial residual = 0.2811660554, Final residual = 9.670708134e-07, No Iterations 95
DILUPBiCGStab: Solving for Ux, Initial residual = 1, Final residual = 9.738421148e-09, No Iterations 4
DILUPBiCGStab: Solving for Uy, Initial residual = 1, Final residual = 6.855897803e-10, No Iterations 4
DILUPBiCGStab: Solving for Uz, Initial residual = 1, Final residual = 1.9254539e-09, No Iterations 3
DICPCG: Solving for p, Initial residual = 1, Final residual = 9.810391143e-07, No Iterations 224
DICPCG: Solving for p, Initial residual = 0.2958468192, Final residual = 9.858938828e-07, No Iterations 94
time step continuity errors : sum local = 1.926422976e-10, global = -6.251194308e-12
DICPCG: Solving for p, Initial residual = 0.1606323101, Final residual = 9.210452718e-07, No Iterations 211
DICPCG: Solving for p, Initial residual = 0.05099778996, Final residual = 9.558772473e-07, No Iterations 102
time step continuity errors : sum local = 2.277079592e-10, global = 5.016874791e-12
DICPCG: Solving for p, Initial residual = 0.05653450391, Final residual = 9.904724655e-07, No Iterations 101
DICPCG: Solving for p, Initial residual = 0.01734203487, Final residual = 9.639817656e-07, No Iterations 67
time step continuity errors : sum local = 2.182714662e-10, global = 1.473874789e-11 Continuity errors
…
35
snappyHexMesh guided tutorials
CSTR – Continuous stirring tank reactor mesh
• The utility checkMesh, can be used to report the quality of the NCC interpolation.
• To report the coverage information of the NCC patches, execute checkMesh as follows:
• $> checkMesh –allGeometry
• To save the coverage information, you need to first generate the moving mesh.
• $> foamRun -solver movingMesh
• Inside each directory, you will find the files NCC1_coverage.vtk and
NCC2_coverage.vtk.
• The files are prepended with the name of the NCC patch.
36
snappyHexMesh guided tutorials
CSTR – Continuous stirring tank reactor mesh
• The output of the command checkMesh –allGeometry is shown in the figure below.
• Ideally, the coverage error should be as close as possible to one.
• The quantities openness/error/depth/angle should be close to zero or small.
37
snappyHexMesh guided tutorials
CSTR – Continuous stirring tank reactor mesh
• In the figure below, the coverage field on each NCC patch is shown in paraview.
38
snappyHexMesh guided tutorials
CSTR – Continuous stirring tank reactor mesh
• In the figure below, the surface mesh on each NCC patch is shown in paraview.
39
snappyHexMesh guided tutorials
CSTR – Continuous stirring tank reactor mesh
• For NCC patches that fully overlap, boundary conditions are typically applied to fields which
correspond to a slip wall:
• movingWallSlipVelocity (or slip if the mesh is stationary) for velocity U;
• zeroGradient or fixedFluxPressure for pressure p;
• calculated for nut;
• zeroGradient for other fields.
• Boundary conditions also need to be specified for the nonConformalCyclic patches created by
createNonConformalCouples.
• It is generally recommended that this is done by including the
$FOAM_ETC/caseDicts/setConstraintTypes file in the boundaryField section of each
of the field files.
• You can find more information at the following links,
• https://cfd.direct/openfoam/free-software/using-non-conformal-coupling/
• https://github.com/OpenFOAM/OpenFOAM-
dev/commit/569fa31d09f98e29d1aaf84d40bb16043f104ec6
40
snappyHexMesh guided tutorials
CSTR – Continuous stirring tank reactor mesh
NCC – Solver and algorithm controls
• For moving mesh cases, it may be necessary to correct the solvers
mesh fluxes that are changed as a result of the connection {
procedure. MeshPhi
{
• If the connected patches do not conform perfectly to the mesh solver smoothSolver;
motion, then failure to correct the fluxes can result in noise in smoother symGaussSeidel;
the pressure solution. tolerance 1e-2;
relTol 0;
• Correction for the mesh fluxes is enabled by the }
correctMeshPhi switch in the PIMPLE (or equivalent) section
of system/fvSolution. ...
...
• When it is enabled, solver settings are required for MeshPhi. ...
• The solution just needs to distribute the error enough to
}
dissipate the noise.
• A smooth solver with a loose tolerance is sufficient, e.g. the PIMPLE
{
settings in system/fvSolution.
correctMeshPhi yes;
• The solution of MeshPhi is an inexpensive computation since
it is applied only to a small subset of the mesh adjacent to the ...
...
couple. ...
• Conservation is maintained whether or not the mesh flux
}
correction is enabled, and regardless of the solution tolerance
for MeshPhi. 41
snappyHexMesh guided tutorials
42
snappyHexMesh guided tutorials
CSTR – Continuous stirring tank reactor mesh
Shaft
Let us take a look at the dictionary type rotatingWallVelocity;
dynamicMeshDict used to define the motion origin (0 0 0);
axis (0 0 1);
omega constant 12.566370;
value uniform (0 0 0);
Impeller
mover
{ Motion libraries and solvers.
type motionSolver; For multiple bodies use the motion
libs ("libfvMotionSolvers.so"); solver multiSolidBodyMotionSolver
motionSolver solidBody;
cellZone cell_inner_volume; Rotating zone selection
solidBodyMotionFunction rotatingMotion;
origin (0 0 0);
axis (0 0 1);
Motion type.
omega constant 12.566370; Omega is given in rad/s
}
43
snappyHexMesh guided tutorials
CSTR – Continuous stirring tank reactor mesh
Shaft
Let us compare the motion dictionaries type rotatingWallVelocity;
used for NCC and MRF simulations origin (0 0 0);
axis (0 0 1);
omega constant 12.566370;
Impeller value uniform (0 0 0);
} • finiteVolume/cfdTools/general/MRF/derivedFvPatchFields/MRFnoSlip/
• finiteVolume/cfdTools/general/MRF/derivedFvPatchFields/MRFslip/
boundaryField
{
rotor
{
type MRFnoSlip; Or if the case has several MRF zones the particular
MRFZoneName rotor; zone this patch is in must be named explicitly
}
45
snappyHexMesh guided tutorials
CSTR – Continuous stirring tank reactor with two impellers
• And of course, it is possible to put several regions into motion (sliding meshes).
• For a single zone you can use the solver solidBody.
• For multiple regions, you will need to use the solver multiSolidBodyMotionSolver.
• The solver multiSolidBodyMotionSolver lets you use a single cellZone or multiple cellZone, so it is more
general.
• You will need to create the cellZones and the AMI/NCC patches.
• In this case, the NCC settings are read from the dictionary createNonConformalCouplesDict.
shaft1
rotatingWallVelocity
(fixed patch) impeller2
movingWallVelocity
shaft2 (rotating patch)
rotatingWallVelocity
(fixed patch) impeller1
movingWallVelocity
(rotating patch)
http://www.wolfdynamics.com/training/dynamicMeshes/sliding1.gif 46
snappyHexMesh guided tutorials
CSTR – Continuous stirring tank reactor with two impellers
• For multiple regions, the dictionary dynamicsMeshDict looks like as follows:
mover
{ cell_inner_volume2
type motionSolver;
}
You will find this tutorial in the directory
CSTR_two_impellers_NCC
}
47
snappyHexMesh guided tutorials
CSTR – Continuous stirring tank reactor mesh
• With this tutorial, you will find additional cases dealing with MRF and a CSTR with two
impellers:
• CSTR_one_impeller_sliding_NCC_PIMPLE – Sliding meshes approach, unsteady,
NCC.
• CSTR_one_impeller_MRF_SIMPLE – MRF approach, steady, only cell zones
• CSTR_two_impellers_NCC – Sliding meshes approach, unsteady, NCC
• CSTR_one_impeller_sliding_AMI – Demonstration of old AMI approach*.
48
snappyHexMesh guided tutorials
Bonus slides
49
snappyHexMesh guided tutorials
AMI approach
50
snappyHexMesh guided tutorials
CSTR – Continuous stirring tank reactor mesh
• After generating the mesh with the respective zones (cellZone and faceZone), the next step is
splitting the mesh in two regions.
• Let us now create the two regions, we will use the following dictionaries and files:
• system/createBafflesDict
• system/createPatchDict
51
snappyHexMesh guided tutorials
CSTR – Continuous stirring tank reactor mesh
• The utility createBaffles, reads the dictionary createBafflesDict.
• With this utility we create the interface patches between the fixed zone and the rotating zone.
baffles
{
rotating Name of the baffle group – Given by the user
{
type faceZone; Use faceZone
zoneName face_inner_volume; Face to use to construct the AMI.
Generated during the meshing stage.
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
52
snappyHexMesh guided tutorials
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),
53
snappyHexMesh guided tutorials
CSTR – Continuous stirring tank reactor mesh
• So, what did we do?
• Step 1 (compulsory):
• 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 (compulsory):
• Topologically split the patches AMI1 and AMI2.
• As we removed the link between AMI1 and AMI2, the regions are free to move.
• If you run checkMesh, you will notice that we have two regions.
• This mesh is a valid mesh to be used with the sliding meshes approach.
54
snappyHexMesh guided tutorials
CSTR – Continuous stirring tank reactor mesh
• So, what did we do?
• Step 3 (optional):
• Gets rid of zero faced patches if they exist.
• These are the patches remaining from the base mesh, as they are empty, we do not
need them.
• Step 4 (optional):
• Just to show the regions and names.
• Step 5 (optional):
• Scales the mesh.
55
snappyHexMesh guided tutorials
CSTR – Continuous stirring tank reactor mesh
• At this point the mesh is ready to use.
• You can visualize the mesh and the regions using paraFoam.
• If you use checkMesh, it will report two regions.
• In the dictionary constant/dynamicsMeshDict we set which region will move and the
rotation parameters.
• To preview the region motion, in the terminal type:
• $> moveMesh -checkAMI -noFunctionObjects
56
snappyHexMesh guided tutorials
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
…
…
…
57
snappyHexMesh guided tutorials
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
<<Writing region 1 with 67682 cells to cellSet region1
…
…
…
59