72 cumulative_(getProperty<scalar>(
"cumulative"))
87 dict.readIfPresent(
"phi", phiName_);
109 <<
"Unable to find flux field " << phiName_
116 const scalar deltaT = mesh_.time().deltaTValue();
119 const scalar global = deltaT*
error.weightedAverage(mesh_.V()).value();
120 cumulative_ += global;
124 writeCurrentTime(
os);
128 << cumulative_ <<
endl;
132 <<
" global = " << global <<
nl
133 <<
" cumulative = " << cumulative_ <<
nl
136 setResult(
"local",
local);
137 setResult(
"global", global);
138 setResult(
"cumulative", cumulative_);
140 setProperty<scalar>(
"cumulative", cumulative_);
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Class to handle errors and exceptions in a simple, consistent stream-based manner.
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.
Computes local, global and cumulative continuity errors for a flux field.
virtual bool read(const dictionary &dict)
Read the function-object dictionary.
continuityError(const word &name, const Time &runTime, const dictionary &dict)
Construct from name, Time and dictionary.
word phiName_
Name of flux field.
scalar cumulative_
Cumulative error.
virtual void writeFileHeader(Ostream &os)
Output file header information.
virtual bool execute()
Execute the function-object operations.
virtual bool write()
Write the function-object results.
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
const fvMesh & mesh_
Reference to the fvMesh.
fvMeshFunctionObject(const fvMeshFunctionObject &)=delete
No copy construct.
void setResult(const word &entryName, const Type &value)
Add result.
void setProperty(const word &entryName, const Type &value)
Add generic property.
Type getProperty(const word &entryName, const Type &defaultValue=Type(Zero)) const
Retrieve generic property.
Base class for writing single files from the function objects.
writeFile(const objectRegistry &obr, const fileName &prefix, const word &name="undefined", const bool writeToFile=true, const string &ext=".dat")
Construct from objectRegistry, prefix, fileName.
virtual void writeHeader(Ostream &os, const string &str) const
Write a commented header to stream.
virtual bool read(const dictionary &dict)
Read.
virtual OFstream & file()
Return access to the file (if only 1).
virtual void writeCommented(Ostream &os, const string &str) const
Write a commented string to stream.
virtual void writeCurrentTime(Ostream &os) const
Write the current time to stream.
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
OBJstream os(runTime.globalPath()/outputName)
Calculate the divergence of the given field.
#define WarningInFunction
Report a warning using Foam::Warning.
Function objects are OpenFOAM utilities to ease workflow configurations and enhance workflows.
tmp< GeometricField< Type, fvPatchField, volMesh > > div(const GeometricField< Type, fvsPatchField, surfaceMesh > &ssf)
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Type weightedAverage(const UList< scalar > &weights, const UList< Type > &fld)
The local weighted average of a field, using the mag() of the weights.
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
const word GlobalIOList< Tuple2< scalar, vector > >::typeName("scalarVectorTable")
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
constexpr char nl
The newline '\n' character (0x0a).
constexpr char tab
The tab '\t' character(0x09).