48void 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",
176void 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;
250Foam::mixerFvMesh::mixerFvMesh
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())
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
label size() const noexcept
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
static dictionary readContents(const IOobject &io)
Read and return contents, testing for "dictionary" type. The IOobject will not be registered.
@ MUST_READ
Reading required.
@ AUTO_WRITE
Automatically write from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
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.
label size() const noexcept
The number of entries in the list.
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
A cell is defined as a list of faces with extra functionality.
A cylindrical coordinate system (r-theta-z). The coordinate system angle theta is always in radians.
Base class for coordinate system specification, the default coordinate system type is cartesian .
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 dictionary & optionalSubDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary, otherwise return this dictionary.
A face is a list of labels corresponding to mesh vertices.
const Time & time() const
Return the top-level database.
virtual void movePoints(const pointField &)
Move points, returns volumes swept by faces in motion.
virtual bool update()
Update the mesh for both mesh motion and topology change.
virtual ~mixerFvMesh()
Destructor.
const polyBoundaryMesh & boundaryMesh() const noexcept
Return boundary mesh.
const faceZoneMesh & faceZones() const noexcept
Return face zone mesh.
virtual const pointField & oldPoints() const
Return old points (mesh motion).
const cellZoneMesh & cellZones() const noexcept
Return cell zone mesh.
void addZones(PtrList< pointZone > &&pz, PtrList< faceZone > &&fz, PtrList< cellZone > &&cz)
Add mesh zones.
const pointZoneMesh & pointZones() const noexcept
Return point zone mesh.
label findNearestCell(const point &location) const
Find the cell with the nearest cell centre to location.
label nCells() const noexcept
Number of mesh cells.
Abstract base class for a topology changing fvMesh.
polyTopoChanger topoChanger_
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define DebugInFunction
Report an information message using Foam::Info.
#define InfoInFunction
Report an information message using Foam::Info.
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
List of values generated by applying the access operation to each list item.
const dimensionedScalar c
Speed of light in a vacuum.
Different types of constants.
List< label > labelList
A List of labels.
messageStream Info
Information stream (stdout output on master, null elsewhere).
List< face > faceList
List of faces.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
const word GlobalIOList< Tuple2< scalar, vector > >::typeName("scalarVectorTable")
Ostream & endl(Ostream &os)
Add newline and flush stream.
constexpr scalar rpmToRads() noexcept
Multiplication factor for revolutions/minute to radians/sec.
List< cell > cellList
List of cell.
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...
errorManip< error > abort(error &err)
static constexpr const zero Zero
Global zero (0).
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
constexpr char nl
The newline '\n' character (0x0a).
#define forAll(list, i)
Loop across all elements in list.
Unit conversion functions.