ENH: snappyHexMesh: add buffer layers before snapping

This commit is contained in:
Mattijs Janssens
2024-12-12 16:13:32 +00:00
parent e7cf8a1d59
commit de5d34787c
231 changed files with 46574 additions and 963 deletions

View File

@ -0,0 +1,68 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2309 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
arch "LSB;label=32;scalar=64";
class pointVectorField;
location "0";
object pointDisplacement;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 1 0 0 0 0 0];
internalField uniform (0 0 0);
boundaryField
{
movingZone
{
type uniformFixedValue;
uniformValue table
(
( 0.0 (0 0 0))
( 5.0 (0.2 0 0))
(10.0 (0 0 0))
);
}
movingZoneEdges
{
//type slip;
${movingZone}
}
minX
{
type slip;
}
maxX
{
$minX
}
minY
{
$minX
}
maxY
{
$minX
}
minZ
{
$minX
}
maxZ
{
$minX
}
}
// ************************************************************************* //

View File

@ -0,0 +1,17 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/CleanFunctions # Tutorial clean functions
#------------------------------------------------------------------------------
cleanCase
rm -rf constant/extendedFeatureEdgeMesh
#- From pointMesh generation
rm -rf constant/pointMesh
rm -f constant/triSurface/blockMesh.obj
#- From surfaceFeatureExtract
rm -f constant/triSurface/box222.eMesh
#------------------------------------------------------------------------------

View File

@ -0,0 +1,47 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
#------------------------------------------------------------------------------
#- Generate mesh
runApplication blockMesh
#- Create faceZone (on unrotated mesh so is easy to select box of faces)
runApplication topoSet
#- Rotate a bit
#runApplication transformPoints -rotate-z -45
#- Generate pointMesh with additional feature patches
# (in constant/pointMesh/boundary)
# - extracted surface is not used
# - specify illegal patchname so none will be extracted (could use
# '-excludePatches' instead)
# - extract feature points of faceZone
# - additionally extract all points of faceZone (-extractZonePoints)
runApplication surfaceMeshExtract \
-featureAngle 45 \
-patches '(ZZZZZZ)' \
-faceZones '(movingZone)' -extractZonePoints \
constant/triSurface/blockMesh.obj
#- For postprocessing: extract new pointPatches as vtk files
setSet <<EOF
pointSet p0 new patchToPoint movingZone
pointSet p1 new patchToPoint movingZoneEdges
EOF
#- TBD. move triSurfaces to resources
#mkdir -p constant/triSurface
#cp -f \
# "$FOAM_TUTORIALS"/resources/geometry/box222.obj \
# constant/triSurface/
#- Extract features from surface. Writes .eMesh
runApplication surfaceFeatureExtract
#- Morph mesh to the surface (.obj file) and feature-edges (.eMesh file)
#- Note: needs point-based motion solver
runApplication moveDynamicMesh
#------------------------------------------------------------------------------

View File

@ -0,0 +1,2 @@
Demo of applying mesh motion to internal faces. Note: using point-based
motion-solver since no boundary faces to put motion bcs on.

View File

@ -0,0 +1,31 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2312 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object dynamicMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dynamicFvMesh dynamicMotionSolverFvMesh;
// For point-bcs
motionSolverLibs (fvMotionSolvers);
motionSolver displacementPointSmoothing;
displacementPointSmoothingCoeffs
{
// Use geometricElementTransform to maintain relative sizes
pointSmoother geometricElementTransform;
transformationParameter 0.667;
nPointSmootherIter 10;
}
// ************************************************************************* //

View File

@ -0,0 +1,79 @@
# Generated by Visualization Toolkit
v -1 -1 -1
v -1 -1 1
v -1 1 -1
v -1 1 1
v 1 -1 -1
v 1 -1 1
v 1 1 -1
v 1 1 1
v -1 -1 -1
v -1 -1 1
v 1 -1 -1
v 1 -1 1
v -1 1 -1
v -1 1 1
v 1 1 -1
v 1 1 1
v -1 -1 -1
v 1 -1 -1
v -1 1 -1
v 1 1 -1
v -1 -1 1
v 1 -1 1
v -1 1 1
v 1 1 1
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn -1 0 0
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn 1 0 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 -1 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 1 0
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
vn 0 0 -1
vn 0 0 1
vn 0 0 1
vn 0 0 1
vn 0 0 1
vt -0.5 -0.5
vt 1.5 -0.5
vt -0.5 1.5
vt 1.5 1.5
vt 0.5 -0.5
vt -1.5 -0.5
vt 0.5 1.5
vt -1.5 1.5
vt 0.5 0.5
vt 0.5 -1.5
vt -1.5 0.5
vt -1.5 -1.5
vt -0.5 0.5
vt -0.5 -1.5
vt 1.5 0.5
vt 1.5 -1.5
vt 0.5 -0.5
vt -1.5 -0.5
vt 0.5 1.5
vt -1.5 1.5
vt -0.5 -0.5
vt 1.5 -0.5
vt -0.5 1.5
vt 1.5 1.5
f 1/1/1 2/2/2 4/4/4 3/3/3
f 5/5/5 7/7/7 8/8/8 6/6/6
f 9/9/9 11/11/11 12/12/12 10/10/10
f 13/13/13 14/14/14 16/16/16 15/15/15
f 17/17/17 19/19/19 20/20/20 18/18/18
f 21/21/21 22/22/22 24/24/24 23/23/23

View File

@ -0,0 +1,95 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2312 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
scale 1;
vertices
(
// Inner block
(-2 -2 -2)
( 2 -2 -2)
( 2 2 -2)
(-2 2 -2)
(-2 -2 2)
( 2 -2 2)
( 2 2 2)
(-2 2 2)
);
blocks
(
hex (0 1 2 3 4 5 6 7) (20 20 20) grading (1 10 1) // Inner block
);
boundary
(
minX
{
type patch;
faces
(
(0 0) // block 0: x-min
);
}
maxX
{
type patch;
faces
(
(0 1) // block 0: x-max
);
}
minY
{
type patch;
faces
(
(0 2) // block 0: y-min
);
}
maxY
{
type patch;
faces
(
(0 3) // block 0: y-max
);
}
minZ
{
type patch;
faces
(
(0 4) // block 0: z-min
);
}
maxZ
{
type patch;
faces
(
(0 5) // block 0: z-max
);
}
);
// ************************************************************************* //

View File

@ -0,0 +1,53 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2312 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
DebugSwitches
{
pointBoundaryMesh 1;
}
application moveDynamicMesh;
startFrom startTime;
startTime 0;
stopAt endTime;
endTime 10;
deltaT 1;
writeControl timeStep;
writeInterval 1;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
// ************************************************************************* //

View File

@ -0,0 +1,44 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2312 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
ddtSchemes
{}
gradSchemes
{
default Gauss linear;
}
divSchemes
{}
laplacianSchemes
{
default Gauss linear corrected;
}
interpolationSchemes
{
default linear;
}
snGradSchemes
{
default corrected;
}
// ************************************************************************* //

View File

@ -0,0 +1,33 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2312 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solvers
{
"cellDisplacement.*"
{
solver GAMG;
tolerance 1e-08;
relTol 0;
smoother GaussSeidel;
}
}
PIMPLE
{}
// ************************************************************************* //

View File

@ -0,0 +1,33 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2312 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object surfaceFeatureExtractDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
box222.obj
{
// How to obtain raw features (extractFromFile || extractFromSurface)
extractionMethod extractFromSurface;
// Mark edges whose adjacent surface normals are at an angle less
// than includedAngle as features
// - 0 : selects no edges
// - 180: selects all edges
includedAngle 135;
// Write features to obj format for postprocessing
writeObj yes;
}
// ************************************************************************* //

View File

@ -0,0 +1,43 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2312 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object topoSetDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
actions
(
{
name c0;
type cellSet;
action new;
source boxToCell;
box (-1 -1 -1)(1 1 1);
}
{
name movingZoneFaces;
type faceSet;
action new;
source cellToFace;
set c0;
option outside;
}
{
name movingZone;
type faceZoneSet;
action new;
source setToFaceZone;
faceSet movingZoneFaces;
}
);
// ************************************************************************* //