53 { derivedType::NONE ,
"none" },
54 { derivedType::MASS_FLUX ,
"rhoU" },
55 { derivedType::TOTAL_PRESSURE ,
"pTotal" },
67 const word& derivedName,
78 const bool isNew = !result;
87 mesh.time().timeName(),
120 const word& derivedName,
132 const bool isNew = !result;
201 label nbad = 0, ngood = 0;
203 for (
const word& key : derivedNames)
214 derivedNames[nbad++] = key;
229 <<
"Ignoring unknown derived names: "
230 << SubList<word>(derivedNames, nbad) <<
nl;
250 Log <<
type() <<
" calculating:";
252 for (
const derivedType category : derivedTypes_)
258 case derivedType::MASS_FLUX:
260 isNew =
calc_rhoU(mesh_, knownNames[category], rhoRef_);
262 Log <<
" " << knownNames[category];
263 if (isNew)
Log <<
" (new)";
267 case derivedType::TOTAL_PRESSURE:
269 isNew =
calc_pTotal(mesh_, knownNames[category], rhoRef_);
271 Log <<
" " << knownNames[category];
272 if (isNew)
Log <<
" (new)";
289 for (
const derivedType category : derivedTypes_)
293 case derivedType::NONE:
294 case derivedType::UNKNOWN:
300 mesh_.cfindObject<
regIOobject>(knownNames[category]);
305 <<
" writing field " << ioptr->name() <<
endl;
340 removeDerivedFields();
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
EnumType lookup(const word &enumName, const EnumType deflt) const
The enumeration corresponding to the given name.
@ REGISTER
Request registration (bool: true).
@ NO_READ
Nothing to be read.
@ NO_WRITE
Ignore writing from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
void resize(const label len)
A non-owning sub-view of a List (allocated or unallocated storage).
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
static word timeName(const scalar t, const int precision=precision_)
Return a time name for the given scalar time value formatted with the given precision.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Abstract base-class for Time/database function objects.
virtual bool read(const dictionary &dict)
Read and set the function object if its data have changed.
virtual const word & type() const =0
Runtime type information.
Computes two predefined derived fields, i.e. rhoU, and pTotal, where the defined fields are hard-code...
scalar rhoRef_
Reference density (to convert from kinematic to static pressure).
derivedType
Options for the derived/calculated field type.
virtual void movePoints(const polyMesh &m)
Update for mesh point-motion.
virtual bool read(const dictionary &dict)
Read the function-object dictionary.
static const Enum< derivedType > knownNames
Names for derivedType.
derivedFields(const word &name, const Time &runTime, const dictionary &dict)
Construct from name, Time and dictionary.
virtual void updateMesh(const mapPolyMesh &mpm)
Update for changes of mesh.
void removeDerivedFields()
Remove (checkOut) derived fields from the object registry.
List< derivedType > derivedTypes_
List of derived field (types) to create.
virtual bool execute()
Execute the function-object operations.
virtual bool write()
Write the function-object results.
const fvMesh & mesh_
Reference to the fvMesh.
fvMeshFunctionObject(const fvMeshFunctionObject &)=delete
No copy construct.
Mesh data needed to do the Finite Volume discretisation.
const Time & time() const
Return the top-level database.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
const polyMesh & mesh() const noexcept
Return polyMesh.
const Type * findObject(const word &name, const bool recursive=false) const
Return const pointer to the object of the given Type.
const Type & lookupObject(const word &name, const bool recursive=false) const
Lookup and return const reference to the object of the given Type. Fatal if not found or the wrong ty...
Type * getObjectPtr(const word &name, const bool recursive=false) const
Return non-const pointer to the object of the given Type, using a const-cast to have it behave like a...
Mesh consisting of general polyhedral cells.
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
#define WarningInFunction
Report a warning using Foam::Warning.
Function objects are OpenFOAM utilities to ease workflow configurations and enhance workflows.
const dimensionSet dimPressure
static bool calc_rhoU(const fvMesh &mesh, const word &derivedName, const scalar rhoRef)
List< word > wordList
List of word.
GeometricField< vector, fvPatchField, volMesh > volVectorField
GeometricField< scalar, fvPatchField, volMesh > volScalarField
const dimensionSet dimVelocity
messageStream Info
Information stream (stdout output on master, null elsewhere).
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Ostream & endl(Ostream &os)
Add newline and flush stream.
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
const dimensionSet dimDensity
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
constexpr char nl
The newline '\n' character (0x0a).
static bool calc_pTotal(const fvMesh &mesh, const word &derivedName, const scalar rhoRef)
Info<< "Reading mechanical properties\n"<< endl;IOdictionary mechanicalProperties(IOobject("mechanicalProperties", runTime.constant(), mesh, IOobject::MUST_READ_IF_MODIFIED, IOobject::NO_WRITE));const dictionary &rhoDict(mechanicalProperties.subDict("rho"));word rhoType(rhoDict.get< word >("type"));autoPtr< volScalarField > rhoPtr
#define forAll(list, i)
Loop across all elements in list.