Commit 5e46a129 authored by Mark Olesen's avatar Mark Olesen

STYLE: use degToRad() instead of pi/180

parent 09bd1077
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2017 OpenFOAM Foundation
......@@ -27,7 +27,7 @@ License
#include "JohnsonJacksonFrictionalStress.H"
#include "addToRunTimeSelectionTable.H"
#include "mathematicalConstants.H"
#include "unitConversion.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
......@@ -66,7 +66,7 @@ JohnsonJackson
phi_("phi", dimless, coeffDict_),
alphaDeltaMin_("alphaDeltaMin", dimless, coeffDict_)
{
phi_ *= constant::mathematical::pi/180.0;
phi_ *= degToRad();
}
......@@ -139,7 +139,7 @@ bool Foam::kineticTheoryModels::frictionalStressModels::JohnsonJackson::read()
p_.read(coeffDict_);
phi_.read(coeffDict_);
phi_ *= constant::mathematical::pi/180.0;
phi_ *= degToRad();
alphaDeltaMin_.read(coeffDict_);
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2016-2017 OpenFOAM Foundation
......@@ -27,7 +27,7 @@ License
#include "JohnsonJacksonSchaefferFrictionalStress.H"
#include "addToRunTimeSelectionTable.H"
#include "mathematicalConstants.H"
#include "unitConversion.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
......@@ -66,7 +66,7 @@ JohnsonJacksonSchaeffer::JohnsonJacksonSchaeffer
phi_("phi", dimless, coeffDict_),
alphaDeltaMin_("alphaDeltaMin", dimless, coeffDict_)
{
phi_ *= constant::mathematical::pi/180.0;
phi_ *= degToRad();
}
......@@ -199,7 +199,7 @@ JohnsonJacksonSchaeffer::read()
p_.read(coeffDict_);
phi_.read(coeffDict_);
phi_ *= constant::mathematical::pi/180.0;
phi_ *= degToRad();
alphaDeltaMin_.read(coeffDict_);
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2017 OpenFOAM Foundation
......@@ -27,6 +27,7 @@ License
#include "SchaefferFrictionalStress.H"
#include "addToRunTimeSelectionTable.H"
#include "unitConversion.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
......@@ -60,7 +61,7 @@ Foam::kineticTheoryModels::frictionalStressModels::Schaeffer::Schaeffer
coeffDict_(dict.optionalSubDict(typeName + "Coeffs")),
phi_("phi", dimless, coeffDict_)
{
phi_ *= constant::mathematical::pi/180.0;
phi_ *= degToRad();
}
......@@ -183,7 +184,7 @@ bool Foam::kineticTheoryModels::frictionalStressModels::Schaeffer::read()
coeffDict_ <<= dict_.optionalSubDict(typeName + "Coeffs");
phi_.read(coeffDict_);
phi_ *= constant::mathematical::pi/180.0;
phi_ *= degToRad();
return true;
}
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2017 OpenFOAM Foundation
......@@ -27,7 +27,7 @@ License
#include "JohnsonJacksonFrictionalStress.H"
#include "addToRunTimeSelectionTable.H"
#include "mathematicalConstants.H"
#include "unitConversion.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
......@@ -66,7 +66,7 @@ JohnsonJackson
phi_("phi", dimless, coeffDict_),
alphaDeltaMin_("alphaDeltaMin", dimless, coeffDict_)
{
phi_ *= constant::mathematical::pi/180.0;
phi_ *= degToRad();
}
......@@ -139,7 +139,7 @@ bool Foam::kineticTheoryModels::frictionalStressModels::JohnsonJackson::read()
p_.read(coeffDict_);
phi_.read(coeffDict_);
phi_ *= constant::mathematical::pi/180.0;
phi_ *= degToRad();
alphaDeltaMin_.read(coeffDict_);
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2016-2017 OpenFOAM Foundation
......@@ -27,7 +27,7 @@ License
#include "JohnsonJacksonSchaefferFrictionalStress.H"
#include "addToRunTimeSelectionTable.H"
#include "mathematicalConstants.H"
#include "unitConversion.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
......@@ -66,7 +66,7 @@ JohnsonJacksonSchaeffer::JohnsonJacksonSchaeffer
phi_("phi", dimless, coeffDict_),
alphaDeltaMin_("alphaDeltaMin", dimless, coeffDict_)
{
phi_ *= constant::mathematical::pi/180.0;
phi_ *= degToRad();
}
......@@ -199,7 +199,7 @@ JohnsonJacksonSchaeffer::read()
p_.read(coeffDict_);
phi_.read(coeffDict_);
phi_ *= constant::mathematical::pi/180.0;
phi_ *= degToRad();
alphaDeltaMin_.read(coeffDict_);
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2017 OpenFOAM Foundation
......@@ -27,6 +27,7 @@ License
#include "SchaefferFrictionalStress.H"
#include "addToRunTimeSelectionTable.H"
#include "unitConversion.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
......@@ -60,7 +61,7 @@ Foam::kineticTheoryModels::frictionalStressModels::Schaeffer::Schaeffer
coeffDict_(dict.optionalSubDict(typeName + "Coeffs")),
phi_("phi", dimless, coeffDict_)
{
phi_ *= constant::mathematical::pi/180.0;
phi_ *= degToRad();
}
......@@ -183,7 +184,7 @@ bool Foam::kineticTheoryModels::frictionalStressModels::Schaeffer::read()
coeffDict_ <<= dict_.optionalSubDict(typeName + "Coeffs");
phi_.read(coeffDict_);
phi_ *= constant::mathematical::pi/180.0;
phi_ *= degToRad();
return true;
}
......
......@@ -199,13 +199,13 @@ int main(int argc, char *argv[])
<< Ra
(
axisAngle.first() / mag(axisAngle.first()),
axisAngle.second() * constant::mathematical::pi/180.0
degToRad(axisAngle.second())
) << nl;
Info<< "-ve Ra = "
<< Ra
(
axisAngle.first() / mag(axisAngle.first()),
-axisAngle.second() * constant::mathematical::pi/180.0
degToRad(-axisAngle.second())
) << nl;
}
......
......@@ -73,10 +73,9 @@ Usage
#include "pointFields.H"
#include "transformField.H"
#include "transformGeometricField.H"
#include "mathematicalConstants.H"
#include "unitConversion.H"
using namespace Foam;
using namespace Foam::constant::mathematical;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -310,7 +309,7 @@ int main(int argc, char *argv[])
const quaternion quat
(
axisAngle.first(),
axisAngle.second() * pi/180.0 // degToRad
degToRad(axisAngle.second())
);
Info<< "Rotating points by quaternion " << quat << endl;
......@@ -328,8 +327,7 @@ int main(int argc, char *argv[])
<< " pitch " << v.y() << nl
<< " yaw " << v.z() << nl;
// degToRad
v *= pi/180.0;
v *= degToRad();
const quaternion quat(quaternion::rotationSequence::XYZ, v);
......@@ -348,8 +346,7 @@ int main(int argc, char *argv[])
<< " pitch " << v.y() << nl
<< " roll " << v.z() << nl;
// degToRad
v *= pi/180.0;
v *= degToRad();
const quaternion quat(quaternion::rotationSequence::ZYX, v);
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010, 2017 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2010, 2017-2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2016 OpenFOAM Foundation
......@@ -49,12 +49,11 @@ Description
#include "Pair.H"
#include "Tuple2.H"
#include "quaternion.H"
#include "mathematicalConstants.H"
#include "unitConversion.H"
#include "MeshedSurfaces.H"
using namespace Foam;
using namespace Foam::constant::mathematical;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -200,7 +199,7 @@ int main(int argc, char *argv[])
const quaternion quat
(
axisAngle.first(),
axisAngle.second() * pi/180.0 // degToRad
degToRad(axisAngle.second())
);
Info<< "Rotating points by quaternion " << quat << endl;
......@@ -213,8 +212,7 @@ int main(int argc, char *argv[])
<< " pitch " << v.y() << nl
<< " yaw " << v.z() << nl;
// degToRad
v *= pi/180.0;
v *= degToRad();
const quaternion quat(quaternion::rotationSequence::XYZ, v);
......@@ -228,8 +226,7 @@ int main(int argc, char *argv[])
<< " pitch " << v.y() << nl
<< " roll " << v.z() << nl;
// degToRad
v *= pi/180.0;
v *= degToRad();
const quaternion quat(quaternion::rotationSequence::ZYX, v);
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2010, 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2016 OpenFOAM Foundation
......@@ -27,9 +27,7 @@ License
#include "oscillatingRotatingMotion.H"
#include "addToRunTimeSelectionTable.H"
#include "mathematicalConstants.H"
using namespace Foam::constant::mathematical;
#include "unitConversion.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
......@@ -81,7 +79,7 @@ transformation() const
vector eulerAngles = amplitude_*sin(omega_*t);
// Convert the rotational motion from deg to rad
eulerAngles *= pi/180.0;
eulerAngles *= degToRad();
quaternion R(quaternion::XYZ, eulerAngles);
septernion TR(septernion(-origin_)*R*septernion(origin_));
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2004-2010, 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2016 OpenFOAM Foundation
......@@ -30,9 +30,8 @@ License
#include "Tuple2.H"
#include "IFstream.H"
#include "interpolateSplineXY.H"
#include "mathematicalConstants.H"
#include "unitConversion.H"
using namespace Foam::constant::mathematical;
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
......@@ -104,7 +103,7 @@ Foam::solidBodyMotionFunctions::tabulated6DoFMotion::transformation() const
);
// Convert the rotational motion from deg to rad
TRV[1] *= pi/180.0;
TRV[1] *= degToRad();
quaternion R(quaternion::XYZ, TRV[1]);
septernion TR(septernion(-CofG_ + -TRV[0])*R*septernion(CofG_));
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2017 OpenFOAM Foundation
......@@ -185,7 +185,7 @@ void Foam::ParticleErosion<CloudType>::postPatch
const vector Udir = U/magU;
// determine impact angle, alpha
const scalar alpha = mathematical::pi/2.0 - acos(nw & Udir);
const scalar alpha = mathematical::piByTwo - acos(nw & Udir);
const scalar coeff = p.nParticle()*p.mass()*sqr(magU)/(p_*psi_*K_);
......
......@@ -27,7 +27,7 @@ License
#include "ConeNozzleInjection.H"
#include "TimeFunction1.H"
#include "mathematicalConstants.H"
#include "unitConversion.H"
#include "distributionModel.H"
using namespace Foam::constant;
......@@ -417,14 +417,11 @@ void Foam::ConeNozzleInjection<CloudType>::setProperties
Random& rndGen = this->owner().rndGen();
// Set particle velocity
const scalar deg2Rad = mathematical::pi/180.0;
scalar t = time - this->SOI_;
scalar ti = thetaInner_.value(t);
scalar to = thetaOuter_.value(t);
scalar coneAngle = rndGen.sample01<scalar>()*(to - ti) + ti;
scalar coneAngle = degToRad(rndGen.sample01<scalar>()*(to - ti) + ti);
coneAngle *= deg2Rad;
scalar alpha = sin(coneAngle);
scalar dcorr = cos(coneAngle);
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2011, 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2017 OpenFOAM Foundation
......@@ -27,7 +27,7 @@ License
#include "ThermoSurfaceFilm.H"
#include "addToRunTimeSelectionTable.H"
#include "mathematicalConstants.H"
#include "unitConversion.H"
#include "Pstream.H"
using namespace Foam::constant::mathematical;
......@@ -114,7 +114,7 @@ Foam::vector Foam::ThermoSurfaceFilm<CloudType>::splashDirection
const scalar phiSi = twoPi*rndGen_.sample01<scalar>();
// Ejection angle [rad]
const scalar thetaSi = pi/180.0*(rndGen_.sample01<scalar>()*(50 - 5) + 5);
const scalar thetaSi = degToRad(rndGen_.sample01<scalar>()*(50 - 5) + 5);
// Direction vector of new parcel
const scalar alpha = sin(thetaSi);
......@@ -311,7 +311,7 @@ void Foam::ThermoSurfaceFilm<CloudType>::wetSplashInteraction
else if ((We >= 2) && (We < 20)) // Bounce
{
// Incident angle of impingement
const scalar theta = pi/2 - acos(U/mag(U) & nf);
const scalar theta = piByTwo - acos(U/mag(U) & nf);
// Restitution coefficient
const scalar epsilon = 0.993 - theta*(1.76 - theta*(1.56 - theta*0.49));
......
......@@ -27,9 +27,7 @@ License
#include "moleculeCloud.H"
#include "fvMesh.H"
#include "mathematicalConstants.H"
using namespace Foam::constant::mathematical;
#include "unitConversion.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
......@@ -610,11 +608,9 @@ void Foam::moleculeCloud::initialiseMolecules
zoneDict.get<vector>("orientationAngles")
);
scalar phi(orientationAngles.x()*pi/180.0);
scalar theta(orientationAngles.y()*pi/180.0);
scalar psi(orientationAngles.z()*pi/180.0);
const scalar phi(degToRad(orientationAngles.x()));
const scalar theta(degToRad(orientationAngles.y()));
const scalar psi(degToRad(orientationAngles.z()));
const tensor R
(
......@@ -984,11 +980,9 @@ void Foam::moleculeCloud::createMolecule
{
pi = equipartitionAngularMomentum(temperature, cP);
scalar phi(rndGen_.sample01<scalar>()*twoPi);
scalar theta(rndGen_.sample01<scalar>()*twoPi);
scalar psi(rndGen_.sample01<scalar>()*twoPi);
const scalar phi(rndGen_.sample01<scalar>()*mathematical::twoPi);
const scalar theta(rndGen_.sample01<scalar>()*mathematical::twoPi);
const scalar psi(rndGen_.sample01<scalar>()*mathematical::twoPi);
Q = tensor
(
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd |
\\ / A nd | Copyright (C) 2019 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
| Copyright (C) 2011-2016 OpenFOAM Foundation
......@@ -32,7 +32,7 @@ License
#include "polyMesh.H"
#include "addToRunTimeSelectionTable.H"
#include "word.H"
#include "mathematicalConstants.H"
#include "unitConversion.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
......@@ -72,7 +72,7 @@ void Foam::circleSet::calcSamples
}
// Add remaining points
const scalar alpha = constant::mathematical::pi/180.0*dTheta_;
const scalar alpha = degToRad(dTheta_);
const scalar sinAlpha = sin(alpha);
const scalar cosAlpha = cos(alpha);
......@@ -107,10 +107,7 @@ void Foam::circleSet::calcSamples
samplingCells.append(celli);
samplingFaces.append(-1);
samplingSegments.append(nPoint);
samplingCurveDist.append
(
radius*constant::mathematical::pi/180.0*theta
);
samplingCurveDist.append(radius*degToRad(theta));
++nPoint;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment