Relocated motion constraints to sixDOFODE base class

This commit is contained in:
Vuko Vukcevic 2017-03-09 10:35:50 +01:00 committed by Hrvoje Jasak
parent d4e6ec34c3
commit 8de41a7ae4
10 changed files with 120 additions and 219 deletions

View file

@ -56,10 +56,12 @@ SourceFiles
#ifndef rotationalConstraint_H
#define rotationalConstraint_H
#include "sixDOFODE.H"
#include "typeInfo.H"
#include "runTimeSelectionTables.H"
#include "autoPtr.H"
#include "dimensionedTypes.H"
#include "dictionary.H"
#include "Switch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View file

@ -56,10 +56,12 @@ SourceFiles
#ifndef translationalConstraint_H
#define translationalConstraint_H
#include "sixDOFODE.H"
#include "typeInfo.H"
#include "runTimeSelectionTables.H"
#include "autoPtr.H"
#include "dimensionedTypes.H"
#include "dictionary.H"
#include "Switch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View file

@ -24,13 +24,6 @@ License
Class
geometricSixDOF
Description
6-DOF solver using a geometric method for integration of rotations.
Author
Viktor Pandza, FSB Zagreb. All rights reserved.
Vuko Vukcevic, FSB Zagreb. All rights reserved.
\*---------------------------------------------------------------------------*/
#include "geometricSixDOF.H"
@ -76,7 +69,7 @@ Foam::dimensionedVector Foam::geometricSixDOF::A
// Create a scalar square matrix representing Newton equations with
// constraints and the corresponding source (right hand side vector).
// Note: size of the matrix is 3 + number of constraints
scalarField rhs(translationalConstraints_.size() + 3, 0.0);
scalarField rhs(translationalConstraints().size() + 3, 0.0);
scalarSquareMatrix M(rhs.size(), 0.0);
// Insert mass and explicit forcing into the system. Note: translations are
@ -98,10 +91,10 @@ Foam::dimensionedVector Foam::geometricSixDOF::A
}
// Insert contributions from the constraints
forAll(translationalConstraints_, tcI)
forAll(translationalConstraints(), tcI)
{
// Get reference to current constraint
const translationalConstraint& curTc = translationalConstraints_[tcI];
const translationalConstraint& curTc = translationalConstraints()[tcI];
// Get matrix contribution from constraint
const vector mc =
@ -152,7 +145,7 @@ Foam::dimensionedVector Foam::geometricSixDOF::OmegaDot
// Create a scalar square matrix representing Euler equations with
// constraints and the corresponding source (right hand side vector).
// Note: size of the matrix is 3 + number of constraints
scalarField rhs(rotationalConstraints_.size() + 3, 0.0);
scalarField rhs(rotationalConstraints().size() + 3, 0.0);
scalarSquareMatrix J(rhs.size(), 0.0);
// Get current inertial-to-local transformation
@ -175,10 +168,10 @@ Foam::dimensionedVector Foam::geometricSixDOF::OmegaDot
}
// Insert contributions from the constraints
forAll(rotationalConstraints_, rcI)
forAll(rotationalConstraints(), rcI)
{
// Get reference to current constraint
const rotationalConstraint& curRc = rotationalConstraints_[rcI];
const rotationalConstraint& curRc = rotationalConstraints()[rcI];
// Get matrix contribution from the constraint
const vector mc =
@ -321,10 +314,6 @@ void Foam::geometricSixDOF::setState(const sixDOFODE& sd)
// Copy ODE coefficients: this carries actual ODE state
// HJ, 23/Mar/2015
coeffs_ = gsd.coeffs_;
// Copy constraints
translationalConstraints_ = gsd.translationalConstraints_;
rotationalConstraints_ = gsd.rotationalConstraints_;
}
@ -345,10 +334,7 @@ Foam::geometricSixDOF::geometricSixDOF(const IOobject& io)
omega_(dict().lookup("omega")),
omegaAverage_("omegaAverage", omega_),
coeffs_(12, 0.0),
translationalConstraints_(),
rotationalConstraints_()
coeffs_(12, 0.0)
{
// Set ODE coefficients from position and rotation
@ -374,31 +360,6 @@ Foam::geometricSixDOF::geometricSixDOF(const IOobject& io)
coeffs_[9] = 0;
coeffs_[10] = 0;
coeffs_[11] = 0;
// Read and construct constraints
// Read translation constraints if they are present
if (dict().found("translationalConstraints"))
{
PtrList<translationalConstraint> tcList
(
dict().lookup("translationalConstraints"),
translationalConstraint::iNew()
);
translationalConstraints_.transfer(tcList);
}
// Read rotation constraints if they are present
if (dict().found("rotationalConstraints"))
{
PtrList<rotationalConstraint> rcList
(
dict().lookup("rotationalConstraints"),
rotationalConstraint::iNew()
);
rotationalConstraints_.transfer(rcList);
}
}
@ -417,10 +378,7 @@ Foam::geometricSixDOF::geometricSixDOF
omega_(gsd.omega_.name(), gsd.omega_),
omegaAverage_(gsd.omegaAverage_.name(), gsd.omegaAverage_),
coeffs_(gsd.coeffs_),
translationalConstraints_(gsd.translationalConstraints_),
rotationalConstraints_(gsd.rotationalConstraints_)
coeffs_(gsd.coeffs_)
{}
@ -634,20 +592,6 @@ bool Foam::geometricSixDOF::writeData(Ostream& os) const
os.writeKeyword("omega") << tab << omega_
<< token::END_STATEMENT << nl << endl;
if (!translationalConstraints_.empty())
{
os.writeKeyword("translationalConstraints")
<< translationalConstraints_
<< token::END_STATEMENT << nl << endl;
}
if (!rotationalConstraints_.empty())
{
os.writeKeyword("rotationalConstraints")
<< rotationalConstraints_
<< token::END_STATEMENT << endl;
}
return os.good();
}

View file

@ -28,7 +28,7 @@ Description
6-DOF solver using a geometric method for integration of rotations.
Run-time selectable constraints are handled via Lagrangian multipliers using
the interface from translationa/rotationalConstraint classes.
the interface from translational/rotationalConstraint classes.
Reference (bibtex):
@ -60,10 +60,7 @@ SourceFiles
#define geometricSixDOF_H
#include "sixDOFODE.H"
#include "finiteRotation.H"
#include "tolerancesSwitch.H"
#include "translationalConstraint.H"
#include "rotationalConstraint.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -109,15 +106,6 @@ class geometricSixDOF
scalarField coeffs_;
// Motion constraints
//- List of translational constraints
PtrList<translationalConstraint> translationalConstraints_;
//- List of rotational constraints
PtrList<rotationalConstraint> rotationalConstraints_;
// Private Member Functions
//- Disallow default bitwise copy construct
@ -216,23 +204,6 @@ public:
// Member Functions
// Access member functions
//- Return const reference to translational constraints
const PtrList<translationalConstraint>&
translationalConstraints() const
{
return translationalConstraints_;
}
//- Return const reference to rotational constraints
const PtrList<rotationalConstraint>&
rotationalConstraints() const
{
return rotationalConstraints_;
}
// Virtual interface for 6DOF motion state
// Variables in relative coordinate system

View file

@ -24,14 +24,6 @@ License
Class
quaternionSixDOF
Description
6-DOF solver using quaternions
Author
Dubravko Matijasevic, FSB Zagreb. All rights reserved.
Hrvoje Jasak, FSB Zagreb. All rights reserved.
Vuko Vukcevic, FSB Zagreb. All rights reserved.
\*---------------------------------------------------------------------------*/
#include "quaternionSixDOF.H"
@ -61,7 +53,7 @@ Foam::dimensionedVector Foam::quaternionSixDOF::A
// Create a scalar square matrix representing Newton equations with
// constraints and the corresponding source (right hand side vector).
// Note: size of the matrix is 3 + number of constraints
scalarField rhs(translationalConstraints_.size() + 3, 0.0);
scalarField rhs(translationalConstraints().size() + 3, 0.0);
scalarSquareMatrix M(rhs.size(), 0.0);
// Insert mass and explicit forcing into the system. Note: translations are
@ -83,10 +75,10 @@ Foam::dimensionedVector Foam::quaternionSixDOF::A
}
// Insert contributions from the constraints
forAll(translationalConstraints_, tcI)
forAll(translationalConstraints(), tcI)
{
// Get reference to current constraint
const translationalConstraint& curTc = translationalConstraints_[tcI];
const translationalConstraint& curTc = translationalConstraints()[tcI];
// Get matrix contribution from constraint
const vector mc =
@ -144,7 +136,7 @@ Foam::dimensionedVector Foam::quaternionSixDOF::OmegaDot
// Create a scalar square matrix representing Euler equations with
// constraints and the corresponding source (right hand side vector).
// Note: size of the matrix is 3 + number of constraints
scalarField rhs(rotationalConstraints_.size() + 3, 0.0);
scalarField rhs(rotationalConstraints().size() + 3, 0.0);
scalarSquareMatrix J(rhs.size(), 0.0);
// Get current inertial-to-local transformation. Note: different convention
@ -168,10 +160,10 @@ Foam::dimensionedVector Foam::quaternionSixDOF::OmegaDot
}
// Insert contributions from the constraints
forAll(rotationalConstraints_, rcI)
forAll(rotationalConstraints(), rcI)
{
// Get reference to current constraint
const rotationalConstraint& curRc = rotationalConstraints_[rcI];
const rotationalConstraint& curRc = rotationalConstraints()[rcI];
// Get matrix contribution from the constraint
const vector mc =
@ -241,10 +233,6 @@ void Foam::quaternionSixDOF::setState(const sixDOFODE& sd)
// Copy ODE coefficients: this carries actual ODE state
// HJ, 23/Mar/2015
coeffs_ = qsd.coeffs_;
// Copy constraints
translationalConstraints_ = qsd.translationalConstraints_;
rotationalConstraints_ = qsd.rotationalConstraints_;
}
@ -265,10 +253,7 @@ Foam::quaternionSixDOF::quaternionSixDOF(const IOobject& io)
omega_(dict().lookup("omega")),
omegaAverage_("omegaAverage", omega_),
coeffs_(13, 0.0),
translationalConstraints_(),
rotationalConstraints_()
coeffs_(13, 0.0)
{
// Set ODE coefficients from position and rotation
@ -295,30 +280,6 @@ Foam::quaternionSixDOF::quaternionSixDOF(const IOobject& io)
coeffs_[10] = rotation_.eInitial().e1();
coeffs_[11] = rotation_.eInitial().e2();
coeffs_[12] = rotation_.eInitial().e3();
// Read and construct constraints
// Read translation constraints if they are present
if (dict().found("translationalConstraints"))
{
PtrList<translationalConstraint> tcList
(
dict().lookup("translationalConstraints"),
translationalConstraint::iNew()
);
translationalConstraints_.transfer(tcList);
}
// Read rotation constraints if they are present
if (dict().found("rotationalConstraints"))
{
PtrList<rotationalConstraint> rcList
(
dict().lookup("rotationalConstraints"),
rotationalConstraint::iNew()
);
rotationalConstraints_.transfer(rcList);
}
}
@ -337,10 +298,7 @@ Foam::quaternionSixDOF::quaternionSixDOF
omega_(qsd.omega_.name(), qsd.omega_),
omegaAverage_(qsd.omegaAverage_.name(), qsd.omegaAverage_),
coeffs_(qsd.coeffs_),
translationalConstraints_(qsd.translationalConstraints_),
rotationalConstraints_(qsd.rotationalConstraints_)
coeffs_(qsd.coeffs_)
{}
@ -548,20 +506,6 @@ bool Foam::quaternionSixDOF::writeData(Ostream& os) const
os.writeKeyword("omega") << tab << omega_
<< token::END_STATEMENT << nl << nl;
if (!translationalConstraints_.empty())
{
os.writeKeyword("translationalConstraints")
<< translationalConstraints_
<< token::END_STATEMENT << nl << endl;
}
if (!rotationalConstraints_.empty())
{
os.writeKeyword("rotationalConstraints")
<< rotationalConstraints_
<< token::END_STATEMENT << endl;
}
return os.good();
}

View file

@ -36,8 +36,11 @@ Description
Author
Dubravko Matijasevic, FSB Zagreb. All rights reserved.
Hrvoje Jasak, FSB Zagreb. All rights reserved.
Reorganization by
Vuko Vukcevic, FSB Zagreb. All rights reserved.
Inno Gatin, FSB Zagreb. All rights reserved.
Hrvoje Jasak, FSB Zagreb. All rights reserved.
SourceFiles
quaternionSixDOF.C
@ -49,8 +52,6 @@ SourceFiles
#include "sixDOFODE.H"
#include "finiteRotation.H"
#include "translationalConstraint.H"
#include "rotationalConstraint.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -93,15 +94,6 @@ class quaternionSixDOF
scalarField coeffs_;
// Motion constraints
//- List of translational constraints
PtrList<translationalConstraint> translationalConstraints_;
//- List of rotational constraints
PtrList<rotationalConstraint> rotationalConstraints_;
// Private Member Functions
//- Disallow default bitwise copy construct
@ -179,23 +171,6 @@ public:
// Member Functions
// Access member functions
//- Return const reference to translational constraints
const PtrList<translationalConstraint>&
translationalConstraints() const
{
return translationalConstraints_;
}
//- Return const reference to rotational constraints
const PtrList<rotationalConstraint>&
rotationalConstraints() const
{
return rotationalConstraints_;
}
// Virtual interface for 6DOF motion state
// Variables in relative coordinate system

View file

@ -25,15 +25,6 @@ License
Class
sixDOFODE
Description
Abstract base class for six-degrees-of-freedom (6DOF) ordinary differential
equations with necessary interface for two-way coupling with CFD solvers.
Author
Dubravko Matijasevic, FSB Zagreb. All rights reserved.
Hrvoje Jasak, FSB Zagreb. All rights reserved.
Vuko Vukcevic, FSB Zagreb. All rights reserved.
\*---------------------------------------------------------------------------*/
#include "error.H"

View file

@ -24,15 +24,6 @@ License
Class
sixDOFODE
Description
Abstract base class for six-degrees-of-freedom (6DOF) ordinary differential
equations with necessary interface for two-way coupling with CFD solvers.
Author
Dubravko Matijasevic, FSB Zagreb. All rights reserved.
Hrvoje Jasak, FSB Zagreb. All rights reserved.
Vuko Vukcevic, FSB Zagreb. All rights reserved.
\*---------------------------------------------------------------------------*/
#include "objectRegistry.H"
@ -205,6 +196,10 @@ void Foam::sixDOFODE::setState(const sixDOFODE& sd)
force_ = sd.force_;
moment_ = sd.moment_;
// Copy constraints
translationalConstraints_ = sd.translationalConstraints_;
rotationalConstraints_ = sd.rotationalConstraints_;
}
@ -263,7 +258,10 @@ Foam::sixDOFODE::sixDOFODE(const IOobject& io)
moment_(dict_.lookup("moment")),
curTimeIndex_(-1),
oldStatePtr_()
oldStatePtr_(),
translationalConstraints_(),
rotationalConstraints_()
{
// Sanity checks
if (mass_.value() < SMALL)
@ -282,6 +280,30 @@ Foam::sixDOFODE::sixDOFODE(const IOobject& io)
<< nl << "Please check " << dict_.name() << "dictionary."
<< exit(FatalError);
}
// Read and construct constraints
// Read translation constraints if they are present
if (dict().found("translationalConstraints"))
{
PtrList<translationalConstraint> tcList
(
dict().lookup("translationalConstraints"),
translationalConstraint::iNew()
);
translationalConstraints_.transfer(tcList);
}
// Read rotation constraints if they are present
if (dict().found("rotationalConstraints"))
{
PtrList<rotationalConstraint> rcList
(
dict().lookup("rotationalConstraints"),
rotationalConstraint::iNew()
);
rotationalConstraints_.transfer(rcList);
}
}
@ -315,7 +337,10 @@ Foam::sixDOFODE::sixDOFODE(const word& name, const sixDOFODE& sd)
moment_(sd.moment_),
curTimeIndex_(sd.curTimeIndex_),
oldStatePtr_()
oldStatePtr_(),
translationalConstraints_(sd.translationalConstraints_),
rotationalConstraints_(sd.rotationalConstraints_)
{}
@ -359,6 +384,20 @@ bool Foam::sixDOFODE::writeData(Ostream& os) const
os.writeKeyword("moment") << tab << moment_
<< token::END_STATEMENT << nl << nl;
if (!translationalConstraints_.empty())
{
os.writeKeyword("translationalConstraints")
<< translationalConstraints_
<< token::END_STATEMENT << nl << endl;
}
if (!rotationalConstraints_.empty())
{
os.writeKeyword("rotationalConstraints")
<< rotationalConstraints_
<< token::END_STATEMENT << endl;
}
return os.good();
}

View file

@ -28,10 +28,16 @@ Description
Abstract base class for six-degrees-of-freedom (6DOF) ordinary differential
equations with necessary interface for two-way coupling with CFD solvers.
Holds list of translational and rotational constraints to be used in derived
classes.
Author
Dubravko Matijasevic, FSB Zagreb. All rights reserved.
Hrvoje Jasak, FSB Zagreb. All rights reserved.
Reorganisation by
Vuko Vukcevic, FSB Zagreb. All rights reserved.
Inno Gatin, FSB Zagreb. All rights reserved.
Hrvoje Jasak, FSB Zagreb. All rights reserved.
SourceFiles
sixDOFODEI.H
@ -50,6 +56,9 @@ SourceFiles
#include "runTimeSelectionTables.H"
#include "Switch.H"
#include "foamTime.H"
#include "translationalConstraint.H"
#include "rotationalConstraint.H"
#include "PtrList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -148,6 +157,15 @@ class sixDOFODE
autoPtr<sixDOFODE> oldStatePtr_;
// Motion constraints
//- List of translational constraints
PtrList<translationalConstraint> translationalConstraints_;
//- List of rotational constraints
PtrList<rotationalConstraint> rotationalConstraints_;
// Private Member Functions
// Copy control
@ -289,6 +307,17 @@ public:
);
// Access to motion constraints
//- Return const reference to translational constraints
inline const PtrList<translationalConstraint>&
translationalConstraints() const;
//- Return const reference to rotational constraints
inline const PtrList<rotationalConstraint>&
rotationalConstraints() const;
// Virtual interface for 6DOF motion state
// Variables in relative coordinate system

View file

@ -24,15 +24,6 @@ License
Class
sixDOFODE
Description
Abstract base class for six-degrees-of-freedom (6DOF) ordinary differential
equations with necessary interface for two-way coupling with CFD solvers.
Author
Dubravko Matijasevic, FSB Zagreb. All rights reserved.
Hrvoje Jasak, FSB Zagreb. All rights reserved.
Vuko Vukcevic, FSB Zagreb. All rights reserved.
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * * //
@ -135,4 +126,17 @@ void Foam::sixDOFODE::setExternalForceAndMoment
}
const Foam::PtrList<Foam::translationalConstraint>&
Foam::sixDOFODE::translationalConstraints() const
{
return translationalConstraints_;
}
const Foam::PtrList<Foam::rotationalConstraint>&
Foam::sixDOFODE::rotationalConstraints() const
{
return rotationalConstraints_;
}
// ************************************************************************* //