mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of /home/noisy3/OpenFOAM/OpenFOAM-dev
This commit is contained in:
3
applications/test/fieldDependency/Make/files
Normal file
3
applications/test/fieldDependency/Make/files
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fieldDependency.C
|
||||||
|
|
||||||
|
EXE = $(FOAM_USER_APPBIN)/fieldDependency
|
||||||
5
applications/test/fieldDependency/Make/options
Normal file
5
applications/test/fieldDependency/Make/options
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
EXE_INC = \
|
||||||
|
-I$(LIB_SRC)/finiteVolume/lnInclude
|
||||||
|
|
||||||
|
EXE_LIBS = \
|
||||||
|
-lfiniteVolume
|
||||||
102
applications/test/fieldDependency/fieldDependency.C
Normal file
102
applications/test/fieldDependency/fieldDependency.C
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
/*---------------------------------------------------------------------------*\
|
||||||
|
========= |
|
||||||
|
\\ / 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
|
||||||
|
|
||||||
|
Description
|
||||||
|
Test field dependencies.
|
||||||
|
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "argList.H"
|
||||||
|
#include "Time.H"
|
||||||
|
#include "volFields.H"
|
||||||
|
|
||||||
|
using namespace Foam;
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
// Main program:
|
||||||
|
|
||||||
|
int main(int argc, char *argv[])
|
||||||
|
{
|
||||||
|
#include "setRootCase.H"
|
||||||
|
#include "createTime.H"
|
||||||
|
#include "createMesh.H"
|
||||||
|
|
||||||
|
Info<< "Creating field T\n" << endl;
|
||||||
|
volScalarField T
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"T",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh,
|
||||||
|
dimensionedScalar("zero", dimless, 0)
|
||||||
|
);
|
||||||
|
|
||||||
|
Info<< "Creating field p\n" << endl;
|
||||||
|
volScalarField p
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"p",
|
||||||
|
runTime.timeName(),
|
||||||
|
mesh,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh,
|
||||||
|
dimensionedScalar("zero", dimless, 0)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
Info<< "p.eventNo:" << p.eventNo() << endl;
|
||||||
|
Info<< "p.uptodate:" << p.upToDate("T")<< endl;
|
||||||
|
|
||||||
|
// Change T and mark as uptodate.
|
||||||
|
Info<< "Changing T" << endl;
|
||||||
|
T = 0.0;
|
||||||
|
T.setUpToDate();
|
||||||
|
Info<< "T.eventNo:" << T.eventNo() << endl;
|
||||||
|
|
||||||
|
// Check p dependency:
|
||||||
|
Info<< "p.uptodate:" << p.upToDate("T")<< endl;
|
||||||
|
|
||||||
|
// Change p and mark as uptodate.
|
||||||
|
Info<< "Changing p." << endl;
|
||||||
|
p.setUpToDate();
|
||||||
|
Info<< "p.uptodate:" << p.upToDate("T")<< endl;
|
||||||
|
Info<< "p.eventNo:" << p.eventNo() << endl;
|
||||||
|
|
||||||
|
|
||||||
|
Info<< "End\n" << endl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -445,12 +445,12 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
scalar featureAngle(readScalar(IStringStream(args.additionalArgs()[0])()));
|
scalar featureAngle(readScalar(IStringStream(args.additionalArgs()[0])()));
|
||||||
|
|
||||||
scalar minCos = Foam::cos(featureAngle*constant::mathematical::pi/180.0);
|
scalar minCos = Foam::cos(degToRad(featureAngle));
|
||||||
|
|
||||||
scalar concaveAngle = defaultConcaveAngle;
|
scalar concaveAngle = defaultConcaveAngle;
|
||||||
args.optionReadIfPresent("concaveAngle", concaveAngle);
|
args.optionReadIfPresent("concaveAngle", concaveAngle);
|
||||||
|
|
||||||
scalar concaveSin = Foam::sin(concaveAngle*constant::mathematical::pi/180.0);
|
scalar concaveSin = Foam::sin(degToRad(concaveAngle));
|
||||||
|
|
||||||
bool snapMeshDict = args.optionFound("snapMesh");
|
bool snapMeshDict = args.optionFound("snapMesh");
|
||||||
bool overwrite = args.optionFound("overwrite");
|
bool overwrite = args.optionFound("overwrite");
|
||||||
|
|||||||
@ -539,9 +539,8 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
scalar featureAngle(readScalar(IStringStream(args.additionalArgs()[0])()));
|
scalar featureAngle(readScalar(IStringStream(args.additionalArgs()[0])()));
|
||||||
|
|
||||||
scalar radAngle = featureAngle*constant::mathematical::pi/180.0;
|
scalar minCos = Foam::cos(degToRad(featureAngle));
|
||||||
scalar minCos = Foam::cos(radAngle);
|
scalar minSin = Foam::sin(degToRad(featureAngle));
|
||||||
scalar minSin = Foam::sin(radAngle);
|
|
||||||
|
|
||||||
bool readSet = args.optionFound("set");
|
bool readSet = args.optionFound("set");
|
||||||
bool geometry = args.optionFound("geometry");
|
bool geometry = args.optionFound("geometry");
|
||||||
|
|||||||
@ -434,7 +434,7 @@ if (pFaces[WEDGE].size() && pFaces[WEDGE][0].size())
|
|||||||
{
|
{
|
||||||
// Distribute the points to be +/- 2.5deg from the x-z plane
|
// Distribute the points to be +/- 2.5deg from the x-z plane
|
||||||
|
|
||||||
scalar tanTheta = Foam::tan(2.5*constant::mathematical::pi/180.0);
|
scalar tanTheta = Foam::tan(degToRad(2.5));
|
||||||
|
|
||||||
SLList<face>::iterator iterf = pFaces[WEDGE][0].begin();
|
SLList<face>::iterator iterf = pFaces[WEDGE][0].begin();
|
||||||
SLList<face>::iterator iterb = pFaces[WEDGE][1].begin();
|
SLList<face>::iterator iterb = pFaces[WEDGE][1].begin();
|
||||||
|
|||||||
@ -91,7 +91,7 @@ void simpleMarkFeatures
|
|||||||
labelList& multiCellFeaturePoints
|
labelList& multiCellFeaturePoints
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
scalar minCos = Foam::cos(featureAngle*constant::mathematical::pi/180.0);
|
scalar minCos = Foam::cos(degToRad(featureAngle));
|
||||||
|
|
||||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||||
|
|
||||||
@ -387,7 +387,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
scalar featureAngle(readScalar(IStringStream(args.additionalArgs()[0])()));
|
scalar featureAngle(readScalar(IStringStream(args.additionalArgs()[0])()));
|
||||||
|
|
||||||
scalar minCos = Foam::cos(featureAngle*constant::mathematical::pi/180.0);
|
scalar minCos = Foam::cos(degToRad(featureAngle));
|
||||||
|
|
||||||
Info<< "Feature:" << featureAngle << endl
|
Info<< "Feature:" << featureAngle << endl
|
||||||
<< "minCos :" << minCos << endl
|
<< "minCos :" << minCos << endl
|
||||||
|
|||||||
@ -99,7 +99,7 @@ void starMesh::createCoupleMatches()
|
|||||||
<< coupleI << ". STAR couple ID: "
|
<< coupleI << ". STAR couple ID: "
|
||||||
<< couples_[coupleI].coupleID() << endl
|
<< couples_[coupleI].coupleID() << endl
|
||||||
<< "The angle between face normals is "
|
<< "The angle between face normals is "
|
||||||
<< Foam::acos(faceAreaAngle)/constant::mathematical::pi*180
|
<< radToDeg(Foam::acos(faceAreaAngle))
|
||||||
<< " deg." << endl
|
<< " deg." << endl
|
||||||
<< "master cell: " << fp.masterCell()
|
<< "master cell: " << fp.masterCell()
|
||||||
<< " STAR number: " << starCellID_[fp.masterCell()]
|
<< " STAR number: " << starCellID_[fp.masterCell()]
|
||||||
|
|||||||
@ -51,8 +51,7 @@ wedge::wedge(const dictionary& dict)
|
|||||||
axis_(coeffDict_.lookup("axis")),
|
axis_(coeffDict_.lookup("axis")),
|
||||||
angle_
|
angle_
|
||||||
(
|
(
|
||||||
readScalar(coeffDict_.lookup("angle"))
|
degToRad(readScalar(coeffDict_.lookup("angle")))
|
||||||
*constant::mathematical::pi/180.0
|
|
||||||
)
|
)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|||||||
@ -93,7 +93,7 @@ int main(int argc, char *argv[])
|
|||||||
scalar featureAngle(readScalar(IStringStream(args.additionalArgs()[0])()));
|
scalar featureAngle(readScalar(IStringStream(args.additionalArgs()[0])()));
|
||||||
bool overwrite = args.optionFound("overwrite");
|
bool overwrite = args.optionFound("overwrite");
|
||||||
|
|
||||||
scalar minCos = Foam::cos(featureAngle*constant::mathematical::pi/180.0);
|
scalar minCos = Foam::cos(degToRad(featureAngle));
|
||||||
|
|
||||||
Info<< "Feature:" << featureAngle << endl
|
Info<< "Feature:" << featureAngle << endl
|
||||||
<< "minCos :" << minCos << endl
|
<< "minCos :" << minCos << endl
|
||||||
|
|||||||
@ -38,8 +38,6 @@ wmake libso sampling
|
|||||||
wmake libso dynamicMesh
|
wmake libso dynamicMesh
|
||||||
wmake libso dynamicFvMesh
|
wmake libso dynamicFvMesh
|
||||||
wmake libso topoChangerFvMesh
|
wmake libso topoChangerFvMesh
|
||||||
wmake libso fvMotionSolver
|
|
||||||
wmake libso engine
|
|
||||||
|
|
||||||
wmake libso ODE
|
wmake libso ODE
|
||||||
wmake libso randomProcesses
|
wmake libso randomProcesses
|
||||||
@ -56,4 +54,7 @@ wmake libso errorEstimation
|
|||||||
|
|
||||||
fvAgglomerationMethods/Allwmake
|
fvAgglomerationMethods/Allwmake
|
||||||
|
|
||||||
|
wmake libso fvMotionSolver
|
||||||
|
wmake libso engine
|
||||||
|
|
||||||
# ----------------------------------------------------------------- end-of-file
|
# ----------------------------------------------------------------- end-of-file
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
global/global.Cver
|
global/global.Cver
|
||||||
global/dimensionedConstants/dimensionedConstants.C
|
global/constants/constants.C
|
||||||
global/dimensionedConstants/constants/constants.C
|
global/constants/dimensionedConstants.C
|
||||||
global/argList/argList.C
|
global/argList/argList.C
|
||||||
global/clock/clock.C
|
global/clock/clock.C
|
||||||
|
|
||||||
|
|||||||
@ -72,9 +72,7 @@ public:
|
|||||||
TimeState();
|
TimeState();
|
||||||
|
|
||||||
|
|
||||||
// Destructor
|
//- Destructor
|
||||||
|
|
||||||
//- Virtual destructor
|
|
||||||
virtual ~TimeState();
|
virtual ~TimeState();
|
||||||
|
|
||||||
|
|
||||||
@ -89,22 +87,34 @@ public:
|
|||||||
virtual scalar timeToUserTime(const scalar t) const;
|
virtual scalar timeToUserTime(const scalar t) const;
|
||||||
|
|
||||||
//- Return current time value
|
//- Return current time value
|
||||||
virtual scalar timeOutputValue() const;
|
scalar timeOutputValue() const;
|
||||||
|
|
||||||
//- Return current time index
|
//- Return current time index
|
||||||
virtual label timeIndex() const;
|
label timeIndex() const;
|
||||||
|
|
||||||
|
//- Return time step value
|
||||||
|
inline scalar deltaTValue() const
|
||||||
|
{
|
||||||
|
return deltaT_;
|
||||||
|
}
|
||||||
|
|
||||||
|
//- Return old time step value
|
||||||
|
inline scalar deltaT0Value() const
|
||||||
|
{
|
||||||
|
return deltaT0_;
|
||||||
|
}
|
||||||
|
|
||||||
//- Return time step
|
//- Return time step
|
||||||
virtual dimensionedScalar deltaT() const;
|
dimensionedScalar deltaT() const;
|
||||||
|
|
||||||
//- Return old time step
|
//- Return old time step
|
||||||
virtual dimensionedScalar deltaT0() const;
|
dimensionedScalar deltaT0() const;
|
||||||
|
|
||||||
|
|
||||||
// Check
|
// Check
|
||||||
|
|
||||||
//- Return true if this is an output time
|
//- Return true if this is an output time
|
||||||
virtual bool outputTime() const;
|
bool outputTime() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -23,7 +23,7 @@ License
|
|||||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Namespace
|
Namespace
|
||||||
Foam::constant::atom
|
Foam::constant::atomic
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Atomic constants
|
Atomic constants
|
||||||
@ -68,7 +68,7 @@ namespace atomic
|
|||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace atomic
|
} // End namespace atomic
|
||||||
} // end namespace constant
|
} // End namespace constant
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -22,9 +22,6 @@ License
|
|||||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Description
|
|
||||||
Collection of dimensioned constants
|
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -27,9 +27,10 @@ Global
|
|||||||
|
|
||||||
Description
|
Description
|
||||||
Dictionary reading and supplying the dimensioned constants used within
|
Dictionary reading and supplying the dimensioned constants used within
|
||||||
OpenFOAM particularly for thermodynamics. The values are read from the
|
OpenFOAM, particularly for thermodynamics.
|
||||||
OpenFOAM controlDict and should be changed to run with a different set of
|
|
||||||
units from the default SI units.
|
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
|
SourceFiles
|
||||||
dimensionedConstants.C
|
dimensionedConstants.C
|
||||||
@ -23,7 +23,7 @@ License
|
|||||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Namespace
|
Namespace
|
||||||
Foam::constant::em
|
Foam::constant::electromagnetic
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Electromagnetic constants
|
Electromagnetic constants
|
||||||
@ -77,7 +77,7 @@ namespace electromagnetic
|
|||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace electromagnetic
|
} // End namespace electromagnetic
|
||||||
} // end namespace constant
|
} // End namespace constant
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -26,7 +26,7 @@ Namespace
|
|||||||
Foam::constant::mathematical
|
Foam::constant::mathematical
|
||||||
|
|
||||||
Description
|
Description
|
||||||
mathematical constants
|
mathematical constants and conversion functions
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
@ -56,7 +56,24 @@ namespace mathematical
|
|||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace mathematical
|
} // End namespace mathematical
|
||||||
} // end namespace constant
|
} // 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
|
} // End namespace Foam
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -23,7 +23,7 @@ License
|
|||||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Namespace
|
Namespace
|
||||||
Foam::constant::phys
|
Foam::constant::physicoChemical
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Physico-chemical constants
|
Physico-chemical constants
|
||||||
@ -71,7 +71,7 @@ namespace physicoChemical
|
|||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
} // End namespace physicoChemical
|
} // End namespace physicoChemical
|
||||||
} // end namespace constant
|
} // End namespace constant
|
||||||
} // End namespace Foam
|
} // End namespace Foam
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
@ -23,7 +23,7 @@ License
|
|||||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Namespace
|
Namespace
|
||||||
Foam::constant::uni
|
Foam::constant::universal
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Universal constants
|
Universal constants
|
||||||
@ -59,11 +59,8 @@ Foam::solution::solution(const objectRegistry& obr, const fileName& dictName)
|
|||||||
IOobject::NO_WRITE
|
IOobject::NO_WRITE
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
relaxationFactors_
|
cache_(ITstream("cache", tokenList())()),
|
||||||
(
|
relaxationFactors_(ITstream("relaxationFactors", tokenList())()),
|
||||||
ITstream("relaxationFactors",
|
|
||||||
tokenList())()
|
|
||||||
),
|
|
||||||
defaultRelaxationFactor_(0),
|
defaultRelaxationFactor_(0),
|
||||||
solvers_(ITstream("solvers", tokenList())())
|
solvers_(ITstream("solvers", tokenList())())
|
||||||
{
|
{
|
||||||
@ -151,44 +148,14 @@ Foam::label Foam::solution::upgradeSolverDict
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Foam::solution::read()
|
bool Foam::solution::cache(const word& name) const
|
||||||
{
|
{
|
||||||
if (regIOobject::read())
|
if (debug)
|
||||||
{
|
{
|
||||||
const dictionary& dict = solutionDict();
|
Info<< "Find cache entry for " << name << endl;
|
||||||
|
|
||||||
if (dict.found("relaxationFactors"))
|
|
||||||
{
|
|
||||||
relaxationFactors_ = dict.subDict("relaxationFactors");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
relaxationFactors_.readIfPresent("default", defaultRelaxationFactor_);
|
return cache_.found(name);
|
||||||
|
|
||||||
if (dict.found("solvers"))
|
|
||||||
{
|
|
||||||
solvers_ = dict.subDict("solvers");
|
|
||||||
upgradeSolverDict(solvers_);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const Foam::dictionary& Foam::solution::solutionDict() const
|
|
||||||
{
|
|
||||||
if (found("select"))
|
|
||||||
{
|
|
||||||
return subDict(word(lookup("select")));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -235,6 +202,19 @@ Foam::scalar Foam::solution::relaxationFactor(const word& name) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const Foam::dictionary& Foam::solution::solutionDict() const
|
||||||
|
{
|
||||||
|
if (found("select"))
|
||||||
|
{
|
||||||
|
return subDict(word(lookup("select")));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const Foam::dictionary& Foam::solution::solverDict(const word& name) const
|
const Foam::dictionary& Foam::solution::solverDict(const word& name) const
|
||||||
{
|
{
|
||||||
if (debug)
|
if (debug)
|
||||||
@ -259,4 +239,37 @@ const Foam::dictionary& Foam::solution::solver(const word& name) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Foam::solution::read()
|
||||||
|
{
|
||||||
|
if (regIOobject::read())
|
||||||
|
{
|
||||||
|
const dictionary& dict = solutionDict();
|
||||||
|
|
||||||
|
if (dict.found("cache"))
|
||||||
|
{
|
||||||
|
cache_ = dict.subDict("cache");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dict.found("relaxationFactors"))
|
||||||
|
{
|
||||||
|
relaxationFactors_ = dict.subDict("relaxationFactors");
|
||||||
|
}
|
||||||
|
|
||||||
|
relaxationFactors_.readIfPresent("default", defaultRelaxationFactor_);
|
||||||
|
|
||||||
|
if (dict.found("solvers"))
|
||||||
|
{
|
||||||
|
solvers_ = dict.subDict("solvers");
|
||||||
|
upgradeSolverDict(solvers_);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ************************************************************************* //
|
// ************************************************************************* //
|
||||||
|
|||||||
@ -53,6 +53,9 @@ class solution
|
|||||||
{
|
{
|
||||||
// Private data
|
// Private data
|
||||||
|
|
||||||
|
//- Dictionary of temporary fields to cache
|
||||||
|
dictionary cache_;
|
||||||
|
|
||||||
//- Dictionary of relaxation factors for all the fields
|
//- Dictionary of relaxation factors for all the fields
|
||||||
dictionary relaxationFactors_;
|
dictionary relaxationFactors_;
|
||||||
|
|
||||||
@ -62,6 +65,7 @@ class solution
|
|||||||
//- Dictionary of solver parameters for all the fields
|
//- Dictionary of solver parameters for all the fields
|
||||||
dictionary solvers_;
|
dictionary solvers_;
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
//- Disallow default bitwise copy construct and assignment
|
//- Disallow default bitwise copy construct and assignment
|
||||||
@ -90,9 +94,8 @@ public:
|
|||||||
|
|
||||||
// Access
|
// Access
|
||||||
|
|
||||||
//- Return the selected sub-dictionary of solvers if the "select"
|
//- Return true if the given field should be cached
|
||||||
// keyword is given, otherwise return the complete dictionary
|
bool cache(const word& name) const;
|
||||||
const dictionary& solutionDict() const;
|
|
||||||
|
|
||||||
//- Return true if the relaxation factor is given for the field
|
//- Return true if the relaxation factor is given for the field
|
||||||
bool relax(const word& name) const;
|
bool relax(const word& name) const;
|
||||||
@ -100,6 +103,10 @@ public:
|
|||||||
//- Return the relaxation factor for the given field
|
//- Return the relaxation factor for the given field
|
||||||
scalar relaxationFactor(const word& name) const;
|
scalar relaxationFactor(const word& name) const;
|
||||||
|
|
||||||
|
//- Return the selected sub-dictionary of solvers if the "select"
|
||||||
|
// keyword is given, otherwise return the complete dictionary
|
||||||
|
const dictionary& solutionDict() const;
|
||||||
|
|
||||||
//- Return the solver controls dictionary for the given field
|
//- Return the solver controls dictionary for the given field
|
||||||
const dictionary& solverDict(const word& name) const;
|
const dictionary& solverDict(const word& name) const;
|
||||||
|
|
||||||
|
|||||||
@ -159,9 +159,9 @@ Foam::pointHit Foam::face::intersection
|
|||||||
|
|
||||||
if (curHit.hit())
|
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.setHit();
|
||||||
nearest.setPoint(curHit.hitPoint());
|
nearest.setPoint(curHit.hitPoint());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -410,7 +410,7 @@ bool Foam::primitiveMesh::checkFaceOrthogonality
|
|||||||
|
|
||||||
// Severe nonorthogonality threshold
|
// Severe nonorthogonality threshold
|
||||||
const scalar severeNonorthogonalityThreshold =
|
const scalar severeNonorthogonalityThreshold =
|
||||||
::cos(nonOrthThreshold_/180.0*constant::mathematical::pi);
|
::cos(degToRad(nonOrthThreshold_));
|
||||||
|
|
||||||
scalar minDDotS = GREAT;
|
scalar minDDotS = GREAT;
|
||||||
|
|
||||||
@ -472,9 +472,8 @@ bool Foam::primitiveMesh::checkFaceOrthogonality
|
|||||||
if (debug || report)
|
if (debug || report)
|
||||||
{
|
{
|
||||||
Info<< " Mesh non-orthogonality Max: "
|
Info<< " Mesh non-orthogonality Max: "
|
||||||
<< ::acos(minDDotS)/constant::mathematical::pi*180.0
|
<< radToDeg(::acos(minDDotS))
|
||||||
<< " average: " <<
|
<< " average: " << radToDeg(::acos(sumDDotS/neiSize))
|
||||||
::acos(sumDDotS/neiSize)/constant::mathematical::pi*180.0
|
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -839,7 +838,7 @@ bool Foam::primitiveMesh::checkFaceAngles
|
|||||||
<< exit(FatalError);
|
<< exit(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
const scalar maxSin = Foam::sin(maxDeg/180.0*constant::mathematical::pi);
|
const scalar maxSin = Foam::sin(degToRad(maxDeg));
|
||||||
|
|
||||||
const pointField& p = points();
|
const pointField& p = points();
|
||||||
const faceList& fcs = faces();
|
const faceList& fcs = faces();
|
||||||
@ -915,8 +914,7 @@ bool Foam::primitiveMesh::checkFaceAngles
|
|||||||
if (nConcave > 0)
|
if (nConcave > 0)
|
||||||
{
|
{
|
||||||
scalar maxConcaveDegr =
|
scalar maxConcaveDegr =
|
||||||
Foam::asin(Foam::min(1.0, maxEdgeSin))
|
radToDeg(Foam::asin(Foam::min(1.0, maxEdgeSin)));
|
||||||
*180.0/constant::mathematical::pi;
|
|
||||||
|
|
||||||
if (debug || report)
|
if (debug || report)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -200,7 +200,7 @@ bool Foam::primitiveMesh::checkMeshMotion
|
|||||||
) << "Severe non-orthogonality in mesh motion for face "
|
) << "Severe non-orthogonality in mesh motion for face "
|
||||||
<< faceI
|
<< faceI
|
||||||
<< " between cells " << own[faceI] << " and " << nei[faceI]
|
<< " between cells " << own[faceI] << " and " << nei[faceI]
|
||||||
<< ": Angle = " << ::acos(dDotS)/constant::mathematical::pi*180.0
|
<< ": Angle = " << radToDeg(::acos(dDotS))
|
||||||
<< " deg." << endl;
|
<< " deg." << endl;
|
||||||
|
|
||||||
nDotProductErrors++;
|
nDotProductErrors++;
|
||||||
|
|||||||
@ -44,8 +44,7 @@ namespace Foam
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Angle for polys to be considered splitHexes.
|
// Angle for polys to be considered splitHexes.
|
||||||
const Foam::scalar Foam::topoCellLooper::featureCos =
|
const Foam::scalar Foam::topoCellLooper::featureCos = Foam::cos(degToRad(10.0));
|
||||||
Foam::cos(10.0*constant::mathematical::pi/180.0);
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|||||||
@ -192,7 +192,7 @@ Foam::undoableMeshCutter::undoableMeshCutter
|
|||||||
faceRemover_
|
faceRemover_
|
||||||
(
|
(
|
||||||
mesh,
|
mesh,
|
||||||
Foam::cos(30.0/180.0*constant::mathematical::pi)
|
Foam::cos(degToRad(30.0))
|
||||||
)
|
)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|||||||
@ -248,7 +248,7 @@ Foam::scalar Foam::polyMeshGeometry::checkNonOrtho
|
|||||||
<< " between cells " << mesh.faceOwner()[faceI]
|
<< " between cells " << mesh.faceOwner()[faceI]
|
||||||
<< " and " << nei
|
<< " and " << nei
|
||||||
<< ": Angle = "
|
<< ": Angle = "
|
||||||
<< ::acos(dDotS)/constant::mathematical::pi*180.0
|
<< radToDeg(::acos(dDotS))
|
||||||
<< " deg." << endl;
|
<< " deg." << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -269,7 +269,7 @@ Foam::scalar Foam::polyMeshGeometry::checkNonOrtho
|
|||||||
<< " between cells " << mesh.faceOwner()[faceI]
|
<< " between cells " << mesh.faceOwner()[faceI]
|
||||||
<< " and " << nei
|
<< " and " << nei
|
||||||
<< ": Angle = "
|
<< ": Angle = "
|
||||||
<< ::acos(dDotS)/constant::mathematical::pi*180.0
|
<< radToDeg(::acos(dDotS))
|
||||||
<< " deg." << endl;
|
<< " deg." << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -368,8 +368,7 @@ bool Foam::polyMeshGeometry::checkFaceDotProduct
|
|||||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||||
|
|
||||||
// Severe nonorthogonality threshold
|
// Severe nonorthogonality threshold
|
||||||
const scalar severeNonorthogonalityThreshold =
|
const scalar severeNonorthogonalityThreshold = ::cos(degToRad(orthWarn));
|
||||||
::cos(orthWarn/180.0*constant::mathematical::pi);
|
|
||||||
|
|
||||||
|
|
||||||
// Calculate coupled cell centre
|
// Calculate coupled cell centre
|
||||||
@ -504,9 +503,8 @@ bool Foam::polyMeshGeometry::checkFaceDotProduct
|
|||||||
if (nDDotS > 0)
|
if (nDDotS > 0)
|
||||||
{
|
{
|
||||||
Info<< "Mesh non-orthogonality Max: "
|
Info<< "Mesh non-orthogonality Max: "
|
||||||
<< ::acos(minDDotS)/constant::mathematical::pi*180.0
|
<< radToDeg(::acos(minDDotS))
|
||||||
<< " average: " <<
|
<< " average: " << radToDeg(::acos(sumDDotS/nDDotS))
|
||||||
::acos(sumDDotS/nDDotS)/constant::mathematical::pi*180.0
|
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1258,7 +1256,7 @@ bool Foam::polyMeshGeometry::checkFaceAngles
|
|||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
const scalar maxSin = Foam::sin(maxDeg/180.0*constant::mathematical::pi);
|
const scalar maxSin = Foam::sin(degToRad(maxDeg));
|
||||||
|
|
||||||
const faceList& fcs = mesh.faces();
|
const faceList& fcs = mesh.faces();
|
||||||
|
|
||||||
@ -1338,8 +1336,7 @@ bool Foam::polyMeshGeometry::checkFaceAngles
|
|||||||
if (maxEdgeSin > SMALL)
|
if (maxEdgeSin > SMALL)
|
||||||
{
|
{
|
||||||
scalar maxConcaveDegr =
|
scalar maxConcaveDegr =
|
||||||
Foam::asin(Foam::min(1.0, maxEdgeSin))
|
radToDeg(Foam::asin(Foam::min(1.0, maxEdgeSin)));
|
||||||
*180.0/constant::mathematical::pi;
|
|
||||||
|
|
||||||
Info<< "There are " << nConcave
|
Info<< "There are " << nConcave
|
||||||
<< " faces with concave angles between consecutive"
|
<< " faces with concave angles between consecutive"
|
||||||
|
|||||||
@ -123,12 +123,6 @@ bool Foam::engineTime::read()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Foam::scalar Foam::engineTime::degToRad(const scalar deg) const
|
|
||||||
{
|
|
||||||
return constant::mathematical::pi*deg/180.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Foam::scalar Foam::engineTime::degToTime(const scalar theta) const
|
Foam::scalar Foam::engineTime::degToTime(const scalar theta) const
|
||||||
{
|
{
|
||||||
// 6 * rpm => deg/s
|
// 6 * rpm => deg/s
|
||||||
|
|||||||
@ -121,9 +121,6 @@ public:
|
|||||||
|
|
||||||
// Conversion
|
// Conversion
|
||||||
|
|
||||||
//- Convert degrees to radians
|
|
||||||
scalar degToRad(const scalar rad) const;
|
|
||||||
|
|
||||||
//- Convert degrees to seconds (for given engine speed in RPM)
|
//- Convert degrees to seconds (for given engine speed in RPM)
|
||||||
scalar degToTime(const scalar theta) const;
|
scalar degToTime(const scalar theta) const;
|
||||||
|
|
||||||
|
|||||||
@ -345,7 +345,8 @@ void surfaceInterpolation::makeCorrectionVectors() const
|
|||||||
// Calculate the non-orthogonality for meshes with 1 face or more
|
// Calculate the non-orthogonality for meshes with 1 face or more
|
||||||
if (returnReduce(magSf.size(), sumOp<label>()) > 0)
|
if (returnReduce(magSf.size(), sumOp<label>()) > 0)
|
||||||
{
|
{
|
||||||
NonOrthogCoeff =
|
NonOrthogCoeff = radToDeg
|
||||||
|
(
|
||||||
asin
|
asin
|
||||||
(
|
(
|
||||||
min
|
min
|
||||||
@ -353,7 +354,8 @@ void surfaceInterpolation::makeCorrectionVectors() const
|
|||||||
(sum(magSf*mag(corrVecs))/sum(magSf)).value(),
|
(sum(magSf*mag(corrVecs))/sum(magSf)).value(),
|
||||||
1.0
|
1.0
|
||||||
)
|
)
|
||||||
)*180.0/constant::mathematical::pi;
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
|
|||||||
@ -31,5 +31,10 @@ pointPatchFields/derived/oscillatingDisplacement/oscillatingDisplacementPointPat
|
|||||||
pointPatchFields/derived/angularOscillatingDisplacement/angularOscillatingDisplacementPointPatchVectorField.C
|
pointPatchFields/derived/angularOscillatingDisplacement/angularOscillatingDisplacementPointPatchVectorField.C
|
||||||
pointPatchFields/derived/surfaceSlipDisplacement/surfaceSlipDisplacementPointPatchVectorField.C
|
pointPatchFields/derived/surfaceSlipDisplacement/surfaceSlipDisplacementPointPatchVectorField.C
|
||||||
pointPatchFields/derived/surfaceDisplacement/surfaceDisplacementPointPatchVectorField.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
|
LIB = $(FOAM_LIBBIN)/libfvMotionSolvers
|
||||||
|
|||||||
@ -2,10 +2,12 @@ EXE_INC = \
|
|||||||
-I$(LIB_SRC)/triSurface/lnInclude \
|
-I$(LIB_SRC)/triSurface/lnInclude \
|
||||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||||
-I$(LIB_SRC)/dynamicMesh/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 = \
|
LIB_LIBS = \
|
||||||
-ltriSurface \
|
-ltriSurface \
|
||||||
-lmeshTools \
|
-lmeshTools \
|
||||||
-ldynamicMesh \
|
-ldynamicMesh \
|
||||||
-lfiniteVolume
|
-lfiniteVolume \
|
||||||
|
-lforces
|
||||||
|
|||||||
@ -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
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -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
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -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_)));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -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
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -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();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -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()
|
||||||
|
{}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -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
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -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_;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -165,9 +165,8 @@ Foam::multiHoleInjector::~multiHoleInjector()
|
|||||||
|
|
||||||
void Foam::multiHoleInjector::setTangentialVectors()
|
void Foam::multiHoleInjector::setTangentialVectors()
|
||||||
{
|
{
|
||||||
scalar pi180 = constant::mathematical::pi/180.0;
|
scalar alpha = degToRad(xyAngle_);
|
||||||
scalar alpha = xyAngle_*pi180;
|
scalar phi = degToRad(zAngle_);
|
||||||
scalar phi = zAngle_*pi180;
|
|
||||||
|
|
||||||
vector xp(cos(alpha), sin(alpha), 0.0);
|
vector xp(cos(alpha), sin(alpha), 0.0);
|
||||||
vector zp(cos(alpha)*sin(phi), sin(alpha)*sin(phi), cos(phi));
|
vector zp(cos(alpha)*sin(phi), sin(alpha)*sin(phi), cos(phi));
|
||||||
@ -184,11 +183,11 @@ void Foam::multiHoleInjector::setTangentialVectors()
|
|||||||
// Info << "zp = " << zp << endl;
|
// Info << "zp = " << zp << endl;
|
||||||
|
|
||||||
scalar angle = 0.0;
|
scalar angle = 0.0;
|
||||||
scalar u = umbrellaAngle_*pi180/2.0;
|
scalar u = degToRad(umbrellaAngle_/2.0);
|
||||||
for (label i=0; i<nHoles_; i++)
|
for (label i=0; i<nHoles_; i++)
|
||||||
{
|
{
|
||||||
angle += angleSpacing_[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;
|
direction_[i] = cos(v)*sin(u)*xp + sin(v)*sin(u)*yp + cos(u)*zp;
|
||||||
vector dp = direction_[i] - (direction_[i] & zp)*direction_[i];
|
vector dp = direction_[i] - (direction_[i] & zp)*direction_[i];
|
||||||
if (mag(dp) > SMALL)
|
if (mag(dp) > SMALL)
|
||||||
|
|||||||
@ -293,7 +293,7 @@ Foam::spray::spray
|
|||||||
angleOfWedge_ = constant::mathematical::pi - acos(arcCos);
|
angleOfWedge_ = constant::mathematical::pi - acos(arcCos);
|
||||||
|
|
||||||
Info<< "Calculated angle of wedge is "
|
Info<< "Calculated angle of wedge is "
|
||||||
<< angleOfWedge_*180/constant::mathematical::pi << " deg."
|
<< radToDeg(angleOfWedge_) << " deg."
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -110,9 +110,7 @@ scalar blobsSwirlInjector::d0
|
|||||||
|
|
||||||
scalar c = rndGen_.scalar01();
|
scalar c = rndGen_.scalar01();
|
||||||
|
|
||||||
angle_ = coneAngle_[n]/2.0 + c*coneInterval_[n];
|
angle_ = degToRad(coneAngle_[n]/2.0 + c*coneInterval_[n]);
|
||||||
|
|
||||||
angle_ *= constant::mathematical::pi/180.0;
|
|
||||||
|
|
||||||
scalar injectedMassFlow = it.massFlowRate(t);
|
scalar injectedMassFlow = it.massFlowRate(t);
|
||||||
|
|
||||||
|
|||||||
@ -2480,10 +2480,10 @@ void Foam::autoLayerDriver::mergePatchFacesUndo
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
scalar minCos =
|
scalar minCos =
|
||||||
Foam::cos(layerParams.featureAngle()*constant::mathematical::pi/180.0);
|
Foam::cos(degToRad(layerParams.featureAngle()));
|
||||||
|
|
||||||
scalar concaveCos =
|
scalar concaveCos =
|
||||||
Foam::cos(layerParams.concaveAngle()*constant::mathematical::pi/180.0);
|
Foam::cos(degToRad(layerParams.concaveAngle()));
|
||||||
|
|
||||||
Info<< nl
|
Info<< nl
|
||||||
<< "Merging all faces of a cell" << nl
|
<< "Merging all faces of a cell" << nl
|
||||||
@ -2602,7 +2602,7 @@ void Foam::autoLayerDriver::addLayers
|
|||||||
(
|
(
|
||||||
pp,
|
pp,
|
||||||
meshEdges,
|
meshEdges,
|
||||||
layerParams.featureAngle()*constant::mathematical::pi/180.0,
|
degToRad(layerParams.featureAngle()),
|
||||||
|
|
||||||
patchDisp,
|
patchDisp,
|
||||||
patchNLayers,
|
patchNLayers,
|
||||||
|
|||||||
@ -681,8 +681,8 @@ void Foam::autoRefineDriver::mergePatchFaces
|
|||||||
|
|
||||||
meshRefiner_.mergePatchFaces
|
meshRefiner_.mergePatchFaces
|
||||||
(
|
(
|
||||||
Foam::cos(45*constant::mathematical::pi/180.0),
|
Foam::cos(degToRad(45.0)),
|
||||||
Foam::cos(45*constant::mathematical::pi/180.0),
|
Foam::cos(degToRad(45.0)),
|
||||||
meshRefiner_.meshedPatches()
|
meshRefiner_.meshedPatches()
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -691,7 +691,7 @@ void Foam::autoRefineDriver::mergePatchFaces
|
|||||||
meshRefiner_.checkData();
|
meshRefiner_.checkData();
|
||||||
}
|
}
|
||||||
|
|
||||||
meshRefiner_.mergeEdges(Foam::cos(45*constant::mathematical::pi/180.0));
|
meshRefiner_.mergeEdges(Foam::cos(degToRad(45.0)));
|
||||||
|
|
||||||
if (debug)
|
if (debug)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -192,7 +192,7 @@ Foam::layerParameters::layerParameters
|
|||||||
),
|
),
|
||||||
layerTerminationCos_
|
layerTerminationCos_
|
||||||
(
|
(
|
||||||
Foam::cos(0.5*featureAngle_*constant::mathematical::pi/180.0)
|
Foam::cos(degToRad(0.5*featureAngle_))
|
||||||
),
|
),
|
||||||
maxThicknessToMedialRatio_
|
maxThicknessToMedialRatio_
|
||||||
(
|
(
|
||||||
@ -200,8 +200,7 @@ Foam::layerParameters::layerParameters
|
|||||||
),
|
),
|
||||||
minMedianAxisAngleCos_
|
minMedianAxisAngleCos_
|
||||||
(
|
(
|
||||||
Foam::cos(readScalar(dict.lookup("minMedianAxisAngle")))
|
Foam::cos(degToRad(readScalar(dict.lookup("minMedianAxisAngle"))))
|
||||||
*constant::mathematical::pi/180.0
|
|
||||||
),
|
),
|
||||||
nBufferCellsNoExtrude_
|
nBufferCellsNoExtrude_
|
||||||
(
|
(
|
||||||
@ -269,7 +268,7 @@ Foam::layerParameters::layerParameters
|
|||||||
),
|
),
|
||||||
layerTerminationCos_
|
layerTerminationCos_
|
||||||
(
|
(
|
||||||
Foam::cos(0.5*featureAngle_*constant::mathematical::pi/180.0)
|
Foam::cos(degToRad(0.5*featureAngle_))
|
||||||
),
|
),
|
||||||
maxThicknessToMedialRatio_
|
maxThicknessToMedialRatio_
|
||||||
(
|
(
|
||||||
@ -277,8 +276,7 @@ Foam::layerParameters::layerParameters
|
|||||||
),
|
),
|
||||||
minMedianAxisAngleCos_
|
minMedianAxisAngleCos_
|
||||||
(
|
(
|
||||||
Foam::cos(readScalar(dict.lookup("minMedianAxisAngle")))
|
Foam::cos(degToRad(readScalar(dict.lookup("minMedianAxisAngle"))))
|
||||||
*constant::mathematical::pi/180.0
|
|
||||||
),
|
),
|
||||||
nBufferCellsNoExtrude_
|
nBufferCellsNoExtrude_
|
||||||
(
|
(
|
||||||
|
|||||||
@ -65,7 +65,7 @@ Foam::refinementParameters::refinementParameters(const dictionary& dict)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
curvature_ = Foam::cos(featAngle*constant::mathematical::pi/180.0);
|
curvature_ = Foam::cos(degToRad(featAngle));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -247,7 +247,7 @@ Foam::Map<Foam::label> Foam::meshRefinement::findEdgeConnectedProblemCells
|
|||||||
nearestRegion[i]
|
nearestRegion[i]
|
||||||
);
|
);
|
||||||
|
|
||||||
scalar angle = perpendicularAngle[region]/180.0*constant::mathematical::pi;
|
scalar angle = degToRad(perpendicularAngle[region]);
|
||||||
|
|
||||||
if (angle >= 0)
|
if (angle >= 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -72,12 +72,12 @@ Foam::cylindricalCS Foam::arcEdge::calcAngle()
|
|||||||
|
|
||||||
// find angles
|
// find angles
|
||||||
scalar tmp = (r3&r1)/(mag(r3)*mag(r1));
|
scalar tmp = (r3&r1)/(mag(r3)*mag(r1));
|
||||||
angle_ = acos(tmp)*180.0/constant::mathematical::pi;
|
angle_ = radToDeg(acos(tmp));
|
||||||
|
|
||||||
// check if the vectors define an exterior or an interior arcEdge
|
// check if the vectors define an exterior or an interior arcEdge
|
||||||
if (((r1 ^ r2)&(r1 ^ r3)) < 0.0)
|
if (((r1 ^ r2)&(r1 ^ r3)) < 0.0)
|
||||||
{
|
{
|
||||||
angle_ = 360 - angle_;
|
angle_ = 360.0 - angle_;
|
||||||
}
|
}
|
||||||
|
|
||||||
vector tempAxis;
|
vector tempAxis;
|
||||||
@ -159,7 +159,7 @@ Foam::vector Foam::arcEdge::position(const scalar lambda) const
|
|||||||
|
|
||||||
Foam::scalar Foam::arcEdge::length() const
|
Foam::scalar Foam::arcEdge::length() const
|
||||||
{
|
{
|
||||||
return angle_*radius_*constant::mathematical::pi/180.0;
|
return degToRad(angle_*radius_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -66,8 +66,7 @@ Foam::tmp<Foam::scalarField> Foam::cellQuality::nonOrthogonality() const
|
|||||||
scalar magS = mag(s);
|
scalar magS = mag(s);
|
||||||
|
|
||||||
scalar cosDDotS =
|
scalar cosDDotS =
|
||||||
Foam::acos(min(1.0, (d & s)/(mag(d)*magS + VSMALL)))
|
radToDeg(Foam::acos(min(1.0, (d & s)/(mag(d)*magS + VSMALL))));
|
||||||
*180.0/constant::mathematical::pi;
|
|
||||||
|
|
||||||
result[own[faceI]] = max(cosDDotS, result[own[faceI]]);
|
result[own[faceI]] = max(cosDDotS, result[own[faceI]]);
|
||||||
|
|
||||||
@ -92,8 +91,7 @@ Foam::tmp<Foam::scalarField> Foam::cellQuality::nonOrthogonality() const
|
|||||||
scalar magS = mag(s);
|
scalar magS = mag(s);
|
||||||
|
|
||||||
scalar cosDDotS =
|
scalar cosDDotS =
|
||||||
Foam::acos(min(1.0, (d & s)/(mag(d)*magS + VSMALL)))
|
radToDeg(Foam::acos(min(1.0, (d & s)/(mag(d)*magS + VSMALL))));
|
||||||
*180.0/constant::mathematical::pi;
|
|
||||||
|
|
||||||
result[faceCells[faceI]] = max(cosDDotS, result[faceCells[faceI]]);
|
result[faceCells[faceI]] = max(cosDDotS, result[faceCells[faceI]]);
|
||||||
}
|
}
|
||||||
@ -207,8 +205,7 @@ Foam::tmp<Foam::scalarField> Foam::cellQuality::faceNonOrthogonality() const
|
|||||||
scalar magS = mag(s);
|
scalar magS = mag(s);
|
||||||
|
|
||||||
scalar cosDDotS =
|
scalar cosDDotS =
|
||||||
Foam::acos(min(1.0, (d & s)/(mag(d)*magS + VSMALL)))
|
radToDeg(Foam::acos(min(1.0, (d & s)/(mag(d)*magS + VSMALL))));
|
||||||
*180.0/constant::mathematical::pi;
|
|
||||||
|
|
||||||
result[faceI] = cosDDotS;
|
result[faceI] = cosDDotS;
|
||||||
}
|
}
|
||||||
@ -233,8 +230,7 @@ Foam::tmp<Foam::scalarField> Foam::cellQuality::faceNonOrthogonality() const
|
|||||||
scalar magS = mag(s);
|
scalar magS = mag(s);
|
||||||
|
|
||||||
scalar cosDDotS =
|
scalar cosDDotS =
|
||||||
Foam::acos(min(1.0, (d & s)/(mag(d)*magS + VSMALL)))
|
radToDeg(Foam::acos(min(1.0, (d & s)/(mag(d)*magS + VSMALL))));
|
||||||
*180.0/constant::mathematical::pi;
|
|
||||||
|
|
||||||
result[globalFaceI++] = cosDDotS;
|
result[globalFaceI++] = cosDDotS;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -72,8 +72,8 @@ Foam::vector Foam::toroidalCS::localToGlobal
|
|||||||
) const
|
) const
|
||||||
{
|
{
|
||||||
// Notation: r = local.x()
|
// Notation: r = local.x()
|
||||||
scalar theta = local.y()*constant::mathematical::pi/180.0;
|
scalar theta = degToRad(local.y());
|
||||||
scalar phi = local.z()*constant::mathematical::pi/180.0;
|
scalar phi = degToRad(local.z());
|
||||||
|
|
||||||
scalar rprime = radius_ + local.x()*sin(phi);
|
scalar rprime = radius_ + local.x()*sin(phi);
|
||||||
|
|
||||||
|
|||||||
@ -271,8 +271,7 @@ bool Foam::primitiveMeshGeometry::checkFaceDotProduct
|
|||||||
const labelList& nei = mesh.faceNeighbour();
|
const labelList& nei = mesh.faceNeighbour();
|
||||||
|
|
||||||
// Severe nonorthogonality threshold
|
// Severe nonorthogonality threshold
|
||||||
const scalar severeNonorthogonalityThreshold =
|
const scalar severeNonorthogonalityThreshold = ::cos(degToRad(orthWarn));
|
||||||
::cos(orthWarn/180.0*constant::mathematical::pi);
|
|
||||||
|
|
||||||
scalar minDDotS = GREAT;
|
scalar minDDotS = GREAT;
|
||||||
|
|
||||||
@ -303,8 +302,7 @@ bool Foam::primitiveMeshGeometry::checkFaceDotProduct
|
|||||||
Pout<< "Severe non-orthogonality for face " << faceI
|
Pout<< "Severe non-orthogonality for face " << faceI
|
||||||
<< " between cells " << own[faceI]
|
<< " between cells " << own[faceI]
|
||||||
<< " and " << nei[faceI]
|
<< " and " << nei[faceI]
|
||||||
<< ": Angle = "
|
<< ": Angle = " << radToDeg(::acos(dDotS))
|
||||||
<< ::acos(dDotS)/constant::mathematical::pi*180.0
|
|
||||||
<< " deg." << endl;
|
<< " deg." << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -329,8 +327,7 @@ bool Foam::primitiveMeshGeometry::checkFaceDotProduct
|
|||||||
<< faceI
|
<< faceI
|
||||||
<< " between cells " << own[faceI] << " and "
|
<< " between cells " << own[faceI] << " and "
|
||||||
<< nei[faceI]
|
<< nei[faceI]
|
||||||
<< ": Angle = "
|
<< ": Angle = " << radToDeg(::acos(dDotS))
|
||||||
<< ::acos(dDotS)/constant::mathematical::pi*180.0
|
|
||||||
<< " deg." << endl;
|
<< " deg." << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -376,9 +373,8 @@ bool Foam::primitiveMeshGeometry::checkFaceDotProduct
|
|||||||
if (neiSize > 0)
|
if (neiSize > 0)
|
||||||
{
|
{
|
||||||
Info<< "Mesh non-orthogonality Max: "
|
Info<< "Mesh non-orthogonality Max: "
|
||||||
<< ::acos(minDDotS)/constant::mathematical::pi*180.0
|
<< radToDeg(::acos(minDDotS))
|
||||||
<< " average: " <<
|
<< " average: " << radToDeg(::acos(sumDDotS/neiSize))
|
||||||
::acos(sumDDotS/neiSize)/constant::mathematical::pi*180.0
|
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -780,7 +776,7 @@ bool Foam::primitiveMeshGeometry::checkFaceAngles
|
|||||||
<< abort(FatalError);
|
<< abort(FatalError);
|
||||||
}
|
}
|
||||||
|
|
||||||
const scalar maxSin = Foam::sin(maxDeg/180.0*constant::mathematical::pi);
|
const scalar maxSin = Foam::sin(degToRad(maxDeg));
|
||||||
|
|
||||||
const faceList& fcs = mesh.faces();
|
const faceList& fcs = mesh.faces();
|
||||||
|
|
||||||
@ -860,8 +856,7 @@ bool Foam::primitiveMeshGeometry::checkFaceAngles
|
|||||||
if (maxEdgeSin > SMALL)
|
if (maxEdgeSin > SMALL)
|
||||||
{
|
{
|
||||||
scalar maxConcaveDegr =
|
scalar maxConcaveDegr =
|
||||||
Foam::asin(Foam::min(1.0, maxEdgeSin))
|
radToDeg(Foam::asin(Foam::min(1.0, maxEdgeSin)));
|
||||||
*180.0/constant::mathematical::pi;
|
|
||||||
|
|
||||||
Info<< "There are " << nConcave
|
Info<< "There are " << nConcave
|
||||||
<< " faces with concave angles between consecutive"
|
<< " faces with concave angles between consecutive"
|
||||||
|
|||||||
@ -56,8 +56,7 @@ Foam::topoSetSource::addToUsageTable Foam::shapeToCell::usage_
|
|||||||
|
|
||||||
|
|
||||||
// Angle for polys to be considered splitHexes.
|
// Angle for polys to be considered splitHexes.
|
||||||
Foam::scalar Foam::shapeToCell::featureCos =
|
Foam::scalar Foam::shapeToCell::featureCos = Foam::cos(degToRad(10.0));
|
||||||
Foam::cos(10.0*Foam::constant::mathematical::pi/180.0);
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|||||||
@ -43,8 +43,7 @@ License
|
|||||||
|
|
||||||
defineTypeNameAndDebug(Foam::edgeIntersections, 0);
|
defineTypeNameAndDebug(Foam::edgeIntersections, 0);
|
||||||
|
|
||||||
Foam::scalar Foam::edgeIntersections::alignedCos_ =
|
Foam::scalar Foam::edgeIntersections::alignedCos_ = Foam::cos(degToRad(89.0));
|
||||||
Foam::cos(89.0*Foam::constant::mathematical::pi/180.0);
|
|
||||||
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|||||||
@ -490,8 +490,7 @@ Foam::labelList Foam::surfaceFeatures::selectFeatureEdges
|
|||||||
|
|
||||||
void Foam::surfaceFeatures::findFeatures(const scalar includedAngle)
|
void Foam::surfaceFeatures::findFeatures(const scalar includedAngle)
|
||||||
{
|
{
|
||||||
scalar minCos =
|
scalar minCos = Foam::cos(degToRad(180.0 - includedAngle));
|
||||||
Foam::cos((180.0 - includedAngle)*constant::mathematical::pi/180.0);
|
|
||||||
|
|
||||||
const labelListList& edgeFaces = surf_.edgeFaces();
|
const labelListList& edgeFaces = surf_.edgeFaces();
|
||||||
const vectorField& faceNormals = surf_.faceNormals();
|
const vectorField& faceNormals = surf_.faceNormals();
|
||||||
|
|||||||
@ -128,7 +128,7 @@ int main(int argc, char *argv[])
|
|||||||
fileName pointsFile(runTime.constantPath()/"points.tmp");
|
fileName pointsFile(runTime.constantPath()/"points.tmp");
|
||||||
OFstream pFile(pointsFile);
|
OFstream pFile(pointsFile);
|
||||||
|
|
||||||
scalar a(0.1*constant::mathematical::pi/180.0);
|
scalar a(degToRad(0.1));
|
||||||
tensor rotateZ =
|
tensor rotateZ =
|
||||||
tensor
|
tensor
|
||||||
(
|
(
|
||||||
|
|||||||
10
tutorials/multiphase/interDyMFoam/ras/floatingObject/Allclean
Executable file
10
tutorials/multiphase/interDyMFoam/ras/floatingObject/Allclean
Executable file
@ -0,0 +1,10 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Source tutorial clean functions
|
||||||
|
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
|
||||||
|
|
||||||
|
rm system/cellSetDict > /dev/null 2>&1
|
||||||
|
rm -rf 0 > /dev/null 2>&1
|
||||||
|
|
||||||
|
cleanCase
|
||||||
|
|
||||||
27
tutorials/multiphase/interDyMFoam/ras/floatingObject/Allrun
Executable file
27
tutorials/multiphase/interDyMFoam/ras/floatingObject/Allrun
Executable file
@ -0,0 +1,27 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Source tutorial run functions
|
||||||
|
. $WM_PROJECT_DIR/bin/tools/RunFunctions
|
||||||
|
|
||||||
|
# Set application name
|
||||||
|
application="interDyMFoam"
|
||||||
|
|
||||||
|
makeMeshByCellSet()
|
||||||
|
{
|
||||||
|
while [ $# -ge 1 ]
|
||||||
|
do
|
||||||
|
echo "Running cellSet operation $1"
|
||||||
|
cp system/cellSetDict.$1 system/cellSetDict
|
||||||
|
cellSet > log.cellSet.$1 2>&1
|
||||||
|
shift
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
runApplication blockMesh
|
||||||
|
makeMeshByCellSet 1 2
|
||||||
|
runApplication subsetMesh -overwrite c0 -patch floatingObject
|
||||||
|
cp -r 0.orig 0 > /dev/null 2>&1
|
||||||
|
runApplication setFields
|
||||||
|
runApplication $application
|
||||||
|
|
||||||
|
# -----------------------------------------------------------------------------
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: 1.6 |
|
||||||
|
| \\ / A nd | Web: www.OpenFOAM.org |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class dictionary;
|
||||||
|
location "constant";
|
||||||
|
object RASProperties;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
RASModel kEpsilon;
|
||||||
|
|
||||||
|
turbulence on;
|
||||||
|
|
||||||
|
printCoeffs on;
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,26 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: 1.6 |
|
||||||
|
| \\ / A nd | Web: http://www.OpenFOAM.org |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class dictionary;
|
||||||
|
object motionProperties;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
dynamicFvMesh dynamicMotionSolverFvMesh;
|
||||||
|
|
||||||
|
motionSolverLibs ("libfvMotionSolvers.so");
|
||||||
|
|
||||||
|
solver displacementLaplacian;
|
||||||
|
|
||||||
|
diffusivity inverseDistance (floatingObject);
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,22 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: 1.6 |
|
||||||
|
| \\ / A nd | Web: www.OpenFOAM.org |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class uniformDimensionedVectorField;
|
||||||
|
location "constant";
|
||||||
|
object g;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
dimensions [0 1 -2 0 0 0 0];
|
||||||
|
value ( 0 0 -9.81 );
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,62 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: 1.6 |
|
||||||
|
| \\ / A nd | Web: http://www.OpenFOAM.org |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class dictionary;
|
||||||
|
object blockMeshDict;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
convertToMeters 1;
|
||||||
|
|
||||||
|
vertices
|
||||||
|
(
|
||||||
|
(0 0 0)
|
||||||
|
(1 0 0)
|
||||||
|
(1 1 0)
|
||||||
|
(0 1 0)
|
||||||
|
(0 0 1)
|
||||||
|
(1 0 1)
|
||||||
|
(1 1 1)
|
||||||
|
(0 1 1)
|
||||||
|
);
|
||||||
|
|
||||||
|
blocks
|
||||||
|
(
|
||||||
|
hex (0 1 2 3 4 5 6 7) (40 40 60) simpleGrading (1 1 1)
|
||||||
|
);
|
||||||
|
|
||||||
|
edges
|
||||||
|
(
|
||||||
|
);
|
||||||
|
|
||||||
|
patches
|
||||||
|
(
|
||||||
|
wall stationaryWalls
|
||||||
|
(
|
||||||
|
(0 3 2 1)
|
||||||
|
(2 6 5 1)
|
||||||
|
(1 5 4 0)
|
||||||
|
(3 7 6 2)
|
||||||
|
(0 4 7 3)
|
||||||
|
)
|
||||||
|
patch atmosphere
|
||||||
|
(
|
||||||
|
(4 5 6 7)
|
||||||
|
)
|
||||||
|
wall floatingObject
|
||||||
|
()
|
||||||
|
);
|
||||||
|
|
||||||
|
mergePatchPairs
|
||||||
|
(
|
||||||
|
);
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,40 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: 1.6.x |
|
||||||
|
| \\ / A nd | Web: www.OpenFOAM.org |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class polyBoundaryMesh;
|
||||||
|
location "constant/polyMesh";
|
||||||
|
object boundary;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
3
|
||||||
|
(
|
||||||
|
stationaryWalls
|
||||||
|
{
|
||||||
|
type wall;
|
||||||
|
nFaces 11200;
|
||||||
|
startFace 277808;
|
||||||
|
}
|
||||||
|
atmosphere
|
||||||
|
{
|
||||||
|
type patch;
|
||||||
|
nFaces 1600;
|
||||||
|
startFace 289008;
|
||||||
|
}
|
||||||
|
floatingObject
|
||||||
|
{
|
||||||
|
type wall;
|
||||||
|
nFaces 672;
|
||||||
|
startFace 290608;
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,35 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: 1.6 |
|
||||||
|
| \\ / A nd | Web: www.OpenFOAM.org |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class dictionary;
|
||||||
|
location "constant";
|
||||||
|
object transportProperties;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
phase1
|
||||||
|
{
|
||||||
|
transportModel Newtonian;
|
||||||
|
nu nu [ 0 2 -1 0 0 0 0 ] 1e-06;
|
||||||
|
rho rho [ 1 -3 0 0 0 0 0 ] 998.2;
|
||||||
|
}
|
||||||
|
|
||||||
|
phase2
|
||||||
|
{
|
||||||
|
transportModel Newtonian;
|
||||||
|
nu nu [ 0 2 -1 0 0 0 0 ] 1.48e-05;
|
||||||
|
rho rho [ 1 -3 0 0 0 0 0 ] 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
sigma sigma [ 1 0 -2 0 0 0 0 ] 0;
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,20 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: 1.6 |
|
||||||
|
| \\ / A nd | Web: www.OpenFOAM.org |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class dictionary;
|
||||||
|
location "constant";
|
||||||
|
object turbulenceProperties;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
simulationType RASModel;
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,30 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: 1.6 |
|
||||||
|
| \\ / A nd | Web: http://www.OpenFOAM.org |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class dictionary;
|
||||||
|
object cellSetDict;
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
name c0;
|
||||||
|
|
||||||
|
action new;
|
||||||
|
|
||||||
|
topoSetSources
|
||||||
|
(
|
||||||
|
boxToCell
|
||||||
|
{
|
||||||
|
box (0.35 0.35 0.44) (0.65 0.65 0.56);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: 1.6 |
|
||||||
|
| \\ / A nd | Web: http://www.OpenFOAM.org |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class dictionary;
|
||||||
|
object cellSetDict;
|
||||||
|
}
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
name c0;
|
||||||
|
|
||||||
|
action invert;
|
||||||
|
|
||||||
|
topoSetSources ();
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,56 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: 1.6 |
|
||||||
|
| \\ / A nd | Web: www.OpenFOAM.org |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class dictionary;
|
||||||
|
location "system";
|
||||||
|
object controlDict;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
application interDyMFoam;
|
||||||
|
|
||||||
|
startFrom startTime;
|
||||||
|
|
||||||
|
startTime 0;
|
||||||
|
|
||||||
|
stopAt endTime;
|
||||||
|
|
||||||
|
endTime 6;
|
||||||
|
|
||||||
|
deltaT 0.01;
|
||||||
|
|
||||||
|
writeControl adjustableRunTime;
|
||||||
|
|
||||||
|
writeInterval 0.025;
|
||||||
|
|
||||||
|
purgeWrite 0;
|
||||||
|
|
||||||
|
writeFormat ascii;
|
||||||
|
|
||||||
|
writePrecision 12;
|
||||||
|
|
||||||
|
writeCompression uncompressed;
|
||||||
|
|
||||||
|
timeFormat general;
|
||||||
|
|
||||||
|
timePrecision 6;
|
||||||
|
|
||||||
|
runTimeModifiable yes;
|
||||||
|
|
||||||
|
adjustTimeStep yes;
|
||||||
|
|
||||||
|
maxCo 0.2;
|
||||||
|
|
||||||
|
maxDeltaT 0.025;
|
||||||
|
|
||||||
|
libs ("libincompressibleRASModels.so" "libfvMotionSolvers.so");
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,50 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: 1.6 |
|
||||||
|
| \\ / A nd | Web: www.OpenFOAM.org |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class dictionary;
|
||||||
|
location "system";
|
||||||
|
object decomposeParDict;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
numberOfSubdomains 4;
|
||||||
|
|
||||||
|
method hierarchical;
|
||||||
|
|
||||||
|
simpleCoeffs
|
||||||
|
{
|
||||||
|
n ( 2 2 1 );
|
||||||
|
delta 0.001;
|
||||||
|
}
|
||||||
|
|
||||||
|
hierarchicalCoeffs
|
||||||
|
{
|
||||||
|
n ( 2 2 1 );
|
||||||
|
delta 0.001;
|
||||||
|
order xyz;
|
||||||
|
}
|
||||||
|
|
||||||
|
metisCoeffs
|
||||||
|
{
|
||||||
|
processorWeights ( 1 1 1 1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
manualCoeffs
|
||||||
|
{
|
||||||
|
dataFile "";
|
||||||
|
}
|
||||||
|
|
||||||
|
distributed no;
|
||||||
|
|
||||||
|
roots ( );
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,61 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: 1.6 |
|
||||||
|
| \\ / A nd | Web: www.OpenFOAM.org |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class dictionary;
|
||||||
|
location "system";
|
||||||
|
object fvSchemes;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
ddtSchemes
|
||||||
|
{
|
||||||
|
default Euler;
|
||||||
|
}
|
||||||
|
|
||||||
|
gradSchemes
|
||||||
|
{
|
||||||
|
default Gauss linear;
|
||||||
|
}
|
||||||
|
|
||||||
|
divSchemes
|
||||||
|
{
|
||||||
|
div(rho*phi,U) Gauss vanLeerV;
|
||||||
|
div(phi,alpha) Gauss vanLeer;
|
||||||
|
div(phirb,alpha) Gauss vanLeer;
|
||||||
|
div(phi,k) Gauss upwind;
|
||||||
|
div(phi,epsilon) Gauss upwind;
|
||||||
|
}
|
||||||
|
|
||||||
|
laplacianSchemes
|
||||||
|
{
|
||||||
|
default Gauss linear corrected;
|
||||||
|
}
|
||||||
|
|
||||||
|
interpolationSchemes
|
||||||
|
{
|
||||||
|
default linear;
|
||||||
|
}
|
||||||
|
|
||||||
|
snGradSchemes
|
||||||
|
{
|
||||||
|
default corrected;
|
||||||
|
}
|
||||||
|
|
||||||
|
fluxRequired
|
||||||
|
{
|
||||||
|
default no;
|
||||||
|
p;
|
||||||
|
pcorr;
|
||||||
|
alpha;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,129 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: 1.6 |
|
||||||
|
| \\ / A nd | Web: www.OpenFOAM.org |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class dictionary;
|
||||||
|
location "system";
|
||||||
|
object fvSolution;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
solvers
|
||||||
|
{
|
||||||
|
cellDisplacement
|
||||||
|
{
|
||||||
|
solver GAMG;
|
||||||
|
tolerance 1e-08;
|
||||||
|
relTol 0;
|
||||||
|
smoother GaussSeidel;
|
||||||
|
cacheAgglomeration true;
|
||||||
|
nCellsInCoarsestLevel 10;
|
||||||
|
agglomerator faceAreaPair;
|
||||||
|
mergeLevels 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
pcorr
|
||||||
|
{
|
||||||
|
solver PCG;
|
||||||
|
preconditioner
|
||||||
|
{
|
||||||
|
preconditioner GAMG;
|
||||||
|
tolerance 1e-05;
|
||||||
|
relTol 0;
|
||||||
|
smoother DICGaussSeidel;
|
||||||
|
nPreSweeps 0;
|
||||||
|
nPostSweeps 2;
|
||||||
|
nBottomSweeps 2;
|
||||||
|
cacheAgglomeration false;
|
||||||
|
nCellsInCoarsestLevel 10;
|
||||||
|
agglomerator faceAreaPair;
|
||||||
|
mergeLevels 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
tolerance 1e-05;
|
||||||
|
relTol 0;
|
||||||
|
maxIter 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
p
|
||||||
|
{
|
||||||
|
solver GAMG;
|
||||||
|
tolerance 1e-08;
|
||||||
|
relTol 0.01;
|
||||||
|
smoother DIC;
|
||||||
|
nPreSweeps 0;
|
||||||
|
nPostSweeps 2;
|
||||||
|
nFinestSweeps 2;
|
||||||
|
cacheAgglomeration true;
|
||||||
|
nCellsInCoarsestLevel 10;
|
||||||
|
agglomerator faceAreaPair;
|
||||||
|
mergeLevels 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
pFinal
|
||||||
|
{
|
||||||
|
solver PCG;
|
||||||
|
preconditioner
|
||||||
|
{
|
||||||
|
preconditioner GAMG;
|
||||||
|
tolerance 2e-09;
|
||||||
|
relTol 0;
|
||||||
|
nVcycles 2;
|
||||||
|
smoother DICGaussSeidel;
|
||||||
|
nPreSweeps 2;
|
||||||
|
nPostSweeps 2;
|
||||||
|
nFinestSweeps 2;
|
||||||
|
cacheAgglomeration true;
|
||||||
|
nCellsInCoarsestLevel 10;
|
||||||
|
agglomerator faceAreaPair;
|
||||||
|
mergeLevels 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
tolerance 2e-09;
|
||||||
|
relTol 0;
|
||||||
|
maxIter 20;
|
||||||
|
}
|
||||||
|
|
||||||
|
U
|
||||||
|
{
|
||||||
|
solver smoothSolver;
|
||||||
|
smoother GaussSeidel;
|
||||||
|
tolerance 1e-06;
|
||||||
|
relTol 0;
|
||||||
|
nSweeps 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
"(k|epsilon|R|nuTilda)"
|
||||||
|
{
|
||||||
|
$U;
|
||||||
|
tolerance 1e-08;
|
||||||
|
relTol 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
PISO
|
||||||
|
{
|
||||||
|
momentumPredictor no;
|
||||||
|
nCorrectors 2;
|
||||||
|
nNonOrthogonalCorrectors 0;
|
||||||
|
nAlphaCorr 1;
|
||||||
|
nAlphaSubCycles 1;
|
||||||
|
cAlpha 1.5;
|
||||||
|
correctPhi no;
|
||||||
|
}
|
||||||
|
|
||||||
|
relaxationFactors
|
||||||
|
{
|
||||||
|
U 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
@ -0,0 +1,39 @@
|
|||||||
|
/*--------------------------------*- C++ -*----------------------------------*\
|
||||||
|
| ========= | |
|
||||||
|
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||||
|
| \\ / O peration | Version: 1.6 |
|
||||||
|
| \\ / A nd | Web: www.OpenFOAM.org |
|
||||||
|
| \\/ M anipulation | |
|
||||||
|
\*---------------------------------------------------------------------------*/
|
||||||
|
FoamFile
|
||||||
|
{
|
||||||
|
version 2.0;
|
||||||
|
format ascii;
|
||||||
|
class dictionary;
|
||||||
|
location "system";
|
||||||
|
object setFieldsDict;
|
||||||
|
}
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
defaultFieldValues
|
||||||
|
(
|
||||||
|
volScalarFieldValue alpha1 0
|
||||||
|
);
|
||||||
|
|
||||||
|
regions
|
||||||
|
(
|
||||||
|
boxToCell
|
||||||
|
{
|
||||||
|
box ( -100 -100 -100 ) ( 100 100 0.5368 );
|
||||||
|
fieldValues ( volScalarFieldValue alpha1 1 );
|
||||||
|
}
|
||||||
|
|
||||||
|
boxToCell
|
||||||
|
{
|
||||||
|
box ( 0.7 0.8 -100 ) ( 100 100 0.65 );
|
||||||
|
fieldValues ( volScalarFieldValue alpha1 1 );
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
// ************************************************************************* //
|
||||||
Reference in New Issue
Block a user