mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
BUG: fvMotionSolver/pointPatchFields which store p0, the initial
position of patch points. Adding autoMap and rmap functions to correctly handle p0 on decomposition and reconstruction.
This commit is contained in:
@ -48,7 +48,7 @@ uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField
|
||||
:
|
||||
fixedValuePointPatchField<vector>(p, iF),
|
||||
motion_(),
|
||||
p0_(p.localPoints()),
|
||||
initialPoints_(p.localPoints()),
|
||||
rhoInf_(1.0)
|
||||
{}
|
||||
|
||||
@ -70,13 +70,13 @@ uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField
|
||||
updateCoeffs();
|
||||
}
|
||||
|
||||
if (dict.found("p0"))
|
||||
if (dict.found("initialPoints"))
|
||||
{
|
||||
p0_ = vectorField("p0", dict , p.size());
|
||||
initialPoints_ = vectorField("initialPoints", dict , p.size());
|
||||
}
|
||||
else
|
||||
{
|
||||
p0_ = p.localPoints();
|
||||
initialPoints_ = p.localPoints();
|
||||
}
|
||||
}
|
||||
|
||||
@ -92,7 +92,7 @@ uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField
|
||||
:
|
||||
fixedValuePointPatchField<vector>(ptf, p, iF, mapper),
|
||||
motion_(ptf.motion_),
|
||||
p0_(ptf.p0_, mapper),
|
||||
initialPoints_(ptf.initialPoints_, mapper),
|
||||
rhoInf_(ptf.rhoInf_)
|
||||
{}
|
||||
|
||||
@ -106,13 +106,42 @@ uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField
|
||||
:
|
||||
fixedValuePointPatchField<vector>(ptf, iF),
|
||||
motion_(ptf.motion_),
|
||||
p0_(ptf.p0_),
|
||||
initialPoints_(ptf.initialPoints_),
|
||||
rhoInf_(ptf.rhoInf_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField::autoMap
|
||||
(
|
||||
const pointPatchFieldMapper& m
|
||||
)
|
||||
{
|
||||
fixedValuePointPatchField<vector>::autoMap(m);
|
||||
|
||||
initialPoints_.autoMap(m);
|
||||
}
|
||||
|
||||
|
||||
void uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField::rmap
|
||||
(
|
||||
const pointPatchField<vector>& ptf,
|
||||
const labelList& addr
|
||||
)
|
||||
{
|
||||
const uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField& uSDoFptf =
|
||||
refCast
|
||||
<
|
||||
const uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField
|
||||
>(ptf);
|
||||
|
||||
fixedValuePointPatchField<vector>::rmap(uSDoFptf, addr);
|
||||
|
||||
initialPoints_.rmap(uSDoFptf.initialPoints_, addr);
|
||||
}
|
||||
|
||||
|
||||
void uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField::updateCoeffs()
|
||||
{
|
||||
if (this->updated())
|
||||
@ -138,7 +167,10 @@ void uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField::updateCoeffs()
|
||||
// Do not modify the accelerations, except with gravity, where available
|
||||
motion_.updateForce(gravity*motion_.mass(), vector::zero, t.deltaTValue());
|
||||
|
||||
Field<vector>::operator=(motion_.currentPosition(p0_) - p0_);
|
||||
Field<vector>::operator=
|
||||
(
|
||||
motion_.currentPosition(initialPoints_) - initialPoints_
|
||||
);
|
||||
|
||||
fixedValuePointPatchField<vector>::updateCoeffs();
|
||||
}
|
||||
@ -153,7 +185,7 @@ void uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField::write
|
||||
motion_.write(os);
|
||||
os.writeKeyword("rhoInf")
|
||||
<< rhoInf_ << token::END_STATEMENT << nl;
|
||||
p0_.writeEntry("p0", os);
|
||||
initialPoints_.writeEntry("initialPoints", os);
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
||||
@ -57,8 +57,8 @@ class uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField
|
||||
//- Six dof motion object
|
||||
sixDoFRigidBodyMotion motion_;
|
||||
|
||||
//- Reference positions of points on the patch
|
||||
pointField p0_;
|
||||
//- Initial positions of points on the patch
|
||||
pointField initialPoints_;
|
||||
|
||||
//- Reference density required by the forces object for
|
||||
// incompressible calculations. Retained here to give
|
||||
@ -136,6 +136,22 @@ public:
|
||||
|
||||
// Member functions
|
||||
|
||||
// Mapping functions
|
||||
|
||||
//- Map (and resize as needed) from self given a mapping object
|
||||
virtual void autoMap
|
||||
(
|
||||
const pointPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Reverse map the given pointPatchField onto this pointPatchField
|
||||
virtual void rmap
|
||||
(
|
||||
const pointPatchField<vector>&,
|
||||
const labelList&
|
||||
);
|
||||
|
||||
|
||||
// Evaluation functions
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
|
||||
Reference in New Issue
Block a user