32 #include "surfaceInterpolate.H" 43 namespace functionObjects
78 for (
const label patchi : patchIDs_)
80 wallHeatFluxBf[patchi] = alphaBf[patchi]*heBf[patchi].snGrad();
84 const auto* qrPtr = cfindObject<volScalarField>(qrName_);
90 for (
const label patchi : patchIDs_)
92 wallHeatFluxBf[patchi] -= radHeatFluxBf[patchi];
108 writeFile(obr_,
name, typeName,
dict),
146 dict.readIfPresent(
"qr", qrName_);
159 if (patchSet.
empty())
161 patchIDs_ = allWalls.sortedToc();
163 Info<<
" processing all (" << patchIDs_.size()
164 <<
") wall patches" <<
nl <<
endl;
168 allWalls &= patchSet;
169 patchSet -= allWalls;
172 if (!patchSet.
empty())
175 <<
"Requested wall heat-flux on (" 176 << patchSet.
size() <<
") non-wall patches:" <<
nl;
178 for (
const label patchi : patchSet.
sortedToc())
185 Info<<
" processing (" << patchIDs_.size()
186 <<
") wall patches:" <<
nl;
188 for (
const label patchi : patchIDs_)
201 auto& wallHeatFlux = lookupObjectRef<volScalarField>(scopedName(typeName));
205 foundObject<compressible::turbulenceModel>
212 lookupObject<compressible::turbulenceModel>
220 turbModel.transport().he(),
226 const fluidThermo&
thermo =
238 const solidThermo&
thermo =
241 calcHeatFlux(
thermo.alpha(),
thermo.he(), wallHeatFlux);
245 foundObject<multiphaseInterSystem>
249 const auto&
thermo = lookupObject<multiphaseInterSystem>
254 calcHeatFlux(
thermo.kappaEff()(),
thermo.T(), wallHeatFlux);
259 <<
"Unable to find compressible turbulence model in the " 268 for (
const label patchi : patchIDs_)
274 const MinMax<scalar> limits =
gMinMax(hfp);
275 const scalar integralHfp =
gSum(magSf[patchi]*hfp);
279 writeCurrentTime(file());
289 Log <<
" min/max/integ(" <<
pp.name() <<
") = " 290 << limits.min() <<
", " << limits.max()
291 <<
", " << integralHfp <<
endl;
293 this->setResult(
"min(" +
pp.name() +
")", limits.min());
294 this->setResult(
"max(" +
pp.name() +
")", limits.max());
295 this->setResult(
"int(" +
pp.name() +
")", integralHfp);
304 const auto& wallHeatFlux =
305 lookupObject<volScalarField>(scopedName(typeName));
308 <<
" writing field " << wallHeatFlux.
name() <<
endl;
310 wallHeatFlux.
write();
word dictName() const
The local dictionary name (final part of scoped name)
const polyBoundaryMesh & pbm
virtual OFstream & file()
Return access to the file (if only 1)
defineTypeNameAndDebug(ObukhovLength, 0)
wallHeatFlux(const word &name, const Time &runTime, const dictionary &)
Construct from Time and dictionary.
virtual bool execute()
Calculate the wall heat-flux.
virtual void writeHeader(Ostream &os, const string &str) const
Write a commented header to stream.
errorManipArg< error, int > exit(error &err, const int errNo=1)
static const word phasePropertiesName
Default name of the phase properties dictionary.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const word & name() const noexcept
Return the object name.
virtual void writeFileHeader(Ostream &os) const
File header information.
virtual bool write()
Write the wall heat-flux.
constexpr char nl
The newline '\n' character (0x0a)
Ostream & endl(Ostream &os)
Add newline and flush stream.
bool store()
Register object with its registry and transfer ownership to the registry.
Calculate the snGrad of the given volField.
GeometricBoundaryField< scalar, fvsPatchField, surfaceMesh > Boundary
Type of boundary fields.
Ignore writing from objectRegistry::writeObject()
Templated wrapper class to provide compressible turbulence models thermal diffusivity based thermal t...
const Time & time() const
Return the top-level database.
Abstract base-class for Time/database function objects.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Macros for easy insertion into run-time selection tables.
virtual const objectRegistry & thisDb() const
Return the object registry - resolve conflict polyMesh/lduMesh.
virtual tmp< volScalarField > alphaEff() const
Return the effective turbulent thermal diffusivity for enthalpy.
psiReactionThermo & thermo
label size() const noexcept
The number of elements in table.
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.
Type gSum(const FieldField< Field, Type > &f)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
static const word propertiesName
Default name of the turbulence properties dictionary.
A class for handling words, derived from Foam::string.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
wordList patchNames(nPatches)
virtual bool write(const bool writeOnProc=true) const
Write using setting from DB.
A List of wordRe with additional matching capabilities.
MinMax< Type > gMinMax(const FieldField< Field, Type > &f)
A polyBoundaryMesh is a polyPatch list with additional search methods and registered IO...
An Ostream is an abstract base class for all output systems (streams, files, token lists...
bool empty() const noexcept
True if the hash table is empty.
static word timeName(const scalar t, const int precision=precision_)
Return a time name for the given scalar time value formatted with the given precision.
OBJstream os(runTime.globalPath()/outputName)
addToRunTimeSelectionTable(functionObject, ObukhovLength, dictionary)
virtual bool read(const dictionary &dict)
Read.
void calcHeatFlux(const volScalarField &alpha, const volScalarField &he, volScalarField &wallHeatFlux)
Calculate the heat-flux.
dimensionedScalar pow3(const dimensionedScalar &ds)
#define WarningInFunction
Report a warning using Foam::Warning.
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
List< Key > sortedToc() const
The table of contents (the keys) in sorted order.
static bool master(const label communicator=worldComm)
True if process corresponds to the master rank in the communicator.
const polyBoundaryMesh & patches
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
messageStream Info
Information stream (stdout output on master, null elsewhere)
virtual bool read(const dictionary &dict)
Read optional controls.
Computes the wall-heat flux at selected wall patches.
virtual bool read(const dictionary &dict)
Read the wallHeatFlux data.
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
Defines the attributes of an object for which implicit objectRegistry management is supported...
Request registration (bool: true)
word scopedName(const word &name) const
Return a scoped (prefixed) name.
const fvMesh & mesh_
Reference to the fvMesh.
const Boundary & boundaryField() const noexcept
Return const-reference to the boundary field.
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
PtrList< fvPatch > fvPatchList
Store lists of fvPatch as a PtrList.
static constexpr const zero Zero
Global zero (0)
virtual void writeTabbed(Ostream &os, const string &str) const
Write a tabbed string to stream.