29 #include "surfaceInterpolate.H"
51 void Foam::fv::effectivenessHeatExchangerSource::readCoeffs()
53 secondaryMassFlowRate_ =
coeffs().
lookup<scalar>(
"secondaryMassFlowRate");
54 secondaryInletT_ =
coeffs().
lookup<scalar>(
"secondaryInletT");
55 primaryInletT_ =
coeffs().
lookup<scalar>(
"primaryInletT");
67 void Foam::fv::effectivenessHeatExchangerSource::setZone()
69 zoneID_ = mesh().faceZones().findZoneID(faceZoneName_);
73 <<
type() <<
" " << this->
name() <<
": "
74 <<
" Unknown face zone name: " << faceZoneName_
75 <<
". Valid face zones are: " << mesh().faceZones().names()
79 const faceZone& fZone = mesh().faceZones()[zoneID_];
81 faceId_.setSize(fZone.size());
82 facePatchId_.setSize(fZone.size());
83 faceSign_.setSize(fZone.size());
88 const label facei = fZone[i];
90 label facePatchId = -1;
91 if (mesh().isInternalFace(facei))
98 facePatchId = mesh().boundaryMesh().whichPatch(facei);
99 const polyPatch& pp = mesh().boundaryMesh()[facePatchId];
100 if (isA<coupledPolyPatch>(pp))
102 if (refCast<const coupledPolyPatch>(pp).owner())
104 faceId = pp.whichFace(facei);
111 else if (!isA<emptyPolyPatch>(pp))
113 faceId = facei - pp.start();
124 if (fZone.flipMap()[i])
126 faceSign_[
count] = -1;
130 faceSign_[
count] = 1;
133 facePatchId_[
count] = facePatchId;
137 faceId_.setSize(
count);
138 facePatchId_.setSize(
count);
139 faceSign_.setSize(
count);
141 calculateTotalArea(faceZoneArea_);
145 void Foam::fv::effectivenessHeatExchangerSource::calculateTotalArea
153 const label facei = faceId_[i];
154 if (facePatchId_[i] != -1)
157 area += mesh().magSf().boundaryField()[
patchi][facei];
161 area += mesh().magSf()[facei];
164 reduce(area, sumOp<scalar>());
173 const word& modelType,
179 set_(mesh, coeffs()),
180 secondaryMassFlowRate_(
NaN),
181 secondaryInletT_(
NaN),
186 phiName_(
word::null),
187 faceZoneName_(
word::null),
204 mesh().lookupObject<
basicThermo>(physicalProperties::typeName);
214 const word& fieldName
218 mesh().lookupObject<
basicThermo>(physicalProperties::typeName);
229 label facei = faceId_[i];
230 if (facePatchId_[i] != -1)
236 Cpf.boundaryField()[
patchi][facei]
237 *mesh().magSf().boundaryField()[
patchi][facei];
241 totalphi += phi[facei]*faceSign_[i];
242 CpfMean += Cpf[facei]*mesh().magSf()[facei];
249 eTable_->value(
mag(totalphi), secondaryMassFlowRate_)
250 *(secondaryInletT_ - primaryInletT_)
251 *(CpfMean/faceZoneArea_)*
mag(totalphi);
274 deltaTCells[i] =
max(Tref - TCells[i], 0.0);
278 deltaTCells[i] =
max(TCells[i] - Tref, 0.0);
284 scalar sumWeight = 0;
292 if (
mag(Qt) > vSmall)
298 heSource[
cells[i]] -=
305 Info<<
indent <<
"Net mass flux [Kg/s] = " << totalphi <<
nl;
306 Info<<
indent <<
"Total energy exchange [W] = " << Qt <<
nl;
309 << eTable_->value(
mag(totalphi), secondaryMassFlowRate_) <<
endl;
326 set_.topoChange(map);
341 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 dictionary &dict)
Selector.
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,.
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 source model, in which the heat exchanger is defined as a selection of cells.
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 addSup(const volScalarField &rho, fvMatrix< scalar > &eqn, const word &fieldName) const
Explicit and implicit source for compressible equation.
virtual void topoChange(const polyTopoChangeMap &)
Update topology using the given map.
virtual void distribute(const polyDistributionMap &)
Redistribute or update using the given distribution map.
virtual bool read(const dictionary &dict)
Read dictionary.
effectivenessHeatExchangerSource(const word &name, const word &modelType, const fvMesh &mesh, const dictionary &dict)
Construct from components.
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)
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.
layerAndWeight min(const layerAndWeight &a, const layerAndWeight &b)
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)
label count(const ListType &l, typename ListType::const_reference x)
Count the number of occurrences of a value in a list.
word name(const complex &)
Return a string representation of a complex.
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