45 { operationMode::fixedPower,
"power" },
46 { operationMode::fixedHeatFlux,
"flux" },
47 { operationMode::fixedHeatTransferCoeff,
"coefficient" },
53Foam::externalWallHeatFluxTemperatureFvPatchScalarField::
54externalWallHeatFluxTemperatureFvPatchScalarField
60 mixedFvPatchScalarField(
p, iF),
77 qrName_(
"undefined-qr"),
87Foam::externalWallHeatFluxTemperatureFvPatchScalarField::
88externalWallHeatFluxTemperatureFvPatchScalarField
95 mixedFvPatchScalarField(
p, iF),
97 mode_(operationModeNames.get(
"mode",
dict)),
102 relaxation_(
dict.getOrDefault<scalar>(
"relaxation", 1)),
103 emissivity_(
dict.getOrDefault<scalar>(
"emissivity", 0)),
104 qrRelaxation_(
dict.getOrDefault<scalar>(
"qrRelaxation", 1)),
105 qrName_(
dict.getOrDefault<
word>(
"qr",
"none")),
130 if (thicknessLayers_.
size() != kappaLayers_.
size())
133 <<
"\n number of layers for thicknessLayers and "
134 <<
"kappaLayers must be the same"
135 <<
"\n for patch " <<
p.
name()
136 <<
" of field " << internalField().name()
137 <<
" in file " << internalField().objectPath()
148 if (qrName_ !=
"none")
177Foam::externalWallHeatFluxTemperatureFvPatchScalarField::
178externalWallHeatFluxTemperatureFvPatchScalarField
186 mixedFvPatchScalarField(rhs,
p, iF, mapper),
190 q_(rhs.q_.clone(patch().patch())),
191 h_(rhs.h_.clone(patch().patch())),
192 Ta_(rhs.Ta_.clone()),
193 relaxation_(rhs.relaxation_),
194 emissivity_(rhs.emissivity_),
196 qrRelaxation_(rhs.qrRelaxation_),
197 qrName_(rhs.qrName_),
198 thicknessLayers_(rhs.thicknessLayers_),
199 kappaLayers_(rhs.kappaLayers_)
201 if (qrName_ !=
"none")
204 qrPrevious_.
map(rhs.qrPrevious_, mapper);
209Foam::externalWallHeatFluxTemperatureFvPatchScalarField::
210externalWallHeatFluxTemperatureFvPatchScalarField
215 mixedFvPatchScalarField(rhs),
219 q_(rhs.q_.clone(patch().patch())),
220 h_(rhs.h_.clone(patch().patch())),
221 Ta_(rhs.Ta_.clone()),
222 relaxation_(rhs.relaxation_),
223 emissivity_(rhs.emissivity_),
224 qrPrevious_(rhs.qrPrevious_),
225 qrRelaxation_(rhs.qrRelaxation_),
226 qrName_(rhs.qrName_),
227 thicknessLayers_(rhs.thicknessLayers_),
228 kappaLayers_(rhs.kappaLayers_)
232Foam::externalWallHeatFluxTemperatureFvPatchScalarField::
233externalWallHeatFluxTemperatureFvPatchScalarField
239 mixedFvPatchScalarField(rhs, iF),
243 q_(rhs.q_.clone(patch().patch())),
244 h_(rhs.h_.clone(patch().patch())),
245 Ta_(rhs.Ta_.clone()),
246 relaxation_(rhs.relaxation_),
247 emissivity_(rhs.emissivity_),
248 qrPrevious_(rhs.qrPrevious_),
249 qrRelaxation_(rhs.qrRelaxation_),
250 qrName_(rhs.qrName_),
251 thicknessLayers_(rhs.thicknessLayers_),
252 kappaLayers_(rhs.kappaLayers_)
263 mixedFvPatchScalarField::autoMap(mapper);
275 if (qrName_ !=
"none")
277 qrPrevious_.autoMap(mapper);
288 mixedFvPatchScalarField::rmap(ptf, addr);
291 refCast<const externalWallHeatFluxTemperatureFvPatchScalarField>(ptf);
298 q_->rmap(rhs.q_(), addr);
302 h_->rmap(rhs.h_(), addr);
305 if (qrName_ !=
"none")
307 qrPrevious_.rmap(rhs.qrPrevious_, addr);
325 if (qrName_ !=
"none")
330 + (1 - qrRelaxation_)*qrPrevious_;
339 const scalar heatPower =
340 Q_->value(this->db().time().timeOutputValue());
342 refGrad() = (heatPower/
gSum(patch().magSf()) + qr)/kappa(Tp);
351 q_->value(this->db().time().timeOutputValue());
353 refGrad() = (heatFlux + qr)/kappa(Tp);
359 case fixedHeatTransferCoeff:
363 h_->value(this->db().time().timeOutputValue()) + VSMALL
365 const auto& htcCoeff = thtcCoeff();
367 scalar totalSolidRes = 0;
368 if (thicknessLayers_.size())
370 forAll(thicknessLayers_, iLayer)
372 const scalar l = thicknessLayers_[iLayer];
373 if (kappaLayers_[iLayer] > 0)
375 totalSolidRes += l/kappaLayers_[iLayer];
382 Ta_->value(this->db().time().timeOutputValue());
390 if (totalSolidRes > 0)
394 scalarField TpLambda(htcCoeff/(htcCoeff + 1/totalSolidRes));
398 hp += emissivity_*sigma.
value()*(
pow4(Ts) - lambdaTa4)/Tp;
399 hpTa += emissivity_*sigma.
value()*(lambdaTa4 +
pow4(Ta));
405 hp += emissivity_*sigma.
value()*
pow3(Tp);
406 hpTa += emissivity_*sigma.
value()*
pow4(Ta);
412 this->kappa(Tp)*patch().deltaCoeffs()
421 const scalar hpmqr = hp[i] - qr[i]/Tp[i];
423 refValue()[i] = hpTa[i]/hpmqr;
424 valueFraction()[i] = hpmqr/(hpmqr + kappaDeltaCoeffs[i]);
428 refValue()[i] = (hpTa[i] + qr[i])/hp[i];
429 valueFraction()[i] = hp[i]/(hp[i] + kappaDeltaCoeffs[i]);
438 relaxation_*valueFraction() + (1 - relaxation_)*valueFraction0;
439 refValue() = relaxation_*refValue() + (1 - relaxation_)*refValue0;
441 mixedFvPatchScalarField::updateCoeffs();
444 << patch().boundaryMesh().mesh().name() <<
':' << patch().name() <<
':'
445 << internalField().name() <<
" :"
446 <<
" heat transfer rate:" <<
gSum(kappa(Tp)*patch().magSf()*snGrad())
447 <<
" wall temperature "
448 <<
" min:" <<
gMin(*
this)
449 <<
" max:" <<
gMax(*
this)
483 case fixedHeatTransferCoeff:
495 if (thicknessLayers_.size())
510 if (qrName_ !=
"none")
520 writeEntry(
"value",
os);
Macros for easy insertion into run-time selection tables.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
virtual label size() const =0
The size of the mapper.
void map(const UList< Type > &mapF, const labelUList &mapAddressing)
1 to 1 map from the given field
const word & name() const noexcept
Return the object name.
void resize(const label len)
Adjust allocated size of list.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
void size(const label n)
Older name for setAddressableSize.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
bool found(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Search for an entry (const access) with the given keyword.
bool readIfPresent(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX) const
bool readEntry(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX, bool mandatory=true) const
const Type & value() const
Return const reference to value.
This boundary condition applies a heat flux condition to temperature on an external wall in one of th...
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
virtual void rmap(const fvPatchScalarField &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
static const Enum< operationMode > operationModeNames
operationMode
Operation mode enumeration.
@ fixedPower
Heat power [W].
@ fixedHeatTransferCoeff
Heat transfer coefficient [W/m^2/K].
@ fixedHeatFlux
Heat flux [W/m2].
virtual bool write()
Write the output fields.
A FieldMapper for finite-volume patch fields.
virtual void operator=(const UList< scalar > &)
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
Common functions used in temperature coupled boundaries.
virtual void autoMap(const fvPatchFieldMapper &)=0
Map (and resize as needed) from self given a mapping object.
virtual void rmap(const fvPatchField< scalar > &, const labelList &)=0
Reverse map the given fvPatchField onto this fvPatchField.
A class for managing temporary objects.
A class for handling words, derived from Foam::string.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
OBJstream os(runTime.globalPath()/outputName)
#define makePatchTypeField(PatchTypeField, typePatchTypeField)
#define DebugInfo
Report an information message using Foam::Info.
const dimensionedScalar sigma
Stefan-Boltzmann constant: default SI units: [W/m2/K4].
Type gSum(const FieldField< Field, Type > &f)
dimensionedScalar pow3(const dimensionedScalar &ds)
GeometricField< scalar, fvPatchField, volMesh > volScalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
dimensionedScalar pow4(const dimensionedScalar &ds)
Type gAverage(const FieldField< Field, Type > &f)
static constexpr const zero Zero
Global zero (0)
Type gMin(const FieldField< Field, Type > &f)
errorManipArg< error, int > exit(error &err, const int errNo=1)
Type gMax(const FieldField< Field, Type > &f)
constexpr char nl
The newline '\n' character (0x0a)
#define forAll(list, i)
Loop across all elements in list.