39 namespace 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;
201 label nbad = 0, ngood = 0;
203 for (
const word&
key : derivedNames)
209 case derivedType::NONE:
212 case derivedType::UNKNOWN:
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;
322 mesh_.thisDb().checkOut(knownNames[category]);
331 removeDerivedFields();
340 removeDerivedFields();
defineTypeNameAndDebug(ObukhovLength, 0)
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...
void resize(const label len)
Adjust allocated size of list.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
static bool calc_pTotal(const fvMesh &mesh, const word &derivedName, const scalar rhoRef)
void removeDerivedFields()
Remove (checkOut) derived fields from the object registry.
derivedFields(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
constexpr char nl
The newline '\n' character (0x0a)
virtual bool read(const dictionary &dict)
Read the data.
Ostream & endl(Ostream &os)
Add newline and flush stream.
derivedType
Options for the derived/calculated field type.
bool store()
Register object with its registry and transfer ownership to the registry.
const Type * findObject(const word &name, const bool recursive=false) const
Return const pointer to the object of the given Type.
Ignore writing from objectRegistry::writeObject()
const Time & time() const
Return the top-level database.
GeometricField< vector, fvPatchField, volMesh > volVectorField
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Macros for easy insertion into run-time selection tables.
virtual void movePoints(const polyMesh &m)
Update for mesh point-motion.
#define forAll(list, i)
Loop across all elements in list.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
A List obtained as a section of another List.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
A class for handling words, derived from Foam::string.
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...
List< derivedType > derivedTypes_
List of derived field (types) to create.
virtual const word & type() const =0
Runtime type information.
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
scalar rhoRef_
Reference density (to convert from kinematic to static pressure)
const dimensionSet dimPressure
static word timeName(const scalar t, const int precision=precision_)
Return time name of given scalar time formatted with the given precision.
addToRunTimeSelectionTable(functionObject, ObukhovLength, dictionary)
const dimensionSet dimDensity
virtual void updateMesh(const mapPolyMesh &mpm)
Update for changes of mesh.
Info<< "Reading mechanical properties\"<< 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 WarningInFunction
Report a warning using Foam::Warning.
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
auto key(const Type &t) -> typename std::enable_if< std::is_enum< Type >::value, typename std::underlying_type< Type >::type >::type
Mesh data needed to do the Finite Volume discretisation.
const polyMesh & mesh() const
Return polyMesh.
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
messageStream Info
Information stream (stdout output on master, null elsewhere)
virtual bool read(const dictionary &dict)
Read optional controls.
static bool calc_rhoU(const fvMesh &mesh, const word &derivedName, const scalar rhoRef)
Mesh consisting of general polyhedral cells.
Defines the attributes of an object for which implicit objectRegistry management is supported...
virtual bool execute()
Calculate the derived fields.
Request registration (bool: true)
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
static const Enum< derivedType > knownNames
Names for derivedType.
EnumType lookup(const word &enumName, const EnumType deflt) const
The enumeration corresponding to the given name.
virtual bool write()
Write derived fields.
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.
const dimensionSet dimVelocity