35 namespace compressible
40 bool thermalBaffleFvPatchScalarField::primary()
const 46 bool thermalBaffleFvPatchScalarField::owner()
const 50 && patch().index() < patch().boundaryMesh()[nbrPatch_].index();
54 void thermalBaffleFvPatchScalarField::checkPatches()
const 56 if (!primary())
return;
58 const polyPatch& pp = patch().patch();
59 const polyPatch& nbrPp = patch().patch().boundaryMesh()[nbrPatch_];
62 auto checkPatchIsMapped = [&](
const polyPatch& pp)
64 if (!isA<mappedPatchBase>(pp))
67 <<
"Patch field of type \"" << typeName
68 <<
"\" specified for patch \"" << pp.name() <<
"\" of field \"" 69 << internalField().name() <<
"\", but this patch is not of " 70 <<
"type \"" << mappedPatchBase::typeName <<
"\"" 74 checkPatchIsMapped(pp);
75 checkPatchIsMapped(nbrPp);
77 const mappedPatchBase& mpp = refCast<const mappedPatchBase>(pp);
78 const mappedPatchBase nbrMpp = refCast<const mappedPatchBase>(nbrPp);
81 auto checkPatchMapsDifferentRegion = [&](
const mappedPatchBase& mpp)
86 <<
"Patch field of type \"" << typeName
87 <<
"\" specified for patch \"" << pp.name() <<
"\" of field \"" 88 << internalField().name() <<
"\", but this patch maps to " 89 <<
"another patch in the same region. It should map to a " 90 <<
"different region; i.e., that of the thermal baffle model." 94 checkPatchMapsDifferentRegion(mpp);
95 checkPatchMapsDifferentRegion(nbrMpp);
99 if (mpp.sampleRegion() != nbrMpp.sampleRegion())
102 <<
"Patch fields of type \"" << typeName
103 <<
"\" specified for patches \"" << pp.name() <<
"\" and \"" 104 << nbrPp.name() <<
"\" of field \"" << internalField().name()
105 <<
"\", but these patches map to different regions \"" 106 << mpp.sampleRegion() <<
"\" and \"" << nbrMpp.sampleRegion()
107 <<
". They should map to the same region; i.e., that of the " 108 <<
"thermal baffle model." 114 if (mpp.samplePatch() == nbrMpp.samplePatch())
117 <<
"Patch fields of type \"" << typeName
118 <<
"\" specified for patches \"" << pp.name() <<
"\" and \"" 119 << nbrPp.name() <<
"\" of field \"" << internalField().name()
120 <<
"\", but these patches map to the same patch; \"" 121 << mpp.samplePatch() <<
"\" of region \"" << mpp.sampleRegion()
122 <<
". They should map to different patches, as these will become " 123 <<
"the patches at opposite ends of the extruded baffle mesh." 129 void thermalBaffleFvPatchScalarField::checkPatchFields()
const 131 if (!primary())
return;
133 const fvPatch& fvp = patch();
134 const fvPatch& nbrFvp = patch().boundaryMesh()[nbrPatch_];
137 nbrFvp.lookupPatchField<
volScalarField, scalar>(internalField().name());
140 if (!isA<thermalBaffleFvPatchScalarField>(nbrTp))
143 <<
"Patch field of type \"" << typeName
144 <<
"\" specified for patch \"" << fvp.name() <<
"\" of field \"" 145 << internalField().name() <<
"\" but the field on the " 146 <<
"neighbouring patch \"" << nbrFvp.name()
147 <<
"\" is of a different type. Both should be of type \"" 154 refCast<const thermalBaffleFvPatchScalarField>(nbrTp);
155 if (nbrTBp.nbrPatch_ != patch().name())
158 <<
"Patch field of type \"" << typeName
159 <<
"\" on patch \"" << fvp.name() <<
"\" of field \"" 160 << internalField().name() <<
"\" is specified to neighbour " 161 <<
"patch \"" << nbrPatch_ <<
"\", but this patch does not " 162 <<
"reciprocally neighbour patch \"" << fvp.name() <<
"\"" 168 autoPtr<extrudePatchMesh>
169 thermalBaffleFvPatchScalarField::initBaffleMesh()
const 174 <<
"Baffle mesh is only available to the owner patch in the " 180 const fvMesh& mesh = patch().boundaryMesh().mesh();
182 const mappedPatchBase& mpp =
183 refCast<const mappedPatchBase>(patch().patch());
185 const mappedPatchBase nbrMpp =
186 refCast<const mappedPatchBase>
187 (patch().patch().boundaryMesh()[nbrPatch_]);
192 nbrMpp.samplePatch(),
198 mappedWallPolyPatch::typeName,
199 mappedWallPolyPatch::typeName,
200 symmetryPolyPatch::typeName
209 patchDicts[0].add(
"sampleMode", mpp.sampleModeNames_[mpp.mode()]);
210 patchDicts[0].add(
"sampleRegion", mesh.name());
212 patchDicts[1].add(
"sampleMode", mpp.sampleModeNames_[nbrMpp.mode()]);
213 patchDicts[1].add(
"sampleRegion", mesh.name());
216 List<polyPatch*> patchPtrs(3);
229 dictionary
dict(dict_);
230 dict.
add(
"columnCells",
false);
233 autoPtr<extrudePatchMesh>
247 autoPtr<regionModels::thermalBaffleModel>
248 thermalBaffleFvPatchScalarField::initBaffle()
const 253 <<
"Baffle model is only available to the owner patch in the " 259 const fvMesh& mesh = patch().boundaryMesh().mesh();
261 const mappedPatchBase& mpp =
262 refCast<const mappedPatchBase>(patch().patch());
264 dictionary
dict(dict_);
265 dict.
add(
"regionName", mpp.sampleRegion());
297 baffleMeshPtr_(owner() ? initBaffleMesh().ptr() :
nullptr),
298 bafflePtr_(owner() ? initBaffle().ptr() :
nullptr)
343 turbulentTemperatureRadCoupledMixedFvPatchScalarField::autoMap(m);
353 turbulentTemperatureRadCoupledMixedFvPatchScalarField::rmap(ptf, addr);
362 turbulentTemperatureRadCoupledMixedFvPatchScalarField::reset(ptf);
377 bafflePtr_->evolve();
#define forAll(list, i)
Loop across all elements in list.
errorManipArg< error, int > exit(error &err, const int errNo=1)
A list of keyword definitions, which are a keyword followed by any number of values (e...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define forAllConstIter(Container, container, iter)
Iterate across all elements in the container object of type.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
wordList patchTypes(nPatches)
static word defaultRegion
Return the default region name.
A finiteVolume patch using a polyPatch and a fvBoundaryMesh.
virtual void rmap(const fvPatchScalarField &, const labelList &)
Reverse map the given fvPatchField onto this fvPatchField.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
static autoPtr< thermalBaffleModel > New(const fvMesh &mesh)
Return a reference to the selected model.
Macros for easy insertion into run-time selection tables.
bool add(entry *, bool mergeEntry=false)
Add a new entry.
virtual void updateCoeffs()
Update the coefficients associated with the patch field.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
fvPatchField< scalar > fvPatchScalarField
A class for handling words, derived from string.
Foam::fvPatchFieldMapper.
wordList patchNames(nPatches)
static const dictionary null
Null dictionary.
turbulentTemperatureRadCoupledMixedFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
static const word null
An empty word.
virtual void write(Ostream &) const
Write.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
virtual void write(Ostream &) const
Write.
void writeEntry(Ostream &os, const HashTable< T, Key, Hash > &ht)
word name(const complex &)
Return a string representation of a complex.
thermalBaffleFvPatchScalarField(const fvPatch &, const DimensionedField< scalar, volMesh > &)
Construct from patch and internal field.
virtual void reset(const fvPatchScalarField &)
Reset the fvPatchField to the given fvPatchField.
Field with dimensions and associated with geometry type GeoMesh which is used to size the field and a...
static autoPtr< polyPatch > New(const word &patchType, const word &name, const label size, const label start, const label index, const polyBoundaryMesh &bm)
Return a pointer to a new patch created on freestore from.
virtual void autoMap(const fvPatchFieldMapper &)
Map (and resize as needed) from self given a mapping object.
PtrList< dictionary > patchDicts
This boundary condition provides a coupled temperature condition between multiple mesh regions...
makePatchTypeField(fvPatchScalarField, thermalBaffleFvPatchScalarField)
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.