sixDoFRigidBody: adding constraints.

Adding outline and placeholders for constraints and their solution.
This commit is contained in:
graham
2010-01-26 17:51:38 +00:00
parent 8bcb2c8f11
commit a0522a2b7b
14 changed files with 671 additions and 28 deletions

View File

@ -17,6 +17,12 @@ $(sDoFRBMR)/sixDoFRigidBodyMotionRestraint/sixDoFRigidBodyMotionRestraint.C
$(sDoFRBMR)/sixDoFRigidBodyMotionRestraint/newSixDoFRigidBodyMotionRestraint.C $(sDoFRBMR)/sixDoFRigidBodyMotionRestraint/newSixDoFRigidBodyMotionRestraint.C
$(sDoFRBMR)/linearSpring/linearSpring.C $(sDoFRBMR)/linearSpring/linearSpring.C
sDoFRBMC = $(sDoFRBM)/sixDoFRigidBodyMotionConstraint
$(sDoFRBMC)/sixDoFRigidBodyMotionConstraint/sixDoFRigidBodyMotionConstraint.C
$(sDoFRBMC)/sixDoFRigidBodyMotionConstraint/newSixDoFRigidBodyMotionConstraint.C
$(sDoFRBMC)/fixedPoint/fixedPoint.C
pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyDisplacementPointPatchVectorField.C pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyDisplacementPointPatchVectorField.C
pointPatchFields/derived/uncoupledSixDoFRigidBodyDisplacement/uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField.C pointPatchFields/derived/uncoupledSixDoFRigidBodyDisplacement/uncoupledSixDoFRigidBodyDisplacementPointPatchVectorField.C
pointPatchFields/derived/constrainedSixDoFRigidBodyDisplacement/constrainedSixDoFRigidBodyDisplacementPointPatchVectorField.C pointPatchFields/derived/constrainedSixDoFRigidBodyDisplacement/constrainedSixDoFRigidBodyDisplacementPointPatchVectorField.C

View File

@ -49,15 +49,61 @@ void Foam::sixDoFRigidBodyMotion::applyRestraints()
a() += rF/mass_; a() += rF/mass_;
tau() += Q().T() & (rM + (rP - centreOfMass()) ^ rF); tau() += Q().T() & (rM + ((rP - centreOfMass()) ^ rF));
} }
} }
} }
void Foam::sixDoFRigidBodyMotion::applyConstraints() void Foam::sixDoFRigidBodyMotion::applyConstraints(scalar deltaT)
{ {
if (Pstream::master())
{
label iter = 0;
bool converged = true;
// constraint force accumulator
vector cFA = vector::zero;
// constraint moment accumulator
vector cMA = vector::zero;
do
{
converged = true;
Info<< "Iteration " << iter << endl;
forAll(constraints_, cI)
{
Info<< "Constraint " << cI << endl;
// constraint position
point cP = vector::zero;
// constraint force
vector cF = vector::zero;
// constraint moment
vector cM = vector::zero;
converged = converged && constraints_[cI].constrain
(
*this,
cFA,
cMA,
deltaT,
cP,
cF,
cM
);
}
iter++;
} while(!converged);
}
} }
@ -67,6 +113,7 @@ Foam::sixDoFRigidBodyMotion::sixDoFRigidBodyMotion()
: :
motionState_(), motionState_(),
restraints_(), restraints_(),
constraints_(),
refCentreOfMass_(vector::zero), refCentreOfMass_(vector::zero),
momentOfInertia_(diagTensor::one*VSMALL), momentOfInertia_(diagTensor::one*VSMALL),
mass_(VSMALL) mass_(VSMALL)
@ -96,6 +143,7 @@ Foam::sixDoFRigidBodyMotion::sixDoFRigidBodyMotion
tau tau
), ),
restraints_(), restraints_(),
constraints_(),
refCentreOfMass_(refCentreOfMass), refCentreOfMass_(refCentreOfMass),
momentOfInertia_(momentOfInertia), momentOfInertia_(momentOfInertia),
mass_(mass) mass_(mass)
@ -106,6 +154,7 @@ Foam::sixDoFRigidBodyMotion::sixDoFRigidBodyMotion(const dictionary& dict)
: :
motionState_(dict), motionState_(dict),
restraints_(), restraints_(),
constraints_(),
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")))
@ -123,6 +172,7 @@ Foam::sixDoFRigidBodyMotion::sixDoFRigidBodyMotion
: :
motionState_(sDoFRBM.motionState()), motionState_(sDoFRBM.motionState()),
restraints_(sDoFRBM.restraints()), restraints_(sDoFRBM.restraints()),
constraints_(sDoFRBM.constraints()),
refCentreOfMass_(sDoFRBM.refCentreOfMass()), refCentreOfMass_(sDoFRBM.refCentreOfMass()),
momentOfInertia_(sDoFRBM.momentOfInertia()), momentOfInertia_(sDoFRBM.momentOfInertia()),
mass_(sDoFRBM.mass()) mass_(sDoFRBM.mass())
@ -176,7 +226,32 @@ void Foam::sixDoFRigidBodyMotion::addConstraints
const dictionary& dict const dictionary& dict
) )
{ {
if (dict.found("constraints"))
{
const dictionary& constraintDict = dict.subDict("constraints");
label i = 0;
constraints_.setSize(constraintDict.size());
forAllConstIter(IDLList<entry>, constraintDict, iter)
{
if (iter().isDict())
{
Info<< "Adding constraint: " << iter().keyword() << endl;
constraints_.set
(
i,
sixDoFRigidBodyMotionConstraint::New(iter().dict())
);
}
i++;
}
constraints_.setSize(i);
}
} }
@ -244,7 +319,7 @@ void Foam::sixDoFRigidBodyMotion::updateForce
applyRestraints(); applyRestraints();
applyConstraints(); applyConstraints(deltaT);
v() += 0.5*deltaT*a(); v() += 0.5*deltaT*a();
@ -282,5 +357,17 @@ void Foam::sixDoFRigidBodyMotion::updateForce
} }
Foam::point Foam::sixDoFRigidBodyMotion::predictedPosition
(
const point& pt,
const vector deltaForce,
const vector deltaMoment,
scalar deltaT
) const
{
Info<< "predictedPosition NOT IMPLEMENTED" << endl;
return pt;
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -59,6 +59,7 @@ SourceFiles
#include "sixDoFRigidBodyMotionState.H" #include "sixDoFRigidBodyMotionState.H"
#include "pointField.H" #include "pointField.H"
#include "sixDoFRigidBodyMotionRestraint.H" #include "sixDoFRigidBodyMotionRestraint.H"
#include "sixDoFRigidBodyMotionConstraint.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -90,8 +91,8 @@ class sixDoFRigidBodyMotion
//- Restraints on the motion //- Restraints on the motion
PtrList<sixDoFRigidBodyMotionRestraint> restraints_; PtrList<sixDoFRigidBodyMotionRestraint> restraints_;
// //- Constaints on the motion //- Constaints on the motion
// PtrList<sixDoFRigidBodyMotionConstraint> constraints_; PtrList<sixDoFRigidBodyMotionConstraint> constraints_;
//- Centre of mass of reference state //- Centre of mass of reference state
point refCentreOfMass_; point refCentreOfMass_;
@ -121,7 +122,7 @@ class sixDoFRigidBodyMotion
void applyRestraints(); void applyRestraints();
//- Apply the constraints to the object //- Apply the constraints to the object
void applyConstraints(); void applyConstraints(scalar deltaT);
// Access functions retained as private because of the risk of // Access functions retained as private because of the risk of
// confusion over what is a body local frame vector and what is global // confusion over what is a body local frame vector and what is global
@ -135,6 +136,10 @@ class sixDoFRigidBodyMotion
inline const PtrList<sixDoFRigidBodyMotionRestraint>& inline const PtrList<sixDoFRigidBodyMotionRestraint>&
restraints() const; restraints() const;
//- Return access to the constraints
inline const PtrList<sixDoFRigidBodyMotionConstraint>&
constraints() 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;
@ -256,6 +261,17 @@ public:
// motion state // motion state
inline point currentPosition(const point& pt) const; inline point currentPosition(const point& pt) const;
//- Predict the position of the supplied point after deltaT
// given the current motion state and the additional supplied
// force and moment
point predictedPosition
(
const point& pt,
const vector deltaForce,
const vector deltaMoment,
scalar deltaT
) const;
//- Return the angular velocity in the global frame //- Return the angular velocity in the global frame
inline vector omega() const; inline vector omega() const;

View File

@ -0,0 +1,109 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "fixedPoint.H"
#include "addToRunTimeSelectionTable.H"
#include "sixDoFRigidBodyMotion.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace sixDoFRigidBodyMotionConstraints
{
defineTypeNameAndDebug(fixedPoint, 0);
addToRunTimeSelectionTable
(
sixDoFRigidBodyMotionConstraint,
fixedPoint,
dictionary
);
};
};
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::sixDoFRigidBodyMotionConstraints::fixedPoint::fixedPoint
(
const dictionary& sDoFRBMCDict
)
:
sixDoFRigidBodyMotionConstraint(sDoFRBMCDict),
fixedPoint_()
{
read(sDoFRBMCDict);
}
// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * //
Foam::sixDoFRigidBodyMotionConstraints::fixedPoint::~fixedPoint()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
bool Foam::sixDoFRigidBodyMotionConstraints::fixedPoint::constrain
(
const sixDoFRigidBodyMotion& motion,
const vector& existingConstraintForce,
const vector& existingConstraintMoment,
scalar deltaT,
vector& constraintPosition,
vector& constraintForceIncrement,
vector& constraintMomentIncrement
) const
{
point predictedPosition = motion.predictedPosition
(
fixedPoint_,
existingConstraintForce,
existingConstraintMoment,
deltaT
);
vector error = predictedPosition - fixedPoint_;
Info<< error << endl;
return true;
}
bool Foam::sixDoFRigidBodyMotionConstraints::fixedPoint::read
(
const dictionary& sDoFRBMCDict
)
{
sixDoFRigidBodyMotionConstraint::read(sDoFRBMCDict);
sDoFRBMCCoeffs_.lookup("fixedPoint") >> fixedPoint_;
return true;
}
// ************************************************************************* //

View File

@ -0,0 +1,124 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::sixDoFRigidBodyMotionConstraints::fixedPoint
Description
sixDoFRigidBodyMotionConstraint. Point fixed in space.
SourceFiles
fixedPoint.C
\*---------------------------------------------------------------------------*/
#ifndef fixedPoint_H
#define fixedPoint_H
#include "sixDoFRigidBodyMotionConstraint.H"
#include "point.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace sixDoFRigidBodyMotionConstraints
{
/*---------------------------------------------------------------------------*\
Class fixedPoint Declaration
\*---------------------------------------------------------------------------*/
class fixedPoint
:
public sixDoFRigidBodyMotionConstraint
{
// Private data
//- Point which is rigidly attached to the body and constrains
// it so that this point remains fixed.
point fixedPoint_;
public:
//- Runtime type information
TypeName("fixedPoint");
// Constructors
//- Construct from components
fixedPoint
(
const dictionary& sDoFRBMCDict
);
//- Construct and return a clone
virtual autoPtr<sixDoFRigidBodyMotionConstraint> clone() const
{
return autoPtr<sixDoFRigidBodyMotionConstraint>
(
new fixedPoint(*this)
);
}
// Destructor
virtual ~fixedPoint();
// Member Functions
//- Calculate the constraint position, force and moment.
// Global reference frame vectors. Returns boolean stating
// whether the constraint been converged to tolerance.
virtual bool constrain
(
const sixDoFRigidBodyMotion& motion,
const vector& existingConstraintForce,
const vector& existingConstraintMoment,
scalar deltaT,
vector& constraintPosition,
vector& constraintForceIncrement,
vector& constraintMomentIncrement
) const;
//- Update properties from given dictionary
virtual bool read(const dictionary& sDoFRBMCCoeff);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace solidBodyMotionFunctions
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,65 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "sixDoFRigidBodyMotionConstraint.H"
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::sixDoFRigidBodyMotionConstraint>
Foam::sixDoFRigidBodyMotionConstraint::New(const dictionary& sDoFRBMCDict)
{
word sixDoFRigidBodyMotionConstraintTypeName =
sDoFRBMCDict.lookup("sixDoFRigidBodyMotionConstraint");
Info<< "Selecting sixDoFRigidBodyMotionConstraint function "
<< sixDoFRigidBodyMotionConstraintTypeName << endl;
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find
(
sixDoFRigidBodyMotionConstraintTypeName
);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
FatalErrorIn
(
"sixDoFRigidBodyMotionConstraint::New"
"("
"const dictionary& sDoFRBMCDict"
")"
) << "Unknown sixDoFRigidBodyMotionConstraint type "
<< sixDoFRigidBodyMotionConstraintTypeName << endl << endl
<< "Valid sixDoFRigidBodyMotionConstraints are : " << endl
<< dictionaryConstructorTablePtr_->sortedToc()
<< exit(FatalError);
}
return autoPtr<sixDoFRigidBodyMotionConstraint>(cstrIter()(sDoFRBMCDict));
}
// ************************************************************************* //

View File

@ -0,0 +1,75 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "sixDoFRigidBodyMotionConstraint.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(Foam::sixDoFRigidBodyMotionConstraint, 0);
defineRunTimeSelectionTable(Foam::sixDoFRigidBodyMotionConstraint, dictionary);
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::sixDoFRigidBodyMotionConstraint::sixDoFRigidBodyMotionConstraint
(
const dictionary& sDoFRBMCDict
)
:
sDoFRBMCCoeffs_
(
sDoFRBMCDict.subDict
(
word(sDoFRBMCDict.lookup("sixDoFRigidBodyMotionConstraint"))
+ "Coeffs"
)
),
tolerance_(readScalar(sDoFRBMCDict.lookup("tolerance")))
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::sixDoFRigidBodyMotionConstraint::~sixDoFRigidBodyMotionConstraint()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
bool Foam::sixDoFRigidBodyMotionConstraint::read
(
const dictionary& sDoFRBMCDict
)
{
tolerance_ = (readScalar(sDoFRBMCDict.lookup("tolerance")));
sDoFRBMCCoeffs_ = sDoFRBMCDict.subDict(type() + "Coeffs");
return true;
}
// ************************************************************************* //

View File

@ -0,0 +1,154 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Namespace
Foam::sixDoFRigidBodyMotionConstraints
Description
Namespace for six DoF motion constraints
Class
Foam::sixDoFRigidBodyMotionConstraint
Description
Base class for defining constraints for sixDoF motions
SourceFiles
sixDoFRigidBodyMotionConstraint.C
newDynamicFvMesh.C
\*---------------------------------------------------------------------------*/
#ifndef sixDoFRigidBodyMotionConstraint_H
#define sixDoFRigidBodyMotionConstraint_H
#include "Time.H"
#include "dictionary.H"
#include "autoPtr.H"
#include "vector.H"
#include "runTimeSelectionTables.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class sixDoFRigidBodyMotion;
/*---------------------------------------------------------------------------*\
Class sixDoFRigidBodyMotionConstraint Declaration
\*---------------------------------------------------------------------------*/
class sixDoFRigidBodyMotionConstraint
{
protected:
// Protected data
//- Constraint model specific coefficient dictionary
dictionary sDoFRBMCCoeffs_;
//- Solution tolerance. Meaning depends on model, usually an
// absolute distance or angle.
scalar tolerance_;
public:
//- Runtime type information
TypeName("sixDoFRigidBodyMotionConstraint");
// Declare run-time constructor selection table
declareRunTimeSelectionTable
(
autoPtr,
sixDoFRigidBodyMotionConstraint,
dictionary,
(const dictionary& sDoFRBMCDict),
(sDoFRBMCDict)
);
// Constructors
//- Construct from the sDoFRBMCDict dictionary and Time
sixDoFRigidBodyMotionConstraint
(
const dictionary& sDoFRBMCDict
);
//- Construct and return a clone
virtual autoPtr<sixDoFRigidBodyMotionConstraint> clone() const = 0;
// Selectors
//- Select constructed from the sDoFRBMCDict dictionary and Time
static autoPtr<sixDoFRigidBodyMotionConstraint> New
(
const dictionary& sDoFRBMCDict
);
// Destructor
virtual ~sixDoFRigidBodyMotionConstraint();
// Member Functions
//- Calculate the constraint position, force and moment.
// Global reference frame vectors. Returns boolean stating
// whether the constraint been converged to tolerance.
virtual bool constrain
(
const sixDoFRigidBodyMotion& motion,
const vector& existingConstraintForce,
const vector& existingConstraintMoment,
scalar deltaT,
vector& constraintPosition,
vector& constraintForceIncrement,
vector& constraintMomentIncrement
) const = 0;
//- Update properties from given dictionary
virtual bool read(const dictionary& sDoFRBMCDict) = 0;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -76,6 +76,13 @@ Foam::sixDoFRigidBodyMotion::restraints() const
} }
inline const Foam::PtrList<Foam::sixDoFRigidBodyMotionConstraint>&
Foam::sixDoFRigidBodyMotion::constraints() const
{
return constraints_;
}
inline const Foam::point& Foam::sixDoFRigidBodyMotion::refCentreOfMass() const inline const Foam::point& Foam::sixDoFRigidBodyMotion::refCentreOfMass() const
{ {
return refCentreOfMass_; return refCentreOfMass_;

View File

@ -49,17 +49,17 @@ namespace sixDoFRigidBodyMotionRestraints
Foam::sixDoFRigidBodyMotionRestraints::linearSpring::linearSpring Foam::sixDoFRigidBodyMotionRestraints::linearSpring::linearSpring
( (
const dictionary& sDoFRBMRCoeffs const dictionary& sDoFRBMRDict
) )
: :
sixDoFRigidBodyMotionRestraint(sDoFRBMRCoeffs), sixDoFRigidBodyMotionRestraint(sDoFRBMRDict),
anchor_(), anchor_(),
refAttachmentPt_(), refAttachmentPt_(),
stiffness_(), stiffness_(),
damping_(), damping_(),
restLength_() restLength_()
{ {
read(sDoFRBMRCoeffs); read(sDoFRBMRDict);
} }
@ -98,10 +98,10 @@ void Foam::sixDoFRigidBodyMotionRestraints::linearSpring::restrain
bool Foam::sixDoFRigidBodyMotionRestraints::linearSpring::read bool Foam::sixDoFRigidBodyMotionRestraints::linearSpring::read
( (
const dictionary& sDoFRBMRCoeffs const dictionary& sDoFRBMRDict
) )
{ {
sixDoFRigidBodyMotionRestraint::read(sDoFRBMRCoeffs); sixDoFRigidBodyMotionRestraint::read(sDoFRBMRDict);
sDoFRBMRCoeffs_.lookup("anchor") >> anchor_; sDoFRBMRCoeffs_.lookup("anchor") >> anchor_;

View File

@ -85,7 +85,7 @@ public:
//- Construct from components //- Construct from components
linearSpring linearSpring
( (
const dictionary& sDoFRBMRCoeffs const dictionary& sDoFRBMRDict
); );
//- Construct and return a clone //- Construct and return a clone

View File

@ -29,10 +29,10 @@ License
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::sixDoFRigidBodyMotionRestraint> Foam::autoPtr<Foam::sixDoFRigidBodyMotionRestraint>
Foam::sixDoFRigidBodyMotionRestraint::New(const dictionary& sDoFRBMRCoeffs) Foam::sixDoFRigidBodyMotionRestraint::New(const dictionary& sDoFRBMRDict)
{ {
word sixDoFRigidBodyMotionRestraintTypeName = word sixDoFRigidBodyMotionRestraintTypeName =
sDoFRBMRCoeffs.lookup("sixDoFRigidBodyMotionRestraint"); sDoFRBMRDict.lookup("sixDoFRigidBodyMotionRestraint");
Info<< "Selecting sixDoFRigidBodyMotionRestraint function " Info<< "Selecting sixDoFRigidBodyMotionRestraint function "
<< sixDoFRigidBodyMotionRestraintTypeName << endl; << sixDoFRigidBodyMotionRestraintTypeName << endl;
@ -49,7 +49,7 @@ Foam::sixDoFRigidBodyMotionRestraint::New(const dictionary& sDoFRBMRCoeffs)
( (
"sixDoFRigidBodyMotionRestraint::New" "sixDoFRigidBodyMotionRestraint::New"
"(" "("
" const dictionary& sDoFRBMRCoeffs" "const dictionary& sDoFRBMRDict"
")" ")"
) << "Unknown sixDoFRigidBodyMotionRestraint type " ) << "Unknown sixDoFRigidBodyMotionRestraint type "
<< sixDoFRigidBodyMotionRestraintTypeName << endl << endl << sixDoFRigidBodyMotionRestraintTypeName << endl << endl
@ -58,7 +58,7 @@ Foam::sixDoFRigidBodyMotionRestraint::New(const dictionary& sDoFRBMRCoeffs)
<< exit(FatalError); << exit(FatalError);
} }
return autoPtr<sixDoFRigidBodyMotionRestraint>(cstrIter()(sDoFRBMRCoeffs)); return autoPtr<sixDoFRigidBodyMotionRestraint>(cstrIter()(sDoFRBMRDict));
} }

View File

@ -36,14 +36,14 @@ defineRunTimeSelectionTable(Foam::sixDoFRigidBodyMotionRestraint, dictionary);
Foam::sixDoFRigidBodyMotionRestraint::sixDoFRigidBodyMotionRestraint Foam::sixDoFRigidBodyMotionRestraint::sixDoFRigidBodyMotionRestraint
( (
const dictionary& sDoFRBMRCoeffs const dictionary& sDoFRBMRDict
) )
: :
sDoFRBMRCoeffs_ sDoFRBMRCoeffs_
( (
sDoFRBMRCoeffs.subDict sDoFRBMRDict.subDict
( (
word(sDoFRBMRCoeffs.lookup("sixDoFRigidBodyMotionRestraint")) word(sDoFRBMRDict.lookup("sixDoFRigidBodyMotionRestraint"))
+ "Coeffs" + "Coeffs"
) )
) )
@ -60,10 +60,10 @@ Foam::sixDoFRigidBodyMotionRestraint::~sixDoFRigidBodyMotionRestraint()
bool Foam::sixDoFRigidBodyMotionRestraint::read bool Foam::sixDoFRigidBodyMotionRestraint::read
( (
const dictionary& sDoFRBMRCoeffs const dictionary& sDoFRBMRDict
) )
{ {
sDoFRBMRCoeffs_ = sDoFRBMRCoeffs.subDict(type() + "Coeffs"); sDoFRBMRCoeffs_ = sDoFRBMRDict.subDict(type() + "Coeffs");
return true; return true;
} }

View File

@ -86,17 +86,17 @@ public:
autoPtr, autoPtr,
sixDoFRigidBodyMotionRestraint, sixDoFRigidBodyMotionRestraint,
dictionary, dictionary,
(const dictionary& sDoFRBMRCoeffs), (const dictionary& sDoFRBMRDict),
(sDoFRBMRCoeffs) (sDoFRBMRDict)
); );
// Constructors // Constructors
//- Construct from the sDoFRBMRCoeffs dictionary and Time //- Construct from the sDoFRBMRDict dictionary and Time
sixDoFRigidBodyMotionRestraint sixDoFRigidBodyMotionRestraint
( (
const dictionary& sDoFRBMRCoeffs const dictionary& sDoFRBMRDict
); );
//- Construct and return a clone //- Construct and return a clone
@ -105,10 +105,10 @@ public:
// Selectors // Selectors
//- Select constructed from the sDoFRBMRCoeffs dictionary and Time //- Select constructed from the sDoFRBMRDict dictionary and Time
static autoPtr<sixDoFRigidBodyMotionRestraint> New static autoPtr<sixDoFRigidBodyMotionRestraint> New
( (
const dictionary& sDoFRBMRCoeffs const dictionary& sDoFRBMRDict
); );
@ -130,7 +130,7 @@ public:
) const = 0; ) const = 0;
//- Update properties from given dictionary //- Update properties from given dictionary
virtual bool read(const dictionary& sDoFRBMRCoeffs) = 0; virtual bool read(const dictionary& sDoFRBMRDict) = 0;
}; };