interpolatingSolidBodyMotionSolver: Added mapMesh function
to support run-time mesh-to-mesh mapping. The points0 are reset to the points of the new mesh, i.e. the displacement is assumed 0 after mapping and the motion functions need to take this into account.
This commit is contained in:
@ -201,7 +201,7 @@ void Foam::componentDisplacementMotionSolver::topoChange
|
|||||||
|
|
||||||
void Foam::componentDisplacementMotionSolver::mapMesh(const polyMeshMap& map)
|
void Foam::componentDisplacementMotionSolver::mapMesh(const polyMeshMap& map)
|
||||||
{
|
{
|
||||||
points0_ == mesh().points().component(cmpt_);
|
points0_ = mesh().points().component(cmpt_);
|
||||||
pointDisplacement_ == Zero;
|
pointDisplacement_ == Zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -160,7 +160,7 @@ void Foam::points0MotionSolver::topoChange(const polyTopoChangeMap& map)
|
|||||||
|
|
||||||
void Foam::points0MotionSolver::mapMesh(const polyMeshMap& map)
|
void Foam::points0MotionSolver::mapMesh(const polyMeshMap& map)
|
||||||
{
|
{
|
||||||
points0_ == mesh().points();
|
points0_.primitiveFieldRef() = mesh().points();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -110,6 +110,7 @@ public:
|
|||||||
virtual void topoChange(const polyTopoChangeMap&);
|
virtual void topoChange(const polyTopoChangeMap&);
|
||||||
|
|
||||||
//- Update from another mesh using the given map
|
//- Update from another mesh using the given map
|
||||||
|
// Resets points0 to the points of the new mesh
|
||||||
virtual void mapMesh(const polyMeshMap&);
|
virtual void mapMesh(const polyMeshMap&);
|
||||||
|
|
||||||
//- Update corresponding to the given distribution map
|
//- Update corresponding to the given distribution map
|
||||||
|
|||||||
@ -43,41 +43,11 @@ namespace Foam
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||||
|
|
||||||
Foam::interpolatingSolidBodyMotionSolver::interpolatingSolidBodyMotionSolver
|
void Foam::interpolatingSolidBodyMotionSolver::calcScale()
|
||||||
(
|
|
||||||
const word& name,
|
|
||||||
const polyMesh& mesh,
|
|
||||||
const dictionary& dict
|
|
||||||
)
|
|
||||||
:
|
|
||||||
points0MotionSolver(name, mesh, dict, typeName),
|
|
||||||
SBMFPtr_(solidBodyMotionFunction::New(coeffDict(), mesh.time())),
|
|
||||||
patches_(wordReList(coeffDict().lookup("patches"))),
|
|
||||||
patchSet_(mesh.boundaryMesh().patchSet(patches_)),
|
|
||||||
CofG_(coeffDict().lookup("CofG")),
|
|
||||||
di_(coeffDict().lookup<scalar>("innerDistance")),
|
|
||||||
do_(coeffDict().lookup<scalar>("outerDistance")),
|
|
||||||
scale_
|
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"motionScale",
|
|
||||||
mesh.time().timeName(),
|
|
||||||
mesh,
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::NO_WRITE,
|
|
||||||
false
|
|
||||||
),
|
|
||||||
pointMesh::New(mesh),
|
|
||||||
dimensionedScalar(dimless, 0)
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
// Calculate scaling factor everywhere
|
const pointMesh& pMesh = pointMesh::New(mesh());
|
||||||
|
|
||||||
{
|
|
||||||
const pointMesh& pMesh = pointMesh::New(mesh);
|
|
||||||
|
|
||||||
pointPatchDist pDist(pMesh, patchSet_, points0());
|
pointPatchDist pDist(pMesh, patchSet_, points0());
|
||||||
|
|
||||||
@ -110,7 +80,41 @@ Foam::interpolatingSolidBodyMotionSolver::interpolatingSolidBodyMotionSolver
|
|||||||
|
|
||||||
pointConstraints::New(pMesh).constrain(scale_);
|
pointConstraints::New(pMesh).constrain(scale_);
|
||||||
scale_.write();
|
scale_.write();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::interpolatingSolidBodyMotionSolver::interpolatingSolidBodyMotionSolver
|
||||||
|
(
|
||||||
|
const word& name,
|
||||||
|
const polyMesh& mesh,
|
||||||
|
const dictionary& dict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
points0MotionSolver(name, mesh, dict, typeName),
|
||||||
|
SBMFPtr_(solidBodyMotionFunction::New(coeffDict(), mesh.time())),
|
||||||
|
patches_(wordReList(coeffDict().lookup("patches"))),
|
||||||
|
patchSet_(mesh.boundaryMesh().patchSet(patches_)),
|
||||||
|
CofG_(coeffDict().lookup("CofG")),
|
||||||
|
di_(coeffDict().lookup<scalar>("innerDistance")),
|
||||||
|
do_(coeffDict().lookup<scalar>("outerDistance")),
|
||||||
|
scale_
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"motionScale",
|
||||||
|
mesh.time().timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::NO_WRITE
|
||||||
|
),
|
||||||
|
pointMesh::New(mesh),
|
||||||
|
dimensionedScalar(dimless, 0)
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// Calculate scaling factor everywhere
|
||||||
|
calcScale();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -131,6 +135,7 @@ Foam::interpolatingSolidBodyMotionSolver::curPoints() const
|
|||||||
tmp<pointField> tpoints(new pointField(points0));
|
tmp<pointField> tpoints(new pointField(points0));
|
||||||
pointField& points = tpoints.ref();
|
pointField& points = tpoints.ref();
|
||||||
|
|
||||||
|
Info << points.size() << " " << scale_.size() << endl;
|
||||||
forAll(points, pointi)
|
forAll(points, pointi)
|
||||||
{
|
{
|
||||||
// Move non-stationary points
|
// Move non-stationary points
|
||||||
@ -157,4 +162,25 @@ Foam::interpolatingSolidBodyMotionSolver::curPoints() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::interpolatingSolidBodyMotionSolver::topoChange
|
||||||
|
(
|
||||||
|
const polyTopoChangeMap& map
|
||||||
|
)
|
||||||
|
{
|
||||||
|
// Pending implementation of the inverse transformation of points0
|
||||||
|
NotImplemented;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Foam::interpolatingSolidBodyMotionSolver::mapMesh(const polyMeshMap& map)
|
||||||
|
{
|
||||||
|
InfoInFunction << endl;
|
||||||
|
points0MotionSolver::mapMesh(map);
|
||||||
|
|
||||||
|
// scale is resized by the meshToMesh mapper
|
||||||
|
scale_ = Zero;
|
||||||
|
calcScale();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -75,6 +75,8 @@ class interpolatingSolidBodyMotionSolver
|
|||||||
//- Current interpolation scale (1 at patches, 0 at distance_)
|
//- Current interpolation scale (1 at patches, 0 at distance_)
|
||||||
pointScalarField scale_;
|
pointScalarField scale_;
|
||||||
|
|
||||||
|
void calcScale();
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@ -112,6 +114,12 @@ public:
|
|||||||
virtual void solve()
|
virtual void solve()
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
//- Update local data for topology changes
|
||||||
|
virtual void topoChange(const polyTopoChangeMap&);
|
||||||
|
|
||||||
|
//- Update from another mesh using the given map
|
||||||
|
virtual void mapMesh(const polyMeshMap&);
|
||||||
|
|
||||||
|
|
||||||
// Member Operators
|
// Member Operators
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user