29 #include "surfaceInterpolate.H"
45 effectivenessHeatExchangerSource,
46 "effectivenessHeatExchangerSource"
54 void Foam::fv::effectivenessHeatExchanger::readCoeffs(
const dictionary&
dict)
56 secondaryMassFlowRate_ =
75 UName_ =
dict.lookupOrDefault<word>(
"U",
"U");
76 TName_ =
dict.lookupOrDefault<word>(
"T",
"T");
77 phiName_ =
dict.lookupOrDefault<word>(
"phi",
"phi");
79 faceZoneName_ =
dict.lookup<word>(
"faceZone");
83 void Foam::fv::effectivenessHeatExchanger::setZone()
89 <<
type() <<
" " << this->
name() <<
": "
90 <<
" Unknown face zone name: " << faceZoneName_
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))
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)
180 reduce(area, sumOp<scalar>());
189 const word& modelType,
196 secondaryMassFlowRate_(NaN),
197 secondaryInletT_(NaN),
202 phiName_(
word::null),
203 faceZoneName_(
word::null),
245 label facei = faceId_[i];
246 if (facePatchId_[i] != -1)
252 Cpf.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 zone_.topoChange(map);
357 zone_.distribute(map);
365 zone_.read(coeffs(
dict));
366 readCoeffs(coeffs(
dict));
#define forAll(list, i)
Loop across all elements in list.
Macros for easy insertion into run-time selection tables.
wordList toc() const
Return the table of contents.
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.
label findIndex(const word &key) const
Return the index of the given the key or -1 if not found.
void setSize(const label)
Reset size of PtrList. If extending the PtrList, new entries are.
static bool master(const label communicator=0)
Am I the master process.
Base-class for fluid and solid thermodynamic properties.
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Mesh data needed to do the Finite Volume discretisation.
const DimensionedField< scalar, volMesh > & V() const
Return cell volumes.
const surfaceScalarField & magSf() const
Return cell face area magnitudes.
Finite volume model abstract base class.
static const dictionary & coeffs(const word &modelType, const dictionary &)
Return the coefficients sub-dictionary for a given model type.
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.
const Type & lookupObject(const word &name) const
Lookup and return the object of the given Type and name.
label whichPatch(const label faceIndex) const
Return patch index for a given face label.
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
Class containing mesh-to-mesh mapping information.
const faceZoneList & faceZones() const
Return face zones.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
A class for handling words, derived from string.
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
#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.
const dimensionSet dimless
void T(LagrangianPatchField< Type > &f, const LagrangianPatchField< Type > &f1)
const dimensionSet dimTemperature
void mag(LagrangianPatchField< scalar > &f, const LagrangianPatchField< Type > &f1)
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)
layerAndWeight max(const layerAndWeight &a, const layerAndWeight &b)
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
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.
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
fluidMulticomponentThermo & thermo