extrudeToRegionMesh: Added 'intrude' option

With the new film implementation the single cell layer film region is extruded
into (overlapping with) the primary/fluid region which can now be generated with
extrudeToRegionMesh using the new 'intrude' option, e.g. for the
tutorials/modules/multiRegion/film/splashPanel case the extrudeToRegionMeshDict
contains:

region          film;

patches         (film);

extrudeModel    linearNormal;

intrude         yes;

adaptMesh       no;

patchTypes      (mappedExtrudedWall);
patchNames      (film);

regionPatchTypes   (filmWall);
regionPatchNames   (wall);

regionOppositePatchTypes    (mappedFilmSurface);
regionOppositePatchNames    (surface);

nLayers         1;

expansionRatio  1;

linearNormalCoeffs
{
    thickness       0.002;
}
This commit is contained in:
Henry Weller
2023-05-02 17:22:03 +01:00
parent f0421f0823
commit f850266cdf
19 changed files with 135 additions and 395 deletions

View File

@ -536,6 +536,7 @@ void addCouplingPatches
(
const fvMesh& mesh,
const bool isShellMesh,
const bool intrude,
const word& regionName,
const word& nbrRegionName,
const wordList& zoneNames,
@ -654,8 +655,13 @@ void addCouplingPatches
: word(zoneNames[zonei] + "_top");
}
dictionary bottomPatchDict(patchDict);
bottomPatchDict.add("neighbourPatch", bottomNbrPatchName);
dictionary bottomPatchDict;
if (!intrude)
{
bottomPatchDict = patchDict;
bottomPatchDict.add("neighbourPatch", bottomNbrPatchName);
}
zoneBottomPatch[zonei] = addPatch
(
@ -691,6 +697,19 @@ void addCouplingPatches
}
else
{
dictionary oppositePatchDict;
if (intrude)
{
oppositePatchDict = patchDict;
oppositePatchDict.add("neighbourPatch", bottomNbrPatchName);
if (isShellMesh)
{
oppositePatchDict.add("oppositePatch", bottomPatchName);
}
}
zoneTopPatch[zonei] = addPatch
(
mesh.boundaryMesh(),
@ -698,7 +717,7 @@ void addCouplingPatches
regionOppositePatchTypes.size()
? regionOppositePatchTypes[zonei]
: polyPatch::typeName,
dictionary(),
oppositePatchDict,
newPatches
);
}
@ -1030,9 +1049,12 @@ int main(int argc, char *argv[])
const dictionary dict(systemDict("extrudeToRegionMeshDict", args, mesh));
// Region to extrude from
// Region to create by extrusion
const word shellRegionName(dict.lookup("region"));
// Should the extruded region overlap the existing region, i.e. "intrude"?
const Switch intrude(dict.lookupOrDefault("intrude", false));
if (shellRegionName == regionName)
{
FatalIOErrorIn(args.executable().c_str(), dict)
@ -1043,14 +1065,31 @@ int main(int argc, char *argv[])
}
// Select faces to extrude
enum class zoneSourceType { zone, set, patch };
static const wordList zoneSourceTypeNames =
{"faceZone", "faceSet", "patch" };
static const wordList zoneSourcesTypeNames =
{"faceZones", "faceSets", "patches" };
enum class zoneSourceType
{
zone,
set,
patch
};
static const wordList zoneSourceTypeNames
{
"faceZone",
"faceSet",
"patch"
};
static const wordList zoneSourcesTypeNames
{
"faceZones",
"faceSets",
"patches"
};
wordList zoneNames;
wordList zoneShadowNames;
List<zoneSourceType> zoneSourceTypes;
auto lookupZones = [&](const zoneSourceType& type)
{
const word& keyword = zoneSourcesTypeNames[unsigned(type)];
@ -1322,15 +1361,23 @@ int main(int argc, char *argv[])
shadowExtrudeFaceFlips.transfer(sdwFlipsDyn);
}
faceList extrudeFaceList(UIndirectList<face>(mesh.faces(), extrudeFaces));
if (intrude)
{
forAll(extrudeFaceList, facei)
{
extrudeFaceList[facei].flip();
}
}
// Create a primitive patch of the extruded faces
const primitiveFacePatch extrudePatch
(
faceList(UIndirectList<face>(mesh.faces(), extrudeFaces)),
extrudeFaceList,
mesh.points()
);
// Check zone either all internal or all external faces
const boolList zoneIsInternal
(
@ -1410,6 +1457,7 @@ int main(int argc, char *argv[])
(
mesh,
true,
intrude,
shellRegionName,
regionName,
zoneNames,
@ -1443,6 +1491,7 @@ int main(int argc, char *argv[])
(
mesh,
false,
intrude,
regionName,
shellRegionName,
zoneNames,

View File

@ -5,7 +5,8 @@ cd ${0%/*} || exit 1 # Run from this directory
. $WM_PROJECT_DIR/bin/tools/RunFunctions
runApplication -s VoF blockMesh -region VoF
runApplication -s film blockMesh -region film
runApplication extrudeToRegionMesh -region VoF -overwrite
runApplication setFields -region VoF

View File

@ -17,7 +17,9 @@ region film;
patches (film);
extrudeModel linearDirection;
extrudeModel linearNormal;
intrude yes;
adaptMesh no;
@ -39,11 +41,4 @@ linearNormalCoeffs
thickness 0.001;
}
linearDirectionCoeffs
{
direction (1 0 0);
thickness 0.001;
}
// ************************************************************************* //

View File

@ -1,114 +0,0 @@
/*--------------------------------*- 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;
w 1;
h 100;
wCells 1;
hCells 80;
wGrading 1;
vertices
(
(0 0 -1)
($w 0 -1)
(0 $h -1)
($w $h -1)
(0 0 0)
($w 0 0)
(0 $h 0)
($w $h 0)
);
blocks
(
hex (0 1 3 2 4 5 7 6)
($wCells $hCells 1)
simpleGrading ($wGrading 1 1)
);
boundary
(
wall
{
type filmWall;
neighbourRegion VoF;
neighbourPatch film;
faces
(
(0 2 6 4)
);
}
surface
{
type mappedFilmSurface;
neighbourRegion VoF;
neighbourPatch film;
oppositePatch wall;
faces
(
(1 3 7 5)
);
}
bottom
{
type patch;
faces
(
(0 1 5 4)
);
}
atmosphere
{
type patch;
faces
(
(2 3 7 6)
);
}
back
{
type empty;
faces
(
(0 2 3 1)
);
}
front
{
type empty;
faces
(
(4 5 7 6)
);
}
);
// ************************************************************************* //

View File

@ -4,21 +4,8 @@ cd ${0%/*} || exit 1 # Run from this directory
. $WM_PROJECT_DIR/bin/tools/RunFunctions
runApplication -s fluid blockMesh -region fluid
runApplication -s film blockMesh -dict system/film/blockMeshDict
runApplication extrudeMesh -region film
runApplication -s fluid foamDictionary -set \
"entry0/film/type=mappedExtrudedWall, \
entry0/film/neighbourRegion=film, \
entry0/film/neighbourPatch=surface, \
constant/fluid/polyMesh/boundary
runApplication -s film foamDictionary -set \
"entry0/surface/type=mappedFilmSurface, \
entry0/surface/neighbourRegion=fluid, \
entry0/surface/neighbourPatch=film, \
entry0/surface/oppositePatch=wall, \
constant/film/polyMesh/boundary
runApplication extrudeToRegionMesh -region fluid -overwrite
printf "\n%s\n" "Creating files for paraview post-processing"
paraFoam -touchAll

View File

@ -101,7 +101,10 @@ boundary
(
film
{
type patch;
type mappedExtrudedWall;
neighbourRegion film;
neighbourPatch surface;
faces
(
(0 1 20 19)
@ -118,6 +121,7 @@ boundary
sides
{
type patch;
faces
(
(2 3 22 21)
@ -129,6 +133,7 @@ boundary
top
{
type patch;
faces
(
(6 7 26 25)

View File

@ -13,18 +13,29 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
region wallFilm;
region film;
patches (walls);
patches (film);
extrudeModel linearNormal;
intrude yes;
adaptMesh no;
patchTypes (mappedExtrudedWall);
patchNames (film);
regionPatchTypes (filmWall);
regionPatchNames (wall);
regionOppositePatchTypes (mappedFilmSurface);
regionOppositePatchNames (surface);
nLayers 1;
expansionRatio 1;
adaptMesh yes; // apply mapped to both regions
linearNormalCoeffs
{
thickness 0.01;

View File

@ -1,30 +0,0 @@
/*--------------------------------*- 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 fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
divSchemes
{
}
gradSchemes
{
}
laplacianSchemes
{
}
// ************************************************************************* //

View File

@ -5,21 +5,8 @@ cd ${0%/*} || exit 1 # Run from this directory
. $WM_PROJECT_DIR/bin/tools/RunFunctions
runApplication -s VoF blockMesh -region VoF
runApplication -s film blockMesh -dict system/film/blockMeshDict
runApplication extrudeMesh -region film
runApplication -s VoF foamDictionary -set \
"entry0/film/type=mappedExtrudedWall, \
entry0/film/neighbourRegion=film, \
entry0/film/neighbourPatch=surface, \
constant/VoF/polyMesh/boundary
runApplication -s film foamDictionary -set \
"entry0/surface/type=mappedFilmSurface, \
entry0/surface/neighbourRegion=VoF, \
entry0/surface/neighbourPatch=film, \
entry0/surface/oppositePatch=wall, \
constant/film/polyMesh/boundary
runApplication extrudeToRegionMesh -region VoF -overwrite
printf "\n%s\n" "Creating files for paraview post-processing"
paraFoam -touchAll

View File

@ -101,7 +101,10 @@ boundary
(
film
{
type patch;
type mappedExtrudedWall;
neighbourRegion film;
neighbourPatch surface;
faces
(
(0 1 20 19)
@ -118,6 +121,7 @@ boundary
sides
{
type patch;
faces
(
(2 3 22 21)
@ -129,6 +133,7 @@ boundary
top
{
type patch;
faces
(
(6 7 26 25)

View File

@ -9,25 +9,33 @@ FoamFile
{
format ascii;
class dictionary;
object extrudeMeshDict;
object extrudeToRegionMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
sourceCase "$FOAM_CASE";
constructFrom patch;
region film;
sourcePatches (surface);
exposedPatchName wall;
patches (film);
extrudeModel linearNormal;
intrude yes;
adaptMesh no;
patchTypes (mappedExtrudedWall);
patchNames (film);
regionPatchTypes (filmWall);
regionPatchNames (wall);
regionOppositePatchTypes (mappedFilmSurface);
regionOppositePatchNames (surface);
nLayers 1;
expansionRatio 1;
flipNormals yes;
mergeFaces no;
linearNormalCoeffs
{
thickness 0.01;

View File

@ -1,36 +0,0 @@
/*--------------------------------*- 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 extrudeMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
sourceCase "$FOAM_CASE";
constructFrom patch;
sourcePatches (surface);
exposedPatchName wall;
extrudeModel linearNormal;
nLayers 1;
expansionRatio 1;
flipNormals yes;
mergeFaces no;
linearNormalCoeffs
{
thickness 0.01;
}
// ************************************************************************* //

View File

@ -1,30 +0,0 @@
/*--------------------------------*- 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 fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
divSchemes
{
}
gradSchemes
{
}
laplacianSchemes
{
}
// ************************************************************************* //

View File

@ -20,14 +20,14 @@ runApplication -s film extrudeToRegionMesh \
runApplication -s box foamDictionary -set \
"entry0/film/type=mappedExtrudedWall, \
entry0/film/neighbourRegion=film, \
entry0/film/neighbourPatch=surface, \
entry0/film/neighbourPatch=surface" \
constant/box/polyMesh/boundary
runApplication -s film foamDictionary -set \
"entry0/surface/type=mappedFilmSurface, \
entry0/surface/neighbourRegion=box, \
entry0/surface/neighbourPatch=film, \
entry0/surface/oppositePatch=wall, \
entry0/surface/oppositePatch=wall" \
constant/film/polyMesh/boundary
printf "\n%s\n" "Creating files for paraview post-processing"

View File

@ -4,21 +4,8 @@ cd ${0%/*} || exit 1 # Run from this directory
. $WM_PROJECT_DIR/bin/tools/RunFunctions
runApplication -s fluid blockMesh -region fluid
runApplication -s film blockMesh -dict system/film/blockMeshDict
runApplication extrudeMesh -region film
runApplication -s fluid foamDictionary -set \
"entry0/film/type=mappedExtrudedWall, \
entry0/film/neighbourRegion=film, \
entry0/film/neighbourPatch=surface, \
constant/fluid/polyMesh/boundary
runApplication -s film foamDictionary -set \
"entry0/surface/type=mappedFilmSurface, \
entry0/surface/neighbourRegion=fluid, \
entry0/surface/neighbourPatch=film, \
entry0/surface/oppositePatch=wall, \
constant/film/polyMesh/boundary
runApplication extrudeToRegionMesh -region fluid -overwrite
printf "\n%s\n" "Creating files for paraview post-processing"
paraFoam -touchAll

View File

@ -1,68 +0,0 @@
/*--------------------------------*- 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.1;
vertices
(
( 0 0 0)
( 1 0 0)
( 0 0.5 0)
( 1 0.5 0)
( 0 0 1)
( 1 0 1)
( 0 0.5 1)
( 1 0.5 1)
);
blocks
(
hex (0 1 3 2 4 5 7 6) (20 10 20) simpleGrading (1 1 1)
);
boundary
(
wall
{
type filmWall;
faces
(
(4 5 7 6)
);
}
sides
{
type symmetry;
faces
(
(1 5 7 3)
(4 0 2 6)
(7 3 2 6)
(0 4 5 1)
);
}
surface
{
type patch;
faces
(
(0 1 3 2)
);
}
);
// ************************************************************************* //

View File

@ -38,6 +38,7 @@ boundary
top
{
type patch;
faces
(
(4 5 7 6)
@ -46,6 +47,7 @@ boundary
sides
{
type symmetry;
faces
(
(1 5 7 3)
@ -56,7 +58,10 @@ boundary
}
film
{
type patch;
type mappedExtrudedWall;
neighbourRegion film;
neighbourPatch surface;
faces
(
(0 1 3 2)

View File

@ -9,25 +9,33 @@ FoamFile
{
format ascii;
class dictionary;
object extrudeMeshDict;
object extrudeToRegionMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
sourceCase "$FOAM_CASE";
constructFrom patch;
region film;
sourcePatches (surface);
exposedPatchName wall;
patches (film);
extrudeModel linearNormal;
intrude yes;
adaptMesh no;
patchTypes (mappedExtrudedWall);
patchNames (film);
regionPatchTypes (filmWall);
regionPatchNames (wall);
regionOppositePatchTypes (mappedFilmSurface);
regionOppositePatchNames (surface);
nLayers 1;
expansionRatio 1;
flipNormals yes;
mergeFaces no;
linearNormalCoeffs
{
thickness 0.002;

View File

@ -1,30 +0,0 @@
/*--------------------------------*- 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 fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
divSchemes
{
}
gradSchemes
{
}
laplacianSchemes
{
}
// ************************************************************************* //