29 #include "surfaceInterpolate.H"
45 effectivenessHeatExchangerSource,
46 "effectivenessHeatExchangerSource"
54 void Foam::fv::effectivenessHeatExchanger::readCoeffs()
56 secondaryMassFlowRate_ =
83 void Foam::fv::effectivenessHeatExchanger::setZone()
85 zoneIndex_ = mesh().faceZones().findIndex(faceZoneName_);
89 <<
type() <<
" " << this->
name() <<
": "
90 <<
" Unknown face zone name: " << faceZoneName_
91 <<
". Valid face zones are: " << mesh().faceZones().toc()
95 const faceZone& fZone = mesh().faceZones()[zoneIndex_];
97 faceId_.setSize(fZone.size());
98 facePatchId_.setSize(fZone.size());
99 faceSign_.setSize(fZone.size());
104 const label facei = fZone[i];
106 label facePatchId = -1;
107 if (mesh().isInternalFace(facei))
114 facePatchId = mesh().boundaryMesh().whichPatch(facei);
115 const polyPatch& pp = mesh().boundaryMesh()[facePatchId];
116 if (isA<coupledPolyPatch>(pp))
118 if (refCast<const coupledPolyPatch>(pp).owner())
120 faceId = pp.whichFace(facei);
127 else if (!isA<emptyPolyPatch>(pp))
129 faceId = facei - pp.start();
140 if (fZone.flipMap()[i])
142 faceSign_[
count] = -1;
146 faceSign_[
count] = 1;
149 facePatchId_[
count] = facePatchId;
153 faceId_.setSize(
count);
154 facePatchId_.setSize(
count);
155 faceSign_.setSize(
count);
157 calculateTotalArea(faceZoneArea_);
161 void Foam::fv::effectivenessHeatExchanger::calculateTotalArea
169 const label facei = faceId_[i];
170 if (facePatchId_[i] != -1)
173 area += mesh().magSf().boundaryField()[
patchi][facei];
177 area += mesh().magSf()[facei];
180 reduce(area, sumOp<scalar>());
189 const word& modelType,
195 set_(mesh, coeffs()),
196 secondaryMassFlowRate_(NaN),
197 secondaryInletT_(NaN),
202 phiName_(
word::null),
203 faceZoneName_(
word::null),
220 mesh().lookupObject<
basicThermo>(physicalProperties::typeName);
234 mesh().lookupObject<
basicThermo>(physicalProperties::typeName);
245 label facei = faceId_[i];
246 if (facePatchId_[i] != -1)
252 Cpf.boundaryField()[
patchi][facei]
253 *mesh().magSf().boundaryField()[
patchi][facei];
257 totalphi += phi[facei]*faceSign_[i];
258 CpfMean += Cpf[facei]*mesh().magSf()[facei];
265 eTable_->value(
mag(totalphi), secondaryMassFlowRate_)
266 *(secondaryInletT_ - primaryInletT_)
267 *(CpfMean/faceZoneArea_)*
mag(totalphi);
290 deltaTCells[i] =
max(Tref - TCells[i], 0.0);
294 deltaTCells[i] =
max(TCells[i] - Tref, 0.0);
300 scalar sumWeight = 0;
308 if (
mag(Qt) > vSmall)
314 heSource[
cells[i]] -=
321 Info<<
indent <<
"Net mass flux [Kg/s] = " << totalphi <<
nl;
322 Info<<
indent <<
"Total energy exchange [W] = " << Qt <<
nl;
325 << eTable_->value(
mag(totalphi), secondaryMassFlowRate_) <<
endl;
342 set_.topoChange(map);
357 set_.distribute(map);
#define forAll(list, i)
Loop across all elements in list.
Macros for easy insertion into run-time selection tables.
static autoPtr< Function2< Type > > New(const word &name, const Function2s::unitConversions &units, const dictionary &dict)
Select from dictionary.
Generic GeometricField class.
const Boundary & boundaryField() const
Return const-reference to the boundary field.
static bool master(const label communicator=0)
Am I the master process.
Base-class for fluid and solid thermodynamic properties.
A list of keyword definitions, which are a keyword followed by any number of values (e....
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T, if not found return the given default.
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Mesh data needed to do the Finite Volume discretisation.
Finite volume model abstract base class.
const dictionary & coeffs() const
Return dictionary.
virtual bool read(const dictionary &dict)
Read source dictionary.
Heat exchanger model, based on an effectiveness.
virtual bool movePoints()
Update for mesh motion.
virtual wordList addSupFields() const
Return the list of fields for which the fvModel adds source term.
virtual void topoChange(const polyTopoChangeMap &)
Update topology using the given map.
effectivenessHeatExchanger(const word &name, const word &modelType, const fvMesh &mesh, const dictionary &dict)
Construct from components.
virtual void distribute(const polyDistributionMap &)
Redistribute or update using the given distribution map.
virtual bool read(const dictionary &dict)
Read dictionary.
virtual void addSup(const volScalarField &rho, const volScalarField &he, fvMatrix< scalar > &eqn) const
Explicit and implicit source for compressible equation.
virtual void mapMesh(const polyMeshMap &)
Update from another mesh using the given map.
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
Class containing mesh-to-mesh mapping information.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
A class for handling words, derived from string.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
addToRunTimeSelectionTable(fvConstraint, bound, dictionary)
defineTypeNameAndDebug(bound, 0)
addBackwardCompatibleToRunTimeSelectionTable(fvConstraint, fixedTemperature, dictionary, fixedTemperatureConstraint, "fixedTemperatureConstraint")
static tmp< SurfaceField< Type > > interpolate(const VolField< Type > &tvf, const surfaceScalarField &faceFlux, Istream &schemeData)
Interpolate field onto faces using scheme given by Istream.
errorManipArg< error, int > exit(error &err, const int errNo=1)
List< word > wordList
A List of words.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
word name(const bool)
Return a word representation of a bool.
const dimensionSet dimless
const dimensionSet dimTemperature
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
const dimensionSet dimTime
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
dimensioned< scalar > mag(const dimensioned< Type > &)
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
const dimensionSet dimMass
label count(const ListType &l, typename ListType::const_reference x)
Count the number of occurrences of a value in a list.
Ostream & indent(Ostream &os)
Indent stream.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
fluidMulticomponentThermo & thermo