ENH: sixDoFRigidBodyDisplacement rho field handling.

Removing rhoInf from uncoupledSixDoF... patch, not needed.  Adding
optional rhoName entry to sixDoF... so no rhoInf entry is needed for
simulations that have a rho field, and require than a rhoInf value is
read for those that don't.
This commit is contained in:
graham
2010-05-11 12:09:58 +01:00
parent 9f2e06ed55
commit be8c67a242
4 changed files with 26 additions and 20 deletions

View File

@ -49,7 +49,8 @@ sixDoFRigidBodyDisplacementPointPatchVectorField
fixedValuePointPatchField<vector>(p, iF), fixedValuePointPatchField<vector>(p, iF),
motion_(), motion_(),
initialPoints_(p.localPoints()), initialPoints_(p.localPoints()),
rhoInf_(1.0) rhoInf_(1.0),
rhoName_("rho")
{} {}
@ -63,8 +64,14 @@ sixDoFRigidBodyDisplacementPointPatchVectorField
: :
fixedValuePointPatchField<vector>(p, iF, dict), fixedValuePointPatchField<vector>(p, iF, dict),
motion_(dict), motion_(dict),
rhoInf_(readScalar(dict.lookup("rhoInf"))) rhoInf_(1.0),
rhoName_(dict.lookupOrDefault<word>("rhoName", "rho"))
{ {
if (rhoName_ == "rhoInf")
{
rhoInf_ = readScalar(dict.lookup("rhoInf"));
}
if (!dict.found("value")) if (!dict.found("value"))
{ {
updateCoeffs(); updateCoeffs();
@ -93,7 +100,8 @@ sixDoFRigidBodyDisplacementPointPatchVectorField
fixedValuePointPatchField<vector>(ptf, p, iF, mapper), fixedValuePointPatchField<vector>(ptf, p, iF, mapper),
motion_(ptf.motion_), motion_(ptf.motion_),
initialPoints_(ptf.initialPoints_, mapper), initialPoints_(ptf.initialPoints_, mapper),
rhoInf_(ptf.rhoInf_) rhoInf_(ptf.rhoInf_),
rhoName_(ptf.rhoName_)
{} {}
@ -107,7 +115,8 @@ sixDoFRigidBodyDisplacementPointPatchVectorField
fixedValuePointPatchField<vector>(ptf, iF), fixedValuePointPatchField<vector>(ptf, iF),
motion_(ptf.motion_), motion_(ptf.motion_),
initialPoints_(ptf.initialPoints_), initialPoints_(ptf.initialPoints_),
rhoInf_(ptf.rhoInf_) rhoInf_(ptf.rhoInf_),
rhoName_(ptf.rhoName_)
{} {}
@ -160,6 +169,7 @@ void sixDoFRigidBodyDisplacementPointPatchVectorField::updateCoeffs()
forcesDict.add("patches", wordList(1, ptPatch.name())); forcesDict.add("patches", wordList(1, ptPatch.name()));
forcesDict.add("rhoInf", rhoInf_); forcesDict.add("rhoInf", rhoInf_);
forcesDict.add("rhoName", rhoName_);
forcesDict.add("CofR", motion_.centreOfMass()); forcesDict.add("CofR", motion_.centreOfMass());
forces f("forces", db(), forcesDict); forces f("forces", db(), forcesDict);
@ -200,6 +210,8 @@ void sixDoFRigidBodyDisplacementPointPatchVectorField::write(Ostream& os) const
motion_.write(os); motion_.write(os);
os.writeKeyword("rhoInf") os.writeKeyword("rhoInf")
<< rhoInf_ << token::END_STATEMENT << nl; << rhoInf_ << token::END_STATEMENT << nl;
os.writeKeyword("rhoName")
<< rhoName_ << token::END_STATEMENT << nl;
initialPoints_.writeEntry("initialPoints", os); initialPoints_.writeEntry("initialPoints", os);
writeEntry("value", os); writeEntry("value", os);
} }

View File

@ -60,9 +60,14 @@ class sixDoFRigidBodyDisplacementPointPatchVectorField
pointField initialPoints_; pointField initialPoints_;
//- Reference density required by the forces object for //- Reference density required by the forces object for
// incompressible calculations // incompressible calculations, required if rhoName == rhoInf
scalar rhoInf_; scalar rhoInf_;
//- Name of density field, optional unless used for an
// incompressible simulation, when this needs to be specified
// as rhoInf
word rhoName_;
public: public:

View File

@ -47,8 +47,7 @@ uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField
: :
fixedValuePointPatchField<vector>(p, iF), fixedValuePointPatchField<vector>(p, iF),
motion_(), motion_(),
initialPoints_(p.localPoints()), initialPoints_(p.localPoints())
rhoInf_(1.0)
{} {}
@ -61,8 +60,7 @@ uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField
) )
: :
fixedValuePointPatchField<vector>(p, iF, dict), fixedValuePointPatchField<vector>(p, iF, dict),
motion_(dict), motion_(dict)
rhoInf_(readScalar(dict.lookup("rhoInf")))
{ {
if (!dict.found("value")) if (!dict.found("value"))
{ {
@ -91,8 +89,7 @@ uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField
: :
fixedValuePointPatchField<vector>(ptf, p, iF, mapper), fixedValuePointPatchField<vector>(ptf, p, iF, mapper),
motion_(ptf.motion_), motion_(ptf.motion_),
initialPoints_(ptf.initialPoints_, mapper), initialPoints_(ptf.initialPoints_, mapper)
rhoInf_(ptf.rhoInf_)
{} {}
@ -105,8 +102,7 @@ uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField
: :
fixedValuePointPatchField<vector>(ptf, iF), fixedValuePointPatchField<vector>(ptf, iF),
motion_(ptf.motion_), motion_(ptf.motion_),
initialPoints_(ptf.initialPoints_), initialPoints_(ptf.initialPoints_)
rhoInf_(ptf.rhoInf_)
{} {}
@ -182,8 +178,6 @@ void uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField::write
{ {
pointPatchField<vector>::write(os); pointPatchField<vector>::write(os);
motion_.write(os); motion_.write(os);
os.writeKeyword("rhoInf")
<< rhoInf_ << token::END_STATEMENT << nl;
initialPoints_.writeEntry("initialPoints", os); initialPoints_.writeEntry("initialPoints", os);
writeEntry("value", os); writeEntry("value", os);
} }

View File

@ -59,11 +59,6 @@ class uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField
//- Initial positions of points on the patch //- Initial positions of points on the patch
pointField initialPoints_; pointField initialPoints_;
//- Reference density required by the forces object for
// incompressible calculations. Retained here to give
// dictionary compatibility with other sixDoF patches.
scalar rhoInf_;
public: public: