OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

motionSmoother Class Reference

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

Collaboration diagram for motionSmoother:

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 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 &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.

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 93 of file motionSmoother.H.


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 371 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 418 of file motionSmoother.C.

~motionSmoother (  ) 

Definition at line 466 of file motionSmoother.C.


Member Function Documentation

ClassName ( "motionSmoother"   ) 

const Foam::polyMesh & mesh (  )  const

Reference to mesh.

Definition at line 472 of file motionSmoother.C.

const Foam::pointMesh & pMesh (  )  const

Reference to pointMesh.

Definition at line 478 of file motionSmoother.C.

const Foam::indirectPrimitivePatch & patch (  )  const

Reference to patch.

Definition at line 484 of file motionSmoother.C.

const Foam::labelList & adaptPatchIDs (  )  const

Patch labels that are being adapted.

Definition at line 490 of file motionSmoother.C.

const Foam::dictionary & paramDict (  )  const

Definition at line 496 of file motionSmoother.C.

Foam::pointVectorField & displacement (  ) 

Reference to displacement field.

Definition at line 502 of file motionSmoother.C.

const Foam::pointVectorField & displacement (  )  const

Reference to displacement field.

Definition at line 508 of file motionSmoother.C.

const Foam::pointScalarField & scale (  )  const

Reference to scale field.

Definition at line 514 of file motionSmoother.C.

const Foam::pointField & oldPoints (  )  const

Starting mesh position.

Definition at line 520 of file motionSmoother.C.

twoDPointCorrector& twoDCorrector (  )  [inline]

Return reference to 2D point motion correction.

Definition at line 353 of file motionSmoother.H.

void correct (  ) 

Take over existing mesh position.

Definition at line 526 of file motionSmoother.C.

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 538 of file motionSmoother.C.

void correctBoundaryConditions ( pointVectorField &  displacement  )  const

Special correctBoundaryConditions which evaluates fixedValue.

patches first so they get overwritten with any constraint bc's.

Definition at line 660 of file motionSmoother.C.

Foam::tmp< Foam::scalarField > movePoints ( pointField &  newPoints  ) 

Move mesh. Does 2D correction (modifies passed pointField) and.

polyMesh::movePoints. Returns swept volumes.

Definition at line 725 of file motionSmoother.C.

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 787 of file motionSmoother.C.

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 801 of file motionSmoother.C.

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 819 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 839 of file motionSmoother.C.

void updateMesh (  ) 

Update topology.

Definition at line 1072 of file motionSmoother.C.

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 353 of file motionSmootherCheck.C.

Referenced by motionSmoother::checkMesh().

Here is the caller graph for this function:

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 25 of file motionSmootherCheck.C.

References motionSmoother::checkMesh().

Here is the call graph for this function:

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 46 of file motionSmootherCheck.C.

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 371 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 394 of file motionSmootherCheck.C.

void smooth ( const GeometricField< Type, pointPatchField, pointMesh > &  fld,
const scalarField &  edgeWeight,
const bool  separation,
GeometricField< Type, pointPatchField, pointMesh > &  newFld 
) const [inline]

Fully explicit smoothing of internal points with varying.

diffusivity.

Definition at line 253 of file motionSmootherTemplates.C.


The documentation for this class was generated from the following files:
Copyright © 2000-2009 OpenCFD Ltd