37 namespace functionObjects
53 tmp<volScalarField> tmagU =
mag(lookupObject<volVectorField>(
"U"));
79 lookupObject<volScalarField>(
"T").boundaryField();
81 scalar areaIntegral = 0;
82 scalar TareaIntegral = 0;
87 const fvPatch& pTBf = TBf[patchi].
patch();
90 if (isType<wallFvPatch>(pTBf))
92 areaIntegral +=
gSum(pSf);
93 TareaIntegral +=
gSum(pSf*pT);
97 Trad.value() = TareaIntegral/areaIntegral;
104 <<
"The calculated mean wall radiation temperature is out of the\n" 105 <<
"bounds specified in EN ISO 7730:2005\n" 106 <<
"Valid range is 10 degC < T < 40 degC\n" 107 <<
"The actual value is: " << (Trad.value() - 273.15) <<
nl <<
endl;
124 if (pSat_.value() == 0)
126 const auto&
T = lookupObject<volScalarField>(
"T");
129 tpSat = kPaToPa*
exp(
A -
B/(
T +
C));
167 tmp<volScalarField> tTcl
189 Tcl = (Tcl + Tcl.prevIter())/2;
201 pos(hcForced - hcNatural)*hcForced
202 +
neg0(hcForced - hcNatural)*hcNatural;
207 - factor2*(metabolicRateSI - extWorkSI)
208 - Icl_*factor3*fcl_*(
pow4(Tcl) -
pow4(Trad))
209 - Icl_*fcl_*hc*(Tcl -
T);
215 }
while (!converged(Tcl) && i++ < maxClothIter_);
217 if (i == maxClothIter_)
220 <<
"The surface cloth temperature did not converge within " << i
221 <<
" iterations" <<
nl;
228 bool Foam::functionObjects::comfort::converged
234 max(
mag(
phi.primitiveField() -
phi.prevIter().primitiveField()))
249 clothing_(
"clothing",
dimless, 0),
253 relHumidity_(
"relHumidity",
dimless, 0.5),
272 clothing_.readIfPresent(
dict);
273 metabolicRate_.readIfPresent(
dict);
274 extWork_.readIfPresent(
dict);
275 pSat_.readIfPresent(
dict);
276 tolerance_ =
dict.getOrDefault(
"tolerance", 1
e-4);
277 maxClothIter_ =
dict.getOrDefault(
"maxClothIter", 100);
278 meanVelocity_ =
dict.getOrDefault<
bool>(
"meanVelocity",
false);
281 if (
dict.found(relHumidity_.name()))
283 relHumidity_.read(
dict);
288 if (
dict.found(Trad_.name()))
297 Icl_.value() <= 0.078
298 ? 1.0 + 1.290*Icl_.value()
299 : 1.05 + 0.645*Icl_.value();
317 const auto&
T = lookupObject<volScalarField>(
"T");
326 mesh_.time().timeName(),
373 (metabolicRateSI - extWorkSI).value() < factor8.
value() ? 0 : 0.42
376 Info<<
"Calculating the predicted mean vote (PMV)" <<
endl;
382 (factor1*
exp(factor2*metabolicRateSI) + factor3)
384 (metabolicRateSI - extWorkSI)
390 - factor6*(metabolicRateSI - extWorkSI)
395 - factor7*(metabolicRateSI - extWorkSI - factor8)
398 - factor9*metabolicRateSI*(factor10 - pSat*relHumidity_)
401 - factor11*metabolicRateSI*(factor12 -
T)
404 - factor13*fcl_*(
pow4(Tcloth) -
pow4(Trad))
407 - fcl_*hc*(Tcloth -
T)
411 Info<<
"Calculating the predicted percentage of dissatisfaction (PPD)" 416 100 - 95*
exp(-0.03353*
pow4(PMV()) - 0.21790*
sqr(PMV()));
418 Info<<
"Calculating the draught rating (DR)\n";
436 mesh_.time().timeName(),
443 if (foundObject<volScalarField>(
"k"))
445 const auto&
k = lookupObject<volScalarField>(
"k");
446 TI =
sqrt(2/3*
k)/Umag;
452 dimensionSet(0, -1.62, 1.62, -1, 0, 0, 0),
457 tmp<volScalarField> DR =
458 correctUnit*(factor12 -
T)*
pow(Umag - Umin, 0.62)*(pre*Umag*TI + C1);
461 tmp<volScalarField> Top = 0.5*(
T + Trad);
464 word fieldNamePMV =
"PMV";
465 word fieldNamePPD =
"PPD";
466 word fieldNameDR =
"DR";
467 word fieldNameTop =
"Top";
471 store(fieldNamePMV, PMV)
472 && store(fieldNamePPD, PPD)
473 && store(fieldNameDR, DR)
474 && store(fieldNameTop, Top)
484 && writeObject(
"PPD")
486 && writeObject(
"Top")
void clamp_range(const dimensioned< MinMax< Type >> &range)
Clamp field values (in-place) to the specified range.
const Type & value() const noexcept
Return const reference to value.
defineTypeNameAndDebug(ObukhovLength, 0)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
A list of keyword definitions, which are a keyword followed by a number of values (eg...
const fvPatch & patch() const noexcept
Return the patch.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
constexpr char nl
The newline '\n' character (0x0a)
dimensionedScalar sqrt(const dimensionedScalar &ds)
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensionedScalar pow025(const dimensionedScalar &ds)
GeometricBoundaryField< scalar, fvPatchField, volMesh > Boundary
Type of boundary fields.
label k
Boltzmann constant.
const dimensionSet dimless
Dimensionless.
const DimensionedField< scalar, volMesh > & V() const
Return cell volumes.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Macros for easy insertion into run-time selection tables.
bool read(const char *buf, int32_t &val)
Same as readInt32.
#define forAll(list, i)
Loop across all elements in list.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
dimensionedScalar pos(const dimensionedScalar &ds)
const dimensionedScalar e
Elementary charge.
Type gSum(const FieldField< Field, Type > &f)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
dimensionedScalar exp(const dimensionedScalar &ds)
fvPatchField< scalar > fvPatchScalarField
A class for handling words, derived from Foam::string.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
const dimensionSet dimTemperature(0, 0, 0, 1, 0, 0, 0)
comfort(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
dimensionedScalar neg0(const dimensionedScalar &ds)
virtual bool execute()
Calculate the predicted mean vote (PMV) and predicted percentage dissatisfaction (PPD) fields...
virtual bool read(const dictionary &)
Read the data needed for the comfort calculation.
const dimensionSet & dimensions() const noexcept
Return const reference to dimensions.
const dimensionSet dimPressure
static tmp< GeometricField< scalar, fvPatchField, volMesh > > New(const word &name, IOobjectOption::registerOption regOpt, const Mesh &mesh, const dimensionSet &dims, const word &patchFieldType=fvPatchField< scalar >::calculatedType())
Return tmp field (NO_READ, NO_WRITE) from name, mesh, dimensions and patch type. [Takes current timeN...
addToRunTimeSelectionTable(functionObject, ObukhovLength, dictionary)
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
dimensionedScalar pow3(const dimensionedScalar &ds)
#define WarningInFunction
Report a warning using Foam::Warning.
const dimensionSet dimLength(0, 1, 0, 0, 0, 0, 0)
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
dimensionedScalar pow4(const dimensionedScalar &ds)
static const Foam::scalarMinMax Tbounds(283.15, 313.15)
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
messageStream Info
Information stream (stdout output on master, null elsewhere)
Internal & ref(const bool updateAccessTime=true)
Same as internalFieldRef()
virtual bool read(const dictionary &dict)
Read optional controls.
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
dimensioned< Type > weightedAverage(const DimensionedField< scalar, GeoMesh > &weightField) const
Calculate and return weighted average.
const dimensionSet dimMass(1, 0, 0, 0, 0, 0, 0)
A class for managing temporary objects.
virtual bool write()
Write the PPD and PMV fields.
static const Foam::dimensionedScalar A("", Foam::dimPressure, 611.21)
Defines the attributes of an object for which implicit objectRegistry management is supported...
bool contains(const T &val) const
True if the value is within the range (inclusive check)
const fvMesh & mesh_
Reference to the fvMesh.
static const Foam::dimensionedScalar B("", Foam::dimless, 18.678)
static constexpr const zero Zero
Global zero (0)
const dimensionSet dimVelocity