Given a displacement moves the mesh by scaling the displacement back until there are no more mesh errors. More...
#include <dynamicMesh/motionSmoother.H>
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 98 of file motionSmoother.H.
Classes | |
class | maxMagEqOp |
To synchronise displacements. We want max displacement since.
| |
Public Member Functions | |
ClassName ("motionSmoother") | |
motionSmoother (polyMesh &, pointMesh &, indirectPrimitivePatch &pp, const labelList &adaptPatchIDs, const dictionary ¶mDict) | |
Construct from mesh, patches to work on and smoothing parameters.
| |
motionSmoother (polyMesh &, indirectPrimitivePatch &pp, const labelList &adaptPatchIDs, const pointVectorField &, const dictionary ¶mDict) | |
Construct from mesh, patches to work on and smoothing parameters and.
| |
~motionSmoother () | |
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 & | displacement () |
Reference to displacement field.
| |
const pointVectorField & | displacement () const |
Reference to displacement field.
| |
const pointScalarField & | scale () const |
Reference to scale field.
| |
const pointField & | oldPoints () const |
Starting mesh position.
| |
twoDPointCorrector & | twoDCorrector () |
Return reference to 2D point motion correction.
| |
void | correct () |
Take over existing mesh position.
| |
void | setDisplacement (pointField &patchDisp) |
Set displacement field from displacement on patch points.
| |
void | correctBoundaryConditions (pointVectorField &) const |
Special correctBoundaryConditions which evaluates fixedValue.
| |
tmp< scalarField > | movePoints (pointField &) |
Move mesh. Does 2D correction (modifies passed pointField) and.
| |
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 | updateMesh () |
Update topology.
| |
template<class Type > | |
void | smooth (const GeometricField< Type, pointPatchField, pointMesh > &fld, const scalarField &edgeWeight, const bool separation, GeometricField< Type, pointPatchField, pointMesh > &newFld) const |
Fully explicit smoothing of internal points with varying.
| |
Static Public Member Functions | |
static bool | checkMesh (const bool report, const polyMesh &mesh, const dictionary &dict, labelHashSet &wrongFaces) |
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) |
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) |
Check (subset of mesh including baffles) with mesh settings.
| |
static bool | checkMesh (const bool report, const dictionary &dict, const polyMeshGeometry &, const labelList &checkFaces, labelHashSet &wrongFaces) |
Check part of mesh with mesh settings in dict.
| |
static bool | checkMesh (const bool report, const dictionary &dict, const polyMeshGeometry &, const labelList &checkFaces, const List< labelPair > &baffles, labelHashSet &wrongFaces) |
Check part of mesh including baffles with mesh settings in dict.
|
motionSmoother | ( | polyMesh & | mesh, |
pointMesh & | pMesh, | ||
indirectPrimitivePatch & | pp, | ||
const labelList & | adaptPatchIDs, | ||
const dictionary & | paramDict | ||
) |
Construct from mesh, patches to work on and smoothing parameters.
Reads displacement field (only boundary conditions used)
Definition at line 379 of file motionSmoother.C.
motionSmoother | ( | polyMesh & | mesh, |
indirectPrimitivePatch & | pp, | ||
const labelList & | adaptPatchIDs, | ||
const pointVectorField & | displacement, | ||
const dictionary & | paramDict | ||
) |
Construct from mesh, patches to work on and smoothing parameters and.
displacementfield (only boundary conditions used)
Definition at line 426 of file motionSmoother.C.
~motionSmoother | ( | ) |
Definition at line 474 of file motionSmoother.C.
ClassName | ( | "motionSmoother" | ) |
const Foam::polyMesh & mesh | ( | ) | const |
Reference to mesh.
Definition at line 480 of file motionSmoother.C.
const Foam::pointMesh & pMesh | ( | ) | const |
Reference to pointMesh.
Definition at line 486 of file motionSmoother.C.
Referenced by autoSnapDriver::smoothDisplacement().
const Foam::indirectPrimitivePatch & patch | ( | ) | const |
Reference to patch.
Definition at line 492 of file motionSmoother.C.
Referenced by autoSnapDriver::calcNearestSurface(), and autoSnapDriver::smoothDisplacement().
const Foam::labelList & adaptPatchIDs | ( | ) | const |
Patch labels that are being adapted.
Definition at line 498 of file motionSmoother.C.
const Foam::dictionary & paramDict | ( | ) | const |
Definition at line 504 of file motionSmoother.C.
Foam::pointVectorField & displacement | ( | ) |
Reference to displacement field.
Definition at line 510 of file motionSmoother.C.
Referenced by autoSnapDriver::scaleMesh(), and autoSnapDriver::smoothDisplacement().
const Foam::pointVectorField & displacement | ( | ) | const |
Reference to displacement field.
Definition at line 516 of file motionSmoother.C.
const Foam::pointScalarField & scale | ( | ) | const |
Reference to scale field.
Definition at line 522 of file motionSmoother.C.
const Foam::pointField & oldPoints | ( | ) | const |
Starting mesh position.
Definition at line 528 of file motionSmoother.C.
twoDPointCorrector& twoDCorrector | ( | ) | [inline]
|
Return reference to 2D point motion correction.
Definition at line 345 of file motionSmoother.H.
void correct | ( | ) |
Take over existing mesh position.
Definition at line 534 of file motionSmoother.C.
Referenced by autoSnapDriver::preSmoothPatch().
void setDisplacement | ( | pointField & | patchDisp ) |
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 546 of file motionSmoother.C.
References polyPatch::coupled(), Foam::endl(), forAll, HashTable< T, Key, Hash >::found(), Foam::mag(), PrimitivePatch< Face, FaceList, PointField, PointType >::meshPoints(), OSstream::name(), patches, Foam::Pout, PstreamBase::scheduled, syncTools::syncPointList(), Foam::meshTools::writeOBJ(), and Vector< Cmpt >::zero.
Referenced by autoSnapDriver::calcNearestSurface(), and autoSnapDriver::preSmoothPatch().
void correctBoundaryConditions | ( | pointVectorField & | displacement ) | const |
Special correctBoundaryConditions which evaluates fixedValue.
patches first so they get overwritten with any constraint bc's.
Definition at line 668 of file motionSmoother.C.
References PstreamBase::blocking, GeometricField< Type, PatchField, GeoMesh >::boundaryField(), forAll, HashTable< T, Key, Hash >::found(), syncTools::syncPointList(), and Vector< Cmpt >::zero.
Foam::tmp< Foam::scalarField > movePoints | ( | pointField & | newPoints ) |
Move mesh. Does 2D correction (modifies passed pointField) and.
polyMesh::movePoints. Returns swept volumes.
Definition at line 733 of file motionSmoother.C.
References E(), e, edge::end(), Foam::endl(), forAll, Foam::Info, Foam::Pout, edge::start(), and WarningIn.
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 796 of file motionSmoother.C.
References Foam::readScalar().
Referenced by autoSnapDriver::preSmoothPatch(), and autoSnapDriver::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 810 of file motionSmoother.C.
Referenced by autoSnapDriver::preSmoothPatch(), and autoSnapDriver::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 828 of file motionSmoother.C.
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 848 of file motionSmoother.C.
References correctBoundaryConditions(), E(), Foam::endl(), Foam::exit(), Foam::FatalError, FatalErrorIn, forAll, forAllConstIter, coupledPolyPatch::forwardT(), Foam::gMax(), Foam::gMin(), Foam::Info, HashSet< Key, Hash >::insert(), dictionary::lookup(), Foam::mag(), patchIdentifier::name(), Foam::nl, IOobject::NO_READ, IOobject::NO_WRITE, coupledPolyPatch::parallel(), patches, Foam::Pout, Foam::readScalar(), Foam::returnReduce(), coupledPolyPatch::separated(), HashTable< T, Key, Hash >::size(), List< T >::size(), pointSet::sync(), syncTools::syncPointList(), and Vector< Cmpt >::zero.
void updateMesh | ( | ) |
Update topology.
Definition at line 1082 of file motionSmoother.C.
References Foam::exit(), Foam::FatalError, FatalErrorIn, forAll, syncTools::getMasterEdges(), Foam::nl, and patches.
bool checkMesh | ( | const bool | report, |
const polyMesh & | mesh, | ||
const dictionary & | dict, | ||
labelHashSet & | wrongFaces | ||
) | [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 361 of file motionSmootherCheck.C.
References Foam::identity(), and primitiveMesh::nFaces().
Referenced by autoLayerDriver::doLayers(), and autoSnapDriver::doSnap().
bool checkMesh | ( | const bool | report, |
const polyMesh & | mesh, | ||
const dictionary & | dict, | ||
const labelList & | checkFaces, | ||
labelHashSet & | wrongFaces | ||
) | [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 33 of file motionSmootherCheck.C.
bool checkMesh | ( | const bool | report, |
const polyMesh & | mesh, | ||
const dictionary & | dict, | ||
const labelList & | checkFaces, | ||
const List< labelPair > & | baffles, | ||
labelHashSet & | wrongFaces | ||
) | [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 54 of file motionSmootherCheck.C.
References primitiveMesh::cellCentres(), primitiveMesh::cellVolumes(), Foam::endl(), primitiveMesh::faceAreas(), primitiveMesh::faceCentres(), Foam::Info, dictionary::lookup(), polyMesh::points(), readScalar, Foam::returnReduce(), Foam::setw(), and HashTable< T, Key, Hash >::size().
bool checkMesh | ( | const bool | report, |
const dictionary & | dict, | ||
const polyMeshGeometry & | meshGeom, | ||
const labelList & | checkFaces, | ||
labelHashSet & | wrongFaces | ||
) | [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 379 of file motionSmootherCheck.C.
bool checkMesh | ( | const bool | report, |
const dictionary & | dict, | ||
const polyMeshGeometry & | meshGeom, | ||
const labelList & | checkFaces, | ||
const List< labelPair > & | baffles, | ||
labelHashSet & | wrongFaces | ||
) | [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 402 of file motionSmootherCheck.C.
References polyMeshGeometry::affectedCells(), polyMeshGeometry::checkCellDeterminant(), polyMeshGeometry::checkFaceAngles(), polyMeshGeometry::checkFaceArea(), polyMeshGeometry::checkFaceDotProduct(), polyMeshGeometry::checkFacePyramids(), polyMeshGeometry::checkFaceSkewness(), polyMeshGeometry::checkFaceTwist(), polyMeshGeometry::checkFaceWeights(), polyMeshGeometry::checkTriangleTwist(), polyMeshGeometry::checkVolRatio(), Foam::endl(), Foam::Info, dictionary::lookup(), polyMeshGeometry::mesh(), polyMesh::points(), readScalar, Foam::returnReduce(), Foam::setw(), and HashTable< T, Key, Hash >::size().
void smooth | ( | const GeometricField< Type, pointPatchField, pointMesh > & | fld, |
const scalarField & | edgeWeight, | ||
const bool | separation, | ||
GeometricField< Type, pointPatchField, pointMesh > & | newFld | ||
) | const |
Fully explicit smoothing of internal points with varying.
diffusivity.
Definition at line 261 of file motionSmootherTemplates.C.
References GeometricField< Type, PatchField, GeoMesh >::correctBoundaryConditions(), and forAll.
Referenced by autoSnapDriver::smoothDisplacement().