TUT: use new 'arc' specification in several tutorials

- in most cases this eliminates manually calculation of circumferential
  points.

TUT: improve parameterization of sphere blockMeshDict

- allow separate parameterization of radius, ratio of inner to outer,
  and the number of divisions in x/y/z and radial directions
This commit is contained in:
Mark Olesen
2020-10-05 12:48:54 +02:00
parent 1d08ed9be2
commit 121c69ef2e
21 changed files with 786 additions and 715 deletions

View File

@ -16,65 +16,71 @@ FoamFile
scale 1;
// Geometric parameters
outerRadius 1;
// Divisions in x/y/z directions. Can be unequal.
nx 10;
ny $nx;
nz $nx;
geometry
{
sphere
{
type sphere;
origin (0 0 0);
radius 1;
radius $outerRadius;
}
}
v 0.5773502;
mv -0.5773502;
a 0.7071067;
ma -0.7071067;
// Box sizes
vo #eval{ sqrt($outerRadius/3) };
mvo #eval{ -$vo };
vertices
(
($mv $mv $mv)
( $v $mv $mv)
( $v $v $mv)
($mv $v $mv)
($mv $mv $v)
( $v $mv $v)
( $v $v $v)
($mv $v $v)
($mvo $mvo $mvo)
( $vo $mvo $mvo)
( $vo $vo $mvo)
($mvo $vo $mvo)
($mvo $mvo $vo)
( $vo $mvo $vo)
( $vo $vo $vo)
($mvo $vo $vo)
);
blocks
(
hex (0 1 2 3 4 5 6 7) (10 10 10) simpleGrading (1 1 1)
hex (0 1 2 3 4 5 6 7) ($nx $ny $nz) grading (1 1 1)
);
edges
(
arc 0 1 (0 $ma $ma)
arc 2 3 (0 $a $ma)
arc 6 7 (0 $a $a)
arc 4 5 (0 $ma $a)
arc 0 1 origin (0 0 0)
arc 2 3 origin (0 0 0)
arc 6 7 origin (0 0 0)
arc 4 5 origin (0 0 0)
arc 0 3 ($ma 0 $ma)
arc 1 2 ($a 0 $ma)
arc 5 6 ($a 0 $a)
arc 4 7 ($ma 0 $a)
arc 0 3 origin (0 0 0)
arc 1 2 origin (0 0 0)
arc 5 6 origin (0 0 0)
arc 4 7 origin (0 0 0)
arc 0 4 ($ma $ma 0)
arc 1 5 ($a $ma 0)
arc 2 6 ($a $a 0)
arc 3 7 ($ma $a 0)
arc 0 4 origin (0 0 0)
arc 1 5 origin (0 0 0)
arc 2 6 origin (0 0 0)
arc 3 7 origin (0 0 0)
);
faces
(
project (0 4 7 3) sphere
project (2 6 5 1) sphere
project (1 5 4 0) sphere
project (3 7 6 2) sphere
project (0 3 2 1) sphere
project (4 5 6 7) sphere
project (0 4 7 3) sphere // x-min
project (1 2 6 5) sphere // x-max
project (0 1 5 4) sphere // y-min
project (3 7 6 2) sphere // y-max
project (0 3 2 1) sphere // z-min
project (4 5 6 7) sphere // z-max
);
boundary
@ -84,12 +90,12 @@ boundary
type wall;
faces
(
(0 4 7 3)
(2 6 5 1)
(1 5 4 0)
(3 7 6 2)
(0 3 2 1)
(4 5 6 7)
(0 4 7 3) // x-min
(1 2 6 5) // x-max
(0 1 5 4) // y-min
(3 7 6 2) // y-max
(0 3 2 1) // z-min
(4 5 6 7) // z-max
);
}
);

View File

@ -17,103 +17,115 @@ FoamFile
scale 1;
verbose no;
// Geometric parameters
outerRadius 1;
innerRatio 0.7;
// Divisions in x/y/z and radial directions. Can be unequal.
nx 10;
ny $nx;
nz $nx;
nr 6;
geometry
{
sphere
{
type sphere;
origin (0 0 0);
radius 1;
radius $outerRadius;
}
}
// Outer box sizes
vo #eval{ sqrt($outerRadius/3) };
mvo #eval{ -$vo };
n 10;
v 0.5773502;
mv -0.5773502;
vh 0.2886751;
mvh -0.2886751;
a 0.7071067;
ma -0.7071067;
ah 0.3464101;
mah -0.3464101;
// Inner box sizes - % of overall dimension
vi #eval{ $innerRatio*$vo };
mvi #eval{ $innerRatio*$mvo };
vertices
(
($mvh $mvh $mvh)
( $vh $mvh $mvh)
( $vh $vh $mvh)
($mvh $vh $mvh)
($mvh $mvh $vh)
( $vh $mvh $vh)
( $vh $vh $vh)
($mvh $vh $vh)
// Inner block
($mvi $mvi $mvi)
( $vi $mvi $mvi)
( $vi $vi $mvi)
($mvi $vi $mvi)
($mvi $mvi $vi)
( $vi $mvi $vi)
( $vi $vi $vi)
($mvi $vi $vi)
($mv $mv $mv)
( $v $mv $mv)
( $v $v $mv)
($mv $v $mv)
($mv $mv $v)
( $v $mv $v)
( $v $v $v)
($mv $v $v)
// Outer blocks
($mvo $mvo $mvo)
( $vo $mvo $mvo)
( $vo $vo $mvo)
($mvo $vo $mvo)
($mvo $mvo $vo)
( $vo $mvo $vo)
( $vo $vo $vo)
($mvo $vo $vo)
);
blocks
(
hex ( 0 1 2 3 4 5 6 7) ($n $n $n) simpleGrading (1 1 1)
hex ( 9 8 12 13 1 0 4 5) ($n $n $n) simpleGrading (1 1 1)
hex (10 9 13 14 2 1 5 6) ($n $n $n) simpleGrading (1 1 1)
hex (11 10 14 15 3 2 6 7) ($n $n $n) simpleGrading (1 1 1)
hex ( 8 11 15 12 0 3 7 4) ($n $n $n) simpleGrading (1 1 1)
hex ( 8 9 10 11 0 1 2 3) ($n $n $n) simpleGrading (1 1 1)
hex (13 12 15 14 5 4 7 6) ($n $n $n) simpleGrading (1 1 1)
hex (0 1 2 3 4 5 6 7) ($nx $ny $nz) grading (1 1 1) // Inner block
// Outer blocks
hex ( 8 0 3 11 12 4 7 15) ($nr $ny $nz) grading (1 1 1) // x-min
hex ( 1 9 10 2 5 13 14 6) ($nr $ny $nz) grading (1 1 1) // x-max
hex ( 8 9 1 0 12 13 5 4) ($nx $nr $nz) grading (1 1 1) // y-min
hex ( 3 2 10 11 7 6 14 15) ($nx $nr $nz) grading (1 1 1) // y-max
hex ( 8 9 10 11 0 1 2 3) ($nx $ny $nr) grading (1 1 1) // z-min
hex ( 4 5 6 7 12 13 14 15) ($nx $ny $nr) grading (1 1 1) // z-max
);
edges
(
arc 8 9 (0 $ma $ma)
arc 10 11 (0 $a $ma)
arc 14 15 (0 $a $a)
arc 12 13 (0 $ma $a)
// Outer blocks
arc 8 9 origin (0 0 0)
arc 10 11 origin (0 0 0)
arc 14 15 origin (0 0 0)
arc 12 13 origin (0 0 0)
arc 8 11 ($ma 0 $ma)
arc 9 10 ($a 0 $ma)
arc 13 14 ($a 0 $a)
arc 12 15 ($ma 0 $a)
arc 8 11 origin (0 0 0)
arc 9 10 origin (0 0 0)
arc 13 14 origin (0 0 0)
arc 12 15 origin (0 0 0)
arc 8 12 ($ma $ma 0)
arc 9 13 ($a $ma 0)
arc 10 14 ($a $a 0)
arc 11 15 ($ma $a 0)
arc 8 12 origin (0 0 0)
arc 9 13 origin (0 0 0)
arc 10 14 origin (0 0 0)
arc 11 15 origin (0 0 0)
// Inner block - flattened by factor 1.1
arc 0 1 origin 1.1 (0 0 0)
arc 2 3 origin 1.1 (0 0 0)
arc 6 7 origin 1.1 (0 0 0)
arc 4 5 origin 1.1 (0 0 0)
arc 0 1 (0 $mah $mah)
arc 2 3 (0 $ah $mah)
arc 6 7 (0 $ah $ah)
arc 4 5 (0 $mah $ah)
arc 0 3 origin 1.1 (0 0 0)
arc 1 2 origin 1.1 (0 0 0)
arc 5 6 origin 1.1 (0 0 0)
arc 4 7 origin 1.1 (0 0 0)
arc 0 3 ($mah 0 $mah)
arc 1 2 ($ah 0 $mah)
arc 5 6 ($ah 0 $ah)
arc 4 7 ($mah 0 $ah)
arc 0 4 ($mah $mah 0)
arc 1 5 ($ah $mah 0)
arc 2 6 ($ah $ah 0)
arc 3 7 ($mah $ah 0)
arc 0 4 origin 1.1 (0 0 0)
arc 1 5 origin 1.1 (0 0 0)
arc 2 6 origin 1.1 (0 0 0)
arc 3 7 origin 1.1 (0 0 0)
);
faces
(
project ( 8 12 15 11) sphere
project (10 14 13 9) sphere
project ( 9 13 12 8) sphere
project (11 15 14 10) sphere
project ( 8 11 10 9) sphere
project (12 13 14 15) sphere
// Outer blocks
project ( 8 12 15 11) sphere // x-min
project ( 9 10 14 13) sphere // x-max
project ( 8 9 13 12) sphere // y-min
project (11 15 14 10) sphere // y-max
project ( 8 11 10 9) sphere // z-min
project (12 13 14 15) sphere // z-max
);
boundary
@ -123,12 +135,12 @@ boundary
type wall;
faces
(
( 8 12 15 11)
(10 14 13 9)
( 9 13 12 8)
(11 15 14 10)
( 8 11 10 9)
(12 13 14 15)
( 8 12 15 11) // x-min
( 9 10 14 13) // x-max
( 8 9 13 12) // y-min
(11 15 14 10) // y-max
( 8 11 10 9) // z-min
(12 13 14 15) // z-max
);
}
);

View File

@ -17,68 +17,81 @@ FoamFile
scale 1;
verbose no;
// Geometric parameters
outerRadius 1;
innerRatio 0.5;
// Divisions in x/y/z and radial directions. Can be unequal.
nx 10;
ny $nx;
nz $nx;
nr 6;
geometry
{
sphere
{
type sphere;
origin (0 0 0);
radius 1;
radius $outerRadius;
}
innerSphere
{
type sphere;
origin (0 0 0);
radius 0.5;
radius #eval{ $innerRatio * $outerRadius };
}
}
n 10;
// Rough approximation of corner points
v 0.5773502;
mv -0.5773502;
vh 0.2886751;
mvh -0.2886751;
// Outer box sizes (approximate)
vo #eval{ sqrt($outerRadius/3) };
mvo #eval{ -$vo };
// Inner box sizes - % of overall dimension
vi #eval{ $innerRatio*$vo };
mvi #eval{ $innerRatio*$mvo };
vertices
(
// Inner block points
project ($mvh $mvh $mvh) (innerSphere)
project ( $vh $mvh $mvh) (innerSphere)
project ( $vh $vh $mvh) (innerSphere)
project ($mvh $vh $mvh) (innerSphere)
project ($mvh $mvh $vh) (innerSphere)
project ( $vh $mvh $vh) (innerSphere)
project ( $vh $vh $vh) (innerSphere)
project ($mvh $vh $vh) (innerSphere)
project ($mvi $mvi $mvi) (innerSphere)
project ( $vi $mvi $mvi) (innerSphere)
project ( $vi $vi $mvi) (innerSphere)
project ($mvi $vi $mvi) (innerSphere)
project ($mvi $mvi $vi) (innerSphere)
project ( $vi $mvi $vi) (innerSphere)
project ( $vi $vi $vi) (innerSphere)
project ($mvi $vi $vi) (innerSphere)
// Outer block points
project ($mv $mv $mv) (sphere)
project ( $v $mv $mv) (sphere)
project ( $v $v $mv) (sphere)
project ($mv $v $mv) (sphere)
project ($mv $mv $v) (sphere)
project ( $v $mv $v) (sphere)
project ( $v $v $v) (sphere)
project ($mv $v $v) (sphere)
project ($mvo $mvo $mvo) (sphere)
project ( $vo $mvo $mvo) (sphere)
project ( $vo $vo $mvo) (sphere)
project ($mvo $vo $mvo) (sphere)
project ($mvo $mvo $vo) (sphere)
project ( $vo $mvo $vo) (sphere)
project ( $vo $vo $vo) (sphere)
project ($mvo $vo $vo) (sphere)
);
blocks
(
hex ( 0 1 2 3 4 5 6 7) ($n $n $n) simpleGrading (1 1 1)
hex ( 9 8 12 13 1 0 4 5) ($n $n $n) simpleGrading (1 1 1)
hex (10 9 13 14 2 1 5 6) ($n $n $n) simpleGrading (1 1 1)
hex (11 10 14 15 3 2 6 7) ($n $n $n) simpleGrading (1 1 1)
hex ( 8 11 15 12 0 3 7 4) ($n $n $n) simpleGrading (1 1 1)
hex ( 8 9 10 11 0 1 2 3) ($n $n $n) simpleGrading (1 1 1)
hex (13 12 15 14 5 4 7 6) ($n $n $n) simpleGrading (1 1 1)
hex (0 1 2 3 4 5 6 7) ($nx $ny $nz) grading (1 1 1) // Inner block
// Outer blocks
hex ( 8 0 3 11 12 4 7 15) ($nr $ny $nz) grading (1 1 1) // x-min
hex ( 1 9 10 2 5 13 14 6) ($nr $ny $nz) grading (1 1 1) // x-max
hex ( 8 9 1 0 12 13 5 4) ($nx $nr $nz) grading (1 1 1) // y-min
hex ( 3 2 10 11 7 6 14 15) ($nx $nr $nz) grading (1 1 1) // y-max
hex ( 8 9 10 11 0 1 2 3) ($nx $ny $nr) grading (1 1 1) // z-min
hex ( 4 5 6 7 12 13 14 15) ($nx $ny $nr) grading (1 1 1) // z-max
);
edges
(
// Outer edges
// Outer blocks
project 8 9 (sphere)
project 10 11 (sphere)
project 14 15 (sphere)
@ -94,32 +107,32 @@ edges
project 10 14 (sphere)
project 11 15 (sphere)
// Inner block
project 0 1 (innerSphere)
project 2 3 (innerSphere)
project 6 7 (innerSphere)
project 4 5 (innerSphere)
// Inner edges
project 0 1 (innerSphere)
project 2 3 (innerSphere)
project 6 7 (innerSphere)
project 4 5 (innerSphere)
project 0 3 (innerSphere)
project 1 2 (innerSphere)
project 5 6 (innerSphere)
project 4 7 (innerSphere)
project 0 3 (innerSphere)
project 1 2 (innerSphere)
project 5 6 (innerSphere)
project 4 7 (innerSphere)
project 0 4 (innerSphere)
project 1 5 (innerSphere)
project 2 6 (innerSphere)
project 3 7 (innerSphere)
project 0 4 (innerSphere)
project 1 5 (innerSphere)
project 2 6 (innerSphere)
project 3 7 (innerSphere)
);
faces
(
project ( 8 12 15 11) sphere
project (10 14 13 9) sphere
project ( 9 13 12 8) sphere
project (11 15 14 10) sphere
project ( 8 11 10 9) sphere
project (12 13 14 15) sphere
// Outer blocks
project ( 8 12 15 11) sphere // x-min
project ( 9 10 14 13) sphere // x-max
project ( 8 9 13 12) sphere // y-min
project (11 15 14 10) sphere // y-max
project ( 8 11 10 9) sphere // z-min
project (12 13 14 15) sphere // z-max
);
boundary
@ -129,12 +142,12 @@ boundary
type wall;
faces
(
( 8 12 15 11)
(10 14 13 9)
( 9 13 12 8)
(11 15 14 10)
( 8 11 10 9)
(12 13 14 15)
( 8 12 15 11) // x-min
( 9 10 14 13) // x-max
( 8 9 13 12) // y-min
(11 15 14 10) // y-max
( 8 11 10 9) // z-min
(12 13 14 15) // z-max
);
}
);

View File

@ -1,9 +1,15 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2006 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object blockMeshDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -25,13 +31,10 @@ scale 1;
D
*/
Ax 0.438912; Ay 0.000000;
Bx 18.28800; By 0.000000;
Cx 0.310358; Cy -0.310358;
Dx 12.931569; Dy -12.931569;
Hx 0.405502; Hy -0.167964;
Gx 16.895909; Gy -6.998515;
Ax 0.438912; Ay 0;
Bx 18.28800; By 0;
Cx 0.310358; Cy #eval{-$Cx};
Dx 12.931569; Dy #eval{-$Dx};
Z_DB_low -0.88706;
Z_AC_low -1.07;
@ -51,16 +54,15 @@ vertices
blocks
(
hex (0 1 2 3 4 5 6 7) (47 10 4) simpleGrading (41.6669 1 1)
hex (0 1 2 3 4 5 6 7) (47 10 4) simpleGrading (41.6669 1 1)
);
edges
(
arc 0 3 ($Hx $Hy $Z_AC_low)
arc 4 7 ($Hx $Hy $Z_high)
arc 1 2 ($Gx $Gy $Z_DB_low)
arc 5 6 ($Gx $Gy $Z_high)
arc 0 3 origin (0 0 $Z_AC_low)
arc 4 7 origin (0 0 $Z_high)
arc 1 2 origin (0 0 $Z_DB_low)
arc 5 6 origin (0 0 $Z_high)
);
patches