Commit e7f380dc authored by Mark Olesen's avatar Mark Olesen Committed by Andrew Heather
Browse files

TUT: use #eval instead of #calc where possible

parent 02914539
......@@ -25,43 +25,41 @@ t -10;
u 10;
o 10;
d2r #calc "constant::mathematical::pi/180";
r0CosT #calc "$r0*cos($d2r*($t ))";
r0CosTO #calc "$r0*cos($d2r*($t+$o))";
r0CosU #calc "$r0*cos($d2r*($u ))";
r0CosUO #calc "$r0*cos($d2r*($u+$o))";
r0SinT #calc "$r0*sin($d2r*($t ))";
r0SinTO #calc "$r0*sin($d2r*($t+$o))";
r0SinU #calc "$r0*sin($d2r*($u ))";
r0SinUO #calc "$r0*sin($d2r*($u+$o))";
r1CosT #calc "$r1*cos($d2r*($t ))";
r1CosTO #calc "$r1*cos($d2r*($t+$o))";
r1CosU #calc "$r1*cos($d2r*($u ))";
r1CosUO #calc "$r1*cos($d2r*($u+$o))";
r1SinT #calc "$r1*sin($d2r*($t ))";
r1SinTO #calc "$r1*sin($d2r*($t+$o))";
r1SinU #calc "$r1*sin($d2r*($u ))";
r1SinUO #calc "$r1*sin($d2r*($u+$o))";
r2CosT #calc "$r2*cos($d2r*($t ))";
r2CosTO #calc "$r2*cos($d2r*($t+$o))";
r2CosU #calc "$r2*cos($d2r*($u ))";
r2CosUO #calc "$r2*cos($d2r*($u+$o))";
r2SinT #calc "$r2*sin($d2r*($t ))";
r2SinTO #calc "$r2*sin($d2r*($t+$o))";
r2SinU #calc "$r2*sin($d2r*($u ))";
r2SinUO #calc "$r2*sin($d2r*($u+$o))";
r3CosT #calc "$r3*cos($d2r*($t ))";
r3CosTO #calc "$r3*cos($d2r*($t+$o))";
r3CosU #calc "$r3*cos($d2r*($u ))";
r3CosUO #calc "$r3*cos($d2r*($u+$o))";
r3SinT #calc "$r3*sin($d2r*($t ))";
r3SinTO #calc "$r3*sin($d2r*($t+$o))";
r3SinU #calc "$r3*sin($d2r*($u ))";
r3SinUO #calc "$r3*sin($d2r*($u+$o))";
r0CosT #eval{ $r0*cos(degToRad($t )) };
r0CosTO #eval{ $r0*cos(degToRad($t+$o)) };
r0CosU #eval{ $r0*cos(degToRad($u )) };
r0CosUO #eval{ $r0*cos(degToRad($u+$o)) };
r0SinT #eval{ $r0*sin(degToRad($t )) };
r0SinTO #eval{ $r0*sin(degToRad($t+$o)) };
r0SinU #eval{ $r0*sin(degToRad($u )) };
r0SinUO #eval{ $r0*sin(degToRad($u+$o)) };
r1CosT #eval{ $r1*cos(degToRad($t )) };
r1CosTO #eval{ $r1*cos(degToRad($t+$o)) };
r1CosU #eval{ $r1*cos(degToRad($u )) };
r1CosUO #eval{ $r1*cos(degToRad($u+$o)) };
r1SinT #eval{ $r1*sin(degToRad($t )) };
r1SinTO #eval{ $r1*sin(degToRad($t+$o)) };
r1SinU #eval{ $r1*sin(degToRad($u )) };
r1SinUO #eval{ $r1*sin(degToRad($u+$o)) };
r2CosT #eval{ $r2*cos(degToRad($t )) };
r2CosTO #eval{ $r2*cos(degToRad($t+$o)) };
r2CosU #eval{ $r2*cos(degToRad($u )) };
r2CosUO #eval{ $r2*cos(degToRad($u+$o)) };
r2SinT #eval{ $r2*sin(degToRad($t )) };
r2SinTO #eval{ $r2*sin(degToRad($t+$o)) };
r2SinU #eval{ $r2*sin(degToRad($u )) };
r2SinUO #eval{ $r2*sin(degToRad($u+$o)) };
r3CosT #eval{ $r3*cos(degToRad($t )) };
r3CosTO #eval{ $r3*cos(degToRad($t+$o)) };
r3CosU #eval{ $r3*cos(degToRad($u )) };
r3CosUO #eval{ $r3*cos(degToRad($u+$o)) };
r3SinT #eval{ $r3*sin(degToRad($t )) };
r3SinTO #eval{ $r3*sin(degToRad($t+$o)) };
r3SinU #eval{ $r3*sin(degToRad($u )) };
r3SinUO #eval{ $r3*sin(degToRad($u+$o)) };
vertices
(
......
......@@ -16,10 +16,11 @@ FoamFile
scale 1;
L #calc "20*M_PI";
H #calc "1";
H2 #calc "2*$H";
W #calc "M_PI";
L #eval{ 20*pi() };
H 1.0;
H2 #eval{ 2*$H };
W #eval{ pi() };
vertices
(
......
......@@ -45,6 +45,10 @@ timePrecision 6;
runTimeModifiable true;
// Allow 10% run-up before calculating mean
timeStart #eval #{ 0.1 * ${/endTime} #};
functions
{
Q1
......@@ -84,7 +88,7 @@ functions
type fieldAverage;
libs (fieldFunctionObjects);
writeControl writeTime;
timeStart 8.5;
timeStart ${/timeStart};
fields
(
......
......@@ -23,17 +23,17 @@ z_pad 1;
x0 0;
x1 $x_up;
x2 #calc "$x1 + 1";
x3 #calc "$x2 + $x_down";
x2 #eval{ $x1 + 1 };
x3 #eval{ $x2 + $x_down };
y0 0;
y1 $y_pad;
y2 #calc "$y1 + 1";
y3 #calc "$y2 + $y_pad";
y2 #eval{ $y1 + 1 };
y3 #eval{ $y2 + $y_pad };
z0 0;
z1 1;
z2 #calc "$z1 + $z_pad";
z2 #eval{ $z1 + $z_pad };
nx1 40;
nx2 40;
......
......@@ -20,14 +20,12 @@ scale 1;
halfAngle 45.0;
//- Radius of pipe [m]
radius 0.5;
radius 0.5;
radHalfAngle #calc "degToRad($halfAngle)";
y #calc "$radius*sin($radHalfAngle)";
minY #calc "-1.0*$y";
z #calc "$radius*cos($radHalfAngle)";
minZ #calc "-1.0*$z";
y #eval{ $radius*sin(degToRad($halfAngle)) };
minY #eval{ -1*$y };
z #eval{ $radius*cos(degToRad($halfAngle)) };
minZ #eval{ -1*$z };
vertices
(
......
......@@ -32,83 +32,79 @@ sphereLayerThickness 2.0; // Total layer thickness in sphere radii
sphereRadius 0.028;
sphereCentreHeight 0.147; // y-coord of sphere centre
pi #calc "Foam::constant::mathematical::pi";
// Calculated positions
sphereRadiusPosition #calc "-1.0*(1.0 + $sphereLayerThickness)*$sphereRadius"; //"-1.0* $sphereRadius";
AMIBlockPosition #calc "2.0*$sphereRadiusPosition + $sphereRadius";
sphereRadiusPosition #eval{ -1.0*(1.0 + $sphereLayerThickness)*$sphereRadius };
AMIBlockPosition #eval{ 2.0*$sphereRadiusPosition + $sphereRadius };
// Centre plane is z=0, so use half of wedge angle to calculate pos and neg
// z-positions
halfAngleRad #calc "0.5*$wedgeAngle*$pi/180.0";
tanAlpha #calc "tan($halfAngleRad)";
tanAlpha #eval{ tan(0.5*degToRad($wedgeAngle)) };
// Multiply by -1 because tan give negative value
firstBlockPosDepth #calc "-1.0*$tanAlpha*$sphereRadiusPosition";
firstBlockNegDepth #calc "-1.0*$firstBlockPosDepth";
AMIBlockPosDepth #calc "-1.0*$tanAlpha*$AMIBlockPosition";
AMIBlockNegDepth #calc "-1.0*$AMIBlockPosDepth";
farFieldPosDepth #calc "-1.0*$tanAlpha*$farFieldWall";
farFieldNegDepth #calc "-1.0*$farFieldPosDepth";
firstBlockPosDepth #eval{ -1.0*$tanAlpha*$sphereRadiusPosition };
firstBlockNegDepth #eval{ -1.0*$firstBlockPosDepth };
AMIBlockPosDepth #eval{ -1.0*$tanAlpha*$AMIBlockPosition };
AMIBlockNegDepth #eval{ -1.0*$AMIBlockPosDepth };
farFieldPosDepth #eval{ -1.0*$tanAlpha*$farFieldWall };
farFieldNegDepth #eval{ -1.0*$farFieldPosDepth };
bottomBlockTopHeight #calc "$sphereCentreHeight - $lowerSphereBlock*$sphereRadius";
topBlockBottomHeight #calc "$sphereCentreHeight + $upperSphereBlock*$sphereRadius";
bottomBlockTopHeight #eval{ $sphereCentreHeight - $lowerSphereBlock*$sphereRadius };
topBlockBottomHeight #eval{ $sphereCentreHeight + $upperSphereBlock*$sphereRadius };
topSphere #calc "$sphereCentreHeight + $sphereRadius";
bottomSphere #calc "$sphereCentreHeight - $sphereRadius";
topSphereLayer #calc "$sphereCentreHeight + (1.0 + $sphereLayerThickness)*$sphereRadius";
bottomSphereLayer #calc "$sphereCentreHeight - (1.0 + $sphereLayerThickness)*$sphereRadius";
topSphere #eval{ $sphereCentreHeight + $sphereRadius };
bottomSphere #eval{ $sphereCentreHeight - $sphereRadius };
topSphereLayer #eval{ $sphereCentreHeight + (1.0 + $sphereLayerThickness)*$sphereRadius };
bottomSphereLayer #eval{ $sphereCentreHeight - (1.0 + $sphereLayerThickness)*$sphereRadius };
// Layer block below sphere
innerBottomLayerX #calc "-1.0*cos(45.0*$pi/180.0)*$sphereRadius";
innerBottomLayerY #calc "$sphereCentreHeight - cos(45.0*$pi/180.0)*$sphereRadius";
innerBottomLayerZPos #calc "-1.0*$tanAlpha*$innerBottomLayerX";
innerBottomLayerZNeg #calc "-1.0*$innerBottomLayerZPos";
innerBottomArcX1 #calc "-1.0*sin(22.5*$pi/180.0)*$sphereRadius";
innerBottomArcY1 #calc "$sphereCentreHeight - cos(22.5*$pi/180.0)*$sphereRadius";
innerBottomArcZ1Pos #calc "$innerBottomArcX1*$tanAlpha";
innerBottomArcZ1Neg #calc "-1.0*$innerBottomArcZ1Pos";
outerBottomArcX1 #calc "-1.0*sin(22.5*$pi/180.0)*$sphereRadius*(1.0 + $sphereLayerThickness)";
outerBottomArcY1 #calc #{ $sphereCentreHeight - cos(22.5*$pi/180.0)*$sphereRadius*(1.0 + $sphereLayerThickness) #};
outerBottomArcZ1Pos #calc "$outerBottomArcX1*$tanAlpha";
outerBottomArcZ1Neg #calc "-1.0*$outerBottomArcZ1Pos";
outerBottomLayerX #calc "-1.0*cos(45.0*$pi/180.0)*(1.0 + $sphereLayerThickness)*$sphereRadius";
outerBottomLayerY #calc "$sphereCentreHeight - cos(45.0*$pi/180.0)*(1.0 + $sphereLayerThickness)*$sphereRadius";
outerBottomLayerZPos #calc "-1.0*$tanAlpha*$outerBottomLayerX";
outerBottomLayerZNeg #calc "-1.0*$outerBottomLayerZPos";
innerBottomLayerX #eval{ -1.0*cos(degToRad(45.0))*$sphereRadius };
innerBottomLayerY #eval{ $sphereCentreHeight - cos(degToRad(45.0))*$sphereRadius };
innerBottomLayerZPos #eval{ -1.0*$tanAlpha*$innerBottomLayerX };
innerBottomLayerZNeg #eval{ -1.0*$innerBottomLayerZPos };
innerBottomArcX1 #eval{ -1.0*sin(degToRad(22.5))*$sphereRadius };
innerBottomArcY1 #eval{ $sphereCentreHeight - cos(degToRad(22.5))*$sphereRadius };
innerBottomArcZ1Pos #eval{ $innerBottomArcX1*$tanAlpha };
innerBottomArcZ1Neg #eval{ -1.0*$innerBottomArcZ1Pos };
outerBottomArcX1 #eval{ -1.0*sin(degToRad(22.5))*$sphereRadius*(1.0 + $sphereLayerThickness) };
outerBottomArcY1 #eval{ $sphereCentreHeight - cos(degToRad(22.5))*$sphereRadius*(1.0 + $sphereLayerThickness) };
outerBottomArcZ1Pos #eval{ $outerBottomArcX1*$tanAlpha };
outerBottomArcZ1Neg #eval{ -1.0*$outerBottomArcZ1Pos };
outerBottomLayerX #eval{ -1.0*cos(degToRad(45.0))*(1.0 + $sphereLayerThickness)*$sphereRadius };
outerBottomLayerY #eval{ $sphereCentreHeight - cos(degToRad(45.0))*(1.0 + $sphereLayerThickness)*$sphereRadius };
outerBottomLayerZPos #eval{ -1.0*$tanAlpha*$outerBottomLayerX };
outerBottomLayerZNeg #eval{ -1.0*$outerBottomLayerZPos };
// Layer block above sphere
innerTopLayerX #calc "cos(135.0*$pi/180.0)*$sphereRadius";
innerTopLayerY #calc "$sphereCentreHeight - cos(135.0*$pi/180.0)*$sphereRadius";
innerTopLayerZPos #calc "-1.0*$tanAlpha*$innerBottomLayerX";
innerTopLayerZNeg #calc "-1.0*$innerBottomLayerZPos";
innerTopArcX1 #calc "-1.0*sin(157.5*$pi/180.0)*$sphereRadius";
innerTopArcY1 #calc "$sphereCentreHeight - cos(157.5*$pi/180.0)*$sphereRadius";
innerTopArcZ1Pos #calc "$innerTopArcX1*$tanAlpha";
innerTopArcZ1Neg #calc "-1.0*$innerTopArcZ1Pos";
outerTopArcX1 #calc "-1.0*sin(157.5*$pi/180.0)*$sphereRadius*(1.0 + $sphereLayerThickness)";
outerTopArcY1 #calc "$sphereCentreHeight - cos(157.5*$pi/180.0)*$sphereRadius*(1.0 + $sphereLayerThickness)";
outerTopArcZ1Pos #calc "$outerTopArcX1*$tanAlpha";
outerTopArcZ1Neg #calc "-1.0*$outerTopArcZ1Pos";
outerTopLayerX #calc "cos(135.0*$pi/180.0)*(1.0 + $sphereLayerThickness)*$sphereRadius";
outerTopLayerY #calc "$sphereCentreHeight - cos(135.0*$pi/180.0)*(1.0 + $sphereLayerThickness)*$sphereRadius";
outerTopLayerZPos #calc "-1.0*$tanAlpha*$outerTopLayerX";
outerTopLayerZNeg #calc "-1.0*$outerTopLayerZPos";
innerTopLayerX #eval{ cos(degToRad(135.0))*$sphereRadius };
innerTopLayerY #eval{ $sphereCentreHeight - cos(degToRad(135.0))*$sphereRadius };
innerTopLayerZPos #eval{ -1.0*$tanAlpha*$innerBottomLayerX };
innerTopLayerZNeg #eval{ -1.0*$innerBottomLayerZPos };
innerTopArcX1 #eval{ -1.0*sin(degToRad(157.5))*$sphereRadius };
innerTopArcY1 #eval{ $sphereCentreHeight - cos(degToRad(157.5))*$sphereRadius };
innerTopArcZ1Pos #eval{ $innerTopArcX1*$tanAlpha };
innerTopArcZ1Neg #eval{ -1.0*$innerTopArcZ1Pos };
outerTopArcX1 #eval{ -1.0*sin(degToRad(157.5))*$sphereRadius*(1.0 + $sphereLayerThickness) };
outerTopArcY1 #eval{ $sphereCentreHeight - cos(degToRad(157.5))*$sphereRadius*(1.0 + $sphereLayerThickness) };
outerTopArcZ1Pos #eval{ $outerTopArcX1*$tanAlpha };
outerTopArcZ1Neg #eval{ -1.0*$outerTopArcZ1Pos };
outerTopLayerX #eval{ cos(degToRad(135.0))*(1.0 + $sphereLayerThickness)*$sphereRadius };
outerTopLayerY #eval{ $sphereCentreHeight - cos(degToRad(135.0))*(1.0 + $sphereLayerThickness)*$sphereRadius };
outerTopLayerZPos #eval{ -1.0*$tanAlpha*$outerTopLayerX };
outerTopLayerZNeg #eval{ -1.0*$outerTopLayerZPos };
// Layer block left of sphere
innerLeftArcX #calc "-1.0*$sphereRadius";
innerLeftArcY #calc "$sphereCentreHeight";
innerLeftArcZPos #calc "-1.0*$tanAlpha*$innerLeftArcX";
innerLeftArcZNeg #calc "-1.0*$innerLeftArcZPos";
outerLeftArcX #calc "-1.0*(1.0 + $sphereLayerThickness)*$sphereRadius";
outerLeftArcZPos #calc "-1.0*$tanAlpha*$outerLeftArcX";
outerLeftArcZNeg #calc "-1.0*$outerLeftArcZPos";
innerLeftArcX #eval{ -1.0*$sphereRadius };
innerLeftArcY #eval{ $sphereCentreHeight };
innerLeftArcZPos #eval{ -1.0*$tanAlpha*$innerLeftArcX };
innerLeftArcZNeg #eval{ -1.0*$innerLeftArcZPos };
outerLeftArcX #eval{ -1.0*(1.0 + $sphereLayerThickness)*$sphereRadius };
outerLeftArcZPos #eval{ -1.0*$tanAlpha*$outerLeftArcX };
outerLeftArcZNeg #eval{ -1.0*$outerLeftArcZPos };
vertices
......@@ -159,9 +155,10 @@ vertices
edgeNumber 1; // 0.707;
layerGrading 0.5;
invLayerGrading #calc "1.0/$layerGrading";
invLayerGrading #eval{ 1.0/$layerGrading };
blockGrading 0.3;
invBlockGrading #calc "1.0/$blockGrading";
invBlockGrading #eval{ 1.0/$blockGrading };
blocks
(
......
......@@ -47,7 +47,7 @@ rigidBodyMotionCoeffs
rho 500;
// Cuboid mass
mass #calc "$rho*$Lx*$Ly*$Lz";
mass #eval{ $rho*$Lx*$Ly*$Lz };
L ($Lx $Ly $Lz);
centreOfMass (0 0 0.25);
transform (1 0 0 0 1 0 0 0 1) (0.5 0.45 0.1);
......
......@@ -37,7 +37,7 @@ sixDoFRigidBodyMotionCoeffs
rhoSolid 500;
// Cuboid mass
mass #calc "$rhoSolid*$Lx*$Ly*$Lz";
mass #eval{ $rhoSolid*$Lx*$Ly*$Lz };
// Cuboid moment of inertia about the centre of mass
momentOfInertia #codeStream
......
......@@ -38,7 +38,7 @@ sixDoFRigidBodyMotionCoeffs
rhoSolid 700;
// Cuboid mass
mass #calc "$rhoSolid*$Lx*$Ly*$Lz";
mass #eval{ $rhoSolid*$Lx*$Ly*$Lz };
// Cuboid moment of inertia about the centre of mass
momentOfInertia #codeStream
......
......@@ -14,8 +14,6 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dynamicFvMesh dynamicOversetFvMesh;
solvers
......@@ -55,7 +53,7 @@ solvers
rhoSolid 500;
// Cuboid mass
mass #calc "$rhoSolid*$Lx*$Ly*$Lz";
mass #eval{ $rhoSolid*$Lx*$Ly*$Lz };
// Cuboid moment of inertia about the centre of mass
momentOfInertia #codeStream
......
......@@ -14,12 +14,12 @@ FoamFile
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
scale 1;
scale 1;
L 0.125664;// "20*M_PI";
H #calc "1";
H2 #calc "2*$H";
W #calc "M_PI";
L 0.125664;
H 1.0;
H2 #eval{ 2*$H };
W #eval{ pi() };
vertices
(
......
......@@ -48,7 +48,7 @@ runTimeModifiable false;
adjustTimeStep false;
// Allow 10% run-up before calculating mean
timeStart #calc #{ 0.1 * ${/endTime} #};
timeStart #eval #{ 0.1 * ${/endTime} #};
functions
{
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment