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)
97 relaxedPoints_ =
points0() + pointDisplacement().internalField();
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);
245 if (
dict.getOrDefault<
bool>(
"moveInternalFaces",
true))
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,
316 coeffDict().get<label>(
"nPointSmootherIter")
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();
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
propsDict readIfPresent("fields", acceptFields)
bool insert(const Key &key)
Insert a new entry, not overwriting existing entries.
List< Key > toc() const
The table of contents (the keys) in unsorted order.
void clear()
Remove all entries from table.
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
static FOAM_NO_DANGLING_REFERENCE const pointConstraints & New(const pointMesh &mesh, Args &&... args)
static void reduceAnd(bool &value, const int communicator=worldComm)
Logical (and) reduction (MPI_AllReduce).
A bitSet stores bits (elements with only two states) in packed internal format and supports a variety...
void set(const bitSet &bitset)
Set specified bits from another bitset.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
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 & subDict(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a sub-dictionary.
Virtual base class for displacement motion solver.
pointVectorField & pointDisplacement() noexcept
Return reference to the point motion displacement field.
displacementMotionSolver(const displacementMotionSolver &)=delete
No copy construct.
static autoPtr< displacementMotionSolver > New(const word &solverTypeName, const polyMesh &, const IOdictionary &, const pointVectorField &pointDisplacement, const pointIOField &points0)
Select constructed from polyMesh, dictionary and components.
Quality-based under-relaxation for run-time selectable point smoothing.
autoPtr< pointSmoother > pointSmoother_
Point smoothing method.
displacementPointSmoothingMotionSolver(const polyMesh &, const IOdictionary &)
Construct from a polyMesh and an IOdictionary.
virtual tmp< pointField > curPoints() const
Return point location obtained from the current motion field.
labelHashSet facesToMove_
Set of the faces which are to be moved.
polyMeshGeometry meshGeometry_
Part-updatable mesh geometry.
pointField relaxedPoints_
Relaxed point field.
bool relax()
Relax the points.
scalarList relaxationFactors_
Relaxation factors to use in each iteration.
void markAffectedFaces(const labelHashSet &changedFaces, labelHashSet &affectedFaces)
Mark affected faces.
dictionary meshQualityDict_
Mesh quality dictionary.
const label nPointSmootherIter_
Number of point smoother iterations per timestep.
virtual void setFacesToMove(const dictionary &)
Set all the faces to be moved.
virtual void solve()
Solve for motion.
A face is a list of labels corresponding to mesh vertices.
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 mesh motion solver.
const polyMesh & mesh() const
Return reference to mesh.
virtual void twoDCorrectPoints(pointField &) const
const dictionary & coeffDict() const
Const access to the coefficients dictionary.
Smooth ATC in cells having a point to a set of patches supplied by type.
Application of (multi-)patch point constraints.
void constrainDisplacement(pointVectorField &displacement, const bool overrideValue=false) const
Apply boundary conditions (single-patch constraints),.
Abstract base class for point smoothing methods. Handles parallel communication via reset and average...
pointField & points0() noexcept
Return reference to the reference ('0') pointField.
virtual void movePoints(const pointField &)
Update local data for geometry changes.
Mesh consisting of general polyhedral cells.
label nFaces() const noexcept
Number of mesh faces.
A class for managing temporary objects.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
List of values generated by applying the access operation to each list item.
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.
List< label > labelList
A List of labels.
HashSet< label, Hash< label > > labelHashSet
A HashSet of labels, uses label hasher.
GeometricField< vector, pointPatchField, pointMesh > pointVectorField
vectorIOField pointIOField
pointIOField is a vectorIOField.
const word GlobalIOList< Tuple2< scalar, vector > >::typeName("scalarVectorTable")
vectorField pointField
pointField is a vectorField.
#define forAll(list, i)
Loop across all elements in list.
pointField points0(pointIOField(IOobject("points", mesh.time().constant(), polyMesh::meshSubDir, mesh, IOobject::MUST_READ, IOobject::NO_WRITE, IOobject::NO_REGISTER)))