Go to the documentation of this file.
35 #include "surfaceInterpolate.H"
47 effectivenessHeatExchangerSource,
56 void Foam::fv::effectivenessHeatExchangerSource::initialise()
63 <<
type() <<
" " << this->
name() <<
": "
78 label facei = fZone[i];
80 label facePatchId = -1;
90 const auto* cpp = isA<coupledPolyPatch>(pp);
94 faceId = (cpp->owner() ? pp.whichFace(facei) : -1);
96 else if (!isA<emptyPolyPatch>(pp))
98 faceId = pp.whichFace(facei);
109 if (fZone.flipMap()[i])
133 const word& modelType,
139 secondaryMassFlowRate_(0),
142 userPrimaryInletT_(
false),
143 targetQdotActive_(
false),
145 targetQdotCalcInterval_(5),
146 targetQdotRelax_(0.5),
151 faceZoneName_(
"unknown-faceZone"),
163 fieldNames_.resize(1,
thermo.he().name());
192 scalar sumMagPhi = 0;
194 scalar primaryInletTfMean = 0;
197 label facei = faceId_[i];
198 if (facePatchId_[i] != -1)
200 label patchi = facePatchId_[i];
201 scalar phii =
phi.boundaryField()[patchi][facei]*faceSign_[i];
205 scalar Cpfi = Cpf.boundaryField()[patchi][facei];
206 scalar Tfi = Tf.boundaryField()[patchi][facei];
207 scalar magPhii =
mag(phii);
209 sumMagPhi += magPhii;
210 CpfMean += Cpfi*magPhii;
211 primaryInletTfMean += Tfi*magPhii;
215 scalar phii =
phi[facei]*faceSign_[i];
216 scalar magPhii =
mag(phii);
219 sumMagPhi += magPhii;
220 CpfMean += Cpf[facei]*magPhii;
221 primaryInletTfMean += Tf[facei]*magPhii;
227 CpfMean /= sumMagPhi + ROOTVSMALL;
229 scalar primaryInletT = primaryInletT_;
230 if (!userPrimaryInletT_)
233 primaryInletT = primaryInletTfMean/(sumMagPhi + ROOTVSMALL);
237 eTable_()(
mag(sumPhi), secondaryMassFlowRate_)
238 *CpfMean*
mag(sumPhi);
240 const scalar Qt =
alpha*(secondaryInletT_ - primaryInletT);
245 && (mesh_.time().timeIndex() % targetQdotCalcInterval_ == 0)
248 scalar dT = (targetQdot_ - Qt)/(
alpha + ROOTVSMALL);
249 secondaryInletT_ += targetQdotRelax_*dT;
260 deltaTCells[i] =
max(Tref - TCells[i], 0.0);
268 deltaTCells[i] =
max(TCells[i] - Tref, 0.0);
275 scalar sumWeight = 0;
278 label celli = cells_[i];
279 sumWeight += V[celli]*
mag(
U[celli])*deltaTCells[i];
283 if (this->V() > VSMALL &&
mag(Qt) > VSMALL)
289 label celli = cells_[i];
291 Qt*V[celli]*
mag(
U[celli])*deltaTCells[i]
292 /(sumWeight + ROOTVSMALL);
297 <<
indent <<
"Net mass flux [Kg/s] : " << sumPhi <<
nl
298 <<
indent <<
"Total heat exchange [W] : " << Qt <<
nl
299 <<
indent <<
"Secondary inlet T [K] : " << secondaryInletT_ <<
nl
300 <<
indent <<
"Tref [K] : " << Tref <<
nl
301 <<
indent <<
"Effectiveness : "
302 << eTable_()(
mag(sumPhi), secondaryMassFlowRate_) <<
decrIndent
311 UName_ = coeffs_.getOrDefault<
word>(
"U",
"U");
312 TName_ = coeffs_.getOrDefault<
word>(
"T",
"T");
313 phiName_ = coeffs_.getOrDefault<
word>(
"phi",
"phi");
314 coeffs_.readEntry(
"faceZone", faceZoneName_);
316 coeffs_.readEntry(
"secondaryMassFlowRate", secondaryMassFlowRate_);
317 coeffs_.readEntry(
"secondaryInletT", secondaryInletT_);
319 if (coeffs_.readIfPresent(
"primaryInletT", primaryInletT_))
321 userPrimaryInletT_ =
true;
323 <<
"employing user-specified primary flow inlet temperature: "
324 << primaryInletT_ <<
endl;
329 <<
"employing flux-weighted primary flow inlet temperature"
333 if (coeffs_.readIfPresent(
"targetQdot", targetQdot_))
335 targetQdotActive_ =
true;
336 Info<<
indent <<
"employing target heat rejection of "
337 << targetQdot_ <<
nl;
339 coeffs_.readIfPresent
341 "targetQdotCalcInterval",
342 targetQdotCalcInterval_
345 Info<<
indent <<
"updating secondary inlet temperature every "
346 << targetQdotCalcInterval_ <<
" iterations" <<
nl;
348 coeffs_.readIfPresent(
"targetQdotRelax", targetQdotRelax_);
351 << targetQdotRelax_ <<
endl;
const word & name() const noexcept
Return const access to the source name.
A class for handling words, derived from Foam::string.
Intermediate abstract class for handling cell-set options for the derived fvOptions.
static constexpr const zero Zero
Global zero (0)
void resetApplied()
Resize/reset applied flag list for all fieldNames_ entries.
virtual bool read(const dictionary &dict)
Read dictionary.
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
bool read(const char *buf, int32_t &val)
Same as readInt32.
virtual void addSup(fvMatrix< scalar > &eqn, const label fieldi)
Add explicit/implicit contribution to momentum equation.
Basic thermodynamics type based on the use of fitting functions for cp, h, s obtained from the templa...
Abstract base-class for fluid and solid thermodynamic properties.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Ostream & incrIndent(Ostream &os)
Increment the indent level.
const fvMesh & mesh_
Reference to the mesh database.
#define forAll(list, i)
Loop across all elements in list.
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
labelList faceId_
Local list of face IDs.
messageStream Info
Information stream (stdout output on master, null elsewhere)
void setSize(const label n)
Alias for resize()
virtual bool read(const dictionary &dict)
Read source dictionary.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
labelList faceSign_
List of +1/-1 representing face flip map (1 use as is, -1 negate)
const faceZoneMesh & faceZones() const noexcept
Return face zone mesh.
label whichPatch(const label faceIndex) const
Return patch index for a given face label.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
word faceZoneName_
Name of the faceZone at the heat exchange inlet.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Macros for easy insertion into run-time selection tables.
const labelIOList & zoneID
Mesh data needed to do the Finite Volume discretisation.
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
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.
label findZoneID(const word &zoneName) const
Find zone index by name, return -1 if not found.
Ostream & indent(Ostream &os)
Indent stream.
wordList names() const
A list of the zone names.
errorManipArg< error, int > exit(error &err, const int errNo=1)
bool isInternalFace(const label faceIndex) const noexcept
Return true if given face label is internal to the mesh.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
unsigned int count(const UList< bool > &bools, const bool val=true)
Count number of 'true' entries.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
A special matrix type and solver, designed for finite volume solutions of scalar equations....
labelList facePatchId_
Local list of patch ID per face.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
defineTypeNameAndDebug(atmAmbientTurbSource, 0)
addToRunTimeSelectionTable(option, atmAmbientTurbSource, dictionary)
Type gMin(const FieldField< Field, Type > &f)
effectivenessHeatExchangerSource(const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from components.
Type gMax(const FieldField< Field, Type > &f)
word dictName() const
The local dictionary name (final part of scoped name)