48 void Foam::mixerFvMesh::addZonesAndModifiers()
61 <<
"Zones and modifiers already present. Skipping." 68 <<
"Adding zones and modifiers to the mesh" <<
endl;
71 List<pointZone*> pz(1);
74 pz[0] =
new pointZone(
"cutPointZone", 0,
pointZones());
79 List<faceZone*> fz(3);
82 const word innerSliderName
84 motionDict_.
subDict(
"slider").
get<word>(
"inside")
86 const polyPatch& innerSlider =
boundaryMesh()[innerSliderName];
98 const word outerSliderName
100 motionDict_.
subDict(
"slider").
get<word>(
"outside")
102 const polyPatch& outerSlider =
boundaryMesh()[outerSliderName];
114 fz[2] =
new faceZone(
"cutFaceZone", 2,
faceZones());
116 List<cellZone*> cz(1);
119 regionSplit rs(*
this);
125 label nMovingCells = 0;
129 if (rs[celli] == originRegion)
131 movingCells[nMovingCells] = celli;
136 movingCells.resize(nMovingCells);
137 Info<<
"Number of cells in the moving region: " << nMovingCells <<
endl;
142 std::move(movingCells),
147 Info<<
"Adding point, face and cell zones" <<
endl;
151 Info<<
"Adding topology modifiers" <<
endl;
161 outerSliderName +
"Zone",
162 innerSliderName +
"Zone",
176 void Foam::mixerFvMesh::calcMovingMasks()
const 180 if (movingPointsMaskPtr_)
183 <<
"point mask already calculated" 188 movingPointsMaskPtr_ = std::make_unique<scalarField>(
points().
size(),
Zero);
189 auto& movingPointsMask = *movingPointsMaskPtr_;
194 const labelList& cellAddr = cellZones()[
"movingCells"];
196 for (
const label celli : cellAddr)
198 const cell& curCell =
c[celli];
200 for (
const label facei : curCell)
203 const face& curFace =
f[facei];
207 movingPointsMask[curFace[pointi]] = 1;
212 const word innerSliderZoneName
214 motionDict_.subDict(
"slider").get<word>(
"inside") +
"Zone" 217 const labelList& innerSliderAddr = faceZones()[innerSliderZoneName];
219 for (
const label facei : innerSliderAddr)
221 const face& curFace =
f[facei];
225 movingPointsMask[curFace[pointi]] = 1;
229 const word outerSliderZoneName
231 motionDict_.subDict(
"slider").get<word>(
"outside") +
"Zone" 234 const labelList& outerSliderAddr = faceZones()[outerSliderZoneName];
236 for (
const label facei : outerSliderAddr)
238 const face& curFace =
f[facei];
242 movingPointsMask[curFace[pointi]] = 0;
250 Foam::mixerFvMesh::mixerFvMesh
255 topoChangerFvMesh(
io),
258 IOdictionary::readContents
267 ).optionalSubDict(typeName +
"Coeffs")
269 rpm_(motionDict_.
get<scalar>(
"rpm"))
273 auto csysPtr = coordinateSystem::NewIfPresent(*
this,
dict);
277 static_cast<coordinateSystem&
>(csys_) = *csysPtr;
281 csys_ = coordSystem::cylindrical(motionDict_);
284 addZonesAndModifiers();
286 Info<<
"Mixer mesh:" <<
nl 287 <<
" origin: " << csys_.
origin() <<
nl 288 <<
" axis: " << csys_.
e3() <<
nl 289 <<
" rpm: " << rpm_ <<
endl;
297 movingPointsMaskPtr_.reset(
nullptr);
306 if (!movingPointsMaskPtr_)
311 return *movingPointsMaskPtr_;
324 csys_.localPosition(
points())
331 autoPtr<mapPolyMesh> topoChangeMap = topoChanger_.changeMesh(
true);
337 movingPointsMaskPtr_.reset(
nullptr);
344 csys_.localPosition(oldPoints())
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
List of values generated by applying the access operation to each list item.
void size(const label n)
Older name for setAddressableSize.
List< cell > cellList
List of cell.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
constexpr scalar rpmToRads(const scalar rpm) noexcept
Conversion from revolutions/minute to radians/sec.
Unit conversion functions.
constexpr char nl
The newline '\n' character (0x0a)
virtual const vector e3() const
The local Cartesian z-axis in global coordinates.
void setSize(const label n)
Same as resize()
Ostream & endl(Ostream &os)
Add newline and flush stream.
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T. FatalIOError if not found, or if the number of tokens is incorrect.
const Time & time() const
Return the top-level database.
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary.
Macros for easy insertion into run-time selection tables.
virtual const point & origin() const
Return origin.
#define forAll(list, i)
Loop across all elements in list.
List< face > faceList
List of faces.
label size() const noexcept
The number of elements in table.
writeOption writeOpt() const noexcept
Get the write option.
virtual ~mixerFvMesh()
Destructor.
labelList identity(const label len, label start=0)
Return an identity map of the given length with (map[i] == i), works like std::iota() but returning a...
const polyBoundaryMesh & boundaryMesh() const noexcept
Return boundary mesh.
#define DebugInFunction
Report an information message using Foam::Info.
label size() const noexcept
The number of entries in the list.
void addZones(PtrList< pointZone > &&pz, PtrList< faceZone > &&fz, PtrList< cellZone > &&cz)
Add mesh zones.
errorManip< error > abort(error &err)
const T * set(const label i) const
Return const pointer to element (can be nullptr), or nullptr for out-of-range access (ie...
virtual bool write(const bool writeOnProc=true) const
Write mesh using IO settings from time.
static word timeName(const scalar t, const int precision=precision_)
Return a time name for the given scalar time value formatted with the given precision.
const faceZoneMesh & faceZones() const noexcept
Return face zone mesh.
defineTypeNameAndDebug(combustionModel, 0)
const pointZoneMesh & pointZones() const noexcept
Return point zone mesh.
label nCells() const noexcept
Number of mesh cells.
const dimensionedScalar c
Speed of light in a vacuum.
label findNearestCell(const point &location) const
Find the cell with the nearest cell centre to location.
Automatically write from objectRegistry::writeObject()
const cellZoneMesh & cellZones() const noexcept
Return cell zone mesh.
messageStream Info
Information stream (stdout output on master, null elsewhere)
List< label > labelList
A List of labels.
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, IOobject::NO_REGISTER)
polyTopoChanger topoChanger_
virtual bool update()
Update the mesh for both mesh motion and topology change.
addToRunTimeSelectionTable(functionObject, pointHistory, dictionary)
#define InfoInFunction
Report an information message using Foam::Info.
static constexpr const zero Zero
Global zero (0)