mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: layered mesh motion solver
Specifies motion as blocks inside which motion is interpolated
This commit is contained in:
@ -2,6 +2,7 @@ fvMotionSolvers/fvMotionSolver/fvMotionSolver.C
|
|||||||
fvMotionSolvers/velocity/laplacian/velocityLaplacianFvMotionSolver.C
|
fvMotionSolvers/velocity/laplacian/velocityLaplacianFvMotionSolver.C
|
||||||
fvMotionSolvers/displacement/displacementFvMotionSolver/displacementFvMotionSolver.C
|
fvMotionSolvers/displacement/displacementFvMotionSolver/displacementFvMotionSolver.C
|
||||||
fvMotionSolvers/displacement/layeredSolver/displacementLayeredMotionFvMotionSolver.C
|
fvMotionSolvers/displacement/layeredSolver/displacementLayeredMotionFvMotionSolver.C
|
||||||
|
fvMotionSolvers/displacement/layeredSolver/pointEdgeStructuredWalk.C
|
||||||
fvMotionSolvers/displacement/interpolation/displacementInterpolationFvMotionSolver.C
|
fvMotionSolvers/displacement/interpolation/displacementInterpolationFvMotionSolver.C
|
||||||
fvMotionSolvers/displacement/laplacian/displacementLaplacianFvMotionSolver.C
|
fvMotionSolvers/displacement/laplacian/displacementLaplacianFvMotionSolver.C
|
||||||
fvMotionSolvers/displacement/SBRStress/displacementSBRStressFvMotionSolver.C
|
fvMotionSolvers/displacement/SBRStress/displacementSBRStressFvMotionSolver.C
|
||||||
|
|||||||
@ -133,16 +133,14 @@ void Foam::displacementLayeredMotionFvMotionSolver::walkStructured
|
|||||||
vectorField& data
|
vectorField& data
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
const pointField& points = mesh().points();
|
|
||||||
|
|
||||||
List<pointEdgeStructuredWalk> seedInfo(seedPoints.size());
|
List<pointEdgeStructuredWalk> seedInfo(seedPoints.size());
|
||||||
|
|
||||||
forAll(seedPoints, i)
|
forAll(seedPoints, i)
|
||||||
{
|
{
|
||||||
seedInfo[i] = pointEdgeStructuredWalk
|
seedInfo[i] = pointEdgeStructuredWalk
|
||||||
(
|
(
|
||||||
true,
|
points0()[seedPoints[i]], // location of data
|
||||||
points[seedPoints[i]],
|
points0()[seedPoints[i]], // previous location
|
||||||
0.0,
|
0.0,
|
||||||
seedData[i]
|
seedData[i]
|
||||||
);
|
);
|
||||||
@ -150,12 +148,22 @@ void Foam::displacementLayeredMotionFvMotionSolver::walkStructured
|
|||||||
|
|
||||||
// Current info on points
|
// Current info on points
|
||||||
List<pointEdgeStructuredWalk> allPointInfo(mesh().nPoints());
|
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)
|
forAll(isZonePoint, pointI)
|
||||||
{
|
{
|
||||||
if (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])
|
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
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -35,7 +35,7 @@ Foam::Ostream& Foam::operator<<
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
return os
|
return os
|
||||||
<< wDist.inZone_ << wDist.previousPoint_
|
<< wDist.point0_ << wDist.previousPoint_
|
||||||
<< wDist.dist_ << wDist.data_;
|
<< wDist.dist_ << wDist.data_;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ Foam::Istream& Foam::operator>>
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
return is
|
return is
|
||||||
>> wDist.inZone_ >> wDist.previousPoint_
|
>> wDist.point0_ >> wDist.previousPoint_
|
||||||
>> wDist.dist_ >> wDist.data_;
|
>> wDist.dist_ >> wDist.data_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -61,10 +61,10 @@ class pointEdgeStructuredWalk
|
|||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
//- Is this point/edge inside the walk zone
|
//- Starting location
|
||||||
bool inZone_;
|
point point0_;
|
||||||
|
|
||||||
//- Previuos point
|
//- Previous point
|
||||||
point previousPoint_;
|
point previousPoint_;
|
||||||
|
|
||||||
//- Sum of distance
|
//- Sum of distance
|
||||||
@ -77,15 +77,6 @@ class pointEdgeStructuredWalk
|
|||||||
|
|
||||||
//- Evaluate distance to point.
|
//- Evaluate distance to point.
|
||||||
inline bool update
|
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 pointEdgeStructuredWalk& w2,
|
||||||
const scalar tol
|
const scalar tol
|
||||||
@ -101,7 +92,7 @@ public:
|
|||||||
//- Construct from components
|
//- Construct from components
|
||||||
inline pointEdgeStructuredWalk
|
inline pointEdgeStructuredWalk
|
||||||
(
|
(
|
||||||
const bool,
|
const point&,
|
||||||
const point&,
|
const point&,
|
||||||
const scalar,
|
const scalar,
|
||||||
const vector&
|
const vector&
|
||||||
@ -114,10 +105,6 @@ public:
|
|||||||
|
|
||||||
inline bool inZone() const;
|
inline bool inZone() const;
|
||||||
|
|
||||||
inline bool& inZone();
|
|
||||||
|
|
||||||
inline const point& previousPoint() const;
|
|
||||||
|
|
||||||
inline scalar dist() const;
|
inline scalar dist() const;
|
||||||
|
|
||||||
inline const vector& data() const;
|
inline const vector& data() const;
|
||||||
|
|||||||
@ -32,16 +32,15 @@ License
|
|||||||
// Update this with w2.
|
// Update this with w2.
|
||||||
inline bool Foam::pointEdgeStructuredWalk::update
|
inline bool Foam::pointEdgeStructuredWalk::update
|
||||||
(
|
(
|
||||||
const point& pt,
|
|
||||||
const pointEdgeStructuredWalk& w2,
|
const pointEdgeStructuredWalk& w2,
|
||||||
const scalar tol
|
const scalar tol
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (!valid())
|
if (!valid())
|
||||||
{
|
{
|
||||||
// current not yet set. Walked from w2 to here (=pt)
|
// current not yet set. Walked from w2 to here (=point0)
|
||||||
dist_ = w2.dist_ + mag(pt-w2.previousPoint_);
|
dist_ = w2.dist_ + mag(point0_-w2.previousPoint_);
|
||||||
previousPoint_ = pt;
|
previousPoint_ = point0_;
|
||||||
data_ = w2.data_;
|
data_ = w2.data_;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -53,35 +52,12 @@ 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 * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
// Null constructor
|
// Null constructor
|
||||||
inline Foam::pointEdgeStructuredWalk::pointEdgeStructuredWalk()
|
inline Foam::pointEdgeStructuredWalk::pointEdgeStructuredWalk()
|
||||||
:
|
:
|
||||||
inZone_(false),
|
point0_(vector::max),
|
||||||
previousPoint_(vector::max),
|
previousPoint_(vector::max),
|
||||||
dist_(0),
|
dist_(0),
|
||||||
data_(vector::zero)
|
data_(vector::zero)
|
||||||
@ -91,13 +67,13 @@ inline Foam::pointEdgeStructuredWalk::pointEdgeStructuredWalk()
|
|||||||
// Construct from origin, distance
|
// Construct from origin, distance
|
||||||
inline Foam::pointEdgeStructuredWalk::pointEdgeStructuredWalk
|
inline Foam::pointEdgeStructuredWalk::pointEdgeStructuredWalk
|
||||||
(
|
(
|
||||||
const bool inZone,
|
const point& point0,
|
||||||
const point& previousPoint,
|
const point& previousPoint,
|
||||||
const scalar dist,
|
const scalar dist,
|
||||||
const vector& data
|
const vector& data
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
inZone_(inZone),
|
point0_(point0),
|
||||||
previousPoint_(previousPoint),
|
previousPoint_(previousPoint),
|
||||||
dist_(dist),
|
dist_(dist),
|
||||||
data_(data)
|
data_(data)
|
||||||
@ -108,20 +84,14 @@ inline Foam::pointEdgeStructuredWalk::pointEdgeStructuredWalk
|
|||||||
|
|
||||||
inline bool Foam::pointEdgeStructuredWalk::inZone() const
|
inline bool Foam::pointEdgeStructuredWalk::inZone() const
|
||||||
{
|
{
|
||||||
return inZone_;
|
return point0_ != vector::max;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline bool& Foam::pointEdgeStructuredWalk::inZone()
|
//inline const Foam::point& Foam::pointEdgeStructuredWalk::previousPoint() const
|
||||||
{
|
//{
|
||||||
return inZone_;
|
// return previousPoint_;
|
||||||
}
|
//}
|
||||||
|
|
||||||
|
|
||||||
inline const Foam::point& Foam::pointEdgeStructuredWalk::previousPoint() const
|
|
||||||
{
|
|
||||||
return previousPoint_;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline Foam::scalar Foam::pointEdgeStructuredWalk::dist() const
|
inline Foam::scalar Foam::pointEdgeStructuredWalk::dist() const
|
||||||
@ -210,9 +180,9 @@ inline bool Foam::pointEdgeStructuredWalk::updatePoint
|
|||||||
const scalar tol
|
const scalar tol
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (inZone_)
|
if (inZone())
|
||||||
{
|
{
|
||||||
return update(mesh.points()[pointI], edgeInfo, tol);
|
return update(edgeInfo, tol);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -230,9 +200,9 @@ inline bool Foam::pointEdgeStructuredWalk::updatePoint
|
|||||||
const scalar tol
|
const scalar tol
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (inZone_)
|
if (inZone())
|
||||||
{
|
{
|
||||||
return update(mesh.points()[pointI], newPointInfo, tol);
|
return update(newPointInfo, tol);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -262,15 +232,9 @@ inline bool Foam::pointEdgeStructuredWalk::updateEdge
|
|||||||
const scalar tol
|
const scalar tol
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
if (inZone_)
|
if (inZone())
|
||||||
{
|
{
|
||||||
const pointField& points = mesh.points();
|
return update(pointInfo, tol);
|
||||||
|
|
||||||
const edge& e = mesh.edges()[edgeI];
|
|
||||||
|
|
||||||
const point edgeMid(0.5*(points[e[0]] + points[e[1]]));
|
|
||||||
|
|
||||||
return update(edgeMid, pointInfo, tol);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -286,7 +250,7 @@ inline bool Foam::pointEdgeStructuredWalk::operator==
|
|||||||
const Foam::pointEdgeStructuredWalk& rhs
|
const Foam::pointEdgeStructuredWalk& rhs
|
||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
return previousPoint() == rhs.previousPoint();
|
return previousPoint_ == rhs.previousPoint_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user