ENH: Adding subMesh option to momentumError and div FOs

1) Adding subMesh capabilities to momentumError and div FOs.
	- A subMesh is created from cellZones.
	- The operators (div, etc) are only calculated in the subMesh.

2) Optionally, halo cells can be added to the cellZones.

3) New helper class to handle the subMesh creation and field mapping.
This commit is contained in:
sergio
2021-06-22 08:46:28 -07:00
committed by Mattijs Janssens
parent 6595429f53
commit 6101272133
25 changed files with 914 additions and 111 deletions

View File

@ -3,19 +3,9 @@ cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
#------------------------------------------------------------------------------
mkdir -p constant/geometry
./Allrun.pre
cp -f \
"$FOAM_TUTORIALS"/resources/geometry/NACA0012.obj.gz \
constant/geometry
restore0Dir
runApplication blockMesh
runApplication transformPoints -scale "(1 0 1)"
runApplication extrudeMesh
runApplication topoSet
runApplication $(getApplication)

View File

@ -0,0 +1,18 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
#------------------------------------------------------------------------------
./Allrun.pre
runParallel -s decompose \
redistributePar -decompose -overwrite -withZero
runParallel topoSet
runParallel $(getApplication)
runParallel -s reconstruct \
redistributePar -reconstruct -overwrite
#------------------------------------------------------------------------------

View File

@ -0,0 +1,20 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
#------------------------------------------------------------------------------
mkdir -p constant/geometry
cp -f \
"$FOAM_TUTORIALS"/resources/geometry/NACA0012.obj.gz \
constant/geometry
restore0Dir
runApplication blockMesh
runApplication transformPoints -scale "(1 0 1)"
runApplication extrudeMesh
#------------------------------------------------------------------------------

View File

@ -1,7 +1,7 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2012 |
| \\ / O peration | Version: v2106 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
@ -16,7 +16,7 @@ FoamFile
application rhoSimpleFoam;
startFrom latestTime;
startFrom startTime;
startTime 0;
@ -34,7 +34,7 @@ purgeWrite 0;
writeFormat ascii;
writePrecision 8;
writePrecision 8;
writeCompression off;
@ -48,6 +48,33 @@ functions
{
#includeFunc MachNo
#includeFunc solverInfo
readFields1
{
type readFields;
libs (fieldFunctionObjects);
fields (phi);
readOnStart true;
}
contErr
{
type div;
libs (fieldFunctionObjects);
field phi;
executeControl writeTime;
writeControl writeTime;
}
momErr
{
type momentumError;
libs (fieldFunctionObjects);
cellZones (z1);
nLayers 2;
executeControl writeTime;
writeControl writeTime;
}
}

View File

@ -0,0 +1,27 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2106 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object decomposeParDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
numberOfSubdomains 8;
method hierarchical;
coeffs
{
n (4 1 2);
}
// ************************************************************************* //

View File

@ -27,6 +27,7 @@ gradSchemes
grad(U) $limited;
grad(k) $limited;
grad(omega) $limited;
grad(subsetU) $limited;
}
divSchemes

View File

@ -0,0 +1,37 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2106 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object topoSetDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
actions
(
{
name c1;
type cellSet;
action new;
source boxToCell;
box (-0.2 -0.1 -0.2) (1.2 0.1 0.2);
}
{
name z1;
type cellZoneSet;
action new;
source setToCellZone;
set c1; // cellSet
}
);
// ************************************************************************* //