32 #include "phaseSystem.H"
44 turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField::regionTypeNames_
46 { regionType::solid,
"solid" },
57 turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField::KMethodTypeNames_
59 { KMethodType::mtSolidThermo,
"solidThermo" },
60 { KMethodType::mtLookup,
"lookup" },
61 { KMethodType::mtPhaseSystem,
"phaseSystem" }
69 turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField::
75 const polyMesh&
mesh =
patch().boundaryMesh().mesh();
76 const label patchi =
patch().index();
82 const solidThermo&
thermo =
85 return thermo.kappa(patchi);
108 return n & KWall &
n;
113 <<
"Did not find field " << kappaName_
114 <<
" on mesh " <<
mesh.name() <<
" patch " <<
patch().name()
116 <<
" Please set 'kappa' to the name of a volScalarField"
117 <<
" or volSymmTensorField."
129 const phaseSystem&
fluid =
131 mesh.lookupObject<phaseSystem>(
"phaseProperties")
156 <<
"Unimplemented method " << KMethodTypeNames_[method_] <<
nl
157 <<
"Please set 'kappaMethod' to one of "
159 <<
"and 'kappa' to the name of the volScalar"
181 const DimensionedField<scalar, volMesh>& iF
184 mixedFvPatchScalarField(
p, iF),
188 otherPhaseName_(
"vapor"),
189 TnbrName_(
"undefined-Tnbr"),
190 qrNbrName_(
"undefined-qrNbr"),
191 qrName_(
"undefined-qr")
193 this->refValue() = 0.0;
194 this->refGrad() = 0.0;
195 this->valueFraction() = 1.0;
199 turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField::
200 turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField
202 const turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField& psf,
204 const DimensionedField<scalar, volMesh>& iF,
205 const fvPatchFieldMapper& mapper
208 mixedFvPatchScalarField(psf,
p, iF, mapper),
209 regionType_(psf.regionType_),
210 method_(psf.method_),
211 kappaName_(psf.kappaName_),
212 otherPhaseName_(psf.otherPhaseName_),
213 TnbrName_(psf.TnbrName_),
214 qrNbrName_(psf.qrNbrName_),
219 turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField::
220 turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField
223 const DimensionedField<scalar, volMesh>& iF,
224 const dictionary&
dict
227 mixedFvPatchScalarField(
p, iF),
228 regionType_(regionTypeNames_.
get(
"region",
dict)),
229 method_(KMethodTypeNames_.
get(
"kappaMethod",
dict)),
230 kappaName_(
dict.getOrDefault<word>(
"kappa",
"none")),
231 otherPhaseName_(
dict.
get<word>(
"otherPhase")),
232 TnbrName_(
dict.getOrDefault<word>(
"Tnbr",
"T")),
233 qrNbrName_(
dict.getOrDefault<word>(
"qrNbr",
"none")),
234 qrName_(
dict.getOrDefault<word>(
"qr",
"none"))
236 if (!isA<mappedPatchBase>(this->
patch().
patch()))
239 <<
"' not type '" << mappedPatchBase::typeName <<
"'"
240 <<
"\n for patch " <<
p.name()
241 <<
" of field " << internalField().name()
242 <<
" in file " << internalField().objectPath()
248 if (
dict.found(
"refValue"))
260 valueFraction() = 1.0;
265 turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField::
266 turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField
268 const turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField& psf,
269 const DimensionedField<scalar, volMesh>& iF
272 mixedFvPatchScalarField(psf, iF),
273 regionType_(psf.regionType_),
274 method_(psf.method_),
275 kappaName_(psf.kappaName_),
276 otherPhaseName_(psf.otherPhaseName_),
277 TnbrName_(psf.TnbrName_),
278 qrNbrName_(psf.qrNbrName_),
285 void turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField::
293 const polyMesh&
mesh =
patch().boundaryMesh().mesh();
297 int oldTag = UPstream::msgType();
298 UPstream::msgType() = oldTag+1;
301 const label patchi =
patch().index();
302 const mappedPatchBase& mpp =
303 refCast<const mappedPatchBase>(
patch().
patch());
304 const polyMesh& nbrMesh = mpp.sampleMesh();
305 const label samplePatchi = mpp.samplePolyPatch().index();
306 const fvPatch& nbrPatch =
307 refCast<const fvMesh>(nbrMesh).boundary()[samplePatchi];
311 const turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField&
313 <
const turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField>
320 mpp.distribute(TcNbr);
325 KDeltaNbr = nbrField.kappa(nbrField)*nbrPatch.deltaCoeffs();
326 mpp.distribute(KDeltaNbr);
331 if (qrName_ !=
"none")
337 if (qrNbrName_ !=
"none")
339 qrNbr = nbrPatch.lookupPatchField<
volScalarField, scalar>(qrNbrName_);
340 mpp.distribute(qrNbr);
344 if (regionType_ == solid)
347 const phaseSystem&
fluid =
349 nbrMesh.lookupObject<phaseSystem>(
"phaseProperties")
353 const phaseModel& liquid
355 fluid.phases()[nbrField.internalField().group()]
358 const phaseModel& vapor(
fluid.phases()[otherPhaseName_]);
364 alphal*(liquid.kappaEff(samplePatchi))*nbrPatch.deltaCoeffs();
365 mpp.distribute(KDeltaLiqNbr);
370 alphav*(vapor.kappaEff(samplePatchi))*nbrPatch.deltaCoeffs();
371 mpp.distribute(KDeltaVapNbr);
375 vapor.thermo().T().boundaryField()[samplePatchi];
377 mpp.distribute(TvNbr);
385 scalarField KDeltaLiqVapNbr(KDeltaLiqNbr + KDeltaVapNbr);
386 valueFraction() = KDeltaLiqVapNbr/(KDeltaLiqVapNbr + KDelta);
387 refValue() =
c/KDeltaLiqVapNbr;
388 refGrad() = (qr + qrNbr)/
kappa(Tp);
397 <<
" heat transfer rate from solid:" << Q
398 <<
" walltemperature "
399 <<
" min:" <<
gMin(Tp)
400 <<
" max:" <<
gMax(Tp)
405 else if (regionType_ ==
fluid)
407 const phaseSystem&
fluid =
409 mesh.lookupObject<phaseSystem>(
"phaseProperties")
412 const phaseModel& liquid
417 const phaseModel& vapor(
fluid.phases()[otherPhaseName_]);
420 vapor.thermo().T().boundaryField()[patchi];
426 alphav*(vapor.kappaEff(patchi))*
patch().deltaCoeffs()
433 alphal*(liquid.kappaEff(patchi))*
patch().deltaCoeffs()
438 const scalarField c(TcNbr*KDeltaNbr + Tv.patchInternalField()*KdeltaVap);
442 valueFraction() = a/(a + KdeltaLiq);
444 refGrad() = (qr + qrNbr)/
kappa(Tp);
450 scalarField qVap((Tp - Tv.patchInternalField())*KdeltaVap);
457 scalar QLiq =
gSum(qLiq*
patch().magSf());
458 scalar QVap =
gSum(qVap*
patch().magSf());
460 Info<<
" Heat transfer to Liq: " << QLiq <<
endl;
461 Info<<
" Heat transfer to Vap: " << QVap <<
endl;
463 Info<<
" walltemperature "
464 <<
" min:" <<
gMin(Tp)
465 <<
" max:" <<
gMax(Tp)
473 <<
"Unknown phase type. Valid types are: "
477 mixedFvPatchScalarField::updateCoeffs();
480 UPstream::msgType() = oldTag;
490 os.writeEntry(
"kappaMethod", KMethodTypeNames_[method_]);
491 os.writeEntryIfDifferent<word>(
"kappa",
"none", kappaName_);
493 os.writeEntry(
"Tnbr", TnbrName_);
495 os.writeEntryIfDifferent<word>(
"qrNbr",
"none", qrNbrName_);
496 os.writeEntryIfDifferent<word>(
"qr",
"none", qrName_);
498 os.writeEntry(
"region", regionTypeNames_[regionType_]);
499 os.writeEntry(
"otherPhase", otherPhaseName_);
508 turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField