TUT: multi-world tutorial setup with circular connectivity

This commit is contained in:
Mark Olesen
2021-07-28 09:54:19 +02:00
parent 2bb91e354b
commit 9d26b25c46
86 changed files with 1171 additions and 326 deletions

View File

@ -1,2 +0,0 @@
-np 2 laplacianFoam -case left -world LEFT -parallel
-np 2 laplacianFoam -case right -world RIGHT -parallel

View File

@ -1 +0,0 @@
../../left/constant/transportProperties

View File

@ -3,12 +3,14 @@ cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/CleanFunctions # Tutorial clean functions
#------------------------------------------------------------------------------
for subcase in left right
for subcase in $(./list-worlds)
do
(
cd "$subcase" && cleanCase0
cd "$subcase" || exit
cleanCase0
rm -f *_mapped.obj 2>/dev/null
)
done
rm -f log.*
rm -rf log.* 2>/dev/null
#------------------------------------------------------------------------------

View File

@ -5,25 +5,19 @@ cd "${0%/*}" || exit # Run from this directory
# Run serial
./Allrun.pre
mpirun -app ./mpirun_left_right.schema
echo "Begin run"
mpirun -app ./mpirun_worlds.schema
# Run with database
mv -f log.run_left* log.run_right*
for subcase in left right
do
(
cd "$subcase" || exit
foamListTimes -rm
restore0Dir
foamDictionary 0/T -entry boundaryField.coupled.sampleDatabase -add true
)
done
mpirun -app ./mpirun_left_right.schema
./Allrun.addDatabase
mv -f log.run_* 2>/dev/null
echo "Begin run with database"
mpirun -app ./mpirun_worlds.schema
## Run parallel
## ./Allrun.pre-parallel
## mpirun -app ./mpirun.schema
echo "End"
#------------------------------------------------------------------------------

View File

@ -0,0 +1,30 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
#------------------------------------------------------------------------------
# Running with database
for subcase in $(./list-worlds)
do
(
cd "$subcase" || exit
foamListTimes -rm
restore0Dir
dictFile="0/T"
for patch in $(foamDictionary "$dictFile" -keywords -entry boundaryField)
do
patchType="$(foamDictionary "$dictFile" -value -entry boundaryField/"$patch"/type)"
case "$patchType" in
(mapped*)
foamDictionary "$dictFile" -entry boundaryField/"$patch"/sampleDatabase -add true >/dev/null
echo "Use sampleDatabase: $subcase/$dictFile patch=$patch"
;;
esac
done
)
done
#------------------------------------------------------------------------------

View File

@ -0,0 +1,23 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
#------------------------------------------------------------------------------
# Create meshes and initial fields
for subcase in $(./list-worlds)
do
(
cd "$subcase" || exit
echo "case=$subcase"
if [ -x ./Allrun.pre ]
then
./Allrun.pre
else
runApplication blockMesh
fi
restore0Dir
echo
)
done
#------------------------------------------------------------------------------

View File

@ -4,7 +4,7 @@ cd "${0%/*}" || exit # Run from this directory
#------------------------------------------------------------------------------
# Create meshes and initial fields
for subcase in left right
for subcase in $(./list-worlds)
do
(
cd "$subcase" || exit

View File

@ -29,7 +29,7 @@ boundaryField
sampleMode nearestPatchFaceAMI;
// Simulation world to sample
sampleWorld RIGHT;
sampleWorld right;
// Region to sample
sampleRegion region0;

View File

@ -0,0 +1 @@
../../common/constant/transportProperties

View File

@ -0,0 +1,6 @@
#!/bin/sh
#------------------------------------------------------------------------------
echo left right
#------------------------------------------------------------------------------

View File

@ -0,0 +1,2 @@
-np 2 laplacianFoam -case left -world left -parallel
-np 2 laplacianFoam -case right -world right -parallel

View File

@ -29,7 +29,7 @@ boundaryField
sampleMode nearestPatchFaceAMI;
// Simulation world to sample
sampleWorld LEFT;
sampleWorld left;
// Region to sample
sampleRegion region0;

View File

@ -0,0 +1 @@
../../common/constant/transportProperties

View File

@ -15,9 +15,11 @@ then
fi
worldCase="$(echo "$world" | tr '[:upper:]' '[:lower:]')"
worldName="$(echo "$world" | tr '[:lower:]' '[:upper:]')"
# worldName="$(echo "$world" | tr '[:lower:]' '[:upper:]')"
worldName="$worldCase"
"$application" -case "$worldCase" -world "$worldName" 2>&1 | tee log.run_"$worldCase"
read dummy
log="log.run_$worldCase"
"$application" -case "$worldCase" -world "$worldName" > "$log" 2>&1
# ----------------------------------------------------------------------------

View File

@ -0,0 +1,16 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/CleanFunctions # Tutorial clean functions
#------------------------------------------------------------------------------
for subcase in $(./list-worlds)
do
(
cd "$subcase" || exit
cleanCase0
rm -f *_mapped.obj 2>/dev/null
)
done
rm -rf log.* 2>/dev/null
#------------------------------------------------------------------------------

View File

@ -0,0 +1,23 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
#------------------------------------------------------------------------------
# Run serial
./Allrun.pre
echo "Begin run - interworld communication"
mpirun -app ./mpirun_full.schema
# Run with database
if false
then
./Allrun.addDatabase
rm -f log.run* 2>/dev/null
echo "Begin run - database data exchange"
mpirun -app ./mpirun_full.schema
fi
echo "Can load with: paraview --script=load-worlds.py &"
echo "End"
#------------------------------------------------------------------------------

View File

@ -0,0 +1,30 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
#------------------------------------------------------------------------------
# Prepare for running with database
for subcase in $(./list-worlds)
do
(
cd "$subcase" || exit
foamListTimes -rm
restore0Dir
dictFile="0/T"
for patch in $(foamDictionary "$dictFile" -keywords -entry boundaryField)
do
patchType="$(foamDictionary "$dictFile" -value -entry boundaryField/"$patch"/type)"
case "$patchType" in
(mapped*)
foamDictionary "$dictFile" -entry boundaryField/"$patch"/sampleDatabase -add true >/dev/null
echo "Use sampleDatabase: $subcase/$dictFile patch=$patch"
;;
esac
done
)
done
#------------------------------------------------------------------------------

View File

@ -0,0 +1,24 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
#------------------------------------------------------------------------------
# Create meshes and initial fields
for subcase in $(./list-worlds)
do
(
cd "$subcase" || exit
echo "case=$subcase"
if [ -x ./Allrun.pre ]
then
./Allrun.pre
else
runApplication blockMesh
fi
restore0Dir
touch "$subcase.foam" # paraview
echo
)
done
#------------------------------------------------------------------------------

View File

@ -0,0 +1,21 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2112 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object transportProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
DT 4e-05;
// ************************************************************************* //

View File

@ -0,0 +1,75 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2112 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
libs (utilityFunctionObjects);
DebugSwitches
{
multiWorld 1;
// mappedPatchBase 1;
// syncObjects 2;
}
application laplacianFoam;
startFrom startTime; //latestTime;
startTime 0;
stopAt endTime;
endTime 50;
deltaT 1;
//writeControl runTime;
//writeInterval 0.1;
writeControl timeStep;
writeInterval 1;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
writeCompression off;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
functions
{
syncObjects
{
type syncObjects;
libs (utilityFunctionObjects);
// Where is data located relative to runTime. Given as a filename
// with every '/' indicating a sub-objectRegistry w.r.t. runTime.
// Local data is under <root>/send/processorXXX. After execution
// data will be under the corresponding <root>/receive/processorYYY
// objectRegistry
//root "level0/level1/level2";
}
}
// ************************************************************************* //

View File

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

View File

@ -0,0 +1,52 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2112 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
ddtSchemes
{
default steadyState; //Euler;
}
gradSchemes
{
default Gauss linear;
grad(T) Gauss linear;
}
divSchemes
{
default none;
}
laplacianSchemes
{
default none;
laplacian(DT,T) Gauss linear corrected;
laplacian(DTV,T) Gauss linear corrected;
}
interpolationSchemes
{
default linear;
}
snGradSchemes
{
default corrected;
}
// ************************************************************************* //

View File

@ -0,0 +1,35 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2112 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solvers
{
T
{
solver PCG;
preconditioner DIC;
tolerance 1e-06;
relTol 0;
}
}
SIMPLE
{
nNonOrthogonalCorrectors 2;
}
// ************************************************************************* //

View File

@ -0,0 +1,6 @@
#!/bin/sh
#------------------------------------------------------------------------------
echo top slab1 slab2 slab3 slab4
#------------------------------------------------------------------------------

View File

@ -0,0 +1,67 @@
#### import the simple module from the paraview
from paraview.simple import *
#### disable automatic camera reset on 'Show'
paraview.simple._DisableFirstRenderCameraReset()
# get active view
renderView1 = GetActiveViewOrCreate('RenderView')
useGroup = True
pieces = []
# Load all pieces
for worldName in ['top', 'slab1', 'slab2', 'slab3', 'slab4']:
# Could also touch world/world.foam into existence
loadedDir = './' + worldName + '/' + worldName + '.foam'
piece = OpenFOAMReader(registrationName=worldName, FileName=loadedDir)
piece.SkipZeroTime = 0
piece.Decomposepolyhedra = 0
piece.MeshRegions = ['internalMesh']
piece.CellArrays = ['T']
pieces.append(piece)
# Set display for all pieces
for piece in pieces:
display = Show(piece, renderView1, 'UnstructuredGridRepresentation')
display.SetRepresentationType('Surface With Edges')
ColorBy(display, ('CELLS', 'T'))
# Show color bar/color legend
display.SetScalarBarVisibility(renderView1, True)
# ----
# Group pieces
if useGroup:
# Hide data in view
group1 = GroupDatasets(registrationName='GroupDatasets1', Input=pieces)
# show data in view
display = Show(group1, renderView1, 'UnstructuredGridRepresentation')
display.SetRepresentationType('Surface With Edges')
ColorBy(display, ('CELLS', 'T'))
# Show color bar/color legend
display.SetScalarBarVisibility(renderView1, True)
for piece in pieces:
Hide(piece, renderView1)
# ----
# get color transfer function/color map for 'T'
tLUT = GetColorTransferFunction('T')
# Rescale transfer function
tLUT.RescaleTransferFunction(0.0, 1.2)
# get opacity transfer function/opacity map for 'T'
tPWF = GetOpacityTransferFunction('T')
# Rescale transfer function
tPWF.RescaleTransferFunction(0.0, 1.2)
# reset view to fit data
renderView1.ResetCamera(False)
# update the view to ensure updated data information
renderView1.Update()
#================================================================

View File

@ -0,0 +1,5 @@
-np 1 ./run_world.sh top
-np 1 ./run_world.sh slab1
-np 1 ./run_world.sh slab2
-np 1 ./run_world.sh slab3
-np 1 ./run_world.sh slab4

View File

@ -0,0 +1,19 @@
#!/bin/sh
world="${1:?specify world/case}"
application="${2:-laplacianFoam}"
if [ -z "$application" ] || ! command -v "$application" > /dev/null
then
echo "No application: $application"
exit 2
fi
worldCase="$(echo "$world" | tr '[:upper:]' '[:lower:]')"
# worldName="$(echo "$world" | tr '[:lower:]' '[:upper:]')"
worldName="$worldCase"
log="log.run_$worldCase"
"$application" -case "$worldCase" -world "$worldName" > "$log" 2>&1
# ----------------------------------------------------------------------------

View File

@ -0,0 +1,87 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2112 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object T;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 0 1 0 0 0];
internalField uniform 0;
_mappedMixedField
{
type mappedMixedField;
// What/how to sample:
sampleMode nearestPatchFaceAMI;
// Simulation world to sample
// Overwrite -> sampleWorld top;
// Region to sample
sampleRegion region0;
// If sampleMode is nearestPatchFace : patch to find faces of
// Overwrite -> samplePatch right_to_left;
// Use database to get data from (one-way or loose coupling in
// combination with functionObject)
//sampleDatabase false; //true;
// According to offsetMode (see above) supply one of
// offset, offsets or distance
offset (0 0 0);
value uniform 0.0;
// For mappedMixed
//weightField DTV;
refValue $value;
refGradient uniform 0.0;
valueFraction uniform 1.0;
}
boundaryField
{
slab1_to_2
{
$_mappedMixedField;
sampleWorld slab2;
samplePatch slab2_to_1;
}
left
{
type fixedValue;
value uniform 1;
}
to_top
{
$_mappedMixedField;
sampleWorld top;
samplePatch top_to_1;
}
bottom
{
type zeroGradient;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //

View File

@ -0,0 +1 @@
../../common/constant/transportProperties

View File

@ -0,0 +1,84 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2112 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
SLAB_OFFSET 0;
scale 0.1;
transform
{
origin (#eval{0.5 * $SLAB_OFFSET} 0 0);
rotation none;
}
xdim 0.5;
ydim 1;
zdim 0.1;
vertices
(
(0 0 0)
($xdim 0 0)
($xdim $ydim 0)
(0 $ydim 0)
(0 0 $zdim)
($xdim 0 $zdim)
($xdim $ydim $zdim)
(0 $ydim $zdim)
);
blocks
(
hex (0 1 2 3 4 5 6 7) (2 2 1) grading (1 1 1)
);
boundary
(
left // left-side (face 0)
{
type wall;
faces ((0 0));
}
slab1_to_2 // right-side (face 1)
{
type wall;
faces ((0 1));
}
bottom // face 2
{
type wall;
faces ((0 2));
}
to_top // top: face 3
{
type wall;
faces ((0 3));
}
frontAndBack // face 4 5
{
type empty;
faces ((0 4) (0 5));
}
);
// ************************************************************************* //

View File

@ -0,0 +1 @@
../../common/system/controlDict

View File

@ -0,0 +1 @@
../../common/system/decomposeParDict

View File

@ -0,0 +1 @@
../../common/system/fvSchemes

View File

@ -0,0 +1 @@
../../common/system/fvSolution

View File

@ -0,0 +1,94 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2112 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object T;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 0 1 0 0 0];
internalField uniform 0;
_mappedMixedField
{
type mappedMixedField;
// What/how to sample:
sampleMode nearestPatchFaceAMI;
// Simulation world to sample
// Overwrite -> sampleWorld top;
// Region to sample
sampleRegion region0;
// If sampleMode is nearestPatchFace : patch to find faces of
// Overwrite -> samplePatch right_to_left;
// Use database to get data from (one-way or loose coupling in
// combination with functionObject)
//sampleDatabase false; //true;
// According to offsetMode (see above) supply one of
// offset, offsets or distance
offset (0 0 0);
value uniform 0.0;
// For mappedMixed
//weightField DTV;
refValue $value;
refGradient uniform 0.0;
valueFraction uniform 1.0;
}
boundaryField
{
slab2_to_1
{
$_mappedMixedField;
sampleWorld slab1;
samplePatch slab1_to_2;
}
slab2_to_3
{
$_mappedMixedField;
sampleWorld slab3;
samplePatch slab3_to_2;
}
to_top
{
$_mappedMixedField;
sampleWorld top;
samplePatch top_to_2;
}
bottom
{
type zeroGradient;
}
right
{
type fixedValue;
value uniform 0;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //

View File

@ -0,0 +1 @@
../../common/constant/transportProperties

View File

@ -0,0 +1,83 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2112 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
SLAB_OFFSET 1;
scale 0.1;
transform
{
origin (#eval{0.5 * $SLAB_OFFSET} 0 0);
rotation none;
}
xdim 0.5;
ydim 1;
zdim 0.1;
vertices
(
(0 0 0)
($xdim 0 0)
($xdim $ydim 0)
(0 $ydim 0)
(0 0 $zdim)
($xdim 0 $zdim)
($xdim $ydim $zdim)
(0 $ydim $zdim)
);
blocks
(
hex (0 1 2 3 4 5 6 7) (2 2 1) grading (1 1 1)
);
boundary
(
slab2_to_1 // left-side (face 0)
{
type wall;
faces ((0 0));
}
slab2_to_3 // right-side (face 1)
{
type wall;
faces ((0 1));
}
bottom // face 2
{
type wall;
faces ((0 2));
}
to_top // top: face 3
{
type wall;
faces ((0 3));
}
frontAndBack // face 4 5
{
type empty;
faces ((0 4) (0 5));
}
);
// ************************************************************************* //

View File

@ -0,0 +1 @@
../../common/system/controlDict

View File

@ -0,0 +1 @@
../../common/system/decomposeParDict

View File

@ -0,0 +1 @@
../../common/system/fvSchemes

View File

@ -0,0 +1 @@
../../common/system/fvSolution

View File

@ -0,0 +1,88 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2112 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object T;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 0 1 0 0 0];
internalField uniform 0;
_mappedMixedField
{
type mappedMixedField;
// What/how to sample:
sampleMode nearestPatchFaceAMI;
// Simulation world to sample
// Overwrite -> sampleWorld top;
// Region to sample
sampleRegion region0;
// If sampleMode is nearestPatchFace : patch to find faces of
// Overwrite -> samplePatch right_to_left;
// Use database to get data from (one-way or loose coupling in
// combination with functionObject)
//sampleDatabase false; //true;
// According to offsetMode (see above) supply one of
// offset, offsets or distance
offset (0 0 0);
value uniform 0.0;
// For mappedMixed
//weightField DTV;
refValue $value;
refGradient uniform 0.0;
valueFraction uniform 1.0;
}
boundaryField
{
slab3_to_2
{
$_mappedMixedField;
sampleWorld slab2;
samplePatch slab2_to_3;
}
slab3_to_4
{
$_mappedMixedField;
sampleWorld slab4;
samplePatch slab4_to_3;
}
to_top
{
$_mappedMixedField;
sampleWorld top;
samplePatch top_to_3;
}
bottom
{
type zeroGradient;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //

View File

@ -0,0 +1 @@
../../common/constant/transportProperties

View File

@ -0,0 +1,83 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2112 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
SLAB_OFFSET 2;
scale 0.1;
transform
{
origin (#eval{0.5 * $SLAB_OFFSET} 0 0);
rotation none;
}
xdim 0.5;
ydim 1;
zdim 0.1;
vertices
(
(0 0 0)
($xdim 0 0)
($xdim $ydim 0)
(0 $ydim 0)
(0 0 $zdim)
($xdim 0 $zdim)
($xdim $ydim $zdim)
(0 $ydim $zdim)
);
blocks
(
hex (0 1 2 3 4 5 6 7) (2 2 1) grading (1 1 1)
);
boundary
(
slab3_to_2 // left-side (face 0)
{
type wall;
faces ((0 0));
}
slab3_to_4 // right-side (face 1)
{
type wall;
faces ((0 1));
}
bottom // face 2
{
type wall;
faces ((0 2));
}
to_top // top: face 3
{
type wall;
faces ((0 3));
}
frontAndBack // face 4 5
{
type empty;
faces ((0 4) (0 5));
}
);
// ************************************************************************* //

View File

@ -0,0 +1 @@
../../common/system/controlDict

View File

@ -0,0 +1 @@
../../common/system/decomposeParDict

View File

@ -0,0 +1 @@
../../common/system/fvSchemes

View File

@ -0,0 +1 @@
../../common/system/fvSolution

View File

@ -0,0 +1,87 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2112 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object T;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 0 1 0 0 0];
internalField uniform 0;
_mappedMixedField
{
type mappedMixedField;
// What/how to sample:
sampleMode nearestPatchFaceAMI;
// Simulation world to sample
// Overwrite -> sampleWorld top;
// Region to sample
sampleRegion region0;
// If sampleMode is nearestPatchFace : patch to find faces of
// Overwrite -> samplePatch right_to_left;
// Use database to get data from (one-way or loose coupling in
// combination with functionObject)
//sampleDatabase false; //true;
// According to offsetMode (see above) supply one of
// offset, offsets or distance
offset (0 0 0);
value uniform 0.0;
// For mappedMixed
//weightField DTV;
refValue $value;
refGradient uniform 0.0;
valueFraction uniform 1.0;
}
boundaryField
{
slab4_to_3
{
$_mappedMixedField;
sampleWorld slab3;
samplePatch slab3_to_4;
}
right
{
type fixedValue;
value uniform 0;
}
to_top
{
$_mappedMixedField;
sampleWorld top;
samplePatch top_to_4;
}
bottom
{
type zeroGradient;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //

View File

@ -0,0 +1 @@
../../common/constant/transportProperties

View File

@ -0,0 +1,83 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2112 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
SLAB_OFFSET 3;
scale 0.1;
transform
{
origin (#eval{0.5 * $SLAB_OFFSET} 0 0);
rotation none;
}
xdim 0.5;
ydim 1;
zdim 0.1;
vertices
(
(0 0 0)
($xdim 0 0)
($xdim $ydim 0)
(0 $ydim 0)
(0 0 $zdim)
($xdim 0 $zdim)
($xdim $ydim $zdim)
(0 $ydim $zdim)
);
blocks
(
hex (0 1 2 3 4 5 6 7) (2 2 1) grading (1 1 1)
);
boundary
(
slab4_to_3 // left-side (face 0)
{
type wall;
faces ((0 0));
}
right // right-side (face 1)
{
type wall;
faces ((0 1));
}
bottom // face 2
{
type wall;
faces ((0 2));
}
to_top // top: face 3
{
type wall;
faces ((0 3));
}
frontAndBack // face 4 5
{
type empty;
faces ((0 4) (0 5));
}
);
// ************************************************************************* //

View File

@ -0,0 +1 @@
../../common/system/controlDict

View File

@ -0,0 +1 @@
../../common/system/decomposeParDict

View File

@ -0,0 +1 @@
../../common/system/fvSchemes

View File

@ -0,0 +1 @@
../../common/system/fvSolution

View File

@ -0,0 +1,109 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2112 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object T;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 0 1 0 0 0];
internalField uniform 0;
_mappedMixedField
{
type mappedMixedField;
// What/how to sample:
sampleMode nearestPatchFaceAMI;
// Simulation world to sample
// Overwrite -> sampleWorld slabN;
// Region to sample
sampleRegion region0;
// If sampleMode is nearestPatchFace : patch to find faces of
samplePatch to_top;
// Use database to get data from (one-way or loose coupling in
// combination with functionObject)
//sampleDatabase false; //true;
// According to offsetMode (see above) supply one of
// offset, offsets or distance
offset (0 0 0);
value uniform 0.0;
// For mappedMixed
//weightField DTV;
refValue $value;
refGradient uniform 0.0;
valueFraction uniform 1.0;
}
boundaryField
{
top_to_1
{
$_mappedMixedField;
sampleWorld slab1;
}
top_to_2
{
$_mappedMixedField;
sampleWorld slab2;
}
top_to_3
{
$_mappedMixedField;
sampleWorld slab3;
}
top_to_4
{
$_mappedMixedField;
sampleWorld slab4;
}
top
{
type zeroGradient;
}
interface
{
type zeroGradient;
}
left
{
type fixedValue;
value uniform 1.2;
}
right
{
type fixedValue;
value uniform 0.2;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //

View File

@ -3,13 +3,11 @@ cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/bin/tools/RunFunctions # Tutorial run functions
#------------------------------------------------------------------------------
# Create meshes and initial fields
for subcase in left right
do
(
cd "$subcase" || exit
runApplication blockMesh && restore0Dir
)
done
# Create meshes
runApplication blockMesh
runApplication -s patches topoSet -dict system/topoSetDict.patches
runApplication createPatch -overwrite
#------------------------------------------------------------------------------

View File

@ -0,0 +1 @@
../../common/constant/transportProperties

View File

@ -0,0 +1,87 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2112 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// TOP
NSLABS 4;
scale 0.1;
transform
{
origin (0 1 0);
rotation none;
}
xdim #eval{0.5 * $NSLABS};
ydim 0.2;
zdim 0.1;
nx #eval #{ round(5 * $NSLABS) #};
vertices
(
(0 0 0)
($xdim 0 0)
($xdim $ydim 0)
(0 $ydim 0)
(0 0 $zdim)
($xdim 0 $zdim)
($xdim $ydim $zdim)
(0 $ydim $zdim)
);
blocks
(
hex (0 1 2 3 4 5 6 7) ($nx 2 1) grading (1 1 1)
);
boundary
(
left
{
type wall;
faces ((0 0));
}
right
{
type wall;
faces ((0 1));
}
interface // inter-world connections
{
type wall;
faces ((0 2));
}
top
{
type wall;
faces ((0 3));
}
frontAndBack
{
type empty;
faces ((0 4) (0 5));
}
);
// ************************************************************************* //

View File

@ -0,0 +1 @@
../../common/system/controlDict

View File

@ -0,0 +1,55 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2112 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object createPatchDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
pointSync false;
_fromSet
{
patchInfo { type patch; }
constructFrom set;
}
// Patches to create
patches
(
{
name top_to_1;
set top_to_1;
$_fromSet;
}
{
name top_to_2;
set top_to_2;
$_fromSet;
}
{
name top_to_3;
set top_to_3;
$_fromSet;
}
{
name top_to_4;
set top_to_4;
$_fromSet;
}
);
// ************************************************************************* //

View File

@ -0,0 +1 @@
../../common/system/decomposeParDict

View File

@ -0,0 +1 @@
../../common/system/fvSchemes

View File

@ -0,0 +1 @@
../../common/system/fvSolution

View File

@ -0,0 +1,71 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2112 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object topoSetDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
_newFromPatch
{
type faceSet;
action new;
source patchToFace;
patch interface;
}
_subsetBox
{
type faceSet;
action subset;
source boxToFace;
min (0 0 -1);
span (0.05 2 2);
}
actions
(
// slab 1 (offset 0)
{ name top_to_1; $_newFromPatch }
{
name top_to_1;
$_subsetBox;
min (0 0 -1);
}
// slab 2 (offset 1)
{ name top_to_2; $_newFromPatch }
{
name top_to_2;
$_subsetBox;
min (0.05 0 -1);
}
// slab 3 (offset 2)
{ name top_to_3; $_newFromPatch }
{
name top_to_3;
$_subsetBox;
min (0.10 0 -1);
}
// slab 4 (offset 3)
{ name top_to_4; $_newFromPatch }
{
name top_to_4;
$_subsetBox;
min (0.15 0 -1);
}
);
// ************************************************************************* //