45 { operationMode::fixedPower,
"power" },
46 { operationMode::fixedHeatFlux,
"flux" },
47 { operationMode::fixedHeatTransferCoeff,
"coefficient" },
60 mixedFvPatchScalarField(
p, iF),
70 qrName_(
"undefined-qr"),
88 mixedFvPatchScalarField(
p, iF),
90 mode_(operationModeNames.
get(
"mode",
dict)),
95 relaxation_(
dict.getOrDefault<scalar>(
"relaxation", 1)),
96 emissivity_(
dict.getOrDefault<scalar>(
"emissivity", 0)),
97 qrRelaxation_(
dict.getOrDefault<scalar>(
"qrRelaxation", 1)),
98 qrName_(
dict.getOrDefault<
word>(
"qr",
"none")),
119 if (
dict.readIfPresent(
"thicknessLayers", thicknessLayers_))
121 dict.readEntry(
"kappaLayers", kappaLayers_);
123 if (thicknessLayers_.
size() != kappaLayers_.
size())
126 <<
"\n number of layers for thicknessLayers and " 127 <<
"kappaLayers must be the same" 128 <<
"\n for patch " <<
p.name()
129 <<
" of field " << internalField().name()
130 <<
" in file " << internalField().objectPath()
139 if (qrName_ !=
"none")
141 if (
dict.found(
"qrPrevious"))
153 if (this->readMixedEntries(
dict))
170 const externalWallHeatFluxTemperatureFvPatchScalarField& rhs,
172 const DimensionedField<scalar, volMesh>& iF,
173 const fvPatchFieldMapper& mapper
176 mixedFvPatchScalarField(rhs,
p, iF, mapper),
177 temperatureCoupledBase(
patch(), rhs),
182 Ta_(rhs.Ta_.clone()),
183 relaxation_(rhs.relaxation_),
184 emissivity_(rhs.emissivity_),
186 qrRelaxation_(rhs.qrRelaxation_),
187 qrName_(rhs.qrName_),
188 thicknessLayers_(rhs.thicknessLayers_),
189 kappaLayers_(rhs.kappaLayers_)
191 if (qrName_ !=
"none")
193 qrPrevious_.
resize(mapper.size());
194 qrPrevious_.
map(rhs.qrPrevious_, mapper);
202 const externalWallHeatFluxTemperatureFvPatchScalarField& rhs
205 mixedFvPatchScalarField(rhs),
206 temperatureCoupledBase(rhs),
211 Ta_(rhs.Ta_.clone()),
212 relaxation_(rhs.relaxation_),
213 emissivity_(rhs.emissivity_),
214 qrPrevious_(rhs.qrPrevious_),
215 qrRelaxation_(rhs.qrRelaxation_),
216 qrName_(rhs.qrName_),
217 thicknessLayers_(rhs.thicknessLayers_),
218 kappaLayers_(rhs.kappaLayers_)
229 mixedFvPatchScalarField(rhs, iF),
235 Ta_(rhs.Ta_.clone()),
236 relaxation_(rhs.relaxation_),
237 emissivity_(rhs.emissivity_),
238 qrPrevious_(rhs.qrPrevious_),
239 qrRelaxation_(rhs.qrRelaxation_),
240 qrName_(rhs.qrName_),
241 thicknessLayers_(rhs.thicknessLayers_),
242 kappaLayers_(rhs.kappaLayers_)
253 mixedFvPatchScalarField::autoMap(mapper);
265 if (qrName_ !=
"none")
267 qrPrevious_.autoMap(mapper);
278 mixedFvPatchScalarField::rmap(ptf, addr);
281 refCast<const externalWallHeatFluxTemperatureFvPatchScalarField>(ptf);
288 q_->rmap(rhs.q_(), addr);
292 h_->rmap(rhs.h_(), addr);
295 if (qrName_ !=
"none")
297 qrPrevious_.rmap(rhs.qrPrevious_, addr);
315 if (qrName_ !=
"none")
320 patch().lookupPatchField<volScalarField>(qrName_),
330 const scalar heatPower =
331 Q_->value(this->db().time().timeOutputValue());
341 tmp<scalarField> heatFlux =
342 q_->
value(this->db().time().timeOutputValue());
344 refGrad() = (heatFlux + qr)/
kappa(Tp);
350 case fixedHeatTransferCoeff:
352 tmp<scalarField> thtcCoeff =
354 h_->value(this->db().time().timeOutputValue()) + VSMALL
356 const auto& htcCoeff = thtcCoeff();
358 scalar totalSolidRes = 0;
359 if (thicknessLayers_.size())
361 forAll(thicknessLayers_, iLayer)
363 const scalar l = thicknessLayers_[iLayer];
364 if (kappaLayers_[iLayer] > 0)
366 totalSolidRes += l/kappaLayers_[iLayer];
372 Ta_->value(this->db().time().timeOutputValue());
381 if (totalSolidRes > 0)
385 scalarField TpLambda(htcCoeff/(htcCoeff + 1/totalSolidRes));
387 hrad = eSig*((
pow3(Ta) +
pow3(Ts)) + Ta*Ts*(Ta + Ts));
391 scalar hradTmp0 = hrad[i];
393 (htcCoeff[i] + hradTmp0)
394 /(htcCoeff[i] + hradTmp0 + 1/totalSolidRes);
396 scalar TsiNew = TaLambda*Ta + (1 - TaLambda)*Tp[i];
399 while (
mag(Tsi - TsiNew)/Tsi > 0.01)
404 eSig*((
pow3(Ta) +
pow3(Tsi)) + Ta*Tsi*(Ta + Tsi))
408 (htcCoeff[i] + hradNew)
409 /(htcCoeff[i] + hradNew + 1/totalSolidRes);
411 TsiNew = TaLambda*Ta + (1 - TaLambda)*Tp[i];
415 eSig*((
pow3(Ta) +
pow3(Tsi)) + Ta*Tsi*(Ta + Tsi));
420 hrad = eSig*((
pow3(Ta) +
pow3(Tp)) + Ta*Tp*(Ta + Tp));
424 const scalarField hp(1/(1/(htcCoeff + hrad) + totalSolidRes));
439 const scalar hpmqr = hp[i] - qr[i]/Tp[i];
441 refValue()[i] = hpTa[i]/hpmqr;
442 valueFraction()[i] = hpmqr/(hpmqr + kappaDeltaCoeffs[i]);
446 refValue()[i] = (hpTa[i] + qr[i])/hp[i];
447 valueFraction()[i] = hp[i]/(hp[i] + kappaDeltaCoeffs[i]);
455 valueFraction() =
lerp(valueFraction0, valueFraction(), relaxation_);
456 refValue() =
lerp(refValue0, refValue(), relaxation_);
458 mixedFvPatchScalarField::updateCoeffs();
461 <<
patch().boundaryMesh().mesh().name() <<
':' <<
patch().name() <<
':' 462 << internalField().name() <<
" :" 464 <<
" wall temperature " 466 <<
" max:" <<
gMax(*
this)
500 case fixedHeatTransferCoeff:
512 if (thicknessLayers_.size())
527 if (qrName_ !=
"none")
548 externalWallHeatFluxTemperatureFvPatchScalarField
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
List of values generated by applying the access operation to each list item.
virtual void rmap(const fvPatchScalarField &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
Top level data entry class for use in dictionaries. Provides a mechanism to specify a variable as a c...
const Type & value() const noexcept
Return const reference to value.
void size(const label n)
Older name for setAddressableSize.
Heat transfer coefficient [W/m^2/K].
errorManipArg< error, int > exit(error &err, const int errNo=1)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
void resize(const label len)
Adjust allocated size of list.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Type gMin(const FieldField< Field, Type > &f)
static const Enum< operationMode > operationModeNames
constexpr char nl
The newline '\n' character (0x0a)
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
const dimensionedScalar sigma
Stefan-Boltzmann constant: default SI units: [W/m2/K4].
virtual void rmap(const fvPatchField< scalar > &, const labelList &)=0
Reverse map the given fvPatchField onto this fvPatchField.
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
void writeValueEntry(Ostream &os) const
Write *this field as a "value" entry.
virtual void autoMap(const fvPatchFieldMapper &)=0
Map (and resize as needed) from self given a mapping object.
void write(Ostream &os) const
Write.
virtual void write(Ostream &) const
Write.
const dimensionedScalar kappa
Coulomb constant: default SI units: [N.m2/C2].
dimensionedScalar sigma("sigma", dimMass/sqr(dimTime), transportProperties)
Macros for easy insertion into run-time selection tables.
#define forAll(list, i)
Loop across all elements in list.
Type gSum(const FieldField< Field, Type > &f)
fvPatchField< scalar > fvPatchScalarField
A class for handling words, derived from Foam::string.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
A FieldMapper for finite-volume patch fields.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
#define DebugInfo
Report an information message using Foam::Info.
void map(const UList< Type > &mapF, const labelUList &mapAddressing)
1 to 1 map from the given field
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Top level data entry class for use in dictionaries. Provides a mechanism to specify a variable as a c...
Type gMax(const FieldField< Field, Type > &f)
OBJstream os(runTime.globalPath()/outputName)
dimensioned< Type > lerp(const dimensioned< Type > &a, const dimensioned< Type > &b, const scalar t)
dimensionedScalar pow3(const dimensionedScalar &ds)
Common functions used in temperature coupled boundaries.
operationMode
Operation mode enumeration.
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Type gAverage(const FieldField< Field, Type > &f)
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
const std::string patch
OpenFOAM patch number as a std::string.
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
externalWallHeatFluxTemperatureFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
List< label > labelList
A List of labels.
void write(Ostream &) const
Write.
makePatchTypeField(fvPatchScalarField, atmBoundaryLayerInletEpsilonFvPatchScalarField)
This boundary condition applies a heat flux condition to temperature on an external wall in one of th...
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > snGrad(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
static constexpr const zero Zero
Global zero (0)