mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: refineMesh: tutorial to demo directional refinement
This commit is contained in:
10
tutorials/mesh/refineMesh/cylinder/Allclean
Executable file
10
tutorials/mesh/refineMesh/cylinder/Allclean
Executable file
@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
cd "${0%/*}" || exit # Run from this directory
|
||||||
|
. ${WM_PROJECT_DIR:?}/bin/tools/CleanFunctions # Tutorial clean functions
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
cleanCase
|
||||||
|
|
||||||
|
rm -rf constant
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
26
tutorials/mesh/refineMesh/cylinder/Allrun
Executable file
26
tutorials/mesh/refineMesh/cylinder/Allrun
Executable file
@ -0,0 +1,26 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
cd "${0%/*}" || exit # Run from this directory
|
||||||
|
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
mkdir -p constant/triSurface
|
||||||
|
|
||||||
|
cp -f \
|
||||||
|
"$FOAM_TUTORIALS"/resources/geometry/cylinder.vtk.gz \
|
||||||
|
constant/triSurface/
|
||||||
|
|
||||||
|
# Generate mesh from surface (in constant/triSurface)
|
||||||
|
runApplication extrudeMesh
|
||||||
|
|
||||||
|
# Make front and back type empty
|
||||||
|
runApplication createPatch -overwrite
|
||||||
|
|
||||||
|
runApplication -s "level1" topoSet -dict system/topoSetDict_level1
|
||||||
|
|
||||||
|
runApplication -s "level1" refineMesh
|
||||||
|
|
||||||
|
runApplication -s "level2" topoSet -dict system/topoSetDict_level2
|
||||||
|
|
||||||
|
runApplication -s "level2" refineMesh
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
1
tutorials/mesh/refineMesh/cylinder/README.txt
Normal file
1
tutorials/mesh/refineMesh/cylinder/README.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
Demonstrate using user-defined coordinate system to directionally refine.
|
||||||
48
tutorials/mesh/refineMesh/cylinder/system/controlDict
Normal file
48
tutorials/mesh/refineMesh/cylinder/system/controlDict
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: v2412 |
|
||||||
|
| \\ / A nd | Website: www.openfoam.com |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class dictionary;
|
||||||
|
object controlDict;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
application snappyHexMesh;
|
||||||
|
|
||||||
|
startFrom latestTime;
|
||||||
|
|
||||||
|
startTime 0;
|
||||||
|
|
||||||
|
stopAt endTime;
|
||||||
|
|
||||||
|
endTime 100;
|
||||||
|
|
||||||
|
deltaT 1;
|
||||||
|
|
||||||
|
writeControl runTime;
|
||||||
|
|
||||||
|
writeInterval 1;
|
||||||
|
|
||||||
|
purgeWrite 0;
|
||||||
|
|
||||||
|
writeFormat ascii;
|
||||||
|
|
||||||
|
writePrecision 6;
|
||||||
|
|
||||||
|
writeCompression off;
|
||||||
|
|
||||||
|
timeFormat general;
|
||||||
|
|
||||||
|
timePrecision 6;
|
||||||
|
|
||||||
|
runTimeModifiable true;
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
84
tutorials/mesh/refineMesh/cylinder/system/createPatchDict
Normal file
84
tutorials/mesh/refineMesh/cylinder/system/createPatchDict
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: v2412 |
|
||||||
|
| \\ / A nd | Website: www.openfoam.com |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class dictionary;
|
||||||
|
object createPatchDict;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
pointSync false;
|
||||||
|
|
||||||
|
// Patches to create.
|
||||||
|
patches
|
||||||
|
(
|
||||||
|
{
|
||||||
|
// Name of new patch
|
||||||
|
name oversetPatch;
|
||||||
|
|
||||||
|
// Dictionary to construct new patch from
|
||||||
|
patchInfo
|
||||||
|
{
|
||||||
|
type overset;
|
||||||
|
}
|
||||||
|
|
||||||
|
// How to construct: either from 'patches' or 'set'
|
||||||
|
constructFrom patches;
|
||||||
|
|
||||||
|
// If constructFrom = patches : names of patches. Wildcards allowed.
|
||||||
|
patches (otherSide);
|
||||||
|
|
||||||
|
// If constructFrom = set : name of faceSet
|
||||||
|
set f0;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
// Name of new patch
|
||||||
|
name walls;
|
||||||
|
|
||||||
|
// Dictionary to construct new patch from
|
||||||
|
patchInfo
|
||||||
|
{
|
||||||
|
type wall;
|
||||||
|
}
|
||||||
|
|
||||||
|
// How to construct: either from 'patches' or 'set'
|
||||||
|
constructFrom patches;
|
||||||
|
|
||||||
|
// If constructFrom = patches : names of patches. Wildcards allowed.
|
||||||
|
patches (originalPatch);
|
||||||
|
|
||||||
|
// If constructFrom = set : name of faceSet
|
||||||
|
set f0;
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
// Name of new patch
|
||||||
|
name frontAndBack;
|
||||||
|
|
||||||
|
// Dictionary to construct new patch from
|
||||||
|
patchInfo
|
||||||
|
{
|
||||||
|
type empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
// How to construct: either from 'patches' or 'set'
|
||||||
|
constructFrom patches;
|
||||||
|
|
||||||
|
// If constructFrom = patches : names of patches. Wildcards allowed.
|
||||||
|
patches (sides);
|
||||||
|
|
||||||
|
// If constructFrom = set : name of faceSet
|
||||||
|
set f0;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
135
tutorials/mesh/refineMesh/cylinder/system/extrudeMeshDict
Normal file
135
tutorials/mesh/refineMesh/cylinder/system/extrudeMeshDict
Normal file
@ -0,0 +1,135 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: v2412 |
|
||||||
|
| \\ / A nd | Website: www.openfoam.com |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class dictionary;
|
||||||
|
object extrudeMeshDict;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
// What to extrude:
|
||||||
|
// patch : from patch of another case ('sourceCase')
|
||||||
|
// mesh : as above but with original case included
|
||||||
|
// surface : from externally read surface
|
||||||
|
|
||||||
|
//constructFrom mesh;
|
||||||
|
//constructFrom patch;
|
||||||
|
constructFrom surface;
|
||||||
|
|
||||||
|
// If construct from patch/mesh:
|
||||||
|
sourceCase "../cavity";
|
||||||
|
sourcePatches (movingWall);
|
||||||
|
|
||||||
|
// If construct from patch: patch to use for back (can be same as sourcePatch)
|
||||||
|
exposedPatchName movingWall;
|
||||||
|
|
||||||
|
// If construct from surface:
|
||||||
|
surface "<constant>/triSurface/cylinder.vtk";
|
||||||
|
|
||||||
|
// Flip surface normals before usage. Valid only for extrude from surface or
|
||||||
|
// patch.
|
||||||
|
flipNormals false;
|
||||||
|
|
||||||
|
//- Linear extrusion in point-normal direction
|
||||||
|
extrudeModel linearNormal;
|
||||||
|
|
||||||
|
//- Single layer linear extrusion in point-normal direction
|
||||||
|
// with empty patches on front and back
|
||||||
|
//extrudeModel plane;
|
||||||
|
|
||||||
|
//- Linear extrusion in specified direction
|
||||||
|
//extrudeModel linearDirection;
|
||||||
|
|
||||||
|
//- Sector extrusion
|
||||||
|
//extrudeModel sector;
|
||||||
|
|
||||||
|
//- Wedge extrusion of a single layer
|
||||||
|
// with wedge patches on front and back
|
||||||
|
//extrudeModel wedge;
|
||||||
|
|
||||||
|
//- Extrudes into sphere around (0 0 0)
|
||||||
|
//extrudeModel linearRadial;
|
||||||
|
|
||||||
|
//- Extrudes into sphere around (0 0 0) with specified radii
|
||||||
|
//extrudeModel radial;
|
||||||
|
|
||||||
|
//- Extrudes into sphere with grading according to pressure (atmospherics)
|
||||||
|
//extrudeModel sigmaRadial;
|
||||||
|
|
||||||
|
//- Extrudes by interpolating along path inbetween two (topologically identical)
|
||||||
|
// surfaces (e.g. one is an offsetted version of the other)
|
||||||
|
//extrudeModel offsetSurface;
|
||||||
|
|
||||||
|
nLayers 10;
|
||||||
|
|
||||||
|
expansionRatio 1.02;
|
||||||
|
|
||||||
|
sectorCoeffs //<- Also used for wedge
|
||||||
|
{
|
||||||
|
point (0 0.1 -0.05);
|
||||||
|
axis (-1 0 0);
|
||||||
|
angle 360; // For nLayers=1 assume symmetry so angle/2 on each side
|
||||||
|
}
|
||||||
|
|
||||||
|
linearNormalCoeffs
|
||||||
|
{
|
||||||
|
thickness 0.7;
|
||||||
|
}
|
||||||
|
|
||||||
|
planeCoeffs
|
||||||
|
{
|
||||||
|
// thickness 0.1;
|
||||||
|
nLayers 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
linearDirectionCoeffs
|
||||||
|
{
|
||||||
|
direction (0 1 0);
|
||||||
|
thickness 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
|
linearRadialCoeffs
|
||||||
|
{
|
||||||
|
R 0.1;
|
||||||
|
Rsurface 0.01; // Optional inner radius
|
||||||
|
}
|
||||||
|
|
||||||
|
radialCoeffs
|
||||||
|
{
|
||||||
|
// Radii specified through interpolation table
|
||||||
|
R table ((0 0.01)(3 0.03)(10 0.1));
|
||||||
|
}
|
||||||
|
|
||||||
|
sigmaRadialCoeffs
|
||||||
|
{
|
||||||
|
RTbyg 1;
|
||||||
|
pRef 1;
|
||||||
|
pStrat 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
offsetSurfaceCoeffs
|
||||||
|
{
|
||||||
|
// Surface that mesh has been meshed to
|
||||||
|
baseSurface "<constant>/triSurface/DTC-scaled-inflated.obj";
|
||||||
|
|
||||||
|
// Surface to fill in to
|
||||||
|
offsetSurface "<constant>/triSurface/DTC-scaled.obj";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Do front and back need to be merged? Usually only makes sense for 360
|
||||||
|
// degree wedges.
|
||||||
|
mergeFaces false;
|
||||||
|
|
||||||
|
// Merge small edges. Fraction of bounding box.
|
||||||
|
mergeTol 0;
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
42
tutorials/mesh/refineMesh/cylinder/system/fvSchemes
Normal file
42
tutorials/mesh/refineMesh/cylinder/system/fvSchemes
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: v2412 |
|
||||||
|
| \\ / A nd | Website: www.openfoam.com |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class dictionary;
|
||||||
|
object fvSchemes;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
ddtSchemes
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
gradSchemes
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
divSchemes
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
laplacianSchemes
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
interpolationSchemes
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
snGradSchemes
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
23
tutorials/mesh/refineMesh/cylinder/system/fvSolution
Normal file
23
tutorials/mesh/refineMesh/cylinder/system/fvSolution
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: v2412 |
|
||||||
|
| \\ / A nd | Website: www.openfoam.com |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class dictionary;
|
||||||
|
object fvSolution;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
PIMPLE
|
||||||
|
{
|
||||||
|
nOuterCorrectors 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
42
tutorials/mesh/refineMesh/cylinder/system/refineMeshDict
Normal file
42
tutorials/mesh/refineMesh/cylinder/system/refineMeshDict
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: v2406 |
|
||||||
|
| \\ / A nd | Website: www.openfoam.com |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class dictionary;
|
||||||
|
object refineMeshDict;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
set cellsToRefine;
|
||||||
|
|
||||||
|
coordinateSystem user;
|
||||||
|
|
||||||
|
userCoeffs
|
||||||
|
{
|
||||||
|
type cylindrical;
|
||||||
|
origin (0 0 0);
|
||||||
|
e1 (1 0 0);
|
||||||
|
e3 (0 1 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
directions
|
||||||
|
(
|
||||||
|
//normal
|
||||||
|
tan1
|
||||||
|
//tan2
|
||||||
|
);
|
||||||
|
|
||||||
|
useHexTopology true;
|
||||||
|
|
||||||
|
geometricCut false;
|
||||||
|
|
||||||
|
writeMesh false;
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
33
tutorials/mesh/refineMesh/cylinder/system/topoSetDict_level1
Normal file
33
tutorials/mesh/refineMesh/cylinder/system/topoSetDict_level1
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: v2406 |
|
||||||
|
| \\ / A nd | Website: www.openfoam.com |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class dictionary;
|
||||||
|
object topoSetDict;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
actions
|
||||||
|
(
|
||||||
|
{
|
||||||
|
name cellsToRefine;
|
||||||
|
type cellSet;
|
||||||
|
action new;
|
||||||
|
|
||||||
|
// Mandatory entries
|
||||||
|
source cylinderAnnulusToCell;
|
||||||
|
p1 (0 -1 0);
|
||||||
|
p2 (0 1 0);
|
||||||
|
innerRadius 0.7;
|
||||||
|
outerRadius 1.5;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
33
tutorials/mesh/refineMesh/cylinder/system/topoSetDict_level2
Normal file
33
tutorials/mesh/refineMesh/cylinder/system/topoSetDict_level2
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: v2406 |
|
||||||
|
| \\ / A nd | Website: www.openfoam.com |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class dictionary;
|
||||||
|
object topoSetDict;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
actions
|
||||||
|
(
|
||||||
|
{
|
||||||
|
name cellsToRefine;
|
||||||
|
type cellSet;
|
||||||
|
action new;
|
||||||
|
|
||||||
|
// Mandatory entries
|
||||||
|
source cylinderAnnulusToCell;
|
||||||
|
p1 (0 -1 0);
|
||||||
|
p2 (0 1 0);
|
||||||
|
innerRadius 0.9;
|
||||||
|
outerRadius 1.5;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
Reference in New Issue
Block a user