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 if (isA<coupledPolyPatch>(pp))
92 if (refCast<const coupledPolyPatch>(pp).owner())
94 faceId = pp.whichFace(facei);
101 else if (!isA<emptyPolyPatch>(pp))
103 faceId = facei - pp.start();
114 if (fZone.flipMap()[i])
135 Foam::fv::effectivenessHeatExchangerSource::effectivenessHeatExchangerSource
138 const word& modelType,
144 secondaryMassFlowRate_(0),
147 userPrimaryInletT_(
false),
148 targetQdotActive_(
false),
150 targetQdotCalcInterval_(5),
151 targetQdotRelax_(0.5),
156 faceZoneName_(
"unknown-faceZone"),
169 fieldNames_.setSize(1,
thermo.he().name());
171 applied_.setSize(1,
false);
200 scalar sumMagPhi = 0;
202 scalar primaryInletTfMean = 0;
205 label facei = faceId_[i];
206 if (facePatchId_[i] != -1)
208 label patchi = facePatchId_[i];
209 scalar phii =
phi.boundaryField()[patchi][facei]*faceSign_[i];
213 scalar Cpfi = Cpf.boundaryField()[patchi][facei];
214 scalar Tfi = Tf.boundaryField()[patchi][facei];
215 scalar magPhii =
mag(phii);
217 sumMagPhi += magPhii;
218 CpfMean += Cpfi*magPhii;
219 primaryInletTfMean += Tfi*magPhii;
223 scalar phii =
phi[facei]*faceSign_[i];
224 scalar magPhii =
mag(phii);
227 sumMagPhi += magPhii;
228 CpfMean += Cpf[facei]*magPhii;
229 primaryInletTfMean += Tf[facei]*magPhii;
235 CpfMean /= sumMagPhi + ROOTVSMALL;
237 scalar primaryInletT = primaryInletT_;
238 if (!userPrimaryInletT_)
241 primaryInletT = primaryInletTfMean/(sumMagPhi + ROOTVSMALL);
245 eTable_()(
mag(sumPhi), secondaryMassFlowRate_)
246 *CpfMean*
mag(sumPhi);
248 const scalar Qt =
alpha*(secondaryInletT_ - primaryInletT);
253 && (mesh_.time().timeIndex() % targetQdotCalcInterval_ == 0)
256 scalar dT = (targetQdot_ - Qt)/(
alpha + ROOTVSMALL);
257 secondaryInletT_ += targetQdotRelax_*dT;
268 deltaTCells[i] =
max(Tref - TCells[i], 0.0);
276 deltaTCells[i] =
max(TCells[i] - Tref, 0.0);
283 scalar sumWeight = 0;
286 label celli = cells_[i];
287 sumWeight += V[celli]*
mag(
U[celli])*deltaTCells[i];
291 if (this->V() > VSMALL &&
mag(Qt) > VSMALL)
297 label celli = cells_[i];
299 Qt*V[celli]*
mag(
U[celli])*deltaTCells[i]
300 /(sumWeight + ROOTVSMALL);
305 <<
indent <<
"Net mass flux [Kg/s] : " << sumPhi <<
nl
306 <<
indent <<
"Total heat exchange [W] : " << Qt <<
nl
307 <<
indent <<
"Secondary inlet T [K] : " << secondaryInletT_ <<
nl
308 <<
indent <<
"Tref [K] : " << Tref <<
nl
309 <<
indent <<
"Effectiveness : "
310 << eTable_()(
mag(sumPhi), secondaryMassFlowRate_) <<
decrIndent
319 UName_ = coeffs_.getOrDefault<
word>(
"U",
"U");
320 TName_ = coeffs_.getOrDefault<
word>(
"T",
"T");
321 phiName_ = coeffs_.getOrDefault<
word>(
"phi",
"phi");
322 coeffs_.readEntry(
"faceZone", faceZoneName_);
324 coeffs_.readEntry(
"secondaryMassFlowRate", secondaryMassFlowRate_);
325 coeffs_.readEntry(
"secondaryInletT", secondaryInletT_);
327 if (coeffs_.readIfPresent(
"primaryInletT", primaryInletT_))
329 userPrimaryInletT_ =
true;
331 <<
"employing user-specified primary flow inlet temperature: "
332 << primaryInletT_ <<
endl;
337 <<
"employing flux-weighted primary flow inlet temperature"
341 if (coeffs_.readIfPresent(
"targetQdot", targetQdot_))
343 targetQdotActive_ =
true;
344 Info<<
indent <<
"employing target heat rejection of "
345 << targetQdot_ <<
nl;
347 coeffs_.readIfPresent
349 "targetQdotCalcInterval",
350 targetQdotCalcInterval_
353 Info<<
indent <<
"updating secondary inlet temperature every "
354 << targetQdotCalcInterval_ <<
" iterations" <<
nl;
356 coeffs_.readIfPresent(
"targetQdotRelax", targetQdotRelax_);
359 << targetQdotRelax_ <<
endl;
A class for handling words, derived from Foam::string.
Cell-set options abstract base class. Provides a base set of controls, e.g.:
static constexpr const zero Zero
Global zero (0)
const word & name() const
Return const access to the source name.
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)
Scalar.
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.
const faceZoneMesh & faceZones() const
Return face zone mesh.
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 (uses stdout - output is on the master only)
word name(const complex &c)
Return string representation of complex.
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)
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 dictName() const
The local dictionary name (final part of scoped name)
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 given a 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)
#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.
bool isInternalFace(const label faceIndex) const
Return true if given face label is internal to the mesh.
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.
defineTypeNameAndDebug(atmAmbientTurbSource, 0)
addToRunTimeSelectionTable(option, atmAmbientTurbSource, dictionary)
Type gMin(const FieldField< Field, Type > &f)
void setSize(const label newSize)
Alias for resize(const label)
Type gMax(const FieldField< Field, Type > &f)