diff --git a/applications/test/fieldDependency/Make/files b/applications/test/fieldDependency/Make/files new file mode 100644 index 0000000000000000000000000000000000000000..98fd335a17af51235e92f8cfcd0511bf1e1b31a9 --- /dev/null +++ b/applications/test/fieldDependency/Make/files @@ -0,0 +1,3 @@ +fieldDependency.C + +EXE = $(FOAM_USER_APPBIN)/fieldDependency diff --git a/applications/test/fieldDependency/Make/options b/applications/test/fieldDependency/Make/options new file mode 100644 index 0000000000000000000000000000000000000000..fa15f124528ebfcaf279a88a73a0d7954f2e9dc1 --- /dev/null +++ b/applications/test/fieldDependency/Make/options @@ -0,0 +1,5 @@ +EXE_INC = \ + -I$(LIB_SRC)/finiteVolume/lnInclude + +EXE_LIBS = \ + -lfiniteVolume diff --git a/applications/test/fieldDependency/fieldDependency.C b/applications/test/fieldDependency/fieldDependency.C new file mode 100644 index 0000000000000000000000000000000000000000..fa3c7b2e86a48989315a0b914666cc4ebd6ecec5 --- /dev/null +++ b/applications/test/fieldDependency/fieldDependency.C @@ -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; +} + + +// ************************************************************************* // diff --git a/applications/utilities/mesh/advanced/combinePatchFaces/combinePatchFaces.C b/applications/utilities/mesh/advanced/combinePatchFaces/combinePatchFaces.C index 54fd1bdf4ff208d9bb10456b2fdc1b70391bddc8..d16f4f23cce3bcde783777e001f9310a0d426bd6 100644 --- a/applications/utilities/mesh/advanced/combinePatchFaces/combinePatchFaces.C +++ b/applications/utilities/mesh/advanced/combinePatchFaces/combinePatchFaces.C @@ -445,12 +445,12 @@ int main(int argc, char *argv[]) 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; 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 overwrite = args.optionFound("overwrite"); diff --git a/applications/utilities/mesh/advanced/splitCells/splitCells.C b/applications/utilities/mesh/advanced/splitCells/splitCells.C index c83ab27583cf69bea1709c15bde09a17ff3cffc8..f9f47c815a90fb4bda00ac188b5328fbec46bb62 100644 --- a/applications/utilities/mesh/advanced/splitCells/splitCells.C +++ b/applications/utilities/mesh/advanced/splitCells/splitCells.C @@ -539,9 +539,8 @@ int main(int argc, char *argv[]) scalar featureAngle(readScalar(IStringStream(args.additionalArgs()[0])())); - scalar radAngle = featureAngle*constant::mathematical::pi/180.0; - scalar minCos = Foam::cos(radAngle); - scalar minSin = Foam::sin(radAngle); + scalar minCos = Foam::cos(degToRad(featureAngle)); + scalar minSin = Foam::sin(degToRad(featureAngle)); bool readSet = args.optionFound("set"); bool geometry = args.optionFound("geometry"); diff --git a/applications/utilities/mesh/conversion/kivaToFoam/readKivaGrid.H b/applications/utilities/mesh/conversion/kivaToFoam/readKivaGrid.H index 9ed5e27004f9543efa8a55e574120435d1b8cd16..ba2b615df18aa7cc6b32de4133ae0d65be446987 100644 --- a/applications/utilities/mesh/conversion/kivaToFoam/readKivaGrid.H +++ b/applications/utilities/mesh/conversion/kivaToFoam/readKivaGrid.H @@ -434,7 +434,7 @@ if (pFaces[WEDGE].size() && pFaces[WEDGE][0].size()) { // 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 iterb = pFaces[WEDGE][1].begin(); diff --git a/applications/utilities/mesh/conversion/polyDualMesh/polyDualMeshApp.C b/applications/utilities/mesh/conversion/polyDualMesh/polyDualMeshApp.C index 740b87a391764df9a6841cea83390f48b9b7f0ad..af2c429bdc93fa9f922847285dc86127f0255311 100644 --- a/applications/utilities/mesh/conversion/polyDualMesh/polyDualMeshApp.C +++ b/applications/utilities/mesh/conversion/polyDualMesh/polyDualMeshApp.C @@ -91,7 +91,7 @@ void simpleMarkFeatures labelList& multiCellFeaturePoints ) { - scalar minCos = Foam::cos(featureAngle*constant::mathematical::pi/180.0); + scalar minCos = Foam::cos(degToRad(featureAngle)); const polyBoundaryMesh& patches = mesh.boundaryMesh(); @@ -387,7 +387,7 @@ int main(int argc, char *argv[]) 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 << "minCos :" << minCos << endl diff --git a/applications/utilities/mesh/conversion/starToFoam/createCoupleMatches.C b/applications/utilities/mesh/conversion/starToFoam/createCoupleMatches.C index bfd1dae88261ceeabad72f0bdb2cf64a35113079..da0f8683887c836e90ad56cfcf9742968c74b310 100644 --- a/applications/utilities/mesh/conversion/starToFoam/createCoupleMatches.C +++ b/applications/utilities/mesh/conversion/starToFoam/createCoupleMatches.C @@ -99,7 +99,7 @@ void starMesh::createCoupleMatches() << coupleI << ". STAR couple ID: " << couples_[coupleI].coupleID() << endl << "The angle between face normals is " - << Foam::acos(faceAreaAngle)/constant::mathematical::pi*180 + << radToDeg(Foam::acos(faceAreaAngle)) << " deg." << endl << "master cell: " << fp.masterCell() << " STAR number: " << starCellID_[fp.masterCell()] diff --git a/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/wedge/wedge.C b/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/wedge/wedge.C index eac10738cf9df9170264476def02155da24f35b1..67abf365642afabad71e2d6f14ea9e1fffa391b9 100644 --- a/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/wedge/wedge.C +++ b/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/wedge/wedge.C @@ -51,8 +51,7 @@ wedge::wedge(const dictionary& dict) axis_(coeffDict_.lookup("axis")), angle_ ( - readScalar(coeffDict_.lookup("angle")) - *constant::mathematical::pi/180.0 + degToRad(readScalar(coeffDict_.lookup("angle"))) ) {} diff --git a/applications/utilities/mesh/manipulation/autoPatch/autoPatch.C b/applications/utilities/mesh/manipulation/autoPatch/autoPatch.C index 7161e6bb706679b9ced55362cf473951459de8e9..15affd66e0f447bbc4f193c9f3a9c657bc0215bf 100644 --- a/applications/utilities/mesh/manipulation/autoPatch/autoPatch.C +++ b/applications/utilities/mesh/manipulation/autoPatch/autoPatch.C @@ -93,7 +93,7 @@ int main(int argc, char *argv[]) scalar featureAngle(readScalar(IStringStream(args.additionalArgs()[0])())); 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 << "minCos :" << minCos << endl diff --git a/src/Allwmake b/src/Allwmake index 2564ccf9e3e7d6ba8638f8832ce81817bdff0981..e4724a1e8f14bf4f331697de3da1895926345725 100755 --- a/src/Allwmake +++ b/src/Allwmake @@ -38,8 +38,6 @@ wmake libso sampling wmake libso dynamicMesh wmake libso dynamicFvMesh wmake libso topoChangerFvMesh -wmake libso fvMotionSolver -wmake libso engine wmake libso ODE wmake libso randomProcesses @@ -56,4 +54,7 @@ wmake libso errorEstimation fvAgglomerationMethods/Allwmake +wmake libso fvMotionSolver +wmake libso engine + # ----------------------------------------------------------------- end-of-file diff --git a/src/OpenFOAM/Make/files b/src/OpenFOAM/Make/files index 6ba6b90cf116720e24a35025059b46474a946285..2823c2a9ec3f0e45310365741915f3667a3446f9 100644 --- a/src/OpenFOAM/Make/files +++ b/src/OpenFOAM/Make/files @@ -1,6 +1,6 @@ global/global.Cver -global/dimensionedConstants/dimensionedConstants.C -global/dimensionedConstants/constants/constants.C +global/constants/constants.C +global/constants/dimensionedConstants.C global/argList/argList.C global/clock/clock.C diff --git a/src/OpenFOAM/db/Time/TimeState.H b/src/OpenFOAM/db/Time/TimeState.H index 56fb54d7b8ccb1605aa3a1a4b0b2ae4d65d0c02d..a9f1c90ef26de58cd91a23fe233c33b8a264a079 100644 --- a/src/OpenFOAM/db/Time/TimeState.H +++ b/src/OpenFOAM/db/Time/TimeState.H @@ -72,10 +72,8 @@ public: TimeState(); - // Destructor - - //- Virtual destructor - virtual ~TimeState(); + //- Destructor + virtual ~TimeState(); // Member functions @@ -89,22 +87,34 @@ public: virtual scalar timeToUserTime(const scalar t) const; //- Return current time value - virtual scalar timeOutputValue() const; + scalar timeOutputValue() const; //- 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 - virtual dimensionedScalar deltaT() const; + dimensionedScalar deltaT() const; //- Return old time step - virtual dimensionedScalar deltaT0() const; + dimensionedScalar deltaT0() const; // Check //- Return true if this is an output time - virtual bool outputTime() const; + bool outputTime() const; }; diff --git a/src/OpenFOAM/global/dimensionedConstants/constants/atomic/atomicConstants.C b/src/OpenFOAM/global/constants/atomic/atomicConstants.C similarity index 100% rename from src/OpenFOAM/global/dimensionedConstants/constants/atomic/atomicConstants.C rename to src/OpenFOAM/global/constants/atomic/atomicConstants.C diff --git a/src/OpenFOAM/global/dimensionedConstants/constants/atomic/atomicConstants.H b/src/OpenFOAM/global/constants/atomic/atomicConstants.H similarity index 97% rename from src/OpenFOAM/global/dimensionedConstants/constants/atomic/atomicConstants.H rename to src/OpenFOAM/global/constants/atomic/atomicConstants.H index c25737444152aaee517c2790669b83a62d882c7c..b732207d2caa5ce3880a75f7e7694c79542167a4 100644 --- a/src/OpenFOAM/global/dimensionedConstants/constants/atomic/atomicConstants.H +++ b/src/OpenFOAM/global/constants/atomic/atomicConstants.H @@ -23,7 +23,7 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Namespace - Foam::constant::atom + Foam::constant::atomic Description Atomic constants @@ -68,7 +68,7 @@ namespace atomic // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace atomic -} // end namespace constant +} // End namespace constant } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/global/dimensionedConstants/constants/constants.C b/src/OpenFOAM/global/constants/constants.C similarity index 96% rename from src/OpenFOAM/global/dimensionedConstants/constants/constants.C rename to src/OpenFOAM/global/constants/constants.C index f921cba9836e9bff24bb31ce0fbcd53dc567bba4..079343360f1b08da3d6512da576f1ddd6a313df0 100644 --- a/src/OpenFOAM/global/dimensionedConstants/constants/constants.C +++ b/src/OpenFOAM/global/constants/constants.C @@ -22,9 +22,6 @@ License along with OpenFOAM; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA -Description - Collection of dimensioned constants - \*---------------------------------------------------------------------------*/ // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/global/dimensionedConstants/constants/constants.H b/src/OpenFOAM/global/constants/constants.H similarity index 100% rename from src/OpenFOAM/global/dimensionedConstants/constants/constants.H rename to src/OpenFOAM/global/constants/constants.H diff --git a/src/OpenFOAM/global/dimensionedConstants/dimensionedConstants.C b/src/OpenFOAM/global/constants/dimensionedConstants.C similarity index 100% rename from src/OpenFOAM/global/dimensionedConstants/dimensionedConstants.C rename to src/OpenFOAM/global/constants/dimensionedConstants.C diff --git a/src/OpenFOAM/global/dimensionedConstants/dimensionedConstants.H b/src/OpenFOAM/global/constants/dimensionedConstants.H similarity index 93% rename from src/OpenFOAM/global/dimensionedConstants/dimensionedConstants.H rename to src/OpenFOAM/global/constants/dimensionedConstants.H index 989089c0b065fee12857e30b317a445026a8909d..fbba918e249b8b920a55ac2139d16dde4740ce6e 100644 --- a/src/OpenFOAM/global/dimensionedConstants/dimensionedConstants.H +++ b/src/OpenFOAM/global/constants/dimensionedConstants.H @@ -27,9 +27,10 @@ Global Description Dictionary reading and supplying the dimensioned constants used within - OpenFOAM particularly for thermodynamics. The values are read from the - OpenFOAM controlDict and should be changed to run with a different set of - units from the default SI units. + OpenFOAM, particularly for thermodynamics. + + The values are read from the OpenFOAM etc/controlDict and should be + changed to run with a different set of units from the default SI units. SourceFiles dimensionedConstants.C diff --git a/src/OpenFOAM/global/dimensionedConstants/constants/electromagnetic/electromagneticConstants.C b/src/OpenFOAM/global/constants/electromagnetic/electromagneticConstants.C similarity index 100% rename from src/OpenFOAM/global/dimensionedConstants/constants/electromagnetic/electromagneticConstants.C rename to src/OpenFOAM/global/constants/electromagnetic/electromagneticConstants.C diff --git a/src/OpenFOAM/global/dimensionedConstants/constants/electromagnetic/electromagneticConstants.H b/src/OpenFOAM/global/constants/electromagnetic/electromagneticConstants.H similarity index 97% rename from src/OpenFOAM/global/dimensionedConstants/constants/electromagnetic/electromagneticConstants.H rename to src/OpenFOAM/global/constants/electromagnetic/electromagneticConstants.H index 54586cda47e7cc185261e8ae2580d78f5b3eb046..0d4cd6df14e48674c098dd41e379d15eacfd1ec5 100644 --- a/src/OpenFOAM/global/dimensionedConstants/constants/electromagnetic/electromagneticConstants.H +++ b/src/OpenFOAM/global/constants/electromagnetic/electromagneticConstants.H @@ -23,7 +23,7 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Namespace - Foam::constant::em + Foam::constant::electromagnetic Description Electromagnetic constants @@ -77,7 +77,7 @@ namespace electromagnetic // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace electromagnetic -} // end namespace constant +} // End namespace constant } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/global/dimensionedConstants/constants/fundamental/fundamentalConstants.C b/src/OpenFOAM/global/constants/fundamental/fundamentalConstants.C similarity index 100% rename from src/OpenFOAM/global/dimensionedConstants/constants/fundamental/fundamentalConstants.C rename to src/OpenFOAM/global/constants/fundamental/fundamentalConstants.C diff --git a/src/OpenFOAM/global/dimensionedConstants/constants/fundamental/fundamentalConstants.H b/src/OpenFOAM/global/constants/fundamental/fundamentalConstants.H similarity index 100% rename from src/OpenFOAM/global/dimensionedConstants/constants/fundamental/fundamentalConstants.H rename to src/OpenFOAM/global/constants/fundamental/fundamentalConstants.H diff --git a/src/OpenFOAM/global/dimensionedConstants/constants/math/mathematicalConstants.H b/src/OpenFOAM/global/constants/math/mathematicalConstants.H similarity index 79% rename from src/OpenFOAM/global/dimensionedConstants/constants/math/mathematicalConstants.H rename to src/OpenFOAM/global/constants/math/mathematicalConstants.H index 0c7e584ed89169188e9430616c2edb79934fd3c5..64811272d8f074fc2137e4be092c20f4a03f3996 100644 --- a/src/OpenFOAM/global/dimensionedConstants/constants/math/mathematicalConstants.H +++ b/src/OpenFOAM/global/constants/math/mathematicalConstants.H @@ -26,7 +26,7 @@ Namespace Foam::constant::mathematical Description - mathematical constants + mathematical constants and conversion functions \*---------------------------------------------------------------------------*/ @@ -56,7 +56,24 @@ 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 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/global/dimensionedConstants/constants/physicoChemical/physicoChemicalConstants.C b/src/OpenFOAM/global/constants/physicoChemical/physicoChemicalConstants.C similarity index 100% rename from src/OpenFOAM/global/dimensionedConstants/constants/physicoChemical/physicoChemicalConstants.C rename to src/OpenFOAM/global/constants/physicoChemical/physicoChemicalConstants.C diff --git a/src/OpenFOAM/global/dimensionedConstants/constants/physicoChemical/physicoChemicalConstants.H b/src/OpenFOAM/global/constants/physicoChemical/physicoChemicalConstants.H similarity index 97% rename from src/OpenFOAM/global/dimensionedConstants/constants/physicoChemical/physicoChemicalConstants.H rename to src/OpenFOAM/global/constants/physicoChemical/physicoChemicalConstants.H index 7f25e0dfb7f0aac5c7914e777b42d5b4cfcdc4fb..920f390e27f2d0b8386aafd08d82171e824af070 100644 --- a/src/OpenFOAM/global/dimensionedConstants/constants/physicoChemical/physicoChemicalConstants.H +++ b/src/OpenFOAM/global/constants/physicoChemical/physicoChemicalConstants.H @@ -23,7 +23,7 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Namespace - Foam::constant::phys + Foam::constant::physicoChemical Description Physico-chemical constants @@ -71,7 +71,7 @@ namespace physicoChemical // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace physicoChemical -} // end namespace constant +} // End namespace constant } // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/global/dimensionedConstants/constants/universal/universalConstants.C b/src/OpenFOAM/global/constants/universal/universalConstants.C similarity index 100% rename from src/OpenFOAM/global/dimensionedConstants/constants/universal/universalConstants.C rename to src/OpenFOAM/global/constants/universal/universalConstants.C diff --git a/src/OpenFOAM/global/dimensionedConstants/constants/universal/universalConstants.H b/src/OpenFOAM/global/constants/universal/universalConstants.H similarity index 98% rename from src/OpenFOAM/global/dimensionedConstants/constants/universal/universalConstants.H rename to src/OpenFOAM/global/constants/universal/universalConstants.H index 305e30fe190568c49211730dfc078e327be68eae..85f8f1d9d8d2039320d03d6efddf6c9202d12a5b 100644 --- a/src/OpenFOAM/global/dimensionedConstants/constants/universal/universalConstants.H +++ b/src/OpenFOAM/global/constants/universal/universalConstants.H @@ -23,7 +23,7 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Namespace - Foam::constant::uni + Foam::constant::universal Description Universal constants diff --git a/src/OpenFOAM/matrices/solution/solution.C b/src/OpenFOAM/matrices/solution/solution.C index 030b3df9ae1296ebc8d42fe69b725e89a29503d4..c63dceec4eab01206c48000edf0fe9ed318a176f 100644 --- a/src/OpenFOAM/matrices/solution/solution.C +++ b/src/OpenFOAM/matrices/solution/solution.C @@ -59,11 +59,8 @@ Foam::solution::solution(const objectRegistry& obr, const fileName& dictName) IOobject::NO_WRITE ) ), - relaxationFactors_ - ( - ITstream("relaxationFactors", - tokenList())() - ), + cache_(ITstream("cache", tokenList())()), + relaxationFactors_(ITstream("relaxationFactors", tokenList())()), defaultRelaxationFactor_(0), 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()) - { - const dictionary& dict = solutionDict(); - - 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 + if (debug) { - return false; + Info<< "Find cache entry for " << name << endl; } -} - -const Foam::dictionary& Foam::solution::solutionDict() const -{ - if (found("select")) - { - return subDict(word(lookup("select"))); - } - else - { - return *this; - } + return cache_.found(name); } @@ -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 { 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; + } +} + + // ************************************************************************* // diff --git a/src/OpenFOAM/matrices/solution/solution.H b/src/OpenFOAM/matrices/solution/solution.H index d3bf0084750740d76e3922d962f9ff2b45d40ba7..36724bf49556cb24ea8518acd62201547a33e723 100644 --- a/src/OpenFOAM/matrices/solution/solution.H +++ b/src/OpenFOAM/matrices/solution/solution.H @@ -53,6 +53,9 @@ class solution { // Private data + //- Dictionary of temporary fields to cache + dictionary cache_; + //- Dictionary of relaxation factors for all the fields dictionary relaxationFactors_; @@ -62,6 +65,7 @@ class solution //- Dictionary of solver parameters for all the fields dictionary solvers_; + // Private Member Functions //- Disallow default bitwise copy construct and assignment @@ -90,9 +94,8 @@ public: // Access - //- Return the selected sub-dictionary of solvers if the "select" - // keyword is given, otherwise return the complete dictionary - const dictionary& solutionDict() const; + //- Return true if the given field should be cached + bool cache(const word& name) const; //- Return true if the relaxation factor is given for the field bool relax(const word& name) const; @@ -100,6 +103,10 @@ public: //- Return the relaxation factor for the given field 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 const dictionary& solverDict(const word& name) const; diff --git a/src/OpenFOAM/meshes/meshShapes/face/faceIntersection.C b/src/OpenFOAM/meshes/meshShapes/face/faceIntersection.C index c5f9a80250b00e433d139011a9e2d2c7b33b28a3..cf7dfc940059c9e9d5830cbc3afbb5bb12637fd0 100644 --- a/src/OpenFOAM/meshes/meshShapes/face/faceIntersection.C +++ b/src/OpenFOAM/meshes/meshShapes/face/faceIntersection.C @@ -159,9 +159,9 @@ Foam::pointHit Foam::face::intersection if (curHit.hit()) { - if (Foam::mag(curHit.distance()) < nearestHitDist) + if (Foam::mag(curHit.distance()) < Foam::mag(nearestHitDist)) { - nearestHitDist = Foam::mag(curHit.distance()); + nearestHitDist = curHit.distance(); nearest.setHit(); nearest.setPoint(curHit.hitPoint()); } diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCheck/primitiveMeshCheck.C b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCheck/primitiveMeshCheck.C index 258cb163a17e50ff9ea275df93d4bc26bcbd88a4..6350c934466ee98ae08bd4750c6cb5320ef3736c 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCheck/primitiveMeshCheck.C +++ b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCheck/primitiveMeshCheck.C @@ -410,7 +410,7 @@ bool Foam::primitiveMesh::checkFaceOrthogonality // Severe nonorthogonality threshold const scalar severeNonorthogonalityThreshold = - ::cos(nonOrthThreshold_/180.0*constant::mathematical::pi); + ::cos(degToRad(nonOrthThreshold_)); scalar minDDotS = GREAT; @@ -472,9 +472,8 @@ bool Foam::primitiveMesh::checkFaceOrthogonality if (debug || report) { Info<< " Mesh non-orthogonality Max: " - << ::acos(minDDotS)/constant::mathematical::pi*180.0 - << " average: " << - ::acos(sumDDotS/neiSize)/constant::mathematical::pi*180.0 + << radToDeg(::acos(minDDotS)) + << " average: " << radToDeg(::acos(sumDDotS/neiSize)) << endl; } } @@ -839,7 +838,7 @@ bool Foam::primitiveMesh::checkFaceAngles << 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 faceList& fcs = faces(); @@ -915,8 +914,7 @@ bool Foam::primitiveMesh::checkFaceAngles if (nConcave > 0) { scalar maxConcaveDegr = - Foam::asin(Foam::min(1.0, maxEdgeSin)) - *180.0/constant::mathematical::pi; + radToDeg(Foam::asin(Foam::min(1.0, maxEdgeSin))); if (debug || report) { diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCheck/primitiveMeshCheckMotion.C b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCheck/primitiveMeshCheckMotion.C index 688bdd81a2d38cf2d5c8259b1694af772dddb455..8fce92f3c808fc7fdb7d9eee19585d4c368da002 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCheck/primitiveMeshCheckMotion.C +++ b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCheck/primitiveMeshCheckMotion.C @@ -200,7 +200,7 @@ bool Foam::primitiveMesh::checkMeshMotion ) << "Severe non-orthogonality in mesh motion for face " << faceI << " between cells " << own[faceI] << " and " << nei[faceI] - << ": Angle = " << ::acos(dDotS)/constant::mathematical::pi*180.0 + << ": Angle = " << radToDeg(::acos(dDotS)) << " deg." << endl; nDotProductErrors++; diff --git a/src/dynamicMesh/meshCut/cellLooper/topoCellLooper.C b/src/dynamicMesh/meshCut/cellLooper/topoCellLooper.C index 5e83fd9e7833036a091331a0402bd6823d9dd99f..f17e07c323f3329c5ff16d8282eecb7cdd62ddfe 100644 --- a/src/dynamicMesh/meshCut/cellLooper/topoCellLooper.C +++ b/src/dynamicMesh/meshCut/cellLooper/topoCellLooper.C @@ -44,8 +44,7 @@ namespace Foam } // Angle for polys to be considered splitHexes. -const Foam::scalar Foam::topoCellLooper::featureCos = - Foam::cos(10.0*constant::mathematical::pi/180.0); +const Foam::scalar Foam::topoCellLooper::featureCos = Foam::cos(degToRad(10.0)); // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/src/dynamicMesh/meshCut/meshModifiers/undoableMeshCutter/undoableMeshCutter.C b/src/dynamicMesh/meshCut/meshModifiers/undoableMeshCutter/undoableMeshCutter.C index ea8ab52a7fc9a20ca0f56274f6474269425b2027..16606233d04418e686e3730c9849515ab0b51c7b 100644 --- a/src/dynamicMesh/meshCut/meshModifiers/undoableMeshCutter/undoableMeshCutter.C +++ b/src/dynamicMesh/meshCut/meshModifiers/undoableMeshCutter/undoableMeshCutter.C @@ -192,7 +192,7 @@ Foam::undoableMeshCutter::undoableMeshCutter faceRemover_ ( mesh, - Foam::cos(30.0/180.0*constant::mathematical::pi) + Foam::cos(degToRad(30.0)) ) {} diff --git a/src/dynamicMesh/motionSmoother/polyMeshGeometry/polyMeshGeometry.C b/src/dynamicMesh/motionSmoother/polyMeshGeometry/polyMeshGeometry.C index d95e1f34e990da0b82686620d8a15434d16917a3..83d0000ea39b1c1ed6ac15ff98a37c3d4c657952 100644 --- a/src/dynamicMesh/motionSmoother/polyMeshGeometry/polyMeshGeometry.C +++ b/src/dynamicMesh/motionSmoother/polyMeshGeometry/polyMeshGeometry.C @@ -248,7 +248,7 @@ Foam::scalar Foam::polyMeshGeometry::checkNonOrtho << " between cells " << mesh.faceOwner()[faceI] << " and " << nei << ": Angle = " - << ::acos(dDotS)/constant::mathematical::pi*180.0 + << radToDeg(::acos(dDotS)) << " deg." << endl; } @@ -269,7 +269,7 @@ Foam::scalar Foam::polyMeshGeometry::checkNonOrtho << " between cells " << mesh.faceOwner()[faceI] << " and " << nei << ": Angle = " - << ::acos(dDotS)/constant::mathematical::pi*180.0 + << radToDeg(::acos(dDotS)) << " deg." << endl; } @@ -368,8 +368,7 @@ bool Foam::polyMeshGeometry::checkFaceDotProduct const polyBoundaryMesh& patches = mesh.boundaryMesh(); // Severe nonorthogonality threshold - const scalar severeNonorthogonalityThreshold = - ::cos(orthWarn/180.0*constant::mathematical::pi); + const scalar severeNonorthogonalityThreshold = ::cos(degToRad(orthWarn)); // Calculate coupled cell centre @@ -504,9 +503,8 @@ bool Foam::polyMeshGeometry::checkFaceDotProduct if (nDDotS > 0) { Info<< "Mesh non-orthogonality Max: " - << ::acos(minDDotS)/constant::mathematical::pi*180.0 - << " average: " << - ::acos(sumDDotS/nDDotS)/constant::mathematical::pi*180.0 + << radToDeg(::acos(minDDotS)) + << " average: " << radToDeg(::acos(sumDDotS/nDDotS)) << endl; } } @@ -1258,7 +1256,7 @@ bool Foam::polyMeshGeometry::checkFaceAngles << abort(FatalError); } - const scalar maxSin = Foam::sin(maxDeg/180.0*constant::mathematical::pi); + const scalar maxSin = Foam::sin(degToRad(maxDeg)); const faceList& fcs = mesh.faces(); @@ -1338,8 +1336,7 @@ bool Foam::polyMeshGeometry::checkFaceAngles if (maxEdgeSin > SMALL) { scalar maxConcaveDegr = - Foam::asin(Foam::min(1.0, maxEdgeSin)) - *180.0/constant::mathematical::pi; + radToDeg(Foam::asin(Foam::min(1.0, maxEdgeSin))); Info<< "There are " << nConcave << " faces with concave angles between consecutive" diff --git a/src/engine/engineTime/engineTime.C b/src/engine/engineTime/engineTime.C index ef0d016880f9d5bd0df32e55da14142fdb428086..8adf64fdcde9238eeea90e21476b437049858154 100644 --- a/src/engine/engineTime/engineTime.C +++ b/src/engine/engineTime/engineTime.C @@ -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 { // 6 * rpm => deg/s diff --git a/src/engine/engineTime/engineTime.H b/src/engine/engineTime/engineTime.H index f97701d2405c6084479e67f8b35b72f549777728..e63a7caa0b5bdfd77a207419487e6bae8c36b584 100644 --- a/src/engine/engineTime/engineTime.H +++ b/src/engine/engineTime/engineTime.H @@ -121,9 +121,6 @@ public: // Conversion - //- Convert degrees to radians - scalar degToRad(const scalar rad) const; - //- Convert degrees to seconds (for given engine speed in RPM) scalar degToTime(const scalar theta) const; diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolation/surfaceInterpolation.C b/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolation/surfaceInterpolation.C index 87cc39bfdc7a4c988456c53565fc59f13269ba2d..5bcb692065cec4ca8f64ecdbe0e7cf22035807b7 100644 --- a/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolation/surfaceInterpolation.C +++ b/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolation/surfaceInterpolation.C @@ -345,7 +345,8 @@ void surfaceInterpolation::makeCorrectionVectors() const // Calculate the non-orthogonality for meshes with 1 face or more if (returnReduce(magSf.size(), sumOp<label>()) > 0) { - NonOrthogCoeff = + NonOrthogCoeff = radToDeg + ( asin ( min @@ -353,7 +354,8 @@ void surfaceInterpolation::makeCorrectionVectors() const (sum(magSf*mag(corrVecs))/sum(magSf)).value(), 1.0 ) - )*180.0/constant::mathematical::pi; + ) + ); } if (debug) diff --git a/src/fvMotionSolver/Make/files b/src/fvMotionSolver/Make/files index f229ae322ef04b4bf61dd4bb0eb336fed3764e48..fd018a7537f36ed366a281d758e1094f93e098f3 100644 --- a/src/fvMotionSolver/Make/files +++ b/src/fvMotionSolver/Make/files @@ -31,5 +31,10 @@ pointPatchFields/derived/oscillatingDisplacement/oscillatingDisplacementPointPat pointPatchFields/derived/angularOscillatingDisplacement/angularOscillatingDisplacementPointPatchVectorField.C pointPatchFields/derived/surfaceSlipDisplacement/surfaceSlipDisplacementPointPatchVectorField.C pointPatchFields/derived/surfaceDisplacement/surfaceDisplacementPointPatchVectorField.C +pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyDisplacementPointPatchVectorField.C +pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion.C +pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionIO.C +pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionState.C +pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionStateIO.C LIB = $(FOAM_LIBBIN)/libfvMotionSolvers diff --git a/src/fvMotionSolver/Make/options b/src/fvMotionSolver/Make/options index 966b56964d720cb3acf3a2f006a63d6b14284ef5..9222d5f97c8e43b80117b51b5d21abc1216f2d71 100644 --- a/src/fvMotionSolver/Make/options +++ b/src/fvMotionSolver/Make/options @@ -2,10 +2,12 @@ EXE_INC = \ -I$(LIB_SRC)/triSurface/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/dynamicMesh/lnInclude \ - -I$(LIB_SRC)/finiteVolume/lnInclude + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/postProcessing/functionObjects/forces/lnInclude \ LIB_LIBS = \ -ltriSurface \ -lmeshTools \ -ldynamicMesh \ - -lfiniteVolume + -lfiniteVolume \ + -lforces diff --git a/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyDisplacementPointPatchVectorField.C b/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyDisplacementPointPatchVectorField.C new file mode 100644 index 0000000000000000000000000000000000000000..f2a7adb5b6e6efd896e0fe4d3714ad1017703b93 --- /dev/null +++ b/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyDisplacementPointPatchVectorField.C @@ -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 + +// ************************************************************************* // diff --git a/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyDisplacementPointPatchVectorField.H b/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyDisplacementPointPatchVectorField.H new file mode 100644 index 0000000000000000000000000000000000000000..048fa9f14be951585bc97b611e4d41674daf4009 --- /dev/null +++ b/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyDisplacementPointPatchVectorField.H @@ -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 + +// ************************************************************************* // diff --git a/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion.C b/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion.C new file mode 100644 index 0000000000000000000000000000000000000000..dae1ba9f3df97636cf65b584f6f35e630a192cfd --- /dev/null +++ b/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion.C @@ -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_))); +} + + +// ************************************************************************* // diff --git a/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion.H b/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion.H new file mode 100644 index 0000000000000000000000000000000000000000..16ea1d42b2cba49d908ed4aadfe896bf4bb937b9 --- /dev/null +++ b/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion.H @@ -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 + +// ************************************************************************* // diff --git a/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionI.H b/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionI.H new file mode 100644 index 0000000000000000000000000000000000000000..aeb75bdea4a0c0e03b00b464e770a9cc856b85b6 --- /dev/null +++ b/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionI.H @@ -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(); +} + + +// ************************************************************************* // diff --git a/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionIO.C b/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionIO.C new file mode 100644 index 0000000000000000000000000000000000000000..005cbbe6aa4fec362797b1a91c0da55123614bee --- /dev/null +++ b/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionIO.C @@ -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; +} + + +// ************************************************************************* // diff --git a/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionState.C b/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionState.C new file mode 100644 index 0000000000000000000000000000000000000000..cd52b1d142a27179e7721e2e33bf6dcc1c88968e --- /dev/null +++ b/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionState.C @@ -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() +{} + + +// ************************************************************************* // diff --git a/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionState.H b/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionState.H new file mode 100644 index 0000000000000000000000000000000000000000..32cf0be02bc51a452783377fbbd653ad20d14f1f --- /dev/null +++ b/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionState.H @@ -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 + +// ************************************************************************* // diff --git a/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionStateI.H b/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionStateI.H new file mode 100644 index 0000000000000000000000000000000000000000..dc6659d0cd78bd1b54a361d4517d86d3ae094e08 --- /dev/null +++ b/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionStateI.H @@ -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_; +} + + +// ************************************************************************* // diff --git a/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionStateIO.C b/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionStateIO.C new file mode 100644 index 0000000000000000000000000000000000000000..650a3599910271cef51858af3855c94c576cc34c --- /dev/null +++ b/src/fvMotionSolver/pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionStateIO.C @@ -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; +} + + +// ************************************************************************* // diff --git a/src/lagrangian/dieselSpray/injector/multiHoleInjector/multiHoleInjector.C b/src/lagrangian/dieselSpray/injector/multiHoleInjector/multiHoleInjector.C index b518d41254b9b7faa5cc89db3a4933d58830c873..9f8f595ea5663c082c568c71b05c5a69c0aa2399 100644 --- a/src/lagrangian/dieselSpray/injector/multiHoleInjector/multiHoleInjector.C +++ b/src/lagrangian/dieselSpray/injector/multiHoleInjector/multiHoleInjector.C @@ -165,9 +165,8 @@ Foam::multiHoleInjector::~multiHoleInjector() void Foam::multiHoleInjector::setTangentialVectors() { - scalar pi180 = constant::mathematical::pi/180.0; - scalar alpha = xyAngle_*pi180; - scalar phi = zAngle_*pi180; + scalar alpha = degToRad(xyAngle_); + scalar phi = degToRad(zAngle_); vector xp(cos(alpha), sin(alpha), 0.0); vector zp(cos(alpha)*sin(phi), sin(alpha)*sin(phi), cos(phi)); @@ -184,11 +183,11 @@ void Foam::multiHoleInjector::setTangentialVectors() // Info << "zp = " << zp << endl; scalar angle = 0.0; - scalar u = umbrellaAngle_*pi180/2.0; + scalar u = degToRad(umbrellaAngle_/2.0); for (label i=0; i<nHoles_; i++) { angle += angleSpacing_[i]; - scalar v = angle*pi180; + scalar v = degToRad(angle); direction_[i] = cos(v)*sin(u)*xp + sin(v)*sin(u)*yp + cos(u)*zp; vector dp = direction_[i] - (direction_[i] & zp)*direction_[i]; if (mag(dp) > SMALL) diff --git a/src/lagrangian/dieselSpray/spray/spray.C b/src/lagrangian/dieselSpray/spray/spray.C index de2a05687af4e74d8cb61ebde892144bd7717cff..2f24587bb7373c951fc7c82bc978d36b8fc6fa5f 100644 --- a/src/lagrangian/dieselSpray/spray/spray.C +++ b/src/lagrangian/dieselSpray/spray/spray.C @@ -293,7 +293,7 @@ Foam::spray::spray angleOfWedge_ = constant::mathematical::pi - acos(arcCos); Info<< "Calculated angle of wedge is " - << angleOfWedge_*180/constant::mathematical::pi << " deg." + << radToDeg(angleOfWedge_) << " deg." << endl; } else diff --git a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/blobsSwirl/blobsSwirlInjector.C b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/blobsSwirl/blobsSwirlInjector.C index 025c0ec692ab25dfae8eec3546df34cd65e92383..c78b872e2b1527eed51a9a15b6eb0863ae225610 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/blobsSwirl/blobsSwirlInjector.C +++ b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/blobsSwirl/blobsSwirlInjector.C @@ -110,9 +110,7 @@ scalar blobsSwirlInjector::d0 scalar c = rndGen_.scalar01(); - angle_ = coneAngle_[n]/2.0 + c*coneInterval_[n]; - - angle_ *= constant::mathematical::pi/180.0; + angle_ = degToRad(coneAngle_[n]/2.0 + c*coneInterval_[n]); scalar injectedMassFlow = it.massFlowRate(t); diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C index 3a870136d08a77b6a2f3008152e3405800307b1f..7799663505090f66e3bffef463a2f39a9ec9cf03 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C @@ -2480,10 +2480,10 @@ void Foam::autoLayerDriver::mergePatchFacesUndo ) { scalar minCos = - Foam::cos(layerParams.featureAngle()*constant::mathematical::pi/180.0); + Foam::cos(degToRad(layerParams.featureAngle())); scalar concaveCos = - Foam::cos(layerParams.concaveAngle()*constant::mathematical::pi/180.0); + Foam::cos(degToRad(layerParams.concaveAngle())); Info<< nl << "Merging all faces of a cell" << nl @@ -2602,7 +2602,7 @@ void Foam::autoLayerDriver::addLayers ( pp, meshEdges, - layerParams.featureAngle()*constant::mathematical::pi/180.0, + degToRad(layerParams.featureAngle()), patchDisp, patchNLayers, @@ -2688,7 +2688,7 @@ void Foam::autoLayerDriver::addLayers maxPatchNameLen = max(maxPatchNameLen, label(patchName.size())); } - Info<< nl + Info<< nl << setf(ios_base::left) << setw(maxPatchNameLen) << "patch" << setw(0) << " faces layers avg thickness[m]" << nl << setf(ios_base::left) << setw(maxPatchNameLen) << " " @@ -3289,7 +3289,7 @@ void Foam::autoLayerDriver::doLayers << "Doing initial balancing" << nl << "-----------------------" << nl << endl; - + scalarField cellWeights(mesh.nCells(), 1); forAll(numLayers, patchI) { @@ -3302,7 +3302,7 @@ void Foam::autoLayerDriver::doLayers } } } - + // Balance mesh (and meshRefinement). No restriction on face zones // and baffles. autoPtr<mapDistributePolyMesh> map = meshRefiner_.balance @@ -3313,7 +3313,7 @@ void Foam::autoLayerDriver::doLayers decomposer, distributor ); - + //{ // globalIndex globalCells(mesh.nCells()); // diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C index b8c13d83d99ce6c53967dc7d4cf597a241f4abff..f799881e932c7c8e74e26cdd08a15fc2d0c9457d 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C @@ -681,8 +681,8 @@ void Foam::autoRefineDriver::mergePatchFaces meshRefiner_.mergePatchFaces ( - Foam::cos(45*constant::mathematical::pi/180.0), - Foam::cos(45*constant::mathematical::pi/180.0), + Foam::cos(degToRad(45.0)), + Foam::cos(degToRad(45.0)), meshRefiner_.meshedPatches() ); @@ -691,7 +691,7 @@ void Foam::autoRefineDriver::mergePatchFaces meshRefiner_.checkData(); } - meshRefiner_.mergeEdges(Foam::cos(45*constant::mathematical::pi/180.0)); + meshRefiner_.mergeEdges(Foam::cos(degToRad(45.0))); if (debug) { diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/layerParameters/layerParameters.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/layerParameters/layerParameters.C index 4e73157996a6869fd5c7b85a9370cfe1de924c70..8a71825221cdeaeff2e5e8ce9d4a4498a4bd8793 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/layerParameters/layerParameters.C +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/layerParameters/layerParameters.C @@ -192,7 +192,7 @@ Foam::layerParameters::layerParameters ), layerTerminationCos_ ( - Foam::cos(0.5*featureAngle_*constant::mathematical::pi/180.0) + Foam::cos(degToRad(0.5*featureAngle_)) ), maxThicknessToMedialRatio_ ( @@ -200,8 +200,7 @@ Foam::layerParameters::layerParameters ), minMedianAxisAngleCos_ ( - Foam::cos(readScalar(dict.lookup("minMedianAxisAngle"))) - *constant::mathematical::pi/180.0 + Foam::cos(degToRad(readScalar(dict.lookup("minMedianAxisAngle")))) ), nBufferCellsNoExtrude_ ( @@ -269,7 +268,7 @@ Foam::layerParameters::layerParameters ), layerTerminationCos_ ( - Foam::cos(0.5*featureAngle_*constant::mathematical::pi/180.0) + Foam::cos(degToRad(0.5*featureAngle_)) ), maxThicknessToMedialRatio_ ( @@ -277,8 +276,7 @@ Foam::layerParameters::layerParameters ), minMedianAxisAngleCos_ ( - Foam::cos(readScalar(dict.lookup("minMedianAxisAngle"))) - *constant::mathematical::pi/180.0 + Foam::cos(degToRad(readScalar(dict.lookup("minMedianAxisAngle")))) ), nBufferCellsNoExtrude_ ( diff --git a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/refinementParameters/refinementParameters.C b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/refinementParameters/refinementParameters.C index d3c656a6d42895c999f44ad36af14dc4a7d02dda..bf1d6ec6c07e43e8b8372bad039cbfe362372928 100644 --- a/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/refinementParameters/refinementParameters.C +++ b/src/mesh/autoMesh/autoHexMesh/autoHexMeshDriver/refinementParameters/refinementParameters.C @@ -65,7 +65,7 @@ Foam::refinementParameters::refinementParameters(const dictionary& dict) } else { - curvature_ = Foam::cos(featAngle*constant::mathematical::pi/180.0); + curvature_ = Foam::cos(degToRad(featAngle)); } } diff --git a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementProblemCells.C b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementProblemCells.C index 578d21be1b37bf92a0a376e2d19d16c11c566cb4..f72dcc313116940793884b29acff53100d2d52aa 100644 --- a/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementProblemCells.C +++ b/src/mesh/autoMesh/autoHexMesh/meshRefinement/meshRefinementProblemCells.C @@ -247,7 +247,7 @@ Foam::Map<Foam::label> Foam::meshRefinement::findEdgeConnectedProblemCells nearestRegion[i] ); - scalar angle = perpendicularAngle[region]/180.0*constant::mathematical::pi; + scalar angle = degToRad(perpendicularAngle[region]); if (angle >= 0) { diff --git a/src/mesh/blockMesh/curvedEdges/arcEdge.C b/src/mesh/blockMesh/curvedEdges/arcEdge.C index 514b63b918625348e4d5ec9658149df3f7807989..985caef831512f7aef6145b95a63849467c2a1df 100644 --- a/src/mesh/blockMesh/curvedEdges/arcEdge.C +++ b/src/mesh/blockMesh/curvedEdges/arcEdge.C @@ -72,12 +72,12 @@ Foam::cylindricalCS Foam::arcEdge::calcAngle() // find angles 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 if (((r1 ^ r2)&(r1 ^ r3)) < 0.0) { - angle_ = 360 - angle_; + angle_ = 360.0 - angle_; } vector tempAxis; @@ -159,7 +159,7 @@ Foam::vector Foam::arcEdge::position(const scalar lambda) const Foam::scalar Foam::arcEdge::length() const { - return angle_*radius_*constant::mathematical::pi/180.0; + return degToRad(angle_*radius_); } diff --git a/src/meshTools/cellQuality/cellQuality.C b/src/meshTools/cellQuality/cellQuality.C index 0d32f64ef42dd5754a7f298e853afd55a3a99390..dfbab90f055911e7e6272c258f6cd762dd2f870e 100644 --- a/src/meshTools/cellQuality/cellQuality.C +++ b/src/meshTools/cellQuality/cellQuality.C @@ -66,8 +66,7 @@ Foam::tmp<Foam::scalarField> Foam::cellQuality::nonOrthogonality() const scalar magS = mag(s); scalar cosDDotS = - Foam::acos(min(1.0, (d & s)/(mag(d)*magS + VSMALL))) - *180.0/constant::mathematical::pi; + radToDeg(Foam::acos(min(1.0, (d & s)/(mag(d)*magS + VSMALL)))); 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 cosDDotS = - Foam::acos(min(1.0, (d & s)/(mag(d)*magS + VSMALL))) - *180.0/constant::mathematical::pi; + radToDeg(Foam::acos(min(1.0, (d & s)/(mag(d)*magS + VSMALL)))); 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 cosDDotS = - Foam::acos(min(1.0, (d & s)/(mag(d)*magS + VSMALL))) - *180.0/constant::mathematical::pi; + radToDeg(Foam::acos(min(1.0, (d & s)/(mag(d)*magS + VSMALL)))); result[faceI] = cosDDotS; } @@ -233,8 +230,7 @@ Foam::tmp<Foam::scalarField> Foam::cellQuality::faceNonOrthogonality() const scalar magS = mag(s); scalar cosDDotS = - Foam::acos(min(1.0, (d & s)/(mag(d)*magS + VSMALL))) - *180.0/constant::mathematical::pi; + radToDeg(Foam::acos(min(1.0, (d & s)/(mag(d)*magS + VSMALL)))); result[globalFaceI++] = cosDDotS; } diff --git a/src/meshTools/coordinateSystems/toroidalCS.C b/src/meshTools/coordinateSystems/toroidalCS.C index 93495948fdf6947fbbcb6fa1e7f004afd38b5a19..3e912007a54c60b2a8e55801a7ecae8ecb028f76 100644 --- a/src/meshTools/coordinateSystems/toroidalCS.C +++ b/src/meshTools/coordinateSystems/toroidalCS.C @@ -72,8 +72,8 @@ Foam::vector Foam::toroidalCS::localToGlobal ) const { // Notation: r = local.x() - scalar theta = local.y()*constant::mathematical::pi/180.0; - scalar phi = local.z()*constant::mathematical::pi/180.0; + scalar theta = degToRad(local.y()); + scalar phi = degToRad(local.z()); scalar rprime = radius_ + local.x()*sin(phi); diff --git a/src/meshTools/primitiveMeshGeometry/primitiveMeshGeometry.C b/src/meshTools/primitiveMeshGeometry/primitiveMeshGeometry.C index 69a67634bc21bb56e588fe911b620227c3bebae6..9924eb0a9cb2d245c980874a5960db0af518e685 100644 --- a/src/meshTools/primitiveMeshGeometry/primitiveMeshGeometry.C +++ b/src/meshTools/primitiveMeshGeometry/primitiveMeshGeometry.C @@ -271,8 +271,7 @@ bool Foam::primitiveMeshGeometry::checkFaceDotProduct const labelList& nei = mesh.faceNeighbour(); // Severe nonorthogonality threshold - const scalar severeNonorthogonalityThreshold = - ::cos(orthWarn/180.0*constant::mathematical::pi); + const scalar severeNonorthogonalityThreshold = ::cos(degToRad(orthWarn)); scalar minDDotS = GREAT; @@ -303,8 +302,7 @@ bool Foam::primitiveMeshGeometry::checkFaceDotProduct Pout<< "Severe non-orthogonality for face " << faceI << " between cells " << own[faceI] << " and " << nei[faceI] - << ": Angle = " - << ::acos(dDotS)/constant::mathematical::pi*180.0 + << ": Angle = " << radToDeg(::acos(dDotS)) << " deg." << endl; } @@ -329,8 +327,7 @@ bool Foam::primitiveMeshGeometry::checkFaceDotProduct << faceI << " between cells " << own[faceI] << " and " << nei[faceI] - << ": Angle = " - << ::acos(dDotS)/constant::mathematical::pi*180.0 + << ": Angle = " << radToDeg(::acos(dDotS)) << " deg." << endl; } @@ -376,9 +373,8 @@ bool Foam::primitiveMeshGeometry::checkFaceDotProduct if (neiSize > 0) { Info<< "Mesh non-orthogonality Max: " - << ::acos(minDDotS)/constant::mathematical::pi*180.0 - << " average: " << - ::acos(sumDDotS/neiSize)/constant::mathematical::pi*180.0 + << radToDeg(::acos(minDDotS)) + << " average: " << radToDeg(::acos(sumDDotS/neiSize)) << endl; } } @@ -780,7 +776,7 @@ bool Foam::primitiveMeshGeometry::checkFaceAngles << 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(); @@ -860,8 +856,7 @@ bool Foam::primitiveMeshGeometry::checkFaceAngles if (maxEdgeSin > SMALL) { scalar maxConcaveDegr = - Foam::asin(Foam::min(1.0, maxEdgeSin)) - *180.0/constant::mathematical::pi; + radToDeg(Foam::asin(Foam::min(1.0, maxEdgeSin))); Info<< "There are " << nConcave << " faces with concave angles between consecutive" diff --git a/src/meshTools/sets/cellSources/shapeToCell/shapeToCell.C b/src/meshTools/sets/cellSources/shapeToCell/shapeToCell.C index 96b1b3562ba17885f657de446e98fdbcd58c03e1..b36997f208ad0256a70a8924b55772176f49eccf 100644 --- a/src/meshTools/sets/cellSources/shapeToCell/shapeToCell.C +++ b/src/meshTools/sets/cellSources/shapeToCell/shapeToCell.C @@ -56,8 +56,7 @@ Foam::topoSetSource::addToUsageTable Foam::shapeToCell::usage_ // Angle for polys to be considered splitHexes. -Foam::scalar Foam::shapeToCell::featureCos = - Foam::cos(10.0*Foam::constant::mathematical::pi/180.0); +Foam::scalar Foam::shapeToCell::featureCos = Foam::cos(degToRad(10.0)); // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/src/meshTools/triSurface/booleanOps/surfaceIntersection/edgeIntersections.C b/src/meshTools/triSurface/booleanOps/surfaceIntersection/edgeIntersections.C index fdd08569a698a5ebb23c6ef474df8ccefbf56e14..a8a979af4e8ef72bd45052faa28e317a79ce3e6e 100644 --- a/src/meshTools/triSurface/booleanOps/surfaceIntersection/edgeIntersections.C +++ b/src/meshTools/triSurface/booleanOps/surfaceIntersection/edgeIntersections.C @@ -43,8 +43,7 @@ License defineTypeNameAndDebug(Foam::edgeIntersections, 0); -Foam::scalar Foam::edgeIntersections::alignedCos_ = - Foam::cos(89.0*Foam::constant::mathematical::pi/180.0); +Foam::scalar Foam::edgeIntersections::alignedCos_ = Foam::cos(degToRad(89.0)); // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/src/meshTools/triSurface/surfaceFeatures/surfaceFeatures.C b/src/meshTools/triSurface/surfaceFeatures/surfaceFeatures.C index 8699b1be34a1f8e65fc66f5dc254487ef8047b37..4383c30a2f745ff896e6e6d65523f89ceadaeef2 100644 --- a/src/meshTools/triSurface/surfaceFeatures/surfaceFeatures.C +++ b/src/meshTools/triSurface/surfaceFeatures/surfaceFeatures.C @@ -490,8 +490,7 @@ Foam::labelList Foam::surfaceFeatures::selectFeatureEdges void Foam::surfaceFeatures::findFeatures(const scalar includedAngle) { - scalar minCos = - Foam::cos((180.0 - includedAngle)*constant::mathematical::pi/180.0); + scalar minCos = Foam::cos(degToRad(180.0 - includedAngle)); const labelListList& edgeFaces = surf_.edgeFaces(); const vectorField& faceNormals = surf_.faceNormals(); diff --git a/tutorials/compressible/rhoCentralFoam/biconic25-55Run35/datToFoam/datToFoam.C b/tutorials/compressible/rhoCentralFoam/biconic25-55Run35/datToFoam/datToFoam.C index 8ff4a0c063b1253dfa21c5d413711344858a55be..bd5f890ee59e8d2f81cca253dc538182dc089117 100644 --- a/tutorials/compressible/rhoCentralFoam/biconic25-55Run35/datToFoam/datToFoam.C +++ b/tutorials/compressible/rhoCentralFoam/biconic25-55Run35/datToFoam/datToFoam.C @@ -128,7 +128,7 @@ int main(int argc, char *argv[]) fileName pointsFile(runTime.constantPath()/"points.tmp"); OFstream pFile(pointsFile); - scalar a(0.1*constant::mathematical::pi/180.0); + scalar a(degToRad(0.1)); tensor rotateZ = tensor ( diff --git a/tutorials/multiphase/interDyMFoam/ras/floatingObject/Allclean b/tutorials/multiphase/interDyMFoam/ras/floatingObject/Allclean new file mode 100755 index 0000000000000000000000000000000000000000..2cd0673fdd5e684d4862ad4f10019588b8c5d95a --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/floatingObject/Allclean @@ -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 + diff --git a/tutorials/multiphase/interDyMFoam/ras/floatingObject/Allrun b/tutorials/multiphase/interDyMFoam/ras/floatingObject/Allrun new file mode 100755 index 0000000000000000000000000000000000000000..1bece85bd98222c0358d809de9c9d3033aeda6c4 --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/floatingObject/Allrun @@ -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 + +# ----------------------------------------------------------------------------- diff --git a/tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/RASProperties b/tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/RASProperties new file mode 100644 index 0000000000000000000000000000000000000000..81b1ec9115226882e6e980b8e5f4e19cabb886d9 --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/RASProperties @@ -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; + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/dynamicMeshDict b/tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/dynamicMeshDict new file mode 100644 index 0000000000000000000000000000000000000000..083baf725a14ecb9787708faf739d7e859f6172e --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/dynamicMeshDict @@ -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); + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/g b/tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/g new file mode 100644 index 0000000000000000000000000000000000000000..317bdd50defb2d1a2717ce5c7b4467cf9fd14264 --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/g @@ -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 ); + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/polyMesh/blockMeshDict b/tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/polyMesh/blockMeshDict new file mode 100644 index 0000000000000000000000000000000000000000..611466bb780fc9e54585ddbdbe160ad492fde813 --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/polyMesh/blockMeshDict @@ -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 +( +); + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/polyMesh/boundary b/tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/polyMesh/boundary new file mode 100644 index 0000000000000000000000000000000000000000..62fd629b04d8486450a703d16f705cc5a0a987ac --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/polyMesh/boundary @@ -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; + } +) + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/transportProperties b/tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/transportProperties new file mode 100644 index 0000000000000000000000000000000000000000..6a2e70e1c4280ebd53d4ada91293b41d817271f6 --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/transportProperties @@ -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; + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/turbulenceProperties b/tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/turbulenceProperties new file mode 100644 index 0000000000000000000000000000000000000000..e94c3c747331a9df223b57641173f3f8e8185a15 --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/floatingObject/constant/turbulenceProperties @@ -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; + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/cellSetDict.1 b/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/cellSetDict.1 new file mode 100644 index 0000000000000000000000000000000000000000..90a225e6a9a91a84eb563e3ddfb54503a4b4d8d7 --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/cellSetDict.1 @@ -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); + } +); + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/cellSetDict.2 b/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/cellSetDict.2 new file mode 100644 index 0000000000000000000000000000000000000000..57cc0658f727238910e5a2351eae60f342221ff0 --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/cellSetDict.2 @@ -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 (); + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/controlDict b/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/controlDict new file mode 100644 index 0000000000000000000000000000000000000000..efcb76277a25448889bdf8fb1b57de9aebafba0c --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/controlDict @@ -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"); + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/decomposeParDict b/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/decomposeParDict new file mode 100644 index 0000000000000000000000000000000000000000..2a513989c06496d892c421259c6312431ee03d23 --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/decomposeParDict @@ -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 ( ); + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/fvSchemes b/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/fvSchemes new file mode 100644 index 0000000000000000000000000000000000000000..aa863122a1cd30a7c93ca9c3061035a8b1d02568 --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/fvSchemes @@ -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; +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/fvSolution b/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/fvSolution new file mode 100644 index 0000000000000000000000000000000000000000..bbe6b39db4c5ac879a9d67cc11fad5888a0bcf90 --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/fvSolution @@ -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; +} + + +// ************************************************************************* // diff --git a/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/setFieldsDict b/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/setFieldsDict new file mode 100644 index 0000000000000000000000000000000000000000..3565b89deede7023901256fb0f38769f5094019c --- /dev/null +++ b/tutorials/multiphase/interDyMFoam/ras/floatingObject/system/setFieldsDict @@ -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 ); + } +); + + +// ************************************************************************* //