The purpose of these operations was unclear, and there was no
documentation or examples of their usage. The differences between these
operations behaviours for scalar and vector input seemed arbitrary.
These operations have in some cases become the subject of confusion.
They have therefore been removed.
Equivalent functionality could be easily reinstated as and when a clear
need and application becomes apparent.
Dictionary entries constructed with #calc and #codeStream can now
conveniently access and use typed variables. This means calculations
involving vectors and tensors and list and field types are now possible.
To access a variable and construct it as a given type within a #calc
or #codeStream entry, put the type immediately after the $ symbol inside
angled brackets <>. So, $<vector>var or $<vector>{var} substitutes a
variable named var as a vector.
Examples:
- Reflect a point in a plane defined by a normal
p (1 2 3);
n (1 1 0);
pStar #calc "$<vector>p - (2*sqr($<vector>n)/magSqr($<vector>n)&$<vector>p)";
- Rotate a list of points around an axis by a given angle
points ((3 0 0) (2 1 1) (1 2 2) (0 3 3));
rotation
{
axis (0 1 1);
angle 45;
}
#codeStream
{
codeInclude
#{
#include "pointField.H"
#include "transform.H"
#};
code
#{
const pointField points($<List<point>>points);
const vector axis = $<vector>!rotation/axis;
const scalar angle = degToRad($!rotation/angle);
os << "pointsRotated" << nl << (Ra(axis, angle) & points)() << ";";
#};
};
- Compute the centre and trianglation of a polygon
polygon ((0 0 0) (1 0 0) (2 1 0) (0 2 0) (-1 1 0));
#codeStream
{
codeInclude
#{
#include "polygonTriangulate.H"
#};
code
#{
const List<point> polygon($<List<point>>polygon);
writeEntry(os, "polygonCentre", face::centre(polygon));
polygonTriangulate triEngine;
triEngine.triangulate(polygon);
os << "polygonTris" << ' ' << triEngine.triPoints() << ";";
#};
};
- Generate a single block blockMeshDict for use with snappyHexMesh with no redundant information
min (-2.5 -1.2 -3.0); // Minimum coordinates of the block
max (2.5 1.2 3.0); // Maximum coordinates of the block
nCellsByL 33.3333; // Number of cells per unit length
// Calculate the number of cells in each block direction
nCells #calc "Vector<label>($nCellsByL*($<vector>max - $<vector>min) + vector::one/2)";
// Generate the vertices using a boundBox
vertices #codeStream
{
codeInclude
#{
#include "boundBox.H"
#};
code
#{
os << boundBox($<vector>min, $<vector>max).points();
#};
};
blocks
(
hex (0 1 2 3 4 5 6 7) $nCells simpleGrading (1 1 1)
);
defaultPatch
{
type patch;
}
boundary
();
Specific names have been given for expand functions. Unused functions
have been removed, and functions only used locally have been removed
from the namespace. Documentation has been corrected. Default and
alternative value handling has been removed from code template
expansion.
This allows primitive and other types either directly or indirectly
constructable from Istream to be constructed from a string using pTraits and
IStringStream, e.g.
const vector v(read<vector>("(1 2 3)"));
Variadic constructors have been added to dictionary to facilitate
convenient construction in code, including within a #codeStream entry.
The constructors take an even number of arguments, alternating between
the key and the corresponding value. The values may, themselves, be
dictionaries constructed in the same way. This means that the code
directly maps to the resulting nested dictionary structure.
For example, the following code stream entry:
#codeStream
{
code
#{
writeEntry
(
os,
"dict",
dictionary
(
"s", 1,
"wl", wordList({"apples", "oranges"}),
"subDict", dictionary
(
"v", vector(2, 3, 4),
"t", tensor(5, 6, 7, 8, 9, 10, 11, 12, 13),
"ll", labelList(10, -1)
)
)
);
#};
}
Expands to the following:
dict
{
s 1;
wl 2 ( apples oranges );
subDict
{
v ( 2 3 4 );
t ( 5 6 7 8 9 10 11 12 13 );
ll 10 { -1 };
}
}
setFormat no longer defaults to the value of graphFormat optionally set in
controlDict and must be set in the functionObject dictionary.
boundaryFoam, financialFoam and pdfPlot still require a graphFormat entry in
controlDict but this is now read directly rather than by Time.
the -solver option also disables the default loading of all libraries, instead
loading just the specified solver module library and dependencies.
It is generally more useful to load all the libraries when searching for model,
boundary condition etc. rather than having to list specific libraries to search
unless only the contents of the standard libraries loaded into a solver module
are to be searched, in which case the -solver option can be used.
With
executeControl runTimes;
executeTimes (0.1 0.2 0.3);
the functionObject will be executed at 0.1s, 0.2s and 0.3s only.
With
writeControl runTimes;
writeTimes (0.1 0.2 0.3);
the functionObject will write at 0.1s, 0.2s and 0.3s only.
The parcelsPerSecond control can now be specified as a time-varying
function. This provides additional control over the temporal
distribution of injected parcels, which may be advantageous if, for
example, the mass flow rate varies significantly. It also enables
variable flow rates of particulates in cases which have a fixed number
of particles per parcel.
for cases started or restarted from some arbitrary time without a corresponding
<time>/uniform/time dictionary to set the beginTime to the logical start of the
simulation. Setting beginTime to 0 for example ensures that write times,
functionObject evaluations and writes etc. occur at intervals starting from 0
rather than the arbitrary startTime.