39namespace functionObjects
53 { derivedType::NONE ,
"none" },
54 { derivedType::MASS_FLUX ,
"rhoU" },
55 { derivedType::TOTAL_PRESSURE ,
"pTotal" },
67 const word& derivedName,
78 const bool isNew = !result;
120 const word& derivedName,
132 const bool isNew = !result;
195 rhoRef_ =
dict.getOrDefault<scalar>(
"rhoRef", 1);
199 derivedTypes_.resize(derivedNames.size());
201 label nbad = 0, ngood = 0;
203 for (
const word& key : derivedNames)
205 derivedTypes_[ngood] = knownNames.lookup(key, derivedType::UNKNOWN);
207 switch (derivedTypes_[ngood])
209 case derivedType::NONE:
212 case derivedType::UNKNOWN:
214 derivedNames[nbad++] = key;
229 <<
"Ignoring unknown derived names: "
233 derivedTypes_.resize(ngood);
238 derivedNames[i] = knownNames[derivedTypes_[i]];
250 Log <<
type() <<
" calculating:";
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)";
293 case derivedType::NONE:
294 case derivedType::UNKNOWN:
300 mesh_.cfindObject<
regIOobject>(knownNames[category]);
305 <<
" writing field " << ioptr->name() <<
endl;
322 mesh_.thisDb().checkOut(knownNames[category]);
329 if (&mpm.
mesh() == &mesh_)
331 removeDerivedFields();
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...
Defines the attributes of an object for which implicit objectRegistry management is supported,...
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
virtual bool read()
Re-read model coefficients if they have changed.
A List obtained as a section of another List.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
static word timeName(const scalar t, const int precision=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.
Computes two predefined derived fields, i.e. rhoU, and pTotal, where the defined fields are hard-code...
derivedType
Options for the derived/calculated field type.
virtual bool read(const dictionary &dict)
Read the data.
static const Enum< derivedType > knownNames
Names for derivedType.
void removeDerivedFields()
Remove (checkOut) derived fields from the object registry.
virtual bool execute()
Calculate the derived fields.
virtual bool write()
Write derived fields.
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
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
Return polyMesh.
void movePoints()
Update for new mesh geometry.
void updateMesh()
Update for new mesh topology.
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
Type * getObjectPtr(const word &name, const bool recursive=false) const
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.
const dimensionSet dimPressure
static bool calc_rhoU(const fvMesh &mesh, const word &derivedName, const scalar rhoRef)
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 INVALID.
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.