Merge branch 'master' of /home/noisy3/OpenFOAM/OpenFOAM-dev

This commit is contained in:
mattijs
2010-02-05 16:53:20 +00:00
5 changed files with 59 additions and 35 deletions

View File

@ -114,6 +114,32 @@ sixDoFRigidBodyDisplacementPointPatchVectorField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void sixDoFRigidBodyDisplacementPointPatchVectorField::autoMap
(
const pointPatchFieldMapper& m
)
{
fixedValuePointPatchField<vector>::autoMap(m);
p0_.autoMap(m);
}
void sixDoFRigidBodyDisplacementPointPatchVectorField::rmap
(
const pointPatchField<vector>& ptf,
const labelList& addr
)
{
const sixDoFRigidBodyDisplacementPointPatchVectorField& sDoFptf =
refCast<const sixDoFRigidBodyDisplacementPointPatchVectorField>(ptf);
fixedValuePointPatchField<vector>::rmap(sDoFptf, addr);
p0_.rmap(sDoFptf.p0_, addr);
}
void sixDoFRigidBodyDisplacementPointPatchVectorField::updateCoeffs() void sixDoFRigidBodyDisplacementPointPatchVectorField::updateCoeffs()
{ {
if (this->updated()) if (this->updated())
@ -160,26 +186,6 @@ void sixDoFRigidBodyDisplacementPointPatchVectorField::updateCoeffs()
t.deltaTValue() t.deltaTValue()
); );
// ----------------------------------------
// vector rotationAxis(0, 1, 0);
// vector torque
// (
// (
// (fm.second().first() + fm.second().second())
// & rotationAxis
// )
// *rotationAxis
// );
// motion_.updateForce
// (
// vector::zero, // Force no centre of mass motion
// torque, // Only rotation allowed around the unit rotationAxis
// t.deltaTValue()
// );
// ----------------------------------------
Field<vector>::operator=(motion_.currentPosition(p0_) - p0_); Field<vector>::operator=(motion_.currentPosition(p0_) - p0_);
fixedValuePointPatchField<vector>::updateCoeffs(); fixedValuePointPatchField<vector>::updateCoeffs();

View File

@ -135,6 +135,22 @@ public:
// Member functions // 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 // Evaluation functions
//- Update the coefficients associated with the patch field //- Update the coefficients associated with the patch field

View File

@ -30,7 +30,7 @@ License
void Foam::sixDoFRigidBodyMotion::applyRestraints() void Foam::sixDoFRigidBodyMotion::applyRestraints()
{ {
if (restraints_.size() == 0) if (restraints_.empty())
{ {
return; return;
} }
@ -62,14 +62,14 @@ void Foam::sixDoFRigidBodyMotion::applyRestraints()
void Foam::sixDoFRigidBodyMotion::applyConstraints(scalar deltaT) void Foam::sixDoFRigidBodyMotion::applyConstraints(scalar deltaT)
{ {
if (constraints_.size() == 0) if (constraints_.empty())
{ {
return; return;
} }
if (Pstream::master()) if (Pstream::master())
{ {
label iter = 0; label iteration = 0;
bool allConverged = true; bool allConverged = true;
@ -114,9 +114,9 @@ void Foam::sixDoFRigidBodyMotion::applyConstraints(scalar deltaT)
cMA += cM + ((cP - centreOfMass()) ^ cF); cMA += cM + ((cP - centreOfMass()) ^ cF);
} }
} while(++iter < maxConstraintIters_ && !allConverged); } while(++iteration < maxConstraintIterations_ && !allConverged);
if (iter >= maxConstraintIters_) if (iteration >= maxConstraintIterations_)
{ {
FatalErrorIn FatalErrorIn
( (
@ -124,13 +124,15 @@ void Foam::sixDoFRigidBodyMotion::applyConstraints(scalar deltaT)
"(scalar deltaT)" "(scalar deltaT)"
) )
<< nl << "Maximum number of sixDoFRigidBodyMotion constraint " << nl << "Maximum number of sixDoFRigidBodyMotion constraint "
<< "iterations (" << maxConstraintIters_ << ") exceeded." << nl << "iterations ("
<< maxConstraintIterations_
<< ") exceeded." << nl
<< exit(FatalError); << exit(FatalError);
} }
else if (report_) else if (report_)
{ {
Info<< "sixDoFRigidBodyMotion constraints converged in " Info<< "sixDoFRigidBodyMotion constraints converged in "
<< iter << " iterations" << iteration << " iterations"
<< nl << "Constraint force: " << cFA << nl << nl << "Constraint force: " << cFA << nl
<< "Constraint moment: " << cMA << "Constraint moment: " << cMA
<< endl; << endl;
@ -154,7 +156,7 @@ Foam::sixDoFRigidBodyMotion::sixDoFRigidBodyMotion()
motionState_(), motionState_(),
restraints_(), restraints_(),
constraints_(), constraints_(),
maxConstraintIters_(0), maxConstraintIterations_(0),
refCentreOfMass_(vector::zero), refCentreOfMass_(vector::zero),
momentOfInertia_(diagTensor::one*VSMALL), momentOfInertia_(diagTensor::one*VSMALL),
mass_(VSMALL), mass_(VSMALL),
@ -187,7 +189,7 @@ Foam::sixDoFRigidBodyMotion::sixDoFRigidBodyMotion
), ),
restraints_(), restraints_(),
constraints_(), constraints_(),
maxConstraintIters_(0), maxConstraintIterations_(0),
refCentreOfMass_(refCentreOfMass), refCentreOfMass_(refCentreOfMass),
momentOfInertia_(momentOfInertia), momentOfInertia_(momentOfInertia),
mass_(mass), mass_(mass),
@ -200,7 +202,7 @@ Foam::sixDoFRigidBodyMotion::sixDoFRigidBodyMotion(const dictionary& dict)
motionState_(dict), motionState_(dict),
restraints_(), restraints_(),
constraints_(), constraints_(),
maxConstraintIters_(0), maxConstraintIterations_(0),
refCentreOfMass_(dict.lookupOrDefault("refCentreOfMass", centreOfMass())), refCentreOfMass_(dict.lookupOrDefault("refCentreOfMass", centreOfMass())),
momentOfInertia_(dict.lookup("momentOfInertia")), momentOfInertia_(dict.lookup("momentOfInertia")),
mass_(readScalar(dict.lookup("mass"))), mass_(readScalar(dict.lookup("mass"))),
@ -220,7 +222,7 @@ Foam::sixDoFRigidBodyMotion::sixDoFRigidBodyMotion
motionState_(sDoFRBM.motionState()), motionState_(sDoFRBM.motionState()),
restraints_(sDoFRBM.restraints()), restraints_(sDoFRBM.restraints()),
constraints_(sDoFRBM.constraints()), constraints_(sDoFRBM.constraints()),
maxConstraintIters_(sDoFRBM.maxConstraintIters()), maxConstraintIterations_(sDoFRBM.maxConstraintIterations()),
refCentreOfMass_(sDoFRBM.refCentreOfMass()), refCentreOfMass_(sDoFRBM.refCentreOfMass()),
momentOfInertia_(sDoFRBM.momentOfInertia()), momentOfInertia_(sDoFRBM.momentOfInertia()),
mass_(sDoFRBM.mass()), mass_(sDoFRBM.mass()),

View File

@ -96,7 +96,7 @@ class sixDoFRigidBodyMotion
//- Maximum number of iterations allowed to attempt to obey //- Maximum number of iterations allowed to attempt to obey
// constraints // constraints
label maxConstraintIters_; label maxConstraintIterations_;
//- Centre of mass of reference state //- Centre of mass of reference state
point refCentreOfMass_; point refCentreOfMass_;
@ -152,7 +152,7 @@ class sixDoFRigidBodyMotion
//- Return access to the maximum allowed number of //- Return access to the maximum allowed number of
// constraint iterations // constraint iterations
inline label maxConstraintIters() const; inline label maxConstraintIterations() const;
//- Return access to the centre of mass //- Return access to the centre of mass
inline const point& refCentreOfMass() const; inline const point& refCentreOfMass() const;

View File

@ -114,9 +114,9 @@ Foam::sixDoFRigidBodyMotion::constraints() const
} }
inline Foam::label Foam::sixDoFRigidBodyMotion::maxConstraintIters() const inline Foam::label Foam::sixDoFRigidBodyMotion::maxConstraintIterations() const
{ {
return maxConstraintIters_; return maxConstraintIterations_;
} }