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 (
dict.found(
"refValue") && baffleActivated_)
142 valueFraction() = 0.0;
148 template<
class sol
idType>
156 mixedFvPatchScalarField(ptf),
158 baffleActivated_(ptf.baffleActivated_),
159 thickness_(ptf.thickness_),
161 solidDict_(ptf.solidDict_),
162 solidPtr_(ptf.solidPtr_),
163 qrPrevious_(ptf.qrPrevious_),
164 qrRelaxation_(ptf.qrRelaxation_),
169 template<
class sol
idType>
178 mixedFvPatchScalarField(ptf, iF),
180 baffleActivated_(ptf.baffleActivated_),
181 thickness_(ptf.thickness_),
183 solidDict_(ptf.solidDict_),
184 solidPtr_(ptf.solidPtr_),
185 qrPrevious_(ptf.qrPrevious_),
186 qrRelaxation_(ptf.qrRelaxation_),
193 template<
class sol
idType>
194 bool thermalBaffle1DFvPatchScalarField<solidType>::owner()
const 196 const label patchi =
patch().index();
198 const label nbrPatchi = samplePolyPatch().index();
200 return (patchi < nbrPatchi);
204 template<
class sol
idType>
205 const solidType& thermalBaffle1DFvPatchScalarField<solidType>::solid()
const 211 solidPtr_.reset(
new solidType(solidDict_));
217 const fvPatch& nbrPatch =
218 patch().boundaryMesh()[samplePolyPatch().index()];
220 const thermalBaffle1DFvPatchScalarField& nbrField =
221 refCast<const thermalBaffle1DFvPatchScalarField>
223 nbrPatch.template lookupPatchField<volScalarField, scalar>(TName_)
226 return nbrField.solid();
231 template<
class sol
idType>
232 tmp<scalarField> thermalBaffle1DFvPatchScalarField<solidType>::
233 baffleThickness()
const 237 if (thickness_.size() !=
patch().size())
240 <<
"Field thickness has not been specified" 241 " for patch " << this->
patch().name()
251 const fvPatch& nbrPatch =
252 patch().boundaryMesh()[samplePolyPatch().index()];
253 const thermalBaffle1DFvPatchScalarField& nbrField =
254 refCast<const thermalBaffle1DFvPatchScalarField>
256 nbrPatch.template lookupPatchField<volScalarField, scalar>(TName_)
259 tmp<scalarField> tthickness
264 mapDist.distribute(thickness);
270 template<
class sol
idType>
271 tmp<scalarField> thermalBaffle1DFvPatchScalarField<solidType>::qs()
const 281 const fvPatch& nbrPatch =
282 patch().boundaryMesh()[samplePolyPatch().index()];
284 const thermalBaffle1DFvPatchScalarField& nbrField =
285 refCast<const thermalBaffle1DFvPatchScalarField>
287 nbrPatch.template lookupPatchField<volScalarField, scalar>(TName_)
290 tmp<scalarField> tqs(
new scalarField(nbrField.qs()));
292 mapDist.distribute(qs);
298 template<
class sol
idType>
306 mixedFvPatchScalarField::autoMap(m);
310 thickness_.autoMap(m);
316 template<
class sol
idType>
323 mixedFvPatchScalarField::rmap(ptf, addr);
325 const thermalBaffle1DFvPatchScalarField& tiptf =
326 refCast<const thermalBaffle1DFvPatchScalarField>(ptf);
330 thickness_.rmap(tiptf.thickness_, addr);
331 qs_.rmap(tiptf.qs_, addr);
336 template<
class sol
idType>
350 const label patchi =
patch().index();
352 const label nbrPatchi = samplePolyPatch().index();
354 if (baffleActivated_)
356 const fvPatch& nbrPatch =
patch().boundaryMesh()[nbrPatchi];
359 db().template lookupObject<compressible::turbulenceModel>
365 const scalarField kappaw(turbModel.kappaEff(patchi));
368 patch().template lookupPatchField<volScalarField, scalar>(TName_);
373 if (qrName_ !=
"none")
375 qr =
patch().template lookupPatchField<volScalarField, scalar>
378 qr = qrRelaxation_*qr + (1.0 - qrRelaxation_)*qrPrevious_;
382 tmp<scalarField> Ti = patchInternalField();
388 turbModel.transport().
T().boundaryField()[nbrPatchi];
389 mapDist.distribute(nbrTp);
395 kappas[i] = solid().kappa(0.0, (Tp[i] + nbrTp[i])/2.0);
404 refValue() = (KDeltaSolid*nbrTp + qs()/2.0)/
alpha;
409 Info<<
patch().boundaryMesh().mesh().name() <<
':' 410 <<
patch().name() <<
':' 411 << this->internalField().name() <<
" <- " 412 << nbrPatch.name() <<
':' 413 << this->internalField().name() <<
" :" 415 <<
" walltemperature " 416 <<
" min:" <<
gMin(*
this)
417 <<
" max:" <<
gMax(*
this)
426 mixedFvPatchScalarField::updateCoeffs();
429 template<
class sol
idType>
437 baffleThickness()().writeEntry(
"thickness",
os);
438 qs()().writeEntry(
"qs",
os);
442 qrPrevious_.writeEntry(
"qrPrevious",
os);
443 os.writeEntry(
"qr", qrName_);
444 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.
void write(vtk::formatter &fmt, const Type &val, const label n=1)
Component-wise write of a value (N times)
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)
virtual void operator=(const UList< scalar > &)
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)
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)