45 void Foam::MRFZone::setMRFFaces()
47 const polyBoundaryMesh& patches = mesh_.boundaryMesh();
60 const labelList& nei = mesh_.faceNeighbour();
63 boolList zoneCell(mesh_.nCells(),
false);
65 if (cellZoneID_ != -1)
67 const labelList& cellLabels = mesh_.cellZones()[cellZoneID_];
70 zoneCell[cellLabels[i]] =
true;
77 for (
label faceI = 0; faceI < mesh_.nInternalFaces(); faceI++)
79 if (zoneCell[own[faceI]] || zoneCell[nei[faceI]])
91 const polyPatch& pp = patches[patchI];
93 if (pp.coupled() || excludedPatches.found(patchI))
97 label faceI = pp.start()+i;
99 if (zoneCell[own[faceI]])
106 else if (!isA<emptyPolyPatch>(pp))
110 label faceI = pp.start()+i;
112 if (zoneCell[own[faceI]])
131 internalFaces_.setSize(mesh_.nFaces());
134 for (
label faceI = 0; faceI < mesh_.nInternalFaces(); faceI++)
136 if (faceType[faceI] == 1)
138 internalFaces_[nInternal++] = faceI;
141 internalFaces_.setSize(nInternal);
143 labelList nIncludedFaces(patches.size(), 0);
144 labelList nExcludedFaces(patches.size(), 0);
148 const polyPatch& pp = patches[
patchi];
152 label faceI = pp.start() + patchFacei;
154 if (faceType[faceI] == 1)
158 else if (faceType[faceI] == 2)
165 includedFaces_.setSize(patches.size());
166 excludedFaces_.setSize(patches.size());
167 forAll(nIncludedFaces, patchi)
169 includedFaces_[
patchi].setSize(nIncludedFaces[patchi]);
170 excludedFaces_[
patchi].setSize(nExcludedFaces[patchi]);
177 const polyPatch& pp = patches[
patchi];
181 label faceI = pp.start() + patchFacei;
183 if (faceType[faceI] == 1)
185 includedFaces_[
patchi][nIncludedFaces[
patchi]++] = patchFacei;
187 else if (faceType[faceI] == 2)
189 excludedFaces_[
patchi][nExcludedFaces[
patchi]++] = patchFacei;
197 faceSet internalFaces(mesh_,
"internalFaces", internalFaces_);
198 Pout<<
"Writing " << internalFaces.size()
199 <<
" internal faces in MRF zone to faceSet " 201 internalFaces.
write();
203 faceSet MRFFaces(mesh_,
"includedFaces", 100);
204 forAll(includedFaces_, patchi)
206 forAll(includedFaces_[patchi], i)
209 MRFFaces.insert(patches[patchi].start()+patchFacei);
212 Pout<<
"Writing " << MRFFaces.size()
213 <<
" patch faces in MRF zone to faceSet " 217 faceSet excludedFaces(mesh_,
"excludedFaces", 100);
218 forAll(excludedFaces_, patchi)
220 forAll(excludedFaces_[patchi], i)
223 excludedFaces.insert(patches[patchi].start()+patchFacei);
226 Pout<<
"Writing " << excludedFaces.size()
227 <<
" faces in MRF zone with special handling to faceSet " 229 excludedFaces.
write();
236 Foam::MRFZone::MRFZone
241 const word& cellZoneName
247 active_(coeffs_.lookupOrDefault(
"active",
true)),
248 cellZoneName_(cellZoneName),
254 origin_(coeffs_.lookup(
"origin")),
255 axis_(coeffs_.lookup(
"axis")),
260 coeffs_.lookup(
"cellZone") >> cellZoneName_;
269 cellZoneID_ = mesh_.cellZones().findZoneID(cellZoneName_);
271 axis_ = axis_/
mag(axis_);
275 mesh_.boundaryMesh().patchSet(excludedPatchNames_)
278 excludedPatchLabels_.setSize(excludedPatchSet.size());
283 excludedPatchLabels_[i++] = iter.key();
286 bool cellZoneFound = (cellZoneID_ != -1);
298 "const dictionary&, " 302 <<
"cannot find MRF cellZone " << cellZoneName_
315 return omega_->value(mesh_.time().timeOutputValue())*axis_;
325 if (cellZoneID_ == -1)
334 const vector Omega = this->Omega();
338 label celli = cells[i];
339 ddtUc[celli] += (Omega ^ Uc[celli]);
346 if (cellZoneID_ == -1)
356 const vector Omega = this->Omega();
362 label celli = cells[i];
363 Usource[celli] += V[celli]*(Omega ^ U[celli]);
370 label celli = cells[i];
371 Usource[celli] -= V[celli]*(Omega ^ U[celli]);
384 if (cellZoneID_ == -1)
394 const vector Omega = this->Omega();
400 label celli = cells[i];
401 Usource[celli] += V[celli]*rho[celli]*(Omega ^ U[celli]);
408 label celli = cells[i];
409 Usource[celli] -= V[celli]*rho[celli]*(Omega ^ U[celli]);
419 const vector Omega = this->Omega();
425 label celli = cells[i];
426 U[celli] -= (Omega ^ (C[celli] - origin_));
430 forAll(includedFaces_, patchi)
432 forAll(includedFaces_[patchi], i)
440 forAll(excludedFaces_, patchi)
442 forAll(excludedFaces_[patchi], i)
471 makeRelativeRhoFlux(rho, phi);
479 const vector Omega = this->Omega();
485 label celli = cells[i];
486 U[celli] += (Omega ^ (C[celli] - origin_));
490 forAll(includedFaces_, patchi)
492 forAll(includedFaces_[patchi], i)
501 forAll(excludedFaces_, patchi)
503 forAll(excludedFaces_[patchi], i)
525 makeAbsoluteRhoFlux(rho, phi);
531 const vector Omega = this->Omega();
534 forAll(includedFaces_, patchi)
540 forAll(includedFaces_[patchi], i)
544 pfld[patchFacei] = (Omega ^ (patchC[patchFacei] - origin_));
561 omega_->writeData(os);
563 if (excludedPatchNames_.size())
565 os.
writeKeyword(
"nonRotatingPatches") << excludedPatchNames_
578 coeffs_.lookup(
"cellZone") >> cellZoneName_;
579 cellZoneID_ = mesh_.cellZones().findZoneID(cellZoneName_);
void reduce(const List< UPstream::commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm)
Mesh data needed to do the Finite Volume discretisation.
vector Omega() const
Return the current Omega vector.
dimensioned< scalar > mag(const dimensioned< Type > &)
GeometricBoundaryField & boundaryField()
Return reference to GeometricBoundaryField.
A class representing the concept of a GeometricField of 1 used to avoid unnecessary manipulations for...
void correctBoundaryVelocity(volVectorField &U) const
Correct the boundary velocity for the rotation of the MRF region.
List< wordRe > wordReList
A List of wordRe (word or regular expression)
bool read(const dictionary &dict)
Read MRF dictionary.
A class for handling words, derived from string.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
errorManipArg< error, int > exit(error &err, const int errNo=1)
InternalField & internalField()
Return internal field.
void makeRelative(volVectorField &U) const
Make the given absolute velocity relative within the MRF region.
Graphite solid properties.
A special matrix type and solver, designed for finite volume solutions of scalar equations. Face addressing is used to make all matrix assembly and solution loops vectorise.
A list of keyword definitions, which are a keyword followed by any number of values (e...
static void syncFaceList(const polyMesh &mesh, UList< T > &l, const CombineOp &cop)
Synchronize values on all mesh faces.
void addCoriolis(const volVectorField &U, volVectorField &ddtU) const
Add the Coriolis force contribution to the acceleration field.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
Ostream & incrIndent(Ostream &os)
Increment the indent level.
const GeometricField< Type, fvPatchField, volMesh > & psi() const
Ostream & endl(Ostream &os)
Add newline and flush stream.
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
void makeAbsolute(volVectorField &U) const
Make the given relative velocity absolute within the MRF region.
A class representing the concept of a field of oneFields used to avoid unnecessary manipulations for ...
void writeData(Ostream &os) const
Write.
virtual Ostream & write(const token &)=0
Write next token to stream.
virtual const fileName & name() const
Return the name of the stream.
Ostream & writeKeyword(const keyType &)
Write the keyword followed by an appropriate indentation.
#define FatalErrorIn(functionName)
Report an error message using Foam::FatalError.
HashSet< label, Hash< label > > labelHashSet
A HashSet with label keys.
const cellShapeList & cells
T lookupOrDefault(const word &, const T &, bool recursive=false, bool patternMatch=true) const
Find and return a T,.
List< label > labelList
A List of labels.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Top level data entry class for use in dictionaries. Provides a mechanism to specify a variable as a c...
static const word null
An empty word.
defineTypeNameAndDebug(combustionModel, 0)
A special matrix type and solver, designed for finite volume solutions of scalar equations.
prefixOSstream Pout(cout,"Pout")
List< bool > boolList
Bool container classes.