53 mixedFvPatchScalarField(
p, iF),
67 TnbrName_(
"undefined-Tnbr"),
68 qrNbrName_(
"undefined-qrNbr"),
69 qrName_(
"undefined-qr"),
70 thermalInertia_(
false)
72 this->refValue() = 0.0;
73 this->refGrad() = 0.0;
74 this->valueFraction() = 1.0;
88 mixedFvPatchScalarField(psf,
p, iF, mapper),
96 TnbrName_(psf.TnbrName_),
97 qrNbrName_(psf.qrNbrName_),
99 thicknessLayers_(psf.thicknessLayers_),
100 thicknessLayer_(psf.thicknessLayer_.clone(
p.
patch())),
101 kappaLayers_(psf.kappaLayers_),
102 kappaLayer_(psf.kappaLayer_.clone(
p.
patch())),
103 thermalInertia_(psf.thermalInertia_)
115 mixedFvPatchScalarField(
p, iF),
123 TnbrName_(
dict.getOrDefault<
word>(
"Tnbr",
"T")),
124 qrNbrName_(
dict.getOrDefault<
word>(
"qrNbr",
"none")),
125 qrName_(
dict.getOrDefault<
word>(
"qr",
"none")),
126 thermalInertia_(
dict.getOrDefault<
Switch>(
"thermalInertia", false))
128 if (!isA<mappedPatchBase>(this->
patch().
patch()))
131 <<
"' not type '" << mappedPatchBase::typeName <<
"'"
132 <<
"\n for patch " <<
p.name()
133 <<
" of field " << internalField().name()
134 <<
" in file " << internalField().objectPath()
180 if (
dict.readIfPresent(
"thicknessLayers", thicknessLayers_))
182 dict.readEntry(
"kappaLayers", kappaLayers_);
200 if (
dict.found(
"refValue"))
212 valueFraction() = 1.0;
216 if (
dict.readIfPresent(
"useImplicit", boolVal))
218 this->useImplicit(boolVal);
220 if (
dict.found(
"source"))
234 const turbulentTemperatureRadCoupledMixedFvPatchScalarField& psf,
238 mixedFvPatchScalarField(psf, iF),
246 TnbrName_(psf.TnbrName_),
247 qrNbrName_(psf.qrNbrName_),
248 qrName_(psf.qrName_),
249 thicknessLayers_(psf.thicknessLayers_),
250 thicknessLayer_(psf.thicknessLayer_.clone(
patch().
patch())),
251 kappaLayers_(psf.kappaLayers_),
253 thermalInertia_(psf.thermalInertia_)
263 mixedFvPatchScalarField(psf),
271 TnbrName_(psf.TnbrName_),
272 qrNbrName_(psf.qrNbrName_),
273 qrName_(psf.qrName_),
274 thicknessLayers_(psf.thicknessLayers_),
275 thicknessLayer_(psf.thicknessLayer_.clone(
patch().
patch())),
276 kappaLayers_(psf.kappaLayers_),
277 kappaLayer_(psf.kappaLayer_.clone(
patch().
patch())),
278 thermalInertia_(psf.thermalInertia_)
289 mixedFvPatchScalarField::autoMap(
mapper);
295 kappaLayer_().autoMap(
mapper);
306 mixedFvPatchScalarField::rmap(ptf, addr);
318 thicknessLayer_().rmap(tiptf.thicknessLayer_(), addr);
319 kappaLayer_().rmap(tiptf.kappaLayer_(), addr);
334 if (thicknessLayer_ || thicknessLayers_.size())
343 const scalar t = db().time().timeOutputValue();
345 thicknessLayer_().value(t)
346 /kappaLayer_().value(t);
348 if (thicknessLayers_.size())
350 forAll(thicknessLayers_, iLayer)
352 KDelta += thicknessLayers_[iLayer]/kappaLayers_[iLayer];
373 const polyMesh&
mesh =
patch().boundaryMesh().mesh();
381 const label patchi =
patch().index();
382 const mappedPatchBase& mpp =
386 this->internalField()
400 const polyMesh& nbrMesh = mpp.sampleMesh();
401 const label samplePatchi = mpp.samplePolyPatch().index();
402 const fvPatch& nbrPatch =
403 refCast<const fvMesh>(nbrMesh).boundary()[samplePatchi];
412 TcNbr = nbrField.patchInternalField();
413 KDeltaNbr = nbrField.kappa(nbrField)*nbrPatch.deltaCoeffs();
419 TcNbr = patchInternalField();
427 if (qrName_ !=
"none")
433 if (qrNbrName_ !=
"none")
437 const polyMesh& nbrMesh = mpp.sampleMesh();
438 const label samplePatchi = mpp.samplePolyPatch().index();
439 const fvPatch& nbrPatch =
440 refCast<const fvMesh>(nbrMesh).boundary()[samplePatchi];
453 if (thermalInertia_ && !mpp.sameWorld())
456 <<
"thermalInertia not supported in combination with multi-world"
461 const scalar dt =
mesh.time().deltaTValue();
465 const polyMesh& nbrMesh = mpp.sampleMesh();
467 const basicThermo*
thermo =
472 const label samplePatchi = mpp.samplePolyPatch().index();
473 const fvPatch& nbrPatch =
474 refCast<const fvMesh>(nbrMesh).boundary()[samplePatchi];
476 thermo->p().boundaryField()[samplePatchi];
478 thermo->T().boundaryField()[samplePatchi];
482 thermo->Cp(ppn, Tpn, samplePatchi)
483 *
thermo->rho(samplePatchi)
484 / nbrPatch.deltaCoeffs()/dt
487 mpp.distribute(mCpDtNbr);
491 mCpDtNbr.setSize(Tp.size(),
Zero);
499 const basicThermo*
thermo =
508 thermo->Cp(pp, Tp, patchi)
510 /
patch().deltaCoeffs()/dt
516 mCpDt.setSize(Tp.size(),
Zero);
523 this->internalField().name()
526 const fvPatchField<scalar>& TpOld =
T.oldTime().boundaryField()[patchi];
531 scalarField c(KDeltaNbr*TcNbr + (mCpDt + mCpDtNbr)*TpOld);
533 refGrad() = (qr + qrNbr)/kappaTp;
537 valueFraction() = KDeltaNbr/(KDeltaNbr + KDelta);
539 refGrad() = (qr + qrNbr)/kappaTp;
545 if (this->useImplicit())
550 valueFraction()*deltaH()
551 + (qr + qrNbr)/beta()
555 mixedFvPatchScalarField::updateCoeffs();
561 Info<<
patch().boundaryMesh().mesh().name() <<
':'
562 <<
patch().name() <<
':'
563 << this->internalField().name() <<
" <- "
564 << mpp.sampleRegion() <<
':'
565 << mpp.samplePatch() <<
':'
566 << this->internalField().name() <<
" :"
567 <<
" heat transfer rate:" << Q
568 <<
" walltemperature "
569 <<
" min:" <<
gMin(Tp)
570 <<
" max:" <<
gMax(Tp)
588 <<
"This T BC does not support energy coupling "
589 <<
"It is implemented on he field "
602 <<
"This BC does not support energy coupling "
603 <<
"Use compressible::turbulentTemperatureRadCoupledMixed "
604 <<
"which has more functionalities and it can handle "
605 <<
"the assemble coupled option for energy. "
613 turbulentTemperatureRadCoupledMixedFvPatchScalarField::alphaSfDelta()
const
619 tmp<scalarField> turbulentTemperatureRadCoupledMixedFvPatchScalarField::
622 const mappedPatchBase& mpp =
623 refCast<const mappedPatchBase>(
patch().
patch());
625 if (!mpp.sameWorld())
628 <<
"coupled energy not supported in combination with multi-world"
632 const label samplePatchi = mpp.samplePolyPatch().index();
633 const polyMesh& nbrMesh = mpp.sampleMesh();
635 const fvPatch& nbrPatch =
636 refCast<const fvMesh>(nbrMesh).boundary()[samplePatchi];
647 mpp.distribute(TcNbr);
651 nbrField.alpha(TcNbr)*nbrPatch.deltaCoeffs()
653 mpp.distribute(alphaDeltaNbr);
660 return (alphaDeltaNbr + alphaDelta);
664 tmp<scalarField> turbulentTemperatureRadCoupledMixedFvPatchScalarField::
667 const mappedPatchBase& mpp =
668 refCast<const mappedPatchBase>(
patch().
patch());
670 if (!mpp.sameWorld())
673 <<
"coupled energy not supported in combination with multi-world"
677 const polyMesh& nbrMesh = mpp.sampleMesh();
679 const basicThermo* nbrThermo =
682 const polyMesh&
mesh =
patch().boundaryMesh().mesh();
684 const basicThermo* localThermo =
688 if (nbrThermo && localThermo)
690 const label patchi =
patch().index();
691 const scalarField& pp = localThermo->p().boundaryField()[patchi];
694 const mappedPatchBase& mpp =
695 refCast<const mappedPatchBase>(
patch().
patch());
697 const label patchiNrb = mpp.samplePolyPatch().index();
699 const scalarField& ppNbr = nbrThermo->p().boundaryField()[patchiNrb];
709 - localThermo->he(pp, Tp, patchi)
710 + nbrThermo->he(ppNbr, Tp, patchiNrb)
716 <<
"Can't find thermos on mapped patch "
717 <<
" method, but thermo package not available"
731 os.writeEntry(
"Tnbr", TnbrName_);
733 os.writeEntry(
"qrNbr", qrNbrName_);
734 os.writeEntry(
"qr", qrName_);
735 os.writeEntry(
"thermalInertia", thermalInertia_);
739 thicknessLayer_().writeData(
os);
740 kappaLayer_().writeData(
os);
742 if (thicknessLayers_.size())
744 thicknessLayers_.writeEntry(
"thicknessLayers",
os);
745 kappaLayers_.writeEntry(
"kappaLayers",
os);
758 turbulentTemperatureRadCoupledMixedFvPatchScalarField