mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: motionSmoother: split into storage and algorithm
This commit is contained in:
@ -84,7 +84,9 @@ polyMeshAdder/polyMeshAdder.C
|
|||||||
fvMeshTools/fvMeshTools.C
|
fvMeshTools/fvMeshTools.C
|
||||||
|
|
||||||
motionSmoother/motionSmoother.C
|
motionSmoother/motionSmoother.C
|
||||||
motionSmoother/motionSmootherCheck.C
|
motionSmoother/motionSmootherAlgo.C
|
||||||
|
motionSmoother/motionSmootherAlgoCheck.C
|
||||||
|
motionSmoother/motionSmootherData.C
|
||||||
motionSmoother/polyMeshGeometry/polyMeshGeometry.C
|
motionSmoother/polyMeshGeometry/polyMeshGeometry.C
|
||||||
motionSmoother/badQualityToCell/badQualityToCell.C
|
motionSmoother/badQualityToCell/badQualityToCell.C
|
||||||
motionSmoother/badQualityToFace/badQualityToFace.C
|
motionSmoother/badQualityToFace/badQualityToFace.C
|
||||||
|
|||||||
86
src/dynamicMesh/motionSmoother/motionSmoother.C
Normal file
86
src/dynamicMesh/motionSmoother/motionSmoother.C
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "motionSmoother.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(motionSmoother, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::motionSmoother::motionSmoother
|
||||||
|
(
|
||||||
|
polyMesh& mesh,
|
||||||
|
pointMesh& pMesh,
|
||||||
|
indirectPrimitivePatch& pp,
|
||||||
|
const labelList& adaptPatchIDs,
|
||||||
|
const dictionary& paramDict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
motionSmootherData(pMesh),
|
||||||
|
motionSmootherAlgo
|
||||||
|
(
|
||||||
|
mesh,
|
||||||
|
pMesh,
|
||||||
|
pp,
|
||||||
|
motionSmootherData::displacement_,
|
||||||
|
motionSmootherData::scale_,
|
||||||
|
motionSmootherData::oldPoints_,
|
||||||
|
adaptPatchIDs,
|
||||||
|
paramDict
|
||||||
|
)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::motionSmoother::motionSmoother
|
||||||
|
(
|
||||||
|
polyMesh& mesh,
|
||||||
|
indirectPrimitivePatch& pp,
|
||||||
|
const labelList& adaptPatchIDs,
|
||||||
|
const pointVectorField& displacement,
|
||||||
|
const dictionary& paramDict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
motionSmootherData(displacement),
|
||||||
|
motionSmootherAlgo
|
||||||
|
(
|
||||||
|
mesh,
|
||||||
|
const_cast<pointMesh&>(displacement.mesh()),
|
||||||
|
pp,
|
||||||
|
motionSmootherData::displacement_,
|
||||||
|
motionSmootherData::scale_,
|
||||||
|
motionSmootherData::oldPoints_,
|
||||||
|
adaptPatchIDs,
|
||||||
|
paramDict
|
||||||
|
)
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
137
src/dynamicMesh/motionSmoother/motionSmoother.H
Normal file
137
src/dynamicMesh/motionSmoother/motionSmoother.H
Normal file
@ -0,0 +1,137 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::motionSmoother
|
||||||
|
|
||||||
|
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.
|
||||||
|
\verbatim
|
||||||
|
// 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
\endverbatim
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
motionSmoother.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef motionSmoother_H
|
||||||
|
#define motionSmoother_H
|
||||||
|
|
||||||
|
#include "motionSmootherData.H"
|
||||||
|
#include "motionSmootherAlgo.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class motionSmoother Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class motionSmoother
|
||||||
|
:
|
||||||
|
public motionSmootherData,
|
||||||
|
public motionSmootherAlgo
|
||||||
|
|
||||||
|
{
|
||||||
|
// Private class
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
ClassName("motionSmoother");
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from mesh, patches to work on and smoothing parameters.
|
||||||
|
// Reads displacement field (only boundary conditions used)
|
||||||
|
motionSmoother
|
||||||
|
(
|
||||||
|
polyMesh&,
|
||||||
|
pointMesh&,
|
||||||
|
indirectPrimitivePatch& pp, // 'outside' points
|
||||||
|
const labelList& adaptPatchIDs, // patches forming 'outside'
|
||||||
|
const dictionary& paramDict
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from mesh, patches to work on and smoothing parameters and
|
||||||
|
// displacementfield (only boundary conditions used)
|
||||||
|
motionSmoother
|
||||||
|
(
|
||||||
|
polyMesh&,
|
||||||
|
indirectPrimitivePatch& pp, // 'outside' points
|
||||||
|
const labelList& adaptPatchIDs, // patches forming 'outside'
|
||||||
|
const pointVectorField&,
|
||||||
|
const dictionary& paramDict
|
||||||
|
);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -23,7 +23,7 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "motionSmoother.H"
|
#include "motionSmootherAlgo.H"
|
||||||
#include "twoDPointCorrector.H"
|
#include "twoDPointCorrector.H"
|
||||||
#include "faceSet.H"
|
#include "faceSet.H"
|
||||||
#include "pointSet.H"
|
#include "pointSet.H"
|
||||||
@ -37,13 +37,13 @@ License
|
|||||||
|
|
||||||
namespace Foam
|
namespace Foam
|
||||||
{
|
{
|
||||||
defineTypeNameAndDebug(motionSmoother, 0);
|
defineTypeNameAndDebug(motionSmootherAlgo, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::motionSmoother::testSyncPositions
|
void Foam::motionSmootherAlgo::testSyncPositions
|
||||||
(
|
(
|
||||||
const pointField& fld,
|
const pointField& fld,
|
||||||
const scalar maxMag
|
const scalar maxMag
|
||||||
@ -65,7 +65,7 @@ void Foam::motionSmoother::testSyncPositions
|
|||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"motionSmoother::testSyncPositions"
|
"motionSmootherAlgo::testSyncPositions"
|
||||||
"("
|
"("
|
||||||
"const pointField&, "
|
"const pointField&, "
|
||||||
"const scalar"
|
"const scalar"
|
||||||
@ -78,7 +78,7 @@ void Foam::motionSmoother::testSyncPositions
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//Foam::tmp<Foam::scalarField> Foam::motionSmoother::sumWeights
|
//Foam::tmp<Foam::scalarField> Foam::motionSmootherAlgo::sumWeights
|
||||||
//(
|
//(
|
||||||
// const scalarField& edgeWeight
|
// const scalarField& edgeWeight
|
||||||
//) const
|
//) const
|
||||||
@ -122,11 +122,11 @@ void Foam::motionSmoother::testSyncPositions
|
|||||||
|
|
||||||
|
|
||||||
// From pointPatchInterpolation
|
// From pointPatchInterpolation
|
||||||
void Foam::motionSmoother::makePatchPatchAddressing()
|
void Foam::motionSmootherAlgo::makePatchPatchAddressing()
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Pout<< "motionSmoother::makePatchPatchAddressing() : "
|
Pout<< "motionSmootherAlgo::makePatchPatchAddressing() : "
|
||||||
<< "constructing boundary addressing"
|
<< "constructing boundary addressing"
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
@ -232,14 +232,14 @@ void Foam::motionSmoother::makePatchPatchAddressing()
|
|||||||
meshTools::writeOBJ(str, mesh_.points()[pointI]);
|
meshTools::writeOBJ(str, mesh_.points()[pointI]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Pout<< "motionSmoother::makePatchPatchAddressing() : "
|
Pout<< "motionSmootherAlgo::makePatchPatchAddressing() : "
|
||||||
<< "finished constructing boundary addressing"
|
<< "finished constructing boundary addressing"
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::motionSmoother::checkFld(const pointScalarField& fld)
|
void Foam::motionSmootherAlgo::checkFld(const pointScalarField& fld)
|
||||||
{
|
{
|
||||||
forAll(fld, pointI)
|
forAll(fld, pointI)
|
||||||
{
|
{
|
||||||
@ -249,15 +249,18 @@ void Foam::motionSmoother::checkFld(const pointScalarField& fld)
|
|||||||
{}
|
{}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FatalErrorIn("motionSmoother::checkFld(const pointScalarField&)")
|
FatalErrorIn
|
||||||
<< "Problem : point:" << pointI << " value:" << val
|
(
|
||||||
|
"motionSmootherAlgo::checkFld"
|
||||||
|
"(const pointScalarField&)"
|
||||||
|
) << "Problem : point:" << pointI << " value:" << val
|
||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::labelHashSet Foam::motionSmoother::getPoints
|
Foam::labelHashSet Foam::motionSmootherAlgo::getPoints
|
||||||
(
|
(
|
||||||
const labelHashSet& faceLabels
|
const labelHashSet& faceLabels
|
||||||
) const
|
) const
|
||||||
@ -278,7 +281,7 @@ Foam::labelHashSet Foam::motionSmoother::getPoints
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::tmp<Foam::scalarField> Foam::motionSmoother::calcEdgeWeights
|
Foam::tmp<Foam::scalarField> Foam::motionSmootherAlgo::calcEdgeWeights
|
||||||
(
|
(
|
||||||
const pointField& points
|
const pointField& points
|
||||||
) const
|
) const
|
||||||
@ -297,7 +300,7 @@ Foam::tmp<Foam::scalarField> Foam::motionSmoother::calcEdgeWeights
|
|||||||
|
|
||||||
|
|
||||||
// Smooth on selected points (usually patch points)
|
// Smooth on selected points (usually patch points)
|
||||||
void Foam::motionSmoother::minSmooth
|
void Foam::motionSmootherAlgo::minSmooth
|
||||||
(
|
(
|
||||||
const scalarField& edgeWeights,
|
const scalarField& edgeWeights,
|
||||||
const PackedBoolList& isAffectedPoint,
|
const PackedBoolList& isAffectedPoint,
|
||||||
@ -332,7 +335,7 @@ void Foam::motionSmoother::minSmooth
|
|||||||
|
|
||||||
|
|
||||||
// Smooth on all internal points
|
// Smooth on all internal points
|
||||||
void Foam::motionSmoother::minSmooth
|
void Foam::motionSmootherAlgo::minSmooth
|
||||||
(
|
(
|
||||||
const scalarField& edgeWeights,
|
const scalarField& edgeWeights,
|
||||||
const PackedBoolList& isAffectedPoint,
|
const PackedBoolList& isAffectedPoint,
|
||||||
@ -365,7 +368,7 @@ void Foam::motionSmoother::minSmooth
|
|||||||
|
|
||||||
|
|
||||||
// Scale on all internal points
|
// Scale on all internal points
|
||||||
void Foam::motionSmoother::scaleField
|
void Foam::motionSmootherAlgo::scaleField
|
||||||
(
|
(
|
||||||
const labelHashSet& pointLabels,
|
const labelHashSet& pointLabels,
|
||||||
const scalar scale,
|
const scalar scale,
|
||||||
@ -385,7 +388,7 @@ void Foam::motionSmoother::scaleField
|
|||||||
|
|
||||||
|
|
||||||
// Scale on selected points (usually patch points)
|
// Scale on selected points (usually patch points)
|
||||||
void Foam::motionSmoother::scaleField
|
void Foam::motionSmootherAlgo::scaleField
|
||||||
(
|
(
|
||||||
const labelList& meshPoints,
|
const labelList& meshPoints,
|
||||||
const labelHashSet& pointLabels,
|
const labelHashSet& pointLabels,
|
||||||
@ -406,7 +409,7 @@ void Foam::motionSmoother::scaleField
|
|||||||
|
|
||||||
|
|
||||||
// Lower on internal points
|
// Lower on internal points
|
||||||
void Foam::motionSmoother::subtractField
|
void Foam::motionSmootherAlgo::subtractField
|
||||||
(
|
(
|
||||||
const labelHashSet& pointLabels,
|
const labelHashSet& pointLabels,
|
||||||
const scalar f,
|
const scalar f,
|
||||||
@ -426,7 +429,7 @@ void Foam::motionSmoother::subtractField
|
|||||||
|
|
||||||
|
|
||||||
// Scale on selected points (usually patch points)
|
// Scale on selected points (usually patch points)
|
||||||
void Foam::motionSmoother::subtractField
|
void Foam::motionSmootherAlgo::subtractField
|
||||||
(
|
(
|
||||||
const labelList& meshPoints,
|
const labelList& meshPoints,
|
||||||
const labelHashSet& pointLabels,
|
const labelHashSet& pointLabels,
|
||||||
@ -446,13 +449,13 @@ void Foam::motionSmoother::subtractField
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Foam::motionSmoother::isInternalPoint(const label pointI) const
|
bool Foam::motionSmootherAlgo::isInternalPoint(const label pointI) const
|
||||||
{
|
{
|
||||||
return isInternalPoint_.get(pointI) == 1;
|
return isInternalPoint_.get(pointI) == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::motionSmoother::getAffectedFacesAndPoints
|
void Foam::motionSmootherAlgo::getAffectedFacesAndPoints
|
||||||
(
|
(
|
||||||
const label nPointIter,
|
const label nPointIter,
|
||||||
const faceSet& wrongFaces,
|
const faceSet& wrongFaces,
|
||||||
@ -510,11 +513,14 @@ void Foam::motionSmoother::getAffectedFacesAndPoints
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::motionSmoother::motionSmoother
|
Foam::motionSmootherAlgo::motionSmootherAlgo
|
||||||
(
|
(
|
||||||
polyMesh& mesh,
|
polyMesh& mesh,
|
||||||
pointMesh& pMesh,
|
pointMesh& pMesh,
|
||||||
indirectPrimitivePatch& pp,
|
indirectPrimitivePatch& pp,
|
||||||
|
pointVectorField& displacement,
|
||||||
|
pointScalarField& scale,
|
||||||
|
pointField& oldPoints,
|
||||||
const labelList& adaptPatchIDs,
|
const labelList& adaptPatchIDs,
|
||||||
const dictionary& paramDict
|
const dictionary& paramDict
|
||||||
)
|
)
|
||||||
@ -522,81 +528,11 @@ Foam::motionSmoother::motionSmoother
|
|||||||
mesh_(mesh),
|
mesh_(mesh),
|
||||||
pMesh_(pMesh),
|
pMesh_(pMesh),
|
||||||
pp_(pp),
|
pp_(pp),
|
||||||
|
displacement_(displacement),
|
||||||
|
scale_(scale),
|
||||||
|
oldPoints_(oldPoints),
|
||||||
adaptPatchIDs_(adaptPatchIDs),
|
adaptPatchIDs_(adaptPatchIDs),
|
||||||
paramDict_(paramDict),
|
paramDict_(paramDict),
|
||||||
displacement_
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"displacement",
|
|
||||||
mesh_.time().timeName(),
|
|
||||||
mesh_,
|
|
||||||
IOobject::MUST_READ,
|
|
||||||
IOobject::AUTO_WRITE
|
|
||||||
),
|
|
||||||
pMesh_
|
|
||||||
),
|
|
||||||
scale_
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"scale",
|
|
||||||
mesh_.time().timeName(),
|
|
||||||
mesh_,
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::AUTO_WRITE
|
|
||||||
),
|
|
||||||
pMesh_,
|
|
||||||
dimensionedScalar("scale", dimless, 1.0)
|
|
||||||
),
|
|
||||||
oldPoints_(mesh_.points()),
|
|
||||||
isInternalPoint_(mesh_.nPoints(), 1),
|
|
||||||
twoDCorrector_(mesh_)
|
|
||||||
{
|
|
||||||
updateMesh();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::motionSmoother::motionSmoother
|
|
||||||
(
|
|
||||||
polyMesh& mesh,
|
|
||||||
indirectPrimitivePatch& pp,
|
|
||||||
const labelList& adaptPatchIDs,
|
|
||||||
const pointVectorField& displacement,
|
|
||||||
const dictionary& paramDict
|
|
||||||
)
|
|
||||||
:
|
|
||||||
mesh_(mesh),
|
|
||||||
pMesh_(const_cast<pointMesh&>(displacement.mesh())),
|
|
||||||
pp_(pp),
|
|
||||||
adaptPatchIDs_(adaptPatchIDs),
|
|
||||||
paramDict_(paramDict),
|
|
||||||
displacement_
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"displacement",
|
|
||||||
mesh_.time().timeName(),
|
|
||||||
mesh_,
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::AUTO_WRITE
|
|
||||||
),
|
|
||||||
displacement
|
|
||||||
),
|
|
||||||
scale_
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"scale",
|
|
||||||
mesh_.time().timeName(),
|
|
||||||
mesh_,
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::AUTO_WRITE
|
|
||||||
),
|
|
||||||
pMesh_,
|
|
||||||
dimensionedScalar("scale", dimless, 1.0)
|
|
||||||
),
|
|
||||||
oldPoints_(mesh_.points()),
|
|
||||||
isInternalPoint_(mesh_.nPoints(), 1),
|
isInternalPoint_(mesh_.nPoints(), 1),
|
||||||
twoDCorrector_(mesh_)
|
twoDCorrector_(mesh_)
|
||||||
{
|
{
|
||||||
@ -606,67 +542,43 @@ Foam::motionSmoother::motionSmoother
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::motionSmoother::~motionSmoother()
|
Foam::motionSmootherAlgo::~motionSmootherAlgo()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
const Foam::polyMesh& Foam::motionSmoother::mesh() const
|
const Foam::polyMesh& Foam::motionSmootherAlgo::mesh() const
|
||||||
{
|
{
|
||||||
return mesh_;
|
return mesh_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const Foam::pointMesh& Foam::motionSmoother::pMesh() const
|
const Foam::pointMesh& Foam::motionSmootherAlgo::pMesh() const
|
||||||
{
|
{
|
||||||
return pMesh_;
|
return pMesh_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const Foam::indirectPrimitivePatch& Foam::motionSmoother::patch() const
|
const Foam::indirectPrimitivePatch& Foam::motionSmootherAlgo::patch() const
|
||||||
{
|
{
|
||||||
return pp_;
|
return pp_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const Foam::labelList& Foam::motionSmoother::adaptPatchIDs() const
|
const Foam::labelList& Foam::motionSmootherAlgo::adaptPatchIDs() const
|
||||||
{
|
{
|
||||||
return adaptPatchIDs_;
|
return adaptPatchIDs_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const Foam::dictionary& Foam::motionSmoother::paramDict() const
|
const Foam::dictionary& Foam::motionSmootherAlgo::paramDict() const
|
||||||
{
|
{
|
||||||
return paramDict_;
|
return paramDict_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::pointVectorField& Foam::motionSmoother::displacement()
|
void Foam::motionSmootherAlgo::correct()
|
||||||
{
|
|
||||||
return displacement_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const Foam::pointVectorField& Foam::motionSmoother::displacement() const
|
|
||||||
{
|
|
||||||
return displacement_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const Foam::pointScalarField& Foam::motionSmoother::scale() const
|
|
||||||
{
|
|
||||||
return scale_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const Foam::pointField& Foam::motionSmoother::oldPoints() const
|
|
||||||
{
|
|
||||||
return oldPoints_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::motionSmoother::correct()
|
|
||||||
{
|
{
|
||||||
oldPoints_ = mesh_.points();
|
oldPoints_ = mesh_.points();
|
||||||
|
|
||||||
@ -674,11 +586,11 @@ void Foam::motionSmoother::correct()
|
|||||||
|
|
||||||
// No need to update twoDmotion corrector since only holds edge labels
|
// No need to update twoDmotion corrector since only holds edge labels
|
||||||
// which will remain the same as before. So unless the mesh was distorted
|
// which will remain the same as before. So unless the mesh was distorted
|
||||||
// severely outside of motionSmoother there will be no need.
|
// severely outside of motionSmootherAlgo there will be no need.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::motionSmoother::setDisplacementPatchFields()
|
void Foam::motionSmootherAlgo::setDisplacementPatchFields()
|
||||||
{
|
{
|
||||||
// Adapt the fixedValue bc's (i.e. copy internal point data to
|
// Adapt the fixedValue bc's (i.e. copy internal point data to
|
||||||
// boundaryField for all affected patches)
|
// boundaryField for all affected patches)
|
||||||
@ -742,7 +654,7 @@ void Foam::motionSmoother::setDisplacementPatchFields()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::motionSmoother::setDisplacement(pointField& patchDisp)
|
void Foam::motionSmootherAlgo::setDisplacement(pointField& patchDisp)
|
||||||
{
|
{
|
||||||
// See comment in .H file about shared points.
|
// See comment in .H file about shared points.
|
||||||
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
|
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
|
||||||
@ -808,7 +720,7 @@ void Foam::motionSmoother::setDisplacement(pointField& patchDisp)
|
|||||||
|
|
||||||
|
|
||||||
// correctBoundaryConditions with fixedValue bc's first.
|
// correctBoundaryConditions with fixedValue bc's first.
|
||||||
void Foam::motionSmoother::correctBoundaryConditions
|
void Foam::motionSmootherAlgo::correctBoundaryConditions
|
||||||
(
|
(
|
||||||
pointVectorField& displacement
|
pointVectorField& displacement
|
||||||
) const
|
) const
|
||||||
@ -873,7 +785,7 @@ void Foam::motionSmoother::correctBoundaryConditions
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void Foam::motionSmoother::modifyMotionPoints(pointField& newPoints) const
|
void Foam::motionSmootherAlgo::modifyMotionPoints(pointField& newPoints) const
|
||||||
{
|
{
|
||||||
// Correct for 2-D motion
|
// Correct for 2-D motion
|
||||||
if (twoDCorrector_.required())
|
if (twoDCorrector_.required())
|
||||||
@ -882,7 +794,7 @@ void Foam::motionSmoother::modifyMotionPoints(pointField& newPoints) const
|
|||||||
|
|
||||||
if (mesh_.globalData().parallel())
|
if (mesh_.globalData().parallel())
|
||||||
{
|
{
|
||||||
WarningIn("motionSmoother::movePoints(pointField&)")
|
WarningIn("motionSmootherAlgo::movePoints(pointField&)")
|
||||||
<< "2D mesh-motion probably not correct in parallel" << endl;
|
<< "2D mesh-motion probably not correct in parallel" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -913,14 +825,15 @@ void Foam::motionSmoother::modifyMotionPoints(pointField& newPoints) const
|
|||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
Pout<< "motionSmoother::modifyMotionPoints : testing sync of newPoints."
|
Pout<< "motionSmootherAlgo::modifyMotionPoints :"
|
||||||
|
<< " testing sync of newPoints."
|
||||||
<< endl;
|
<< endl;
|
||||||
testSyncPositions(newPoints, 1e-6*mesh_.bounds().mag());
|
testSyncPositions(newPoints, 1e-6*mesh_.bounds().mag());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::motionSmoother::movePoints()
|
void Foam::motionSmootherAlgo::movePoints()
|
||||||
{
|
{
|
||||||
// Make sure to clear out tetPtIs since used in checks (sometimes, should
|
// Make sure to clear out tetPtIs since used in checks (sometimes, should
|
||||||
// really check)
|
// really check)
|
||||||
@ -929,7 +842,7 @@ void Foam::motionSmoother::movePoints()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::scalar Foam::motionSmoother::setErrorReduction
|
Foam::scalar Foam::motionSmootherAlgo::setErrorReduction
|
||||||
(
|
(
|
||||||
const scalar errorReduction
|
const scalar errorReduction
|
||||||
)
|
)
|
||||||
@ -943,7 +856,7 @@ Foam::scalar Foam::motionSmoother::setErrorReduction
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Foam::motionSmoother::scaleMesh
|
bool Foam::motionSmootherAlgo::scaleMesh
|
||||||
(
|
(
|
||||||
labelList& checkFaces,
|
labelList& checkFaces,
|
||||||
const bool smoothMesh,
|
const bool smoothMesh,
|
||||||
@ -961,7 +874,7 @@ bool Foam::motionSmoother::scaleMesh
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Foam::motionSmoother::scaleMesh
|
bool Foam::motionSmootherAlgo::scaleMesh
|
||||||
(
|
(
|
||||||
labelList& checkFaces,
|
labelList& checkFaces,
|
||||||
const List<labelPair>& baffles,
|
const List<labelPair>& baffles,
|
||||||
@ -981,7 +894,7 @@ bool Foam::motionSmoother::scaleMesh
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::tmp<Foam::pointField> Foam::motionSmoother::curPoints() const
|
Foam::tmp<Foam::pointField> Foam::motionSmootherAlgo::curPoints() const
|
||||||
{
|
{
|
||||||
// Set newPoints as old + scale*displacement
|
// Set newPoints as old + scale*displacement
|
||||||
|
|
||||||
@ -1054,7 +967,7 @@ Foam::tmp<Foam::pointField> Foam::motionSmoother::curPoints() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Foam::motionSmoother::scaleMesh
|
bool Foam::motionSmootherAlgo::scaleMesh
|
||||||
(
|
(
|
||||||
labelList& checkFaces,
|
labelList& checkFaces,
|
||||||
const List<labelPair>& baffles,
|
const List<labelPair>& baffles,
|
||||||
@ -1068,7 +981,7 @@ bool Foam::motionSmoother::scaleMesh
|
|||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"motionSmoother::scaleMesh"
|
"motionSmootherAlgo::scaleMesh"
|
||||||
"("
|
"("
|
||||||
"labelList&, "
|
"labelList&, "
|
||||||
"const List<labelPair>&, "
|
"const List<labelPair>&, "
|
||||||
@ -1271,7 +1184,7 @@ bool Foam::motionSmoother::scaleMesh
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Foam::motionSmoother::updateMesh()
|
void Foam::motionSmootherAlgo::updateMesh()
|
||||||
{
|
{
|
||||||
const pointBoundaryMesh& patches = pMesh_.boundary();
|
const pointBoundaryMesh& patches = pMesh_.boundary();
|
||||||
|
|
||||||
@ -1290,7 +1203,7 @@ void Foam::motionSmoother::updateMesh()
|
|||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"motionSmoother::updateMesh"
|
"motionSmootherAlgo::updateMesh"
|
||||||
) << "Patch " << patches[patchI].name()
|
) << "Patch " << patches[patchI].name()
|
||||||
<< " has wrong boundary condition "
|
<< " has wrong boundary condition "
|
||||||
<< displacement_.boundaryField()[patchI].type()
|
<< displacement_.boundaryField()[patchI].type()
|
||||||
@ -1324,7 +1237,7 @@ void Foam::motionSmoother::updateMesh()
|
|||||||
// Specialisation of applyCornerConstraints for scalars because
|
// Specialisation of applyCornerConstraints for scalars because
|
||||||
// no constraint need be applied
|
// no constraint need be applied
|
||||||
template<>
|
template<>
|
||||||
void Foam::motionSmoother::applyCornerConstraints<Foam::scalar>
|
void Foam::motionSmootherAlgo::applyCornerConstraints<Foam::scalar>
|
||||||
(
|
(
|
||||||
GeometricField<scalar, pointPatchField, pointMesh>& pf
|
GeometricField<scalar, pointPatchField, pointMesh>& pf
|
||||||
) const
|
) const
|
||||||
|
|||||||
@ -22,7 +22,7 @@ License
|
|||||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Class
|
Class
|
||||||
Foam::motionSmoother
|
Foam::motionSmootherAlgo
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Given a displacement moves the mesh by scaling the displacement back
|
Given a displacement moves the mesh by scaling the displacement back
|
||||||
@ -68,13 +68,13 @@ Note
|
|||||||
recursive lookup)
|
recursive lookup)
|
||||||
|
|
||||||
SourceFiles
|
SourceFiles
|
||||||
motionSmoother.C
|
motionSmootherAlgo.C
|
||||||
motionSmootherTemplates.C
|
motionSmootherAlgoTemplates.C
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#ifndef motionSmoother_H
|
#ifndef motionSmootherAlgo_H
|
||||||
#define motionSmoother_H
|
#define motionSmootherAlgo_H
|
||||||
|
|
||||||
#include "pointFields.H"
|
#include "pointFields.H"
|
||||||
#include "HashSet.H"
|
#include "HashSet.H"
|
||||||
@ -92,10 +92,10 @@ class polyMeshGeometry;
|
|||||||
class faceSet;
|
class faceSet;
|
||||||
|
|
||||||
/*---------------------------------------------------------------------------*\
|
/*---------------------------------------------------------------------------*\
|
||||||
Class motionSmoother Declaration
|
Class motionSmootherAlgo Declaration
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
class motionSmoother
|
class motionSmootherAlgo
|
||||||
{
|
{
|
||||||
// Private class
|
// Private class
|
||||||
|
|
||||||
@ -141,39 +141,39 @@ class motionSmoother
|
|||||||
//- Reference to face subset of all adaptPatchIDs
|
//- Reference to face subset of all adaptPatchIDs
|
||||||
indirectPrimitivePatch& pp_;
|
indirectPrimitivePatch& pp_;
|
||||||
|
|
||||||
//- Indices of fixedValue patches that we're allowed to modify the
|
//- Displacement field
|
||||||
// displacement on.
|
pointVectorField& displacement_;
|
||||||
const labelList adaptPatchIDs_;
|
|
||||||
|
|
||||||
|
//- Scale factor for displacement
|
||||||
|
pointScalarField& scale_;
|
||||||
|
|
||||||
|
//- Starting mesh position
|
||||||
|
pointField& oldPoints_;
|
||||||
|
|
||||||
// Smoothing and checking parameters
|
|
||||||
dictionary paramDict_;
|
|
||||||
|
|
||||||
// Internal data
|
// Internal data
|
||||||
|
|
||||||
//- Displacement field
|
//- Indices of fixedValue patches that we're allowed to modify the
|
||||||
pointVectorField displacement_;
|
// displacement on.
|
||||||
|
const labelList adaptPatchIDs_;
|
||||||
|
|
||||||
//- Scale factor for displacement
|
// Smoothing and checking parameters
|
||||||
pointScalarField scale_;
|
dictionary paramDict_;
|
||||||
|
|
||||||
//- Starting mesh position
|
//- Is mesh point on boundary or not
|
||||||
pointField oldPoints_;
|
PackedBoolList isInternalPoint_;
|
||||||
|
|
||||||
//- Is mesh point on boundary or not
|
//- Is edge master (always except if on coupled boundary and on
|
||||||
PackedBoolList isInternalPoint_;
|
// lower processor)
|
||||||
|
PackedBoolList isMasterEdge_;
|
||||||
|
|
||||||
//- Is edge master (always except if on coupled boundary and on
|
//- 2-D motion corrector
|
||||||
// lower processor)
|
twoDPointCorrector twoDCorrector_;
|
||||||
PackedBoolList isMasterEdge_;
|
|
||||||
|
|
||||||
//- 2-D motion corrector
|
// Muli-patch constraints (from pointPatchInterpolation)
|
||||||
twoDPointCorrector twoDCorrector_;
|
|
||||||
|
|
||||||
// Muli-patch constraints (from pointPatchInterpolation)
|
labelList patchPatchPointConstraintPoints_;
|
||||||
|
tensorField patchPatchPointConstraintTensors_;
|
||||||
labelList patchPatchPointConstraintPoints_;
|
|
||||||
tensorField patchPatchPointConstraintTensors_;
|
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
@ -303,43 +303,34 @@ class motionSmoother
|
|||||||
) const;
|
) const;
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct
|
//- Disallow default bitwise copy construct
|
||||||
motionSmoother(const motionSmoother&);
|
motionSmootherAlgo(const motionSmootherAlgo&);
|
||||||
|
|
||||||
//- Disallow default bitwise assignment
|
//- Disallow default bitwise assignment
|
||||||
void operator=(const motionSmoother&);
|
void operator=(const motionSmootherAlgo&);
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
ClassName("motionSmoother");
|
ClassName("motionSmootherAlgo");
|
||||||
|
|
||||||
// Constructors
|
// Constructors
|
||||||
|
|
||||||
//- Construct from mesh, patches to work on and smoothing parameters.
|
//- Construct from mesh, patches to work on and smoothing parameters.
|
||||||
// Reads displacement field (only boundary conditions used)
|
motionSmootherAlgo
|
||||||
motionSmoother
|
|
||||||
(
|
(
|
||||||
polyMesh&,
|
polyMesh&,
|
||||||
pointMesh&,
|
pointMesh&,
|
||||||
indirectPrimitivePatch& pp, // 'outside' points
|
indirectPrimitivePatch& pp, // 'outside' points
|
||||||
|
pointVectorField& displacement,
|
||||||
|
pointScalarField& scale,
|
||||||
|
pointField& oldPoints,
|
||||||
const labelList& adaptPatchIDs, // patches forming 'outside'
|
const labelList& adaptPatchIDs, // patches forming 'outside'
|
||||||
const dictionary& paramDict
|
const dictionary& paramDict
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct from mesh, patches to work on and smoothing parameters and
|
|
||||||
// displacementfield (only boundary conditions used)
|
|
||||||
motionSmoother
|
|
||||||
(
|
|
||||||
polyMesh&,
|
|
||||||
indirectPrimitivePatch& pp, // 'outside' points
|
|
||||||
const labelList& adaptPatchIDs, // patches forming 'outside'
|
|
||||||
const pointVectorField&,
|
|
||||||
const dictionary& paramDict
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
//- Destructor
|
//- Destructor
|
||||||
~motionSmoother();
|
~motionSmootherAlgo();
|
||||||
|
|
||||||
|
|
||||||
// Member Functions
|
// Member Functions
|
||||||
@ -360,18 +351,6 @@ public:
|
|||||||
|
|
||||||
const dictionary& paramDict() const;
|
const dictionary& paramDict() const;
|
||||||
|
|
||||||
//- Reference to displacement field
|
|
||||||
pointVectorField& displacement();
|
|
||||||
|
|
||||||
//- Reference to displacement field
|
|
||||||
const pointVectorField& displacement() const;
|
|
||||||
|
|
||||||
//- Reference to scale field
|
|
||||||
const pointScalarField& scale() const;
|
|
||||||
|
|
||||||
//- Starting mesh position
|
|
||||||
const pointField& oldPoints() const;
|
|
||||||
|
|
||||||
//- Return reference to 2D point motion correction
|
//- Return reference to 2D point motion correction
|
||||||
twoDPointCorrector& twoDCorrector()
|
twoDPointCorrector& twoDCorrector()
|
||||||
{
|
{
|
||||||
@ -532,7 +511,7 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
void motionSmoother::applyCornerConstraints<scalar>
|
void motionSmootherAlgo::applyCornerConstraints<scalar>
|
||||||
(
|
(
|
||||||
GeometricField<scalar, pointPatchField, pointMesh>& pf
|
GeometricField<scalar, pointPatchField, pointMesh>& pf
|
||||||
) const;
|
) const;
|
||||||
@ -545,7 +524,7 @@ void motionSmoother::applyCornerConstraints<scalar>
|
|||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
#ifdef NoRepository
|
#ifdef NoRepository
|
||||||
# include "motionSmootherTemplates.C"
|
# include "motionSmootherAlgoTemplates.C"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|||||||
@ -23,13 +23,13 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "motionSmoother.H"
|
#include "motionSmootherAlgo.H"
|
||||||
#include "polyMeshGeometry.H"
|
#include "polyMeshGeometry.H"
|
||||||
#include "IOmanip.H"
|
#include "IOmanip.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
bool Foam::motionSmoother::checkMesh
|
bool Foam::motionSmootherAlgo::checkMesh
|
||||||
(
|
(
|
||||||
const bool report,
|
const bool report,
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
@ -50,7 +50,7 @@ bool Foam::motionSmoother::checkMesh
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Foam::motionSmoother::checkMesh
|
bool Foam::motionSmootherAlgo::checkMesh
|
||||||
(
|
(
|
||||||
const bool report,
|
const bool report,
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
@ -411,7 +411,7 @@ bool Foam::motionSmoother::checkMesh
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Foam::motionSmoother::checkMesh
|
bool Foam::motionSmootherAlgo::checkMesh
|
||||||
(
|
(
|
||||||
const bool report,
|
const bool report,
|
||||||
const polyMesh& mesh,
|
const polyMesh& mesh,
|
||||||
@ -429,7 +429,7 @@ bool Foam::motionSmoother::checkMesh
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Foam::motionSmoother::checkMesh
|
bool Foam::motionSmootherAlgo::checkMesh
|
||||||
(
|
(
|
||||||
const bool report,
|
const bool report,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
@ -452,7 +452,7 @@ bool Foam::motionSmoother::checkMesh
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Foam::motionSmoother::checkMesh
|
bool Foam::motionSmootherAlgo::checkMesh
|
||||||
(
|
(
|
||||||
const bool report,
|
const bool report,
|
||||||
const dictionary& dict,
|
const dictionary& dict,
|
||||||
|
|||||||
@ -23,7 +23,7 @@ License
|
|||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "motionSmoother.H"
|
#include "motionSmootherAlgo.H"
|
||||||
#include "meshTools.H"
|
#include "meshTools.H"
|
||||||
#include "processorPointPatchFields.H"
|
#include "processorPointPatchFields.H"
|
||||||
#include "pointConstraint.H"
|
#include "pointConstraint.H"
|
||||||
@ -32,7 +32,7 @@ License
|
|||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::motionSmoother::checkConstraints
|
void Foam::motionSmootherAlgo::checkConstraints
|
||||||
(
|
(
|
||||||
GeometricField<Type, pointPatchField, pointMesh>& pf
|
GeometricField<Type, pointPatchField, pointMesh>& pf
|
||||||
)
|
)
|
||||||
@ -119,7 +119,7 @@ void Foam::motionSmoother::checkConstraints
|
|||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"motionSmoother::checkConstraints"
|
"motionSmootherAlgo::checkConstraints"
|
||||||
"(GeometricField<Type, pointPatchField, pointMesh>&)"
|
"(GeometricField<Type, pointPatchField, pointMesh>&)"
|
||||||
) << "Patch fields are not consistent on mesh point "
|
) << "Patch fields are not consistent on mesh point "
|
||||||
<< ppp << " coordinate " << mesh.points()[ppp]
|
<< ppp << " coordinate " << mesh.points()[ppp]
|
||||||
@ -136,7 +136,7 @@ void Foam::motionSmoother::checkConstraints
|
|||||||
|
|
||||||
|
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::motionSmoother::applyCornerConstraints
|
void Foam::motionSmootherAlgo::applyCornerConstraints
|
||||||
(
|
(
|
||||||
GeometricField<Type, pointPatchField, pointMesh>& pf
|
GeometricField<Type, pointPatchField, pointMesh>& pf
|
||||||
) const
|
) const
|
||||||
@ -155,7 +155,7 @@ void Foam::motionSmoother::applyCornerConstraints
|
|||||||
// Average of connected points.
|
// Average of connected points.
|
||||||
template<class Type>
|
template<class Type>
|
||||||
Foam::tmp<Foam::GeometricField<Type, Foam::pointPatchField, Foam::pointMesh> >
|
Foam::tmp<Foam::GeometricField<Type, Foam::pointPatchField, Foam::pointMesh> >
|
||||||
Foam::motionSmoother::avg
|
Foam::motionSmootherAlgo::avg
|
||||||
(
|
(
|
||||||
const GeometricField<Type, pointPatchField, pointMesh>& fld,
|
const GeometricField<Type, pointPatchField, pointMesh>& fld,
|
||||||
const scalarField& edgeWeight
|
const scalarField& edgeWeight
|
||||||
@ -253,7 +253,7 @@ Foam::motionSmoother::avg
|
|||||||
|
|
||||||
// smooth field (point-jacobi)
|
// smooth field (point-jacobi)
|
||||||
template<class Type>
|
template<class Type>
|
||||||
void Foam::motionSmoother::smooth
|
void Foam::motionSmootherAlgo::smooth
|
||||||
(
|
(
|
||||||
const GeometricField<Type, pointPatchField, pointMesh>& fld,
|
const GeometricField<Type, pointPatchField, pointMesh>& fld,
|
||||||
const scalarField& edgeWeight,
|
const scalarField& edgeWeight,
|
||||||
@ -278,7 +278,7 @@ void Foam::motionSmoother::smooth
|
|||||||
|
|
||||||
//- Test synchronisation of generic field (not positions!) on points
|
//- Test synchronisation of generic field (not positions!) on points
|
||||||
template<class Type, class CombineOp>
|
template<class Type, class CombineOp>
|
||||||
void Foam::motionSmoother::testSyncField
|
void Foam::motionSmootherAlgo::testSyncField
|
||||||
(
|
(
|
||||||
const Field<Type>& fld,
|
const Field<Type>& fld,
|
||||||
const CombineOp& cop,
|
const CombineOp& cop,
|
||||||
@ -308,7 +308,7 @@ void Foam::motionSmoother::testSyncField
|
|||||||
{
|
{
|
||||||
FatalErrorIn
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
"motionSmoother::testSyncField"
|
"motionSmootherAlgo::testSyncField"
|
||||||
"(const Field<Type>&, const CombineOp&"
|
"(const Field<Type>&, const CombineOp&"
|
||||||
", const Type&, const bool)"
|
", const Type&, const bool)"
|
||||||
) << "On element " << i << " value:" << fld[i]
|
) << "On element " << i << " value:" << fld[i]
|
||||||
|
|||||||
124
src/dynamicMesh/motionSmoother/motionSmootherData.C
Normal file
124
src/dynamicMesh/motionSmoother/motionSmootherData.C
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "motionSmootherData.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::motionSmootherData::motionSmootherData
|
||||||
|
(
|
||||||
|
const pointMesh& pMesh
|
||||||
|
)
|
||||||
|
:
|
||||||
|
displacement_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"displacement",
|
||||||
|
pMesh.time().timeName(),
|
||||||
|
pMesh(),
|
||||||
|
IOobject::MUST_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
pMesh
|
||||||
|
),
|
||||||
|
scale_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"scale",
|
||||||
|
pMesh.time().timeName(),
|
||||||
|
pMesh(),
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
pMesh,
|
||||||
|
dimensionedScalar("scale", dimless, 1.0)
|
||||||
|
),
|
||||||
|
oldPoints_(pMesh().points())
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
Foam::motionSmootherData::motionSmootherData
|
||||||
|
(
|
||||||
|
const pointVectorField& displacement
|
||||||
|
)
|
||||||
|
:
|
||||||
|
displacement_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"displacement",
|
||||||
|
displacement.time().timeName(),
|
||||||
|
displacement.mesh()(),
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
displacement
|
||||||
|
),
|
||||||
|
scale_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"scale",
|
||||||
|
displacement.time().timeName(),
|
||||||
|
displacement.mesh()(),
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
displacement.mesh(),
|
||||||
|
dimensionedScalar("scale", dimless, 1.0)
|
||||||
|
),
|
||||||
|
oldPoints_(displacement.mesh()().points())
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::pointVectorField& Foam::motionSmootherData::displacement()
|
||||||
|
{
|
||||||
|
return displacement_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const Foam::pointVectorField& Foam::motionSmootherData::displacement() const
|
||||||
|
{
|
||||||
|
return displacement_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const Foam::pointScalarField& Foam::motionSmootherData::scale() const
|
||||||
|
{
|
||||||
|
return scale_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const Foam::pointField& Foam::motionSmootherData::oldPoints() const
|
||||||
|
{
|
||||||
|
return oldPoints_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
106
src/dynamicMesh/motionSmoother/motionSmootherData.H
Normal file
106
src/dynamicMesh/motionSmoother/motionSmootherData.H
Normal file
@ -0,0 +1,106 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
|
\\ / O peration |
|
||||||
|
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
||||||
|
\\/ M anipulation |
|
||||||
|
-------------------------------------------------------------------------------
|
||||||
|
License
|
||||||
|
This file is part of OpenFOAM.
|
||||||
|
|
||||||
|
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Class
|
||||||
|
Foam::motionSmootherData
|
||||||
|
|
||||||
|
Description
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
motionSmootherData.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef motionSmootherData_H
|
||||||
|
#define motionSmootherData_H
|
||||||
|
|
||||||
|
#include "pointFields.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class motionSmootherData Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class motionSmootherData
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Displacement field
|
||||||
|
pointVectorField displacement_;
|
||||||
|
|
||||||
|
//- Scale factor for displacement
|
||||||
|
pointScalarField scale_;
|
||||||
|
|
||||||
|
//- Starting mesh position
|
||||||
|
pointField oldPoints_;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct read
|
||||||
|
motionSmootherData
|
||||||
|
(
|
||||||
|
const pointMesh&
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct from pointDisplacement
|
||||||
|
motionSmootherData
|
||||||
|
(
|
||||||
|
const pointVectorField&
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// Member Functions
|
||||||
|
|
||||||
|
//- Reference to displacement field
|
||||||
|
pointVectorField& displacement();
|
||||||
|
|
||||||
|
//- Reference to displacement field
|
||||||
|
const pointVectorField& displacement() const;
|
||||||
|
|
||||||
|
//- Reference to scale field
|
||||||
|
const pointScalarField& scale() const;
|
||||||
|
|
||||||
|
//- Starting mesh position
|
||||||
|
const pointField& oldPoints() const;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
} // End namespace Foam
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
Reference in New Issue
Block a user