43 template<
class sol
idType>
52 mixedFvPatchScalarField(
p, iF),
54 baffleActivated_(
true),
59 qrPrevious_(
p.size()),
61 qrName_(
"undefined-qr")
65 template<
class sol
idType>
76 mixedFvPatchScalarField(ptf,
p, iF, mapper),
78 baffleActivated_(ptf.baffleActivated_),
79 thickness_(ptf.thickness_, mapper),
81 solidDict_(ptf.solidDict_),
82 solidPtr_(ptf.solidPtr_),
83 qrPrevious_(ptf.qrPrevious_, mapper),
84 qrRelaxation_(ptf.qrRelaxation_),
89 template<
class sol
idType>
99 mixedFvPatchScalarField(
p, iF),
101 baffleActivated_(
dict.getOrDefault(
"baffleActivated", true)),
106 qrPrevious_(
p.size(),
Zero),
109 dict.getOrDefaultCompat(
"qrRelaxation", {{
"relaxation", 1712}}, 1)
111 qrName_(
dict.getOrDefault<word>(
"qr",
"none"))
115 if (
dict.found(
"thickness"))
120 if (
dict.found(
"qs"))
125 if (
dict.found(
"qrPrevious"))
130 if (baffleActivated_ && this->readMixedEntries(
dict))
139 valueFraction() = 0.0;
145 template<
class sol
idType>
153 mixedFvPatchScalarField(ptf),
155 baffleActivated_(ptf.baffleActivated_),
156 thickness_(ptf.thickness_),
158 solidDict_(ptf.solidDict_),
159 solidPtr_(ptf.solidPtr_),
160 qrPrevious_(ptf.qrPrevious_),
161 qrRelaxation_(ptf.qrRelaxation_),
166 template<
class sol
idType>
175 mixedFvPatchScalarField(ptf, iF),
177 baffleActivated_(ptf.baffleActivated_),
178 thickness_(ptf.thickness_),
180 solidDict_(ptf.solidDict_),
181 solidPtr_(ptf.solidPtr_),
182 qrPrevious_(ptf.qrPrevious_),
183 qrRelaxation_(ptf.qrRelaxation_),
190 template<
class sol
idType>
191 bool thermalBaffle1DFvPatchScalarField<solidType>::owner()
const 193 const label patchi =
patch().index();
195 const label nbrPatchi = samplePolyPatch().index();
197 return (patchi < nbrPatchi);
201 template<
class sol
idType>
202 const solidType& thermalBaffle1DFvPatchScalarField<solidType>::solid()
const 208 solidPtr_.reset(
new solidType(solidDict_));
214 const fvPatch& nbrPatch =
215 patch().boundaryMesh()[samplePolyPatch().index()];
217 const thermalBaffle1DFvPatchScalarField& nbrField =
218 refCast<const thermalBaffle1DFvPatchScalarField>
220 nbrPatch.template lookupPatchField<volScalarField>(TName_)
223 return nbrField.solid();
228 template<
class sol
idType>
229 tmp<scalarField> thermalBaffle1DFvPatchScalarField<solidType>::
230 baffleThickness()
const 234 if (thickness_.size() !=
patch().size())
237 <<
"Field thickness has not been specified" 238 " for patch " << this->
patch().name()
248 const fvPatch& nbrPatch =
249 patch().boundaryMesh()[samplePolyPatch().index()];
250 const thermalBaffle1DFvPatchScalarField& nbrField =
251 refCast<const thermalBaffle1DFvPatchScalarField>
253 nbrPatch.template lookupPatchField<volScalarField>(TName_)
257 auto& thickness = tthickness.ref();
259 mapDist.distribute(thickness);
265 template<
class sol
idType>
266 tmp<scalarField> thermalBaffle1DFvPatchScalarField<solidType>::qs()
const 276 const fvPatch& nbrPatch =
277 patch().boundaryMesh()[samplePolyPatch().index()];
279 const thermalBaffle1DFvPatchScalarField& nbrField =
280 refCast<const thermalBaffle1DFvPatchScalarField>
282 nbrPatch.template lookupPatchField<volScalarField>(TName_)
286 auto& qs = tqs.ref();
288 mapDist.distribute(qs);
294 template<
class sol
idType>
302 mixedFvPatchScalarField::autoMap(m);
306 thickness_.autoMap(m);
312 template<
class sol
idType>
319 mixedFvPatchScalarField::rmap(ptf, addr);
321 const thermalBaffle1DFvPatchScalarField& tiptf =
322 refCast<const thermalBaffle1DFvPatchScalarField>(ptf);
326 thickness_.rmap(tiptf.thickness_, addr);
327 qs_.rmap(tiptf.qs_, addr);
332 template<
class sol
idType>
345 const label patchi =
patch().index();
347 const label nbrPatchi = samplePolyPatch().index();
349 if (baffleActivated_)
351 const fvPatch& nbrPatch =
patch().boundaryMesh()[nbrPatchi];
354 db().template lookupObject<compressible::turbulenceModel>
360 const scalarField kappaw(turbModel.kappaEff(patchi));
363 patch().template lookupPatchField<volScalarField>(TName_);
368 if (qrName_ !=
"none")
370 qr =
patch().template lookupPatchField<volScalarField>(qrName_);
372 qr = qrRelaxation_*qr + (1.0 - qrRelaxation_)*qrPrevious_;
376 tmp<scalarField> Ti = patchInternalField();
382 turbModel.transport().
T().boundaryField()[nbrPatchi];
383 mapDist.distribute(nbrTp);
389 kappas[i] = solid().kappa(0.0, (Tp[i] + nbrTp[i])/2.0);
398 refValue() = (KDeltaSolid*nbrTp + qs()/2.0)/
alpha;
403 Info<<
patch().boundaryMesh().mesh().name() <<
':' 404 <<
patch().name() <<
':' 405 << this->internalField().name() <<
" <- " 406 << nbrPatch.name() <<
':' 407 << this->internalField().name() <<
" :" 409 <<
" walltemperature " 410 <<
" min:" <<
gMin(*
this)
411 <<
" max:" <<
gMax(*
this)
419 mixedFvPatchScalarField::updateCoeffs();
422 template<
class sol
idType>
430 baffleThickness()().writeEntry(
"thickness",
os);
431 qs()().writeEntry(
"qs",
os);
435 qrPrevious_.writeEntry(
"qrPrevious",
os);
436 os.writeEntry(
"qr", qrName_);
437 os.writeEntry(
"qrRelaxation", qrRelaxation_);
thermalBaffle1DFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
virtual void write(Ostream &) const
Write.
errorManipArg< error, int > exit(error &err, const int errNo=1)
static int incrMsgType(int val=1) noexcept
Increment the message tag for standard messages.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Type gMin(const FieldField< Field, Type > &f)
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
ThermalDiffusivity< CompressibleTurbulenceModel< fluidThermo > > turbulenceModel
Ostream & endl(Ostream &os)
Add newline and flush stream.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
static int & msgType() noexcept
Message tag of standard messages.
virtual void rmap(const fvPatchScalarField &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
const mapDistribute & map() const
Return reference to the parallel distribution map.
#define forAll(list, i)
Loop across all elements in list.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
fvPatchField< scalar > fvPatchScalarField
static const word propertiesName
Default name of the turbulence properties dictionary.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
A FieldMapper for finite-volume patch fields.
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 ...
An Ostream is an abstract base class for all output systems (streams, files, token lists...
int debug
Static debugging option.
Type gMax(const FieldField< Field, Type > &f)
OBJstream os(runTime.globalPath()/outputName)
virtual void write(Ostream &os) const
Write as a dictionary.
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Type gAverage(const FieldField< Field, Type > &f)
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.
messageStream Info
Information stream (stdout output on master, null elsewhere)
This BC solves a steady 1D thermal baffle.
tmp< Field< Type > > T() const
Return the field transpose (only defined for second rank tensors)
virtual void write(Ostream &) const
Write.
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > snGrad(const GeometricField< Type, fvPatchField, volMesh > &vf, const word &name)
IOerror FatalIOError
Error stream (stdout output on all processes), with additional 'FOAM FATAL IO ERROR' header text and ...
static constexpr const zero Zero
Global zero (0)