64 for (
const word& fieldName :
fieldSet_.selectionNames())
84 if (!writeResidualFields_)
89 const word residualName
104 mesh_.time().timeName(),
132 residualFieldNames_(),
133 writeResidualFields_(false),
148 fieldSet_.read(
dict);
150 writeResidualFields_ =
dict.getOrDefault(
"writeResidualFields",
false);
152 residualFieldNames_.clear();
167 writeFileHeader(file());
169 if (writeResidualFields_)
171 for (
const word& fieldName : fieldSet_.selectionNames())
173 initialiseResidualField<scalar>(fieldName);
174 initialiseResidualField<vector>(fieldName);
175 initialiseResidualField<sphericalTensor>(fieldName);
176 initialiseResidualField<symmTensor>(fieldName);
177 initialiseResidualField<tensor>(fieldName);
184 writeCurrentTime(file());
186 for (
const word& fieldName : fieldSet_.selectionNames())
188 updateSolverInfo<scalar>(fieldName);
189 updateSolverInfo<vector>(fieldName);
190 updateSolverInfo<sphericalTensor>(fieldName);
191 updateSolverInfo<symmTensor>(fieldName);
192 updateSolverInfo<tensor>(fieldName);
203 for (
const word& residualName : residualFieldNames_)
205 const auto* residualPtr =
215 mesh_.time().timeName(),
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
Internal::FieldType & primitiveFieldRef(const bool updateAccessTime=true)
Return a reference to the internal field values.
void correctBoundaryConditions()
Correct boundary field.
A primitive field of type <T> with automated input and output.
@ NO_REGISTER
Do not request registration (bool: false).
@ 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,...
static word scopedName(const std::string &scope, const word &name)
Create scope:name or scope_name string.
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,...
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.
const fvMesh & mesh_
Reference to the fvMesh.
fvMeshFunctionObject(const fvMeshFunctionObject &)=delete
No copy construct.
const objectRegistry & obr_
Reference to the region objectRegistry.
virtual bool updateSelection()
Update the selection using current contents of obr_.
Writes solver information for a list of user-specified fields.
bool initialised_
Initialisation flag.
void updateSolverInfo(const word &fieldName)
Calculate the solver information.
wordHashSet residualFieldNames_
Names of (result) residual fields.
void createResidualField(const word &fieldName)
Create and store a residual field on the mesh database.
void initialiseResidualField(const word &fieldName)
Initialise a residual field.
bool writeResidualFields_
Flag to write the initial-residual as a vol field.
void writeFileHeader(Ostream &os)
Output file header information.
solverInfo(const solverInfo &)=delete
No copy construct.
virtual bool execute()
Execute the function-object operations.
virtual bool write()
Write the function-object results (no-op).
solverFieldSelection fieldSet_
Names of operand fields.
virtual bool read(const dictionary &)
Read the function-object dictionary.
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 void writeBreak(Ostream &os) const
Write a break marker to the stream.
bool writtenHeader_
Flag to identify whether the header has been written.
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.
static const word & zeroGradientType() noexcept
The type name for zeroGradient patch fields.
virtual bool write(const bool writeOnProc=true) const
Write using setting from DB.
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
OBJstream os(runTime.globalPath()/outputName)
Function objects are OpenFOAM utilities to ease workflow configurations and enhance workflows.
const dimensionSet dimless
Dimensionless.
bool read(const char *buf, int32_t &val)
Same as readInt32.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
const word GlobalIOList< Tuple2< scalar, vector > >::typeName("scalarVectorTable")
Ostream & endl(Ostream &os)
Add newline and flush stream.
static constexpr const zero Zero
Global zero (0).
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.
static bool initialised_(false)