43 displacementPointSmoothingMotionSolver,
49 displacementMotionSolver,
50 displacementPointSmoothingMotionSolver,
66 for (
const label facei : changedFaces)
68 affectedPoints.set(
mesh().faces()[facei]);
75 orEqOp<unsigned int>(),
79 for (
const label pointi : affectedPoints)
81 for (
const label celli :
mesh().pointCells()[pointi])
93 relaxationFactors_.empty()
94 || (relaxationFactors_.size() == 1 && relaxationFactors_[0] == 1.0)
102 const pointField oldRelaxedPoints(relaxedPoints_);
111 for (
const label facei : affectedFaces)
113 for (
const label pointi :
mesh().faces()[facei])
115 relaxationLevel[pointi] = 0;
128 bool complete(
false);
136 forAll(relaxationLevel, pointI)
138 if (relaxationLevel[pointI] >= 0)
142 relaxationFactors_[relaxationLevel[pointI]]
145 relaxedPoints_[pointI] =
146 (1 -
x)*oldRelaxedPoints[pointI]
147 +
x*(
points0()[pointI] + pointDisplacement()[pointI]);
153 markAffectedFaces(affectedFaces, markedFaces);
154 labelList markedFacesList(markedFaces.toc());
157 meshGeometry_.correct(relaxedPoints_, markedFacesList);
172 affectedFaces.clear();
173 markAffectedFaces(markedFaces, affectedFaces);
178 for (
const label facei : affectedFaces)
180 pointsToRelax.set(
mesh().faces()[facei]);
183 for (
const label pointi : pointsToRelax)
185 if (relaxationLevel[pointi] < relaxationFactors_.size() - 1)
187 ++ relaxationLevel[pointi];
206 bool converged(
true);
209 const face& fPoints(
mesh().faces()[facei]);
211 for (
const label pointi : fPoints)
213 if (relaxationLevel[pointi] > 0)
215 facesToMove_.insert(facei);
247 facesToMove_.resize(2*
mesh().nFaces());
250 facesToMove_.insert(faceI);
255 facesToMove_.resize(2*(
mesh().nBoundaryFaces()));
258 label faceI =
mesh().nInternalFaces();
263 facesToMove_.insert(faceI);
283 coeffDict().
get<label>(
"nPointSmootherIter")
298 const polyMesh&
mesh,
299 const IOdictionary&
dict,
304 displacementMotionSolver(
mesh,
dict, pointDisplacement,
points0, typeName),
316 coeffDict().
get<label>(
"nPointSmootherIter")
335 return relaxedPoints_;
346 movePoints(curPoints());
349 pointDisplacement().boundaryFieldRef().updateCoeffs();
353 markAffectedFaces(facesToMove_, affectedFaces);
355 for(label i = 0; i < nPointSmootherIter_; i ++)
357 meshGeometry_.correct
359 points0() + pointDisplacement().internalField(),
367 pointSmoother_->update
371 points0() + pointDisplacement().internalField(),
379 twoDCorrectPoints(relaxedPoints_);
383 pointDisplacement().primitiveFieldRef() = relaxedPoints_-
points0();
386 const pointConstraints& pcs =
388 pcs.constrainDisplacement(pointDisplacement(),
false);
391 relaxedPoints_ =
points0() + pointDisplacement().internalField();
static bool checkMesh(const bool report, const polyMesh &mesh, const dictionary &dict, labelHashSet &wrongFaces, const bool dryRun=false)
Check mesh with mesh settings in dict. Collects incorrect faces.
Virtual base class for displacement motion solver.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Abstract base class for point smoothing methods. Handles parallel communication via reset and average...
vectorIOField pointIOField
pointIOField is a vectorIOField.
const Internal & internalField() const noexcept
Return a const-reference to the dimensioned internal field.
static FOAM_NO_DANGLING_REFERENCE const pointConstraints & New(const pointMesh &mesh, Args &&... args)
Get existing or create MeshObject registered with typeName.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
virtual tmp< pointField > curPoints() const
Return point location obtained from the current motion field.
GeometricField< vector, pointPatchField, pointMesh > pointVectorField
const dictionary & coeffDict() const
Const access to the coefficients dictionary.
label nFaces() const noexcept
Number of mesh faces.
bool insert(const Key &key)
Insert a new entry, not overwriting existing entries.
const dictionary & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary.
virtual void solve()
Solve for motion.
Macros for easy insertion into run-time selection tables.
displacementPointSmoothingMotionSolver(const polyMesh &, const IOdictionary &)
Construct from a polyMesh and an IOdictionary.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
#define forAll(list, i)
Loop across all elements in list.
dictionary meshQualityDict_
Mesh quality dictionary.
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
static void reduceAnd(bool &value, const int communicator=UPstream::worldComm)
Logical (and) reduction (MPI_AllReduce)
vectorField pointField
pointField is a vectorField.
scalarList relaxationFactors_
Relaxation factors to use in each iteration.
constexpr T & get(FixedList< T, N > &list) noexcept
void clear()
Clear the list, i.e. set size to zero.
void markAffectedFaces(const labelHashSet &changedFaces, labelHashSet &affectedFaces)
Mark affected faces.
bool readIfPresent(const word &keyword, T &val, enum keyType::option matchOpt=keyType::REGEX) const
Find an entry if present, and assign to T val. FatalIOError if it is found and the number of tokens i...
defineTypeNameAndDebug(combustionModel, 0)
virtual void setFacesToMove(const dictionary &)
Set all the faces to be moved.
pointField points0(pointIOField(IOobject("points", mesh.time().constant(), polyMesh::meshSubDir, mesh, IOobject::MUST_READ, IOobject::NO_WRITE, IOobject::NO_REGISTER)))
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
Mesh consisting of general polyhedral cells.
List< Key > toc() const
The table of contents (the keys) in unsorted order.
T getOrDefault(const word &keyword, const T &deflt, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T, or return the given default value. FatalIOError if it is found and the number of...
List< label > labelList
A List of labels.
const polyMesh & mesh() const
Return reference to mesh.
A class for managing temporary objects.
bool relax()
Relax the points.
addToRunTimeSelectionTable(functionObject, pointHistory, dictionary)