ENH: handle partially attached master/slave faces (issue #608)

- addresses problems if faces are already partly attached
  (eg, on a single vertex or along an edge).
This commit is contained in:
Mark Olesen
2017-10-06 14:18:54 +02:00
parent 1cfb59fe1a
commit 00b94c4a40
26 changed files with 1739 additions and 1197 deletions

View File

@ -0,0 +1,8 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
. $WM_PROJECT_DIR/bin/tools/CleanFunctions # Tutorial clean functions
cleanCase0
rmdir constant 2> /dev/null
# -----------------------------------------------------------------------------

View File

@ -0,0 +1,19 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
. $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions
runApplication blockMesh
runApplication topoSet
runApplication subsetMesh final -patch outer -resultTime 0
# Avoid any inconsistencies
rm -f constant/polyMesh/{cellZones,faceZones,pointZones}
runApplication -s patches topoSet -dict system/topoSetDict.patches
runApplication createPatch -overwrite
# rm -f 0/polyMesh/{cellZones,faceZones,pointZones}
# -----------------------------------------------------------------------------

View File

@ -0,0 +1,12 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
. $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions
runApplication ./Allmesh
for dir in x y z
do
runApplication -s dir-$dir stitchMesh -partial outer$dir inner$dir
done
# -----------------------------------------------------------------------------

View File

@ -0,0 +1,50 @@
#!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory
. $WM_PROJECT_DIR/bin/tools/RunFunctions # Tutorial run functions
[ "$#" -gt 0 ] || {
echo "provide x, y, z or -all directions"
exit 1
}
unset optAll
for dir
do
case "$dir" in
-x | x) rm -rf 1 2 3 ;;
-y | y) rm -rf 2 3 ;;
-z | z) rm -rf 3 ;;
-all | all)
optAll=true
rm -rf 1 2 3
;;
*)
echo "provide x, y, z or -all directions"
exit 1
;;
esac
done
if [ "$optAll" = true ]
then
set -- x y z
fi
stitch()
{
local dir=$1
stitchMesh -partial outer$dir inner$dir | tee log.stitch-$dir
}
for dir
do
case "$dir" in
-x | x) [ -d 1 ] || stitch x;;
-y | y) [ -d 2 ] || stitch y;;
-z | z) [ -d 3 ] || stitch z;;
esac
done
# -----------------------------------------------------------------------------

View File

@ -0,0 +1,132 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
scale 1;
// Dimensions for outer box
lo 0; // outer lower corner
uo 1; // outer upper corner
// Dimensions for inner box
li -0.1; // inner lower corner
ui 0.497; // inner upper corner
// ^^^^^ very poorly handled gaps
ui 0.498; // inner upper corner
// ^^^^^ slave patch probably does not project onto master
ui 0.499; // inner upper corner
// ^^^^^ OK
vertices
(
( $lo $lo $lo )
( $uo $lo $lo )
( $uo $uo $lo )
( $lo $uo $lo )
( $lo $lo $uo )
( $uo $lo $uo )
( $uo $uo $uo )
( $lo $uo $uo )
( $li $li $li )
( $ui $li $li )
( $ui $ui $li )
( $li $ui $li )
( $li $li $ui )
( $ui $li $ui )
( $ui $ui $ui )
( $li $ui $ui )
);
blocks
(
hex (0 1 2 3 4 5 6 7) (6 6 6) simpleGrading (1 1 1)
hex (8 9 10 11 12 13 14 15) (10 10 10) simpleGrading (1 1 1)
);
edges
(
);
boundary
(
wallso
{
type patch;
faces
(
// Walls of the outside block
(0 4 7 3)
(1 2 6 5)
(0 1 5 4)
(3 7 6 2)
(0 3 2 1)
(4 5 6 7)
);
}
wallsi
{
type patch;
faces
(
// Walls of the inside block
(8 12 15 11)
(8 9 13 12)
(8 11 10 9)
);
}
// Outer faces populated by subsetMesh
outer
{
type patch;
faces ();
}
innerx
{
type patch;
inGroups (inner);
faces
(
(9 10 14 13)
);
}
innery
{
type patch;
inGroups (inner);
faces
(
(11 15 14 10)
);
}
innerz
{
type patch;
inGroups (inner);
faces
(
(12 13 14 15)
);
}
);
// ************************************************************************* //

View File

@ -0,0 +1,45 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object controlDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application simpleFoam;
startFrom latestTime;
startTime 0;
stopAt endTime;
endTime 10;
deltaT 1;
writeControl runTime;
writeInterval 1;
purgeWrite 0;
writeFormat ascii;
writePrecision 6;
timeFormat general;
timePrecision 6;
runTimeModifiable true;
// ************************************************************************* //

View File

@ -0,0 +1,53 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object createPatchDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
pointSync false;
outerSet
{
patchInfo
{
type patch;
inGroups (outer);
}
constructFrom set;
}
// Patches to create.
patches
(
{
name outerx;
set outerx;
$outerSet;
}
{
name outery;
set outery;
$outerSet;
}
{
name outerz;
set outerz;
$outerSet;
}
);
// ************************************************************************* //

View File

@ -0,0 +1,55 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object fvSchemes;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
ddtSchemes
{
default Euler;
}
gradSchemes
{
default Gauss linear;
}
divSchemes
{
default none;
div(phi,U) Gauss cubic;
}
laplacianSchemes
{
default Gauss linear corrected;
}
interpolationSchemes
{
default linear;
}
snGradSchemes
{
default corrected;
}
fluxRequired
{
default no;
p ;
}
// ************************************************************************* //

View File

@ -0,0 +1,43 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object fvSolution;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
solvers
{
p
{
solver PCG;
preconditioner DIC;
tolerance 1e-06;
relTol 0;
}
U
{
solver smoothSolver;
smoother symGaussSeidel;
tolerance 1e-05;
relTol 0;
}
}
PISO
{
nCorrectors 2;
nNonOrthogonalCorrectors 0;
}
// ************************************************************************* //

View File

@ -0,0 +1,106 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object topoSetDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
actions
(
// Outer cube
{
name outer;
type cellSet;
action new;
source regionToCell;
sourceInfo
{
insidePoints
(
(0.99 0.99 0.99)
);
}
}
{
name corner;
type cellSet;
action new;
source boxToCell;
sourceInfo
{
box (-1 -1 -1)(0.5 0.5 0.5);
}
}
{
name inner;
type cellSet;
action new;
source cellToCell;
sourceInfo
{
set corner;
}
}
{
name inner;
type cellSet;
action delete;
source cellToCell;
sourceInfo
{
set outer;
}
}
{
name outer;
type cellSet;
action delete;
source cellToCell;
sourceInfo
{
set corner;
}
}
{
name corner;
type cellSet;
action clear;
}
{
name final;
type cellSet;
action new;
source cellToCell;
sourceInfo
{
set outer;
}
}
{
name final;
type cellSet;
action add;
source cellToCell;
sourceInfo
{
set inner;
}
}
);
// ************************************************************************* //

View File

@ -0,0 +1,88 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: plus |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object topoSetDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
newFromPatch
{
type faceSet;
action new;
source patchToFace;
sourceInfo
{
name outer;
}
}
subsetNormal
{
type faceSet;
action subset;
source normalToFace;
sourceInfo
{
cos 0.1;
}
}
actions
(
// outerx
{
name outerx;
$newFromPatch
}
{
name outerx;
$subsetNormal;
sourceInfo
{
normal (-1 0 0);
}
}
// outery
{
name outery;
$newFromPatch
}
{
name outery;
$subsetNormal;
sourceInfo
{
normal (0 -1 0);
}
}
// outerz
{
name outerz;
$newFromPatch
}
{
name outerz;
$subsetNormal;
sourceInfo
{
normal (0 0 -1);
}
}
);
// ************************************************************************* //