48void Foam::MRFZone::setMRFFaces()
68 if (cellZoneID_ != -1)
73 zoneCell[cellLabels[i]] =
true;
82 if (zoneCell[own[facei]] || zoneCell[nei[facei]])
94 const polyPatch& pp =
patches[patchi];
96 if (pp.coupled() || excludedPatches.found(patchi))
100 label facei = pp.start()+i;
102 if (zoneCell[own[facei]])
109 else if (!isA<emptyPolyPatch>(pp))
113 label facei = pp.start()+i;
115 if (zoneCell[own[facei]])
139 if (faceType[facei] == 1)
141 internalFaces_[nInternal++] = facei;
144 internalFaces_.
setSize(nInternal);
151 const polyPatch& pp =
patches[patchi];
155 label facei = pp.start() + patchFacei;
157 if (faceType[facei] == 1)
159 nIncludedFaces[patchi]++;
161 else if (faceType[facei] == 2)
163 nExcludedFaces[patchi]++;
170 forAll(nIncludedFaces, patchi)
172 includedFaces_[patchi].
setSize(nIncludedFaces[patchi]);
173 excludedFaces_[patchi].
setSize(nExcludedFaces[patchi]);
180 const polyPatch& pp =
patches[patchi];
184 label facei = pp.start() + patchFacei;
186 if (faceType[facei] == 1)
188 includedFaces_[patchi][nIncludedFaces[patchi]++] = patchFacei;
190 else if (faceType[facei] == 2)
192 excludedFaces_[patchi][nExcludedFaces[patchi]++] = patchFacei;
200 faceSet internalFaces(mesh_,
"internalFaces", internalFaces_);
201 Pout<<
"Writing " << internalFaces.size()
202 <<
" internal faces in MRF zone to faceSet "
204 internalFaces.
write();
206 faceSet MRFFaces(mesh_,
"includedFaces", 100);
207 forAll(includedFaces_, patchi)
209 forAll(includedFaces_[patchi], i)
211 label patchFacei = includedFaces_[patchi][i];
212 MRFFaces.insert(
patches[patchi].start()+patchFacei);
215 Pout<<
"Writing " << MRFFaces.size()
216 <<
" patch faces in MRF zone to faceSet "
220 faceSet excludedFaces(mesh_,
"excludedFaces", 100);
221 forAll(excludedFaces_, patchi)
223 forAll(excludedFaces_[patchi], i)
225 label patchFacei = excludedFaces_[patchi][i];
226 excludedFaces.insert(
patches[patchi].start()+patchFacei);
229 Pout<<
"Writing " << excludedFaces.size()
230 <<
" faces in MRF zone with special handling to faceSet "
232 excludedFaces.
write();
244 const word& cellZoneName
251 cellZoneName_(cellZoneName),
253 excludedPatchNames_(
wordRes()),
266 return omega_->value(mesh_.time().timeOutputValue())*axis_;
276 if (cellZoneID_ == -1)
285 const vector Omega = this->Omega();
289 label celli =
cells[i];
290 ddtUc[celli] += (Omega ^ Uc[celli]);
297 if (cellZoneID_ == -1)
307 const vector Omega = this->Omega();
313 label celli =
cells[i];
314 Usource[celli] += V[celli]*(Omega ^
U[celli]);
321 label celli =
cells[i];
322 Usource[celli] -= V[celli]*(Omega ^
U[celli]);
335 if (cellZoneID_ == -1)
345 const vector Omega = this->Omega();
351 label celli =
cells[i];
352 Usource[celli] += V[celli]*
rho[celli]*(Omega ^
U[celli]);
359 label celli =
cells[i];
360 Usource[celli] -= V[celli]*
rho[celli]*(Omega ^
U[celli]);
368 if (cellZoneID_ == -1)
375 const vector Omega = this->Omega();
381 label celli =
cells[i];
382 U[celli] -= (Omega ^ (
C[celli] - origin_));
389 forAll(includedFaces_, patchi)
391 forAll(includedFaces_[patchi], i)
393 label patchFacei = includedFaces_[patchi][i];
394 Ubf[patchi][patchFacei] =
Zero;
399 forAll(excludedFaces_, patchi)
401 forAll(excludedFaces_[patchi], i)
403 label patchFacei = excludedFaces_[patchi][i];
404 Ubf[patchi][patchFacei] -=
406 ^ (
C.boundaryField()[patchi][patchFacei] - origin_));
436 makeRelativeRhoFlux(
rho,
phi);
442 if (cellZoneID_ == -1)
449 const vector Omega = this->Omega();
455 label celli =
cells[i];
456 U[celli] += (Omega ^ (
C[celli] - origin_));
462 forAll(includedFaces_, patchi)
464 forAll(includedFaces_[patchi], i)
466 label patchFacei = includedFaces_[patchi][i];
467 Ubf[patchi][patchFacei] =
468 (Omega ^ (
C.boundaryField()[patchi][patchFacei] - origin_));
473 forAll(excludedFaces_, patchi)
475 forAll(excludedFaces_[patchi], i)
477 label patchFacei = excludedFaces_[patchi][i];
478 Ubf[patchi][patchFacei] +=
479 (Omega ^ (
C.boundaryField()[patchi][patchFacei] - origin_));
497 makeAbsoluteRhoFlux(
rho,
phi);
508 const vector Omega = this->Omega();
513 forAll(includedFaces_, patchi)
515 const vectorField& patchC = mesh_.Cf().boundaryField()[patchi];
519 forAll(includedFaces_[patchi], i)
521 label patchFacei = includedFaces_[patchi][i];
523 pfld[patchFacei] = (Omega ^ (patchC[patchFacei] - origin_));
540 omega_->writeData(
os);
542 if (excludedPatchNames_.size())
544 os.
writeEntry(
"nonRotatingPatches", excludedPatchNames_);
563 coeffs_.readIfPresent(
"nonRotatingPatches", excludedPatchNames_);
565 origin_ = coeffs_.get<
vector>(
"origin");
566 axis_ = coeffs_.get<
vector>(
"axis").normalise();
569 const word oldCellZoneName = cellZoneName_;
572 coeffs_.readEntry(
"cellZone", cellZoneName_);
576 coeffs_.readIfPresent(
"cellZone", cellZoneName_);
579 if (cellZoneID_ == -1 || oldCellZoneName != cellZoneName_)
581 cellZoneID_ = mesh_.cellZones().findZoneID(cellZoneName_);
585 mesh_.boundaryMesh().patchSet(excludedPatchNames_)
588 excludedPatchLabels_.setSize(excludedPatchSet.
size());
591 for (
const label patchi : excludedPatchSet)
593 excludedPatchLabels_[i++] = patchi;
596 bool cellZoneFound = (cellZoneID_ != -1);
603 <<
"cannot find MRF cellZone " << cellZoneName_
616 if (mesh_.topoChanging())
Graphite solid properties.
A field of fields is a PtrList of fields with reference counting.
Top level data entry class for use in dictionaries. Provides a mechanism to specify a variable as a c...
Internal::FieldType & primitiveFieldRef(const bool updateAccessTime=true)
Return a reference to the internal field.
label size() const noexcept
The number of elements in table.
void setSize(const label n)
Alias for resize()
MRF zone definition based on cell zone and parameters obtained from a control dictionary constructed ...
vector Omega() const
Return the current Omega vector.
void writeData(Ostream &os) const
Write.
bool read(const dictionary &dict)
Read MRF dictionary.
void makeAbsolute(volVectorField &U) const
Make the given relative velocity absolute within the MRF region.
void correctBoundaryVelocity(volVectorField &U) const
Correct the boundary velocity for the rotation of the MRF region.
void makeRelative(volVectorField &U) const
Make the given absolute velocity relative within the MRF region.
void update()
Update MRFZone faces if the mesh topology changes.
void addCoriolis(const volVectorField &U, volVectorField &ddtU) const
Add the Coriolis force contribution to the acceleration field.
virtual const fileName & name() const
Get the name of the stream.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
virtual Ostream & endBlock()
Write end block group.
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
virtual Ostream & beginBlock(const keyType &kw)
Write begin block group with the given name.
virtual bool write(const token &tok)=0
Write token to stream or otherwise handle it.
virtual bool read()
Re-read model coefficients if they have changed.
label size() const noexcept
The number of elements in the list.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
bool readIfPresent(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX) const
A special matrix type and solver, designed for finite volume solutions of scalar equations....
const GeometricField< Type, fvPatchField, volMesh > & psi(const label i=0) const
Return psi.
Field< Type > & source() noexcept
Mesh data needed to do the Finite Volume discretisation.
A class representing the concept of a GeometricField of 1 used to avoid unnecessary manipulations for...
A class representing the concept of a field of oneFields used to avoid unnecessary manipulations for ...
A class representing the concept of a field of 1 used to avoid unnecessary manipulations for objects ...
virtual const labelList & faceOwner() const
Return face owner.
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
const cellZoneMesh & cellZones() const noexcept
Return cell zone mesh.
virtual const labelList & faceNeighbour() const
Return face neighbour.
label nInternalFaces() const noexcept
Number of internal faces.
label nCells() const noexcept
Number of mesh cells.
label nFaces() const noexcept
Number of mesh faces.
A List of wordRe with additional matching capabilities.
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
const polyBoundaryMesh & patches
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
A special matrix type and solver, designed for finite volume solutions of scalar equations.
List< label > labelList
A List of labels.
Ostream & endl(Ostream &os)
Add newline and flush stream.
void reduce(const List< UPstream::commsStruct > &comms, T &value, const BinaryOp &bop, const int tag, const label comm)
List< bool > boolList
A List of bools.
static constexpr const zero Zero
Global zero (0)
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a)
#define forAll(list, i)
Loop across all elements in list.