Given a displacement moves the mesh by scaling the displacement back until there are no more mesh errors. More...
#include <motionSmootherAlgo.H>

Public Member Functions | |
| ClassName ("motionSmootherAlgo") | |
| motionSmootherAlgo (polyMesh &, pointMesh &, indirectPrimitivePatch &pp, pointVectorField &displacement, pointScalarField &scale, pointField &oldPoints, const labelList &adaptPatchIDs, const dictionary ¶mDict, const bool dryRun=false) | |
| Construct from mesh, patches to work on and smoothing parameters. | |
| ~motionSmootherAlgo () | |
| Destructor. | |
| const polyMesh & | mesh () const |
| Reference to mesh. | |
| const pointMesh & | pMesh () const |
| Reference to pointMesh. | |
| const indirectPrimitivePatch & | patch () const |
| Reference to patch. | |
| const labelList & | adaptPatchIDs () const |
| Patch labels that are being adapted. | |
| const dictionary & | paramDict () const |
| pointVectorField & | pointDisplacement () |
| Return reference to the point motion displacement field. | |
| const pointVectorField & | pointDisplacement () const |
| Return const reference to the point motion displacement field. | |
| void | correct () |
| Take over existing mesh position. | |
| void | setDisplacementPatchFields () |
| Set patch fields on displacement to be consistent with. | |
| void | setDisplacement (pointField &patchDisp) |
| void | correctBoundaryConditions (pointVectorField &) const |
| Special correctBoundaryConditions which evaluates fixedValue. | |
| void | modifyMotionPoints (pointField &newPoints) const |
| Apply optional point constraint (2d correction). | |
| tmp< pointField > | curPoints () const |
| Get the current points (oldPoints+scale*displacement). | |
| scalar | setErrorReduction (const scalar) |
| Set the errorReduction (by how much to scale the displacement. | |
| bool | scaleMesh (labelList &checkFaces, const bool smoothMesh=true, const label nAllow=0) |
| Move mesh with given scale. Return true if mesh ok or has. | |
| bool | scaleMesh (labelList &checkFaces, const List< labelPair > &baffles, const bool smoothMesh=true, const label nAllow=0) |
| Move mesh (with baffles) with given scale. | |
| bool | scaleMesh (labelList &checkFaces, const List< labelPair > &baffles, const dictionary ¶mDict, const dictionary &meshQualityDict, const bool smoothMesh=true, const label nAllow=0) |
| Move mesh with externally provided mesh constraints. | |
| void | movePoints () |
| Update for new mesh geometry. | |
| void | updateMesh () |
| Update for new mesh topology. | |
| template<class Type> | |
| void | smooth (const GeometricField< Type, pointPatchField, pointMesh > &fld, const scalarField &edgeWeight, GeometricField< Type, pointPatchField, pointMesh > &newFld) const |
| Fully explicit smoothing of fields (not positions). | |
| template<class Type> | |
| Foam::tmp< Foam::GeometricField< Type, Foam::pointPatchField, Foam::pointMesh > > | avg (const GeometricField< Type, pointPatchField, pointMesh > &fld, const scalarField &edgeWeight) const |
Static Public Member Functions | |
| static void | setDisplacementPatchFields (const labelList &patchIDs, pointVectorField &pointDisplacement) |
| Set patch fields on patchIDs to be consistent with. | |
| static void | setDisplacement (const labelList &patchIDs, const indirectPrimitivePatch &pp, pointField &patchDisp, pointVectorField &displacement) |
| Set displacement field from displacement on patch points. | |
| 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. | |
| static bool | checkMesh (const bool report, const polyMesh &mesh, const dictionary &dict, const labelList &checkFaces, labelHashSet &wrongFaces, const bool dryRun=false) |
| Check (subset of mesh) with mesh settings in dict. | |
| static bool | checkMesh (const bool report, const polyMesh &mesh, const dictionary &dict, const labelList &checkFaces, const List< labelPair > &baffles, labelHashSet &wrongFaces, const bool dryRun=false) |
| Check (subset of mesh including baffles) with mesh settings. | |
| static bool | checkMesh (const bool report, const dictionary &dict, const polyMeshGeometry &, const pointField &, const labelList &checkFaces, labelHashSet &wrongFaces, const bool dryRun=false) |
| Check part of mesh with mesh settings in dict. | |
| static bool | checkMesh (const bool report, const dictionary &dict, const polyMeshGeometry &, const pointField &, const labelList &checkFaces, const List< labelPair > &baffles, labelHashSet &wrongFaces, const bool dryRun=false) |
| Check part of mesh including baffles with mesh settings in dict. | |
| template<class Type> | |
| static Type | get (const dictionary &dict, const word &keyword, const bool noExit, enum keyType::option matchOpt, const Type &defaultValue=Zero) |
| Wrapper around dictionary::get which does not exit. | |
Given a displacement moves the mesh by scaling the displacement back until there are no more mesh errors.
Holds displacement field (read upon construction since need boundary conditions) and scaling factor and optional patch number on which to scale back displacement.
E.g.
// Construct iterative mesh mover.
motionSmoother meshMover(mesh, labelList(1, patchi));
// Set desired displacement:
meshMover.displacement() = ..
for (label iter = 0; iter < maxIter; iter++)
{
if (meshMover.scaleMesh(true))
{
Info<< "Successfully moved mesh" << endl;
return true;
}
}
Definition at line 96 of file motionSmootherAlgo.H.
| motionSmootherAlgo | ( | polyMesh & | mesh, |
| pointMesh & | pMesh, | ||
| indirectPrimitivePatch & | pp, | ||
| pointVectorField & | displacement, | ||
| pointScalarField & | scale, | ||
| pointField & | oldPoints, | ||
| const labelList & | adaptPatchIDs, | ||
| const dictionary & | paramDict, | ||
| const bool | dryRun = false ) |
Construct from mesh, patches to work on and smoothing parameters.
Definition at line 318 of file motionSmootherAlgo.C.
References adaptPatchIDs(), mesh(), nPoints, paramDict(), pMesh(), pp(), and updateMesh().

| ~motionSmootherAlgo | ( | ) |
Destructor.
Definition at line 348 of file motionSmootherAlgo.C.
| ClassName | ( | "motionSmootherAlgo" | ) |
| const Foam::polyMesh & mesh | ( | ) | const |
Reference to mesh.
Definition at line 354 of file motionSmootherAlgo.C.
Referenced by avg(), checkMesh(), checkMesh(), checkMesh(), motionSmoother::ClassName(), motionSmoother::motionSmoother(), motionSmoother::motionSmoother(), motionSmootherAlgo(), and setDisplacement().

| const Foam::pointMesh & pMesh | ( | ) | const |
Reference to pointMesh.
Definition at line 360 of file motionSmootherAlgo.C.
Referenced by motionSmoother::ClassName(), motionSmoother::motionSmoother(), motionSmootherAlgo(), and snappySnapDriver::smoothDisplacement().

| const Foam::indirectPrimitivePatch & patch | ( | ) | const |
Reference to patch.
Definition at line 366 of file motionSmootherAlgo.C.
Referenced by snappySnapDriver::smoothDisplacement().

| const Foam::labelList & adaptPatchIDs | ( | ) | const |
Patch labels that are being adapted.
Definition at line 372 of file motionSmootherAlgo.C.
Referenced by motionSmoother::ClassName(), ClassName(), motionSmoother::motionSmoother(), motionSmoother::motionSmoother(), and motionSmootherAlgo().

| const Foam::dictionary & paramDict | ( | ) | const |
Definition at line 378 of file motionSmootherAlgo.C.
Referenced by motionSmoother::ClassName(), ClassName(), motionSmoother::motionSmoother(), motionSmoother::motionSmoother(), motionSmootherAlgo(), and scaleMesh().

|
inline |
Return reference to the point motion displacement field.
Definition at line 376 of file motionSmootherAlgo.H.
Referenced by snappySnapDriver::preSmoothPatch().

|
inline |
Return const reference to the point motion displacement field.
Definition at line 384 of file motionSmootherAlgo.H.
| void correct | ( | ) |
Take over existing mesh position.
Definition at line 384 of file motionSmootherAlgo.C.
Referenced by snappySnapDriver::doSnap(), and snappySnapDriver::preSmoothPatch().

|
static |
Set patch fields on patchIDs to be consistent with.
all other boundary conditions
Definition at line 396 of file motionSmootherAlgo.C.
References GeometricField< Type, PatchField, GeoMesh >::boundaryFieldRef(), pointConstraints::constrainCorners(), HashTable< T, Key, Hash >::found(), DimensionedField< Type, GeoMesh >::mesh(), MeshObject< pointMesh, UpdateableMeshObject, pointConstraints >::New(), UPstream::nonBlocking, UPstream::nRequests(), patchIDs, syncTools::syncPointList(), VectorSpace< Form, Cmpt, Ncmpts >::uniform(), and UPstream::waitRequests().
Referenced by setDisplacement(), and setDisplacementPatchFields().


| void setDisplacementPatchFields | ( | ) |
Set patch fields on displacement to be consistent with.
internal values.
Definition at line 456 of file motionSmootherAlgo.C.
References setDisplacementPatchFields().

|
static |
Set displacement field from displacement on patch points.
Modify provided displacement to be consistent with actual boundary conditions on displacement. Note: resets the displacement to be 0 on coupled patches beforehand to make sure shared points partially on pp (on some processors) and partially not (on other processors) get the value from pp.
Definition at line 462 of file motionSmootherAlgo.C.
References GeometricField< Type, PatchField, GeoMesh >::boundaryFieldRef(), Foam::endl(), forAll, GeometricField< Type, PatchField, GeoMesh >::internalFieldRef(), Foam::mag(), DimensionedField< Type, GeoMesh >::mesh(), mesh(), OFstream::name(), patchIDs, Foam::Pout, pp(), setDisplacementPatchFields(), syncTools::syncPointList(), bitSet::test(), VectorSpace< Form, Cmpt, Ncmpts >::uniform(), and Foam::meshTools::writeOBJ().
Referenced by snappyLayerDriver::addLayers(), snappySnapDriver::doSnap(), snappySnapDriver::preSmoothPatch(), and setDisplacement().


| void setDisplacement | ( | pointField & | patchDisp | ) |
Definition at line 564 of file motionSmootherAlgo.C.
References setDisplacement().

| void correctBoundaryConditions | ( | pointVectorField & | displacement | ) | const |
Special correctBoundaryConditions which evaluates fixedValue.
patches first so they get overwritten with any constraint bc's.
Definition at line 571 of file motionSmootherAlgo.C.
References GeometricField< Type, PatchField, GeoMesh >::boundaryFieldRef(), pointConstraints::constrainCorners(), HashTable< T, Key, Hash >::found(), DimensionedField< Type, GeoMesh >::mesh(), MeshObject< pointMesh, UpdateableMeshObject, pointConstraints >::New(), UPstream::nonBlocking, UPstream::nRequests(), syncTools::syncPointList(), UPstream::waitRequests(), and VectorSpace< Form, Cmpt, Ncmpts >::zero.

| void modifyMotionPoints | ( | pointField & | newPoints | ) | const |
Apply optional point constraint (2d correction).
Definition at line 639 of file motionSmootherAlgo.C.
References twoDPointCorrector::correctPoints(), e, Foam::endl(), forAll, Foam::Info, MeshObject< polyMesh, UpdateableMeshObject, twoDPointCorrector >::New(), twoDPointCorrector::normalEdgeIndices(), twoDPointCorrector::planeNormal(), Foam::Pout, twoDPointCorrector::required(), and WarningInFunction.
Referenced by curPoints().


| Foam::tmp< Foam::pointField > curPoints | ( | ) | const |
Get the current points (oldPoints+scale*displacement).
Definition at line 751 of file motionSmootherAlgo.C.
References correctBoundaryConditions(), e, Foam::endl(), forAll, Foam::isA(), modifyMotionPoints(), IOobjectOption::NO_READ, IOobjectOption::NO_REGISTER, IOobjectOption::NO_WRITE, pbm, Foam::Pout, GeometricField< Type, PatchField, GeoMesh >::primitiveField(), tmp< T >::ref(), List< T >::setSize(), UPtrList< T >::size(), FieldBase::typeName, and VectorSpace< Form, Cmpt, Ncmpts >::zero.
Referenced by scaleMesh().


| Foam::scalar setErrorReduction | ( | const scalar | errorReduction | ) |
Set the errorReduction (by how much to scale the displacement.
at error locations) parameter. Returns the old value. Set to 0 (so revert to old mesh) grows out one cell layer from error faces.
Definition at line 699 of file motionSmootherAlgo.C.
Referenced by snappySnapDriver::preSmoothPatch(), and snappySnapDriver::scaleMesh().

| bool scaleMesh | ( | labelList & | checkFaces, |
| const bool | smoothMesh = true, | ||
| const label | nAllow = 0 ) |
Move mesh with given scale. Return true if mesh ok or has.
less than nAllow errors, false otherwise and locally update scale. Smoothmesh=false means only patch points get moved. Parallel ok (as long as displacement field is consistent across patches)
Definition at line 713 of file motionSmootherAlgo.C.
References scaleMesh().
Referenced by snappySnapDriver::preSmoothPatch(), scaleMesh(), scaleMesh(), and snappySnapDriver::scaleMesh().


| bool scaleMesh | ( | labelList & | checkFaces, |
| const List< labelPair > & | baffles, | ||
| const bool | smoothMesh = true, | ||
| const label | nAllow = 0 ) |
Move mesh (with baffles) with given scale.
Definition at line 731 of file motionSmootherAlgo.C.
References scaleMesh().

| bool scaleMesh | ( | labelList & | checkFaces, |
| const List< labelPair > & | baffles, | ||
| const dictionary & | paramDict, | ||
| const dictionary & | meshQualityDict, | ||
| const bool | smoothMesh = true, | ||
| const label | nAllow = 0 ) |
Move mesh with externally provided mesh constraints.
Definition at line 824 of file motionSmootherAlgo.C.
References checkMesh(), coupled, curPoints(), Foam::endl(), Foam::exit(), Foam::FatalError, FatalErrorInFunction, forAll, get(), Foam::gMinMax(), Foam::Info, HashSet< Key, Hash >::insert(), limits, Foam::mag(), movePoints(), Foam::nl, paramDict(), patches, Foam::Pout, pp(), Foam::refCast(), keyType::REGEX_RECURSIVE, Foam::returnReduce(), HashTable< T, Key, Hash >::size(), faceSet::sync(), pointSet::sync(), syncTools::syncPointList(), and VectorSpace< Form, Cmpt, Ncmpts >::zero.

| void movePoints | ( | ) |
Update for new mesh geometry.
Definition at line 690 of file motionSmootherAlgo.C.
Referenced by scaleMesh().

| void updateMesh | ( | ) |
Update for new mesh topology.
Definition at line 1039 of file motionSmootherAlgo.C.
References Foam::exit(), Foam::FatalError, FatalErrorInFunction, syncTools::getMasterEdges(), Foam::isA(), Foam::nl, and patches.
Referenced by motionSmootherAlgo().


|
static |
Check mesh with mesh settings in dict. Collects incorrect faces.
in set. Returns true if one or more faces in error. Parallel ok.
Definition at line 496 of file motionSmootherAlgoCheck.C.
References checkMesh(), dict, Foam::identity(), and mesh().
Referenced by edgeCollapser::checkBadFaces(), checkMesh(), checkMesh(), checkMesh(), snappyLayerDriver::doLayers(), snappySnapDriver::doSnap(), meshRefinement::mergeEdgesUndo(), meshRefinement::mergePatchFacesUndo(), displacementPointSmoothingMotionSolver::relax(), displacementSmartPointSmoothingMotionSolver::relax(), scaleMesh(), and meshRefinement::splitFacesUndo().


|
static |
Check (subset of mesh) with mesh settings in dict.
Collects incorrect faces in set. Returns true if one or more faces in error. Parallel ok.
Definition at line 29 of file motionSmootherAlgoCheck.C.
References checkMesh(), dict, and mesh().

|
static |
Check (subset of mesh including baffles) with mesh settings.
in dict. Collects incorrect faces in set. Returns true if one or more faces in error. Parallel ok.
Definition at line 52 of file motionSmootherAlgoCheck.C.
References polyMeshGeometry::affectedCells(), polyMeshGeometry::checkCellDeterminant(), polyMeshGeometry::checkEdgeLength(), polyMeshGeometry::checkFaceAngles(), polyMeshGeometry::checkFaceArea(), polyMeshGeometry::checkFaceDotProduct(), polyMeshGeometry::checkFaceFlatness(), polyMeshGeometry::checkFacePyramids(), polyMeshGeometry::checkFaceSkewness(), polyMeshGeometry::checkFaceTets(), polyMeshGeometry::checkFaceTwist(), polyMeshGeometry::checkFaceWeights(), polyMeshGeometry::checkTriangleTwist(), polyMeshGeometry::checkVolRatio(), dict, Foam::endl(), Foam::FatalError, Foam::FatalIOError, get(), Foam::Info, HashSet< Key, Hash >::insert(), IOWarningInFunction, mesh(), Foam::nl, pFaces, keyType::REGEX_RECURSIVE, Foam::returnReduce(), Foam::setw(), and HashTable< T, Key, Hash >::size().

|
static |
Check part of mesh with mesh settings in dict.
Collects incorrect faces in set. Returns true if one or more faces in error. Parallel ok.
Definition at line 516 of file motionSmootherAlgoCheck.C.
References checkMesh(), dict, and points.

|
static |
Check part of mesh including baffles with mesh settings in dict.
Collects incorrect faces in set. Returns true if one or more faces in error. Parallel ok.
Definition at line 543 of file motionSmootherAlgoCheck.C.
References polyMeshGeometry::affectedCells(), polyMeshGeometry::cellCentres(), polyMeshGeometry::checkCellDeterminant(), polyMeshGeometry::checkEdgeLength(), polyMeshGeometry::checkFaceAngles(), polyMeshGeometry::checkFaceArea(), polyMeshGeometry::checkFaceDotProduct(), polyMeshGeometry::checkFaceFlatness(), polyMeshGeometry::checkFacePyramids(), polyMeshGeometry::checkFaceSkewness(), polyMeshGeometry::checkFaceTets(), polyMeshGeometry::checkFaceTwist(), polyMeshGeometry::checkFaceWeights(), polyMeshGeometry::checkTriangleTwist(), polyMeshGeometry::checkVolRatio(), dict, Foam::endl(), polyMeshGeometry::faceAreas(), polyMeshGeometry::faceCentres(), Foam::FatalError, Foam::FatalIOError, get(), Foam::Info, HashSet< Key, Hash >::insert(), polyMeshGeometry::mesh(), Foam::nl, primitiveMesh::nPoints(), Foam::Perr, pFaces, primitiveMesh::pointFaces(), points, keyType::REGEX_RECURSIVE, Foam::returnReduce(), Foam::setw(), and HashTable< T, Key, Hash >::size().

| void smooth | ( | const GeometricField< Type, pointPatchField, pointMesh > & | fld, |
| const scalarField & | edgeWeight, | ||
| GeometricField< Type, pointPatchField, pointMesh > & | newFld ) const |
Fully explicit smoothing of fields (not positions).
of internal points with varying diffusivity.
Definition at line 225 of file motionSmootherAlgoTemplates.C.
References pointConstraints::constrain(), fld(), forAll, and MeshObject< pointMesh, UpdateableMeshObject, pointConstraints >::New().
Referenced by snappySnapDriver::smoothDisplacement().


|
static |
Wrapper around dictionary::get which does not exit.
Definition at line 287 of file motionSmootherAlgoTemplates.C.
References dict, Foam::endl(), Foam::FatalIOError, IOobjectOption::MUST_READ, and IOobjectOption::READ_IF_PRESENT.
Referenced by checkMesh(), checkMesh(), and scaleMesh().


| Foam::tmp< Foam::GeometricField< Type, Foam::pointPatchField, Foam::pointMesh > > avg | ( | const GeometricField< Type, pointPatchField, pointMesh > & | fld, |
| const scalarField & | edgeWeight ) const |
Definition at line 134 of file motionSmootherAlgoTemplates.C.
References pointConstraints::constrain(), e, fld(), forAll, Foam::mag(), mesh(), MeshObject< pointMesh, UpdateableMeshObject, pointConstraints >::New(), Foam::New(), IOobjectOption::NO_READ, IOobjectOption::NO_REGISTER, IOobjectOption::NO_WRITE, syncTools::syncPointList(), and Foam::Zero.
