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_)
256 tmp<scalarField> tthickness
261 mapDist.distribute(thickness);
267 template<
class sol
idType>
268 tmp<scalarField> thermalBaffle1DFvPatchScalarField<solidType>::qs()
const 278 const fvPatch& nbrPatch =
279 patch().boundaryMesh()[samplePolyPatch().index()];
281 const thermalBaffle1DFvPatchScalarField& nbrField =
282 refCast<const thermalBaffle1DFvPatchScalarField>
284 nbrPatch.template lookupPatchField<volScalarField>(TName_)
287 tmp<scalarField> tqs(
new scalarField(nbrField.qs()));
289 mapDist.distribute(qs);
295 template<
class sol
idType>
303 mixedFvPatchScalarField::autoMap(m);
307 thickness_.autoMap(m);
313 template<
class sol
idType>
320 mixedFvPatchScalarField::rmap(ptf, addr);
322 const thermalBaffle1DFvPatchScalarField& tiptf =
323 refCast<const thermalBaffle1DFvPatchScalarField>(ptf);
327 thickness_.rmap(tiptf.thickness_, addr);
328 qs_.rmap(tiptf.qs_, addr);
333 template<
class sol
idType>
347 const label patchi =
patch().index();
349 const label nbrPatchi = samplePolyPatch().index();
351 if (baffleActivated_)
353 const fvPatch& nbrPatch =
patch().boundaryMesh()[nbrPatchi];
356 db().template lookupObject<compressible::turbulenceModel>
362 const scalarField kappaw(turbModel.kappaEff(patchi));
365 patch().template lookupPatchField<volScalarField>(TName_);
370 if (qrName_ !=
"none")
372 qr =
patch().template lookupPatchField<volScalarField>(qrName_);
374 qr = qrRelaxation_*qr + (1.0 - qrRelaxation_)*qrPrevious_;
378 tmp<scalarField> Ti = patchInternalField();
384 turbModel.transport().
T().boundaryField()[nbrPatchi];
385 mapDist.distribute(nbrTp);
391 kappas[i] = solid().kappa(0.0, (Tp[i] + nbrTp[i])/2.0);
400 refValue() = (KDeltaSolid*nbrTp + qs()/2.0)/
alpha;
405 Info<<
patch().boundaryMesh().mesh().name() <<
':' 406 <<
patch().name() <<
':' 407 << this->internalField().name() <<
" <- " 408 << nbrPatch.name() <<
':' 409 << this->internalField().name() <<
" :" 411 <<
" walltemperature " 412 <<
" min:" <<
gMin(*
this)
413 <<
" max:" <<
gMax(*
this)
422 mixedFvPatchScalarField::updateCoeffs();
425 template<
class sol
idType>
433 baffleThickness()().writeEntry(
"thickness",
os);
434 qs()().writeEntry(
"qs",
os);
438 qrPrevious_.writeEntry(
"qrPrevious",
os);
439 os.writeEntry(
"qr", qrName_);
440 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)
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.
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)