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);
97 return patch().patchField(*ptr);
110 return n & KWall &
n;
116 <<
"Did not find field " << kappaName_
117 <<
" on mesh " <<
mesh.name() <<
" patch " <<
patch().name()
119 <<
" Please set 'kappa' to the name of a volScalarField" 120 <<
" or volSymmTensorField." 129 const phaseSystem&
fluid =
131 mesh.lookupObject<phaseSystem>(
"phaseProperties")
154 <<
"Unimplemented method " << KMethodTypeNames_[method_] <<
nl 155 <<
"Please set 'kappaMethod' to one of " 157 <<
"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()
247 this->readValueEntry(
dict, IOobjectOption::MUST_READ);
249 if (this->readMixedEntries(
dict))
258 valueFraction() = 1.0;
263 turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField::
264 turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField
266 const turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField& psf,
267 const DimensionedField<scalar, volMesh>& iF
270 mixedFvPatchScalarField(psf, iF),
271 regionType_(psf.regionType_),
272 method_(psf.method_),
273 kappaName_(psf.kappaName_),
274 otherPhaseName_(psf.otherPhaseName_),
275 TnbrName_(psf.TnbrName_),
276 qrNbrName_(psf.qrNbrName_),
283 void turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField::
291 const polyMesh&
mesh =
patch().boundaryMesh().mesh();
295 const int oldTag = UPstream::incrMsgType();
298 const label patchi =
patch().index();
299 const mappedPatchBase& mpp =
300 refCast<const mappedPatchBase>(
patch().patch());
301 const polyMesh& nbrMesh = mpp.sampleMesh();
302 const label samplePatchi = mpp.samplePolyPatch().index();
303 const fvPatch& nbrPatch =
304 refCast<const fvMesh>(nbrMesh).
boundary()[samplePatchi];
308 const auto& nbrField =
311 const turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField
316 mpp.distribute(TcNbr);
321 KDeltaNbr = nbrField.kappa(nbrField)*nbrPatch.deltaCoeffs();
322 mpp.distribute(KDeltaNbr);
327 if (qrName_ !=
"none")
333 if (qrNbrName_ !=
"none")
336 mpp.distribute(qrNbr);
340 if (regionType_ == solid)
343 const phaseSystem&
fluid =
345 nbrMesh.lookupObject<phaseSystem>(
"phaseProperties")
349 const phaseModel& liquid
351 fluid.phases()[nbrField.internalField().group()]
354 const phaseModel& vapor(
fluid.phases()[otherPhaseName_]);
360 alphal*(liquid.kappaEff(samplePatchi))*nbrPatch.deltaCoeffs();
361 mpp.distribute(KDeltaLiqNbr);
366 alphav*(vapor.kappaEff(samplePatchi))*nbrPatch.deltaCoeffs();
367 mpp.distribute(KDeltaVapNbr);
371 vapor.thermo().
T().boundaryField()[samplePatchi];
372 TvNbr = Tv.patchInternalField();
373 mpp.distribute(TvNbr);
381 scalarField KDeltaLiqVapNbr(KDeltaLiqNbr + KDeltaVapNbr);
382 valueFraction() = KDeltaLiqVapNbr/(KDeltaLiqVapNbr + KDelta);
383 refValue() =
c/KDeltaLiqVapNbr;
384 refGrad() = (qr + qrNbr)/
kappa(Tp);
393 <<
" heat transfer rate from solid:" << Q
394 <<
" walltemperature " 395 <<
" min:" <<
gMin(Tp)
396 <<
" max:" <<
gMax(Tp)
401 else if (regionType_ ==
fluid)
403 const phaseSystem&
fluid =
405 mesh.lookupObject<phaseSystem>(
"phaseProperties")
408 const phaseModel& liquid
410 fluid.phases()[internalField().group()]
413 const phaseModel& vapor(
fluid.phases()[otherPhaseName_]);
416 vapor.thermo().
T().boundaryField()[patchi];
422 alphav*(vapor.kappaEff(patchi))*
patch().deltaCoeffs()
429 alphal*(liquid.kappaEff(patchi))*
patch().deltaCoeffs()
434 const scalarField c(TcNbr*KDeltaNbr + Tv.patchInternalField()*KdeltaVap);
438 valueFraction() = a/(a + KdeltaLiq);
440 refGrad() = (qr + qrNbr)/
kappa(Tp);
446 scalarField qVap((Tp - Tv.patchInternalField())*KdeltaVap);
453 scalar QLiq =
gSum(qLiq*
patch().magSf());
454 scalar QVap =
gSum(qVap*
patch().magSf());
456 Info<<
" Heat transfer to Liq: " << QLiq <<
endl;
457 Info<<
" Heat transfer to Vap: " << QVap <<
endl;
459 Info<<
" walltemperature " 460 <<
" min:" <<
gMin(Tp)
461 <<
" max:" <<
gMax(Tp)
469 <<
"Unknown phase type. Valid types are: " 473 UPstream::msgType(oldTag);
475 mixedFvPatchScalarField::updateCoeffs();
485 os.writeEntry(
"kappaMethod", KMethodTypeNames_[method_]);
486 os.writeEntryIfDifferent<word>(
"kappa",
"none", kappaName_);
488 os.writeEntry(
"Tnbr", TnbrName_);
490 os.writeEntryIfDifferent<word>(
"qrNbr",
"none", qrNbrName_);
491 os.writeEntryIfDifferent<word>(
"qr",
"none", qrName_);
493 os.writeEntry(
"region", regionTypeNames_[regionType_]);
494 os.writeEntry(
"otherPhase", otherPhaseName_);
503 turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
List of values generated by applying the access operation to each list item.
word dictName() const
The local dictionary name (final part of scoped name)
GeometricField< symmTensor, fvPatchField, volMesh > volSymmTensorField
Field< symmTensor > symmTensorField
Specialisation of Field<T> for symmTensor.
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...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Type gMin(const FieldField< Field, Type > &f)
constexpr char nl
The newline '\n' character (0x0a)
Type & refCast(U &obj)
A dynamic_cast (for references). Generates a FatalError on failed casts and uses the virtual type() m...
Ostream & endl(Ostream &os)
Add newline and flush stream.
const dimensionedScalar kappa
Coulomb constant: default SI units: [N.m2/C2].
Macros for easy insertion into run-time selection tables.
#define forAll(list, i)
Loop across all elements in list.
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)
Type gSum(const FieldField< Field, Type > &f)
fvPatchField< scalar > fvPatchScalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
static tmp< T > New(Args &&... args)
Construct tmp with forwarding arguments.
int debug
Static debugging option.
Type gMax(const FieldField< Field, Type > &f)
KMethodType
Type of supplied Kappa.
OBJstream os(runTime.globalPath()/outputName)
List< word > sortedToc() const
The sorted list of enum names.
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
Type gAverage(const FieldField< Field, Type > &f)
const dimensionedScalar c
Speed of light in a vacuum.
const std::string patch
OpenFOAM patch number as a std::string.
messageStream Info
Information stream (stdout output on master, null elsewhere)
tmp< Field< Type > > T() const
Return the field transpose (only defined for second rank tensors)
Field< vector > vectorField
Specialisation of Field<T> for vector.
#define makePatchTypeField(PatchTypeField, typePatchTypeField)
Define a concrete fvPatchField type and add to run-time tables Example, (fvPatchScalarField, calculatedFvPatchScalarField)
turbulentTemperatureTwoPhaseRadCoupledMixedFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
A class for managing temporary objects.
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
regionType
Enumeration listing the region.
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > snGrad(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.
static constexpr const zero Zero
Global zero (0)