Merge branch 'master' of ssh://noisy/home/noisy3/OpenFOAM/OpenFOAM-dev

This commit is contained in:
henry
2009-09-01 10:44:48 +01:00
245 changed files with 3279 additions and 2419 deletions

View File

@ -30,7 +30,7 @@ scalar gasMass0 = fvc::domainIntegrate(rho).value();
if (dieselSpray.twoD())
{
gasMass0 *= 2.0*mathematicalConstant::pi/dieselSpray.angleOfWedge();
gasMass0 *= constant::math::twoPi/dieselSpray.angleOfWedge();
}
gasMass0 -=

View File

@ -43,6 +43,7 @@ Description
#include "OFstream.H"
#include "volPointInterpolation.H"
#include "thermoPhysicsTypes.H"
#include "mathConstants.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -20,7 +20,7 @@
if (dieselSpray.twoD())
{
gasMass *= 2.0*mathematicalConstant::pi/dieselSpray.angleOfWedge();
gasMass *= constant::math::twoPi/dieselSpray.angleOfWedge();
}
scalar addedMass = gasMass - gasMass0;

View File

@ -41,6 +41,7 @@ Description
#include "IFstream.H"
#include "OFstream.H"
#include "Switch.H"
#include "mathConstants.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -58,6 +58,7 @@ Description
#include "ignition.H"
#include "Switch.H"
#include "OFstream.H"
#include "mathConstants.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -28,7 +28,7 @@ License
#include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "mathematicalConstants.H"
#include "mathConstants.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -182,7 +182,7 @@ void smoluchowskiJumpTFvPatchScalarField::updateCoeffs()
}
Field<scalar> C2 = pmu/prho
*sqrt(ppsi*mathematicalConstant::pi/2.0)
*sqrt(ppsi*constant::math::piByTwo)
*2.0*gamma_/Pr.value()/(gamma_ + 1.0)
*(2.0 - accommodationCoeff_)/accommodationCoeff_;

View File

@ -28,7 +28,7 @@ Description
#include "maxwellSlipUFvPatchVectorField.H"
#include "addToRunTimeSelectionTable.H"
#include "mathematicalConstants.H"
#include "mathConstants.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "surfaceFields.H"
@ -147,7 +147,7 @@ void maxwellSlipUFvPatchVectorField::updateCoeffs()
const fvPatchField<scalar>& ppsi =
patch().lookupPatchField<volScalarField, scalar>("psi");
Field<scalar> C1 = sqrt(ppsi*mathematicalConstant::pi/2.0)
Field<scalar> C1 = sqrt(ppsi*constant::math::piByTwo)
*(2.0 - accommodationCoeff_)/accommodationCoeff_;
Field<scalar> pnu = pmu/prho;

View File

@ -25,7 +25,7 @@ License
\*---------------------------------------------------------------------------*/
#include "SchnerrSauer.H"
#include "mathematicalConstants.H"
#include "mathConstants.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -77,7 +77,7 @@ Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::rRb
{
return pow
(
((4*mathematicalConstant::pi*n_)/3)
((4*constant::math::pi*n_)/3)
*limitedAlpha1/(1.0 + alphaNuc() - limitedAlpha1),
1.0/3.0
);
@ -87,7 +87,7 @@ Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::rRb
Foam::dimensionedScalar
Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::alphaNuc() const
{
dimensionedScalar Vnuc = n_*mathematicalConstant::pi*pow3(dNuc_)/6;
dimensionedScalar Vnuc = n_*constant::math::pi*pow3(dNuc_)/6;
return Vnuc/(1 + Vnuc);
}

View File

@ -29,11 +29,12 @@ License
#include "Time.H"
#include "subCycle.H"
#include "fvCFD.H"
#include "mathConstants.H"
// * * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * //
const scalar Foam::multiphaseMixture::convertToRad =
Foam::mathematicalConstant::pi/180.0;
Foam::constant::math::pi/180.0;
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //

View File

@ -25,7 +25,7 @@ License
\*---------------------------------------------------------------------------*/
#include "GidaspowConductivity.H"
#include "mathematicalConstants.H"
#include "mathConstants.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -69,13 +69,13 @@ Foam::tmp<Foam::volScalarField> Foam::GidaspowConductivity::kappa
const dimensionedScalar& e
) const
{
const scalar sqrtPi = sqrt(mathematicalConstant::pi);
const scalar sqrtPi = sqrt(constant::math::pi);
return rhoa*da*sqrt(Theta)*
(
2.0*sqr(alpha)*g0*(1.0 + e)/sqrtPi
+ (9.0/8.0)*sqrtPi*g0*0.5*(1.0 + e)*sqr(alpha)
+ (15.0/16.0)*sqrtPi*alpha
+ (15.0/16.0)*sqrtPi*alpha
+ (25.0/64.0)*sqrtPi/((1.0 + e)*g0)
);
}

View File

@ -25,7 +25,7 @@ License
\*---------------------------------------------------------------------------*/
#include "HrenyaSinclairConductivity.H"
#include "mathematicalConstants.H"
#include "mathConstants.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -74,9 +74,9 @@ Foam::tmp<Foam::volScalarField> Foam::HrenyaSinclairConductivity::kappa
const dimensionedScalar& e
) const
{
const scalar sqrtPi = sqrt(mathematicalConstant::pi);
const scalar sqrtPi = sqrt(constant::math::pi);
volScalarField lamda =
volScalarField lamda =
scalar(1) + da/(6.0*sqrt(2.0)*(alpha + scalar(1.0e-5)))/L_;
return rhoa*da*sqrt(Theta)*

View File

@ -25,7 +25,7 @@ License
\*---------------------------------------------------------------------------*/
#include "SyamlalConductivity.H"
#include "mathematicalConstants.H"
#include "mathConstants.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -69,7 +69,7 @@ Foam::tmp<Foam::volScalarField> Foam::SyamlalConductivity::kappa
const dimensionedScalar& e
) const
{
const scalar sqrtPi = sqrt(mathematicalConstant::pi);
const scalar sqrtPi = sqrt(constant::math::pi);
return rhoa*da*sqrt(Theta)*
(

View File

@ -26,7 +26,7 @@ License
#include "kineticTheoryModel.H"
#include "surfaceInterpolate.H"
#include "mathematicalConstants.H"
#include "mathConstants.H"
#include "fvCFD.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -204,7 +204,7 @@ void Foam::kineticTheoryModel::solve()
volScalarField alpha = alpha_;
alpha.max(1.0e-6);
const scalar sqrtPi = sqrt(mathematicalConstant::pi);
const scalar sqrtPi = sqrt(constant::math::pi);
surfaceScalarField phi = 1.5*rhoa_*phia_*fvc::interpolate(alpha_);

View File

@ -25,7 +25,7 @@ License
\*---------------------------------------------------------------------------*/
#include "GidaspowViscosity.H"
#include "mathematicalConstants.H"
#include "mathConstants.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -70,7 +70,7 @@ Foam::kineticTheoryModels::GidaspowViscosity::mua
const dimensionedScalar& e
) const
{
const scalar sqrtPi = sqrt(mathematicalConstant::pi);
const scalar sqrtPi = sqrt(constant::math::pi);
return rhoa*da*sqrt(Theta)*
(

View File

@ -25,7 +25,7 @@ License
\*---------------------------------------------------------------------------*/
#include "HrenyaSinclairViscosity.H"
#include "mathematicalConstants.H"
#include "mathConstants.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -77,7 +77,7 @@ Foam::kineticTheoryModels::HrenyaSinclairViscosity::mua
const dimensionedScalar& e
) const
{
const scalar sqrtPi = sqrt(mathematicalConstant::pi);
const scalar sqrtPi = sqrt(constant::math::pi);
volScalarField lamda =
scalar(1) + da/(6.0*sqrt(2.0)*(alpha + scalar(1.0e-5)))/L_;

View File

@ -25,7 +25,7 @@ License
\*---------------------------------------------------------------------------*/
#include "SyamlalViscosity.H"
#include "mathematicalConstants.H"
#include "mathConstants.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -69,7 +69,7 @@ Foam::tmp<Foam::volScalarField> Foam::kineticTheoryModels::SyamlalViscosity::mua
const dimensionedScalar& e
) const
{
const scalar sqrtPi = sqrt(mathematicalConstant::pi);
const scalar sqrtPi = sqrt(constant::math::pi);
return rhoa*da*sqrt(Theta)*
(

View File

@ -32,7 +32,7 @@ Description
#include "graph.H"
#include "OFstream.H"
#include "mathematicalConstants.H"
#include "mathConstants.H"
using namespace Foam;
@ -50,7 +50,7 @@ int main()
scalarField b = 0.5*(1.0 + erf(x));
scalarField c = 1.0 - b;
scalarField gradb = (1/::sqrt(mathematicalConstant::pi))*exp(-sqr(x));
scalarField gradb = (1/::sqrt(constant::math::pi))*exp(-sqr(x));
scalarField lapb = -2*x*gradb;
r = lapb*b*c/(gradb*gradb);

View File

@ -47,7 +47,7 @@ Description
#include "polyTopoChanger.H"
#include "polyMesh.H"
#include "mapPolyMesh.H"
#include "mathematicalConstants.H"
#include "mathConstants.H"
#include "PackedBoolList.H"
#include "SortableList.H"
@ -467,7 +467,7 @@ int main(int argc, char *argv[])
scalar angle(readScalar(IStringStream(args.additionalArgs()[1])()));
bool overwrite = args.optionFound("overwrite");
scalar maxCos = Foam::cos(angle*180/mathematicalConstant::pi);
scalar maxCos = Foam::cos(angle*180/constant::math::pi);
Info<< "Merging:" << nl
<< " edges with length less than " << minLen << " meters" << nl

View File

@ -53,7 +53,7 @@ Description
#include "removePoints.H"
#include "polyMesh.H"
#include "mapPolyMesh.H"
#include "mathematicalConstants.H"
#include "mathConstants.H"
using namespace Foam;
@ -445,12 +445,12 @@ int main(int argc, char *argv[])
scalar featureAngle(readScalar(IStringStream(args.additionalArgs()[0])()));
scalar minCos = Foam::cos(featureAngle*mathematicalConstant::pi/180.0);
scalar minCos = Foam::cos(featureAngle*constant::math::pi/180.0);
scalar concaveAngle = defaultConcaveAngle;
args.optionReadIfPresent("concaveAngle", concaveAngle);
scalar concaveSin = Foam::sin(concaveAngle*mathematicalConstant::pi/180.0);
scalar concaveSin = Foam::sin(concaveAngle*constant::math::pi/180.0);
bool snapMeshDict = args.optionFound("snapMesh");
bool overwrite = args.optionFound("overwrite");

View File

@ -49,7 +49,7 @@ Description
#include "cellSet.H"
#include "cellModeller.H"
#include "meshCutter.H"
#include "mathematicalConstants.H"
#include "mathConstants.H"
#include "geomCellLooper.H"
#include "plane.H"
#include "edgeVertex.H"
@ -539,7 +539,7 @@ int main(int argc, char *argv[])
scalar featureAngle(readScalar(IStringStream(args.additionalArgs()[0])()));
scalar radAngle = featureAngle * mathematicalConstant::pi/180.0;
scalar radAngle = featureAngle*constant::math::pi/180.0;
scalar minCos = Foam::cos(radAngle);
scalar minSin = Foam::sin(radAngle);

View File

@ -43,7 +43,7 @@ Description
#include "symmetryPolyPatch.H"
#include "wedgePolyPatch.H"
#include "cyclicPolyPatch.H"
#include "mathematicalConstants.H"
#include "mathConstants.H"
using namespace Foam;

View File

@ -223,7 +223,7 @@ const char* kivaPatchNames[nBCs] =
"cylinderHead",
"axis",
"wedge",
"inflow",
"inflow",
"outflow",
"presin",
"presout",
@ -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*mathematicalConstant::pi/180.0);
scalar tanTheta = Foam::tan(2.5*constant::math::pi/180.0);
SLList<face>::iterator iterf = pFaces[WEDGE][0].begin();
SLList<face>::iterator iterb = pFaces[WEDGE][1].begin();

View File

@ -59,7 +59,7 @@ Usage
#include "Time.H"
#include "timeSelector.H"
#include "fvMesh.H"
#include "mathematicalConstants.H"
#include "mathConstants.H"
#include "polyTopoChange.H"
#include "mapPolyMesh.H"
#include "PackedBoolList.H"
@ -91,7 +91,7 @@ void simpleMarkFeatures
labelList& multiCellFeaturePoints
)
{
scalar minCos = Foam::cos(featureAngle * mathematicalConstant::pi/180.0);
scalar minCos = Foam::cos(featureAngle*constant::math::pi/180.0);
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 * mathematicalConstant::pi/180.0);
scalar minCos = Foam::cos(featureAngle*constant::math::pi/180.0);
Info<< "Feature:" << featureAngle << endl
<< "minCos :" << minCos << endl

View File

@ -33,7 +33,7 @@ Description
#include "IOmanip.H"
#include "boundBox.H"
#include "Map.H"
#include "mathematicalConstants.H"
#include "mathConstants.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -99,7 +99,7 @@ void starMesh::createCoupleMatches()
<< coupleI << ". STAR couple ID: "
<< couples_[coupleI].coupleID() << endl
<< "The angle between face normals is "
<< Foam::acos(faceAreaAngle)/mathematicalConstant::pi*180
<< Foam::acos(faceAreaAngle)/constant::math::pi*180
<< " deg." << endl
<< "master cell: " << fp.masterCell()
<< " STAR number: " << starCellID_[fp.masterCell()]

View File

@ -29,7 +29,7 @@ Description
\*---------------------------------------------------------------------------*/
#include "arcEdge.H"
#include "mathematicalConstants.H"
#include "mathConstants.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -78,7 +78,7 @@ Foam::cylindricalCS Foam::arcEdge::calcAngle()
// find angles
scalar tmp = (r3&r1)/(mag(r3)*mag(r1));
angle_ = acos(tmp)*180.0/mathematicalConstant::pi;
angle_ = acos(tmp)*180.0/constant::math::pi;
// check if the vectors define an exterior or an interior arcEdge
if (((r1 ^ r2)&(r1 ^ r3)) < 0.0) angle_ = 360 - angle_;
@ -162,7 +162,7 @@ Foam::vector Foam::arcEdge::position(const scalar lambda) const
//- Return the length of the curve
Foam::scalar Foam::arcEdge::length() const
{
return angle_*radius_*mathematicalConstant::pi/180.0;
return angle_*radius_*constant::math::pi/180.0;
}

View File

@ -39,7 +39,6 @@ Description
#include "polyTopoChange.H"
#include "polyTopoChanger.H"
#include "edgeCollapser.H"
#include "mathematicalConstants.H"
#include "globalMeshData.H"
#include "perfectInterface.H"
#include "addPatchCellLayer.H"

View File

@ -26,7 +26,7 @@ License
#include "wedge.H"
#include "addToRunTimeSelectionTable.H"
#include "mathematicalConstants.H"
#include "mathConstants.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -52,7 +52,7 @@ wedge::wedge(const dictionary& dict)
angle_
(
readScalar(coeffDict_.lookup("angle"))
*mathematicalConstant::pi/180.0
*constant::math::pi/180.0
)
{}

View File

@ -33,7 +33,7 @@ Description
#include "Time.H"
#include "boundaryMesh.H"
#include "repatchPolyTopoChanger.H"
#include "mathematicalConstants.H"
#include "mathConstants.H"
#include "OFstream.H"
#include "ListOps.H"
@ -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 * mathematicalConstant::pi/180.0);
scalar minCos = Foam::cos(featureAngle*constant::math::pi/180.0);
Info<< "Feature:" << featureAngle << endl
<< "minCos :" << minCos << endl

View File

@ -67,9 +67,10 @@ Usage
#include "transformField.H"
#include "transformGeometricField.H"
#include "IStringStream.H"
#include "mathConstants.H"
using namespace Foam;
using namespace Foam::mathematicalConstant;
using namespace Foam::constant::math;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -1,6 +1,8 @@
EXE_INC = \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/pdfs/lnInclude
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/pdfs/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude
EXE_LIBS = \
-lpdf
-lpdf \
-lsampling

View File

@ -2,7 +2,7 @@
(
IOobject
(
"pdfDictionary",
"pdfDict",
runTime.constant(),
runTime,
IOobject::MUST_READ,
@ -10,20 +10,9 @@
)
);
label nIntervals
(
readLabel(pdfDictionary.lookup("nIntervals"))
);
label nIntervals(readLabel(pdfDictionary.lookup("nIntervals")));
label nSamples
(
readLabel(pdfDictionary.lookup("nSamples"))
);
label nSamples(readLabel(pdfDictionary.lookup("nSamples")));
label samples[nIntervals];
for(label i=0;i<nIntervals;i++)
{
samples[i] = 0;
}
scalarField samples(nIntervals, 0);

View File

@ -0,0 +1,35 @@
/*--------------------------------*- 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 pdfDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Number of intervals/bins in pdf plot
nIntervals 20;
// Number of samples
nSamples 10000;
// Type of pdf
pdfType RosinRammler;
RosinRammlerPDF
{
minValue 1e-06;
maxValue 200e-06;
d (60.0e-06);
n (0.8);
}
// ************************************************************************* //

View File

@ -23,50 +23,60 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
Generates an .obj file to plot a probability distribution function
Generates a graph of a probability distribution function
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "pdf.H"
#include "OFstream.H"
#include "makeGraph.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program:
int main(int argc, char *argv[])
{
#include "setRootCase.H"
#include "createTime.H"
#include "createFields.H"
# include "setRootCase.H"
# include "createTime.H"
# include "createFields.H"
OFstream objFileNew("s.m");
fileName pdfPath = runTime.path()/"pdf";
mkDir(pdfPath);
Random rndGen(label(0));
autoPtr<pdf> p
(
pdf::New(pdfDictionary, rndGen)
);
autoPtr<pdf> p(pdf::New(pdfDictionary, rndGen));
scalar xMin = p->minValue();
scalar xMax = p->maxValue();
for(label i=0;i<nSamples;i++)
label iCheck = 100;
for (label i=1; i<=nSamples; i++)
{
scalar ps = p->sample();
label n = label((ps-xMin)*nIntervals/(xMax-xMin));
//Info << "p[" << i << "] = " << ps << ", n = " << n << endl;
label n = label((ps - xMin)*nIntervals/(xMax - xMin));
samples[n]++;
if (i % iCheck == 0)
{
Info<< " processed " << i << " samples" << endl;
if (i == 10*iCheck)
{
iCheck *= 10;
}
}
}
for(label i=0;i<nIntervals;i++)
scalarField x(nIntervals);
forAll(x, i)
{
scalar x = xMin + i*(xMax-xMin)/(nIntervals-1);
objFileNew << x << " \t" << samples[i] << endl;
x[i] = xMin + i*(xMax - xMin)/(nIntervals - 1);
}
makeGraph(x, samples, p->type(), pdfPath, runTime.graphFormat());
Info << "End\n" << endl;
return 0;

View File

@ -31,7 +31,7 @@ Description
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "mathematicalConstants.H"
#include "mathConstants.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -45,7 +45,7 @@ int main(int argc, char *argv[])
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
scalar Vphi = (mathematicalConstant::pi*swirlRPMRatio*rpm/30).value();
scalar Vphi = (constant::math::pi*swirlRPMRatio*rpm/30).value();
scalar b1 = j1(swirlProfile).value();
scalar b2 = 2.0*b1/swirlProfile.value() - j0(swirlProfile).value();

View File

@ -37,14 +37,22 @@ Description
using namespace Foam;
template<class GeoField>
void setFieldType
template<class Type>
bool setFieldType
(
const word& fieldTypeDesc,
const fvMesh& mesh,
const labelList& selectedCells,
Istream& fieldValueStream
)
{
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
if (fieldTypeDesc != fieldType::typeName + "Value")
{
return false;
}
word fieldName(fieldValueStream);
IOobject fieldHeader
@ -61,15 +69,9 @@ void setFieldType
Info<< " Setting " << fieldHeader.headerClassName()
<< " " << fieldName << endl;
GeoField field(fieldHeader, mesh);
fieldType field(fieldHeader, mesh);
typename GeoField::value_type value
(
static_cast<const typename GeoField::value_type&>
(
pTraits<typename GeoField::value_type>(fieldValueStream)
)
);
const Type& value = pTraits<Type>(fieldValueStream);
if (selectedCells.size() == field.size())
{
@ -100,6 +102,8 @@ void setFieldType
"Istream& fieldValueStream)"
) << "Field " << fieldName << " not found" << endl;
}
return true;
}
@ -133,32 +137,21 @@ public:
{
word fieldType(fieldValues);
if (fieldType == "volScalarFieldValue")
{
setFieldType<volScalarField>
(mesh_, selectedCells_, fieldValues);
}
else if (fieldType == "volVectorFieldValue")
{
setFieldType<volVectorField>
(mesh_, selectedCells_, fieldValues);
}
else if (fieldType == "volSphericalTensorFieldValue")
{
setFieldType<volSphericalTensorField>
(mesh_, selectedCells_, fieldValues);
}
else if (fieldType == "volSymmTensorFieldValue")
{
setFieldType<volSymmTensorField>
(mesh_, selectedCells_, fieldValues);
}
else if (fieldType == "volTensorFieldValue")
{
setFieldType<volTensorField>
(mesh_, selectedCells_, fieldValues);
}
else
if
(
!(
setFieldType<scalar>
(fieldType, mesh_, selectedCells_, fieldValues)
|| setFieldType<vector>
(fieldType, mesh_, selectedCells_, fieldValues)
|| setFieldType<sphericalTensor>
(fieldType, mesh_, selectedCells_, fieldValues)
|| setFieldType<symmTensor>
(fieldType, mesh_, selectedCells_, fieldValues)
|| setFieldType<tensor>
(fieldType, mesh_, selectedCells_, fieldValues)
)
)
{
WarningIn("setField::iNew::operator()(Istream& is)")
<< "field type " << fieldType << " not currently supported"

View File

@ -43,9 +43,10 @@ Description
#include "transformField.H"
#include "Pair.H"
#include "quaternion.H"
#include "mathConstants.H"
using namespace Foam;
using namespace Foam::mathematicalConstant;
using namespace Foam::constant::math;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -54,8 +54,8 @@ int main(int argc, char *argv[])
OFstream reactionsFile(FOAMChemistryFileName);
reactionsFile
<< "species" << cr.species() << ';' << endl << endl
<< "reactions" << cr.reactions() << ';' << endl;
<< "species" << cr.species() << token::END_STATEMENT << nl << nl
<< "reactions" << cr.reactions() << token::END_STATEMENT << endl;
OFstream thermoFile(FOAMThermodynamicsFileName);
thermoFile<< cr.speciesThermo() << endl;

View File

@ -877,34 +877,68 @@ OptimisationSwitches
DimensionedConstants
{
// SI units
unitSet SI; // USCS
//- Universal gas constant [J/(kmol K)]
R 8314.51;
//- Standard pressure [Pa]
Pstd 1.0e5;
//- Standard temperature [K]
Tstd 298.15;
//- Stefan-Boltzmann constant [J/(K4 m2 s)]
sigmaSB sigmaSB [1 0 -3 -4 0 0 0] 5.670e-08;
/* USCS units
//- Universal gas constant [lbm ft2/(s2 kmol R)]
R 3406.78;
//- Standard pressure [lbm/(ft2)]
Pstd 2088.6;
//- Standard temperature [degR]
Tstd 536.67;
//- Stefan-Boltzmann constant [lbm /(degR4 ft s)]
sigmaSB sigmaSB [1 0 -3 -4 0 0 0] 8.2292e-08;
*/
SICoeffs
{
universal
{
c c [ 0 1 -1 0 0 0 0 ] 2.99792e+08;
G G [ -1 3 -2 0 0 0 0 ] 6.67429e-11;
h h [ 1 2 -1 0 0 0 0 ] 6.62607e-34;
}
electromagnetic
{
e e [ 0 0 -1 0 0 1 0 ] 1.60218e-19;
}
atomic
{
me me [ 1 0 0 0 0 0 0 ] 9.10938e-31;
mp mp [ 1 0 0 0 0 0 0 ] 1.67262e-27;
}
physicoChemical
{
mu mu [ 1 0 0 0 0 0 0 ] 1.66054e-27;
k k [ 1 2 -2 -1 0 0 0 ] 1.38065e-23;
}
standard
{
//- Standard pressure [Pa]
Pstd Pstd [ 1 -1 -2 0 0 0 0 ] 100000;
//- Standard temperature [degK]
Tstd Tstd [ 0 0 0 1 0 0 0 ] 298.15;
}
}
USCSCoeffs
{
universal
{
c c [ 0 1 -1 0 0 0 0 ] 9.83558e+08;
G G [ -1 3 -2 0 0 0 0 ] 1.06909e-09;
h h [ 1 2 -1 0 0 0 0 ] 1.57234e-32;
}
electromagnetic
{
e e [ 0 0 -1 0 0 1 0 ] 1.60218e-19;
}
atomic
{
me me [ 1 0 0 0 0 0 0 ] 2.00825e-30;
mp mp [ 1 0 0 0 0 0 0 ] 3.68746e-27;
}
physicoChemical
{
mu mu [ 1 0 0 0 0 0 0 ] 3.66083e-27;
k k [ 1 2 -2 -1 0 0 0 ] 1.82012e-22;
}
standard
{
//- Standard pressure [lbm/ft^2]
Pstd Pstd [ 1 -1 -2 0 0 0 0 ] 2088.6;
//- Standard temperature [degR]
Tstd Tstd [ 0 0 0 1 0 0 0 ] 536.67;
}
}
}

View File

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

View File

@ -0,0 +1,132 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 "mathConstants.H"
#include "universalConstants.H"
#include "electromagneticConstants.H"
#include "atomicConstants.H"
#include "dimensionedConstants.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
const char* Foam::constant::atomic::group = "atomic";
const Foam::dimensionedScalar Foam::constant::atomic::alpha
(
dimensionedConstant
(
group,
"alpha",
dimensionedScalar
(
"alpha",
sqr(constant::electromagnetic::e)
/(
dimensionedScalar("C", dimless, 2.0)
*constant::electromagnetic::epsilon0
*constant::universal::h
*constant::universal::c
)
)
)
);
const Foam::dimensionedScalar Foam::constant::atomic::Rinf
(
dimensionedConstant
(
group,
"Rinf",
dimensionedScalar
(
"Rinf",
sqr(alpha)*me*constant::universal::c
/(dimensionedScalar("C", dimless, 2.0)*constant::universal::h)
)
)
);
const Foam::dimensionedScalar Foam::constant::atomic::a0
(
dimensionedConstant
(
group,
"a0",
dimensionedScalar
(
"a0",
alpha
/(dimensionedScalar("C", dimless, 4.0*constant::math::pi)*Rinf)
)
)
);
const Foam::dimensionedScalar Foam::constant::atomic::re
(
dimensionedConstant
(
group,
"re",
dimensionedScalar
(
"re",
sqr(constant::electromagnetic::e)
/(
dimensionedScalar("C", dimless, 4.0*constant::math::pi)
*constant::electromagnetic::epsilon0
*me
*sqr(constant::universal::c)
)
)
)
);
const Foam::dimensionedScalar Foam::constant::atomic::Eh
(
dimensionedConstant
(
group,
"Eh",
dimensionedScalar
(
"Eh",
dimensionedScalar("C", dimless, 2.0)
*Rinf*constant::universal::h*constant::universal::c
)
)
);
// ************************************************************************* //

View File

@ -0,0 +1,81 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Namespace
Foam::constant::atom
Description
Atomic constants
\*---------------------------------------------------------------------------*/
#ifndef atomicConstants_H
#define atomicConstants_H
#include "dimensionedScalar.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace constant
{
namespace atomic
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- Group name for atomic constants
extern const char* group;
//- Fine-structure constant: default SI units: []
extern const dimensionedScalar alpha;
//- Rydberg constant: default SI units: [1/m]
extern const dimensionedScalar Rinf;
//- Bohr radius: default SI units: [m]
extern const dimensionedScalar a0;
//- Classical electron radius: default SI units: [m]
extern const dimensionedScalar re;
//- Hartree energy: default SI units: [J]
extern const dimensionedScalar Eh;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace atomic
} // end namespace constant
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -22,32 +22,21 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
InNamespace
Foam::radiation
Description
Constants used in radiation modelling
Collection of dimensioned constants
\*---------------------------------------------------------------------------*/
#ifndef radiationConstants_H
#define radiationConstants_H
#include "dimensionedScalar.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace radiation
{
//- Stefan-Boltzmann constant [J/(K4 m2 s)]
extern const dimensionedScalar sigmaSB;
}
}
// Constants supplied in the main controlDict
#include "fundamentalConstants.C"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Derived constants
#include "universalConstants.C"
#include "electromagneticConstants.C"
#include "atomicConstants.C"
#include "physicoChemicalConstants.C"
#endif
// ************************************************************************* //

View File

@ -0,0 +1,59 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Namespace
Foam::constant
Description
Collection of constants
\*---------------------------------------------------------------------------*/
#ifndef constants_H
#define constants_H
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Dimensionless coefficents
// Mathematical constants
#include "mathConstants.H"
// Dimensioned constants
// Fundamental constants
#include "fundamentalConstants.H"
// Derived constants
#include "universalConstants.H"
#include "electromagneticConstants.H"
#include "atomicConstants.H"
#include "physicoChemicalConstants.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,164 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 "mathConstants.H"
#include "universalConstants.H"
#include "electromagneticConstants.H"
#include "atomicConstants.H"
#include "dimensionedConstants.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
const char* Foam::constant::electromagnetic::group = "electromagnetic";
const Foam::dimensionedScalar Foam::constant::electromagnetic::mu0
(
dimensionedConstant
(
group,
"mu0",
dimensionedScalar
(
"mu0",
dimless,
4.0*constant::math::pi*1e-07
)
)
);
const Foam::dimensionedScalar Foam::constant::electromagnetic::epsilon0
(
dimensionedConstant
(
group,
"epsilon0",
dimensionedScalar
(
"epsilon0",
dimensionedScalar("C", dimless, 1.0)
/(mu0*sqr(constant::universal::c))
)
)
);
const Foam::dimensionedScalar Foam::constant::electromagnetic::Z0
(
dimensionedConstant
(
group,
"Z0",
dimensionedScalar
(
"Z0",
mu0*constant::universal::c
)
)
);
const Foam::dimensionedScalar Foam::constant::electromagnetic::kappa
(
dimensionedConstant
(
group,
"kappa",
dimensionedScalar
(
"kappa",
dimensionedScalar("C", dimless, 1.0/(4.0*constant::math::pi))
/epsilon0
)
)
);
const Foam::dimensionedScalar Foam::constant::electromagnetic::G0
(
dimensionedConstant
(
group,
"G0",
dimensionedScalar
(
"G0",
dimensionedScalar("C", dimless, 2)*sqr(e)/constant::universal::h
)
)
);
const Foam::dimensionedScalar Foam::constant::electromagnetic::KJ
(
dimensionedConstant
(
group,
"KJ",
dimensionedScalar
(
"KJ",
dimensionedScalar("C", dimless, 2)*e/constant::universal::h
)
)
);
const Foam::dimensionedScalar Foam::constant::electromagnetic::phi0
(
dimensionedConstant
(
group,
"phi0",
dimensionedScalar
(
"phi0",
constant::universal::h/(dimensionedScalar("C", dimless, 2)*e)
)
)
);
const Foam::dimensionedScalar Foam::constant::electromagnetic::RK
(
dimensionedConstant
(
group,
"RK",
dimensionedScalar
(
"RK",
constant::universal::h/sqr(e)
)
)
);
// ************************************************************************* //

View File

@ -0,0 +1,89 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Namespace
Foam::constant::em
Description
Electromagnetic constants
\*---------------------------------------------------------------------------*/
#ifndef electromagneticConstants_H
#define electromagneticConstants_H
#include "dimensionedScalar.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace constant
{
namespace electromagnetic
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- Group name for electromagnetic constants
extern const char* group;
//- Magnetic constant/permeability of free space: default SI units: [H/m]
extern const dimensionedScalar mu0;
//- Electric constant: default SI units: [F/m]
extern const dimensionedScalar epsilon0;
//- Characteristic impedance of a vacuum: default SI units: [ohm]
extern const dimensionedScalar Z0;
//- Coulomb constant: default SI units: [N.m2/C2]
extern const dimensionedScalar kappa;
//- Conductance quantum: default SI units: [S]
extern const dimensionedScalar G0;
//- Josephson constant: default SI units: [Hz/V]
extern const dimensionedScalar KJ;
//- Magnetic flux quantum: default SI units: [Wb]
extern const dimensionedScalar phi0;
//- von Klitzing constant: default SI units: [ohm]
extern const dimensionedScalar RK;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace electromagnetic
} // end namespace constant
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,128 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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
Description
Fundamental dimensioned constants
\*---------------------------------------------------------------------------*/
#include "fundamentalConstants.H"
#include "universalConstants.H"
#include "electromagneticConstants.H"
#include "atomicConstants.H"
#include "physicoChemicalConstants.H"
#include "dimensionedConstants.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Universal constants
const Foam::dimensionedScalar Foam::constant::universal::c
(
dimensionedConstant(universal::group, "c")
);
const Foam::dimensionedScalar Foam::constant::universal::G
(
dimensionedConstant(universal::group, "G")
);
const Foam::dimensionedScalar Foam::constant::universal::h
(
dimensionedConstant(universal::group, "h")
);
// Electromagnetic
const Foam::dimensionedScalar Foam::constant::electromagnetic::e
(
dimensionedConstant(electromagnetic::group, "e")
);
// Atomic
const Foam::dimensionedScalar Foam::constant::atomic::me
(
dimensionedConstant(atomic::group, "me")
);
const Foam::dimensionedScalar Foam::constant::atomic::mp
(
dimensionedConstant(atomic::group, "mp")
);
// Physico-chemical
const Foam::dimensionedScalar Foam::constant::physicoChemical::mu
(
dimensionedConstant(physicoChemical::group, "mu")
);
const Foam::dimensionedScalar Foam::constant::physicoChemical::NA
(
// dimensionedConstant(physicoChemical::group, "NA")
dimensionedConstant
(
physicoChemical::group,
"NA",
dimensionedScalar
(
"NA",
dimless/dimMoles,
6.0221417930e+23
)
)
);
const Foam::dimensionedScalar Foam::constant::physicoChemical::k
(
dimensionedConstant(physicoChemical::group, "k")
);
// Standard
const Foam::dimensionedScalar Foam::constant::standard::Pstd
(
dimensionedConstant("standard", "Pstd")
);
const Foam::dimensionedScalar Foam::constant::standard::Tstd
(
dimensionedConstant("standard", "Tstd")
);
// ************************************************************************* //

View File

@ -0,0 +1,101 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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
Description
Fundamental dimensioned constants
\*---------------------------------------------------------------------------*/
#ifndef fundamentalConstants_H
#define fundamentalConstants_H
#include "dimensionedScalar.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace constant
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace universal
{
//- Speed of light in a vacuum
extern const dimensionedScalar c;
//- Newtonian constant of gravitation
extern const dimensionedScalar G;
//- Planck constant
extern const dimensionedScalar h;
}
namespace electromagnetic
{
//- Elementary charge
extern const dimensionedScalar e;
}
namespace atomic
{
//- Electron mass
extern const dimensionedScalar me;
//- Proton mass
extern const dimensionedScalar mp;
}
namespace physicoChemical
{
//- Atomic mass unit
extern const dimensionedScalar mu;
//- Avagadro number
extern const dimensionedScalar NA;
//- Boltzmann constant
extern const dimensionedScalar k;
}
namespace standard
{
//- Standard pressure
extern const dimensionedScalar Pstd;
//- Standard temperature
extern const dimensionedScalar Tstd;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace constant
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -23,15 +23,15 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Namespace
Foam::mathematicalConstant
Foam::constant::math
Description
Mathematical constants such as pi, e.
mathematical constants
\*---------------------------------------------------------------------------*/
#ifndef mathematicalConstants_H
#define mathematicalConstants_H
#ifndef mathConstants_H
#define mathConstants_H
#include "scalar.H"
@ -39,19 +39,24 @@ Description
namespace Foam
{
namespace constant
{
namespace math
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace mathematicalConstant
{
static word group = "math";
const scalar e(M_E);
const scalar pi(M_PI);
const scalar twoPi(2*pi);
const scalar piByTwo(0.5*pi);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace math
} // end namespace constant
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -59,3 +64,6 @@ namespace mathematicalConstant
#endif
// ************************************************************************* //

View File

@ -0,0 +1,132 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 "mathConstants.H"
#include "universalConstants.H"
#include "electromagneticConstants.H"
#include "physicoChemicalConstants.H"
#include "dimensionedConstants.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
const char* Foam::constant::physicoChemical::group = "physicoChemical";
const Foam::dimensionedScalar Foam::constant::physicoChemical::R
(
dimensionedConstant
(
group,
"R",
dimensionedScalar
(
"R",
NA*k
)
)
);
const Foam::dimensionedScalar Foam::constant::physicoChemical::F
(
dimensionedConstant
(
group,
"F",
dimensionedScalar
(
"F",
NA*constant::electromagnetic::e
)
)
);
const Foam::dimensionedScalar Foam::constant::physicoChemical::sigma
(
dimensionedConstant
(
group,
"sigma",
dimensionedScalar
(
"sigma",
dimensionedScalar("C", dimless, sqr(constant::math::pi)/60.0)
*pow4(k)/(pow3(constant::universal::hr)*sqr(constant::universal::c))
)
)
);
const Foam::dimensionedScalar Foam::constant::physicoChemical::b
(
dimensionedConstant
(
group,
"b",
dimensionedScalar
(
"b",
(constant::universal::h*constant::universal::c/k)
/dimensionedScalar("C", dimless, 4.965114231)
)
)
);
const Foam::dimensionedScalar Foam::constant::physicoChemical::c1
(
dimensionedConstant
(
group,
"c1",
dimensionedScalar
(
"c1",
dimensionedScalar("C", dimless, constant::math::twoPi)
*constant::universal::h*sqr(constant::universal::c)
)
)
);
const Foam::dimensionedScalar Foam::constant::physicoChemical::c2
(
dimensionedConstant
(
group,
"c2",
dimensionedScalar
(
"c2",
constant::universal::h*constant::universal::c/k
)
)
);
// ************************************************************************* //

View File

@ -0,0 +1,85 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Namespace
Foam::constant::phys
Description
Physico-chemical constants
\*---------------------------------------------------------------------------*/
#ifndef physicoChemicalConstants_H
#define physicoChemicalConstants_H
#include "dimensionedScalar.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace constant
{
namespace physicoChemical
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- Group name for physico-chemical constants
extern const char* group;
//- Universal gas constant: default SI units: [J/mol/K]
extern const dimensionedScalar R;
//- Faraday constant: default SI units: [C/mol]
extern const dimensionedScalar F;
//- Stefan-Boltzmann constant: default SI units: [W/m2/K4]
extern const dimensionedScalar sigma;
//- Wien displacement law constant: default SI units: [m.K]
extern const dimensionedScalar b;
//- First radiation constant: default SI units: [W/m2]
extern const dimensionedScalar c1;
//- Second radiation constant: default SI units: [m.K]
extern const dimensionedScalar c2;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace physicoChemical
} // end namespace constant
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -24,25 +24,30 @@ License
\*---------------------------------------------------------------------------*/
#include "radiationConstants.H"
#include "universalConstants.H"
#include "mathConstants.H"
#include "dimensionedConstants.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- Stefan-Boltzmann constant (default in [J/(K4 m2 s)])
const Foam::dimensionedScalar Foam::radiation::sigmaSB
const char* Foam::constant::universal::group = "universal";
const Foam::dimensionedScalar Foam::constant::universal::hr
(
Foam::dimensionedConstant
dimensionedConstant
(
"sigmaSB",
group,
"hr",
dimensionedScalar
(
"sigmaSB",
dimensionSet(1, 0, -3, -4, 0, 0, 0),
5.670E-08
"hr",
h/(dimensionedScalar("C", dimless, constant::math::twoPi))
)
)
);
// ************************************************************************* //

View File

@ -0,0 +1,66 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Namespace
Foam::constant::uni
Description
Universal constants
\*---------------------------------------------------------------------------*/
#ifndef universalConstants_H
#define universalConstants_H
#include "dimensionedScalar.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace constant
{
namespace universal
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
//- Group name for universal constants
extern const char* group;
//- Reduced Planck constant: default SI units: [J/s]
extern const dimensionedScalar hr;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace universal
} // End namespace constant
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -44,6 +44,25 @@ dictionary& dimensionedConstants()
);
}
dimensionedScalar dimensionedConstant
(
const word& group,
const word& varName
)
{
dictionary& dict = dimensionedConstants();
const word unitSet(dict.lookup("unitSet"));
dictionary& unitDict(dict.subDict(unitSet + "Coeffs"));
dictionary& groupDict = unitDict.subDict(group);
return dimensionedScalar(groupDict.lookup(varName));
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam

View File

@ -40,6 +40,7 @@ SourceFiles
#define dimensionedConstants_H
#include "dictionary.H"
#include "dimensionedScalar.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -50,20 +51,42 @@ namespace Foam
dictionary& dimensionedConstants();
dimensionedScalar dimensionedConstant(const word& group, const word& varName);
template<class T>
T dimensionedConstant
(
const char* switchName,
const T defaultValue
const word& group,
const word& varName,
const T& defaultValue
)
{
if (dimensionedConstants().found(switchName))
dictionary& dict = dimensionedConstants();
const word unitSet(dict.lookup("unitSet"));
dictionary& unitDict(dict.subDict(unitSet + "Coeffs"));
if (unitDict.found(group))
{
return pTraits<T>(dimensionedConstants().lookup(switchName));
dictionary& groupDict = unitDict.subDict(group);
if (groupDict.found(varName))
{
return pTraits<T>(groupDict.lookup(varName));
}
else
{
groupDict.add(varName, defaultValue);
return defaultValue;
}
}
else
{
dimensionedConstants().add(switchName, defaultValue);
unitDict.add(group, dictionary::null);
unitDict.subDict(group).add(varName, defaultValue);
return defaultValue;
}
}

View File

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

View File

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

View File

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

View File

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

View File

@ -25,7 +25,6 @@ License
\*---------------------------------------------------------------------------*/
#include "labelSymmTensor.H"
#include "mathematicalConstants.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

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

View File

@ -25,7 +25,6 @@ License
\*---------------------------------------------------------------------------*/
#include "tensor2D.H"
#include "mathematicalConstants.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -34,7 +34,7 @@ Description
#define transform_H
#include "tensor.H"
#include "mathematicalConstants.H"
#include "mathConstants.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -104,7 +104,7 @@ inline Tensor<Cmpt> transform(const tensor& tt, const Tensor<Cmpt>& t)
(tt.yx()*t.xx() + tt.yy()*t.yx() + tt.yz()*t.zx())*tt.zx()
+ (tt.yx()*t.xy() + tt.yy()*t.yy() + tt.yz()*t.zy())*tt.zy()
+ (tt.yx()*t.xz() + tt.yy()*t.yz() + tt.yz()*t.zz())*tt.zz(),
(tt.zx()*t.xx() + tt.zy()*t.yx() + tt.zz()*t.zx())*tt.xx()
+ (tt.zx()*t.xy() + tt.zy()*t.yy() + tt.zz()*t.zy())*tt.xy()
+ (tt.zx()*t.xz() + tt.zy()*t.yz() + tt.zz()*t.zz())*tt.xz(),
@ -155,7 +155,7 @@ inline SymmTensor<Cmpt> transform(const tensor& tt, const SymmTensor<Cmpt>& st)
(tt.yx()*st.xx() + tt.yy()*st.xy() + tt.yz()*st.xz())*tt.zx()
+ (tt.yx()*st.xy() + tt.yy()*st.yy() + tt.yz()*st.yz())*tt.zy()
+ (tt.yx()*st.xz() + tt.yy()*st.yz() + tt.yz()*st.zz())*tt.zz(),
(tt.zx()*st.xx() + tt.zy()*st.xy() + tt.zz()*st.xz())*tt.zx()
+ (tt.zx()*st.xy() + tt.zy()*st.yy() + tt.zz()*st.yz())*tt.zy()
+ (tt.zx()*st.xz() + tt.zy()*st.yz() + tt.zz()*st.zz())*tt.zz()
@ -205,11 +205,11 @@ inline scalar pseudoAngle
if (sin < -SMALL)
{
return (3.0 + cos)*mathematicalConstant::piByTwo;
return (3.0 + cos)*constant::math::piByTwo;
}
else
{
return (1.0 - cos)*mathematicalConstant::piByTwo;
return (1.0 - cos)*constant::math::piByTwo;
}
}

View File

@ -34,7 +34,7 @@ Description
#include "removePoints.H"
#include "pointFields.H"
#include "motionSmoother.H"
#include "mathematicalConstants.H"
#include "mathConstants.H"
#include "pointSet.H"
#include "faceSet.H"
#include "cellSet.H"
@ -2479,17 +2479,11 @@ void Foam::autoLayerDriver::mergePatchFacesUndo
const dictionary& motionDict
)
{
scalar minCos = Foam::cos
(
layerParams.featureAngle()
* mathematicalConstant::pi/180.0
);
scalar minCos =
Foam::cos(layerParams.featureAngle()*constant::math::pi/180.0);
scalar concaveCos = Foam::cos
(
layerParams.concaveAngle()
* mathematicalConstant::pi/180.0
);
scalar concaveCos =
Foam::cos(layerParams.concaveAngle()*constant::math::pi/180.0);
Info<< nl
<< "Merging all faces of a cell" << nl
@ -2588,7 +2582,7 @@ void Foam::autoLayerDriver::addLayers
(
pp,
meshEdges,
layerParams.featureAngle()*mathematicalConstant::pi/180.0,
layerParams.featureAngle()*constant::math::pi/180.0,
patchDisp,
patchNLayers,

View File

@ -35,6 +35,7 @@ License
#include "refinementSurfaces.H"
#include "shellSurfaces.H"
#include "mapDistributePolyMesh.H"
#include "mathConstants.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -678,8 +679,8 @@ void Foam::autoRefineDriver::mergePatchFaces
meshRefiner_.mergePatchFaces
(
Foam::cos(45*mathematicalConstant::pi/180.0),
Foam::cos(45*mathematicalConstant::pi/180.0),
Foam::cos(45*constant::math::pi/180.0),
Foam::cos(45*constant::math::pi/180.0),
meshRefiner_.meshedPatches()
);
@ -688,7 +689,7 @@ void Foam::autoRefineDriver::mergePatchFaces
meshRefiner_.checkData();
}
meshRefiner_.mergeEdges(Foam::cos(45*mathematicalConstant::pi/180.0));
meshRefiner_.mergeEdges(Foam::cos(45*constant::math::pi/180.0));
if (debug)
{

View File

@ -26,7 +26,7 @@ License
#include "layerParameters.H"
#include "polyBoundaryMesh.H"
#include "mathematicalConstants.H"
#include "mathConstants.H"
#include "refinementSurfaces.H"
#include "searchableSurfaces.H"
#include "regExp.H"
@ -192,12 +192,7 @@ Foam::layerParameters::layerParameters
),
layerTerminationCos_
(
Foam::cos
(
0.5
* featureAngle_
* mathematicalConstant::pi/180.
)
Foam::cos(0.5*featureAngle_*constant::math::pi/180.0)
),
maxThicknessToMedialRatio_
(
@ -206,7 +201,7 @@ Foam::layerParameters::layerParameters
minMedianAxisAngleCos_
(
Foam::cos(readScalar(dict.lookup("minMedianAxisAngle")))
* mathematicalConstant::pi/180.
*constant::math::pi/180.0
),
nBufferCellsNoExtrude_
(
@ -274,12 +269,7 @@ Foam::layerParameters::layerParameters
),
layerTerminationCos_
(
Foam::cos
(
0.5
* featureAngle_
* mathematicalConstant::pi/180.
)
Foam::cos(0.5*featureAngle_*constant::math::pi/180.0)
),
maxThicknessToMedialRatio_
(
@ -288,7 +278,7 @@ Foam::layerParameters::layerParameters
minMedianAxisAngleCos_
(
Foam::cos(readScalar(dict.lookup("minMedianAxisAngle")))
* mathematicalConstant::pi/180.
*constant::math::pi/180.0
),
nBufferCellsNoExtrude_
(

View File

@ -25,7 +25,7 @@ License
\*---------------------------------------------------------------------------*/
#include "refinementParameters.H"
#include "mathematicalConstants.H"
#include "mathConstants.H"
#include "polyMesh.H"
#include "globalIndex.H"
@ -63,7 +63,7 @@ Foam::refinementParameters::refinementParameters(const dictionary& dict)
}
else
{
curvature_ = Foam::cos(featAngle*mathematicalConstant::pi/180.0);
curvature_ = Foam::cos(featAngle*constant::math::pi/180.0);
}
}

View File

@ -37,6 +37,7 @@ License
#include "searchableSurfaces.H"
#include "polyMeshGeometry.H"
#include "IOmanip.H"
#include "mathConstants.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -246,10 +247,7 @@ Foam::Map<Foam::label> Foam::meshRefinement::findEdgeConnectedProblemCells
nearestRegion[i]
);
scalar angle =
perpendicularAngle[region]
/ 180.0
* mathematicalConstant::pi;
scalar angle = perpendicularAngle[region]/180.0*constant::math::pi;
if (angle >= 0)
{
@ -306,7 +304,7 @@ bool Foam::meshRefinement::isCollapsedFace
vector d = ownCc - mesh_.cellCentres()[nei];
scalar dDotS = (d & s)/(mag(d)*magS + VSMALL);
if (dDotS < maxNonOrtho)
{
return true;

View File

@ -27,7 +27,7 @@ License
#include "dynamicInkJetFvMesh.H"
#include "addToRunTimeSelectionTable.H"
#include "volFields.H"
#include "mathematicalConstants.H"
#include "mathConstants.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -90,7 +90,7 @@ Foam::dynamicInkJetFvMesh::~dynamicInkJetFvMesh()
bool Foam::dynamicInkJetFvMesh::update()
{
scalar scalingFunction =
0.5*(::cos(2*mathematicalConstant::pi*frequency_*time().value()) - 1.0);
0.5*(::cos(constant::math::twoPi*frequency_*time().value()) - 1.0);
Info<< "Mesh scaling. Time = " << time().value() << " scaling: "
<< scalingFunction << endl;
@ -113,7 +113,7 @@ bool Foam::dynamicInkJetFvMesh::update()
fvMesh::movePoints(newPoints);
volVectorField& U =
volVectorField& U =
const_cast<volVectorField&>(lookupObject<volVectorField>("U"));
U.correctBoundaryConditions();

View File

@ -26,9 +26,9 @@ License
#include "SDA.H"
#include "addToRunTimeSelectionTable.H"
#include "mathematicalConstants.H"
#include "mathConstants.H"
using namespace Foam::mathematicalConstant;
using namespace Foam::constant::math;
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -70,18 +70,18 @@ Foam::septernion Foam::solidBodyMotionFunctions::SDA::transformation() const
scalar time = time_.value();
scalar Tpi = Tp_ + dTp_*(time/dTi_); // Current roll period [sec]
scalar wr = 2*pi/Tpi; // Current Freq [/sec]
scalar wr = twoPi/Tpi; // Current Freq [/sec]
// Current Phase for roll [rad]
scalar r = dTp_/dTi_;
scalar u = Tp_ + r*time;
scalar phr = 2*pi*((Tp_/u - 1) + log(mag(u)) - log(Tp_))/r;
scalar phr = twoPi*((Tp_/u - 1) + log(mag(u)) - log(Tp_))/r;
// Current Phase for Sway [rad]
scalar phs = phr + pi;
// Current Phase for Heave [rad]
scalar phh = phr + pi/2;
scalar phh = phr + piByTwo;
scalar rollA = max(rollAmax_*exp(-sqr(Tpi - Tpn_)/(2*Q_)), rollAmin_);

View File

@ -29,9 +29,9 @@ License
#include "Tuple2.H"
#include "IFstream.H"
#include "interpolateXY.H"
#include "mathematicalConstants.H"
#include "mathConstants.H"
using namespace Foam::mathematicalConstant;
using namespace Foam::constant::math;
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //

View File

@ -27,11 +27,8 @@ License
#include "solidBodyMotionFvMesh.H"
#include "addToRunTimeSelectionTable.H"
#include "volFields.H"
#include "mathematicalConstants.H"
#include "transformField.H"
using namespace Foam::mathematicalConstant;
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam

View File

@ -28,7 +28,6 @@ License
#include "cellFeatures.H"
#include "polyMesh.H"
#include "cellModeller.H"
#include "mathematicalConstants.H"
#include "plane.H"
#include "ListOps.H"
#include "meshTools.H"
@ -36,18 +35,12 @@ License
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineTypeNameAndDebug(hexCellLooper, 0);
addToRunTimeSelectionTable(cellLooper, hexCellLooper, word);
}

View File

@ -27,7 +27,7 @@ License
#include "topoCellLooper.H"
#include "cellFeatures.H"
#include "polyMesh.H"
#include "mathematicalConstants.H"
#include "mathConstants.H"
#include "DynamicList.H"
#include "ListOps.H"
#include "meshTools.H"
@ -35,9 +35,8 @@ License
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(topoCellLooper, 0);
@ -46,7 +45,7 @@ namespace Foam
// Angle for polys to be considered splitHexes.
const Foam::scalar Foam::topoCellLooper::featureCos =
Foam::cos(10.0 * mathematicalConstant::pi/180.0);
Foam::cos(10.0*constant::math::pi/180.0);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //

View File

@ -32,16 +32,14 @@ License
#include "cellCuts.H"
#include "splitCell.H"
#include "mapPolyMesh.H"
#include "mathematicalConstants.H"
#include "mathConstants.H"
#include "meshTools.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(undoableMeshCutter, 0);
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -193,8 +191,8 @@ Foam::undoableMeshCutter::undoableMeshCutter
liveSplitCells_(mesh.nCells()/100 + 100),
faceRemover_
(
mesh,
Foam::cos(30./180. * mathematicalConstant::pi)
mesh,
Foam::cos(30.0/180.0*constant::math::pi)
)
{}

View File

@ -27,6 +27,7 @@ License
#include "polyMeshGeometry.H"
#include "pyramidPointFaceRef.H"
#include "syncTools.H"
#include "mathConstants.H"
namespace Foam
{
@ -247,7 +248,7 @@ Foam::scalar Foam::polyMeshGeometry::checkNonOrtho
<< " between cells " << mesh.faceOwner()[faceI]
<< " and " << nei
<< ": Angle = "
<< ::acos(dDotS)/mathematicalConstant::pi*180.0
<< ::acos(dDotS)/constant::math::pi*180.0
<< " deg." << endl;
}
@ -268,7 +269,7 @@ Foam::scalar Foam::polyMeshGeometry::checkNonOrtho
<< " between cells " << mesh.faceOwner()[faceI]
<< " and " << nei
<< ": Angle = "
<< ::acos(dDotS)/mathematicalConstant::pi*180.0
<< ::acos(dDotS)/constant::math::pi*180.0
<< " deg." << endl;
}
@ -368,7 +369,7 @@ bool Foam::polyMeshGeometry::checkFaceDotProduct
// Severe nonorthogonality threshold
const scalar severeNonorthogonalityThreshold =
::cos(orthWarn/180.0*mathematicalConstant::pi);
::cos(orthWarn/180.0*constant::math::pi);
// Calculate coupled cell centre
@ -503,9 +504,9 @@ bool Foam::polyMeshGeometry::checkFaceDotProduct
if (nDDotS > 0)
{
Info<< "Mesh non-orthogonality Max: "
<< ::acos(minDDotS)/mathematicalConstant::pi*180.0
<< ::acos(minDDotS)/constant::math::pi*180.0
<< " average: " <<
::acos(sumDDotS/nDDotS)/mathematicalConstant::pi*180.0
::acos(sumDDotS/nDDotS)/constant::math::pi*180.0
<< endl;
}
}
@ -1170,7 +1171,7 @@ bool Foam::polyMeshGeometry::checkVolRatio
{
label face0 = baffles[i].first();
label face1 = baffles[i].second();
scalar ownVol = mag(cellVolumes[own[face0]]);
scalar neiVol = mag(cellVolumes[own[face1]]);
@ -1257,7 +1258,7 @@ bool Foam::polyMeshGeometry::checkFaceAngles
<< abort(FatalError);
}
const scalar maxSin = Foam::sin(maxDeg/180.0*mathematicalConstant::pi);
const scalar maxSin = Foam::sin(maxDeg/180.0*constant::math::pi);
const faceList& fcs = mesh.faces();
@ -1338,7 +1339,7 @@ bool Foam::polyMeshGeometry::checkFaceAngles
{
scalar maxConcaveDegr =
Foam::asin(Foam::min(1.0, maxEdgeSin))
* 180.0/mathematicalConstant::pi;
*180.0/constant::math::pi;
Info<< "There are " << nConcave
<< " faces with concave angles between consecutive"
@ -1823,7 +1824,7 @@ bool Foam::polyMeshGeometry::checkCellDeterminant
forAll(cFaces, cFaceI)
{
label faceI = cFaces[cFaceI];
scalar magArea = mag(faceAreas[faceI]);
magAreaSum += magArea;
@ -1850,7 +1851,7 @@ bool Foam::polyMeshGeometry::checkCellDeterminant
nWarnDet++;
}
}
reduce(minDet, minOp<scalar>());
reduce(sumDet, sumOp<scalar>());
reduce(nSumDet, sumOp<label>());

View File

@ -25,7 +25,7 @@ License
\*---------------------------------------------------------------------------*/
#include "engineTime.H"
#include "mathematicalConstants.H"
#include "mathConstants.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -125,7 +125,7 @@ bool Foam::engineTime::read()
Foam::scalar Foam::engineTime::degToRad(const scalar deg) const
{
return mathematicalConstant::pi*deg/180.0;
return constant::math::pi*deg/180.0;
}
@ -239,6 +239,4 @@ Foam::scalar Foam::engineTime::timeToUserTime(const scalar t) const
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// ************************************************************************* //

View File

@ -27,16 +27,16 @@
)
);
Ak = sphereFraction*4.0*mathematicalConstant::pi
Ak = sphereFraction*4.0*constant::math::pi
*pow
(
3.0*Vk
/(sphereFraction*4.0*mathematicalConstant::pi),
/(sphereFraction*4.0*constant::math::pi),
2.0/3.0
);
}
break;
case 2:
{
// Assume it is part-circular
@ -56,11 +56,11 @@
)
);
Ak = circleFraction*mathematicalConstant::pi*thickness
Ak = circleFraction*constant::math::pi*thickness
*sqrt
(
4.0*Vk
/(circleFraction*thickness*mathematicalConstant::pi)
/(circleFraction*thickness*constant::math::pi)
);
}
break;

View File

@ -22,13 +22,11 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Description
\*---------------------------------------------------------------------------*/
#include "rpm.H"
#include "addToRunTimeSelectionTable.H"
#include "mathematicalConstants.H"
#include "mathConstants.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -58,7 +56,7 @@ Foam::SRF::rpm::rpm
rpm_(readScalar(SRFModelCoeffs_.lookup("rpm")))
{
// Initialise the angular velocity
omega_.value() = axis_*rpm_*2.0*mathematicalConstant::pi/60.0;
omega_.value() = axis_*rpm_*constant::math::twoPi/60.0;
}
@ -78,7 +76,7 @@ bool Foam::SRF::rpm::read()
SRFModelCoeffs_.lookup("rpm") >> rpm_;
// Update angular velocity
omega_.value() = axis_*rpm_*(2.0*mathematicalConstant::pi/60.0);
omega_.value() = axis_*rpm_*(constant::math::twoPi/60.0);
return true;
}

View File

@ -14,7 +14,7 @@
#include "fixedValueFvPatchFields.H"
#include "adjustPhi.H"
#include "findRefCell.H"
#include "mathematicalConstants.H"
#include "constants.H"
#include "OSspecific.H"
#include "argList.H"

View File

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

View File

@ -32,7 +32,7 @@ Description
#include "surfaceFields.H"
#include "demandDrivenData.H"
#include "coupledFvPatch.H"
#include "mathematicalConstants.H"
#include "mathConstants.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -353,7 +353,7 @@ void surfaceInterpolation::makeCorrectionVectors() const
(sum(magSf*mag(corrVecs))/sum(magSf)).value(),
1.0
)
)*180.0/mathematicalConstant::pi;
)*180.0/constant::math::pi;
}
if (debug)

View File

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

View File

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

View File

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

View File

@ -27,22 +27,20 @@ License
#include "commonRailInjector.H"
#include "addToRunTimeSelectionTable.H"
#include "Random.H"
#include "mathematicalConstants.H"
#include "mathConstants.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(commonRailInjector, 0);
defineTypeNameAndDebug(commonRailInjector, 0);
addToRunTimeSelectionTable
(
injectorType,
commonRailInjector,
dictionary
);
addToRunTimeSelectionTable
(
injectorType,
commonRailInjector,
dictionary
);
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -71,38 +69,58 @@ Foam::commonRailInjector::commonRailInjector
averageParcelMass_(mass_/nParcels_),
pressureIndependentVelocity_(false)
{
// convert CA to real time
forAll(massFlowRateProfile_, i)
{
massFlowRateProfile_[i][0] = t.userTimeToTime(massFlowRateProfile_[i][0]);
massFlowRateProfile_[i][0] =
t.userTimeToTime(massFlowRateProfile_[i][0]);
velocityProfile_[i][0] = t.userTimeToTime(massFlowRateProfile_[i][0]);
}
forAll(injectionPressureProfile_, i)
{
injectionPressureProfile_[i][0] = t.userTimeToTime(injectionPressureProfile_[i][0]);
injectionPressureProfile_[i][0] =
t.userTimeToTime(injectionPressureProfile_[i][0]);
}
if (mag(injectionPressureProfile_[0][0]-massFlowRateProfile_[0][0]) > SMALL)
if
(
mag(injectionPressureProfile_[0][0] - massFlowRateProfile_[0][0])
> SMALL
)
{
FatalError << "commonRailInjector::commonRailInjector(const time& t, const dictionary dict) " << endl
<< " start-time entries for injectionPressureProfile and massFlowRateProfile do no match"
<< abort(FatalError);
FatalErrorIn
(
"commonRailInjector::commonRailInjector"
"(const time& t, const dictionary dict)"
) << " start-time entries for injectionPressureProfile and "
<< "massFlowRateProfile do no match"
<< abort(FatalError);
}
Info << "injectionPressureProfile_.size() = " << injectionPressureProfile_.size()
Info<< "injectionPressureProfile_.size() = "
<< injectionPressureProfile_.size()
<< ", massFlowRateProfile_.size() = " << massFlowRateProfile_.size()
<< endl;
if (mag(injectionPressureProfile_[injectionPressureProfile_.size()-1][0]-massFlowRateProfile_[massFlowRateProfile_.size()-1][0]) > SMALL)
if
(
mag(injectionPressureProfile_[injectionPressureProfile_.size()-1][0]
- massFlowRateProfile_[massFlowRateProfile_.size()-1][0])
> SMALL
)
{
FatalError << "commonRailInjector::commonRailInjector(const time& t, const dictionary dict) " << endl
<< " end-time entries for injectionPressureProfile and massFlowRateProfile do no match"
<< abort(FatalError);
FatalErrorIn
(
"commonRailInjector::commonRailInjector"
"(const time& t, const dictionary dict)"
) << "End-time entries for injectionPressureProfile and "
<< "massFlowRateProfile do no match"
<< abort(FatalError);
}
scalar integratedMFR = integrateTable(massFlowRateProfile_);
scalar integratedP = integrateTable(injectionPressureProfile_)/(teoi()-tsoi());
scalar integratedP =
integrateTable(injectionPressureProfile_)/(teoi() - tsoi());
forAll(massFlowRateProfile_, i)
{
@ -113,7 +131,6 @@ Foam::commonRailInjector::commonRailInjector
TProfile_[i][1] = T_;
CdProfile_[i][0] = massFlowRateProfile_[i][0];
}
forAll(injectionPressureProfile_, i)
@ -122,7 +139,7 @@ Foam::commonRailInjector::commonRailInjector
}
// Normalize the direction vector
direction_ /= mag(direction_);
setTangentialVectors();
// check molar fractions
@ -134,18 +151,22 @@ Foam::commonRailInjector::commonRailInjector
if (mag(Xsum - 1.0) > SMALL)
{
Info << "Warning!!!\n commonRailInjector::commonRailInjector(const time& t, Istream& is)"
<< "X does not add up to 1.0, correcting molar fractions."
WarningIn
(
"commonRailInjector::commonRailInjector"
"(const time& t, const dictionary dict)"
) << "X does not add up to 1.0, correcting molar fractions."
<< endl;
forAll(X_, i)
{
X_[i] /= Xsum;
}
}
Info << "end constructor. in commonRail" << endl;
Info << "end constructor. in commonRail" << endl;
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::commonRailInjector::~commonRailInjector()
@ -181,17 +202,20 @@ Foam::label Foam::commonRailInjector::nParcelsToInject
) const
{
scalar mInj = mass_*(fractionOfInjection(time1)-fractionOfInjection(time0));
scalar mInj =
mass_*(fractionOfInjection(time1) - fractionOfInjection(time0));
label nParcels = label(mInj/averageParcelMass_ + 0.49);
return nParcels;
}
const Foam::vector Foam::commonRailInjector::position(const label n) const
{
return position_;
}
Foam::vector Foam::commonRailInjector::position
(
const label n,
@ -220,33 +244,35 @@ Foam::vector Foam::commonRailInjector::position
{
// otherwise, disc injection
scalar iRadius = d_*rndGen.scalar01();
scalar iAngle = 2.0*mathematicalConstant::pi*rndGen.scalar01();
scalar iAngle = constant::math::twoPi*rndGen.scalar01();
return
(
(
position_
+ iRadius
* (
tangentialInjectionVector1_*cos(iAngle)
+ tangentialInjectionVector2_*sin(iAngle)
)
*(
tangentialInjectionVector1_*cos(iAngle)
+ tangentialInjectionVector2_*sin(iAngle)
)
);
}
return position_;
}
Foam::label Foam::commonRailInjector::nHoles() const
{
return 1;
}
Foam::scalar Foam::commonRailInjector::d() const
{
return d_;
}
const Foam::vector& Foam::commonRailInjector::direction
(
const label i,
@ -256,6 +282,7 @@ const Foam::vector& Foam::commonRailInjector::direction
return direction_;
}
Foam::scalar Foam::commonRailInjector::mass
(
const scalar time0,
@ -264,47 +291,55 @@ Foam::scalar Foam::commonRailInjector::mass
const scalar angleOfWedge
) const
{
scalar mInj = mass_*(fractionOfInjection(time1)-fractionOfInjection(time0));
scalar mInj =
mass_*(fractionOfInjection(time1) - fractionOfInjection(time0));
// correct mass if calculation is 2D
// correct mass if calculation is 2D
if (twoD)
{
mInj *= 0.5*angleOfWedge/mathematicalConstant::pi;
mInj *= 0.5*angleOfWedge/constant::math::pi;
}
return mInj;
}
Foam::scalar Foam::commonRailInjector::mass() const
{
return mass_;
}
const Foam::scalarField& Foam::commonRailInjector::X() const
{
return X_;
}
Foam::List<Foam::commonRailInjector::pair> Foam::commonRailInjector::T() const
{
return TProfile_;
}
Foam::scalar Foam::commonRailInjector::T(const scalar time) const
{
return T_;
}
Foam::scalar Foam::commonRailInjector::tsoi() const
{
return massFlowRateProfile_[0][0];
}
Foam::scalar Foam::commonRailInjector::teoi() const
{
return massFlowRateProfile_[massFlowRateProfile_.size()-1][0];
}
Foam::scalar Foam::commonRailInjector::massFlowRate
(
const scalar time
@ -313,6 +348,7 @@ Foam::scalar Foam::commonRailInjector::massFlowRate
return getTableValue(massFlowRateProfile_, time);
}
Foam::scalar Foam::commonRailInjector::injectionPressure
(
const scalar time
@ -321,6 +357,7 @@ Foam::scalar Foam::commonRailInjector::injectionPressure
return getTableValue(injectionPressureProfile_, time);
}
Foam::scalar Foam::commonRailInjector::velocity
(
const scalar time
@ -329,11 +366,14 @@ Foam::scalar Foam::commonRailInjector::velocity
return getTableValue(velocityProfile_, time);
}
Foam::List<Foam::commonRailInjector::pair> Foam::commonRailInjector::CdProfile() const
Foam::List<Foam::commonRailInjector::pair> Foam::commonRailInjector::CdProfile()
const
{
return CdProfile_;
}
Foam::scalar Foam::commonRailInjector::Cd
(
const scalar time
@ -342,11 +382,13 @@ Foam::scalar Foam::commonRailInjector::Cd
return getTableValue(CdProfile_, time);
}
Foam::scalar Foam::commonRailInjector::fractionOfInjection(const scalar time) const
{
return integrateTable(massFlowRateProfile_, time)/mass_;
}
Foam::scalar Foam::commonRailInjector::injectedMass
(
const scalar t
@ -362,13 +404,14 @@ void Foam::commonRailInjector::correctProfiles
const scalar referencePressure
)
{
scalar A = 0.25*mathematicalConstant::pi*pow(d_, 2.0);
scalar A = 0.25*constant::math::pi*sqr(d_);
scalar pDummy = 1.0e+5;
scalar rho = fuel.rho(pDummy, T_, X_);
forAll(velocityProfile_, i)
{
scalar Pinj = getTableValue(injectionPressureProfile_, velocityProfile_[i][0]);
scalar Pinj =
getTableValue(injectionPressureProfile_, velocityProfile_[i][0]);
scalar Vinj = sqrt(2.0*(Pinj - referencePressure)/rho);
scalar mfr = massFlowRateProfile_[i][1]/(rho*A);
scalar Cd = mfr/Vinj;
@ -377,14 +420,17 @@ void Foam::commonRailInjector::correctProfiles
}
}
Foam::vector Foam::commonRailInjector::tan1(const label n) const
{
return tangentialInjectionVector1_;
}
Foam::vector Foam::commonRailInjector::tan2(const label n) const
{
return tangentialInjectionVector2_;
}
// ************************************************************************* //

View File

@ -47,7 +47,7 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class commonRailInjector Declaration
Class commonRailInjector Declaration
\*---------------------------------------------------------------------------*/
class commonRailInjector
@ -110,16 +110,11 @@ public:
// Constructors
//- Construct from components
commonRailInjector
(
const Time& t,
const dictionary& dict
);
commonRailInjector(const Time& t, const dictionary& dict);
// Destructor
~commonRailInjector();
//- Destructor
virtual ~commonRailInjector();
// Member Functions
@ -146,7 +141,7 @@ public:
const vector& axisOfWedgeNormal,
Random& rndGen
) const;
//- Return the number of holes
label nHoles() const;
@ -201,14 +196,14 @@ public:
{
return injectionPressureProfile_;
}
scalar injectionPressure(const scalar time) const;
List<pair> velocityProfile() const
{
return velocityProfile_;
}
scalar velocity(const scalar time) const;
List<pair> CdProfile() const;
@ -227,7 +222,6 @@ public:
{
return pressureIndependentVelocity_;
}
};

View File

@ -27,21 +27,19 @@ License
#include "definedInjector.H"
#include "addToRunTimeSelectionTable.H"
#include "Random.H"
#include "mathematicalConstants.H"
#include "mathConstants.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(definedInjector, 0);
defineTypeNameAndDebug(definedInjector, 0);
addToRunTimeSelectionTable
(
injectorType,
definedInjector,
dictionary
);
addToRunTimeSelectionTable
(
injectorType,
definedInjector,
dictionary
);
}
@ -73,12 +71,13 @@ Foam::definedInjector::definedInjector
// convert CA to real time - mass flow rate profile
forAll(massFlowRateProfile_, i)
{
massFlowRateProfile_[i][0] = t.userTimeToTime(massFlowRateProfile_[i][0]);
// dummy
injectionPressureProfile_[i][0] = massFlowRateProfile_[i][0];
injectionPressureProfile_[i][1] = 0.0;
CdProfile_[i][0] = massFlowRateProfile_[i][0];
CdProfile_[i][1] = 1.0;
massFlowRateProfile_[i][0] =
t.userTimeToTime(massFlowRateProfile_[i][0]);
// dummy
injectionPressureProfile_[i][0] = massFlowRateProfile_[i][0];
injectionPressureProfile_[i][1] = 0.0;
CdProfile_[i][0] = massFlowRateProfile_[i][0];
CdProfile_[i][1] = 1.0;
}
forAll(velocityProfile_, i)
@ -89,15 +88,28 @@ Foam::definedInjector::definedInjector
// check if time entries match
if (mag(massFlowRateProfile_[0][0]-velocityProfile_[0][0]) > SMALL)
{
FatalError << "definedInjector::definedInjector(const time& t, const dictionary dict) " << endl
<< " start-times do not match for velocityProfile and massFlowRateProfile."
FatalErrorIn
(
"definedInjector::definedInjector"
"(const time& t, const dictionary dict)"
) << "Start-times do not match for velocityProfile and "
<< "massFlowRateProfile." << nl
<< abort(FatalError);
}
if (mag(massFlowRateProfile_[massFlowRateProfile_.size()-1][0]-velocityProfile_[velocityProfile_.size()-1][0]) > SMALL)
if
(
mag(massFlowRateProfile_[massFlowRateProfile_.size()-1][0]
- velocityProfile_[velocityProfile_.size()-1][0])
> SMALL
)
{
FatalError << "definedInjector::definedInjector(const time& t, const dictionary dict) " << endl
<< " end-times do not match for velocityProfile and massFlowRateProfile."
FatalErrorIn
(
"definedInjector::definedInjector"
"(const time& t, const dictionary dict)"
) << "End-times do not match for velocityProfile and "
<< "massFlowRateProfile."
<< abort(FatalError);
}
@ -112,7 +124,7 @@ Foam::definedInjector::definedInjector
// Normalize the direction vector
direction_ /= mag(direction_);
setTangentialVectors();
// check molar fractions
@ -126,7 +138,8 @@ Foam::definedInjector::definedInjector
{
WarningIn
(
"definedInjector::definedInjector(const time& t, Istream& is)"
"definedInjector::definedInjector"
"(const time& t, const dictionary dict)"
) << "X does not add up to 1.0, correcting molar fractions."
<< endl;
@ -174,15 +187,17 @@ Foam::label Foam::definedInjector::nParcelsToInject
scalar mInj = mass_*(fractionOfInjection(time1)-fractionOfInjection(time0));
label nParcels = label(mInj/averageParcelMass_ + 0.49);
return nParcels;
}
const Foam::vector Foam::definedInjector::position(const label n) const
{
return position_;
}
Foam::vector Foam::definedInjector::position
(
const label n,
@ -211,10 +226,10 @@ Foam::vector Foam::definedInjector::position
{
// otherwise, disc injection
scalar iRadius = d_*rndGen.scalar01();
scalar iAngle = 2.0*mathematicalConstant::pi*rndGen.scalar01();
scalar iAngle = constant::math::twoPi*rndGen.scalar01();
return
(
(
position_
+ iRadius
* (
@ -222,22 +237,25 @@ Foam::vector Foam::definedInjector::position
+ tangentialInjectionVector2_*sin(iAngle)
)
);
}
return position_;
}
Foam::label Foam::definedInjector::nHoles() const
{
return 1;
}
Foam::scalar Foam::definedInjector::d() const
{
return d_;
}
const Foam::vector& Foam::definedInjector::direction
(
const label i,
@ -247,6 +265,7 @@ const Foam::vector& Foam::definedInjector::direction
return direction_;
}
Foam::scalar Foam::definedInjector::mass
(
const scalar time0,
@ -255,62 +274,73 @@ Foam::scalar Foam::definedInjector::mass
const scalar angleOfWedge
) const
{
scalar mInj = mass_*(fractionOfInjection(time1)-fractionOfInjection(time0));
scalar mInj =
mass_*(fractionOfInjection(time1) - fractionOfInjection(time0));
// correct mass if calculation is 2D
// correct mass if calculation is 2D
if (twoD)
{
mInj *= 0.5*angleOfWedge/mathematicalConstant::pi;
mInj *= 0.5*angleOfWedge/constant::math::pi;
}
return mInj;
}
Foam::scalar Foam::definedInjector::mass() const
{
return mass_;
}
Foam::scalar Foam::definedInjector::massFlowRate(const scalar time) const
{
return getTableValue(massFlowRateProfile_, time);
}
Foam::scalar Foam::definedInjector::injectionPressure(const scalar time) const
{
return getTableValue(injectionPressureProfile_, time);
}
Foam::scalar Foam::definedInjector::Cd(const scalar time) const
{
return getTableValue(CdProfile_, time);
}
const Foam::scalarField& Foam::definedInjector::X() const
{
return X_;
}
Foam::List<Foam::definedInjector::pair> Foam::definedInjector::T() const
{
return TProfile_;
}
Foam::scalar Foam::definedInjector::T(const scalar time) const
{
return T_;
}
Foam::scalar Foam::definedInjector::tsoi() const
{
return massFlowRateProfile_[0][0];
}
Foam::scalar Foam::definedInjector::teoi() const
{
return massFlowRateProfile_[massFlowRateProfile_.size()-1][0];
}
Foam::scalar Foam::definedInjector::fractionOfInjection
(
const scalar time
@ -319,6 +349,7 @@ Foam::scalar Foam::definedInjector::fractionOfInjection
return integrateTable(massFlowRateProfile_, time)/mass_;
}
Foam::scalar Foam::definedInjector::velocity
(
const scalar time
@ -327,6 +358,7 @@ Foam::scalar Foam::definedInjector::velocity
return getTableValue(velocityProfile_, time);
}
Foam::scalar Foam::definedInjector::injectedMass
(
const scalar t
@ -335,13 +367,14 @@ Foam::scalar Foam::definedInjector::injectedMass
return mass_*fractionOfInjection(t);
}
void Foam::definedInjector::correctProfiles
(
const liquidMixture& fuel,
const scalar referencePressure
)
{
scalar A = 0.25*mathematicalConstant::pi*pow(d_, 2.0);
scalar A = 0.25*constant::math::pi*sqr(d_);
scalar pDummy = 1.0e+5;
scalar rho = fuel.rho(pDummy, T_, X_);
@ -354,14 +387,17 @@ void Foam::definedInjector::correctProfiles
}
}
Foam::vector Foam::definedInjector::tan1(const label n) const
{
return tangentialInjectionVector1_;
}
Foam::vector Foam::definedInjector::tan2(const label n) const
{
return tangentialInjectionVector2_;
}
// ************************************************************************* //

View File

@ -46,7 +46,7 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class definedInjector Declaration
Class definedInjector Declaration
\*---------------------------------------------------------------------------*/
class definedInjector
@ -69,8 +69,8 @@ private:
scalar T_;
label nParcels_;
scalarField X_;
List<pair> massFlowRateProfile_; // aj
List<pair> velocityProfile_; // aj
List<pair> massFlowRateProfile_;
List<pair> velocityProfile_;
List<pair> injectionPressureProfile_;
List<pair> CdProfile_;
List<pair> TProfile_;
@ -101,6 +101,7 @@ private:
//- Return the instantaneous injection velocity
scalar injectionVelocity(const scalar) const;
public:
//- Runtime type information
@ -110,16 +111,11 @@ public:
// Constructors
//- Construct from components
definedInjector
(
const Time& t,
const dictionary& dict
);
definedInjector(const Time& t, const dictionary& dict);
// Destructor
~definedInjector();
//- Destructor
virtual ~definedInjector();
// Member Functions
@ -146,7 +142,7 @@ public:
const vector& axisOfWedgeNormal,
Random& rndGen
) const;
//- Return the number of holes
label nHoles() const;
@ -201,14 +197,14 @@ public:
{
return injectionPressureProfile_;
}
scalar injectionPressure(const scalar time) const;
List<pair> velocityProfile() const
{
return velocityProfile_;
}
scalar velocity(const scalar time) const;
List<pair> CdProfile() const
@ -231,7 +227,6 @@ public:
{
return pressureIndependentVelocity_;
}
};

View File

@ -31,10 +31,9 @@ License
namespace Foam
{
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// No code
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -47,7 +47,7 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class injector Declaration
Class injector Declaration
\*---------------------------------------------------------------------------*/
class injector
@ -62,7 +62,7 @@ class injector
public:
// Constructors
//- Constructor from Istream
injector(const Time& t, Istream& is);

View File

@ -30,10 +30,8 @@ License
namespace Foam
{
defineTypeNameAndDebug(injectorType, 0);
defineRunTimeSelectionTable(injectorType, dictionary);
defineTypeNameAndDebug(injectorType, 0);
defineRunTimeSelectionTable(injectorType, dictionary);
}
@ -47,6 +45,7 @@ Foam::injectorType::injectorType
)
{}
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::injectorType> Foam::injectorType::New
@ -55,30 +54,25 @@ Foam::autoPtr<Foam::injectorType> Foam::injectorType::New
const dictionary& dict
)
{
word injectorTypeName
(
dict.lookup("injectorType")
);
word injectorTypeName(dict.lookup("injectorType"));
Info<< "Selecting injectorType "
<< injectorTypeName << endl;
Info<< "Selecting injectorType " << injectorTypeName << endl;
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(injectorTypeName);
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
FatalError
<< "injectorType::New(const dictionary&) : " << endl
<< " unknown injectorType type "
FatalErrorIn("injectorType::New(const dictionary&)")
<< "Unknown injectorType type "
<< injectorTypeName
<< ", constructor not in hash table" << endl << endl
<< " Valid injector types are :" << endl;
Info<< dictionaryConstructorTablePtr_->sortedToc() << abort(FatalError);
<< ", constructor not in hash table" << nl << nl
<< " Valid injector types are:" << nl
<< dictionaryConstructorTablePtr_->sortedToc()
<< abort(FatalError);
}
return autoPtr<injectorType>(cstrIter()(t, dict));
}
@ -87,6 +81,7 @@ Foam::autoPtr<Foam::injectorType> Foam::injectorType::New
Foam::injectorType::~injectorType()
{}
Foam::scalar Foam::injectorType::getTableValue
(
const List<pair>& table,
@ -120,12 +115,13 @@ Foam::scalar Foam::injectorType::getTableValue
i++;
}
// value sits bewteen table[i][0] and table[i+1][0]
return table[i][1]
return table[i][1]
+ (value-table[i][0])/(table[i+1][0]-table[i][0])
* (table[i+1][1]-table[i][1]);
}
}
Foam::scalar Foam::injectorType::integrateTable
(
const List<pair>& table,
@ -162,6 +158,7 @@ Foam::scalar Foam::injectorType::integrateTable
return sum;
}
Foam::scalar Foam::injectorType::integrateTable
(
const List<pair>& table
@ -178,4 +175,5 @@ Foam::scalar Foam::injectorType::integrateTable
return integratedTable;
}
// ************************************************************************* //

View File

@ -53,12 +53,12 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class injectorType Declaration
Class injectorType Declaration
\*---------------------------------------------------------------------------*/
class injectorType
{
typedef VectorSpace<Vector<scalar>, scalar, 2> pair;
typedef VectorSpace<Vector<scalar>, scalar, 2> pair;
public:
@ -79,15 +79,11 @@ public:
(t, dict)
);
// Constructors
//- Construct from components
injectorType
(
const Time& t,
const dictionary& dict
);
injectorType(const Time& t, const dictionary& dict);
// Selectors
@ -99,13 +95,12 @@ public:
);
// Destructor
virtual ~injectorType();
//- Destructor
virtual ~injectorType();
// Member Functions
//- Return number of particles to inject
virtual label nParcelsToInject
(
@ -131,14 +126,14 @@ public:
//- Return the number of holes
virtual label nHoles() const = 0;
//- Return the injector diameter
virtual scalar d() const = 0;
//- Return the injection direction for hole i
virtual const vector& direction
(
const label i,
const label i,
const scalar time
) const = 0;
@ -172,7 +167,7 @@ public:
//- Return the instantaneous velocity
virtual scalar velocity(const scalar time) const = 0;
//- Return the discharge coefficient
//- Return the discharge coefficient
virtual List<pair> CdProfile() const = 0;
//- Return the instantaneous discharge coefficient
@ -197,10 +192,12 @@ public:
virtual bool pressureIndependentVelocity() const = 0;
//- Return a vector perpendicular to the injection direction and tan2 for hole n
//- Return a vector perpendicular to the injection direction and tan2
// for hole n
virtual vector tan1(const label n) const = 0;
//- Return a vector perpendicular to the injection direction and tan1 for hole n
//- Return a vector perpendicular to the injection direction and tan1
// for hole n
virtual vector tan2(const label n) const = 0;
scalar getTableValue
@ -225,7 +222,6 @@ public:
const liquidMixture& fuel,
const scalar referencePressure
) = 0;
};

View File

@ -27,22 +27,20 @@ License
#include "multiHoleInjector.H"
#include "addToRunTimeSelectionTable.H"
#include "Random.H"
#include "mathematicalConstants.H"
#include "mathConstants.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(multiHoleInjector, 0);
defineTypeNameAndDebug(multiHoleInjector, 0);
addToRunTimeSelectionTable
(
injectorType,
multiHoleInjector,
dictionary
);
addToRunTimeSelectionTable
(
injectorType,
multiHoleInjector,
dictionary
);
}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -79,31 +77,43 @@ Foam::multiHoleInjector::multiHoleInjector
tangentialInjectionVector1_(nHoles_),
tangentialInjectionVector2_(nHoles_)
{
// check if time entries for soi and eoi match
if (mag(massFlowRateProfile_[0][0]-TProfile_[0][0]) > SMALL)
if (mag(massFlowRateProfile_[0][0] - TProfile_[0][0]) > SMALL)
{
FatalError << "multiHoleInjector::multiHoleInjector(const time& t, const dictionary dict) " << endl
<< " start-times do not match for TemperatureProfile and massFlowRateProfile."
FatalErrorIn
(
"multiHoleInjector::multiHoleInjector"
"(const time& t, const dictionary dict)"
) << "Start-times do not match for TemperatureProfile and "
<< "massFlowRateProfile."
<< abort(FatalError);
}
if (mag(massFlowRateProfile_[massFlowRateProfile_.size()-1][0]-TProfile_[TProfile_.size()-1][0]) > SMALL)
if
(
mag(massFlowRateProfile_[massFlowRateProfile_.size()-1][0]
- TProfile_[TProfile_.size()-1][0])
> SMALL
)
{
FatalError << "multiHoleInjector::multiHoleInjector(const time& t, const dictionary dict) " << endl
<< " end-times do not match for TemperatureProfile and massFlowRateProfile."
FatalErrorIn
(
"multiHoleInjector::multiHoleInjector"
"(const time& t, const dictionary dict)"
) << "End-times do not match for TemperatureProfile and "
<< "massFlowRateProfile."
<< abort(FatalError);
}
// convert CA to real time
forAll(massFlowRateProfile_, i)
{
massFlowRateProfile_[i][0] = t.userTimeToTime(massFlowRateProfile_[i][0]);
massFlowRateProfile_[i][0] =
t.userTimeToTime(massFlowRateProfile_[i][0]);
velocityProfile_[i][0] = massFlowRateProfile_[i][0];
injectionPressureProfile_[i][0] = massFlowRateProfile_[i][0];
}
forAll(TProfile_, i)
{
TProfile_[i][0] = t.userTimeToTime(TProfile_[i][0]);
@ -115,7 +125,7 @@ Foam::multiHoleInjector::multiHoleInjector
{
// correct the massFlowRateProfile to match the injected mass
massFlowRateProfile_[i][1] *= mass_/integratedMFR;
CdProfile_[i][0] = massFlowRateProfile_[i][0];
CdProfile_[i][1] = Cd_;
}
@ -131,17 +141,20 @@ Foam::multiHoleInjector::multiHoleInjector
if (mag(Xsum - 1.0) > SMALL)
{
Info << "Warning!!!\n multiHoleInjector::multiHoleInjector(const time& t, Istream& is)"
<< "X does not add up to 1.0, correcting molar fractions."
WarningIn
(
"multiHoleInjector::multiHoleInjector"
"(const time& t, const dictionary dict)"
) << "X does not add up to 1.0, correcting molar fractions."
<< endl;
forAll(X_, i)
{
X_[i] /= Xsum;
}
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::multiHoleInjector::~multiHoleInjector()
@ -152,7 +165,7 @@ Foam::multiHoleInjector::~multiHoleInjector()
void Foam::multiHoleInjector::setTangentialVectors()
{
scalar pi180 = mathematicalConstant::pi/180.0;
scalar pi180 = constant::math::pi/180.0;
scalar alpha = xyAngle_*pi180;
scalar phi = zAngle_*pi180;
@ -172,7 +185,7 @@ void Foam::multiHoleInjector::setTangentialVectors()
scalar angle = 0.0;
scalar u = umbrellaAngle_*pi180/2.0;
for(label i=0; i<nHoles_; i++)
for (label i=0; i<nHoles_; i++)
{
angle += angleSpacing_[i];
scalar v = angle*pi180;
@ -183,27 +196,26 @@ void Foam::multiHoleInjector::setTangentialVectors()
dp /= mag(dp);
}
position_[i] = centerPosition_ + 0.5*nozzleTipDiameter_*dp;
// Info << "i = " << i << ", dir = " << direction_[i] << ", pos = " << position_[i] << endl;
}
Random rndGen(label(0));
for(label i=0; i<nHoles_; i++)
for (label i=0; i<nHoles_; i++)
{
vector tangent(vector::zero);
scalar magV = 0;
while (magV < SMALL)
{
vector testThis = rndGen.vector01();
tangent = testThis - (testThis & direction_[i])*direction_[i];
magV = mag(tangent);
}
tangentialInjectionVector1_[i] = tangent/magV;
tangentialInjectionVector2_[i] = direction_[i] ^ tangentialInjectionVector1_[i];
}
tangentialInjectionVector2_[i] =
direction_[i] ^ tangentialInjectionVector1_[i];
}
}
@ -213,18 +225,20 @@ Foam::label Foam::multiHoleInjector::nParcelsToInject
const scalar time1
) const
{
scalar mInj = mass_*(fractionOfInjection(time1)-fractionOfInjection(time0));
scalar mInj =
mass_*(fractionOfInjection(time1) - fractionOfInjection(time0));
label nParcels = label(mInj/averageParcelMass_ + 0.49);
return nParcels;
}
const Foam::vector Foam::multiHoleInjector::position(const label n) const
{
return position_[n];
}
Foam::vector Foam::multiHoleInjector::position
(
const label n,
@ -253,10 +267,10 @@ Foam::vector Foam::multiHoleInjector::position
{
// otherwise, disc injection
scalar iRadius = d_*rndGen.scalar01();
scalar iAngle = 2.0*mathematicalConstant::pi*rndGen.scalar01();
scalar iAngle = constant::math::twoPi*rndGen.scalar01();
return
(
(
position_[n]
+ iRadius
* (
@ -264,21 +278,23 @@ Foam::vector Foam::multiHoleInjector::position
+ tangentialInjectionVector2_[n]*sin(iAngle)
)
);
}
return position_[0];
}
Foam::label Foam::multiHoleInjector::nHoles() const
{
return nHoles_;
}
Foam::scalar Foam::multiHoleInjector::d() const
{
return d_;
}
const Foam::vector& Foam::multiHoleInjector::direction
(
const label i,
@ -288,6 +304,7 @@ const Foam::vector& Foam::multiHoleInjector::direction
return direction_[i];
}
Foam::scalar Foam::multiHoleInjector::mass
(
const scalar time0,
@ -296,47 +313,55 @@ Foam::scalar Foam::multiHoleInjector::mass
const scalar angleOfWedge
) const
{
scalar mInj = mass_*(fractionOfInjection(time1)-fractionOfInjection(time0));
scalar mInj =
mass_*(fractionOfInjection(time1) - fractionOfInjection(time0));
// correct mass if calculation is 2D
// correct mass if calculation is 2D
if (twoD)
{
mInj *= 0.5*angleOfWedge/mathematicalConstant::pi;
mInj *= 0.5*angleOfWedge/constant::math::pi;
}
return mInj;
}
Foam::scalar Foam::multiHoleInjector::mass() const
{
return mass_;
}
const Foam::scalarField& Foam::multiHoleInjector::X() const
{
return X_;
}
Foam::List<Foam::multiHoleInjector::pair> Foam::multiHoleInjector::T() const
{
return TProfile_;
}
Foam::scalar Foam::multiHoleInjector::T(const scalar time) const
{
return getTableValue(TProfile_, time);
}
Foam::scalar Foam::multiHoleInjector::tsoi() const
{
return massFlowRateProfile_[0][0];
}
Foam::scalar Foam::multiHoleInjector::teoi() const
{
return massFlowRateProfile_[massFlowRateProfile_.size()-1][0];
}
Foam::scalar Foam::multiHoleInjector::massFlowRate
(
const scalar time
@ -345,6 +370,7 @@ Foam::scalar Foam::multiHoleInjector::massFlowRate
return getTableValue(massFlowRateProfile_, time);
}
Foam::scalar Foam::multiHoleInjector::injectionPressure
(
const scalar time
@ -353,6 +379,7 @@ Foam::scalar Foam::multiHoleInjector::injectionPressure
return getTableValue(injectionPressureProfile_, time);
}
Foam::scalar Foam::multiHoleInjector::velocity
(
const scalar time
@ -361,11 +388,14 @@ Foam::scalar Foam::multiHoleInjector::velocity
return getTableValue(velocityProfile_, time);
}
Foam::List<Foam::multiHoleInjector::pair> Foam::multiHoleInjector::CdProfile() const
Foam::List<Foam::multiHoleInjector::pair> Foam::multiHoleInjector::CdProfile()
const
{
return CdProfile_;
}
Foam::scalar Foam::multiHoleInjector::Cd
(
const scalar time
@ -374,11 +404,16 @@ Foam::scalar Foam::multiHoleInjector::Cd
return Cd_;
}
Foam::scalar Foam::multiHoleInjector::fractionOfInjection(const scalar time) const
Foam::scalar Foam::multiHoleInjector::fractionOfInjection
(
const scalar time
) const
{
return integrateTable(massFlowRateProfile_, time)/mass_;
}
Foam::scalar Foam::multiHoleInjector::injectedMass
(
const scalar t
@ -394,8 +429,7 @@ void Foam::multiHoleInjector::correctProfiles
const scalar referencePressure
)
{
scalar A = nHoles_*0.25*mathematicalConstant::pi*pow(d_, 2.0);
scalar A = nHoles_*0.25*constant::math::pi*sqr(d_);
forAll(velocityProfile_, i)
{
@ -407,14 +441,17 @@ void Foam::multiHoleInjector::correctProfiles
}
}
Foam::vector Foam::multiHoleInjector::tan1(const label n) const
{
return tangentialInjectionVector1_[n];
}
Foam::vector Foam::multiHoleInjector::tan2(const label n) const
{
return tangentialInjectionVector2_[n];
}
// ************************************************************************* //

View File

@ -47,7 +47,7 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class multiHoleInjector Declaration
Class multiHoleInjector Declaration
\*---------------------------------------------------------------------------*/
class multiHoleInjector
@ -123,9 +123,8 @@ public:
);
// Destructor
~multiHoleInjector();
//- Destructor
virtual ~multiHoleInjector();
// Member Functions
@ -152,7 +151,7 @@ public:
const vector& axisOfWedgeNormal,
Random& rndGen
) const;
//- Return the number of holes
label nHoles() const;
@ -207,14 +206,14 @@ public:
{
return injectionPressureProfile_;
}
scalar injectionPressure(const scalar time) const;
List<pair> velocityProfile() const
{
return velocityProfile_;
}
scalar velocity(const scalar time) const;
List<pair> CdProfile() const;
@ -233,7 +232,6 @@ public:
{
return pressureIndependentVelocity_;
}
};

View File

@ -27,7 +27,7 @@ License
#include "swirlInjector.H"
#include "addToRunTimeSelectionTable.H"
#include "Random.H"
#include "mathematicalConstants.H"
#include "mathConstants.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -83,13 +83,18 @@ Foam::swirlInjector::swirlInjector
}
// check if time entries match
if (mag(massFlowRateProfile_[0][0]-injectionPressureProfile_[0][0]) > SMALL)
if
(
mag(massFlowRateProfile_[0][0] - injectionPressureProfile_[0][0])
> SMALL
)
{
FatalErrorIn
(
"swirlInjector::swirlInjector(const time& t, const dictionary dict)"
"swirlInjector::swirlInjector"
"(const time& t, const dictionary dict)"
) << "Start-times do not match for "
"injectionPressureProfile and massFlowRateProfile."
<< "injectionPressureProfile and massFlowRateProfile."
<< abort(FatalError);
}
@ -105,9 +110,10 @@ Foam::swirlInjector::swirlInjector
{
FatalErrorIn
(
"swirlInjector::swirlInjector(const time& t, const dictionary dict)"
"swirlInjector::swirlInjector"
"(const time& t, const dictionary dict)"
) << "End-times do not match for "
"injectionPressureProfile and massFlowRateProfile."
<< "injectionPressureProfile and massFlowRateProfile."
<< abort(FatalError);
}
@ -152,7 +158,8 @@ Foam::swirlInjector::swirlInjector
{
WarningIn
(
"swirlInjector::swirlInjector(const time& t, const dictionary dict)"
"swirlInjector::swirlInjector"
"(const time& t, const dictionary dict)"
) << "X does not add up to 1.0, correcting molar fractions." << endl;
forAll(X_, i)
@ -186,9 +193,10 @@ void Foam::swirlInjector::setTangentialVectors()
}
tangentialInjectionVector1_ = tangent/magV;
tangentialInjectionVector2_ = direction_ ^ tangentialInjectionVector1_;
tangentialInjectionVector2_ = direction_^tangentialInjectionVector1_;
}
Foam::label Foam::swirlInjector::nParcelsToInject
(
const scalar time0,
@ -196,17 +204,20 @@ Foam::label Foam::swirlInjector::nParcelsToInject
) const
{
scalar mInj = mass_*(fractionOfInjection(time1)-fractionOfInjection(time0));
scalar mInj =
mass_*(fractionOfInjection(time1) - fractionOfInjection(time0));
label nParcels = label(mInj/averageParcelMass_ + 0.49);
return nParcels;
}
const Foam::vector Foam::swirlInjector::position(const label n) const
{
return position_;
}
Foam::vector Foam::swirlInjector::position
(
const label n,
@ -235,7 +246,7 @@ Foam::vector Foam::swirlInjector::position
{
// otherwise, disc injection
scalar iRadius = d_*rndGen.scalar01();
scalar iAngle = 2.0*mathematicalConstant::pi*rndGen.scalar01();
scalar iAngle = constant::math::twoPi*rndGen.scalar01();
return
(
@ -252,16 +263,19 @@ Foam::vector Foam::swirlInjector::position
return position_;
}
Foam::label Foam::swirlInjector::nHoles() const
{
return 1;
}
Foam::scalar Foam::swirlInjector::d() const
{
return d_;
}
const Foam::vector& Foam::swirlInjector::direction
(
const label i,
@ -271,6 +285,7 @@ const Foam::vector& Foam::swirlInjector::direction
return direction_;
}
Foam::scalar Foam::swirlInjector::mass
(
const scalar time0,
@ -279,95 +294,112 @@ Foam::scalar Foam::swirlInjector::mass
const scalar angleOfWedge
) const
{
scalar mInj = mass_*(fractionOfInjection(time1)-fractionOfInjection(time0));
scalar mInj =
mass_*(fractionOfInjection(time1) - fractionOfInjection(time0));
// correct mass if calculation is 2D
if (twoD)
{
mInj *= 0.5*angleOfWedge/mathematicalConstant::pi;
mInj *= 0.5*angleOfWedge/constant::math::pi;
}
return mInj;
}
Foam::scalar Foam::swirlInjector::mass() const
{
return mass_;
}
Foam::List<Foam::swirlInjector::pair>
Foam::swirlInjector::massFlowRateProfile() const
{
return massFlowRateProfile_;
}
Foam::scalar Foam::swirlInjector::massFlowRate(const scalar time) const
{
return getTableValue(massFlowRateProfile_, time);
}
Foam::List<Foam::swirlInjector::pair>
Foam::swirlInjector::injectionPressureProfile() const
{
return injectionPressureProfile_;
}
Foam::scalar Foam::swirlInjector::injectionPressure(const scalar time) const
{
return getTableValue(injectionPressureProfile_, time);
}
Foam::List<Foam::swirlInjector::pair>
Foam::swirlInjector::velocityProfile() const
{
return velocityProfile_;
}
Foam::scalar Foam::swirlInjector::velocity(const scalar time) const
{
return getTableValue(velocityProfile_, time);
}
Foam::List<Foam::swirlInjector::pair> Foam::swirlInjector::CdProfile() const
{
return CdProfile_;
}
Foam::scalar Foam::swirlInjector::Cd(const scalar time) const
{
return getTableValue(CdProfile_, time);
}
const Foam::scalarField& Foam::swirlInjector::X() const
{
return X_;
}
Foam::List<Foam::swirlInjector::pair> Foam::swirlInjector::T() const
{
return TProfile_;
}
Foam::scalar Foam::swirlInjector::T(const scalar time) const
{
return T_;
}
Foam::scalar Foam::swirlInjector::tsoi() const
{
return massFlowRateProfile_[0][0];
}
Foam::scalar Foam::swirlInjector::teoi() const
{
return massFlowRateProfile_[massFlowRateProfile_.size()-1][0];
}
Foam::scalar Foam::swirlInjector::fractionOfInjection(const scalar time) const
{
return integrateTable(massFlowRateProfile_, time)/mass_;
}
Foam::scalar Foam::swirlInjector::injectedMass
(
const scalar t
@ -376,14 +408,14 @@ Foam::scalar Foam::swirlInjector::injectedMass
return mass_*fractionOfInjection(t);
}
void Foam::swirlInjector::correctProfiles
(
const liquidMixture& fuel,
const scalar referencePressure
)
{
scalar A = 0.25*mathematicalConstant::pi*pow(d_, 2.0);
scalar A = 0.25*constant::math::pi*sqr(d_);
scalar pDummy = 1.0e+5;
scalar rho = fuel.rho(pDummy, T_, X_);
@ -401,11 +433,13 @@ void Foam::swirlInjector::correctProfiles
}
}
Foam::vector Foam::swirlInjector::tan1(const label n) const
{
return tangentialInjectionVector1_;
}
Foam::vector Foam::swirlInjector::tan2(const label n) const
{
return tangentialInjectionVector2_;

View File

@ -104,17 +104,15 @@ private:
//- Return the fraction of the total injected liquid
scalar fractionOfInjection(const scalar time) const;
/*
//- Return the average injection velocity
scalar averageInjectionVelocityTime(const scalar liquidDensity) const;
//- Return the instantaneous injection velocity
scalar injectionVelocity(const scalar, const scalar liquidDensity) const;
*/
public:
//- Runtime type information
@ -124,16 +122,11 @@ public:
// Constructors
//- Construct from components
swirlInjector
(
const Time& t,
const dictionary& dict
);
swirlInjector(const Time& t, const dictionary& dict);
// Destructor
~swirlInjector();
//- Destructor
virtual ~swirlInjector();
// Member Functions
@ -160,7 +153,7 @@ public:
const vector& axisOfWedgeNormal,
Random& rndGen
) const;
//- Return the number of holes
label nHoles() const;
@ -204,7 +197,7 @@ public:
//- Return the instantaneous velocity
scalar velocity(const scalar time) const;
//- Return the discharge coefficient
//- Return the discharge coefficient
List<pair> CdProfile() const;
//- Return the instantaneous discharge coefficient
@ -236,7 +229,7 @@ public:
const liquidMixture& fuel,
const scalar referencePressure
);
bool pressureIndependentVelocity() const
{
return pressureIndependentVelocity_;

View File

@ -27,7 +27,7 @@ License
#include "unitInjector.H"
#include "addToRunTimeSelectionTable.H"
#include "Random.H"
#include "mathematicalConstants.H"
#include "mathConstants.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -77,8 +77,8 @@ Foam::unitInjector::unitInjector
FatalErrorIn
(
"unitInjector::unitInjector(const time& t, const dictionary dict)"
)<< "start-times do not match for TemperatureProfile and "
<< " massFlowRateProfile." << nl << exit (FatalError);
) << "start-times do not match for TemperatureProfile and "
<< " massFlowRateProfile." << nl << exit (FatalError);
}
if
@ -91,8 +91,8 @@ Foam::unitInjector::unitInjector
FatalErrorIn
(
"unitInjector::unitInjector(const time& t, const dictionary dict)"
)<< "end-times do not match for TemperatureProfile and "
<< "massFlowRateProfile." << nl << exit(FatalError);
) << "end-times do not match for TemperatureProfile and "
<< "massFlowRateProfile." << nl << exit(FatalError);
}
// convert CA to real time
@ -145,6 +145,7 @@ Foam::unitInjector::unitInjector
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::unitInjector::~unitInjector()
@ -169,7 +170,6 @@ void Foam::unitInjector::setTangentialVectors()
tangentialInjectionVector1_ = tangent/magV;
tangentialInjectionVector2_ = direction_ ^ tangentialInjectionVector1_;
}
@ -179,7 +179,8 @@ Foam::label Foam::unitInjector::nParcelsToInject
const scalar time1
) const
{
scalar mInj = mass_*(fractionOfInjection(time1)-fractionOfInjection(time0));
scalar mInj =
mass_*(fractionOfInjection(time1) - fractionOfInjection(time0));
label nParcels = label(mInj/averageParcelMass_ + 0.49);
return nParcels;
}
@ -219,7 +220,7 @@ Foam::vector Foam::unitInjector::position
{
// otherwise, disc injection
scalar iRadius = d_*rndGen.scalar01();
scalar iAngle = 2.0*mathematicalConstant::pi*rndGen.scalar01();
scalar iAngle = constant::math::twoPi*rndGen.scalar01();
return
(
@ -230,7 +231,6 @@ Foam::vector Foam::unitInjector::position
+ tangentialInjectionVector2_*sin(iAngle)
)
);
}
return position_;
@ -267,12 +267,13 @@ Foam::scalar Foam::unitInjector::mass
const scalar angleOfWedge
) const
{
scalar mInj = mass_*(fractionOfInjection(time1)-fractionOfInjection(time0));
scalar mInj =
mass_*(fractionOfInjection(time1) - fractionOfInjection(time0));
// correct mass if calculation is 2D
if (twoD)
{
mInj *= 0.5*angleOfWedge/mathematicalConstant::pi;
mInj *= 0.5*angleOfWedge/constant::math::pi;
}
return mInj;
@ -363,7 +364,7 @@ void Foam::unitInjector::correctProfiles
const scalar referencePressure
)
{
scalar A = 0.25*mathematicalConstant::pi*pow(d_, 2.0);
scalar A = 0.25*constant::math::pi*sqr(d_);
scalar pDummy = 1.0e+5;
forAll(velocityProfile_, i)

View File

@ -109,16 +109,11 @@ public:
// Constructors
//- Construct from components
unitInjector
(
const Time& t,
const dictionary& dict
);
unitInjector(const Time& t, const dictionary& dict);
// Destructor
~unitInjector();
//- Destructor
virtual ~unitInjector();
// Member Functions
@ -145,7 +140,7 @@ public:
const vector& axisOfWedgeNormal,
Random& rndGen
) const;
//- Return the number of holes
label nHoles() const;
@ -200,14 +195,14 @@ public:
{
return injectionPressureProfile_;
}
scalar injectionPressure(const scalar time) const;
List<pair> velocityProfile() const
{
return velocityProfile_;
}
scalar velocity(const scalar time) const;
List<pair> CdProfile() const;
@ -226,7 +221,6 @@ public:
{
return pressureIndependentVelocity_;
}
};

View File

@ -459,7 +459,6 @@ void Foam::parcel::updateParcelProperties
scalar Tnew = T();
// NN.
// first calculate the new temperature and droplet mass,
// then calculate the energy source and correct the
// gaseous temperature, Tg, and mass fraction, Yfg,

View File

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

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