fvMeshTopoChangers::meshToMesh: New fvMesh topoChanger which maps to a sequence of meshes at run-time

With fvMeshTopoChangers::meshToMesh it is now possible to map the solution to a
specified sequence of pre-generated meshes at run-time to support arbitrary mesh
changes, refinements, un-refinements, changes in region topology, geometry,
etc.  Additionally mesh-motion between the sequence of meshes is supported to
allow for e.g. piston and valve motion in engines.

The tutorials/incompressible/pimpleFoam/laminar/movingCone case has been updated
to provide a demonstration of the advantages of this run-time mesh-mapping by
mapping to meshes that are finer behind the cone and coarser in front of the
cone as the cone approaches the end of the domain, thus maintaining good
resolution while avoiding excessive cell aspect ratio as the mesh is squeezed.
The dynamicMeshDict for the movingCone case is;

mover
{
    type            motionSolver;

    libs            ("libfvMeshMovers.so" "libfvMotionSolvers.so");

    motionSolver    velocityComponentLaplacian;

    component       x;
    diffusivity     directional (1 200 0);
}

topoChanger
{
    type    meshToMesh;

    libs    ("libmeshToMeshTopoChanger.so");

    times   (0.0015 0.003);

    timeDelta 1e-6;
}

which lists the mesh mapping times 0.0015s 0.003s and meshes for these times in
directories constant/meshToMesh_0.0015 and constant/meshToMesh_0.003 are
generated in the Allrun script before the pimpleFoam run:

runApplication -a blockMesh -dict blockMeshDict.2
rm -rf constant/meshToMesh_0.0015
mkdir constant/meshToMesh_0.0015
mv constant/polyMesh constant/meshToMesh_0.0015

runApplication -a blockMesh -dict blockMeshDict.3
rm -rf constant/meshToMesh_0.003
mkdir constant/meshToMesh_0.003
mv constant/polyMesh constant/meshToMesh_0.003

runApplication -a blockMesh -dict blockMeshDict.1

runApplication $application

Note: This functionality is experimental and has only undergone basic testing.
It is likely that it does not yet work with all functionObject, fvModels
etc. which will need updating to support this form of mesh topology change.
This commit is contained in:
Henry Weller
2022-04-06 16:37:22 +01:00
parent 1c8f92f52a
commit 47b0cd54dd
48 changed files with 1585 additions and 131 deletions

View File

@ -19,6 +19,8 @@ internalField uniform (0 0 0);
boundaryField
{
#includeEtc "caseDicts/setConstraintTypes"
movingWall
{
type movingWallVelocity;
@ -45,16 +47,6 @@ boundaryField
{
type noSlip;
}
back
{
type wedge;
}
front
{
type wedge;
}
}
// ************************************************************************* //

View File

@ -19,6 +19,8 @@ internalField uniform 0;
boundaryField
{
#includeEtc "caseDicts/setConstraintTypes"
movingWall
{
type zeroGradient;
@ -44,16 +46,6 @@ boundaryField
{
type zeroGradient;
}
back
{
type wedge;
}
front
{
type wedge;
}
}
// ************************************************************************* //

View File

@ -9,7 +9,7 @@ FoamFile
{
format ascii;
class pointScalarField;
object pointMotionU;
object pointMotionUx;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -19,37 +19,35 @@ internalField uniform 0;
boundaryField
{
#includeEtc "caseDicts/setConstraintTypes"
movingWall
{
type uniformFixedValue;
uniformValue constant 1;
}
farFieldMoving
{
type slip;
}
fixedWall
{
type uniformFixedValue;
uniformValue constant 0;
}
left
{
type uniformFixedValue;
uniformValue constant 0;
}
farField
{
type slip;
}
back
{
type wedge;
}
front
{
type wedge;
}
}
// ************************************************************************* //

View File

@ -0,0 +1,11 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
# Source tutorial clean functions
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
rm -rf constant/meshToMesh*
cleanCase
#------------------------------------------------------------------------------

View File

@ -0,0 +1,23 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions
application=$(getApplication)
runApplication -a blockMesh -dict blockMeshDict.2
rm -rf constant/meshToMesh_0.0015
mkdir constant/meshToMesh_0.0015
mv constant/polyMesh constant/meshToMesh_0.0015
runApplication -a blockMesh -dict blockMeshDict.3
rm -rf constant/meshToMesh_0.003
mkdir constant/meshToMesh_0.003
mv constant/polyMesh constant/meshToMesh_0.003
runApplication -a blockMesh -dict blockMeshDict.1
runApplication $application
#------------------------------------------------------------------------------

View File

@ -27,4 +27,16 @@ mover
}
topoChanger
{
type meshToMesh;
libs ("libmeshToMeshTopoChanger.so");
times (0.0015 0.003);
timeDelta 1e-6;
}
// ************************************************************************* //

View File

@ -41,15 +41,20 @@ vertices
blocks
(
hex (0 1 5 4 0 1 13 12) (15 15 1) simpleGrading (1 1 1)
hex (0 1 5 4 0 1 13 12) (8 15 1) simpleGrading (1 1 1)
hex (2 3 7 6 2 3 15 14) (20 20 1) simpleGrading (2 0.25 1)
hex (4 5 9 8 12 13 17 16) (15 15 1) simpleGrading (1 1 1)
hex (4 5 9 8 12 13 17 16) (8 15 1) simpleGrading (1 1 1)
hex (5 6 10 9 13 14 18 17) (50 15 1) simpleGrading (1 1 1)
hex (6 7 11 10 14 15 19 18) (20 15 1) simpleGrading (2 1 1)
);
boundary
(
internal
{
type internal;
faces ();
}
movingWall
{
type wall;

View File

@ -0,0 +1,139 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 0.001;
vertices
(
(-7.5 0 0)
(-5.5 0 0)
(-2 0 0)
(0 0 0)
(-7.5 0.75 -0.032745707)
(-5.5 0.75 -0.032745707)
(-2 2 -0.087321886)
(0 2 -0.087321886)
(-7.5 2.5 -0.10915236)
(-5.5 2.5 -0.10915236)
(-2 2.5 -0.10915236)
(0 2.5 -0.10915236)
(-7.5 0.75 0.032745707)
(-5.5 0.75 0.032745707)
(-2 2 0.087321886)
(0 2 0.087321886)
(-7.5 2.5 0.10915236)
(-5.5 2.5 0.10915236)
(-2 2.5 0.10915236)
(0 2.5 0.10915236)
);
blocks
(
hex (0 1 5 4 0 1 13 12) (16 15 1) simpleGrading (1 1 1)
hex (2 3 7 6 2 3 15 14) (10 20 1) simpleGrading (2 0.25 1)
hex (4 5 9 8 12 13 17 16) (16 15 1) simpleGrading (1 1 1)
hex (5 6 10 9 13 14 18 17) (50 15 1) simpleGrading (1 1 1)
hex (6 7 11 10 14 15 19 18) (10 15 1) simpleGrading (2 1 1)
);
boundary
(
internal
{
type internal;
faces ();
}
movingWall
{
type wall;
faces
(
(1 5 13 1)
(5 6 14 13)
(2 2 14 6)
);
}
farFieldMoving
{
type patch;
faces
(
(9 17 18 10)
);
}
fixedWall
{
type wall;
faces
(
(3 7 15 3)
(7 11 19 15)
);
}
axis
{
type empty;
faces
(
(0 1 1 0)
(2 3 3 2)
);
}
left
{
type patch;
faces
(
(0 0 12 4)
(4 12 16 8)
);
}
farField
{
type patch;
faces
(
(8 16 17 9)
(10 18 19 11)
);
}
back
{
type wedge;
faces
(
(0 4 5 1)
(2 6 7 3)
(4 8 9 5)
(5 9 10 6)
(6 10 11 7)
);
}
front
{
type wedge;
faces
(
(0 1 13 12)
(2 3 15 14)
(12 13 17 16)
(13 14 18 17)
(14 15 19 18)
);
}
);
// ************************************************************************* //

View File

@ -0,0 +1,139 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 0.001;
vertices
(
(-7.5 0 0)
(-4 0 0)
(-0.5 0 0)
(0 0 0)
(-7.5 0.75 -0.032745707)
(-4 0.75 -0.032745707)
(-0.5 2 -0.087321886)
(0 2 -0.087321886)
(-7.5 2.5 -0.10915236)
(-4 2.5 -0.10915236)
(-0.5 2.5 -0.10915236)
(0 2.5 -0.10915236)
(-7.5 0.75 0.032745707)
(-4 0.75 0.032745707)
(-0.5 2 0.087321886)
(0 2 0.087321886)
(-7.5 2.5 0.10915236)
(-4 2.5 0.10915236)
(-0.5 2.5 0.10915236)
(0 2.5 0.10915236)
);
blocks
(
hex (0 1 5 4 0 1 13 12) (25 15 1) simpleGrading (1 1 1)
hex (2 3 7 6 2 3 15 14) (5 20 1) simpleGrading (2 0.25 1)
hex (4 5 9 8 12 13 17 16) (25 15 1) simpleGrading (1 1 1)
hex (5 6 10 9 13 14 18 17) (50 15 1) simpleGrading (1 1 1)
hex (6 7 11 10 14 15 19 18) (5 15 1) simpleGrading (2 1 1)
);
boundary
(
internal
{
type internal;
faces ();
}
movingWall
{
type wall;
faces
(
(1 5 13 1)
(5 6 14 13)
(2 2 14 6)
);
}
farFieldMoving
{
type patch;
faces
(
(9 17 18 10)
);
}
fixedWall
{
type wall;
faces
(
(3 7 15 3)
(7 11 19 15)
);
}
axis
{
type empty;
faces
(
(0 1 1 0)
(2 3 3 2)
);
}
left
{
type patch;
faces
(
(0 0 12 4)
(4 12 16 8)
);
}
farField
{
type patch;
faces
(
(8 16 17 9)
(10 18 19 11)
);
}
back
{
type wedge;
faces
(
(0 4 5 1)
(2 6 7 3)
(4 8 9 5)
(5 9 10 6)
(6 10 11 7)
);
}
front
{
type wedge;
faces
(
(0 1 13 12)
(2 3 15 14)
(12 13 17 16)
(13 14 18 17)
(14 15 19 18)
);
}
);
// ************************************************************************* //

View File

@ -22,13 +22,13 @@ startTime 0;
stopAt endTime;
endTime 0.003;
endTime 0.0034;
deltaT 5e-06;
writeControl timeStep;
writeControl adjustableRunTime;
writeInterval 40;
writeInterval 1e-4;
purgeWrite 0;
@ -44,9 +44,9 @@ timePrecision 6;
runTimeModifiable true;
adjustTimeStep no;
adjustTimeStep yes;
maxCo 0.2;
maxCo 0.5;
functions
{

View File

@ -0,0 +1,42 @@
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: dev
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
format ascii;
class dictionary;
location "system";
object decomposeParDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
numberOfSubdomains 4;
method hierarchical;
simpleCoeffs
{
n (2 1 1);
}
hierarchicalCoeffs
{
n (4 1 1);
order xyz;
}
manualCoeffs
{
dataFile "";
}
distributed no;
roots ( );
// ************************************************************************* //

View File

@ -28,7 +28,7 @@ divSchemes
{
default none;
div(phi,U) Gauss linear;
div(phi,U) Gauss linearUpwind grad(U);
div((nuEff*dev2(T(grad(U))))) Gauss linear;
}

View File

@ -19,10 +19,11 @@ solvers
p
{
solver GAMG;
smoother DIC;
cacheAgglomeration no;
tolerance 0;
relTol 0.01;
smoother GaussSeidel;
cacheAgglomeration no;
}
pFinal
@ -41,16 +42,16 @@ solvers
U
{
solver smoothSolver;
smoother symGaussSeidel;
tolerance 1e-05;
solver PBiCGStab;
preconditioner DILU;
tolerance 1e-6;
relTol 0.1;
}
UFinal
{
$U;
tolerance 1e-05;
relTol 0;
}