Merge branch 'master' into cvm

This commit is contained in:
graham
2009-10-19 18:28:21 +01:00
378 changed files with 9924 additions and 2969 deletions

View File

@ -39,8 +39,6 @@ wmake libso sampling
wmake libso dynamicMesh
wmake libso dynamicFvMesh
wmake libso topoChangerFvMesh
wmake libso fvMotionSolver
wmake libso engine
wmake libso ODE
wmake libso randomProcesses
@ -51,12 +49,15 @@ turbulenceModels/Allwmake
lagrangian/Allwmake
postProcessing/Allwmake
conversion/Allwmake
mesh/Allwmake
wmake libso autoMesh
wmake libso errorEstimation
wmake libso conformalVoronoiMesh
fvAgglomerationMethods/Allwmake
wmake libso fvMotionSolver
wmake libso engine
# ----------------------------------------------------------------- end-of-file

View File

@ -1,6 +1,6 @@
global/global.Cver
global/dimensionedConstants/dimensionedConstants.C
global/dimensionedConstants/constants/constants.C
global/constants/constants.C
global/constants/dimensionedConstants.C
global/argList/argList.C
global/clock/clock.C

View File

@ -85,7 +85,6 @@ inline void Foam::OPstream::writeToBuffer
}
// * * * * * * * * * * * * * * * * Constructor * * * * * * * * * * * * * * * //
Foam::OPstream::OPstream

View File

@ -217,7 +217,7 @@ bool Foam::Pstream::parRun_(false);
Foam::List<int> Foam::Pstream::procIDs_(1, 0);
// Standard transfer message type
const int Foam::Pstream::msgType_(1);
int Foam::Pstream::msgType_(1);
// Linear communication schedule
Foam::List<Foam::Pstream::commsStruct> Foam::Pstream::linearCommunication_(0);

View File

@ -163,7 +163,7 @@ private:
static bool parRun_;
static List<int> procIDs_;
static const int msgType_;
static int msgType_;
static List<commsStruct> linearCommunication_;
static List<commsStruct> treeCommunication_;
@ -337,11 +337,12 @@ public:
}
//- Message tag of standard messages
static int msgType()
static int& msgType()
{
return msgType_;
}
//- Get the communications type of the stream
commsTypes commsType() const
{

View File

@ -66,7 +66,9 @@ bool Foam::functionEntries::removeEntry::execute
)
{
wordList dictKeys = parentDict.toc();
labelList indices = findStrings<word>(readList<wordRe>(is), dictKeys);
wordReList patterns(is);
labelList indices = findStrings(patterns, dictKeys);
forAll(indices, indexI)
{

View File

@ -38,6 +38,7 @@ SourceFiles
#include "symmTransform.H"
#include "symmTensorField.H"
#include "sphericalTensor.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -26,6 +26,7 @@ License
#include "basicSymmetryPointPatchField.H"
#include "transformField.H"
#include "symmTransformField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -89,7 +90,12 @@ void basicSymmetryPointPatchField<Type>::evaluate(const Pstream::commsTypes)
const vectorField& nHat = this->patch().pointNormals();
tmp<Field<Type> > tvalues =
transform(I - nHat*nHat, this->patchInternalField());
(
(
this->patchInternalField()
+ transform(I - 2.0*sqr(nHat), this->patchInternalField())
)/2.0
);
// Get internal field to insert values into
Field<Type>& iF = const_cast<Field<Type>&>(this->internalField());

View File

@ -24,7 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "mathConstants.H"
#include "mathematicalConstants.H"
#include "universalConstants.H"
#include "electromagneticConstants.H"
#include "atomicConstants.H"
@ -83,7 +83,7 @@ const Foam::dimensionedScalar Foam::constant::atomic::a0
(
"a0",
alpha
/(dimensionedScalar("C", dimless, 4.0*constant::math::pi)*Rinf)
/(dimensionedScalar("C", dimless, 4.0*constant::mathematical::pi)*Rinf)
)
)
);
@ -100,7 +100,7 @@ const Foam::dimensionedScalar Foam::constant::atomic::re
"re",
sqr(constant::electromagnetic::e)
/(
dimensionedScalar("C", dimless, 4.0*constant::math::pi)
dimensionedScalar("C", dimless, 4.0*constant::mathematical::pi)
*constant::electromagnetic::epsilon0
*me
*sqr(constant::universal::c)

View File

@ -23,7 +23,7 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Namespace
Foam::constant::atom
Foam::constant::atomic
Description
Atomic constants
@ -68,7 +68,7 @@ namespace atomic
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace atomic
} // end namespace constant
} // End namespace constant
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -22,9 +22,6 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
Collection of dimensioned constants
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -38,7 +38,7 @@ Description
// Dimensionless coefficents
// Mathematical constants
#include "mathConstants.H"
#include "mathematicalConstants.H"
// Dimensioned constants

View File

@ -27,9 +27,10 @@ Global
Description
Dictionary reading and supplying the dimensioned constants used within
OpenFOAM particularly for thermodynamics. The values are read from the
OpenFOAM controlDict and should be changed to run with a different set of
units from the default SI units.
OpenFOAM, particularly for thermodynamics.
The values are read from the OpenFOAM etc/controlDict and should be
changed to run with a different set of units from the default SI units.
SourceFiles
dimensionedConstants.C

View File

@ -24,7 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "mathConstants.H"
#include "mathematicalConstants.H"
#include "universalConstants.H"
#include "electromagneticConstants.H"
#include "atomicConstants.H"
@ -46,7 +46,7 @@ const Foam::dimensionedScalar Foam::constant::electromagnetic::mu0
(
"mu0",
dimless,
4.0*constant::math::pi*1e-07
4.0*constant::mathematical::pi*1e-07
)
)
);
@ -92,7 +92,7 @@ const Foam::dimensionedScalar Foam::constant::electromagnetic::kappa
dimensionedScalar
(
"kappa",
dimensionedScalar("C", dimless, 1.0/(4.0*constant::math::pi))
dimensionedScalar("C", dimless, 1.0/(4.0*constant::mathematical::pi))
/epsilon0
)
)

View File

@ -23,7 +23,7 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Namespace
Foam::constant::em
Foam::constant::electromagnetic
Description
Electromagnetic constants
@ -77,7 +77,7 @@ namespace electromagnetic
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace electromagnetic
} // end namespace constant
} // End namespace constant
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -0,0 +1,83 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-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::constant::mathematical
Description
mathematical constants and conversion functions
\*---------------------------------------------------------------------------*/
#ifndef mathematicalConstants_H
#define mathematicalConstants_H
#include "scalar.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace constant
{
namespace mathematical
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
static word group = "mathematical";
const scalar e(M_E);
const scalar pi(M_PI);
const scalar twoPi(2*pi);
const scalar piByTwo(0.5*pi);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace mathematical
} // End namespace constant
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- Conversion from degrees to radians
inline scalar degToRad(const scalar& deg)
{
return (deg*constant::mathematical::pi/180.0);
}
//- Conversion from radians to degrees
inline scalar radToDeg(const scalar& rad)
{
return (rad*180.0/constant::mathematical::pi);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -24,7 +24,7 @@ License
\*---------------------------------------------------------------------------*/
#include "mathConstants.H"
#include "mathematicalConstants.H"
#include "universalConstants.H"
#include "electromagneticConstants.H"
#include "physicoChemicalConstants.H"
@ -75,7 +75,7 @@ const Foam::dimensionedScalar Foam::constant::physicoChemical::sigma
dimensionedScalar
(
"sigma",
dimensionedScalar("C", dimless, sqr(constant::math::pi)/60.0)
dimensionedScalar("C", dimless, sqr(constant::mathematical::pi)/60.0)
*pow4(k)/(pow3(constant::universal::hr)*sqr(constant::universal::c))
)
)
@ -107,7 +107,7 @@ const Foam::dimensionedScalar Foam::constant::physicoChemical::c1
dimensionedScalar
(
"c1",
dimensionedScalar("C", dimless, constant::math::twoPi)
dimensionedScalar("C", dimless, constant::mathematical::twoPi)
*constant::universal::h*sqr(constant::universal::c)
)
)

View File

@ -23,7 +23,7 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Namespace
Foam::constant::phys
Foam::constant::physicoChemical
Description
Physico-chemical constants
@ -71,7 +71,7 @@ namespace physicoChemical
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace physicoChemical
} // end namespace constant
} // End namespace constant
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -25,7 +25,7 @@ License
\*---------------------------------------------------------------------------*/
#include "universalConstants.H"
#include "mathConstants.H"
#include "mathematicalConstants.H"
#include "dimensionedConstants.H"
@ -43,7 +43,7 @@ const Foam::dimensionedScalar Foam::constant::universal::hr
dimensionedScalar
(
"hr",
h/(dimensionedScalar("C", dimless, constant::math::twoPi))
h/(dimensionedScalar("C", dimless, constant::mathematical::twoPi))
)
)
);

View File

@ -23,7 +23,7 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Namespace
Foam::constant::uni
Foam::constant::universal
Description
Universal constants

View File

@ -27,7 +27,7 @@ License
#include "face.H"
#include "triFace.H"
#include "triPointRef.H"
#include "mathConstants.H"
#include "mathematicalConstants.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -99,13 +99,13 @@ Foam::label Foam::face::mostConcaveAngle
if ((edgeNormal & n) > 0)
{
// Concave angle.
angle = constant::math::pi + edgeAngle;
angle = constant::mathematical::pi + edgeAngle;
}
else
{
// Convex angle. Note '-' to take into account that rightEdge
// and leftEdge are head-to-tail connected.
angle = constant::math::pi - edgeAngle;
angle = constant::mathematical::pi - edgeAngle;
}
if (angle > maxAngle)
@ -214,7 +214,7 @@ Foam::label Foam::face::split
label index = fcIndex(fcIndex(startIndex));
label minIndex = index;
scalar minDiff = constant::math::pi;
scalar minDiff = constant::mathematical::pi;
for(label i = 0; i < size() - 3; i++)
{

View File

@ -159,9 +159,9 @@ Foam::pointHit Foam::face::intersection
if (curHit.hit())
{
if (Foam::mag(curHit.distance()) < nearestHitDist)
if (Foam::mag(curHit.distance()) < Foam::mag(nearestHitDist))
{
nearestHitDist = Foam::mag(curHit.distance());
nearestHitDist = curHit.distance();
nearest.setHit();
nearest.setPoint(curHit.hitPoint());
}

View File

@ -450,7 +450,7 @@ bool Foam::polyBoundaryMesh::checkParallelSync(const bool report) const
const polyBoundaryMesh& bm = *this;
bool boundaryError = false;
bool hasError = false;
// Collect non-proc patches and check proc patches are last.
wordList names(bm.size());
@ -464,8 +464,8 @@ bool Foam::polyBoundaryMesh::checkParallelSync(const bool report) const
{
if (nonProcI != patchI)
{
// There is processor patch inbetween normal patches.
boundaryError = true;
// There is processor patch in between normal patches.
hasError = true;
if (debug || report)
{
@ -508,7 +508,7 @@ bool Foam::polyBoundaryMesh::checkParallelSync(const bool report) const
|| (allTypes[procI] != allTypes[0])
)
{
boundaryError = true;
hasError = true;
if (debug || (report && Pstream::master()))
{
@ -523,7 +523,7 @@ bool Foam::polyBoundaryMesh::checkParallelSync(const bool report) const
}
}
return boundaryError;
return hasError;
}
@ -532,13 +532,13 @@ bool Foam::polyBoundaryMesh::checkDefinition(const bool report) const
label nextPatchStart = mesh().nInternalFaces();
const polyBoundaryMesh& bm = *this;
bool boundaryError = false;
bool hasError = false;
forAll (bm, patchI)
{
if (bm[patchI].start() != nextPatchStart && !boundaryError)
if (bm[patchI].start() != nextPatchStart && !hasError)
{
boundaryError = true;
hasError = true;
Info<< " ****Problem with boundary patch " << patchI
<< " named " << bm[patchI].name()
@ -553,26 +553,21 @@ bool Foam::polyBoundaryMesh::checkDefinition(const bool report) const
nextPatchStart += bm[patchI].size();
}
reduce(boundaryError, orOp<bool>());
reduce(hasError, orOp<bool>());
if (boundaryError)
if (debug || report)
{
if (debug || report)
if (hasError)
{
Pout << " ***Boundary definition is in error." << endl;
}
return true;
}
else
{
if (debug || report)
else
{
Info << " Boundary definition OK." << endl;
}
return false;
}
return hasError;
}

View File

@ -37,11 +37,11 @@ License
namespace Foam
{
defineTypeNameAndDebug(cellZone, 0);
defineRunTimeSelectionTable(cellZone, dictionary);
addToRunTimeSelectionTable(cellZone, cellZone, dictionary);
}
const char * const Foam::cellZone::labelsName = "cellLabels";
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -79,7 +79,7 @@ Foam::cellZone::cellZone
const cellZoneMesh& zm
)
:
zone("cell", name, dict, index),
zone(name, dict, this->labelsName, index),
zoneMesh_(zm)
{}
@ -140,7 +140,7 @@ void Foam::cellZone::writeDict(Ostream& os) const
os << nl << name() << nl << token::BEGIN_BLOCK << nl
<< " type " << type() << token::END_STATEMENT << nl;
writeEntry("cellLabels", os);
writeEntry(this->labelsName, os);
os << token::END_BLOCK << endl;
}
@ -148,10 +148,10 @@ void Foam::cellZone::writeDict(Ostream& os) const
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
void Foam::cellZone::operator=(const cellZone& cz)
void Foam::cellZone::operator=(const cellZone& zn)
{
clearAddressing();
labelList::operator=(cz);
labelList::operator=(zn);
}
@ -164,10 +164,10 @@ void Foam::cellZone::operator=(const labelList& addr)
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<(Ostream& os, const cellZone& cz)
Foam::Ostream& Foam::operator<<(Ostream& os, const cellZone& zn)
{
cz.write(os);
os.check("Ostream& operator<<(Ostream& os, const cellZone& cz");
zn.write(os);
os.check("Ostream& operator<<(Ostream&, const cellZone&");
return os;
}

View File

@ -81,6 +81,12 @@ protected:
public:
// Static data members
//- The name associated with the zone-labels dictionary entry
static const char * const labelsName;
//- Runtime type information
TypeName("cellZone");

View File

@ -42,6 +42,8 @@ namespace Foam
addToRunTimeSelectionTable(faceZone, faceZone, dictionary);
}
const char* const Foam::faceZone::labelsName = "faceLabels";
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::faceZone::calcFaceZonePatch() const
@ -226,7 +228,7 @@ Foam::faceZone::faceZone
const faceZoneMesh& zm
)
:
zone("face", name, dict, index),
zone(name, dict, this->labelsName, index),
flipMap_(dict.lookup("flipMap")),
zoneMesh_(zm),
patchPtr_(NULL),
@ -442,7 +444,7 @@ bool Foam::faceZone::checkParallelSync(const bool report) const
const polyMesh& mesh = zoneMesh().mesh();
const polyBoundaryMesh& bm = mesh.boundaryMesh();
bool boundaryError = false;
bool hasError = false;
// Check that zone faces are synced
@ -479,7 +481,7 @@ bool Foam::faceZone::checkParallelSync(const bool report) const
// Check face in zone on both sides
if (myZoneFace[bFaceI] != neiZoneFace[bFaceI])
{
boundaryError = true;
hasError = true;
if (report)
{
@ -491,12 +493,17 @@ bool Foam::faceZone::checkParallelSync(const bool report) const
<< " is not consistent with its coupled neighbour."
<< endl;
}
else
{
// w/o report - can stop checking now
break;
}
}
// Flip state should be opposite.
if (myZoneFlip[bFaceI] == neiZoneFlip[bFaceI])
{
boundaryError = true;
hasError = true;
if (report)
{
@ -509,12 +516,17 @@ bool Foam::faceZone::checkParallelSync(const bool report) const
<< " across coupled faces."
<< endl;
}
else
{
// w/o report - can stop checking now
break;
}
}
}
}
}
return returnReduce(boundaryError, orOp<bool>());
return returnReduce(hasError, orOp<bool>());
}
@ -539,7 +551,7 @@ void Foam::faceZone::writeDict(Ostream& os) const
os << nl << name() << nl << token::BEGIN_BLOCK << nl
<< " type " << type() << token::END_STATEMENT << nl;
writeEntry("faceLabels", os);
writeEntry(this->labelsName, os);
flipMap().writeEntry("flipMap", os);
os << token::END_BLOCK << endl;
@ -548,10 +560,10 @@ void Foam::faceZone::writeDict(Ostream& os) const
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<(Ostream& os, const faceZone& fz)
Foam::Ostream& Foam::operator<<(Ostream& os, const faceZone& zn)
{
fz.write(os);
os.check("Ostream& operator<<(Ostream& os, const faceZone& fz");
zn.write(os);
os.check("Ostream& operator<<(Ostream&, const faceZone&");
return os;
}

View File

@ -60,13 +60,17 @@ Ostream& operator<<(Ostream&, const faceZone&);
/*---------------------------------------------------------------------------*\
Class faceZone Declaration
Class faceZone Declaration
\*---------------------------------------------------------------------------*/
class faceZone
:
public zone
{
// Private data
//- The name associated with the zone-labels dictionary entry
static const word labelsName_;
protected:
@ -118,6 +122,12 @@ protected:
public:
// Static data members
//- The name associated with the zone-labels dictionary entry
static const char * const labelsName;
//- Runtime type information
TypeName("faceZone");
@ -283,7 +293,7 @@ public:
virtual void movePoints(const pointField&);
//- Update for changes in topology
virtual void updateMesh(const mapPolyMesh& mpm);
virtual void updateMesh(const mapPolyMesh&);
//- Write
virtual void write(Ostream&) const;
@ -291,7 +301,6 @@ public:
//- Write dictionary
virtual void writeDict(Ostream&) const;
// I-O
//- Ostream Operator

View File

@ -40,6 +40,7 @@ namespace Foam
addToRunTimeSelectionTable(pointZone, pointZone, dictionary);
}
const char* const Foam::pointZone::labelsName = "pointLabels";
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -77,7 +78,7 @@ Foam::pointZone::pointZone
const pointZoneMesh& zm
)
:
zone("point", name, dict, index),
zone(name, dict, this->labelsName, index),
zoneMesh_(zm)
{}
@ -139,7 +140,7 @@ void Foam::pointZone::writeDict(Ostream& os) const
os << nl << name_ << nl << token::BEGIN_BLOCK << nl
<< " type " << type() << token::END_STATEMENT << nl;
writeEntry("pointLabels", os);
writeEntry(this->labelsName, os);
os << token::END_BLOCK << endl;
}
@ -147,10 +148,10 @@ void Foam::pointZone::writeDict(Ostream& os) const
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
void Foam::pointZone::operator=(const pointZone& pz)
void Foam::pointZone::operator=(const pointZone& zn)
{
clearAddressing();
labelList::operator=(pz);
labelList::operator=(zn);
}
@ -163,10 +164,10 @@ void Foam::pointZone::operator=(const labelList& addr)
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<(Ostream& os, const pointZone& pz)
Foam::Ostream& Foam::operator<<(Ostream& os, const pointZone& zn)
{
pz.write(os);
os.check("Ostream& operator<<(Ostream& os, const pointZone& pz");
zn.write(os);
os.check("Ostream& operator<<(Ostream&, const pointZone&");
return os;
}

View File

@ -58,7 +58,7 @@ Ostream& operator<<(Ostream&, const pointZone&);
/*---------------------------------------------------------------------------*\
Class pointZone Declaration
Class pointZone Declaration
\*---------------------------------------------------------------------------*/
class pointZone
@ -68,20 +68,24 @@ class pointZone
protected:
// Private data
// Protected data
//- Reference to zone list
const pointZoneMesh& zoneMesh_;
// Private Member Functions
//- Disallow default bitwise copy construct
pointZone(const pointZone&);
public:
// Static data members
//- The name associated with the zone-labels dictionary entry
static const char * const labelsName;
//- Runtime type information
TypeName("pointZone");

View File

@ -115,13 +115,13 @@ Foam::zone::zone
Foam::zone::zone
(
const word& zoneType,
const word& name,
const dictionary& dict,
const word& labelsName,
const label index
)
:
labelList(dict.lookup(zoneType + "Labels")),
labelList(dict.lookup(labelsName)),
name_(name),
index_(index),
lookupMapPtr_(NULL)
@ -193,13 +193,13 @@ bool Foam::zone::checkDefinition(const label maxSize, const bool report) const
{
const labelList& addr = *this;
bool boundaryError = false;
bool hasError = false;
forAll(addr, i)
{
if (addr[i] < 0 || addr[i] >= maxSize)
{
boundaryError = true;
hasError = true;
if (report)
{
@ -212,10 +212,15 @@ bool Foam::zone::checkDefinition(const label maxSize, const bool report) const
<< "Valid index labels are 0.."
<< maxSize-1 << endl;
}
else
{
// w/o report - can stop checking now
break;
}
}
}
return boundaryError;
return hasError;
}

View File

@ -117,9 +117,9 @@ public:
//- Construct from dictionary
zone
(
const word& zoneType,
const word& name,
const dictionary&,
const word& labelsName,
const label index
);

View File

@ -27,7 +27,7 @@ License
#include "primitiveMesh.H"
#include "pyramidPointFaceRef.H"
#include "ListOps.H"
#include "mathConstants.H"
#include "mathematicalConstants.H"
#include "SortableList.H"
@ -410,7 +410,7 @@ bool Foam::primitiveMesh::checkFaceOrthogonality
// Severe nonorthogonality threshold
const scalar severeNonorthogonalityThreshold =
::cos(nonOrthThreshold_/180.0*constant::math::pi);
::cos(degToRad(nonOrthThreshold_));
scalar minDDotS = GREAT;
@ -472,9 +472,8 @@ bool Foam::primitiveMesh::checkFaceOrthogonality
if (debug || report)
{
Info<< " Mesh non-orthogonality Max: "
<< ::acos(minDDotS)/constant::math::pi*180.0
<< " average: " <<
::acos(sumDDotS/neiSize)/constant::math::pi*180.0
<< radToDeg(::acos(minDDotS))
<< " average: " << radToDeg(::acos(sumDDotS/neiSize))
<< endl;
}
}
@ -840,7 +839,7 @@ bool Foam::primitiveMesh::checkFaceAngles
<< exit(FatalError);
}
const scalar maxSin = Foam::sin(maxDeg/180.0*constant::math::pi);
const scalar maxSin = Foam::sin(degToRad(maxDeg));
const pointField& p = points();
const faceList& fcs = faces();
@ -916,8 +915,7 @@ bool Foam::primitiveMesh::checkFaceAngles
if (nConcave > 0)
{
scalar maxConcaveDegr =
Foam::asin(Foam::min(1.0, maxEdgeSin))
*180.0/constant::math::pi;
radToDeg(Foam::asin(Foam::min(1.0, maxEdgeSin)));
if (debug || report)
{

View File

@ -31,7 +31,7 @@ Description
#include "primitiveMesh.H"
#include "pyramidPointFaceRef.H"
#include "cell.H"
#include "mathConstants.H"
#include "mathematicalConstants.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -200,7 +200,7 @@ bool Foam::primitiveMesh::checkMeshMotion
) << "Severe non-orthogonality in mesh motion for face "
<< faceI
<< " between cells " << own[faceI] << " and " << nei[faceI]
<< ": Angle = " << ::acos(dDotS)/constant::math::pi*180.0
<< ": Angle = " << radToDeg(::acos(dDotS))
<< " deg." << endl;
nDotProductErrors++;

View File

@ -26,7 +26,7 @@ License
#include "IOstreams.H"
#include "pointHit.H"
#include "mathConstants.H"
#include "mathematicalConstants.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -307,7 +307,7 @@ inline scalar triangle<Point, PointRef>::quality() const
return
mag()
/ (
constant::math::pi
constant::mathematical::pi
*Foam::sqr(circumRadius())
*0.413497
+ VSMALL

View File

@ -36,54 +36,262 @@ SourceFiles
#ifndef stringListOps_H
#define stringListOps_H
#include "regExp.H"
#include "labelList.H"
#include "stringList.H"
#include "wordReList.H"
#include "wordReListMatcher.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
//- Return list indices for strings matching the regular expression
template<class StringType>
labelList findStrings
(
const char* regexpPattern,
const UList<StringType>&
);
//- Return list indices for strings matching the regular expression
template<class StringType>
labelList findStrings
(
const std::string& regexpPattern,
const UList<StringType>&
);
//- Return list indices for strings matching the regular expression
template<class StringType>
labelList findStrings
(
const wordRe&,
const UList<StringType>&
);
//- Return list indices for strings matching one of the regular expression
template<class StringType>
labelList findStrings
(
const UList<wordRe>&,
const UList<StringType>&
);
// single-string matches:
//- Return true if string matches one of the regular expressions
template<class StringType>
bool findStrings
inline bool findStrings
(
const UList<wordRe>&,
const StringType& str
const wordReListMatcher& matcher,
const std::string& str
)
{
return matcher.match(str);
}
// multi-string matches:
//- Return list indices for matching strings
template<class Matcher, class StringType>
labelList findMatchingStrings
(
const Matcher&,
const UList<StringType>&,
const bool invert=false
);
//- Return list indices for strings matching the regular expression
// Template partial specialization of findMatchingStrings
template<class StringType>
labelList findStrings
(
const regExp& re,
const UList<StringType>& lst,
const bool invert=false
)
{
return findMatchingStrings(re, lst, invert);
}
//- Return list indices for strings matching the regular expression
// Template partial specialization of findMatchingStrings
template<class StringType>
labelList findStrings
(
const char* rePattern,
const UList<StringType>& lst,
const bool invert=false
)
{
return findStrings(regExp(rePattern), lst, invert);
}
//- Return list indices for strings matching the regular expression
// Template partial specialization of findMatchingStrings
template<class StringType>
labelList findStrings
(
const std::string& rePattern,
const UList<StringType>& lst,
const bool invert=false
)
{
return findMatchingStrings(regExp(rePattern), lst, invert);
}
//- Return list indices for strings matching the regular expression
// Template partial specialization of findMatchingStrings
template<class StringType>
labelList findStrings
(
const wordRe& wre,
const UList<StringType>& lst,
const bool invert=false
)
{
return findMatchingStrings(wre, lst, invert);
}
//- Return list indices for strings matching one of the regular expression
// Template partial specialization of findMatchingStrings
template<class StringType>
labelList findStrings
(
const wordReListMatcher& matcher,
const UList<StringType>& lst,
const bool invert=false
)
{
return findMatchingStrings(matcher, lst, invert);
}
// subsetting multi-string matches (similar to ListOp):
//- Extract elements of StringList when regular expression matches
// optionally invert the match
// eg, to extract all selected elements:
// subsetMatchingStrings<regExp, stringList>(myRegExp, lst);
template<class Matcher, class StringListType>
StringListType subsetMatchingStrings
(
const Matcher&,
const StringListType&,
const bool invert=false
);
//- Extract elements of StringList when regular expression matches
// Template partial specialization of subsetMatchingStrings
template<class StringListType>
StringListType subsetStrings
(
const regExp& re,
const StringListType& lst,
const bool invert=false
)
{
return subsetMatchingStrings(re, lst, invert);
}
//- Extract elements of StringList when regular expression matches
// Template partial specialization of subsetMatchingStrings
template<class StringListType>
StringListType subsetStrings
(
const char* rePattern,
const StringListType& lst,
const bool invert=false
)
{
return subsetMatchingStrings(regExp(rePattern), lst, invert);
}
//- Extract elements of StringList when regular expression matches
// Template partial specialization of subsetMatchingStrings
template<class StringListType>
StringListType subsetStrings
(
const std::string& rePattern,
const StringListType& lst,
const bool invert=false
)
{
return subsetMatchingStrings(regExp(rePattern), lst, invert);
}
//- Extract elements of StringList when regular expression matches
// Template partial specialization of subsetMatchingStrings
template<class StringListType>
StringListType subsetStrings
(
const wordRe& wre,
const StringListType& lst,
const bool invert=false
)
{
return subsetMatchingStrings(wre, lst, invert);
}
//- Extract elements of StringList when regular expression matches
// Template partial specialization of subsetMatchingStrings
template<class StringListType>
StringListType subsetStrings
(
const wordReListMatcher& matcher,
const StringListType& lst,
const bool invert=false
)
{
return subsetMatchingStrings(matcher, lst, invert);
}
//- Inplace extract elements of StringList when regular expression matches
// optionally invert the match
// eg, to extract all selected elements:
// inplaceSubsetMatchingStrings<regExp, stringList>(myRegExp, lst);
template<class Matcher, class StringListType>
void inplaceSubsetMatchingStrings
(
const Matcher&,
StringListType&,
const bool invert=false
);
//- Inplace extract elements of StringList when regular expression matches
// Template partial specialization of inplaceSubsetMatchingStrings
template<class StringListType>
void inplaceSubsetStrings
(
const regExp& re,
StringListType& lst,
const bool invert=false
)
{
inplaceSubsetMatchingStrings(re, lst, invert);
}
//- Inplace extract elements of StringList when regular expression matches
// Template partial specialization of inplaceSubsetMatchingStrings
template<class StringListType>
void inplaceSubsetStrings
(
const char* rePattern,
StringListType& lst,
const bool invert=false
)
{
inplaceSubsetMatchingStrings(regExp(rePattern), lst, invert);
}
//- Inplace extract elements of StringList when regular expression matches
// Template partial specialization of inplaceSubsetMatchingStrings
template<class StringListType>
void inplaceSubsetStrings
(
const std::string& rePattern,
StringListType& lst,
const bool invert=false
)
{
inplaceSubsetMatchingStrings(regExp(rePattern), lst, invert);
}
//- Inplace extract elements of StringList when regular expression matches
// Template partial specialization of inplaceSubsetMatchingStrings
template<class StringListType>
void inplaceSubsetStrings
(
const wordRe& wre,
StringListType& lst,
const bool invert=false
)
{
inplaceSubsetMatchingStrings(wre, lst, invert);
}
//- Inplace extract elements of StringList when regular expression matches
// Template partial specialization of inplaceSubsetMatchingStrings
template<class StringListType>
void inplaceSubsetStrings
(
const wordReListMatcher& matcher,
StringListType& lst,
const bool invert=false
)
{
inplaceSubsetMatchingStrings(matcher, lst, invert);
}
}

View File

@ -24,126 +24,73 @@ License
\*---------------------------------------------------------------------------*/
#include "labelList.H"
#include "regExp.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class StringType>
Foam::labelList Foam::findStrings
template<class Matcher, class StringType>
Foam::labelList Foam::findMatchingStrings
(
const char* pattern,
const UList<StringType>& lst
const Matcher& matcher,
const UList<StringType>& lst,
const bool invert
)
{
regExp re(pattern);
labelList matched(lst.size());
labelList indices(lst.size());
label matchI = 0;
label nElem = 0;
forAll(lst, elemI)
{
if (re.match(lst[elemI]))
if (matcher.match(lst[elemI]) ? !invert : invert)
{
matched[matchI++] = elemI;
indices[nElem++] = elemI;
}
}
matched.setSize(matchI);
indices.setSize(nElem);
return matched;
return indices;
}
template<class StringType>
Foam::labelList Foam::findStrings
template<class Matcher, class StringListType>
StringListType Foam::subsetMatchingStrings
(
const std::string& pattern,
const UList<StringType>& lst
const Matcher& matcher,
const StringListType& lst,
const bool invert
)
{
regExp re(pattern);
labelList matched(lst.size());
StringListType newLst(lst.size());
label matchI = 0;
label nElem = 0;
forAll(lst, elemI)
{
if (re.match(lst[elemI]))
if (matcher.match(lst[elemI]) ? !invert : invert)
{
matched[matchI++] = elemI;
newLst[nElem++] = lst[elemI];
}
}
matched.setSize(matchI);
newLst.setSize(nElem);
return matched;
return newLst;
}
template<class StringType>
Foam::labelList Foam::findStrings
template<class Matcher, class StringListType>
void Foam::inplaceSubsetMatchingStrings
(
const wordRe& wre,
const UList<StringType>& lst
const Matcher& matcher,
StringListType& lst,
const bool invert
)
{
labelList matched(lst.size());
label matchI = 0;
label nElem = 0;
forAll(lst, elemI)
{
if (wre.match(lst[elemI]))
if (matcher.match(lst[elemI]) ? !invert : invert)
{
matched[matchI++] = elemI;
lst[nElem++] = lst[elemI];
}
}
matched.setSize(matchI);
return matched;
}
template<class StringType>
Foam::labelList Foam::findStrings
(
const UList<wordRe>& wreLst,
const UList<StringType>& lst
)
{
labelList matched(lst.size());
label matchI = 0;
forAll(lst, elemI)
{
forAll(wreLst, reI)
{
if (wreLst[reI].match(lst[elemI]))
{
matched[matchI++] = elemI;
break;
}
}
}
matched.setSize(matchI);
return matched;
}
template<class StringType>
bool Foam::findStrings
(
const UList<wordRe>& wreLst,
const StringType& str
)
{
forAll(wreLst, reI)
{
if (wreLst[reI].match(str))
{
return true;
}
}
return false;
lst.setSize(nElem);
}

View File

@ -0,0 +1,101 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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::wordReListMatcher
Description
A wrapper for matching a List of wordRe.
Note
The constructor should remain non-explicit. This allows automatic
conversion from UList\<wordRe\> to wordReListMatcher in search
functions.
SourceFiles
wordReListMatcherI.H
\*---------------------------------------------------------------------------*/
#ifndef wordReListMatcher_H
#define wordReListMatcher_H
#include "wordReList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class wordReListMatcher Declaration
\*---------------------------------------------------------------------------*/
class wordReListMatcher
{
// Private data
//- Reference to underlying list
const UList<wordRe>& reList_;
public:
// Constructors
//- Construct from a List of wordRe
inline wordReListMatcher(const UList<wordRe>&);
// Member Functions
// Access
inline label size() const;
inline bool empty() const;
//- Return underlying list of wordRe
inline const UList<wordRe>& operator()() const;
// Searching
//- Return true if string matches any of the regular expressions
// Smart match as regular expression or as a string.
// Optionally specify a literal match only.
inline bool match(const string&, bool literalMatch=false) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "wordReListMatcherI.H"
#endif
// ************************************************************************* //

View File

@ -0,0 +1,79 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
inline Foam::wordReListMatcher::wordReListMatcher
(
const UList<wordRe>& lst
)
:
reList_(lst)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline Foam::label Foam::wordReListMatcher::size() const
{
return reList_.size();
}
inline bool Foam::wordReListMatcher::empty() const
{
return reList_.empty();
}
inline const Foam::UList<Foam::wordRe>&
Foam::wordReListMatcher::operator()() const
{
return reList_;
}
inline bool Foam::wordReListMatcher::match
(
const string& str,
bool literalMatch
) const
{
const label nElem = reList_.size();
for (label elemI = 0; elemI < nElem; ++elemI)
{
if (reList_[elemI].match(str, literalMatch))
{
return true;
}
}
return false;
}
// ************************************************************************* //

View File

@ -25,7 +25,7 @@ License
\*---------------------------------------------------------------------------*/
#include "tensor.H"
#include "mathConstants.H"
#include "mathematicalConstants.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -150,8 +150,8 @@ vector eigenValues(const tensor& t)
scalar aBy3 = a/3;
i = m2SqrtQ*cos(theta/3) - aBy3;
ii = m2SqrtQ*cos((theta + constant::math::twoPi)/3) - aBy3;
iii = m2SqrtQ*cos((theta - constant::math::twoPi)/3) - aBy3;
ii = m2SqrtQ*cos((theta + constant::mathematical::twoPi)/3) - aBy3;
iii = m2SqrtQ*cos((theta - constant::mathematical::twoPi)/3) - aBy3;
}
else
{
@ -343,8 +343,8 @@ vector eigenValues(const symmTensor& t)
scalar aBy3 = a/3;
i = m2SqrtQ*cos(theta/3) - aBy3;
ii = m2SqrtQ*cos((theta + constant::math::twoPi)/3) - aBy3;
iii = m2SqrtQ*cos((theta - constant::math::twoPi)/3) - aBy3;
ii = m2SqrtQ*cos((theta + constant::mathematical::twoPi)/3) - aBy3;
iii = m2SqrtQ*cos((theta - constant::mathematical::twoPi)/3) - aBy3;
}
else
{

View File

@ -170,7 +170,7 @@ public:
//- Smart match as regular expression or as a string
// Optionally specify a literal match only
inline bool match(const string&, bool literalMatch=false) const;
inline bool match(const std::string&, bool literalMatch=false) const;
//- Miscellaneous

View File

@ -176,12 +176,12 @@ inline void Foam::wordRe::clear()
}
inline bool Foam::wordRe::match(const string& str, bool literalMatch) const
inline bool Foam::wordRe::match(const std::string& str, bool literalMatch) const
{
if (literalMatch || !re_.exists())
{
// check as string
return (*this == str);
return (str == *this);
}
else
{

View File

@ -34,7 +34,7 @@ Description
#define transform_H
#include "tensor.H"
#include "mathConstants.H"
#include "mathematicalConstants.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -205,11 +205,11 @@ inline scalar pseudoAngle
if (sin < -SMALL)
{
return (3.0 + cos)*constant::math::piByTwo;
return (3.0 + cos)*constant::mathematical::piByTwo;
}
else
{
return (1.0 - cos)*constant::math::piByTwo;
return (1.0 - cos)*constant::mathematical::piByTwo;
}
}

View File

@ -97,7 +97,7 @@ Foam::Map<Foam::word> Foam::boundaryRegion::names() const
Foam::Map<Foam::word> Foam::boundaryRegion::names
(
const List<wordRe>& patterns
const UList<wordRe>& patterns
) const
{
Map<word> lookup;

View File

@ -112,7 +112,7 @@ public:
Map<word> names() const;
//- Return a Map of (id => names) selected by patterns
Map<word> names(const List<wordRe>& patterns) const;
Map<word> names(const UList<wordRe>& patterns) const;
//- Return a Map of (id => type)
Map<word> boundaryTypes() const;

View File

@ -169,7 +169,7 @@ Foam::Map<Foam::word> Foam::cellTable::names() const
Foam::Map<Foam::word> Foam::cellTable::names
(
const List<wordRe>& patterns
const UList<wordRe>& patterns
) const
{
Map<word> lookup;

View File

@ -139,7 +139,7 @@ public:
Map<word> names() const;
//- Return a Map of (id => names) selected by patterns
Map<word> names(const List<wordRe>& patterns) const;
Map<word> names(const UList<wordRe>& patterns) const;
//- Return a Map of (id => name) for materialType (fluid | solid | shell)
Map<word> selectType(const word& materialType) const;

View File

@ -10,6 +10,11 @@ solidBodyMotionFunctions = solidBodyMotionFvMesh/solidBodyMotionFunctions
$(solidBodyMotionFunctions)/solidBodyMotionFunction/solidBodyMotionFunction.C
$(solidBodyMotionFunctions)/solidBodyMotionFunction/newSolidBodyMotionFunction.C
$(solidBodyMotionFunctions)/SDA/SDA.C
$(solidBodyMotionFunctions)/SKA/SKA.C
$(solidBodyMotionFunctions)/tabulated6DoFMotion/tabulated6DoFMotion.C
$(solidBodyMotionFunctions)/linearMotion/linearMotion.C
$(solidBodyMotionFunctions)/rotatingMotion/rotatingMotion.C
$(solidBodyMotionFunctions)/multiMotion/multiMotion.C
$(solidBodyMotionFunctions)/oscillatingLinearMotion/oscillatingLinearMotion.C
$(solidBodyMotionFunctions)/oscillatingRotatingMotion/oscillatingRotatingMotion.C
LIB = $(FOAM_LIBBIN)/libdynamicFvMesh

View File

@ -27,7 +27,7 @@ License
#include "dynamicInkJetFvMesh.H"
#include "addToRunTimeSelectionTable.H"
#include "volFields.H"
#include "mathConstants.H"
#include "mathematicalConstants.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -90,7 +90,7 @@ Foam::dynamicInkJetFvMesh::~dynamicInkJetFvMesh()
bool Foam::dynamicInkJetFvMesh::update()
{
scalar scalingFunction =
0.5*(::cos(constant::math::twoPi*frequency_*time().value()) - 1.0);
0.5*(::cos(constant::mathematical::twoPi*frequency_*time().value()) - 1.0);
Info<< "Mesh scaling. Time = " << time().value() << " scaling: "
<< scalingFunction << endl;

View File

@ -26,9 +26,9 @@ License
#include "SDA.H"
#include "addToRunTimeSelectionTable.H"
#include "mathConstants.H"
#include "mathematicalConstants.H"
using namespace Foam::constant::math;
using namespace Foam::constant::mathematical;
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //

View File

@ -0,0 +1,99 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 "linearMotion.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace solidBodyMotionFunctions
{
defineTypeNameAndDebug(linearMotion, 0);
addToRunTimeSelectionTable
(
solidBodyMotionFunction,
linearMotion,
dictionary
);
};
};
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::solidBodyMotionFunctions::linearMotion::linearMotion
(
const dictionary& SBMFCoeffs,
const Time& runTime
)
:
solidBodyMotionFunction(SBMFCoeffs, runTime)
{
read(SBMFCoeffs);
}
// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * //
Foam::solidBodyMotionFunctions::linearMotion::~linearMotion()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
Foam::septernion
Foam::solidBodyMotionFunctions::linearMotion::transformation() const
{
scalar t = time_.value();
// Translation of centre of gravity with constant velocity
const vector displacement = velocity_*t;
quaternion R(0, 0, 0);
septernion TR(septernion(displacement)*R);
Info<< "solidBodyMotionFunctions::linearMotion::transformation(): "
<< "Time = " << t << " transformation: " << TR << endl;
return TR;
}
bool Foam::solidBodyMotionFunctions::linearMotion::read
(
const dictionary& SBMFCoeffs
)
{
solidBodyMotionFunction::read(SBMFCoeffs);
SBMFCoeffs_.lookup("velocity") >> velocity_;
return true;
}
// ************************************************************************* //

View File

@ -0,0 +1,113 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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::solidBodyMotionFunctions::linearMotion
Description
SolidBodyMotionFvMesh 6DoF motion function. Constant velocity displacement.
SourceFiles
linearMotion.C
\*---------------------------------------------------------------------------*/
#ifndef linearMotion_H
#define linearMotion_H
#include "solidBodyMotionFunction.H"
#include "primitiveFields.H"
#include "point.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace solidBodyMotionFunctions
{
/*---------------------------------------------------------------------------*\
Class linearMotion Declaration
\*---------------------------------------------------------------------------*/
class linearMotion
:
public solidBodyMotionFunction
{
// Private data
//- Linear velocity
vector velocity_;
// Private Member Functions
//- Disallow copy construct
linearMotion(const linearMotion&);
//- Disallow default bitwise assignment
void operator=(const linearMotion&);
public:
//- Runtime type information
TypeName("linearMotion");
// Constructors
//- Construct from components
linearMotion
(
const dictionary& SBMFCoeffs,
const Time& runTime
);
// Destructor
virtual ~linearMotion();
// Member Functions
//- Return the solid-body motion transformation septernion
virtual septernion transformation() const;
//- Update properties from given dictionary
virtual bool read(const dictionary& SBMFCoeffs);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace solidBodyMotionFunctions
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,120 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 "multiMotion.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace solidBodyMotionFunctions
{
defineTypeNameAndDebug(multiMotion, 0);
addToRunTimeSelectionTable
(
solidBodyMotionFunction,
multiMotion,
dictionary
);
};
};
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::solidBodyMotionFunctions::multiMotion::multiMotion
(
const dictionary& SBMFCoeffs,
const Time& runTime
)
:
solidBodyMotionFunction(SBMFCoeffs, runTime)
{
read(SBMFCoeffs);
}
// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * //
Foam::solidBodyMotionFunctions::multiMotion::~multiMotion()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
Foam::septernion
Foam::solidBodyMotionFunctions::multiMotion::transformation() const
{
scalar t = time_.value();
septernion TR = SBMFs_[0].transformation();
for (label i = 1; i < SBMFs_.size(); i++)
{
TR *= SBMFs_[i].transformation();
}
Info<< "solidBodyMotionFunctions::multiMotion::transformation(): "
<< "Time = " << t << " transformation: " << TR << endl;
return TR;
}
bool Foam::solidBodyMotionFunctions::multiMotion::read
(
const dictionary& SBMFCoeffs
)
{
solidBodyMotionFunction::read(SBMFCoeffs);
label i = 0;
SBMFs_.setSize(SBMFCoeffs_.size());
forAllConstIter(IDLList<entry>, SBMFCoeffs_, iter)
{
if (iter().isDict())
{
SBMFs_.set
(
i,
solidBodyMotionFunction::New(iter().dict(), time_)
);
Info<< "Constructed SBMF " << i << " : "
<< iter().keyword() << " of type "
<< SBMFs_[i].type() << endl;
i++;
}
}
SBMFs_.setSize(i);
return true;
}
// ************************************************************************* //

View File

@ -0,0 +1,113 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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::solidBodyMotionFunctions::multiMotion
Description
Combination of SolidBodyMotionFvMesh 6DoF motion functions.
SourceFiles
multiMotion.C
\*---------------------------------------------------------------------------*/
#ifndef multiMotion_H
#define multiMotion_H
#include "solidBodyMotionFunction.H"
#include "primitiveFields.H"
#include "point.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace solidBodyMotionFunctions
{
/*---------------------------------------------------------------------------*\
Class multiMotion Declaration
\*---------------------------------------------------------------------------*/
class multiMotion
:
public solidBodyMotionFunction
{
// Private data
//- Motions to combine
PtrList<solidBodyMotionFunction> SBMFs_;
// Private Member Functions
//- Disallow copy construct
multiMotion(const multiMotion&);
//- Disallow default bitwise assignment
void operator=(const multiMotion&);
public:
//- Runtime type information
TypeName("multiMotion");
// Constructors
//- Construct from components
multiMotion
(
const dictionary& SBMFCoeffs,
const Time& runTime
);
// Destructor
virtual ~multiMotion();
// Member Functions
//- Return the solid-body motion transformation septernion
virtual septernion transformation() const;
//- Update properties from given dictionary
virtual bool read(const dictionary& SBMFCoeffs);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace solidBodyMotionFunctions
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,99 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 "oscillatingLinearMotion.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace solidBodyMotionFunctions
{
defineTypeNameAndDebug(oscillatingLinearMotion, 0);
addToRunTimeSelectionTable
(
solidBodyMotionFunction,
oscillatingLinearMotion,
dictionary
);
};
};
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::solidBodyMotionFunctions::oscillatingLinearMotion::oscillatingLinearMotion
(
const dictionary& SBMFCoeffs,
const Time& runTime
)
:
solidBodyMotionFunction(SBMFCoeffs, runTime)
{
read(SBMFCoeffs);
}
// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * //
Foam::solidBodyMotionFunctions::oscillatingLinearMotion::~oscillatingLinearMotion()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
Foam::septernion
Foam::solidBodyMotionFunctions::oscillatingLinearMotion::transformation() const
{
scalar t = time_.value();
const vector displacement = amplitude_*sin(omega_*t);
quaternion R(0, 0, 0);
septernion TR(septernion(displacement)*R);
Info<< "solidBodyMotionFunctions::oscillatingLinearMotion::transformation(): "
<< "Time = " << t << " transformation: " << TR << endl;
return TR;
}
bool Foam::solidBodyMotionFunctions::oscillatingLinearMotion::read
(
const dictionary& SBMFCoeffs
)
{
solidBodyMotionFunction::read(SBMFCoeffs);
SBMFCoeffs_.lookup("amplitude") >> amplitude_;
SBMFCoeffs_.lookup("omega") >> omega_;
return true;
}
// ************************************************************************* //

View File

@ -0,0 +1,116 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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::solidBodyMotionFunctions::oscillatingLinearMotion
Description
SolidBodyMotionFvMesh 6DoF motion function. Oscillating displacement.
SourceFiles
oscillatingLinearMotion.C
\*---------------------------------------------------------------------------*/
#ifndef oscillatingLinearMotion_H
#define oscillatingLinearMotion_H
#include "solidBodyMotionFunction.H"
#include "primitiveFields.H"
#include "point.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace solidBodyMotionFunctions
{
/*---------------------------------------------------------------------------*\
Class oscillatingLinearMotion Declaration
\*---------------------------------------------------------------------------*/
class oscillatingLinearMotion
:
public solidBodyMotionFunction
{
// Private data
//- Amplitude
vector amplitude_;
//- Radial velocity
scalar omega_;
// Private Member Functions
//- Disallow copy construct
oscillatingLinearMotion(const oscillatingLinearMotion&);
//- Disallow default bitwise assignment
void operator=(const oscillatingLinearMotion&);
public:
//- Runtime type information
TypeName("oscillatingLinearMotion");
// Constructors
//- Construct from components
oscillatingLinearMotion
(
const dictionary& SBMFCoeffs,
const Time& runTime
);
// Destructor
virtual ~oscillatingLinearMotion();
// Member Functions
//- Return the solid-body motion transformation septernion
virtual septernion transformation() const;
//- Update properties from given dictionary
virtual bool read(const dictionary& SBMFCoeffs);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace solidBodyMotionFunctions
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,106 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 "oscillatingRotatingMotion.H"
#include "addToRunTimeSelectionTable.H"
#include "mathematicalConstants.H"
using namespace Foam::constant::mathematical;
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace solidBodyMotionFunctions
{
defineTypeNameAndDebug(oscillatingRotatingMotion, 0);
addToRunTimeSelectionTable
(
solidBodyMotionFunction,
oscillatingRotatingMotion,
dictionary
);
};
};
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::solidBodyMotionFunctions::oscillatingRotatingMotion::oscillatingRotatingMotion
(
const dictionary& SBMFCoeffs,
const Time& runTime
)
:
solidBodyMotionFunction(SBMFCoeffs, runTime)
{
read(SBMFCoeffs);
}
// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * //
Foam::solidBodyMotionFunctions::oscillatingRotatingMotion::~oscillatingRotatingMotion()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
Foam::septernion
Foam::solidBodyMotionFunctions::oscillatingRotatingMotion::transformation() const
{
scalar t = time_.value();
vector eulerAngles = amplitude_*sin(omega_*t);
// Convert the rotational motion from deg to rad
eulerAngles *= pi/180.0;
quaternion R(eulerAngles.x(), eulerAngles.y(), eulerAngles.z());
septernion TR(septernion(CofG_)*R*septernion(-CofG_));
Info<< "solidBodyMotionFunctions::oscillatingRotatingMotion::transformation(): "
<< "Time = " << t << " transformation: " << TR << endl;
return TR;
}
bool Foam::solidBodyMotionFunctions::oscillatingRotatingMotion::read
(
const dictionary& SBMFCoeffs
)
{
solidBodyMotionFunction::read(SBMFCoeffs);
SBMFCoeffs_.lookup("CofG") >> CofG_;
SBMFCoeffs_.lookup("amplitude") >> amplitude_;
SBMFCoeffs_.lookup("omega") >> omega_;
return true;
}
// ************************************************************************* //

View File

@ -0,0 +1,119 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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::solidBodyMotionFunctions::oscillatingRotatingMotion
Description
SolidBodyMotionFvMesh 6DoF motion function. Oscillating rotation.
SourceFiles
oscillatingRotatingMotion.C
\*---------------------------------------------------------------------------*/
#ifndef oscillatingRotatingMotion_H
#define oscillatingRotatingMotion_H
#include "solidBodyMotionFunction.H"
#include "primitiveFields.H"
#include "point.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace solidBodyMotionFunctions
{
/*---------------------------------------------------------------------------*\
Class oscillatingRotatingMotion Declaration
\*---------------------------------------------------------------------------*/
class oscillatingRotatingMotion
:
public solidBodyMotionFunction
{
// Private data
//- Centre of gravity
point CofG_;
//- Amplitude
vector amplitude_;
//- Radial velocity
scalar omega_;
// Private Member Functions
//- Disallow copy construct
oscillatingRotatingMotion(const oscillatingRotatingMotion&);
//- Disallow default bitwise assignment
void operator=(const oscillatingRotatingMotion&);
public:
//- Runtime type information
TypeName("oscillatingRotatingMotion");
// Constructors
//- Construct from components
oscillatingRotatingMotion
(
const dictionary& SBMFCoeffs,
const Time& runTime
);
// Destructor
virtual ~oscillatingRotatingMotion();
// Member Functions
//- Return the solid-body motion transformation septernion
virtual septernion transformation() const;
//- Update properties from given dictionary
virtual bool read(const dictionary& SBMFCoeffs);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace solidBodyMotionFunctions
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,108 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 "rotatingMotion.H"
#include "addToRunTimeSelectionTable.H"
#include "mathematicalConstants.H"
using namespace Foam::constant::mathematical;
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace solidBodyMotionFunctions
{
defineTypeNameAndDebug(rotatingMotion, 0);
addToRunTimeSelectionTable
(
solidBodyMotionFunction,
rotatingMotion,
dictionary
);
};
};
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::solidBodyMotionFunctions::rotatingMotion::rotatingMotion
(
const dictionary& SBMFCoeffs,
const Time& runTime
)
:
solidBodyMotionFunction(SBMFCoeffs, runTime)
{
read(SBMFCoeffs);
}
// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * //
Foam::solidBodyMotionFunctions::rotatingMotion::~rotatingMotion()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
Foam::septernion
Foam::solidBodyMotionFunctions::rotatingMotion::transformation() const
{
scalar t = time_.value();
// Motion around a centre of gravity
// Rotation around centre of gravity (in degrees)
vector eulerAngles = radialVelocity_*t;
// Convert the rotational motion from deg to rad
eulerAngles *= pi/180.0;
quaternion R(eulerAngles.x(), eulerAngles.y(), eulerAngles.z());
septernion TR(septernion(CofG_)*R*septernion(-CofG_));
Info<< "solidBodyMotionFunctions::rotatingMotion::transformation(): "
<< "Time = " << t << " transformation: " << TR << endl;
return TR;
}
bool Foam::solidBodyMotionFunctions::rotatingMotion::read
(
const dictionary& SBMFCoeffs
)
{
solidBodyMotionFunction::read(SBMFCoeffs);
SBMFCoeffs_.lookup("CofG") >> CofG_;
SBMFCoeffs_.lookup("radialVelocity") >> radialVelocity_;
return true;
}
// ************************************************************************* //

View File

@ -0,0 +1,117 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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::solidBodyMotionFunctions::rotatingMotion
Description
SolidBodyMotionFvMesh 6DoF motion function. Constant
velocity rotation around CoG.
SourceFiles
rotatingMotion.C
\*---------------------------------------------------------------------------*/
#ifndef rotatingMotion_H
#define rotatingMotion_H
#include "solidBodyMotionFunction.H"
#include "primitiveFields.H"
#include "point.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace solidBodyMotionFunctions
{
/*---------------------------------------------------------------------------*\
Class rotatingMotion Declaration
\*---------------------------------------------------------------------------*/
class rotatingMotion
:
public solidBodyMotionFunction
{
// Private data
//- Centre of gravity
point CofG_;
//- Rotational velocity (deg/s)
vector radialVelocity_;
// Private Member Functions
//- Disallow copy construct
rotatingMotion(const rotatingMotion&);
//- Disallow default bitwise assignment
void operator=(const rotatingMotion&);
public:
//- Runtime type information
TypeName("rotatingMotion");
// Constructors
//- Construct from components
rotatingMotion
(
const dictionary& SBMFCoeffs,
const Time& runTime
);
// Destructor
virtual ~rotatingMotion();
// Member Functions
//- Return the solid-body motion transformation septernion
virtual septernion transformation() const;
//- Update properties from given dictionary
virtual bool read(const dictionary& SBMFCoeffs);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace solidBodyMotionFunctions
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -24,14 +24,14 @@ License
\*---------------------------------------------------------------------------*/
#include "SKA.H"
#include "tabulated6DoFMotion.H"
#include "addToRunTimeSelectionTable.H"
#include "Tuple2.H"
#include "IFstream.H"
#include "interpolateXY.H"
#include "mathConstants.H"
#include "mathematicalConstants.H"
using namespace Foam::constant::math;
using namespace Foam::constant::mathematical;
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -39,15 +39,20 @@ namespace Foam
{
namespace solidBodyMotionFunctions
{
defineTypeNameAndDebug(SKA, 0);
addToRunTimeSelectionTable(solidBodyMotionFunction, SKA, dictionary);
defineTypeNameAndDebug(tabulated6DoFMotion, 0);
addToRunTimeSelectionTable
(
solidBodyMotionFunction,
tabulated6DoFMotion,
dictionary
);
};
};
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::solidBodyMotionFunctions::SKA::SKA
Foam::solidBodyMotionFunctions::tabulated6DoFMotion::tabulated6DoFMotion
(
const dictionary& SBMFCoeffs,
const Time& runTime
@ -61,13 +66,14 @@ Foam::solidBodyMotionFunctions::SKA::SKA
// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * //
Foam::solidBodyMotionFunctions::SKA::~SKA()
Foam::solidBodyMotionFunctions::tabulated6DoFMotion::~tabulated6DoFMotion()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
Foam::septernion Foam::solidBodyMotionFunctions::SKA::transformation() const
Foam::septernion
Foam::solidBodyMotionFunctions::tabulated6DoFMotion::transformation() const
{
scalar t = time_.value();
@ -75,7 +81,7 @@ Foam::septernion Foam::solidBodyMotionFunctions::SKA::transformation() const
{
FatalErrorIn
(
"solidBodyMotionFunctions::SKA::transformation()"
"solidBodyMotionFunctions::tabulated6DoFMotion::transformation()"
) << "current time (" << t
<< ") is less than the minimum in the data table ("
<< times_[0] << ')'
@ -86,7 +92,7 @@ Foam::septernion Foam::solidBodyMotionFunctions::SKA::transformation() const
{
FatalErrorIn
(
"solidBodyMotionFunctions::SKA::transformation()"
"solidBodyMotionFunctions::tabulated6DoFMotion::transformation()"
) << "current time (" << t
<< ") is greater than the maximum in the data table ("
<< times_[times_.size()-1] << ')'
@ -106,14 +112,17 @@ Foam::septernion Foam::solidBodyMotionFunctions::SKA::transformation() const
quaternion R(TRV[1].x(), TRV[1].y(), TRV[1].z());
septernion TR(septernion(CofG_ + TRV[0])*R*septernion(-CofG_));
Info<< "solidBodyMotionFunctions::SKA::transformation(): "
Info<< "solidBodyMotionFunctions::tabulated6DoFMotion::transformation(): "
<< "Time = " << t << " transformation: " << TR << endl;
return TR;
}
bool Foam::solidBodyMotionFunctions::SKA::read(const dictionary& SBMFCoeffs)
bool Foam::solidBodyMotionFunctions::tabulated6DoFMotion::read
(
const dictionary& SBMFCoeffs
)
{
solidBodyMotionFunction::read(SBMFCoeffs);
@ -147,7 +156,8 @@ bool Foam::solidBodyMotionFunctions::SKA::read(const dictionary& SBMFCoeffs)
{
FatalErrorIn
(
"solidBodyMotionFunctions::SKA::read(const dictionary&)"
"solidBodyMotionFunctions::tabulated6DoFMotion::read"
"(const dictionary&)"
) << "Cannot open time data file " << timeDataFileName_
<< exit(FatalError);
}

View File

@ -23,25 +23,22 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::solidBodyMotionFunctions::SKA
Foam::solidBodyMotionFunctions::tabulated6DoFMotion
Description
Sea Keeping Analysis (SKA) 6DoF motion function.
Tabulated 6DoF motion function.
Obtained by interpolating tabulated data for surge (x-translation),
sway (y-translation), heave (z-translation), roll (rotation about x),
pitch (rotation about y) and yaw (rotation about z).
See Also
SDA (Ship design analysis) for 3DoF motion.
SourceFiles
SKA.C
tabulated6DoFMotion.C
\*---------------------------------------------------------------------------*/
#ifndef SKA_H
#define SKA_H
#ifndef tabulated6DoFMotion_H
#define tabulated6DoFMotion_H
#include "solidBodyMotionFunction.H"
#include "primitiveFields.H"
@ -55,10 +52,10 @@ namespace solidBodyMotionFunctions
{
/*---------------------------------------------------------------------------*\
Class SKA Declaration
Class tabulated6DoFMotion Declaration
\*---------------------------------------------------------------------------*/
class SKA
class tabulated6DoFMotion
:
public solidBodyMotionFunction
{
@ -83,22 +80,22 @@ class SKA
// Private Member Functions
//- Disallow copy construct
SKA(const SKA&);
tabulated6DoFMotion(const tabulated6DoFMotion&);
//- Disallow default bitwise assignment
void operator=(const SKA&);
void operator=(const tabulated6DoFMotion&);
public:
//- Runtime type information
TypeName("SKA");
TypeName("tabulated6DoFMotion");
// Constructors
//- Construct from components
SKA
tabulated6DoFMotion
(
const dictionary& SBMFCoeffs,
const Time& runTime
@ -107,7 +104,7 @@ public:
// Destructor
virtual ~SKA();
virtual ~tabulated6DoFMotion();
// Member Functions

View File

@ -83,14 +83,27 @@ Foam::solidBodyMotionFvMesh::~solidBodyMotionFvMesh()
bool Foam::solidBodyMotionFvMesh::update()
{
static bool hasWarned = false;
fvMesh::movePoints
(
transform(SBMFPtr_().transformation(),
undisplacedPoints_)
);
const_cast<volVectorField&>(lookupObject<volVectorField>("U"))
.correctBoundaryConditions();
if (foundObject<volVectorField>("U"))
{
const_cast<volVectorField&>(lookupObject<volVectorField>("U"))
.correctBoundaryConditions();
}
else if (!hasWarned)
{
hasWarned = true;
WarningIn("solidBodyMotionFvMesh::update()")
<< "Did not find volVectorField U."
<< " Not updating U boundary conditions." << endl;
}
return true;
}

View File

@ -27,7 +27,7 @@ License
#include "topoCellLooper.H"
#include "cellFeatures.H"
#include "polyMesh.H"
#include "mathConstants.H"
#include "mathematicalConstants.H"
#include "DynamicList.H"
#include "ListOps.H"
#include "meshTools.H"
@ -44,8 +44,7 @@ namespace Foam
}
// Angle for polys to be considered splitHexes.
const Foam::scalar Foam::topoCellLooper::featureCos =
Foam::cos(10.0*constant::math::pi/180.0);
const Foam::scalar Foam::topoCellLooper::featureCos = Foam::cos(degToRad(10.0));
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //

View File

@ -32,7 +32,7 @@ License
#include "cellCuts.H"
#include "splitCell.H"
#include "mapPolyMesh.H"
#include "mathConstants.H"
#include "mathematicalConstants.H"
#include "meshTools.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -192,7 +192,7 @@ Foam::undoableMeshCutter::undoableMeshCutter
faceRemover_
(
mesh,
Foam::cos(30.0/180.0*constant::math::pi)
Foam::cos(degToRad(30.0))
)
{}

View File

@ -27,7 +27,7 @@ License
#include "polyMeshGeometry.H"
#include "pyramidPointFaceRef.H"
#include "syncTools.H"
#include "mathConstants.H"
#include "mathematicalConstants.H"
namespace Foam
{
@ -248,7 +248,7 @@ Foam::scalar Foam::polyMeshGeometry::checkNonOrtho
<< " between cells " << mesh.faceOwner()[faceI]
<< " and " << nei
<< ": Angle = "
<< ::acos(dDotS)/constant::math::pi*180.0
<< radToDeg(::acos(dDotS))
<< " deg." << endl;
}
@ -269,7 +269,7 @@ Foam::scalar Foam::polyMeshGeometry::checkNonOrtho
<< " between cells " << mesh.faceOwner()[faceI]
<< " and " << nei
<< ": Angle = "
<< ::acos(dDotS)/constant::math::pi*180.0
<< radToDeg(::acos(dDotS))
<< " deg." << endl;
}
@ -368,8 +368,7 @@ bool Foam::polyMeshGeometry::checkFaceDotProduct
const polyBoundaryMesh& patches = mesh.boundaryMesh();
// Severe nonorthogonality threshold
const scalar severeNonorthogonalityThreshold =
::cos(orthWarn/180.0*constant::math::pi);
const scalar severeNonorthogonalityThreshold = ::cos(degToRad(orthWarn));
// Calculate coupled cell centre
@ -504,9 +503,8 @@ bool Foam::polyMeshGeometry::checkFaceDotProduct
if (nDDotS > 0)
{
Info<< "Mesh non-orthogonality Max: "
<< ::acos(minDDotS)/constant::math::pi*180.0
<< " average: " <<
::acos(sumDDotS/nDDotS)/constant::math::pi*180.0
<< radToDeg(::acos(minDDotS))
<< " average: " << radToDeg(::acos(sumDDotS/nDDotS))
<< endl;
}
}
@ -1258,7 +1256,7 @@ bool Foam::polyMeshGeometry::checkFaceAngles
<< abort(FatalError);
}
const scalar maxSin = Foam::sin(maxDeg/180.0*constant::math::pi);
const scalar maxSin = Foam::sin(degToRad(maxDeg));
const faceList& fcs = mesh.faces();
@ -1338,8 +1336,7 @@ bool Foam::polyMeshGeometry::checkFaceAngles
if (maxEdgeSin > SMALL)
{
scalar maxConcaveDegr =
Foam::asin(Foam::min(1.0, maxEdgeSin))
*180.0/constant::math::pi;
radToDeg(Foam::asin(Foam::min(1.0, maxEdgeSin)));
Info<< "There are " << nConcave
<< " faces with concave angles between consecutive"

View File

@ -25,7 +25,7 @@ License
\*---------------------------------------------------------------------------*/
#include "engineTime.H"
#include "mathConstants.H"
#include "mathematicalConstants.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -123,12 +123,6 @@ bool Foam::engineTime::read()
}
Foam::scalar Foam::engineTime::degToRad(const scalar deg) const
{
return constant::math::pi*deg/180.0;
}
Foam::scalar Foam::engineTime::degToTime(const scalar theta) const
{
// 6 * rpm => deg/s

View File

@ -121,9 +121,6 @@ public:
// Conversion
//- Convert degrees to radians
scalar degToRad(const scalar rad) const;
//- Convert degrees to seconds (for given engine speed in RPM)
scalar degToTime(const scalar theta) const;

View File

@ -27,11 +27,11 @@
)
);
Ak = sphereFraction*4.0*constant::math::pi
Ak = sphereFraction*4.0*constant::mathematical::pi
*pow
(
3.0*Vk
/(sphereFraction*4.0*constant::math::pi),
/(sphereFraction*4.0*constant::mathematical::pi),
2.0/3.0
);
}
@ -56,11 +56,11 @@
)
);
Ak = circleFraction*constant::math::pi*thickness
Ak = circleFraction*constant::mathematical::pi*thickness
*sqrt
(
4.0*Vk
/(circleFraction*thickness*constant::math::pi)
/(circleFraction*thickness*constant::mathematical::pi)
);
}
break;

View File

@ -26,7 +26,7 @@ License
#include "rpm.H"
#include "addToRunTimeSelectionTable.H"
#include "mathConstants.H"
#include "mathematicalConstants.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -56,7 +56,7 @@ Foam::SRF::rpm::rpm
rpm_(readScalar(SRFModelCoeffs_.lookup("rpm")))
{
// Initialise the angular velocity
omega_.value() = axis_*rpm_*constant::math::twoPi/60.0;
omega_.value() = axis_*rpm_*constant::mathematical::twoPi/60.0;
}
@ -76,7 +76,7 @@ bool Foam::SRF::rpm::read()
SRFModelCoeffs_.lookup("rpm") >> rpm_;
// Update angular velocity
omega_.value() = axis_*rpm_*(constant::math::twoPi/60.0);
omega_.value() = axis_*rpm_*(constant::mathematical::twoPi/60.0);
return true;
}

View File

@ -95,11 +95,11 @@ basicSymmetryFvPatchField<Type>::basicSymmetryFvPatchField
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
// return gradient at boundary
template<class Type>
tmp<Field<Type> > basicSymmetryFvPatchField<Type>::snGrad() const
{
vectorField nHat = this->patch().nf();
return
(
transform(I - 2.0*sqr(nHat), this->patchInternalField())
@ -108,7 +108,6 @@ tmp<Field<Type> > basicSymmetryFvPatchField<Type>::snGrad() const
}
// Evaluate the field on the patch
template<class Type>
void basicSymmetryFvPatchField<Type>::evaluate(const Pstream::commsTypes)
{
@ -118,6 +117,7 @@ void basicSymmetryFvPatchField<Type>::evaluate(const Pstream::commsTypes)
}
vectorField nHat = this->patch().nf();
Field<Type>::operator=
(
(
@ -130,11 +130,11 @@ void basicSymmetryFvPatchField<Type>::evaluate(const Pstream::commsTypes)
}
// Return defining fields
template<class Type>
tmp<Field<Type> > basicSymmetryFvPatchField<Type>::snGradTransformDiag() const
{
vectorField nHat = this->patch().nf();
vectorField diag(nHat.size());
diag.replace(vector::X, mag(nHat.component(vector::X)));

View File

@ -25,7 +25,7 @@ License
\*---------------------------------------------------------------------------*/
#include "oscillatingFixedValueFvPatchField.H"
#include "mathConstants.H"
#include "mathematicalConstants.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -40,7 +40,7 @@ scalar oscillatingFixedValueFvPatchField<Type>::currentScale() const
return
1.0
+ amplitude_
*sin(constant::math::twoPi*frequency_*this->db().time().value());
*sin(constant::mathematical::twoPi*frequency_*this->db().time().value());
}

View File

@ -32,7 +32,7 @@ Description
#include "surfaceFields.H"
#include "demandDrivenData.H"
#include "coupledFvPatch.H"
#include "mathConstants.H"
#include "mathematicalConstants.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -345,7 +345,8 @@ void surfaceInterpolation::makeCorrectionVectors() const
// Calculate the non-orthogonality for meshes with 1 face or more
if (returnReduce(magSf.size(), sumOp<label>()) > 0)
{
NonOrthogCoeff =
NonOrthogCoeff = radToDeg
(
asin
(
min
@ -353,7 +354,8 @@ void surfaceInterpolation::makeCorrectionVectors() const
(sum(magSf*mag(corrVecs))/sum(magSf)).value(),
1.0
)
)*180.0/constant::math::pi;
)
);
}
if (debug)

View File

@ -31,5 +31,10 @@ pointPatchFields/derived/oscillatingDisplacement/oscillatingDisplacementPointPat
pointPatchFields/derived/angularOscillatingDisplacement/angularOscillatingDisplacementPointPatchVectorField.C
pointPatchFields/derived/surfaceSlipDisplacement/surfaceSlipDisplacementPointPatchVectorField.C
pointPatchFields/derived/surfaceDisplacement/surfaceDisplacementPointPatchVectorField.C
pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyDisplacementPointPatchVectorField.C
pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion.C
pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionIO.C
pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionState.C
pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionStateIO.C
LIB = $(FOAM_LIBBIN)/libfvMotionSolvers

View File

@ -2,10 +2,12 @@ EXE_INC = \
-I$(LIB_SRC)/triSurface/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/postProcessing/functionObjects/forces/lnInclude \
LIB_LIBS = \
-ltriSurface \
-lmeshTools \
-ldynamicMesh \
-lfiniteVolume
-lfiniteVolume \
-lforces

View File

@ -0,0 +1,192 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 "sixDoFRigidBodyDisplacementPointPatchVectorField.H"
#include "pointPatchFields.H"
#include "addToRunTimeSelectionTable.H"
#include "Time.H"
#include "fvMesh.H"
#include "volFields.H"
#include "uniformDimensionedFields.H"
#include "forces.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
sixDoFRigidBodyDisplacementPointPatchVectorField::
sixDoFRigidBodyDisplacementPointPatchVectorField
(
const pointPatch& p,
const DimensionedField<vector, pointMesh>& iF
)
:
fixedValuePointPatchField<vector>(p, iF),
motion_(),
p0_(p.localPoints()),
rhoInf_(1.0)
{}
sixDoFRigidBodyDisplacementPointPatchVectorField::
sixDoFRigidBodyDisplacementPointPatchVectorField
(
const pointPatch& p,
const DimensionedField<vector, pointMesh>& iF,
const dictionary& dict
)
:
fixedValuePointPatchField<vector>(p, iF, dict),
motion_(dict),
rhoInf_(readScalar(dict.lookup("rhoInf")))
{
if (!dict.found("value"))
{
updateCoeffs();
}
if (dict.found("p0"))
{
p0_ = vectorField("p0", dict , p.size());
}
else
{
p0_ = p.localPoints();
}
}
sixDoFRigidBodyDisplacementPointPatchVectorField::
sixDoFRigidBodyDisplacementPointPatchVectorField
(
const sixDoFRigidBodyDisplacementPointPatchVectorField& ptf,
const pointPatch& p,
const DimensionedField<vector, pointMesh>& iF,
const pointPatchFieldMapper& mapper
)
:
fixedValuePointPatchField<vector>(ptf, p, iF, mapper),
motion_(ptf.motion_),
p0_(ptf.p0_),
rhoInf_(ptf.rhoInf_)
{}
sixDoFRigidBodyDisplacementPointPatchVectorField::
sixDoFRigidBodyDisplacementPointPatchVectorField
(
const sixDoFRigidBodyDisplacementPointPatchVectorField& ptf,
const DimensionedField<vector, pointMesh>& iF
)
:
fixedValuePointPatchField<vector>(ptf, iF),
motion_(ptf.motion_),
p0_(ptf.p0_),
rhoInf_(ptf.rhoInf_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void sixDoFRigidBodyDisplacementPointPatchVectorField::updateCoeffs()
{
if (this->updated())
{
return;
}
const polyMesh& mesh = this->dimensionedInternalField().mesh()();
const Time& t = mesh.time();
const pointPatch& ptPatch = this->patch();
// Patch force data is valid for the current positions, so
// calculate the forces on the motion object from this data, then
// update the positions
motion_.updatePosition(t.deltaT().value());
dictionary forcesDict;
forcesDict.add("patches", wordList(1, ptPatch.name()));
forcesDict.add("rhoInf", rhoInf_);
forcesDict.add("CofR", motion_.centreOfMass());
forces f("forces", db(), forcesDict);
forces::forcesMoments fm = f.calcForcesMoment();
// Get the forces on the patch faces at the current positions
vector gravity = vector::zero;
if (db().foundObject<uniformDimensionedVectorField>("g"))
{
uniformDimensionedVectorField g =
db().lookupObject<uniformDimensionedVectorField>("g");
gravity = g.value();
}
motion_.updateForce
(
fm.first().first() + fm.first().second() + gravity*motion_.mass(),
fm.second().first() + fm.second().second(),
t.deltaT().value()
);
Field<vector>::operator=(motion_.generatePositions(p0_) - p0_);
fixedValuePointPatchField<vector>::updateCoeffs();
}
void sixDoFRigidBodyDisplacementPointPatchVectorField::write(Ostream& os) const
{
pointPatchField<vector>::write(os);
motion_.write(os);
os.writeKeyword("rhoInf")
<< rhoInf_ << token::END_STATEMENT << nl;
p0_.writeEntry("p0", os);
writeEntry("value", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePointPatchTypeField
(
pointPatchVectorField,
sixDoFRigidBodyDisplacementPointPatchVectorField
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -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
Class
Foam::sixDoFRigidBodyDisplacementPointPatchVectorField
Description
Foam::sixDoFRigidBodyDisplacementPointPatchVectorField
SourceFiles
sixDoFRigidBodyDisplacementPointPatchVectorField.C
\*---------------------------------------------------------------------------*/
#ifndef sixDoFRigidBodyDisplacementPointPatchVectorField_H
#define sixDoFRigidBodyDisplacementPointPatchVectorField_H
#include "fixedValuePointPatchField.H"
#include "sixDoFRigidBodyMotion.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class sixDoFRigidBodyDisplacementPointPatchVectorField Declaration
\*---------------------------------------------------------------------------*/
class sixDoFRigidBodyDisplacementPointPatchVectorField
:
public fixedValuePointPatchField<vector>
{
// Private data
//- Six dof motion object
sixDoFRigidBodyMotion motion_;
//- Reference positions of points on the patch
pointField p0_;
//- Reference density required by the forces object for
// incompressible calculations
scalar rhoInf_;
public:
//- Runtime type information
TypeName("sixDoFRigidBodyDisplacement");
// Constructors
//- Construct from patch and internal field
sixDoFRigidBodyDisplacementPointPatchVectorField
(
const pointPatch&,
const DimensionedField<vector, pointMesh>&
);
//- Construct from patch, internal field and dictionary
sixDoFRigidBodyDisplacementPointPatchVectorField
(
const pointPatch&,
const DimensionedField<vector, pointMesh>&,
const dictionary&
);
//- Construct by mapping given patchField<vector> onto a new patch
sixDoFRigidBodyDisplacementPointPatchVectorField
(
const sixDoFRigidBodyDisplacementPointPatchVectorField&,
const pointPatch&,
const DimensionedField<vector, pointMesh>&,
const pointPatchFieldMapper&
);
//- Construct and return a clone
virtual autoPtr<pointPatchField<vector> > clone() const
{
return autoPtr<pointPatchField<vector> >
(
new sixDoFRigidBodyDisplacementPointPatchVectorField
(
*this
)
);
}
//- Construct as copy setting internal field reference
sixDoFRigidBodyDisplacementPointPatchVectorField
(
const sixDoFRigidBodyDisplacementPointPatchVectorField&,
const DimensionedField<vector, pointMesh>&
);
//- Construct and return a clone setting internal field reference
virtual autoPtr<pointPatchField<vector> > clone
(
const DimensionedField<vector, pointMesh>& iF
) const
{
return autoPtr<pointPatchField<vector> >
(
new sixDoFRigidBodyDisplacementPointPatchVectorField
(
*this,
iF
)
);
}
// Member functions
// Evaluation functions
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,210 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-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 "sixDoFRigidBodyMotion.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::sixDoFRigidBodyMotion::sixDoFRigidBodyMotion()
:
motionState_(),
refCentreOfMass_(vector::zero),
momentOfInertia_(diagTensor::one*VSMALL),
mass_(VSMALL)
{}
Foam::sixDoFRigidBodyMotion::sixDoFRigidBodyMotion
(
const point& centreOfMass,
const tensor& Q,
const vector& v,
const vector& a,
const vector& pi,
const vector& tau,
scalar mass,
const point& refCentreOfMass,
const diagTensor& momentOfInertia
)
:
motionState_
(
centreOfMass,
Q,
v,
a,
pi,
tau
),
refCentreOfMass_(refCentreOfMass),
momentOfInertia_(momentOfInertia),
mass_(mass)
{}
Foam::sixDoFRigidBodyMotion::sixDoFRigidBodyMotion(const dictionary& dict)
:
motionState_(dict),
refCentreOfMass_(dict.lookupOrDefault("refCentreOfMass", centreOfMass())),
momentOfInertia_(dict.lookup("momentOfInertia")),
mass_(readScalar(dict.lookup("mass")))
{}
Foam::sixDoFRigidBodyMotion::sixDoFRigidBodyMotion
(
const sixDoFRigidBodyMotion& sDoFRBM
)
:
motionState_(sDoFRBM.motionState()),
refCentreOfMass_(sDoFRBM.refCentreOfMass()),
momentOfInertia_(sDoFRBM.momentOfInertia()),
mass_(sDoFRBM.mass())
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::sixDoFRigidBodyMotion::~sixDoFRigidBodyMotion()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
void Foam::sixDoFRigidBodyMotion::updatePosition
(
scalar deltaT
)
{
// First leapfrog velocity adjust and motion part, required before
// force calculation
if (Pstream::master())
{
v() += 0.5*deltaT*a();
pi() += 0.5*deltaT*tau();
// Leapfrog move part
centreOfMass() += deltaT*v();
// Leapfrog orientation adjustment
tensor R;
R = rotationTensorX(0.5*deltaT*pi().x()/momentOfInertia_.xx());
pi() = pi() & R;
Q() = Q() & R;
R = rotationTensorY(0.5*deltaT*pi().y()/momentOfInertia_.yy());
pi() = pi() & R;
Q() = Q() & R;
R = rotationTensorZ(deltaT*pi().z()/momentOfInertia_.zz());
pi() = pi() & R;
Q() = Q() & R;
R = rotationTensorY(0.5*deltaT*pi().y()/momentOfInertia_.yy());
pi() = pi() & R;
Q() = Q() & R;
R = rotationTensorX(0.5*deltaT*pi().x()/momentOfInertia_.xx());
pi() = pi() & R;
Q() = Q() & R;
}
Pstream::scatter(motionState_);
}
void Foam::sixDoFRigidBodyMotion::updateForce
(
const vector& fGlobal,
const vector& tauGlobal,
scalar deltaT
)
{
// Second leapfrog velocity adjust part, required after motion and
// force calculation part
if (Pstream::master())
{
a() = fGlobal/mass_;
tau() = (Q().T() & tauGlobal);
v() += 0.5*deltaT*a();
pi() += 0.5*deltaT*tau();
}
Pstream::scatter(motionState_);
}
void Foam::sixDoFRigidBodyMotion::updateForce
(
const pointField& positions,
const vectorField& forces,
scalar deltaT
)
{
// Second leapfrog velocity adjust part, required after motion and
// force calculation part
if (Pstream::master())
{
a() = vector::zero;
tau() = vector::zero;
forAll(positions, i)
{
const vector& f = forces[i];
a() += f/mass_;
tau() += (positions[i] ^ (Q().T() & f));
}
v() += 0.5*deltaT*a();
pi() += 0.5*deltaT*tau();
}
Pstream::scatter(motionState_);
}
Foam::tmp<Foam::pointField>
Foam::sixDoFRigidBodyMotion::generatePositions(const pointField& pts) const
{
return (centreOfMass() + (Q() & (pts - refCentreOfMass_)));
}
// ************************************************************************* //

View File

@ -0,0 +1,251 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-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::sixDoFRigidBodyMotion
Description
Six degree of freedom motion for a rigid body. Angular momentum stored in
body fixed reference frame. Reference orientation of the body must align
with the cartesian axes such that the Inertia tensor is in principle
component form.
Symplectic motion as per:
title = {Symplectic splitting methods for rigid body molecular dynamics},
publisher = {AIP},
year = {1997},
journal = {The Journal of Chemical Physics},
volume = {107},
number = {15},
pages = {5840-5851},
url = {http://link.aip.org/link/?JCP/107/5840/1},
doi = {10.1063/1.474310}
SourceFiles
sixDoFRigidBodyMotionI.H
sixDoFRigidBodyMotion.C
sixDoFRigidBodyMotionIO.C
\*---------------------------------------------------------------------------*/
#ifndef sixDoFRigidBodyMotion_H
#define sixDoFRigidBodyMotion_H
#include "sixDoFRigidBodyMotionState.H"
#include "pointField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class Istream;
class Ostream;
// Forward declaration of friend functions and operators
class sixDoFRigidBodyMotion;
Istream& operator>>(Istream&, sixDoFRigidBodyMotion&);
Ostream& operator<<(Ostream&, const sixDoFRigidBodyMotion&);
/*---------------------------------------------------------------------------*\
Class sixDoFRigidBodyMotion Declaration
\*---------------------------------------------------------------------------*/
class sixDoFRigidBodyMotion
{
// Private data
// state data object
sixDoFRigidBodyMotionState motionState_;
//- Centre of mass of reference state
point refCentreOfMass_;
//- Moment of inertia of the body in reference configuration
diagTensor momentOfInertia_;
//- Mass of the body
scalar mass_;
// Private Member Functions
//- Calculate the rotation tensor around the body reference
// frame x-axis by the given angle
inline tensor rotationTensorX(scalar deltaT) const;
//- Calculate the rotation tensor around the body reference
// frame y-axis by the given angle
inline tensor rotationTensorY(scalar deltaT) const;
//- Calculate the rotation tensor around the body reference
// frame z-axis by the given angle
inline tensor rotationTensorZ(scalar deltaT) const;
public:
// Constructors
//- Construct null
sixDoFRigidBodyMotion();
//- Construct from components
sixDoFRigidBodyMotion
(
const point& centreOfMass,
const tensor& Q,
const vector& v,
const vector& a,
const vector& pi,
const vector& tau,
scalar mass,
const point& refCentreOfMass,
const diagTensor& momentOfInertia
);
//- Construct from dictionary
sixDoFRigidBodyMotion(const dictionary& dict);
//- Construct as copy
sixDoFRigidBodyMotion(const sixDoFRigidBodyMotion&);
//- Destructor
~sixDoFRigidBodyMotion();
// Member Functions
void updatePosition
(
scalar deltaT
);
void updateForce
(
const vector& fGlobal,
const vector& tauGlobal,
scalar deltaT
);
void updateForce
(
const pointField& positions,
const vectorField& forces,
scalar deltaT
);
tmp<pointField> generatePositions(const pointField& pts) const;
// Access
//- Return access to the motion state
inline const sixDoFRigidBodyMotionState& motionState() const;
//- Return access to the centre of mass
inline const point& centreOfMass() const;
//- Return access to the centre of mass
inline const point& refCentreOfMass() const;
//- Return access to the inertia tensor
inline const diagTensor& momentOfInertia() const;
//- Return access to the mass
inline scalar mass() const;
//- Return access to the orientation
inline const tensor& Q() const;
//- Return access to velocity
inline const vector& v() const;
//- Return access to acceleration
inline const vector& a() const;
//- Return access to angular momentum
inline const vector& pi() const;
//- Return access to torque
inline const vector& tau() const;
// Edit
//- Return non-const access to the centre of mass
inline point& centreOfMass();
//- Return access to the centre of mass
inline point& refCentreOfMass();
//- Return non-const access to the inertia tensor
inline diagTensor& momentOfInertia();
//- Return non-const access to the mass
inline scalar& mass();
//- Return non-const access to the orientation
inline tensor& Q();
//- Return non-const access to vector
inline vector& v();
//- Return non-const access to acceleration
inline vector& a();
//- Return non-const access to angular momentum
inline vector& pi();
//- Return non-const access to torque
inline vector& tau();
//- Write
void write(Ostream&) const;
// IOstream Operators
friend Istream& operator>>(Istream&, sixDoFRigidBodyMotion&);
friend Ostream& operator<<(Ostream&, const sixDoFRigidBodyMotion&);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "sixDoFRigidBodyMotionI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,183 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-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
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
inline Foam::tensor
Foam::sixDoFRigidBodyMotion::rotationTensorX(scalar phi) const
{
return tensor
(
1, 0, 0,
0, Foam::cos(phi), -Foam::sin(phi),
0, Foam::sin(phi), Foam::cos(phi)
);
}
inline Foam::tensor
Foam::sixDoFRigidBodyMotion::rotationTensorY(scalar phi) const
{
return tensor
(
Foam::cos(phi), 0, Foam::sin(phi),
0, 1, 0,
-Foam::sin(phi), 0, Foam::cos(phi)
);
}
inline Foam::tensor
Foam::sixDoFRigidBodyMotion::rotationTensorZ(scalar phi) const
{
return tensor
(
Foam::cos(phi), -Foam::sin(phi), 0,
Foam::sin(phi), Foam::cos(phi), 0,
0, 0, 1
);
}
inline const Foam::sixDoFRigidBodyMotionState&
Foam::sixDoFRigidBodyMotion::motionState() const
{
return motionState_;
}
inline const Foam::point& Foam::sixDoFRigidBodyMotion::centreOfMass() const
{
return motionState_.centreOfMass();
}
inline const Foam::point& Foam::sixDoFRigidBodyMotion::refCentreOfMass() const
{
return refCentreOfMass_;
}
inline const Foam::diagTensor&
Foam::sixDoFRigidBodyMotion::momentOfInertia() const
{
return momentOfInertia_;
}
inline Foam::scalar Foam::sixDoFRigidBodyMotion::mass() const
{
return mass_;
}
inline const Foam::tensor& Foam::sixDoFRigidBodyMotion::Q() const
{
return motionState_.Q();
}
inline const Foam::vector& Foam::sixDoFRigidBodyMotion::v() const
{
return motionState_.v();
}
inline const Foam::vector& Foam::sixDoFRigidBodyMotion::a() const
{
return motionState_.a();
}
inline const Foam::vector& Foam::sixDoFRigidBodyMotion::pi() const
{
return motionState_.pi();
}
inline const Foam::vector& Foam::sixDoFRigidBodyMotion::tau() const
{
return motionState_.tau();
}
inline Foam::point& Foam::sixDoFRigidBodyMotion::centreOfMass()
{
return motionState_.centreOfMass();
}
inline Foam::point& Foam::sixDoFRigidBodyMotion::refCentreOfMass()
{
return refCentreOfMass_;
}
inline Foam::diagTensor& Foam::sixDoFRigidBodyMotion::momentOfInertia()
{
return momentOfInertia_;
}
inline Foam::scalar& Foam::sixDoFRigidBodyMotion::mass()
{
return mass_;
}
inline Foam::tensor& Foam::sixDoFRigidBodyMotion::Q()
{
return motionState_.Q();
}
inline Foam::vector& Foam::sixDoFRigidBodyMotion::v()
{
return motionState_.v();
}
inline Foam::vector& Foam::sixDoFRigidBodyMotion::a()
{
return motionState_.a();
}
inline Foam::vector& Foam::sixDoFRigidBodyMotion::pi()
{
return motionState_.pi();
}
inline Foam::vector& Foam::sixDoFRigidBodyMotion::tau()
{
return motionState_.tau();
}
// ************************************************************************* //

View File

@ -0,0 +1,87 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-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 "sixDoFRigidBodyMotion.H"
#include "IOstreams.H"
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
void Foam::sixDoFRigidBodyMotion::write(Ostream& os) const
{
motionState_.write(os);
os.writeKeyword("refCentreOfMass")
<< refCentreOfMass_ << token::END_STATEMENT << nl;
os.writeKeyword("momentOfInertia")
<< momentOfInertia_ << token::END_STATEMENT << nl;
os.writeKeyword("mass")
<< mass_ << token::END_STATEMENT << nl;
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
Foam::Istream& Foam::operator>>(Istream& is, sixDoFRigidBodyMotion& sDoFRBM)
{
is >> sDoFRBM.motionState_
>> sDoFRBM.refCentreOfMass_
>> sDoFRBM.momentOfInertia_
>> sDoFRBM.mass_;
// Check state of Istream
is.check
(
"Foam::Istream& Foam::operator>>"
"(Foam::Istream&, Foam::sixDoFRigidBodyMotion&)"
);
return is;
}
Foam::Ostream& Foam::operator<<
(
Ostream& os,
const sixDoFRigidBodyMotion& sDoFRBM
)
{
os << sDoFRBM.motionState()
<< token::SPACE << sDoFRBM.refCentreOfMass()
<< token::SPACE << sDoFRBM.momentOfInertia()
<< token::SPACE << sDoFRBM.mass() ;
// Check state of Ostream
os.check
(
"Foam::Ostream& Foam::operator<<(Foam::Ostream&, "
"const Foam::sixDoFRigidBodyMotion&)"
);
return os;
}
// ************************************************************************* //

View File

@ -0,0 +1,95 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-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 "sixDoFRigidBodyMotionState.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::sixDoFRigidBodyMotionState::sixDoFRigidBodyMotionState()
:
centreOfMass_(vector::zero),
Q_(I),
v_(vector::zero),
a_(vector::zero),
pi_(vector::zero),
tau_(vector::zero)
{}
Foam::sixDoFRigidBodyMotionState::sixDoFRigidBodyMotionState
(
const point& centreOfMass,
const tensor& Q,
const vector& v,
const vector& a,
const vector& pi,
const vector& tau
)
:
centreOfMass_(centreOfMass),
Q_(Q),
v_(v),
a_(a),
pi_(pi),
tau_(tau)
{}
Foam::sixDoFRigidBodyMotionState::sixDoFRigidBodyMotionState
(
const dictionary& dict
)
:
centreOfMass_(dict.lookup("centreOfMass")),
Q_(dict.lookupOrDefault("Q", tensor(I))),
v_(dict.lookupOrDefault("v", vector::zero)),
a_(dict.lookupOrDefault("a", vector::zero)),
pi_(dict.lookupOrDefault("pi", vector::zero)),
tau_(dict.lookupOrDefault("tau", vector::zero))
{}
Foam::sixDoFRigidBodyMotionState::sixDoFRigidBodyMotionState
(
const sixDoFRigidBodyMotionState& sDoFRBMS
)
:
centreOfMass_(sDoFRBMS.centreOfMass()),
Q_(sDoFRBMS.Q()),
v_(sDoFRBMS.v()),
a_(sDoFRBMS.a()),
pi_(sDoFRBMS.pi()),
tau_(sDoFRBMS.tau())
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::sixDoFRigidBodyMotionState::~sixDoFRigidBodyMotionState()
{}
// ************************************************************************* //

View File

@ -0,0 +1,194 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-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::sixDoFRigidBodyMotionState
Description
Holds the motion state of sixDoF object. Wrapped up together
to allow rapid scatter to other processors. The processors must all
maintain exactly the same state data to avoid any drift or inconsistency.
SourceFiles
sixDoFRigidBodyMotionStateI.H
sixDoFRigidBodyMotionState.C
sixDoFRigidBodyMotionStateIO.C
\*---------------------------------------------------------------------------*/
#ifndef sixDoFRigidBodyMotionState_H
#define sixDoFRigidBodyMotionState_H
#include "vector.H"
#include "point.H"
#include "diagTensor.H"
#include "tensor.H"
#include "dictionary.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class Istream;
class Ostream;
// Forward declaration of friend functions and operators
class sixDoFRigidBodyMotionState;
Istream& operator>>(Istream&, sixDoFRigidBodyMotionState&);
Ostream& operator<<(Ostream&, const sixDoFRigidBodyMotionState&);
/*---------------------------------------------------------------------------*\
Class sixDoFRigidBodyMotionState Declaration
\*---------------------------------------------------------------------------*/
class sixDoFRigidBodyMotionState
{
// Private data
//- Current position of the centre of mass of the body
point centreOfMass_;
//- Orientation, stored as the rotation tensor to transform
// from the body to the global reference frame, i.e.:
// globalVector = Q_ & bodyLocalVector
// bodyLocalVector = Q_.T() & globalVector
tensor Q_;
// Linear velocity of body
vector v_;
// Total linear acceleration of body
vector a_;
//- Angular momentum of body, in body local reference frame
vector pi_;
//- Total torque on body, in body local reference frame
vector tau_;
public:
// Constructors
//- Construct null
sixDoFRigidBodyMotionState();
//- Construct from components
sixDoFRigidBodyMotionState
(
const point& centreOfMass,
const tensor& Q,
const vector& v,
const vector& a,
const vector& pi,
const vector& tau
);
//- Construct from dictionary
sixDoFRigidBodyMotionState(const dictionary& dict);
//- Construct as copy
sixDoFRigidBodyMotionState(const sixDoFRigidBodyMotionState&);
//- Destructor
~sixDoFRigidBodyMotionState();
// Member Functions
// Access
//- Return access to the centre of mass
inline const point& centreOfMass() const;
//- Return access to the orientation
inline const tensor& Q() const;
//- Return access to velocity
inline const vector& v() const;
//- Return access to acceleration
inline const vector& a() const;
//- Return access to angular momentum
inline const vector& pi() const;
//- Return access to torque
inline const vector& tau() const;
// Edit
//- Return non-const access to the centre of mass
inline point& centreOfMass();
//- Return non-const access to the orientation
inline tensor& Q();
//- Return non-const access to vector
inline vector& v();
//- Return non-const access to acceleration
inline vector& a();
//- Return non-const access to angular momentum
inline vector& pi();
//- Return non-const access to torque
inline vector& tau();
//- Write
void write(Ostream&) const;
// Friend Functions
// Friend Operators
// IOstream Operators
friend Istream& operator>>(Istream&, sixDoFRigidBodyMotionState&);
friend Ostream& operator<<(Ostream&, const sixDoFRigidBodyMotionState&);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "sixDoFRigidBodyMotionStateI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,102 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-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
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline const Foam::point& Foam::sixDoFRigidBodyMotionState::centreOfMass() const
{
return centreOfMass_;
}
inline const Foam::tensor& Foam::sixDoFRigidBodyMotionState::Q() const
{
return Q_;
}
inline const Foam::vector& Foam::sixDoFRigidBodyMotionState::v() const
{
return v_;
}
inline const Foam::vector& Foam::sixDoFRigidBodyMotionState::a() const
{
return a_;
}
inline const Foam::vector& Foam::sixDoFRigidBodyMotionState::pi() const
{
return pi_;
}
inline const Foam::vector& Foam::sixDoFRigidBodyMotionState::tau() const
{
return tau_;
}
inline Foam::point& Foam::sixDoFRigidBodyMotionState::centreOfMass()
{
return centreOfMass_;
}
inline Foam::tensor& Foam::sixDoFRigidBodyMotionState::Q()
{
return Q_;
}
inline Foam::vector& Foam::sixDoFRigidBodyMotionState::v()
{
return v_;
}
inline Foam::vector& Foam::sixDoFRigidBodyMotionState::a()
{
return a_;
}
inline Foam::vector& Foam::sixDoFRigidBodyMotionState::pi()
{
return pi_;
}
inline Foam::vector& Foam::sixDoFRigidBodyMotionState::tau()
{
return tau_;
}
// ************************************************************************* //

View File

@ -0,0 +1,98 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-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 "sixDoFRigidBodyMotionState.H"
#include "IOstreams.H"
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
void Foam::sixDoFRigidBodyMotionState::write(Ostream& os) const
{
os.writeKeyword("centreOfMass")
<< centreOfMass_ << token::END_STATEMENT << nl;
os.writeKeyword("Q")
<< Q_ << token::END_STATEMENT << nl;
os.writeKeyword("v")
<< v_ << token::END_STATEMENT << nl;
os.writeKeyword("a")
<< a_ << token::END_STATEMENT << nl;
os.writeKeyword("pi")
<< pi_ << token::END_STATEMENT << nl;
os.writeKeyword("tau")
<< tau_ << token::END_STATEMENT << nl;
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
Foam::Istream& Foam::operator>>
(
Istream& is, sixDoFRigidBodyMotionState& sDoFRBMS
)
{
is >> sDoFRBMS.centreOfMass_
>> sDoFRBMS.Q_
>> sDoFRBMS.v_
>> sDoFRBMS.a_
>> sDoFRBMS.pi_
>> sDoFRBMS.tau_;
// Check state of Istream
is.check
(
"Foam::Istream& Foam::operator>>"
"(Foam::Istream&, Foam::sixDoFRigidBodyMotionState&)"
);
return is;
}
Foam::Ostream& Foam::operator<<
(
Ostream& os,
const sixDoFRigidBodyMotionState& sDoFRBMS
)
{
os << token::SPACE << sDoFRBMS.centreOfMass()
<< token::SPACE << sDoFRBMS.Q()
<< token::SPACE << sDoFRBMS.v()
<< token::SPACE << sDoFRBMS.a()
<< token::SPACE << sDoFRBMS.pi()
<< token::SPACE << sDoFRBMS.tau();
// Check state of Ostream
os.check
(
"Foam::Ostream& Foam::operator<<(Foam::Ostream&, "
"const Foam::sixDoFRigidBodyMotionState&)"
);
return os;
}
// ************************************************************************* //

View File

@ -25,7 +25,7 @@ License
\*---------------------------------------------------------------------------*/
#include "COxidationDiffusionLimitedRate.H"
#include "mathConstants.H"
#include "mathematicalConstants.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -124,7 +124,7 @@ Foam::scalar Foam::COxidationDiffusionLimitedRate<CloudType>::calculate
const scalar YO2 = this->owner().mcCarrierThermo().Y(O2GlobalId_)[cellI];
// Change in C mass [kg]
scalar dmC = 4.0*constant::math::pi*d*D_*YO2*Tc*rhoc/(Sb_*(T + Tc))*dt;
scalar dmC = 4.0*constant::mathematical::pi*d*D_*YO2*Tc*rhoc/(Sb_*(T + Tc))*dt;
// Limit mass transfer by availability of C
dmC = min(mass*fComb, dmC);

View File

@ -25,7 +25,7 @@ License
\*---------------------------------------------------------------------------*/
#include "COxidationKineticDiffusionLimitedRate.H"
#include "mathConstants.H"
#include "mathematicalConstants.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -138,7 +138,7 @@ Foam::scalar Foam::COxidationKineticDiffusionLimitedRate<CloudType>::calculate
const scalar Rk = C2_*exp(-E_/(specie::RR*Tc));
// Particle surface area
const scalar Ap = constant::math::pi*sqr(d);
const scalar Ap = constant::mathematical::pi*sqr(d);
// Change in C mass [kg]
scalar dmC = Ap*rhoc*specie::RR*Tc*YO2/WO2_*D0*Rk/(D0 + Rk);

View File

@ -25,7 +25,7 @@ License
\*---------------------------------------------------------------------------*/
#include "COxidationMurphyShaddix.H"
#include "mathConstants.H"
#include "mathematicalConstants.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -134,7 +134,7 @@ Foam::scalar Foam::COxidationMurphyShaddix<CloudType>::calculate
}
// Particle surface area [m^2]
const scalar Ap = constant::math::pi*sqr(d);
const scalar Ap = constant::mathematical::pi*sqr(d);
// Calculate diffision constant at continuous phase temperature
// and density [m^2/s]

View File

@ -27,7 +27,7 @@ License
#include "commonRailInjector.H"
#include "addToRunTimeSelectionTable.H"
#include "Random.H"
#include "mathConstants.H"
#include "mathematicalConstants.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
@ -244,7 +244,7 @@ Foam::vector Foam::commonRailInjector::position
{
// otherwise, disc injection
scalar iRadius = d_*rndGen.scalar01();
scalar iAngle = constant::math::twoPi*rndGen.scalar01();
scalar iAngle = constant::mathematical::twoPi*rndGen.scalar01();
return
(
@ -297,7 +297,7 @@ Foam::scalar Foam::commonRailInjector::mass
// correct mass if calculation is 2D
if (twoD)
{
mInj *= 0.5*angleOfWedge/constant::math::pi;
mInj *= 0.5*angleOfWedge/constant::mathematical::pi;
}
return mInj;
@ -404,7 +404,7 @@ void Foam::commonRailInjector::correctProfiles
const scalar referencePressure
)
{
scalar A = 0.25*constant::math::pi*sqr(d_);
scalar A = 0.25*constant::mathematical::pi*sqr(d_);
scalar pDummy = 1.0e+5;
scalar rho = fuel.rho(pDummy, T_, X_);

View File

@ -27,7 +27,7 @@ License
#include "definedInjector.H"
#include "addToRunTimeSelectionTable.H"
#include "Random.H"
#include "mathConstants.H"
#include "mathematicalConstants.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
@ -226,7 +226,7 @@ Foam::vector Foam::definedInjector::position
{
// otherwise, disc injection
scalar iRadius = d_*rndGen.scalar01();
scalar iAngle = constant::math::twoPi*rndGen.scalar01();
scalar iAngle = constant::mathematical::twoPi*rndGen.scalar01();
return
(
@ -280,7 +280,7 @@ Foam::scalar Foam::definedInjector::mass
// correct mass if calculation is 2D
if (twoD)
{
mInj *= 0.5*angleOfWedge/constant::math::pi;
mInj *= 0.5*angleOfWedge/constant::mathematical::pi;
}
return mInj;
@ -374,7 +374,7 @@ void Foam::definedInjector::correctProfiles
const scalar referencePressure
)
{
scalar A = 0.25*constant::math::pi*sqr(d_);
scalar A = 0.25*constant::mathematical::pi*sqr(d_);
scalar pDummy = 1.0e+5;
scalar rho = fuel.rho(pDummy, T_, X_);

View File

@ -27,7 +27,7 @@ License
#include "multiHoleInjector.H"
#include "addToRunTimeSelectionTable.H"
#include "Random.H"
#include "mathConstants.H"
#include "mathematicalConstants.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
@ -165,9 +165,8 @@ Foam::multiHoleInjector::~multiHoleInjector()
void Foam::multiHoleInjector::setTangentialVectors()
{
scalar pi180 = constant::math::pi/180.0;
scalar alpha = xyAngle_*pi180;
scalar phi = zAngle_*pi180;
scalar alpha = degToRad(xyAngle_);
scalar phi = degToRad(zAngle_);
vector xp(cos(alpha), sin(alpha), 0.0);
vector zp(cos(alpha)*sin(phi), sin(alpha)*sin(phi), cos(phi));
@ -184,11 +183,11 @@ void Foam::multiHoleInjector::setTangentialVectors()
// Info << "zp = " << zp << endl;
scalar angle = 0.0;
scalar u = umbrellaAngle_*pi180/2.0;
scalar u = degToRad(umbrellaAngle_/2.0);
for (label i=0; i<nHoles_; i++)
{
angle += angleSpacing_[i];
scalar v = angle*pi180;
scalar v = degToRad(angle);
direction_[i] = cos(v)*sin(u)*xp + sin(v)*sin(u)*yp + cos(u)*zp;
vector dp = direction_[i] - (direction_[i] & zp)*direction_[i];
if (mag(dp) > SMALL)
@ -267,7 +266,7 @@ Foam::vector Foam::multiHoleInjector::position
{
// otherwise, disc injection
scalar iRadius = d_*rndGen.scalar01();
scalar iAngle = constant::math::twoPi*rndGen.scalar01();
scalar iAngle = constant::mathematical::twoPi*rndGen.scalar01();
return
(
@ -319,7 +318,7 @@ Foam::scalar Foam::multiHoleInjector::mass
// correct mass if calculation is 2D
if (twoD)
{
mInj *= 0.5*angleOfWedge/constant::math::pi;
mInj *= 0.5*angleOfWedge/constant::mathematical::pi;
}
return mInj;
@ -429,7 +428,7 @@ void Foam::multiHoleInjector::correctProfiles
const scalar referencePressure
)
{
scalar A = nHoles_*0.25*constant::math::pi*sqr(d_);
scalar A = nHoles_*0.25*constant::mathematical::pi*sqr(d_);
forAll(velocityProfile_, i)
{

View File

@ -27,7 +27,7 @@ License
#include "swirlInjector.H"
#include "addToRunTimeSelectionTable.H"
#include "Random.H"
#include "mathConstants.H"
#include "mathematicalConstants.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -246,7 +246,7 @@ Foam::vector Foam::swirlInjector::position
{
// otherwise, disc injection
scalar iRadius = d_*rndGen.scalar01();
scalar iAngle = constant::math::twoPi*rndGen.scalar01();
scalar iAngle = constant::mathematical::twoPi*rndGen.scalar01();
return
(
@ -300,7 +300,7 @@ Foam::scalar Foam::swirlInjector::mass
// correct mass if calculation is 2D
if (twoD)
{
mInj *= 0.5*angleOfWedge/constant::math::pi;
mInj *= 0.5*angleOfWedge/constant::mathematical::pi;
}
return mInj;
@ -415,7 +415,7 @@ void Foam::swirlInjector::correctProfiles
const scalar referencePressure
)
{
scalar A = 0.25*constant::math::pi*sqr(d_);
scalar A = 0.25*constant::mathematical::pi*sqr(d_);
scalar pDummy = 1.0e+5;
scalar rho = fuel.rho(pDummy, T_, X_);

View File

@ -27,7 +27,7 @@ License
#include "unitInjector.H"
#include "addToRunTimeSelectionTable.H"
#include "Random.H"
#include "mathConstants.H"
#include "mathematicalConstants.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -220,7 +220,7 @@ Foam::vector Foam::unitInjector::position
{
// otherwise, disc injection
scalar iRadius = d_*rndGen.scalar01();
scalar iAngle = constant::math::twoPi*rndGen.scalar01();
scalar iAngle = constant::mathematical::twoPi*rndGen.scalar01();
return
(
@ -273,7 +273,7 @@ Foam::scalar Foam::unitInjector::mass
// correct mass if calculation is 2D
if (twoD)
{
mInj *= 0.5*angleOfWedge/constant::math::pi;
mInj *= 0.5*angleOfWedge/constant::mathematical::pi;
}
return mInj;
@ -364,7 +364,7 @@ void Foam::unitInjector::correctProfiles
const scalar referencePressure
)
{
scalar A = 0.25*constant::math::pi*sqr(d_);
scalar A = 0.25*constant::mathematical::pi*sqr(d_);
scalar pDummy = 1.0e+5;
forAll(velocityProfile_, i)

View File

@ -25,7 +25,7 @@ License
\*---------------------------------------------------------------------------*/
#include "parcel.H"
#include "mathConstants.H"
#include "mathematicalConstants.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -102,13 +102,13 @@ scalar parcel::Pr
scalar parcel::N(const scalar rho) const
{
return 6.0*m_/(rho*pow3(d_)*constant::math::pi);
return 6.0*m_/(rho*pow3(d_)*constant::mathematical::pi);
}
scalar parcel::Vd() const
{
return pow3(d_)*constant::math::pi/6.0;
return pow3(d_)*constant::mathematical::pi/6.0;
}

View File

@ -41,7 +41,7 @@ License
#include "symmetryPolyPatch.H"
#include "wedgePolyPatch.H"
#include "mathConstants.H"
#include "mathematicalConstants.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -290,17 +290,17 @@ Foam::spray::spray
axisOfWedgeNormal_ /= mag(axisOfWedgeNormal_);
scalar arcCos = (v1 & v2)/mag(v1);
angleOfWedge_ = constant::math::pi - acos(arcCos);
angleOfWedge_ = constant::mathematical::pi - acos(arcCos);
Info<< "Calculated angle of wedge is "
<< angleOfWedge_*180/constant::math::pi << " deg."
<< radToDeg(angleOfWedge_) << " deg."
<< endl;
}
else
{
if (symPlaneExist)
{
angleOfWedge_ = constant::math::pi;
angleOfWedge_ = constant::mathematical::pi;
Info<< "Constructing 180 deg three dimensional spray injection."
<< endl;
}

View File

@ -25,7 +25,7 @@ License
\*---------------------------------------------------------------------------*/
#include "spray.H"
#include "mathConstants.H"
#include "mathematicalConstants.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -106,7 +106,7 @@ scalar spray::liquidMass() const
if (twoD())
{
sum *= constant::math::twoPi/angleOfWedge();
sum *= constant::mathematical::twoPi/angleOfWedge();
}
reduce(sum, sumOp<scalar>());
@ -148,7 +148,7 @@ scalar spray::liquidEnthalpy() const
if (twoD())
{
sum *= constant::math::twoPi/angleOfWedge();
sum *= constant::mathematical::twoPi/angleOfWedge();
}
reduce(sum, sumOp<scalar>());
@ -193,7 +193,7 @@ scalar spray::liquidTotalEnthalpy() const
if (twoD())
{
sum *= constant::math::twoPi/angleOfWedge();
sum *= constant::mathematical::twoPi/angleOfWedge();
}
reduce(sum, sumOp<scalar>());
@ -218,7 +218,7 @@ scalar spray::liquidKineticEnergy() const
if (twoD())
{
sum *= constant::math::twoPi/angleOfWedge();
sum *= constant::mathematical::twoPi/angleOfWedge();
}
reduce(sum, sumOp<scalar>());

View File

@ -27,7 +27,7 @@ License
#include "LISA.H"
#include "addToRunTimeSelectionTable.H"
#include "basicMultiComponentMixture.H"
#include "mathConstants.H"
#include "mathematicalConstants.H"
#include "RosinRammler.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -155,7 +155,7 @@ void LISA::atomizeParcel
scalar massFlow = it.massFlowRate(max(0.0,elapsedTime-time));
scalar hSheet = massFlow/(constant::math::pi*d*rhoFuel*mag(p.U()));
scalar hSheet = massFlow/(constant::mathematical::pi*d*rhoFuel*mag(p.U()));
p.d() = min(hSheet,p.d());
@ -249,7 +249,7 @@ void LISA::atomizeParcel
scalar kL = 1.0/(dL*sqrt(0.5 + 1.5*muFuel/sqrt(rhoFuel*sigma*dL)));
scalar dD = cbrt(3.0*constant::math::pi*sqr(dL)/kL);
scalar dD = cbrt(3.0*constant::mathematical::pi*sqr(dL)/kL);
scalar lisaExp = 0.27;
scalar ambientPressure = 1.0e+5;

View File

@ -27,7 +27,7 @@ License
#include "blobsSheetAtomization.H"
#include "addToRunTimeSelectionTable.H"
#include "basicMultiComponentMixture.H"
#include "mathConstants.H"
#include "mathematicalConstants.H"
#include "RosinRammler.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -127,7 +127,7 @@ void blobsSheetAtomization::atomizeParcel
scalar lBU =
B_*sqrt
(
rhoFuel*sigma*p.d()*cos(angle_*constant::math::pi/360.0)
rhoFuel*sigma*p.d()*cos(angle_*constant::mathematical::pi/360.0)
/sqr(rhoAverage*U)
);

Some files were not shown because too many files have changed in this diff Show More