tutorials: Updates to #codeStream and #calc examples

Simplifications have been made where possible, as permitted by the new
$<type>var syntax. Duplication has been reduced in similar blockMesh
files (e.g., sloshingTank cases). Settings that cannot practically be
changed have been hard-coded (e.g., angle in the mixerVessel2D
blockMeshDict). The rotor2D blockMeshDict has been centralised and
extended to work with an arbitrary number of rotor blades.
This commit is contained in:
Will Bainbridge
2023-06-23 08:49:43 +01:00
parent 24995dcbd4
commit 33eb61406b
42 changed files with 587 additions and 864 deletions

View File

@ -40,16 +40,13 @@ mover
parent root;
// Cuboid dimensions
Lx 0.3;
Ly 0.2;
Lz 0.5;
L (0.3 0.2 0.5);
// Density of the cuboid
rho 500;
// Cuboid mass
mass #calc "$rho*$Lx*$Ly*$Lz";
L ($Lx $Ly $Lz);
mass #calc "$rho*cmptProduct($<vector>L)";
centreOfMass (0 0 0.25);
transform (1 0 0 0 1 0 0 0 1) (0.5 0.45 0.1);

View File

@ -30,34 +30,16 @@ mover
centreOfMass (0.5 0.45 0.35);
// Cuboid dimensions
Lx 0.3;
Ly 0.2;
Lz 0.5;
L (0.3 0.2 0.5);
// Density of the solid
rhoSolid 500;
// Cuboid mass
mass #calc "$rhoSolid*$Lx*$Ly*$Lz";
mass #calc "$rhoSolid*cmptProduct($<vector>L)";
// Cuboid moment of inertia about the centre of mass
momentOfInertia #codeStream
{
codeInclude
#{
#include "diagTensor.H"
#};
code
#{
scalar sqrLx = sqr($Lx);
scalar sqrLy = sqr($Ly);
scalar sqrLz = sqr($Lz);
os <<
$mass
*diagTensor(sqrLy + sqrLz, sqrLx + sqrLz, sqrLx + sqrLy)/12.0;
#};
};
momentOfInertia #calc "$mass*(tensor::one-tensor::I)&cmptSqr($<vector>L)/12";
report on;
accelerationRelaxation 0.7;

View File

@ -40,16 +40,13 @@ mover
parent root;
// Cuboid dimensions
Lx 0.3;
Ly 0.2;
Lz 0.5;
L (0.3 0.2 0.5);
// Density of the cuboid
rho 500;
// Cuboid mass
mass #calc "$rho*$Lx*$Ly*$Lz";
L ($Lx $Ly $Lz);
mass #calc "$rho*cmptProduct($<vector>L)";
centreOfMass (0 0 0.25);
transform (1 0 0 0 1 0 0 0 1) (0.5 0.45 0.1);

View File

@ -30,34 +30,16 @@ mover
centreOfMass (0.5 0.45 0.35);
// Cuboid dimensions
Lx 0.3;
Ly 0.2;
Lz 0.5;
L (0.3 0.2 0.5);
// Density of the solid
rhoSolid 500;
// Cuboid mass
mass #calc "$rhoSolid*$Lx*$Ly*$Lz";
mass #calc "$rhoSolid*cmptProduct($<vector>L)";
// Cuboid moment of inertia about the centre of mass
momentOfInertia #codeStream
{
codeInclude
#{
#include "diagTensor.H"
#};
code
#{
scalar sqrLx = sqr($Lx);
scalar sqrLy = sqr($Ly);
scalar sqrLz = sqr($Lz);
os <<
$mass
*diagTensor(sqrLy + sqrLz, sqrLx + sqrLz, sqrLx + sqrLy)/12.0;
#};
};
momentOfInertia #calc "$mass*(tensor::one-tensor::I)&cmptSqr($<vector>L)/12";
report on;
accelerationRelaxation 0.7;

View File

@ -25,7 +25,7 @@ baffles
surface searchableCylinder;
point1 (0 0 -100);
point2 (0 0 100);
radius $rotorRegion;
radius $rMid;
owner
{

View File

@ -19,7 +19,7 @@ internalField uniform (0 0 0);
boundaryField
{
walls
wall
{
type movingWallVelocity;
value uniform (0 0 0);

View File

@ -19,7 +19,7 @@ internalField uniform 0;
boundaryField
{
walls
wall
{
type zeroGradient;
}

View File

@ -19,7 +19,7 @@ internalField uniform 0;
boundaryField
{
walls
wall
{
type fixedFluxPressure;
}

View File

@ -19,7 +19,7 @@ internalField uniform (0 0 0);
boundaryField
{
walls
wall
{
type movingWallVelocity;
value uniform (0 0 0);

View File

@ -19,7 +19,7 @@ internalField uniform 0;
boundaryField
{
walls
wall
{
type zeroGradient;
}

View File

@ -19,7 +19,7 @@ internalField uniform 0;
boundaryField
{
walls
wall
{
type fixedFluxPressure;
}

View File

@ -19,7 +19,7 @@ internalField uniform (0 0 0);
boundaryField
{
walls
wall
{
type movingWallVelocity;
value uniform (0 0 0);

View File

@ -19,7 +19,7 @@ internalField uniform 0;
boundaryField
{
walls
wall
{
type zeroGradient;
}

View File

@ -19,7 +19,7 @@ internalField uniform 0;
boundaryField
{
walls
wall
{
type fixedFluxPressure;
}