41 namespace functionObjects
51 void Foam::functionObjects::surfaceCourantNumber::writeFileHeader(Ostream&
os)
76 resultName_(
"surfaceCo"),
93 dict.readIfPresent(
"result", resultName_);
94 dict.readIfPresent(
"phis", phisName_);
95 dict.readIfPresent(
"rho", rhoName_);
103 <<
"No finite-area object registry is available." 109 if (!
dict.readIfPresent(
"area", areaName))
111 wordList available = faRegistryPtr->sortedNames<faMesh>();
112 if (!available.empty())
114 areaName = available.
front();
118 if (areaName.empty())
121 <<
"No name for finite-area mesh is available." 125 faMeshPtr_ = std::shared_ptr<const faMesh>
127 faRegistryPtr->cfindObject<faMesh>(areaName),
140 <<
"No edge flux field is available. " 141 <<
"Name of provided edge flux field (phi): " << phisName_
149 tmp<areaScalarField::Internal> tCo =
150 (0.5*faMeshPtr_->time().deltaT())
161 auto* resultPtr = faMeshPtr_->getObjectPtr<
areaScalarField>(resultName_);
170 faMeshPtr_->time().timeName(),
180 auto& result = *resultPtr;
182 result.internalFieldRef() = tCo;
183 result.correctBoundaryConditions();
187 const scalar mean =
gAverage(result);
189 Log <<
"Surface Courant number: " 191 <<
" max: " <<
limits.max()
196 if (!writtenHeader_) writeFileHeader(file());
198 writeCurrentTime(file());
212 const auto* result = faMeshPtr_->cfindObject<
areaScalarField>(resultName_);
219 Log <<
type() <<
" " <<
name() <<
" write: " << result->name() <<
endl;
Finite area mesh (used for 2-D non-Euclidian finite area method) defined using a patch of faces on a ...
defineTypeNameAndDebug(ObukhovLength, 0)
MinMax< scalar > scalarMinMax
A scalar min/max range.
virtual void writeHeader(Ostream &os, const string &str) const
Write a commented header to stream.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
tmp< GeometricField< Type, faPatchField, areaMesh > > edgeSum(const GeometricField< Type, faePatchField, edgeMesh > &ssf)
A list of keyword definitions, which are a keyword followed by a number of values (eg...
T & front()
Access first element of the list, position [0].
Ostream & endl(Ostream &os)
Add newline and flush stream.
bool store()
Register object with its registry and transfer ownership to the registry.
surfaceCourantNumber(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
bool writtenHeader_
Flag to identify whether the header has been written.
const dimensionSet dimless
Dimensionless.
DimensionedField< scalar, areaMesh > Internal
The internal field type from which this GeometricField is derived.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
static const word & zeroGradientType() noexcept
The type name for zeroGradient patch fields.
Macros for easy insertion into run-time selection tables.
bool read(const char *buf, int32_t &val)
Same as readInt32.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
virtual void writeCommented(Ostream &os, const string &str) const
Write a commented string to stream.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
A class for handling words, derived from Foam::string.
MinMax< Type > gMinMax(const FieldField< Field, Type > &f)
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
GeometricField< scalar, faePatchField, edgeMesh > edgeScalarField
errorManip< error > abort(error &err)
edgeScalarField phis(IOobject("phis", runTime.timeName(), aMesh.thisDb(), IOobject::NO_READ, IOobject::NO_WRITE), linearEdgeInterpolate(Us) &aMesh.Le())
Type gAverage(const FieldField< Field, Type > &f, const label comm)
The global arithmetic average of a FieldField.
OBJstream os(runTime.globalPath()/outputName)
addToRunTimeSelectionTable(functionObject, ObukhovLength, dictionary)
virtual bool read(const dictionary &dict)
Read.
const dimensionSet dimDensity
virtual bool write()
Write the result field.
List< word > wordList
List of word.
virtual bool read(const dictionary &)
Read the surfaceCourantNumber data.
#define WarningInFunction
Report a warning using Foam::Warning.
virtual bool execute()
Calculate the Courant number field and return true if successful.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
virtual bool read(const dictionary &dict)
Read optional controls.
static const objectRegistry * registry(const polyMesh &pMesh)
The parent registry containing all finite-area meshes on the polyMesh.
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
Base class for writing single files from the function objects.
Edge integrate edgeField creating a areaField. Edge sum a edgeField creating a areaField.
GeometricField< scalar, faPatchField, areaMesh > areaScalarField
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
static constexpr const zero Zero
Global zero (0)
virtual void writeTabbed(Ostream &os, const string &str) const
Write a tabbed string to stream.