32 #include "surfaceInterpolate.H" 44 effectivenessHeatExchangerSource,
53 void Foam::fv::effectivenessHeatExchangerSource::initialise()
55 const faceZone& fZone = mesh_.faceZones()[zoneID_];
57 faceId_.setSize(fZone.size());
58 facePatchId_.setSize(fZone.size());
59 faceSign_.setSize(fZone.size());
64 label facei = fZone[i];
66 label facePatchId = -1;
67 if (mesh_.isInternalFace(facei))
74 facePatchId = mesh_.boundaryMesh().whichPatch(facei);
75 const polyPatch& pp = mesh_.boundaryMesh()[facePatchId];
76 if (isA<coupledPolyPatch>(pp))
78 if (refCast<const coupledPolyPatch>(pp).owner())
80 faceId = pp.whichFace(facei);
87 else if (!isA<emptyPolyPatch>(pp))
89 faceId = facei - pp.start();
100 if (fZone.flipMap()[i])
102 faceSign_[count] = -1;
106 faceSign_[count] = 1;
109 facePatchId_[count] = facePatchId;
113 faceId_.setSize(count);
114 facePatchId_.setSize(count);
115 faceSign_.setSize(count);
117 calculateTotalArea(faceZoneArea_);
121 void Foam::fv::effectivenessHeatExchangerSource::calculateTotalArea
129 label facei = faceId_[i];
130 if (facePatchId_[i] != -1)
132 label patchi = facePatchId_[i];
133 area += mesh_.magSf().boundaryField()[
patchi][facei];
137 area += mesh_.magSf()[facei];
140 reduce(area, sumOp<scalar>());
149 const word& modelType,
155 secondaryMassFlowRate_(
readScalar(coeffs_.lookup(
"secondaryMassFlowRate"))),
156 secondaryInletT_(
readScalar(coeffs_.lookup(
"secondaryInletT"))),
157 primaryInletT_(
readScalar(coeffs_.lookup(
"primaryInletT"))),
159 UName_(coeffs_.lookupOrDefault<
word>(
"U",
"U")),
160 TName_(coeffs_.lookupOrDefault<
word>(
"T",
"T")),
161 phiName_(coeffs_.lookupOrDefault<
word>(
"phi",
"phi")),
162 faceZoneName_(coeffs_.lookup(
"faceZone")),
163 zoneID_(mesh_.faceZones().findZoneID(faceZoneName_)),
172 <<
type() <<
" " << this->
name() <<
": " 173 <<
" Unknown face zone name: " << faceZoneName_
174 <<
". Valid face zones are: " << mesh_.faceZones().names()
184 fieldNames_.setSize(1, thermo.
he().
name());
186 applied_.setSize(1,
false);
215 label facei = faceId_[i];
216 if (facePatchId_[i] != -1)
218 label patchi = facePatchId_[i];
222 Cpf.boundaryField()[
patchi][facei]
223 *mesh_.magSf().boundaryField()[
patchi][facei];
227 totalphi += phi[facei]*faceSign_[i];
228 CpfMean += Cpf[facei]*mesh_.magSf()[facei];
235 eTable_()(
mag(totalphi), secondaryMassFlowRate_)
236 *(secondaryInletT_ - primaryInletT_)
237 *(CpfMean/faceZoneArea_)*
mag(totalphi);
258 deltaTCells[i] =
max(Tref - TCells[i], 0.0);
262 deltaTCells[i] =
max(TCells[i] - Tref, 0.0);
268 scalar sumWeight = 0;
271 sumWeight += V[cells_[i]]*
mag(U[cells_[i]])*deltaTCells[i];
275 if (this->V() > vSmall &&
mag(Qt) > vSmall)
281 heSource[cells_[i]] -=
282 Qt*V[cells_[i]]*
mag(U[cells_[i]])*deltaTCells[i]/sumWeight;
288 Info<<
indent <<
"Net mass flux [Kg/s] = " << totalphi <<
nl;
289 Info<<
indent <<
"Total energy exchange [W] = " << Qt <<
nl;
292 << eTable_()(
mag(totalphi), secondaryMassFlowRate_) <<
endl;
301 coeffs_.lookup(
"secondaryMassFlowRate") >> secondaryMassFlowRate_;
302 coeffs_.lookup(
"secondaryInletT") >> secondaryInletT_;
303 coeffs_.lookup(
"primaryInletT") >> primaryInletT_;
defineTypeNameAndDebug(option, 0)
effectivenessHeatExchangerSource(const word &name, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from components.
#define forAll(list, i)
Loop across all elements in list.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
const word & name() const
Return name.
Abstract base-class for fluid and solid thermodynamic properties.
Ostream & indent(Ostream &os)
Indent stream.
errorManipArg< error, int > exit(error &err, const int errNo=1)
A list of keyword definitions, which are a keyword followed by any number of values (e...
dimensioned< Type > max(const dimensioned< Type > &, const dimensioned< Type > &)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const Boundary & boundaryField() const
Return const-reference to the boundary field.
virtual bool read(const dictionary &dict)
Read dictionary.
Ostream & endl(Ostream &os)
Add newline and flush stream.
static bool master(const label communicator=0)
Am I the master process.
addToRunTimeSelectionTable(option, fixedTemperatureConstraint, dictionary)
virtual bool read(const dictionary &dict)
Read source dictionary.
rhoReactionThermo & thermo
Macros for easy insertion into run-time selection tables.
virtual volScalarField & he()=0
Enthalpy/Internal energy [J/kg].
const word dictName() const
Return the local dictionary name (final part of scoped name)
A class for handling words, derived from string.
A special matrix type and solver, designed for finite volume solutions of scalar equations. Face addressing is used to make all matrix assembly and solution loops vectorise.
bool readScalar(const char *buf, doubleScalar &s)
Read whole of buf as a scalar. Return true if successful.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
virtual tmp< volScalarField > Cp() const =0
Heat capacity at constant pressure [J/kg/K].
dimensioned< Type > min(const dimensioned< Type > &, const dimensioned< Type > &)
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
word name(const complex &)
Return a string representation of a complex.
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.
Mesh data needed to do the Finite Volume discretisation.
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
dimensioned< scalar > mag(const dimensioned< Type > &)
Cell-set options abstract base class. Provides a base set of controls, e.g.:
virtual void addSup(fvMatrix< scalar > &eqn, const label fieldi)
Scalar.