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:
@ -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);
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -25,7 +25,7 @@ baffles
|
||||
surface searchableCylinder;
|
||||
point1 (0 0 -100);
|
||||
point2 (0 0 100);
|
||||
radius $rotorRegion;
|
||||
radius $rMid;
|
||||
|
||||
owner
|
||||
{
|
||||
|
||||
@ -19,7 +19,7 @@ internalField uniform (0 0 0);
|
||||
|
||||
boundaryField
|
||||
{
|
||||
walls
|
||||
wall
|
||||
{
|
||||
type movingWallVelocity;
|
||||
value uniform (0 0 0);
|
||||
|
||||
@ -19,7 +19,7 @@ internalField uniform 0;
|
||||
|
||||
boundaryField
|
||||
{
|
||||
walls
|
||||
wall
|
||||
{
|
||||
type zeroGradient;
|
||||
}
|
||||
|
||||
@ -19,7 +19,7 @@ internalField uniform 0;
|
||||
|
||||
boundaryField
|
||||
{
|
||||
walls
|
||||
wall
|
||||
{
|
||||
type fixedFluxPressure;
|
||||
}
|
||||
|
||||
@ -19,7 +19,7 @@ internalField uniform (0 0 0);
|
||||
|
||||
boundaryField
|
||||
{
|
||||
walls
|
||||
wall
|
||||
{
|
||||
type movingWallVelocity;
|
||||
value uniform (0 0 0);
|
||||
|
||||
@ -19,7 +19,7 @@ internalField uniform 0;
|
||||
|
||||
boundaryField
|
||||
{
|
||||
walls
|
||||
wall
|
||||
{
|
||||
type zeroGradient;
|
||||
}
|
||||
|
||||
@ -19,7 +19,7 @@ internalField uniform 0;
|
||||
|
||||
boundaryField
|
||||
{
|
||||
walls
|
||||
wall
|
||||
{
|
||||
type fixedFluxPressure;
|
||||
}
|
||||
|
||||
@ -19,7 +19,7 @@ internalField uniform (0 0 0);
|
||||
|
||||
boundaryField
|
||||
{
|
||||
walls
|
||||
wall
|
||||
{
|
||||
type movingWallVelocity;
|
||||
value uniform (0 0 0);
|
||||
|
||||
@ -19,7 +19,7 @@ internalField uniform 0;
|
||||
|
||||
boundaryField
|
||||
{
|
||||
walls
|
||||
wall
|
||||
{
|
||||
type zeroGradient;
|
||||
}
|
||||
|
||||
@ -19,7 +19,7 @@ internalField uniform 0;
|
||||
|
||||
boundaryField
|
||||
{
|
||||
walls
|
||||
wall
|
||||
{
|
||||
type fixedFluxPressure;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user