FreeFOAM The Cross-Platform CFD Toolkit
motionSmoother Class Reference

Given a displacement moves the mesh by scaling the displacement back until there are no more mesh errors. More...

#include <dynamicMesh/motionSmoother.H>


Detailed Description

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;
}
}
Note:
  • Shared points (parallel): a processor can have points which are part of pp on another processor but have no pp itself (i.e. it has points and/or edges but no faces of pp). Hence we have to be careful when e.g. synchronising displacements that the value from the processor which has faces of pp get priority. This is currently handled in setDisplacement by resetting the internal displacement to zero before doing anything else. The combine operator used will give preference to non-zero values.
  • Various routines take baffles. These are sets of boundary faces that are treated as a single internal face. This is a hack used to apply movement to internal faces.
  • Mesh constraints are looked up from the supplied dictionary. (uses recursive lookup)
Source files

Definition at line 98 of file motionSmoother.H.

List of all members.

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 &paramDict)
 Construct from mesh, patches to work on and smoothing parameters.
 motionSmoother (polyMesh &, indirectPrimitivePatch &pp, const labelList &adaptPatchIDs, const pointVectorField &, const dictionary &paramDict)
 Construct from mesh, patches to work on and smoothing parameters and.
 ~motionSmoother ()
const polyMeshmesh () const
 Reference to mesh.
const pointMeshpMesh () const
 Reference to pointMesh.
const indirectPrimitivePatchpatch () const
 Reference to patch.
const labelListadaptPatchIDs () const
 Patch labels that are being adapted.
const dictionaryparamDict () const
pointVectorFielddisplacement ()
 Reference to displacement field.
const pointVectorFielddisplacement () const
 Reference to displacement field.
const pointScalarFieldscale () const
 Reference to scale field.
const pointFieldoldPoints () const
 Starting mesh position.
twoDPointCorrectortwoDCorrector ()
 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< scalarFieldmovePoints (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 &paramDict, 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.

Constructor & Destructor Documentation

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.

Definition at line 474 of file motionSmoother.C.


Member Function Documentation

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< scalar >::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< scalar >::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.

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.

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().


The documentation for this class was generated from the following files: