49 void Foam::mixerFvMesh::addZonesAndModifiers()
62 <<
"Zones and modifiers already present. Skipping." 69 <<
"Adding zones and modifiers to the mesh" <<
endl;
72 List<pointZone*> pz(1);
75 pz[0] =
new pointZone(
"cutPointZone", 0,
pointZones());
80 List<faceZone*> fz(3);
83 const word innerSliderName
85 motionDict_.
subDict(
"slider").
get<word>(
"inside")
87 const polyPatch& innerSlider =
boundaryMesh()[innerSliderName];
99 const word outerSliderName
101 motionDict_.
subDict(
"slider").
get<word>(
"outside")
103 const polyPatch& outerSlider =
boundaryMesh()[outerSliderName];
115 fz[2] =
new faceZone(
"cutFaceZone", 2,
faceZones());
117 List<cellZone*> cz(1);
120 regionSplit rs(*
this);
126 label nMovingCells = 0;
130 if (rs[celli] == originRegion)
132 movingCells[nMovingCells] = celli;
137 movingCells.resize(nMovingCells);
138 Info<<
"Number of cells in the moving region: " << nMovingCells <<
endl;
143 std::move(movingCells),
148 Info<<
"Adding point, face and cell zones" <<
endl;
152 Info<<
"Adding topology modifiers" <<
endl;
162 outerSliderName +
"Zone",
163 innerSliderName +
"Zone",
177 void Foam::mixerFvMesh::calcMovingMasks()
const 181 if (movingPointsMaskPtr_)
184 <<
"point mask already calculated" 190 scalarField& movingPointsMask = *movingPointsMaskPtr_;
195 const labelList& cellAddr = cellZones()[
"movingCells"];
197 for (
const label celli : cellAddr)
199 const cell& curCell =
c[celli];
201 for (
const label facei : curCell)
204 const face& curFace =
f[facei];
208 movingPointsMask[curFace[pointi]] = 1;
213 const word innerSliderZoneName
215 motionDict_.subDict(
"slider").get<word>(
"inside") +
"Zone" 218 const labelList& innerSliderAddr = faceZones()[innerSliderZoneName];
220 for (
const label facei : innerSliderAddr)
222 const face& curFace =
f[facei];
226 movingPointsMask[curFace[pointi]] = 1;
230 const word outerSliderZoneName
232 motionDict_.subDict(
"slider").get<word>(
"outside") +
"Zone" 235 const labelList& outerSliderAddr = faceZones()[outerSliderZoneName];
237 for (
const label facei : outerSliderAddr)
239 const face& curFace =
f[facei];
243 movingPointsMask[curFace[pointi]] = 0;
251 Foam::mixerFvMesh::mixerFvMesh
256 topoChangerFvMesh(
io),
259 IOdictionary::readContents
268 ).optionalSubDict(typeName +
"Coeffs")
271 rpm_(motionDict_.
get<scalar>(
"rpm")),
272 movingPointsMaskPtr_(nullptr)
276 auto csysPtr = coordinateSystem::NewIfPresent(*
this,
dict);
280 static_cast<coordinateSystem&
>(csys_) = csysPtr();
284 csys_ = coordSystem::cylindrical(motionDict_);
287 addZonesAndModifiers();
289 Info<<
"Mixer mesh:" <<
nl 290 <<
" origin: " << csys_.
origin() <<
nl 291 <<
" axis: " << csys_.
e3() <<
nl 292 <<
" rpm: " << rpm_ <<
endl;
309 if (!movingPointsMaskPtr_)
314 return *movingPointsMaskPtr_;
327 csys_.localPosition(
points())
334 autoPtr<mapPolyMesh> topoChangeMap = topoChanger_.changeMesh(
true);
347 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.
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.
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.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
#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)
void setSize(const label newLen)
Same as resize()
const pointZoneMesh & pointZones() const noexcept
Return point zone mesh.
Template functions to aid in the implementation of demand driven data.
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.
void deleteDemandDrivenData(DataPtr &dataPtr)
addToRunTimeSelectionTable(functionObject, pointHistory, dictionary)
#define InfoInFunction
Report an information message using Foam::Info.
static constexpr const zero Zero
Global zero (0)