29#include "surfaceInterpolate.H"
51void Foam::heatTransferCoeffModels::faceZoneReferenceTemperature::
57 const word faceZoneName(
dict.get<
word>(
"referenceFaceZone"));
59 faceZonei_ =
mesh.faceZones().findZoneID(faceZoneName);
64 <<
"referenceFaceZone: " << faceZoneName
65 <<
" does not exist in referenceRegion: " << refRegionName_
69 const faceZone& fZone =
mesh.faceZones()[faceZonei_];
71 label numFaces = fZone.size();
76 <<
"referenceFaceZone: " << faceZoneName
77 <<
" contains no faces."
81 faceId_.resize_nocopy(numFaces);
82 facePatchId_.resize_nocopy(numFaces);
90 const label meshFacei = fZone[i];
94 label facePatchId = -1;
97 if (!
mesh.isInternalFace(meshFacei))
99 facePatchId =
mesh.boundaryMesh().whichPatch(meshFacei);
100 const polyPatch&
pp =
mesh.boundaryMesh()[facePatchId];
109 if (cpp && !cpp->owner())
119 faceId_[numFaces] =
faceId;
120 facePatchId_[numFaces] = facePatchId;
128 faceId_.resize(numFaces);
129 facePatchId_.resize(numFaces);
133Foam::scalar Foam::heatTransferCoeffModels::faceZoneReferenceTemperature::
134faceZoneAverageTemperature()
137 mesh_.objectRegistry::db().lookupObject<fvMesh>(refRegionName_);
149 const label facei = faceId_[i];
150 if (facePatchId_[i] != -1)
152 const label patchi = facePatchId_[i];
153 const scalar sf = magSf.boundaryField()[patchi][facei];
155 Tmean += Tf.boundaryField()[patchi][facei]*sf;
160 const scalar sf = magSf[facei];
161 Tmean += Tf[facei]*sf;
165 reduce(Tmean, sumOp<scalar>());
166 reduce(sumMagSf, sumOp<scalar>());
174void Foam::heatTransferCoeffModels::faceZoneReferenceTemperature::htc
177 const FieldField<Field, scalar>& q
190 const scalar Tref = faceZoneAverageTemperature();
193 for (
const label patchi : patchIDs_)
195 htcBf[patchi] =
q[patchi]/(Tref - Tbf[patchi] + ROOTVSMALL);
212 refRegionName_(
polyMesh::defaultRegion),
232 dict.readIfPresent(
"referenceRegion", refRegionName_);
234 setFaceZoneFaces(
dict);
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
GeometricBoundaryField< scalar, fvPatchField, volMesh > Boundary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Mesh data needed to do the Finite Volume discretisation.
A base class for heat transfer coefficient models.
const fvMesh & mesh() const noexcept
Return const reference to the mesh.
const fvMesh & mesh_
Const reference to the mesh.
heatTransferCoeffModel(const dictionary &dict, const fvMesh &mesh, const word &TName)
Construct from components.
virtual bool read(const dictionary &dict)
Read the function-object dictionary.
tmp< FieldField< Field, scalar > > q() const
Return boundary fields of heat-flux field.
const word & TName() const noexcept
Return const reference to name of temperature field.
Heat transfer coefficient calculation that employs the area-average temperature of a specified face z...
virtual bool read(const dictionary &dict)
Read the function-object dictionary.
faceZoneReferenceTemperature(const dictionary &dict, const fvMesh &mesh, const word &TName)
Construct from components.
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...
Mesh consisting of general polyhedral cells.
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
static tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > interpolate(const GeometricField< Type, fvPatchField, volMesh > &tvf, const surfaceScalarField &faceFlux, Istream &schemeData)
Interpolate field onto faces using scheme given by Istream.
A namespace for various heat transfer coefficient model implementations.
bool returnReduceOr(const bool value, const int communicator=UPstream::worldComm)
Perform logical (or) MPI Allreduce on a copy. Uses UPstream::reduceOr.
bool read(const char *buf, int32_t &val)
Same as readInt32.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
const Type * isA(const U &obj)
Attempt dynamic_cast to Type.
void reduce(T &value, BinaryOp bop, const int tag=UPstream::msgType(), const int communicator=UPstream::worldComm)
Reduce inplace (cf. MPI Allreduce).
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
errorManipArg< error, int > exit(error &err, const int errNo=1)
#define forAll(list, i)
Loop across all elements in list.