48 void 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();
239 Foam::MRFZone::MRFZone
244 const word& cellZoneName
250 active_(coeffs_.getOrDefault(
"active",
true)),
251 cellZoneName_(cellZoneName),
257 origin_(coeffs_.get<
vector>(
"origin")),
263 coeffs_.readEntry(
"cellZone", cellZoneName_);
272 cellZoneID_ = mesh_.cellZones().findZoneID(cellZoneName_);
276 mesh_.boundaryMesh().patchSet(excludedPatchNames_)
279 excludedPatchLabels_.setSize(excludedPatchSet.size());
282 for (
const label patchi : excludedPatchSet)
284 excludedPatchLabels_[i++] = patchi;
287 bool cellZoneFound = (cellZoneID_ != -1);
294 <<
"cannot find MRF cellZone " << cellZoneName_
307 return omega_->value(mesh_.time().timeOutputValue())*axis_;
317 if (cellZoneID_ == -1)
326 const vector Omega = this->Omega();
330 label celli =
cells[i];
331 ddtUc[celli] += (Omega ^ Uc[celli]);
338 if (cellZoneID_ == -1)
348 const vector Omega = this->Omega();
354 label celli =
cells[i];
355 Usource[celli] += V[celli]*(Omega ^
U[celli]);
362 label celli =
cells[i];
363 Usource[celli] -= V[celli]*(Omega ^
U[celli]);
376 if (cellZoneID_ == -1)
386 const vector Omega = this->Omega();
392 label celli =
cells[i];
393 Usource[celli] += V[celli]*
rho[celli]*(Omega ^
U[celli]);
400 label celli =
cells[i];
401 Usource[celli] -= V[celli]*
rho[celli]*(Omega ^
U[celli]);
409 if (cellZoneID_ == -1)
416 const vector Omega = this->Omega();
422 label celli =
cells[i];
423 U[celli] -= (Omega ^ (
C[celli] - origin_));
428 volVectorField::Boundary& Ubf =
U.boundaryFieldRef();
430 forAll(includedFaces_, patchi)
432 forAll(includedFaces_[patchi], i)
434 label patchFacei = includedFaces_[patchi][i];
435 Ubf[patchi][patchFacei] =
Zero;
440 forAll(excludedFaces_, patchi)
442 forAll(excludedFaces_[patchi], i)
444 label patchFacei = excludedFaces_[patchi][i];
445 Ubf[patchi][patchFacei] -=
447 ^ (
C.boundaryField()[patchi][patchFacei] - origin_));
477 makeRelativeRhoFlux(
rho,
phi);
483 if (cellZoneID_ == -1)
490 const vector Omega = this->Omega();
496 label celli =
cells[i];
497 U[celli] += (Omega ^ (
C[celli] - origin_));
501 volVectorField::Boundary& Ubf =
U.boundaryFieldRef();
503 forAll(includedFaces_, patchi)
505 forAll(includedFaces_[patchi], i)
507 label patchFacei = includedFaces_[patchi][i];
508 Ubf[patchi][patchFacei] =
509 (Omega ^ (
C.boundaryField()[patchi][patchFacei] - origin_));
514 forAll(excludedFaces_, patchi)
516 forAll(excludedFaces_[patchi], i)
518 label patchFacei = excludedFaces_[patchi][i];
519 Ubf[patchi][patchFacei] +=
520 (Omega ^ (
C.boundaryField()[patchi][patchFacei] - origin_));
538 makeAbsoluteRhoFlux(
rho,
phi);
549 const vector Omega = this->Omega();
552 volVectorField::Boundary& Ubf =
U.boundaryFieldRef();
554 forAll(includedFaces_, patchi)
556 const vectorField& patchC = mesh_.Cf().boundaryField()[patchi];
560 forAll(includedFaces_[patchi], i)
562 label patchFacei = includedFaces_[patchi][i];
564 pfld[patchFacei] = (Omega ^ (patchC[patchFacei] - origin_));
581 omega_->writeData(os);
583 if (excludedPatchNames_.size())
585 os.
writeEntry(
"nonRotatingPatches", excludedPatchNames_);
597 coeffs_.readEntry(
"cellZone", cellZoneName_);
598 cellZoneID_ = mesh_.cellZones().findZoneID(cellZoneName_);
606 if (mesh_.topoChanging())