53 mixedFvPatchScalarField(
p, iF),
60 TnbrName_(
"undefined-Tnbr"),
61 qrNbrName_(
"undefined-qrNbr"),
62 qrName_(
"undefined-qr"),
63 thermalInertia_(
false)
65 this->refValue() = 0.0;
66 this->refGrad() = 0.0;
67 this->valueFraction() = 1.0;
81 mixedFvPatchScalarField(psf,
p, iF, mapper),
89 TnbrName_(psf.TnbrName_),
90 qrNbrName_(psf.qrNbrName_),
92 thicknessLayers_(psf.thicknessLayers_),
93 thicknessLayer_(psf.thicknessLayer_.clone(
p.
patch())),
94 kappaLayers_(psf.kappaLayers_),
95 kappaLayer_(psf.kappaLayer_.clone(
p.
patch())),
96 thermalInertia_(psf.thermalInertia_)
108 mixedFvPatchScalarField(
p, iF),
116 TnbrName_(
dict.getOrDefault<
word>(
"Tnbr",
"T")),
117 qrNbrName_(
dict.getOrDefault<
word>(
"qrNbr",
"none")),
118 qrName_(
dict.getOrDefault<
word>(
"qr",
"none")),
119 thermalInertia_(
dict.getOrDefault<
Switch>(
"thermalInertia", false))
121 if (!isA<mappedPatchBase>(this->
patch().
patch()))
124 <<
"' not type '" << mappedPatchBase::typeName <<
"'" 125 <<
"\n for patch " <<
p.name()
126 <<
" of field " << internalField().name()
127 <<
" in file " << internalField().objectPath()
173 if (
dict.readIfPresent(
"thicknessLayers", thicknessLayers_))
175 dict.readEntry(
"kappaLayers", kappaLayers_);
186 kappaLayer_ = PatchFunction1<scalar>::New
196 if (
dict.found(
"refValue"))
208 valueFraction() = 1.0;
212 if (
dict.readIfPresent(
"useImplicit", boolVal))
214 this->useImplicit(boolVal);
216 if (
dict.found(
"source"))
230 const turbulentTemperatureRadCoupledMixedFvPatchScalarField& psf,
234 mixedFvPatchScalarField(psf, iF),
242 TnbrName_(psf.TnbrName_),
243 qrNbrName_(psf.qrNbrName_),
244 qrName_(psf.qrName_),
245 thicknessLayers_(psf.thicknessLayers_),
246 thicknessLayer_(psf.thicknessLayer_.clone(
patch().
patch())),
247 kappaLayers_(psf.kappaLayers_),
249 thermalInertia_(psf.thermalInertia_)
259 mixedFvPatchScalarField(psf),
267 TnbrName_(psf.TnbrName_),
268 qrNbrName_(psf.qrNbrName_),
269 qrName_(psf.qrName_),
270 thicknessLayers_(psf.thicknessLayers_),
271 thicknessLayer_(psf.thicknessLayer_.clone(
patch().
patch())),
272 kappaLayers_(psf.kappaLayers_),
273 kappaLayer_(psf.kappaLayer_.clone(
patch().
patch())),
274 thermalInertia_(psf.thermalInertia_)
285 mixedFvPatchScalarField::autoMap(
mapper);
291 kappaLayer_().autoMap(
mapper);
302 mixedFvPatchScalarField::rmap(ptf, addr);
314 thicknessLayer_().rmap(tiptf.thicknessLayer_(), addr);
315 kappaLayer_().rmap(tiptf.kappaLayer_(), addr);
348 const label patchi =
patch().index();
353 this->internalField()
371 refCast<const fvMesh>(nbrMesh).
boundary()[samplePatchi];
380 TcNbr = nbrField.patchInternalField();
381 KDeltaNbr = nbrField.kappa(nbrField)*nbrPatch.deltaCoeffs();
387 TcNbr = patchInternalField();
394 if (thicknessLayer_ || thicknessLayers_.
size())
402 const scalar t = db().time().timeOutputValue();
404 thicknessLayer_().value(t)
405 /kappaLayer_().value(t);
408 if (thicknessLayers_.
size())
410 forAll(thicknessLayers_, iLayer)
412 KDeltaC += thicknessLayers_[iLayer]/kappaLayers_[iLayer];
415 KDeltaC = 1.0/(KDeltaC + SMALL);
422 if (qrName_ !=
"none")
428 if (qrNbrName_ !=
"none")
434 const fvPatch& nbrPatch =
435 refCast<const fvMesh>(nbrMesh).
boundary()[samplePatchi];
451 <<
"thermalInertia not supported in combination with multi-world" 456 const scalar dt =
mesh.time().deltaTValue();
462 const basicThermo*
thermo =
468 const fvPatch& nbrPatch =
469 refCast<const fvMesh>(nbrMesh).
boundary()[samplePatchi];
471 thermo->p().boundaryField()[samplePatchi];
473 thermo->T().boundaryField()[samplePatchi];
477 thermo->Cp(ppn, Tpn, samplePatchi)
478 *
thermo->rho(samplePatchi)
479 / nbrPatch.deltaCoeffs()/dt
494 const basicThermo*
thermo =
503 thermo->Cp(pp, Tp, patchi)
505 /
patch().deltaCoeffs()/dt
518 this->internalField().name()
521 const fvPatchField<scalar>& TpOld =
T.oldTime().boundaryField()[patchi];
526 scalarField c(KDeltaNbr*TcNbr + (mCpDt + mCpDtNbr)*TpOld);
528 refGrad() = (qr + qrNbr)/kappaTp;
533 valueFraction() = KDeltaNbr/(KDeltaNbr +
alpha);
535 refGrad() = (qr + qrNbr)/kappaTp;
541 if (this->useImplicit())
546 valueFraction()*deltaH()
547 + (qr + qrNbr)/beta()
551 mixedFvPatchScalarField::updateCoeffs();
557 Info<<
patch().boundaryMesh().mesh().name() <<
':' 558 <<
patch().name() <<
':' 559 << this->internalField().name() <<
" <- " 562 << this->internalField().name() <<
" :" 563 <<
" heat transfer rate:" << Q
564 <<
" walltemperature " 565 <<
" min:" <<
gMin(Tp)
566 <<
" max:" <<
gMax(Tp)
584 <<
"This T BC does not support energy coupling " 585 <<
"It is implemented on he field " 598 <<
"This BC does not support energy coupling " 599 <<
"Use compressible::turbulentTemperatureRadCoupledMixed " 600 <<
"which has more functionalities and it can handle " 601 <<
"the assemble coupled option for energy. " 609 turbulentTemperatureRadCoupledMixedFvPatchScalarField::alphaSfDelta()
const 615 tmp<scalarField> turbulentTemperatureRadCoupledMixedFvPatchScalarField::
618 const mappedPatchBase& mpp =
619 refCast<const mappedPatchBase>(
patch().patch());
621 if (!mpp.sameWorld())
624 <<
"coupled energy not supported in combination with multi-world" 628 const label samplePatchi = mpp.samplePolyPatch().index();
629 const polyMesh& nbrMesh = mpp.sampleMesh();
631 const fvPatch& nbrPatch =
632 refCast<const fvMesh>(nbrMesh).
boundary()[samplePatchi];
643 mpp.distribute(TcNbr);
647 nbrField.alpha(TcNbr)*nbrPatch.deltaCoeffs()
649 mpp.distribute(alphaDeltaNbr);
656 return (alphaDeltaNbr + alphaDelta);
660 tmp<scalarField> turbulentTemperatureRadCoupledMixedFvPatchScalarField::
663 const mappedPatchBase& mpp =
664 refCast<const mappedPatchBase>(
patch().patch());
666 if (!mpp.sameWorld())
669 <<
"coupled energy not supported in combination with multi-world" 673 const polyMesh& nbrMesh = mpp.sampleMesh();
675 const basicThermo* nbrThermo =
678 const polyMesh&
mesh =
patch().boundaryMesh().mesh();
680 const basicThermo* localThermo =
684 if (nbrThermo && localThermo)
686 const label patchi =
patch().index();
687 const scalarField& pp = localThermo->p().boundaryField()[patchi];
690 const mappedPatchBase& mpp =
691 refCast<const mappedPatchBase>(
patch().patch());
693 const label patchiNrb = mpp.samplePolyPatch().index();
695 const scalarField& ppNbr = nbrThermo->p().boundaryField()[patchiNrb];
705 - localThermo->he(pp, Tp, patchi)
706 + nbrThermo->he(ppNbr, Tp, patchiNrb)
712 <<
"Can't find thermos on mapped patch " 713 <<
" method, but thermo package not available" 729 os.writeEntryIfDifferent<
word>(
"Tnbr",
"T", TnbrName_);
732 os.writeEntryIfDifferent<
word>(
"qrNbr",
"none", qrNbrName_);
734 os.writeEntryIfDifferent<
word>(
"qr",
"none", qrName_);
737 os.writeEntry(
"thermalInertia", thermalInertia_);
742 thicknessLayer_().writeData(
os);
743 kappaLayer_().writeData(
os);
745 if (thicknessLayers_.
size())
761 turbulentTemperatureRadCoupledMixedFvPatchScalarField
word dictName() const
The local dictionary name (final part of scoped name)
virtual void rmap(const fvPatchField< scalar > &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
void size(const label n)
Older name for setAddressableSize.
errorManipArg< error, int > exit(error &err, const int errNo=1)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
static const mappedPatchBase & mapper(const fvPatch &p, const DimensionedField< Type, volMesh > &iF)
Check that patch is of correct type.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Type gMin(const FieldField< Field, Type > &f)
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
const polyMesh & sampleMesh() const
Get the region mesh.
virtual void write(Ostream &os) const
Write.
Type & refCast(U &obj)
A dynamic_cast (for references) that generates FatalError on failed casts, uses the virtual type() me...
virtual tmp< scalarField > kappa(const scalarField &Tp) const
Given patch temperature calculate corresponding K field.
Ostream & endl(Ostream &os)
Add newline and flush stream.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
virtual tmp< scalarField > alpha(const scalarField &Tp) const
Given patch temperature calculate corresponding alphaEff field.
A simple wrapper around bool so that it can be read as a word: true/false, on/off, yes/no, any/none. Also accepts 0/1 as a string and shortcuts t/f, y/n.
Mixed boundary condition for temperature and radiation heat transfer to be used for in multiregion ca...
virtual void rmap(const fvPatchField< scalar > &, const labelList &)=0
Reverse map the given fvPatchField onto this fvPatchField.
static int & msgType() noexcept
Message tag of standard messages.
const GeometricField::Patch & lookupPatchField(const word &name, const GeometricField *=nullptr, const AnyType *=nullptr) const
Lookup the named field from the local registry and return the patch field corresponding to this patch...
virtual void autoMap(const fvPatchFieldMapper &)=0
Map (and resize as needed) from self given a mapping object.
void write(Ostream &os) const
Write.
Macros for easy insertion into run-time selection tables.
#define forAll(list, i)
Loop across all elements in list.
makePatchTypeField(fvPatchScalarField, alphatFixedDmdtWallBoilingWallFunctionFvPatchScalarField)
GeometricField< scalar, fvPatchField, volMesh > volScalarField
psiReactionThermo & thermo
void write(vtk::formatter &fmt, const Type &val, const label n=1)
Component-wise write of a value (N times)
bool sameWorld() const
Is sample world the local world?
Type gSum(const FieldField< Field, Type > &f)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
fvPatchField< scalar > fvPatchScalarField
virtual void manipulateMatrix(fvMatrix< scalar > &m, const label iMatrix, const direction cmpt)
Manipulate matrix.
A class for handling words, derived from Foam::string.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
A FieldMapper for finite-volume patch fields.
turbulentTemperatureRadCoupledMixedFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
Determines a mapping between patch face centres and mesh cell or face centres and processors they're ...
A special matrix type and solver, designed for finite volume solutions of scalar equations. Face addressing is used to make all matrix assembly and solution loops vectorise.
errorManip< error > abort(error &err)
virtual tmp< scalarField > kappa(const scalarField &Tp) const
Given patch temperature calculate corresponding K field. Override temperatureCoupledBase::kappa to in...
An Ostream is an abstract base class for all output systems (streams, files, token lists...
virtual void write(Ostream &os) const
Write.
int debug
Static debugging option.
Type gMax(const FieldField< Field, Type > &f)
OBJstream os(runTime.globalPath()/outputName)
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
void distribute(List< Type > &lst) const
Wrapper around map/interpolate data distribution.
Common functions used in temperature coupled boundaries.
Type gAverage(const FieldField< Field, Type > &f)
const dimensionedScalar c
Speed of light in a vacuum.
virtual void operator=(const UList< scalar > &)
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.
static autoPtr< PatchFunction1< Type > > NewIfPresent(const polyPatch &pp, const word &entryName, const dictionary &dict, const bool faceValues=true)
An optional selector.
messageStream Info
Information stream (stdout output on master, null elsewhere)
const word & samplePatch() const
Patch (only if NEARESTPATCHFACE)
void writeEntry(Ostream &os) const
Write the UList with its compound type.
Mesh consisting of general polyhedral cells.
label index() const noexcept
The index of this patch in the boundaryMesh.
A class for managing temporary objects.
const word & sampleRegion() const
Region to sample.
const polyPatch & samplePolyPatch() const
Get the patch on the region.
void distribute(const word &fieldName, Field< T > &newValues) const
Wrapper for mapDistribute::distribute that knows about dabase mapping.
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > snGrad(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
static constexpr const zero Zero
Global zero (0)