mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENC: sixDoFRigidBodyMotion. Adding fixedAxis constraint.
This commit is contained in:
@ -15,18 +15,19 @@ sDoFRBMR = $(sDoFRBM)/sixDoFRigidBodyMotionRestraint
|
|||||||
|
|
||||||
$(sDoFRBMR)/sixDoFRigidBodyMotionRestraint/sixDoFRigidBodyMotionRestraint.C
|
$(sDoFRBMR)/sixDoFRigidBodyMotionRestraint/sixDoFRigidBodyMotionRestraint.C
|
||||||
$(sDoFRBMR)/sixDoFRigidBodyMotionRestraint/newSixDoFRigidBodyMotionRestraint.C
|
$(sDoFRBMR)/sixDoFRigidBodyMotionRestraint/newSixDoFRigidBodyMotionRestraint.C
|
||||||
|
$(sDoFRBMR)/linearAxialAngularSpring/linearAxialAngularSpring.C
|
||||||
$(sDoFRBMR)/linearSpring/linearSpring.C
|
$(sDoFRBMR)/linearSpring/linearSpring.C
|
||||||
$(sDoFRBMR)/sphericalAngularSpring/sphericalAngularSpring.C
|
$(sDoFRBMR)/sphericalAngularSpring/sphericalAngularSpring.C
|
||||||
$(sDoFRBMR)/linearAxialAngularSpring/linearAxialAngularSpring.C
|
|
||||||
|
|
||||||
sDoFRBMC = $(sDoFRBM)/sixDoFRigidBodyMotionConstraint
|
sDoFRBMC = $(sDoFRBM)/sixDoFRigidBodyMotionConstraint
|
||||||
|
|
||||||
$(sDoFRBMC)/sixDoFRigidBodyMotionConstraint/sixDoFRigidBodyMotionConstraint.C
|
$(sDoFRBMC)/sixDoFRigidBodyMotionConstraint/sixDoFRigidBodyMotionConstraint.C
|
||||||
$(sDoFRBMC)/sixDoFRigidBodyMotionConstraint/newSixDoFRigidBodyMotionConstraint.C
|
$(sDoFRBMC)/sixDoFRigidBodyMotionConstraint/newSixDoFRigidBodyMotionConstraint.C
|
||||||
$(sDoFRBMC)/fixedPoint/fixedPoint.C
|
$(sDoFRBMC)/fixedAxis/fixedAxis.C
|
||||||
$(sDoFRBMC)/fixedPlane/fixedPlane.C
|
|
||||||
$(sDoFRBMC)/fixedLine/fixedLine.C
|
$(sDoFRBMC)/fixedLine/fixedLine.C
|
||||||
$(sDoFRBMC)/fixedOrientation/fixedOrientation.C
|
$(sDoFRBMC)/fixedOrientation/fixedOrientation.C
|
||||||
|
$(sDoFRBMC)/fixedPlane/fixedPlane.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
|
||||||
|
|||||||
@ -54,6 +54,8 @@ void Foam::sixDoFRigidBodyMotion::applyRestraints()
|
|||||||
|
|
||||||
a() += rF/mass_;
|
a() += rF/mass_;
|
||||||
|
|
||||||
|
// Moments are returned in global axes, transforming to
|
||||||
|
// body local to add to torque.
|
||||||
tau() += Q().T() & (rM + ((rP - centreOfMass()) ^ rF));
|
tau() += Q().T() & (rM + ((rP - centreOfMass()) ^ rF));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -137,7 +139,8 @@ void Foam::sixDoFRigidBodyMotion::applyConstraints(scalar deltaT)
|
|||||||
a() += cFA/mass_;
|
a() += cFA/mass_;
|
||||||
|
|
||||||
// The moment of constraint forces has already been added
|
// The moment of constraint forces has already been added
|
||||||
// during accumulation
|
// during accumulation. Moments are returned in global axes,
|
||||||
|
// transforming to body local
|
||||||
tau() += Q().T() & cMA;
|
tau() += Q().T() & cMA;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -272,7 +272,12 @@ public:
|
|||||||
|
|
||||||
//- Transform the given reference state direction by the current
|
//- Transform the given reference state direction by the current
|
||||||
// motion state
|
// motion state
|
||||||
inline point currentOrientation(const vector& refDir) const;
|
inline vector currentOrientation(const vector& refDir) const;
|
||||||
|
|
||||||
|
//- Access the orientation tensor, Q.
|
||||||
|
// globalVector = Q & bodyLocalVector
|
||||||
|
// bodyLocalVector = Q.T() & globalVector
|
||||||
|
inline const tensor& currentOrientation() const;
|
||||||
|
|
||||||
//- Predict the position of the supplied point after deltaT
|
//- Predict the position of the supplied point after deltaT
|
||||||
// given the current motion state and the additional supplied
|
// given the current motion state and the additional supplied
|
||||||
|
|||||||
@ -0,0 +1,157 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / 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 "fixedAxis.H"
|
||||||
|
#include "addToRunTimeSelectionTable.H"
|
||||||
|
#include "sixDoFRigidBodyMotion.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
namespace sixDoFRigidBodyMotionConstraints
|
||||||
|
{
|
||||||
|
defineTypeNameAndDebug(fixedAxis, 0);
|
||||||
|
addToRunTimeSelectionTable
|
||||||
|
(
|
||||||
|
sixDoFRigidBodyMotionConstraint,
|
||||||
|
fixedAxis,
|
||||||
|
dictionary
|
||||||
|
);
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::sixDoFRigidBodyMotionConstraints::fixedAxis::fixedAxis
|
||||||
|
(
|
||||||
|
const dictionary& sDoFRBMCDict
|
||||||
|
)
|
||||||
|
:
|
||||||
|
sixDoFRigidBodyMotionConstraint(sDoFRBMCDict),
|
||||||
|
fixedAxis_()
|
||||||
|
{
|
||||||
|
read(sDoFRBMCDict);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
Foam::sixDoFRigidBodyMotionConstraints::fixedAxis::~fixedAxis()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
bool Foam::sixDoFRigidBodyMotionConstraints::fixedAxis::constrain
|
||||||
|
(
|
||||||
|
const sixDoFRigidBodyMotion& motion,
|
||||||
|
const vector& existingConstraintForce,
|
||||||
|
const vector& existingConstraintMoment,
|
||||||
|
scalar deltaT,
|
||||||
|
vector& constraintPosition,
|
||||||
|
vector& constraintForceIncrement,
|
||||||
|
vector& constraintMomentIncrement
|
||||||
|
) const
|
||||||
|
{
|
||||||
|
constraintMomentIncrement = vector::zero;
|
||||||
|
|
||||||
|
vector predictedDir = motion.predictedOrientation
|
||||||
|
(
|
||||||
|
fixedAxis_,
|
||||||
|
existingConstraintMoment,
|
||||||
|
deltaT
|
||||||
|
);
|
||||||
|
|
||||||
|
scalar theta = acos(predictedDir & fixedAxis_);
|
||||||
|
|
||||||
|
vector rotationAxis = fixedAxis_ ^ predictedDir;
|
||||||
|
|
||||||
|
scalar magRotationAxis = mag(rotationAxis);
|
||||||
|
|
||||||
|
if (magRotationAxis > VSMALL)
|
||||||
|
{
|
||||||
|
rotationAxis /= magRotationAxis;
|
||||||
|
|
||||||
|
const tensor& Q = motion.currentOrientation();
|
||||||
|
|
||||||
|
// Transform rotationAxis to body local system
|
||||||
|
rotationAxis = Q.T() & rotationAxis;
|
||||||
|
|
||||||
|
constraintMomentIncrement =
|
||||||
|
-relaxationFactor_
|
||||||
|
*(motion.momentOfInertia() & rotationAxis)
|
||||||
|
*theta/sqr(deltaT);
|
||||||
|
|
||||||
|
// Transform moment increment to global system
|
||||||
|
constraintMomentIncrement = Q & constraintMomentIncrement;
|
||||||
|
|
||||||
|
// Remove any moment that is around the fixedAxis_
|
||||||
|
constraintMomentIncrement -=
|
||||||
|
(constraintMomentIncrement & fixedAxis_)*fixedAxis_;
|
||||||
|
}
|
||||||
|
|
||||||
|
constraintPosition = motion.centreOfMass();
|
||||||
|
|
||||||
|
constraintForceIncrement = vector::zero;
|
||||||
|
|
||||||
|
return (mag(theta) < tolerance_);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::sixDoFRigidBodyMotionConstraints::fixedAxis::read
|
||||||
|
(
|
||||||
|
const dictionary& sDoFRBMCDict
|
||||||
|
)
|
||||||
|
{
|
||||||
|
sixDoFRigidBodyMotionConstraint::read(sDoFRBMCDict);
|
||||||
|
|
||||||
|
sDoFRBMCCoeffs_.lookup("axis") >> fixedAxis_;
|
||||||
|
|
||||||
|
scalar magFixedAxis(mag(fixedAxis_));
|
||||||
|
|
||||||
|
if (magFixedAxis > VSMALL)
|
||||||
|
{
|
||||||
|
fixedAxis_ /= magFixedAxis;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
FatalErrorIn
|
||||||
|
(
|
||||||
|
"Foam::sixDoFRigidBodyMotionConstraints::fixedAxis::read"
|
||||||
|
"("
|
||||||
|
"const dictionary& sDoFRBMCDict"
|
||||||
|
")"
|
||||||
|
)
|
||||||
|
<< "axis has zero length"
|
||||||
|
<< abort(FatalError);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,126 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / 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::fixedAxis
|
||||||
|
|
||||||
|
Description
|
||||||
|
sixDoFRigidBodyMotionConstraint. Axis of body fixed global
|
||||||
|
space.
|
||||||
|
|
||||||
|
SourceFiles
|
||||||
|
fixedAxis.C
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#ifndef fixedAxis_H
|
||||||
|
#define fixedAxis_H
|
||||||
|
|
||||||
|
#include "sixDoFRigidBodyMotionConstraint.H"
|
||||||
|
#include "point.H"
|
||||||
|
#include "tensor.H"
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
namespace Foam
|
||||||
|
{
|
||||||
|
|
||||||
|
namespace sixDoFRigidBodyMotionConstraints
|
||||||
|
{
|
||||||
|
|
||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
Class fixedAxis Declaration
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
class fixedAxis
|
||||||
|
:
|
||||||
|
public sixDoFRigidBodyMotionConstraint
|
||||||
|
{
|
||||||
|
|
||||||
|
// Private data
|
||||||
|
|
||||||
|
//- Reference axis in global space
|
||||||
|
vector fixedAxis_;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
//- Runtime type information
|
||||||
|
TypeName("fixedAxis");
|
||||||
|
|
||||||
|
|
||||||
|
// Constructors
|
||||||
|
|
||||||
|
//- Construct from components
|
||||||
|
fixedAxis
|
||||||
|
(
|
||||||
|
const dictionary& sDoFRBMCDict
|
||||||
|
);
|
||||||
|
|
||||||
|
//- Construct and return a clone
|
||||||
|
virtual autoPtr<sixDoFRigidBodyMotionConstraint> clone() const
|
||||||
|
{
|
||||||
|
return autoPtr<sixDoFRigidBodyMotionConstraint>
|
||||||
|
(
|
||||||
|
new fixedAxis(*this)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Destructor
|
||||||
|
|
||||||
|
virtual ~fixedAxis();
|
||||||
|
|
||||||
|
|
||||||
|
// 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
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -210,7 +210,7 @@ inline Foam::point Foam::sixDoFRigidBodyMotion::currentPosition
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline Foam::point Foam::sixDoFRigidBodyMotion::currentOrientation
|
inline Foam::vector Foam::sixDoFRigidBodyMotion::currentOrientation
|
||||||
(
|
(
|
||||||
const vector& refDir
|
const vector& refDir
|
||||||
) const
|
) const
|
||||||
@ -219,6 +219,13 @@ inline Foam::point Foam::sixDoFRigidBodyMotion::currentOrientation
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline const Foam::tensor&
|
||||||
|
Foam::sixDoFRigidBodyMotion::currentOrientation() const
|
||||||
|
{
|
||||||
|
return Q();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
inline Foam::vector Foam::sixDoFRigidBodyMotion::omega() const
|
inline Foam::vector Foam::sixDoFRigidBodyMotion::omega() const
|
||||||
{
|
{
|
||||||
return Q() & (inv(momentOfInertia_) & pi());
|
return Q() & (inv(momentOfInertia_) & pi());
|
||||||
|
|||||||
Reference in New Issue
Block a user