v2406: New and improved usability
'lookup' Function1
A new lookup Function1 has been introduced which can look up a UniformDimensionedField from a database (usually the mesh). This can be applied to a calculated value in e.g. a boundary condition or simulation setting. The following example demonstrates how to use a rotational velocity which is calculated by a rotatingMotion model:
solidBodyMotionFunction rotatingMotion;
rotatingMotionCoeffs
{
origin (0.005 0.005 0.005);
axis (0 0 1);
omega lookup;
// Name of UniformDimensionedField to look up
name myRotationalVelocity;
}
or the extended syntax, e.g. if there already exists a name entry:
omega lookup
lookupCoeffs
{
name myRotationalVelocity;
}
Some variables are already available as a UniformDimensionedField e.g. gravity using the name 'g'. Further variables can be added via user coding, e.g. inside a coded function object:
libs (utilityFunctionObjects);
type coded;
name register_myVar;
codeRead
#{
const IOobject io
(
"myVar",
mesh().time().constant(),
mesh()
);
auto* ptr =
const_cast<objectRegistry&>
(
io.db().findObject<uniformDimensionedScalarField>(io.name())
);
if (!ptr)
{
ptr = new uniformDimensionedScalarField
(
io,
dimless,
0.80
);
ptr->store();
}
#};
'lookup' PatchFunction1
This variant operates on a patch; it looks-up a volume, surface or point field with the supplied name and extracts the values on the patch, e.g
movingWall
{
type uniformFixedValue;
uniformValue lookup;
name U.water; // use patch value of field U.water
value $internalField;
}
Tutorials
Source code
topoSet source methods that expect the keywords set or sets will now also accept the keywords zone or zones. This will select elements from the current mesh zones instead of reading sets from the constant/polyMesh/sets directory.
Gitlab
Periodic cyclic AMI cases can be challenging to assemble. A rotating axial turbine case supplied by a member of the OpenFOAM community, Hakan Nilsson is now available where the mesh is constructed in cylindrical coordinates and later transformed to Cartesian coordinates using the new transformation options in OpenFOAM v2406.
Tutorial
Gitlab
Attribution
- Thanks to Håkan Nilsson