Commit caa250f8 authored by mattijs's avatar mattijs
Browse files

ENH: layered mesh motion solver

Specifies motion as blocks inside which motion is interpolated
parent 263e9e33
......@@ -2,6 +2,7 @@ fvMotionSolvers/fvMotionSolver/fvMotionSolver.C
fvMotionSolvers/velocity/laplacian/velocityLaplacianFvMotionSolver.C
fvMotionSolvers/displacement/displacementFvMotionSolver/displacementFvMotionSolver.C
fvMotionSolvers/displacement/layeredSolver/displacementLayeredMotionFvMotionSolver.C
fvMotionSolvers/displacement/layeredSolver/pointEdgeStructuredWalk.C
fvMotionSolvers/displacement/interpolation/displacementInterpolationFvMotionSolver.C
fvMotionSolvers/displacement/laplacian/displacementLaplacianFvMotionSolver.C
fvMotionSolvers/displacement/SBRStress/displacementSBRStressFvMotionSolver.C
......
......@@ -51,7 +51,7 @@ namespace Foam
void Foam::displacementLayeredMotionFvMotionSolver::calcZoneMask
(
const label cellZoneI,
const label cellZoneI,
PackedBoolList& isZonePoint,
PackedBoolList& isZoneEdge
) const
......@@ -133,16 +133,14 @@ void Foam::displacementLayeredMotionFvMotionSolver::walkStructured
vectorField& data
) const
{
const pointField& points = mesh().points();
List<pointEdgeStructuredWalk> seedInfo(seedPoints.size());
forAll(seedPoints, i)
{
seedInfo[i] = pointEdgeStructuredWalk
(
true,
points[seedPoints[i]],
points0()[seedPoints[i]], // location of data
points0()[seedPoints[i]], // previous location
0.0,
seedData[i]
);
......@@ -150,12 +148,22 @@ void Foam::displacementLayeredMotionFvMotionSolver::walkStructured
// Current info on points
List<pointEdgeStructuredWalk> allPointInfo(mesh().nPoints());
// Mark points inside cellZone
// Mark points inside cellZone.
// Note that we use points0, not mesh.points()
// so as not to accumulate errors.
forAll(isZonePoint, pointI)
{
if (isZonePoint[pointI])
{
allPointInfo[pointI].inZone() = true;
allPointInfo[pointI] = pointEdgeStructuredWalk
(
points0()[pointI], // location of data
vector::max, // not valid
0.0,
vector::zero // passive data
);
}
}
......@@ -166,7 +174,13 @@ void Foam::displacementLayeredMotionFvMotionSolver::walkStructured
{
if (isZoneEdge[edgeI])
{
allEdgeInfo[edgeI].inZone() = true;
allEdgeInfo[edgeI] = pointEdgeStructuredWalk
(
mesh().edges()[edgeI].centre(points0()), // location of data
vector::max, // not valid
0.0,
vector::zero
);
}
}
......
......@@ -88,7 +88,7 @@ class displacementLayeredMotionFvMotionSolver
void calcZoneMask
(
const label cellZoneI,
const label cellZoneI,
PackedBoolList& isZonePoint,
PackedBoolList& isZoneEdge
) const;
......
......@@ -35,7 +35,7 @@ Foam::Ostream& Foam::operator<<
)
{
return os
<< wDist.inZone_ << wDist.previousPoint_
<< wDist.point0_ << wDist.previousPoint_
<< wDist.dist_ << wDist.data_;
}
......@@ -46,7 +46,7 @@ Foam::Istream& Foam::operator>>
)
{
return is
>> wDist.inZone_ >> wDist.previousPoint_
>> wDist.point0_ >> wDist.previousPoint_
>> wDist.dist_ >> wDist.data_;
}
......
......@@ -61,10 +61,10 @@ class pointEdgeStructuredWalk
{
// Private data
//- Is this point/edge inside the walk zone
bool inZone_;
//- Starting location
point point0_;
//- Previuos point
//- Previous point
point previousPoint_;
//- Sum of distance
......@@ -77,15 +77,6 @@ class pointEdgeStructuredWalk
//- Evaluate distance to point.
inline bool update
(
const point&,
const pointEdgeStructuredWalk& w2,
const scalar tol
);
//- Combine current with w2. Update distSqr, origin if w2 has smaller
// quantities and returns true.
inline bool update
(
const pointEdgeStructuredWalk& w2,
const scalar tol
......@@ -101,7 +92,7 @@ public:
//- Construct from components
inline pointEdgeStructuredWalk
(
const bool,
const point&,
const point&,
const scalar,
const vector&
......@@ -114,10 +105,6 @@ public:
inline bool inZone() const;
inline bool& inZone();
inline const point& previousPoint() const;
inline scalar dist() const;
inline const vector& data() const;
......
......@@ -32,16 +32,15 @@ License
// Update this with w2.
inline bool Foam::pointEdgeStructuredWalk::update
(
const point& pt,
const pointEdgeStructuredWalk& w2,
const scalar tol
)
{
if (!valid())
{
// current not yet set. Walked from w2 to here (=pt)
dist_ = w2.dist_ + mag(pt-w2.previousPoint_);
previousPoint_ = pt;
// current not yet set. Walked from w2 to here (=point0)
dist_ = w2.dist_ + mag(point0_-w2.previousPoint_);
previousPoint_ = point0_;
data_ = w2.data_;
return true;
......@@ -52,36 +51,13 @@ inline bool Foam::pointEdgeStructuredWalk::update
}
}
// Update this with w2 (information on same point)
inline bool Foam::pointEdgeStructuredWalk::update
(
const pointEdgeStructuredWalk& w2,
const scalar tol
)
{
if (!valid())
{
// current not yet set so use neighbour
dist_ = w2.dist_;
previousPoint_ = w2.previousPoint_;
data_ = w2.data_;
return true;
}
else
{
// already nearer to pt
return false;
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Null constructor
inline Foam::pointEdgeStructuredWalk::pointEdgeStructuredWalk()
:
inZone_(false),
point0_(vector::max),
previousPoint_(vector::max),
dist_(0),
data_(vector::zero)
......@@ -91,13 +67,13 @@ inline Foam::pointEdgeStructuredWalk::pointEdgeStructuredWalk()
// Construct from origin, distance
inline Foam::pointEdgeStructuredWalk::pointEdgeStructuredWalk
(
const bool inZone,
const point& previousPoint,
const point& point0,
const point& previousPoint,
const scalar dist,
const vector& data
)
:
inZone_(inZone),
point0_(point0),
previousPoint_(previousPoint),
dist_(dist),
data_(data)
......@@ -108,20 +84,14 @@ inline Foam::pointEdgeStructuredWalk::pointEdgeStructuredWalk
inline bool Foam::pointEdgeStructuredWalk::inZone() const
{
return inZone_;
return point0_ != vector::max;
}
inline bool& Foam::pointEdgeStructuredWalk::inZone()
{
return inZone_;
}
inline const Foam::point& Foam::pointEdgeStructuredWalk::previousPoint() const
{
return previousPoint_;
}
//inline const Foam::point& Foam::pointEdgeStructuredWalk::previousPoint() const
//{
// return previousPoint_;
//}
inline Foam::scalar Foam::pointEdgeStructuredWalk::dist() const
......@@ -210,15 +180,15 @@ inline bool Foam::pointEdgeStructuredWalk::updatePoint
const scalar tol
)
{
if (inZone_)
if (inZone())
{
return update(mesh.points()[pointI], edgeInfo, tol);
return update(edgeInfo, tol);
}
else
{
return false;
}
}
}
// Update this with new information on same point
......@@ -230,9 +200,9 @@ inline bool Foam::pointEdgeStructuredWalk::updatePoint
const scalar tol
)
{
if (inZone_)
if (inZone())
{
return update(mesh.points()[pointI], newPointInfo, tol);
return update(newPointInfo, tol);
}
else
{
......@@ -249,7 +219,7 @@ inline bool Foam::pointEdgeStructuredWalk::updatePoint
)
{
return update(newPointInfo, tol);
}
}
// Update this with information from connected point
......@@ -262,21 +232,15 @@ inline bool Foam::pointEdgeStructuredWalk::updateEdge
const scalar tol
)
{
if (inZone_)
if (inZone())
{
const pointField& points = mesh.points();
const edge& e = mesh.edges()[edgeI];
const point edgeMid(0.5*(points[e[0]] + points[e[1]]));
return update(edgeMid, pointInfo, tol);
return update(pointInfo, tol);
}
else
{
return false;
}
}
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
......@@ -286,7 +250,7 @@ inline bool Foam::pointEdgeStructuredWalk::operator==
const Foam::pointEdgeStructuredWalk& rhs
) const
{
return previousPoint() == rhs.previousPoint();
return previousPoint_ == rhs.previousPoint_;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment