40 Foam::externalCoupledTemperatureMixedFvPatchScalarField::
43Foam::externalCoupledTemperatureMixedFvPatchScalarField::outputTemperatureNames
45 { outputTemperatureType::FLUID,
"fluid" },
46 { outputTemperatureType::WALL,
"wall" },
52 Foam::externalCoupledTemperatureMixedFvPatchScalarField::
55Foam::externalCoupledTemperatureMixedFvPatchScalarField::refTemperatureNames
57 { refTemperatureType::CELL,
"cell" },
58 { refTemperatureType::USER,
"user" },
64void Foam::externalCoupledTemperatureMixedFvPatchScalarField::writeHeader
69 if (outTempType_ == outputTemperatureType::WALL)
71 os <<
"# Values: area Twall qDot htc" <<
endl;
75 os <<
"# Values: area Tfluid qDot htc" << endl;
82Foam::externalCoupledTemperatureMixedFvPatchScalarField::
83externalCoupledTemperatureMixedFvPatchScalarField
89 externalCoupledMixedFvPatchField<scalar>(
p, iF),
90 outTempType_(outputTemperatureType::WALL),
91 refTempType_(refTemperatureType::CELL),
96Foam::externalCoupledTemperatureMixedFvPatchScalarField::
97externalCoupledTemperatureMixedFvPatchScalarField
101 const DimensionedField<scalar, volMesh>& iF,
102 const fvPatchFieldMapper& mapper
105 externalCoupledMixedFvPatchField<scalar>(
rhs,
p, iF, mapper),
106 outTempType_(
rhs.outTempType_),
107 refTempType_(
rhs.refTempType_),
112Foam::externalCoupledTemperatureMixedFvPatchScalarField::
113externalCoupledTemperatureMixedFvPatchScalarField
116 const DimensionedField<scalar, volMesh>& iF,
121 externalCoupledMixedFvPatchField<scalar>(
p, iF),
122 outTempType_(outputTemperatureType::WALL),
125 refTemperatureNames.getOrDefault
129 refTemperatureType::CELL
134 if (
dict.found(
"outputTemperature"))
136 outTempType_ = outputTemperatureNames.get(
"outputTemperature", dict);
141 <<
"outputTemperature not specified "
142 << flatOutput(outputTemperatureNames) << nl
143 <<
"using 'wall' as compatibility default" << nl
147 if (refTempType_ == refTemperatureType::USER)
149 Tref_ = Function1<scalar>::New(
"Tref",
dict, &db());
152 if (this->readMixedEntries(
dict))
161 if (!this->readValueEntry(
dict))
163 fvPatchField<scalar>::extrapolateInternal();
167 this->refValue() = *
this;
168 this->refGrad() = Zero;
169 this->valueFraction() = 1.0;
174Foam::externalCoupledTemperatureMixedFvPatchScalarField::
175externalCoupledTemperatureMixedFvPatchScalarField
180 externalCoupledMixedFvPatchField<scalar>(rhs),
181 outTempType_(rhs.outTempType_),
182 refTempType_(rhs.refTempType_),
183 Tref_(rhs.Tref_.
clone())
187Foam::externalCoupledTemperatureMixedFvPatchScalarField::
188externalCoupledTemperatureMixedFvPatchScalarField
191 const DimensionedField<scalar, volMesh>& iF
194 externalCoupledMixedFvPatchField<scalar>(rhs, iF),
195 outTempType_(rhs.outTempType_),
196 refTempType_(rhs.refTempType_),
197 Tref_(rhs.Tref_.
clone())
203void Foam::externalCoupledTemperatureMixedFvPatchScalarField::writeData
208 const label patchi = patch().index();
211 scalarField qDot(this->patch().size(), Zero);
213 typedef compressible::turbulenceModel cmpTurbModelType;
219 turbulenceModel::propertiesName,
220 internalField().group()
224 static word thermoName(
"thermophysicalProperties");
226 if (db().foundObject<cmpTurbModelType>(turbName))
228 const cmpTurbModelType& turbModel =
229 db().lookupObject<cmpTurbModelType>(turbName);
231 const basicThermo&
thermo = turbModel.transport();
233 const fvPatchScalarField& hep =
thermo.he().boundaryField()[patchi];
235 qDot = turbModel.alphaEff(patchi)*hep.snGrad();
237 else if (db().foundObject<basicThermo>(thermoName))
239 const basicThermo&
thermo = db().lookupObject<basicThermo>(thermoName);
243 qDot =
thermo.alpha().boundaryField()[patchi]*hep.
snGrad();
248 <<
"Condition requires either compressible turbulence and/or "
249 <<
"thermo model to be available" <<
exit(FatalError);
259 if (refTempType_ == refTemperatureType::USER)
262 const scalar currTref =
263 Tref_->value(this->db().time().timeOutputValue());
270 this->patchInternalField(Tfluid);
279 const scalar deltaT =
mag(Twall[i] - Tfluid[i]);
282 htc[i] =
sign(qDot[i])*qDot[i]/deltaT;
286 const Field<scalar>& magSf = this->
patch().magSf();
288 const UList<scalar>& Tout =
290 outTempType_ == outputTemperatureType::FLUID
297 os << magSf[facei] << token::SPACE
298 << Tout[facei] << token::SPACE
299 << qDot[facei] << token::SPACE
305void Foam::externalCoupledTemperatureMixedFvPatchScalarField::readData
322 >> this->refValue()[facei]
323 >> this->refGrad()[facei]
324 >> this->valueFraction()[facei];
329void Foam::externalCoupledTemperatureMixedFvPatchScalarField::write
338 outputTemperatureNames[outTempType_]
343 refTemperatureNames[refTempType_]
348 Tref_->writeData(
os);
Macros for easy insertion into run-time selection tables.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
Generic input stream using a standard (STL) stream.
Input from string buffer, using a ISstream. Always UNCOMPRESSED.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
virtual tmp< Field< Type > > snGrad() const
Return patch-normal gradient.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
virtual void write(Ostream &) const
Write.
Basic thermodynamics type based on the use of fitting functions for cp, h, s obtained from the templa...
virtual tmp< fvPatchField< scalar > > clone() const
Return a clone.
externalCoupledTemperatureMixedFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
#define makePatchTypeField(PatchTypeField, typePatchTypeField)
Define a concrete fvPatchField type and add to run-time tables Example, (fvPatchScalarField,...
const std::string patch
OpenFOAM patch number as a std::string.
string evaluate(label fieldWidth, const std::string &s, size_t pos=0, size_t len=std::string::npos)
String evaluation with specified (positive, non-zero) field width.
dimensionedScalar sign(const dimensionedScalar &ds)
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Ostream & endl(Ostream &os)
Add newline and flush stream.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
void rhs(fvMatrix< typename Expr::value_type > &m, const Expr &expression)
errorManipArg< error, int > exit(error &err, const int errNo=1)
fvPatchField< scalar > fvPatchScalarField
psiReactionThermo & thermo
#define forAll(list, i)
Loop across all elements in list.