Runtime bugfixes and minor reorganization

This commit is contained in:
Vuko Vukcevic 2017-02-28 16:08:03 +01:00 committed by Hrvoje Jasak
parent 546cfc0f5f
commit afeca8ee2f
7 changed files with 11 additions and 180 deletions

View file

@ -13,7 +13,6 @@ sixDOF = sixDOF
$(sixDOF)/finiteRotation/finiteRotation.C $(sixDOF)/finiteRotation/finiteRotation.C
$(sixDOF)/sixDOFqODE/sixDOFqODE.C $(sixDOF)/sixDOFqODE/sixDOFqODE.C
$(sixDOF)/sixDOFODE/sixDOFODEIO.C
$(sixDOF)/sixDOFODE/sixDOFODE.C $(sixDOF)/sixDOFODE/sixDOFODE.C
$(sixDOF)/sixDOFODE/newSixDOFODE.C $(sixDOF)/sixDOFODE/newSixDOFODE.C
$(sixDOF)/quaternionSixDOF/quaternionSixDOF.C $(sixDOF)/quaternionSixDOF/quaternionSixDOF.C

View file

@ -151,7 +151,7 @@ void Foam::finiteRotation::updateRotation(const HamiltonRodriguezRot& rot)
} }
void Foam::finiteRotation::updateRotationGivenIncrement(const tensor& incR) void Foam::finiteRotation::updateRotationWithIncrement(const tensor& incR)
{ {
rotIncrementTensor_ = incR; rotIncrementTensor_ = incR;
rotTensor_ = (incR & rotTensor_); rotTensor_ = (incR & rotTensor_);

View file

@ -108,7 +108,7 @@ public:
void updateRotation(const HamiltonRodriguezRot& rot); void updateRotation(const HamiltonRodriguezRot& rot);
//- Update rotation given increment rotation tensor //- Update rotation given increment rotation tensor
void updateRotationGivenIncrement(const tensor& incR); void updateRotationWithIncrement(const tensor& incR);
//- Return initial quaternions //- Return initial quaternions
const HamiltonRodriguezRot& eInitial() const; const HamiltonRodriguezRot& eInitial() const;

View file

@ -190,7 +190,7 @@ Foam::tensor Foam::geometricSixDOF::expMap(const vector& rotInc) const
+ (skewRotInc & skewRotInc)*(1.0 - cos(magRotInc))/sqr(magRotInc); + (skewRotInc & skewRotInc)*(1.0 - cos(magRotInc))/sqr(magRotInc);
} }
return R; return R.T();
} }
@ -568,15 +568,11 @@ void Foam::geometricSixDOF::derivatives
// Get rotational increment vector (u) // Get rotational increment vector (u)
const vector rotIncrementVector(y[9], y[10], y[11]); const vector rotIncrementVector(y[9], y[10], y[11]);
// Calculate rotation increment tensor obtained with exponential map using // Calculate current rotation tensor obtained with exponential map
// the increment vector const tensor curRot = (expMap(rotIncrementVector) & rotation_.rotTensor());
const tensor rotIncrement = expMap(rotIncrementVector);
// Update rotation tensor
rotation_.updateRotation(rotIncrement);
// Calculate translational acceleration using current rotation // Calculate translational acceleration using current rotation
const vector accel = A(curX, curU, rotation_.rotTensor()).value(); const vector accel = A(curX, curU, curRot).value();
// Set the derivatives for velocity // Set the derivatives for velocity
dydx[3] = accel.x(); dydx[3] = accel.x();
@ -593,7 +589,7 @@ void Foam::geometricSixDOF::derivatives
); );
// Calculate rotational acceleration using current rotation // Calculate rotational acceleration using current rotation
const vector omegaDot = OmegaDot(rotation_.rotTensor(), curOmega).value(); const vector omegaDot = OmegaDot(curRot, curOmega).value();
dydx[6] = omegaDot.x(); dydx[6] = omegaDot.x();
dydx[7] = omegaDot.y(); dydx[7] = omegaDot.y();
@ -649,7 +645,7 @@ void Foam::geometricSixDOF::update(const scalar delta)
omegaVal.z() = coeffs_[8]; omegaVal.z() = coeffs_[8];
// Update rotation with final increment vector // Update rotation with final increment vector
rotation_.updateRotation rotation_.updateRotationWithIncrement
( (
expMap(vector(coeffs_[9], coeffs_[10], coeffs_[11])) expMap(vector(coeffs_[9], coeffs_[10], coeffs_[11]))
); );

View file

@ -85,6 +85,9 @@ void Foam::sixDOFBodies::setBodies()
bodyI, bodyI,
ODESolver::New(lookup("solver"), odes_[bodyI]) ODESolver::New(lookup("solver"), odes_[bodyI])
); );
Info<< "Finished creating " << odes_[bodyI].type()
<< " object for body " << names_[bodyI] << endl;
} }
} }

View file

@ -1,65 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 4.0
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend 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 3 of the License, or (at your
option) any later version.
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
Class
sixDOFODEIO
Description
Class used to control input/output for sixDOFODEIO. Need separate classes in
order to be able to have run-time selection and automatic I/O.
Author
Vuko Vukcevic, FSB Zagreb. All rights reserved.
\*---------------------------------------------------------------------------*/
#include "sixDOFODEIO.H"
#include "sixDOFODE.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::sixDOFODEIO::sixDOFODEIO(const IOobject& io, const sixDOFODE& sixDOF)
:
IOdictionary(io),
sixDOF_(sixDOF)
{
// Note: parameter sixDOF is incomplete here, must not call its member
// functions here.
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::sixDOFODEIO::~sixDOFODEIO()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::sixDOFODEIO::writeData(Ostream& os) const
{
return sixDOF_.writeData(os);
}
// ************************************************************************* //

View file

@ -1,102 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 4.0
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend 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 3 of the License, or (at your
option) any later version.
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
Class
sixDOFODEIO
Description
Class used to control input/output for sixDOFODEIO. Need separate classes in
order to be able to have run-time selection and automatic I/O.
Author
Vuko Vukcevic, FSB Zagreb. All rights reserved.
SourceFiles
sixDOFODEIO.C
\*---------------------------------------------------------------------------*/
#ifndef sixDOFODEIO_H
#define sixDOFODEIO_H
#include "IOdictionary.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class sixDOFODE;
/*---------------------------------------------------------------------------*\
Class sixDOFODEIO Declaration
\*---------------------------------------------------------------------------*/
class sixDOFODEIO
:
public IOdictionary
{
// Private data
//- Const reference to the underlying sixDOFODE object
const sixDOFODE& sixDOF_;
// Private Member Functions
//- Disallow default bitwise copy construct
sixDOFODEIO(const sixDOFODEIO&);
//- Disallow default bitwise assignment
void operator=(const sixDOFODEIO&);
public:
// Constructors
//- Construct from dictionary and sixDOFODE object
sixDOFODEIO(const IOobject& io, const sixDOFODE& sixDOF);
// Destructor
virtual ~sixDOFODEIO();
// Write control
//- writeData member function controlling output
virtual bool writeData(Ostream& os) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //