- when constructing dimensioned fields that are to be zero-initialized,
it is preferrable to use a form such as
dimensionedScalar(dims, Zero)
dimensionedVector(dims, Zero)
rather than
dimensionedScalar("0", dims, 0)
dimensionedVector("zero", dims, vector::zero)
This reduces clutter and also avoids any suggestion that the name of
the dimensioned quantity has any influence on the field's name.
An even shorter version is possible. Eg,
dimensionedScalar(dims)
but reduces the clarity of meaning.
- NB: UniformDimensionedField is an exception to these style changes
since it does use the name of the dimensioned type (instead of the
regIOobject).
65 lines
2.0 KiB
C++
65 lines
2.0 KiB
C++
/*--------------------------------*- C++ -*----------------------------------*\
|
|
| ========= | |
|
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
|
| \\ / O peration | Version: plus |
|
|
| \\ / A nd | Web: www.OpenFOAM.com |
|
|
| \\/ M anipulation | |
|
|
\*---------------------------------------------------------------------------*/
|
|
FoamFile
|
|
{
|
|
version 2.0;
|
|
format ascii;
|
|
class dictionary;
|
|
object postProcessingDict;
|
|
}
|
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
|
|
|
functions
|
|
{
|
|
processorField
|
|
{
|
|
// Type of functionObject
|
|
type processorField;
|
|
|
|
// Where to load it from (if not already in solver)
|
|
libs ("libfieldFunctionObjects.so");
|
|
|
|
// Function object enabled flag
|
|
enabled true;
|
|
|
|
// When to output the average fields
|
|
writeControl writeTime;
|
|
}
|
|
cellID
|
|
{
|
|
// Load the library containing the 'coded' functionObject
|
|
functionObjectLibs ("libutilityFunctionObjects.so");
|
|
type coded;
|
|
// Name of on-the-fly generated functionObject
|
|
redirectType cellID;
|
|
codeExecute
|
|
#{
|
|
volScalarField cellID
|
|
(
|
|
IOobject
|
|
(
|
|
"cellID",
|
|
mesh().time().timeName(),
|
|
mesh(),
|
|
IOobject::NO_READ
|
|
),
|
|
mesh(),
|
|
dimensionedScalar(dimless, Zero)
|
|
);
|
|
forAll(cellID, celli)
|
|
{
|
|
cellID[celli] = celli;
|
|
}
|
|
cellID.correctBoundaryConditions();
|
|
cellID.write();
|
|
#};
|
|
}
|
|
}
|
|
|
|
// ************************************************************************* //
|