diff --git a/applications/solvers/combustion/dieselEngineFoam/createSpray.H b/applications/solvers/combustion/dieselEngineFoam/createSpray.H index ea4d0121b691884e8a774bb5c77e49bf836f10ac..6b78689f09094ddcfb160533fb851bc257b9f454 100644 --- a/applications/solvers/combustion/dieselEngineFoam/createSpray.H +++ b/applications/solvers/combustion/dieselEngineFoam/createSpray.H @@ -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 -= diff --git a/applications/solvers/combustion/dieselEngineFoam/dieselEngineFoam.C b/applications/solvers/combustion/dieselEngineFoam/dieselEngineFoam.C index e3f9c0b118e42571d54e2ad3fa5d0ecdc0760025..709b70f7a6d73522b135933c7f675a3e4e6c6a3d 100644 --- a/applications/solvers/combustion/dieselEngineFoam/dieselEngineFoam.C +++ b/applications/solvers/combustion/dieselEngineFoam/dieselEngineFoam.C @@ -43,6 +43,7 @@ Description #include "OFstream.H" #include "volPointInterpolation.H" #include "thermoPhysicsTypes.H" +#include "mathConstants.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/combustion/dieselEngineFoam/spraySummary.H b/applications/solvers/combustion/dieselEngineFoam/spraySummary.H index 31337d0a77ee0dea6b686bd8f1c2b551d317329a..2bacaa91ee922e8b8663a4bc97c2ee76140b2717 100644 --- a/applications/solvers/combustion/dieselEngineFoam/spraySummary.H +++ b/applications/solvers/combustion/dieselEngineFoam/spraySummary.H @@ -20,7 +20,7 @@ if (dieselSpray.twoD()) { - gasMass *= 2.0*mathematicalConstant::pi/dieselSpray.angleOfWedge(); + gasMass *= constant::math::twoPi/dieselSpray.angleOfWedge(); } scalar addedMass = gasMass - gasMass0; diff --git a/applications/solvers/combustion/dieselFoam/dieselFoam.C b/applications/solvers/combustion/dieselFoam/dieselFoam.C index 86460c1e9a0d7296bdec7d356e737b17cbc0101a..8d5dd0d9facad1d3a6d7a7cca51458c1ab095a4e 100644 --- a/applications/solvers/combustion/dieselFoam/dieselFoam.C +++ b/applications/solvers/combustion/dieselFoam/dieselFoam.C @@ -41,6 +41,7 @@ Description #include "IFstream.H" #include "OFstream.H" #include "Switch.H" +#include "mathConstants.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/combustion/engineFoam/engineFoam.C b/applications/solvers/combustion/engineFoam/engineFoam.C index 9adf73cc67c167a7cbbee0474c461aea7afdafb8..8ff998217d3965354de1a5e0dcee81b74f2f953a 100644 --- a/applications/solvers/combustion/engineFoam/engineFoam.C +++ b/applications/solvers/combustion/engineFoam/engineFoam.C @@ -58,6 +58,7 @@ Description #include "ignition.H" #include "Switch.H" #include "OFstream.H" +#include "mathConstants.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/solvers/compressible/rhoCentralFoam/BCs/T/smoluchowskiJumpTFvPatchScalarField.C b/applications/solvers/compressible/rhoCentralFoam/BCs/T/smoluchowskiJumpTFvPatchScalarField.C index b2d007094ee3bcf2456b7b0985991fd217783998..276cac6ae01e8fe4c178db15516b490658abd83c 100644 --- a/applications/solvers/compressible/rhoCentralFoam/BCs/T/smoluchowskiJumpTFvPatchScalarField.C +++ b/applications/solvers/compressible/rhoCentralFoam/BCs/T/smoluchowskiJumpTFvPatchScalarField.C @@ -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_; diff --git a/applications/solvers/compressible/rhoCentralFoam/BCs/U/maxwellSlipUFvPatchVectorField.C b/applications/solvers/compressible/rhoCentralFoam/BCs/U/maxwellSlipUFvPatchVectorField.C index a087d0c9642d5022106ebdcfc7c6c971889d929c..7cf2ab1f25b8ced12911bbfc8b6f841dc92c14c4 100644 --- a/applications/solvers/compressible/rhoCentralFoam/BCs/U/maxwellSlipUFvPatchVectorField.C +++ b/applications/solvers/compressible/rhoCentralFoam/BCs/U/maxwellSlipUFvPatchVectorField.C @@ -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; diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/SchnerrSauer/SchnerrSauer.C b/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/SchnerrSauer/SchnerrSauer.C index 02d220138b3be75823bf3a7adeee12a1253b1f90..03e46a5c6332ee36bfca0f7fe4e1154988deb959 100644 --- a/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/SchnerrSauer/SchnerrSauer.C +++ b/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/SchnerrSauer/SchnerrSauer.C @@ -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); } diff --git a/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/multiphaseMixture.C b/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/multiphaseMixture.C index 613dbfbaef0268d2cfbc22dd2d5305031b139697..240207c8ab834f594b07a257bf22bdb736da7505 100644 --- a/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/multiphaseMixture.C +++ b/applications/solvers/multiphase/multiphaseInterFoam/multiphaseMixture/multiphaseMixture.C @@ -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 * * * * * * * * * * * // diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/conductivityModel/Gidaspow/GidaspowConductivity.C b/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/conductivityModel/Gidaspow/GidaspowConductivity.C index 5eb399afbfbe71cb40bf19a3e218822f70a7dbe0..fe24603713f2ac3912b10e946f9f9f3e1fc67e64 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/conductivityModel/Gidaspow/GidaspowConductivity.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/conductivityModel/Gidaspow/GidaspowConductivity.C @@ -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) ); } diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/conductivityModel/HrenyaSinclair/HrenyaSinclairConductivity.C b/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/conductivityModel/HrenyaSinclair/HrenyaSinclairConductivity.C index 3fdd409f5bc492ea240558e77641f9c4febf9a84..2d0acca9fafd49ace0d2f56709e9f42f2e0afa6b 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/conductivityModel/HrenyaSinclair/HrenyaSinclairConductivity.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/conductivityModel/HrenyaSinclair/HrenyaSinclairConductivity.C @@ -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)* diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/conductivityModel/Syamlal/SyamlalConductivity.C b/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/conductivityModel/Syamlal/SyamlalConductivity.C index 8e555dd4871c3c045ba3dfabd843c10743de2c83..40c296f7e0463eb72779c03c04660264bcfa4f0e 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/conductivityModel/Syamlal/SyamlalConductivity.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/conductivityModel/Syamlal/SyamlalConductivity.C @@ -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)* ( diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.C b/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.C index 5a6d4aa52d79c6a72fcf1e3b7fb0c0e04ae8a0f9..dd3f3451794013a9481b96f54dfae6e5b942e04b 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/kineticTheoryModel/kineticTheoryModel.C @@ -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_); diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/viscosityModel/Gidaspow/GidaspowViscosity.C b/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/viscosityModel/Gidaspow/GidaspowViscosity.C index b1a127e2e56dfd6a0bc78b58a24cdc5d6425e99b..2a1c00b188d1429659ce63b1cca8a997f6f02c8e 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/viscosityModel/Gidaspow/GidaspowViscosity.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/viscosityModel/Gidaspow/GidaspowViscosity.C @@ -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)* ( diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/viscosityModel/HrenyaSinclair/HrenyaSinclairViscosity.C b/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/viscosityModel/HrenyaSinclair/HrenyaSinclairViscosity.C index 8b431478959ba474d8632da6da557ac2dbfc0b91..b5e60e94c26d8fdf077e6ccd46c3289bc99a1112 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/viscosityModel/HrenyaSinclair/HrenyaSinclairViscosity.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/viscosityModel/HrenyaSinclair/HrenyaSinclairViscosity.C @@ -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_; diff --git a/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/viscosityModel/Syamlal/SyamlalViscosity.C b/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/viscosityModel/Syamlal/SyamlalViscosity.C index 28c2c56b07357f46e4d7a24faaf2c0da8611d98f..892319df6c65ce387ad79148333707d9d07f898d 100644 --- a/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/viscosityModel/Syamlal/SyamlalViscosity.C +++ b/applications/solvers/multiphase/twoPhaseEulerFoam/kineticTheoryModels/viscosityModel/Syamlal/SyamlalViscosity.C @@ -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)* ( diff --git a/applications/test/graphXi/graphXi.C b/applications/test/graphXi/graphXi.C index 2c3a5750f37d9ab090b5287fbbd6029c1124e94c..c717f6cc1f963f9269da2040b80a0c87c7499246 100644 --- a/applications/test/graphXi/graphXi.C +++ b/applications/test/graphXi/graphXi.C @@ -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); diff --git a/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C b/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C index d4d6d11539cee0aaa35b20200a3471fb85e01f91..0905771d199c1d865be6f87e424a5b9b05771ce4 100644 --- a/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C +++ b/applications/utilities/mesh/advanced/collapseEdges/collapseEdges.C @@ -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 diff --git a/applications/utilities/mesh/advanced/combinePatchFaces/combinePatchFaces.C b/applications/utilities/mesh/advanced/combinePatchFaces/combinePatchFaces.C index 60c94395614766a61d1e1ff49e6b039b5194846d..de7af2b077d21defaec9e20829f605c2b14a75db 100644 --- a/applications/utilities/mesh/advanced/combinePatchFaces/combinePatchFaces.C +++ b/applications/utilities/mesh/advanced/combinePatchFaces/combinePatchFaces.C @@ -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"); diff --git a/applications/utilities/mesh/advanced/splitCells/splitCells.C b/applications/utilities/mesh/advanced/splitCells/splitCells.C index 85afb3a771998c2779ef23391a39ae5403723290..1d9c0e5b5430df6bd27a9144ef0263544d3d67c3 100644 --- a/applications/utilities/mesh/advanced/splitCells/splitCells.C +++ b/applications/utilities/mesh/advanced/splitCells/splitCells.C @@ -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); diff --git a/applications/utilities/mesh/conversion/kivaToFoam/kivaToFoam.C b/applications/utilities/mesh/conversion/kivaToFoam/kivaToFoam.C index 1da7ba049e4202ae5e2065fe3f9be3fd0a5502a6..996cd67d4ce6735e503482a67d41c64ee102ac2a 100644 --- a/applications/utilities/mesh/conversion/kivaToFoam/kivaToFoam.C +++ b/applications/utilities/mesh/conversion/kivaToFoam/kivaToFoam.C @@ -43,7 +43,7 @@ Description #include "symmetryPolyPatch.H" #include "wedgePolyPatch.H" #include "cyclicPolyPatch.H" -#include "mathematicalConstants.H" +#include "mathConstants.H" using namespace Foam; diff --git a/applications/utilities/mesh/conversion/kivaToFoam/readKivaGrid.H b/applications/utilities/mesh/conversion/kivaToFoam/readKivaGrid.H index d315dce4a08fe559389119fae389f833b5413694..f1ec25a59c19f67f81fd2edfeb20f0438e36b544 100644 --- a/applications/utilities/mesh/conversion/kivaToFoam/readKivaGrid.H +++ b/applications/utilities/mesh/conversion/kivaToFoam/readKivaGrid.H @@ -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(); diff --git a/applications/utilities/mesh/conversion/polyDualMesh/polyDualMeshApp.C b/applications/utilities/mesh/conversion/polyDualMesh/polyDualMeshApp.C index 2707469a6cd9a698fb343c5ddb6d9ce8b345c332..65dd5c952d93891bcb39ee37c3f6665f2638a82d 100644 --- a/applications/utilities/mesh/conversion/polyDualMesh/polyDualMeshApp.C +++ b/applications/utilities/mesh/conversion/polyDualMesh/polyDualMeshApp.C @@ -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 diff --git a/applications/utilities/mesh/conversion/starToFoam/createCoupleMatches.C b/applications/utilities/mesh/conversion/starToFoam/createCoupleMatches.C index 910df915d839cda42d432296690ee11c57cfc3a5..0b135188e00e173b0f92f870698762e535373157 100644 --- a/applications/utilities/mesh/conversion/starToFoam/createCoupleMatches.C +++ b/applications/utilities/mesh/conversion/starToFoam/createCoupleMatches.C @@ -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()] diff --git a/applications/utilities/mesh/generation/blockMesh/curvedEdges/arcEdge.C b/applications/utilities/mesh/generation/blockMesh/curvedEdges/arcEdge.C index 886281274b6f1a859db28bcd81d192e08062f3bc..2039ffb0bbfe18e67da5d6c9b7a6f69e809f07af 100644 --- a/applications/utilities/mesh/generation/blockMesh/curvedEdges/arcEdge.C +++ b/applications/utilities/mesh/generation/blockMesh/curvedEdges/arcEdge.C @@ -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; } diff --git a/applications/utilities/mesh/generation/extrudeMesh/extrudeMesh.C b/applications/utilities/mesh/generation/extrudeMesh/extrudeMesh.C index 4d5bca0e8220e2c8691ea0e914e870c6581165ea..4d7d6bc81d98d5c426ca688bb78a5e4ac66fef4a 100644 --- a/applications/utilities/mesh/generation/extrudeMesh/extrudeMesh.C +++ b/applications/utilities/mesh/generation/extrudeMesh/extrudeMesh.C @@ -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" diff --git a/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/wedge/wedge.C b/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/wedge/wedge.C index 5d0a3621b43c8752a1da56dfd950a41900f51e2f..07ddf34eaf83b4056d5b4a8f146093ecf4224741 100644 --- a/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/wedge/wedge.C +++ b/applications/utilities/mesh/generation/extrudeMesh/extrudeModel/wedge/wedge.C @@ -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 ) {} diff --git a/applications/utilities/mesh/manipulation/autoPatch/autoPatch.C b/applications/utilities/mesh/manipulation/autoPatch/autoPatch.C index 758592590c4f632b8a09a0a8aba39c8bd816fdde..3c48f6d7d7e86b2fadd1b07dadde324ea0f95534 100644 --- a/applications/utilities/mesh/manipulation/autoPatch/autoPatch.C +++ b/applications/utilities/mesh/manipulation/autoPatch/autoPatch.C @@ -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 diff --git a/applications/utilities/mesh/manipulation/transformPoints/transformPoints.C b/applications/utilities/mesh/manipulation/transformPoints/transformPoints.C index e77fbaf022409d6c7ae4b76a7d3eaff1e98a7937..c6d7b8f61eeb832985ab9769291a72355af232b6 100644 --- a/applications/utilities/mesh/manipulation/transformPoints/transformPoints.C +++ b/applications/utilities/mesh/manipulation/transformPoints/transformPoints.C @@ -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; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/utilities/postProcessing/miscellaneous/pdfPlot/Make/options b/applications/utilities/postProcessing/miscellaneous/pdfPlot/Make/options index f24872134122dab30edecf61de26263329a6daa4..a140053895021e4469c8f776270a59a1acf433c7 100644 --- a/applications/utilities/postProcessing/miscellaneous/pdfPlot/Make/options +++ b/applications/utilities/postProcessing/miscellaneous/pdfPlot/Make/options @@ -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 diff --git a/applications/utilities/postProcessing/miscellaneous/pdfPlot/createFields.H b/applications/utilities/postProcessing/miscellaneous/pdfPlot/createFields.H index c9255fc4cfb72a9e3cb92a2fc8ce7050e29b2ccb..2dc6e7af7040d0acdddd218c9be96c197b6cedcc 100644 --- a/applications/utilities/postProcessing/miscellaneous/pdfPlot/createFields.H +++ b/applications/utilities/postProcessing/miscellaneous/pdfPlot/createFields.H @@ -2,7 +2,7 @@ ( IOobject ( - "pdfDictionary", + "pdfDict", runTime.constant(), runTime, IOobject::MUST_READ, @@ -10,20 +10,9 @@ ) ); - label nIntervals - ( - readLabel(pdfDictionary.lookup("nIntervals")) - ); - - label nSamples - ( - readLabel(pdfDictionary.lookup("nSamples")) - ); + label nIntervals(readLabel(pdfDictionary.lookup("nIntervals"))); - label samples[nIntervals]; + label nSamples(readLabel(pdfDictionary.lookup("nSamples"))); - for(label i=0;i<nIntervals;i++) - { - samples[i] = 0; - } + scalarField samples(nIntervals, 0); diff --git a/applications/utilities/postProcessing/miscellaneous/pdfPlot/pdfDict b/applications/utilities/postProcessing/miscellaneous/pdfPlot/pdfDict new file mode 100644 index 0000000000000000000000000000000000000000..2a48115beafd86a41e7cb779a1bd2f514f53b4ec --- /dev/null +++ b/applications/utilities/postProcessing/miscellaneous/pdfPlot/pdfDict @@ -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); +} + + +// ************************************************************************* // diff --git a/applications/utilities/postProcessing/miscellaneous/pdfPlot/pdfPlot.C b/applications/utilities/postProcessing/miscellaneous/pdfPlot/pdfPlot.C index 0bd05727d782842eacb1abfaeb84e6c45c4bf3e6..09e85cb6492084eef0cfeb2729cd10ccfae4d976 100644 --- a/applications/utilities/postProcessing/miscellaneous/pdfPlot/pdfPlot.C +++ b/applications/utilities/postProcessing/miscellaneous/pdfPlot/pdfPlot.C @@ -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; diff --git a/applications/utilities/preProcessing/engineSwirl/engineSwirl.C b/applications/utilities/preProcessing/engineSwirl/engineSwirl.C index e9171c330cc9d0b1de233c100273347e5f57bb4e..92e305709398933d4823f398f7122a0b6e9b78c7 100644 --- a/applications/utilities/preProcessing/engineSwirl/engineSwirl.C +++ b/applications/utilities/preProcessing/engineSwirl/engineSwirl.C @@ -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(); diff --git a/applications/utilities/preProcessing/setFields/setFields.C b/applications/utilities/preProcessing/setFields/setFields.C index 5ba3727b39bb794d2fdeff316abc67f30589bfeb..d164709504a234271b150538fb947536be91e3a9 100644 --- a/applications/utilities/preProcessing/setFields/setFields.C +++ b/applications/utilities/preProcessing/setFields/setFields.C @@ -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" diff --git a/applications/utilities/surface/surfaceTransformPoints/surfaceTransformPoints.C b/applications/utilities/surface/surfaceTransformPoints/surfaceTransformPoints.C index c3243b71ae82f02347fa25c4a98cae57b8626705..78716d63c789fd9c9883f23220f128d291d2ac41 100644 --- a/applications/utilities/surface/surfaceTransformPoints/surfaceTransformPoints.C +++ b/applications/utilities/surface/surfaceTransformPoints/surfaceTransformPoints.C @@ -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; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/applications/utilities/thermophysical/chemkinToFoam/chemkinToFoam.C b/applications/utilities/thermophysical/chemkinToFoam/chemkinToFoam.C index ce8a3e16f402d5068db8764cf3487f26eae4ae65..18befde0afa83e6d0b1681ada37c273b47432380 100644 --- a/applications/utilities/thermophysical/chemkinToFoam/chemkinToFoam.C +++ b/applications/utilities/thermophysical/chemkinToFoam/chemkinToFoam.C @@ -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; diff --git a/etc/controlDict b/etc/controlDict index c1d7416515f2c7495b8350794ebdfb52748b47a5..97af349e7aa8360fde8a91954d9570215a8797db 100644 --- a/etc/controlDict +++ b/etc/controlDict @@ -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; + } + } } diff --git a/src/OpenFOAM/Make/files b/src/OpenFOAM/Make/files index 7bff2143ec5b3dbb5e34bf634cc74b69da29c9bb..6ba6b90cf116720e24a35025059b46474a946285 100644 --- a/src/OpenFOAM/Make/files +++ b/src/OpenFOAM/Make/files @@ -1,5 +1,6 @@ global/global.Cver global/dimensionedConstants/dimensionedConstants.C +global/dimensionedConstants/constants/constants.C global/argList/argList.C global/clock/clock.C diff --git a/src/OpenFOAM/global/dimensionedConstants/constants/atomic/atomicConstants.C b/src/OpenFOAM/global/dimensionedConstants/constants/atomic/atomicConstants.C new file mode 100644 index 0000000000000000000000000000000000000000..943bdc5c38cd4c9c33a3a35587c50e3f948c5e79 --- /dev/null +++ b/src/OpenFOAM/global/dimensionedConstants/constants/atomic/atomicConstants.C @@ -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 + ) + ) +); + + +// ************************************************************************* // + + + diff --git a/src/OpenFOAM/global/dimensionedConstants/constants/atomic/atomicConstants.H b/src/OpenFOAM/global/dimensionedConstants/constants/atomic/atomicConstants.H new file mode 100644 index 0000000000000000000000000000000000000000..c25737444152aaee517c2790669b83a62d882c7c --- /dev/null +++ b/src/OpenFOAM/global/dimensionedConstants/constants/atomic/atomicConstants.H @@ -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 + +// ************************************************************************* // + + + diff --git a/src/thermophysicalModels/radiation/radiationConstants/radiationConstants.H b/src/OpenFOAM/global/dimensionedConstants/constants/constants.C similarity index 74% rename from src/thermophysicalModels/radiation/radiationConstants/radiationConstants.H rename to src/OpenFOAM/global/dimensionedConstants/constants/constants.C index 2e7e5602e81cde6e8c0b8f1779aa3d1a34760371..f921cba9836e9bff24bb31ce0fbcd53dc567bba4 100644 --- a/src/thermophysicalModels/radiation/radiationConstants/radiationConstants.H +++ b/src/OpenFOAM/global/dimensionedConstants/constants/constants.C @@ -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 // ************************************************************************* // diff --git a/src/OpenFOAM/global/dimensionedConstants/constants/constants.H b/src/OpenFOAM/global/dimensionedConstants/constants/constants.H new file mode 100644 index 0000000000000000000000000000000000000000..14ab108667e1dcb2f7232fbd31045b1749c6af63 --- /dev/null +++ b/src/OpenFOAM/global/dimensionedConstants/constants/constants.H @@ -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 + +// ************************************************************************* // diff --git a/src/OpenFOAM/global/dimensionedConstants/constants/electromagnetic/electromagneticConstants.C b/src/OpenFOAM/global/dimensionedConstants/constants/electromagnetic/electromagneticConstants.C new file mode 100644 index 0000000000000000000000000000000000000000..77e2fec40cac3551c3bb9db3a491fd06b79ddeb9 --- /dev/null +++ b/src/OpenFOAM/global/dimensionedConstants/constants/electromagnetic/electromagneticConstants.C @@ -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) + ) + ) +); + + +// ************************************************************************* // + + diff --git a/src/OpenFOAM/global/dimensionedConstants/constants/electromagnetic/electromagneticConstants.H b/src/OpenFOAM/global/dimensionedConstants/constants/electromagnetic/electromagneticConstants.H new file mode 100644 index 0000000000000000000000000000000000000000..54586cda47e7cc185261e8ae2580d78f5b3eb046 --- /dev/null +++ b/src/OpenFOAM/global/dimensionedConstants/constants/electromagnetic/electromagneticConstants.H @@ -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 + +// ************************************************************************* // + + diff --git a/src/OpenFOAM/global/dimensionedConstants/constants/fundamental/fundamentalConstants.C b/src/OpenFOAM/global/dimensionedConstants/constants/fundamental/fundamentalConstants.C new file mode 100644 index 0000000000000000000000000000000000000000..37e7bf4806430fb4301da23b297b131ed07d4b55 --- /dev/null +++ b/src/OpenFOAM/global/dimensionedConstants/constants/fundamental/fundamentalConstants.C @@ -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") +); + + +// ************************************************************************* // diff --git a/src/OpenFOAM/global/dimensionedConstants/constants/fundamental/fundamentalConstants.H b/src/OpenFOAM/global/dimensionedConstants/constants/fundamental/fundamentalConstants.H new file mode 100644 index 0000000000000000000000000000000000000000..de30291fe8a547b321bab339a3de86bbf286a61f --- /dev/null +++ b/src/OpenFOAM/global/dimensionedConstants/constants/fundamental/fundamentalConstants.H @@ -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 + +// ************************************************************************* // diff --git a/src/OpenFOAM/primitives/mathematicalConstants/mathematicalConstants.H b/src/OpenFOAM/global/dimensionedConstants/constants/math/mathConstants.H similarity index 86% rename from src/OpenFOAM/primitives/mathematicalConstants/mathematicalConstants.H rename to src/OpenFOAM/global/dimensionedConstants/constants/math/mathConstants.H index c1b45e96941158175765f4773abe362ef751b5ec..f18f97d749608843aeb1907e3c2e03aead26579b 100644 --- a/src/OpenFOAM/primitives/mathematicalConstants/mathematicalConstants.H +++ b/src/OpenFOAM/global/dimensionedConstants/constants/math/mathConstants.H @@ -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 // ************************************************************************* // + + + diff --git a/src/OpenFOAM/global/dimensionedConstants/constants/physicoChemical/physicoChemicalConstants.C b/src/OpenFOAM/global/dimensionedConstants/constants/physicoChemical/physicoChemicalConstants.C new file mode 100644 index 0000000000000000000000000000000000000000..7446c67d9739924a27a342fbcd26b0b0782baf8e --- /dev/null +++ b/src/OpenFOAM/global/dimensionedConstants/constants/physicoChemical/physicoChemicalConstants.C @@ -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 + ) + ) +); + + +// ************************************************************************* // diff --git a/src/OpenFOAM/global/dimensionedConstants/constants/physicoChemical/physicoChemicalConstants.H b/src/OpenFOAM/global/dimensionedConstants/constants/physicoChemical/physicoChemicalConstants.H new file mode 100644 index 0000000000000000000000000000000000000000..7f25e0dfb7f0aac5c7914e777b42d5b4cfcdc4fb --- /dev/null +++ b/src/OpenFOAM/global/dimensionedConstants/constants/physicoChemical/physicoChemicalConstants.H @@ -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 + +// ************************************************************************* // + + + + diff --git a/src/thermophysicalModels/radiation/radiationConstants/radiationConstants.C b/src/OpenFOAM/global/dimensionedConstants/constants/universal/universalConstants.C similarity index 78% rename from src/thermophysicalModels/radiation/radiationConstants/radiationConstants.C rename to src/OpenFOAM/global/dimensionedConstants/constants/universal/universalConstants.C index 0e5962910d297c970e0f32e947de103e01e019c0..3284c51d4dbe4018d86c48b787b230d839a67113 100644 --- a/src/thermophysicalModels/radiation/radiationConstants/radiationConstants.C +++ b/src/OpenFOAM/global/dimensionedConstants/constants/universal/universalConstants.C @@ -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)) ) ) ); // ************************************************************************* // + diff --git a/src/OpenFOAM/global/dimensionedConstants/constants/universal/universalConstants.H b/src/OpenFOAM/global/dimensionedConstants/constants/universal/universalConstants.H new file mode 100644 index 0000000000000000000000000000000000000000..305e30fe190568c49211730dfc078e327be68eae --- /dev/null +++ b/src/OpenFOAM/global/dimensionedConstants/constants/universal/universalConstants.H @@ -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 + +// ************************************************************************* // + diff --git a/src/OpenFOAM/global/dimensionedConstants/dimensionedConstants.C b/src/OpenFOAM/global/dimensionedConstants/dimensionedConstants.C index a3a9893fde97005bd41560e83de647032422e46b..b9a7d4277bd4de07aff3cdb9d01bebbc91018e5e 100644 --- a/src/OpenFOAM/global/dimensionedConstants/dimensionedConstants.C +++ b/src/OpenFOAM/global/dimensionedConstants/dimensionedConstants.C @@ -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 diff --git a/src/OpenFOAM/global/dimensionedConstants/dimensionedConstants.H b/src/OpenFOAM/global/dimensionedConstants/dimensionedConstants.H index 476638dbc70a24a4cac36a6af5216d5b61c61347..989089c0b065fee12857e30b317a445026a8909d 100644 --- a/src/OpenFOAM/global/dimensionedConstants/dimensionedConstants.H +++ b/src/OpenFOAM/global/dimensionedConstants/dimensionedConstants.H @@ -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; } } diff --git a/src/OpenFOAM/meshes/meshShapes/face/face.C b/src/OpenFOAM/meshes/meshShapes/face/face.C index f371e697a1a9e4022c3d505ae26abef420785ec2..a7bbf88005239266d53604d7aa633c1c1541b50c 100644 --- a/src/OpenFOAM/meshes/meshShapes/face/face.C +++ b/src/OpenFOAM/meshes/meshShapes/face/face.C @@ -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++) { diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCheck/primitiveMeshCheck.C b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCheck/primitiveMeshCheck.C index 29841d3ec86892fd222c2dae5f6f0864e03a7cec..01879f089f8e3ff815cc301b0d3314d4e908661e 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCheck/primitiveMeshCheck.C +++ b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCheck/primitiveMeshCheck.C @@ -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) { diff --git a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCheck/primitiveMeshCheckMotion.C b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCheck/primitiveMeshCheckMotion.C index 8a82cc4189a1bb53e35da10828dc67fe42ecfd9e..1dafd61f61bdb0819d9bd6465a38abe54a116df5 100644 --- a/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCheck/primitiveMeshCheckMotion.C +++ b/src/OpenFOAM/meshes/primitiveMesh/primitiveMeshCheck/primitiveMeshCheckMotion.C @@ -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++; diff --git a/src/OpenFOAM/meshes/primitiveShapes/triangle/triangleI.H b/src/OpenFOAM/meshes/primitiveShapes/triangle/triangleI.H index a21461bc6289d3c9329bf21937e7a681b68ce575..881fb1d5202073f820d28c4e8db22703ed139038 100644 --- a/src/OpenFOAM/meshes/primitiveShapes/triangle/triangleI.H +++ b/src/OpenFOAM/meshes/primitiveShapes/triangle/triangleI.H @@ -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 ); } diff --git a/src/OpenFOAM/primitives/SymmTensor/labelSymmTensor/labelSymmTensor.C b/src/OpenFOAM/primitives/SymmTensor/labelSymmTensor/labelSymmTensor.C index cd8ed8f9b5807be845170f07c834564178f41ab2..7668cfe0e9463aa69990f8db24882081b2f81ab3 100644 --- a/src/OpenFOAM/primitives/SymmTensor/labelSymmTensor/labelSymmTensor.C +++ b/src/OpenFOAM/primitives/SymmTensor/labelSymmTensor/labelSymmTensor.C @@ -25,7 +25,6 @@ License \*---------------------------------------------------------------------------*/ #include "labelSymmTensor.H" -#include "mathematicalConstants.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/primitives/Tensor/tensor/tensor.C b/src/OpenFOAM/primitives/Tensor/tensor/tensor.C index f36589312565a9fc26d72a16299371e1b5af59d0..6ecc1da31351422682e4311569a88b2c9948e7c7 100644 --- a/src/OpenFOAM/primitives/Tensor/tensor/tensor.C +++ b/src/OpenFOAM/primitives/Tensor/tensor/tensor.C @@ -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 { diff --git a/src/OpenFOAM/primitives/Tensor2D/tensor2D/tensor2D.C b/src/OpenFOAM/primitives/Tensor2D/tensor2D/tensor2D.C index e782cd0fea8d516c3ea07504b310cf06d2e368ba..b817d4ab5edce6a26b1d6a5a37fd64656cf78f2f 100644 --- a/src/OpenFOAM/primitives/Tensor2D/tensor2D/tensor2D.C +++ b/src/OpenFOAM/primitives/Tensor2D/tensor2D/tensor2D.C @@ -25,7 +25,6 @@ License \*---------------------------------------------------------------------------*/ #include "tensor2D.H" -#include "mathematicalConstants.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/primitives/transform/transform.H b/src/OpenFOAM/primitives/transform/transform.H index 33bf2b1d39f83e0a97b21498764fdca5c6f418fd..8d6657b41f915e2459ac55d787c1a755d1e4f011 100644 --- a/src/OpenFOAM/primitives/transform/transform.H +++ b/src/OpenFOAM/primitives/transform/transform.H @@ -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; } } diff --git a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C b/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C index 716bdc6ddfacb967f4e97c2a2e7481327bb6af86..27ca388fe393fba545ca31481608909ed54b8af0 100644 --- a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C +++ b/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoLayerDriver.C @@ -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, diff --git a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C b/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C index 1ba66fffe93a674cf052e5c61cc8eb81efb96936..3ea198e6c4ebc2b216c6e2471495f27d504d1049 100644 --- a/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C +++ b/src/autoMesh/autoHexMesh/autoHexMeshDriver/autoRefineDriver.C @@ -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) { diff --git a/src/autoMesh/autoHexMesh/autoHexMeshDriver/layerParameters/layerParameters.C b/src/autoMesh/autoHexMesh/autoHexMeshDriver/layerParameters/layerParameters.C index fad664229652a22fa4f2949b69bc226009a7abbe..ea57136c1d66f6e859c6336d103d771234f6ceb8 100644 --- a/src/autoMesh/autoHexMesh/autoHexMeshDriver/layerParameters/layerParameters.C +++ b/src/autoMesh/autoHexMesh/autoHexMeshDriver/layerParameters/layerParameters.C @@ -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_ ( diff --git a/src/autoMesh/autoHexMesh/autoHexMeshDriver/refinementParameters/refinementParameters.C b/src/autoMesh/autoHexMesh/autoHexMeshDriver/refinementParameters/refinementParameters.C index d63d527faed069cc437a7fee15cee20c2314bce7..ce3b82bfc6c91e80b5ac269a0194330f31c6d72e 100644 --- a/src/autoMesh/autoHexMesh/autoHexMeshDriver/refinementParameters/refinementParameters.C +++ b/src/autoMesh/autoHexMesh/autoHexMeshDriver/refinementParameters/refinementParameters.C @@ -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); } } diff --git a/src/autoMesh/autoHexMesh/meshRefinement/meshRefinementProblemCells.C b/src/autoMesh/autoHexMesh/meshRefinement/meshRefinementProblemCells.C index fb0a7e2121f020576494e848ad8b6116f71fbcdd..2f3f4e60cafb2f82684a9643faea59ed2bfc551b 100644 --- a/src/autoMesh/autoHexMesh/meshRefinement/meshRefinementProblemCells.C +++ b/src/autoMesh/autoHexMesh/meshRefinement/meshRefinementProblemCells.C @@ -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; diff --git a/src/dynamicFvMesh/dynamicInkJetFvMesh/dynamicInkJetFvMesh.C b/src/dynamicFvMesh/dynamicInkJetFvMesh/dynamicInkJetFvMesh.C index 3b1045cdb377b1baaf951325672e6fd138867737..5fa27e142a6e5e6d36790663a5d4e22e1f73a048 100644 --- a/src/dynamicFvMesh/dynamicInkJetFvMesh/dynamicInkJetFvMesh.C +++ b/src/dynamicFvMesh/dynamicInkJetFvMesh/dynamicInkJetFvMesh.C @@ -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(); diff --git a/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/SDA/SDA.C b/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/SDA/SDA.C index d2f0c467d2d797110f96fc70e7076c0eb1e5f7c9..1fbd323685f026335b1f1ef9326976fa9195f307 100644 --- a/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/SDA/SDA.C +++ b/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/SDA/SDA.C @@ -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_); diff --git a/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/SKA/SKA.C b/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/SKA/SKA.C index 6d4cdc44270c661f6e8fea0feaa9c41f56dc57f7..e15523f9832c1c2b7afb69cd1f61d6faf99175eb 100644 --- a/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/SKA/SKA.C +++ b/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/SKA/SKA.C @@ -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 * * * * * * * * * * * * * // diff --git a/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFvMesh.C b/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFvMesh.C index e41ed4b427edafac00abf18c574f9b0b7515747f..7329c1dd905b3f7cc51d6fcdb6b347f1721bb26c 100644 --- a/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFvMesh.C +++ b/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFvMesh.C @@ -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 diff --git a/src/dynamicMesh/meshCut/cellLooper/hexCellLooper.C b/src/dynamicMesh/meshCut/cellLooper/hexCellLooper.C index e31ad4c2a13d12bf46ee972702e6ae4b78f72e13..8e705ae5258b62afa98519a4311c79f75f3a70ba 100644 --- a/src/dynamicMesh/meshCut/cellLooper/hexCellLooper.C +++ b/src/dynamicMesh/meshCut/cellLooper/hexCellLooper.C @@ -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); - - } diff --git a/src/dynamicMesh/meshCut/cellLooper/topoCellLooper.C b/src/dynamicMesh/meshCut/cellLooper/topoCellLooper.C index 3572546e75bed5fea96f56a80f8dcd69b4848527..8f4a57aca7f2f3dde505f14a508267b1269a8e9e 100644 --- a/src/dynamicMesh/meshCut/cellLooper/topoCellLooper.C +++ b/src/dynamicMesh/meshCut/cellLooper/topoCellLooper.C @@ -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 * * * * * * * * * * * // diff --git a/src/dynamicMesh/meshCut/meshModifiers/undoableMeshCutter/undoableMeshCutter.C b/src/dynamicMesh/meshCut/meshModifiers/undoableMeshCutter/undoableMeshCutter.C index 15478458c9290ccd53865b9a5ad88de036c1d19f..57dd15eb545adb1c5d4477ded509b3796bab3cfb 100644 --- a/src/dynamicMesh/meshCut/meshModifiers/undoableMeshCutter/undoableMeshCutter.C +++ b/src/dynamicMesh/meshCut/meshModifiers/undoableMeshCutter/undoableMeshCutter.C @@ -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) ) {} diff --git a/src/dynamicMesh/motionSmoother/polyMeshGeometry/polyMeshGeometry.C b/src/dynamicMesh/motionSmoother/polyMeshGeometry/polyMeshGeometry.C index 37882a2cc0821ba68a7ed3181d630bb2412287a7..4fbd137526c0906aeaeab48818ce9145a0684576 100644 --- a/src/dynamicMesh/motionSmoother/polyMeshGeometry/polyMeshGeometry.C +++ b/src/dynamicMesh/motionSmoother/polyMeshGeometry/polyMeshGeometry.C @@ -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>()); diff --git a/src/engine/engineTime/engineTime.C b/src/engine/engineTime/engineTime.C index 226334d308bba565458d8a625a93c507f7248da4..8756cff006047d6bd8eb600765fde9a351894d33 100644 --- a/src/engine/engineTime/engineTime.C +++ b/src/engine/engineTime/engineTime.C @@ -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 } -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - // ************************************************************************* // diff --git a/src/engine/include/StCorr.H b/src/engine/include/StCorr.H index a776fef5c3d85c636ef5b5297925ef1876fed343..21e5491f103048780ceb0a6904e1047b21622162 100644 --- a/src/engine/include/StCorr.H +++ b/src/engine/include/StCorr.H @@ -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; diff --git a/src/finiteVolume/cfdTools/general/SRF/SRFModel/rpm/rpm.C b/src/finiteVolume/cfdTools/general/SRF/SRFModel/rpm/rpm.C index d8faf3514768ca80e3adbe3e63a352a4326074ad..6eae867a24f72bd53a58db0d7b5374987a2d7afb 100644 --- a/src/finiteVolume/cfdTools/general/SRF/SRFModel/rpm/rpm.C +++ b/src/finiteVolume/cfdTools/general/SRF/SRFModel/rpm/rpm.C @@ -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; } diff --git a/src/finiteVolume/cfdTools/general/include/fvCFD.H b/src/finiteVolume/cfdTools/general/include/fvCFD.H index 95f566bb1b37e56d2558a5356aaa6d3b7b021811..05b121db80a7c3e306f4f2a83024b141f9292ae2 100644 --- a/src/finiteVolume/cfdTools/general/include/fvCFD.H +++ b/src/finiteVolume/cfdTools/general/include/fvCFD.H @@ -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" diff --git a/src/finiteVolume/fields/fvPatchFields/derived/oscillatingFixedValue/oscillatingFixedValueFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/derived/oscillatingFixedValue/oscillatingFixedValueFvPatchField.C index bb74cddcd233de23b178fe8571dacadadeef509a..912dbf3ea35b0b129a56db7c438fd25d703010f4 100644 --- a/src/finiteVolume/fields/fvPatchFields/derived/oscillatingFixedValue/oscillatingFixedValueFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/derived/oscillatingFixedValue/oscillatingFixedValueFvPatchField.C @@ -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()); } diff --git a/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolation/surfaceInterpolation.C b/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolation/surfaceInterpolation.C index c26bc26c93b32767fd3831d0a5593114e9d54855..b6ead004e7e679f543bd016435144484dadf5337 100644 --- a/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolation/surfaceInterpolation.C +++ b/src/finiteVolume/interpolation/surfaceInterpolation/surfaceInterpolation/surfaceInterpolation.C @@ -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) diff --git a/src/lagrangian/coalCombustion/submodels/surfaceReactionModel/COxidationDiffusionLimitedRate/COxidationDiffusionLimitedRate.C b/src/lagrangian/coalCombustion/submodels/surfaceReactionModel/COxidationDiffusionLimitedRate/COxidationDiffusionLimitedRate.C index 2e252fbf596518b276d552225c0fc55353f48cc1..21e51a9e63b68ba6f0c9eb05d0940164dc859255 100644 --- a/src/lagrangian/coalCombustion/submodels/surfaceReactionModel/COxidationDiffusionLimitedRate/COxidationDiffusionLimitedRate.C +++ b/src/lagrangian/coalCombustion/submodels/surfaceReactionModel/COxidationDiffusionLimitedRate/COxidationDiffusionLimitedRate.C @@ -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); diff --git a/src/lagrangian/coalCombustion/submodels/surfaceReactionModel/COxidationKineticDiffusionLimitedRate/COxidationKineticDiffusionLimitedRate.C b/src/lagrangian/coalCombustion/submodels/surfaceReactionModel/COxidationKineticDiffusionLimitedRate/COxidationKineticDiffusionLimitedRate.C index 682bac3ec67c9bd4eb4634daa0e7315ea9d24140..a96c2ee507ce48b68628931336a0d520e36cef48 100644 --- a/src/lagrangian/coalCombustion/submodels/surfaceReactionModel/COxidationKineticDiffusionLimitedRate/COxidationKineticDiffusionLimitedRate.C +++ b/src/lagrangian/coalCombustion/submodels/surfaceReactionModel/COxidationKineticDiffusionLimitedRate/COxidationKineticDiffusionLimitedRate.C @@ -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); diff --git a/src/lagrangian/coalCombustion/submodels/surfaceReactionModel/COxidationMurphyShaddix/COxidationMurphyShaddix.C b/src/lagrangian/coalCombustion/submodels/surfaceReactionModel/COxidationMurphyShaddix/COxidationMurphyShaddix.C index e2a1c68700d84c7f2ad2470881d5ee946ee9d127..6ee7419b8aadef98b1f132d4ba49de820926a08c 100644 --- a/src/lagrangian/coalCombustion/submodels/surfaceReactionModel/COxidationMurphyShaddix/COxidationMurphyShaddix.C +++ b/src/lagrangian/coalCombustion/submodels/surfaceReactionModel/COxidationMurphyShaddix/COxidationMurphyShaddix.C @@ -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] diff --git a/src/lagrangian/dieselSpray/injector/commonRailInjector/commonRailInjector.C b/src/lagrangian/dieselSpray/injector/commonRailInjector/commonRailInjector.C index 49b5b4ad3af1f538686da9b6deabfde93144c03e..ea3f54f0e01bdb2982b02750f3f414e7bc03076c 100644 --- a/src/lagrangian/dieselSpray/injector/commonRailInjector/commonRailInjector.C +++ b/src/lagrangian/dieselSpray/injector/commonRailInjector/commonRailInjector.C @@ -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); - -addToRunTimeSelectionTable -( - injectorType, - commonRailInjector, - dictionary -); + defineTypeNameAndDebug(commonRailInjector, 0); + + 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_; } + // ************************************************************************* // diff --git a/src/lagrangian/dieselSpray/injector/commonRailInjector/commonRailInjector.H b/src/lagrangian/dieselSpray/injector/commonRailInjector/commonRailInjector.H index 17abfdd51d65fa66fe0fd7b47442d784a76566d1..7aa1e3f87f0d8dd6b32533ad523c7c18e9531bc9 100644 --- a/src/lagrangian/dieselSpray/injector/commonRailInjector/commonRailInjector.H +++ b/src/lagrangian/dieselSpray/injector/commonRailInjector/commonRailInjector.H @@ -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_; } - }; diff --git a/src/lagrangian/dieselSpray/injector/definedInjector/definedInjector.C b/src/lagrangian/dieselSpray/injector/definedInjector/definedInjector.C index b483a3bdf396ba880026dbdcca59c3e1fc270262..a9557c4f09fbab93df6f37e893c94c70b5d81af4 100644 --- a/src/lagrangian/dieselSpray/injector/definedInjector/definedInjector.C +++ b/src/lagrangian/dieselSpray/injector/definedInjector/definedInjector.C @@ -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); - -addToRunTimeSelectionTable -( - injectorType, - definedInjector, - dictionary -); - + defineTypeNameAndDebug(definedInjector, 0); + + 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_; } + // ************************************************************************* // diff --git a/src/lagrangian/dieselSpray/injector/definedInjector/definedInjector.H b/src/lagrangian/dieselSpray/injector/definedInjector/definedInjector.H index fff583391ae24e5111a1542a591a497b4b89e0fe..e2028f6e14c9fa54e032ccb3765d0c197195d47c 100644 --- a/src/lagrangian/dieselSpray/injector/definedInjector/definedInjector.H +++ b/src/lagrangian/dieselSpray/injector/definedInjector/definedInjector.H @@ -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_; } - }; diff --git a/src/lagrangian/dieselSpray/injector/injector/injector.C b/src/lagrangian/dieselSpray/injector/injector/injector.C index 9b32014ac113a87220418a04d5311287b79a24f8..5d611b3ceddb608d23fd9fe9d29e79f9bb5a6009 100644 --- a/src/lagrangian/dieselSpray/injector/injector/injector.C +++ b/src/lagrangian/dieselSpray/injector/injector/injector.C @@ -31,10 +31,9 @@ License namespace Foam { -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// No code // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/lagrangian/dieselSpray/injector/injector/injector.H b/src/lagrangian/dieselSpray/injector/injector/injector.H index 90303b6040b0e5388b3630280a9fd82d3e5820b3..2a67692471b21c89c2f814d177b3654a8f94bf77 100644 --- a/src/lagrangian/dieselSpray/injector/injector/injector.H +++ b/src/lagrangian/dieselSpray/injector/injector/injector.H @@ -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); diff --git a/src/lagrangian/dieselSpray/injector/injectorType/injectorType.C b/src/lagrangian/dieselSpray/injector/injectorType/injectorType.C index 8607b8eab11716371eb7e32fd564358b4ca02a4d..5a6edcda83b7919162227c97b10727e671b673a2 100644 --- a/src/lagrangian/dieselSpray/injector/injectorType/injectorType.C +++ b/src/lagrangian/dieselSpray/injector/injectorType/injectorType.C @@ -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; } + // ************************************************************************* // diff --git a/src/lagrangian/dieselSpray/injector/injectorType/injectorType.H b/src/lagrangian/dieselSpray/injector/injectorType/injectorType.H index 5b0e2ceefaf471c57b42d8a559e9747b68f3fdfa..9943bc10db897a89b2af7cea8a356481c1d2b2fc 100644 --- a/src/lagrangian/dieselSpray/injector/injectorType/injectorType.H +++ b/src/lagrangian/dieselSpray/injector/injectorType/injectorType.H @@ -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; - }; diff --git a/src/lagrangian/dieselSpray/injector/multiHoleInjector/multiHoleInjector.C b/src/lagrangian/dieselSpray/injector/multiHoleInjector/multiHoleInjector.C index 2b0147d77e3fc4fb2e24defd618a6e1772db0d73..44f963f014ad7a9196a72992eb3940658b675fd8 100644 --- a/src/lagrangian/dieselSpray/injector/multiHoleInjector/multiHoleInjector.C +++ b/src/lagrangian/dieselSpray/injector/multiHoleInjector/multiHoleInjector.C @@ -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); - -addToRunTimeSelectionTable -( - injectorType, - multiHoleInjector, - dictionary -); + defineTypeNameAndDebug(multiHoleInjector, 0); + + 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]; } + // ************************************************************************* // diff --git a/src/lagrangian/dieselSpray/injector/multiHoleInjector/multiHoleInjector.H b/src/lagrangian/dieselSpray/injector/multiHoleInjector/multiHoleInjector.H index 96c13153d32459b39eee74559461373e8ff41bb2..a022d0ff773fbbd6e4c6411de2cd10af23e01421 100644 --- a/src/lagrangian/dieselSpray/injector/multiHoleInjector/multiHoleInjector.H +++ b/src/lagrangian/dieselSpray/injector/multiHoleInjector/multiHoleInjector.H @@ -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_; } - }; diff --git a/src/lagrangian/dieselSpray/injector/swirlInjector/swirlInjector.C b/src/lagrangian/dieselSpray/injector/swirlInjector/swirlInjector.C index 2d9fa9bf7c0bae992d97bb7d131d43c9bd712f54..0ade2f8f0503cccc6c7bbcf8b80cc7343fd0f2a8 100644 --- a/src/lagrangian/dieselSpray/injector/swirlInjector/swirlInjector.C +++ b/src/lagrangian/dieselSpray/injector/swirlInjector/swirlInjector.C @@ -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_; diff --git a/src/lagrangian/dieselSpray/injector/swirlInjector/swirlInjector.H b/src/lagrangian/dieselSpray/injector/swirlInjector/swirlInjector.H index 9f7f3347abfe79a74de044307ab6475696eade34..767601d8b32c0207675c0c325f1fc51e1317cfcf 100644 --- a/src/lagrangian/dieselSpray/injector/swirlInjector/swirlInjector.H +++ b/src/lagrangian/dieselSpray/injector/swirlInjector/swirlInjector.H @@ -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_; diff --git a/src/lagrangian/dieselSpray/injector/unitInjector/unitInjector.C b/src/lagrangian/dieselSpray/injector/unitInjector/unitInjector.C index 6b1b07dc7a349c1123d120c26b38b7d01ec37b9d..f6439faf1128547bd28aa4b75d8bfe3976368530 100644 --- a/src/lagrangian/dieselSpray/injector/unitInjector/unitInjector.C +++ b/src/lagrangian/dieselSpray/injector/unitInjector/unitInjector.C @@ -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) diff --git a/src/lagrangian/dieselSpray/injector/unitInjector/unitInjector.H b/src/lagrangian/dieselSpray/injector/unitInjector/unitInjector.H index a2b9fd5c7a54a6b0504333972b08bf513cf0cadd..438ccd533aa76023a874fe9bf9782a3580ae4a3e 100644 --- a/src/lagrangian/dieselSpray/injector/unitInjector/unitInjector.H +++ b/src/lagrangian/dieselSpray/injector/unitInjector/unitInjector.H @@ -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_; } - }; diff --git a/src/lagrangian/dieselSpray/parcel/parcel.C b/src/lagrangian/dieselSpray/parcel/parcel.C index 0dd861683bbf95e89686d661f4c719ab665c0703..49c4d5db489aa941ca75869367f331341483d136 100644 --- a/src/lagrangian/dieselSpray/parcel/parcel.C +++ b/src/lagrangian/dieselSpray/parcel/parcel.C @@ -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, diff --git a/src/lagrangian/dieselSpray/parcel/parcelFunctions.C b/src/lagrangian/dieselSpray/parcel/parcelFunctions.C index 4670185ea9813169dadc285283fc773d1f3ce578..55647326442908c14c679cc298c1898bccab8cfd 100644 --- a/src/lagrangian/dieselSpray/parcel/parcelFunctions.C +++ b/src/lagrangian/dieselSpray/parcel/parcelFunctions.C @@ -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; } diff --git a/src/lagrangian/dieselSpray/spray/findInjectorCell.H b/src/lagrangian/dieselSpray/spray/findInjectorCell.H index f1a8d7fc152c89feac4149d66366a0145ec9802e..ff4eea7904a78fa3b5fa03f224d9597041540b0e 100644 --- a/src/lagrangian/dieselSpray/spray/findInjectorCell.H +++ b/src/lagrangian/dieselSpray/spray/findInjectorCell.H @@ -5,7 +5,7 @@ if (injectorCell >= 0) { const vector& C = mesh_.C()[injectorCell]; injectionPosition += 1.0e-9*(C - injectionPosition); - + foundCell = mesh_.pointInCell ( injectionPosition, @@ -15,7 +15,6 @@ if (injectorCell >= 0) reduce(foundCell, orOp<bool>()); -// NN. // Due to the disc injection, the injectionPosition // can be moved outside the domain. // try point injection @@ -24,7 +23,7 @@ if (!foundCell) { injectionPosition = it->position(n); injectorCell = mesh_.findCell(injectionPosition); - + if (injectorCell >= 0) { const vector& C = mesh_.C()[injectorCell]; @@ -45,13 +44,13 @@ if (!foundCell) { injectorCell = mesh_.findNearestCell(injectionPosition); - + if (injectorCell >= 0) { - + const vector& C = mesh_.C()[injectorCell]; injectionPosition += 1.0e-9*(C - injectionPosition); - + foundCell = mesh_.pointInCell ( injectionPosition, @@ -59,11 +58,11 @@ if (!foundCell) ); } reduce(foundCell, orOp<bool>()); - + if (!foundCell) { - FatalError - << "Cannot find injection position " + FatalError + << "Cannot find injection position " << injectionPosition << abort(FatalError); } diff --git a/src/lagrangian/dieselSpray/spray/spray.C b/src/lagrangian/dieselSpray/spray/spray.C index 3280fefdc93939812cb05681d24f480510b66fdf..1f1945ef5dbc96f88594fd632c2035bbbb03e543 100644 --- a/src/lagrangian/dieselSpray/spray/spray.C +++ b/src/lagrangian/dieselSpray/spray/spray.C @@ -41,7 +41,7 @@ License #include "symmetryPolyPatch.H" #include "wedgePolyPatch.H" -#include "mathematicalConstants.H" +#include "mathConstants.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -289,17 +289,17 @@ Foam::spray::spray axisOfWedgeNormal_ /= mag(axisOfWedgeNormal_); scalar arcCos = (v1 & v2)/mag(v1); - angleOfWedge_ = mathematicalConstant::pi - acos(arcCos); + angleOfWedge_ = constant::math::pi - acos(arcCos); Info<< "Calculated angle of wedge is " - << angleOfWedge_*180/mathematicalConstant::pi << " deg." + << angleOfWedge_*180/constant::math::pi << " deg." << endl; } else { if (symPlaneExist) { - angleOfWedge_ = mathematicalConstant::pi; + angleOfWedge_ = constant::math::pi; Info<< "Constructing 180 deg three dimensional spray injection." << endl; } diff --git a/src/lagrangian/dieselSpray/spray/sprayFunctions.C b/src/lagrangian/dieselSpray/spray/sprayFunctions.C index f6a7a02476a88ca141f32dc049f35d67bc47a0e1..43b14b477816dde0b3fe2b3bbf07535e15b77d10 100644 --- a/src/lagrangian/dieselSpray/spray/sprayFunctions.C +++ b/src/lagrangian/dieselSpray/spray/sprayFunctions.C @@ -25,7 +25,7 @@ License \*---------------------------------------------------------------------------*/ #include "spray.H" -#include "mathematicalConstants.H" +#include "mathConstants.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -106,7 +106,7 @@ scalar spray::liquidMass() const if (twoD()) { - sum *= 2.0*mathematicalConstant::pi/angleOfWedge(); + sum *= constant::math::twoPi/angleOfWedge(); } reduce(sum, sumOp<scalar>()); @@ -137,7 +137,7 @@ scalar spray::liquidEnthalpy() const { label k = liquidToGasIndex_[j]; - hg += + hg += gasProperties()[k].H(T)*gasProperties()[k].W()*elmnt().X()[j] /Wl; } @@ -148,7 +148,7 @@ scalar spray::liquidEnthalpy() const if (twoD()) { - sum *= 2.0*mathematicalConstant::pi/angleOfWedge(); + sum *= constant::math::twoPi/angleOfWedge(); } reduce(sum, sumOp<scalar>()); @@ -180,7 +180,7 @@ scalar spray::liquidTotalEnthalpy() const for(label j=0; j<Nf; j++) { label k = liquidToGasIndex_[j]; - hg += + hg += gasProperties()[k].H(T)*gasProperties()[k].W()*elmnt().X()[j] /Wl; } @@ -193,7 +193,7 @@ scalar spray::liquidTotalEnthalpy() const if (twoD()) { - sum *= 2.0*mathematicalConstant::pi/angleOfWedge(); + sum *= constant::math::twoPi/angleOfWedge(); } reduce(sum, sumOp<scalar>()); @@ -218,7 +218,7 @@ scalar spray::liquidKineticEnergy() const if (twoD()) { - sum *= 2.0*mathematicalConstant::pi/angleOfWedge(); + sum *= constant::math::twoPi/angleOfWedge(); } reduce(sum, sumOp<scalar>()); @@ -267,7 +267,7 @@ scalar spray::liquidPenetration scalar mTot = 0.0; label Np = size(); - + // arrays containing the parcels mass and // distance from injector in ascending order scalarField m(Np); @@ -276,7 +276,6 @@ scalar spray::liquidPenetration if (Np > 1) { - // NN. // first arrange the parcels in ascending order // the first parcel is closest to injector // and the last one is most far away. @@ -303,8 +302,8 @@ scalar spray::liquidPenetration bool found = false; // insert the parcel in the correct place - // and move the others - while ( ( i < n-1 ) && ( !found ) ) + // and move the others + while ( ( i < n-1 ) && ( !found ) ) { if (de < dist[i]) { diff --git a/src/lagrangian/dieselSpray/spray/sprayOps.C b/src/lagrangian/dieselSpray/spray/sprayOps.C index 72e44a6bbe9c133040685091039518eb37464056..9a19041075c0d395f2d6f63d222708fc16d79ca7 100644 --- a/src/lagrangian/dieselSpray/spray/sprayOps.C +++ b/src/lagrangian/dieselSpray/spray/sprayOps.C @@ -31,7 +31,6 @@ License #include "dispersionModel.H" #include "interpolationCellPoint.H" #include "processorPolyPatch.H" -#include "mathematicalConstants.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/lagrangian/dieselSpray/spraySubModels/atomizationModel/LISA/LISA.C b/src/lagrangian/dieselSpray/spraySubModels/atomizationModel/LISA/LISA.C index 742f1fe1b347be3af257e33e66af7d2b273b7f31..36bbbfce715d0622035f5e09b3849a1e12fe5d27 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/atomizationModel/LISA/LISA.C +++ b/src/lagrangian/dieselSpray/spraySubModels/atomizationModel/LISA/LISA.C @@ -24,12 +24,10 @@ License \*---------------------------------------------------------------------------*/ -#include "error.H" - #include "LISA.H" #include "addToRunTimeSelectionTable.H" #include "basicMultiComponentMixture.H" - +#include "mathConstants.H" #include "RosinRammler.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -58,7 +56,7 @@ LISA::LISA ) : atomizationModel(dict, sm), - coeffsDict_(dict.subDict(typeName+"Coeffs")), + coeffsDict_(dict.subDict(typeName + "Coeffs")), rndGen_(sm.rndGen()), Cl_(readScalar(coeffsDict_.lookup("Cl"))), cTau_(readScalar(coeffsDict_.lookup("cTau"))), @@ -83,18 +81,15 @@ void LISA::atomizeParcel const liquidMixture& fuels ) const { - - const PtrList<volScalarField>& Y = spray_.composition().Y(); - label Ns = Y.size(); label cellI = p.cell(); scalar pressure = spray_.p()[cellI]; scalar temperature = spray_.T()[cellI]; scalar Taverage = p.T() + (temperature - p.T())/3.0; scalar Winv = 0.0; - for(label i=0; i<Ns; i++) + forAll (Y, i) { Winv += Y[i][cellI]/spray_.gasProperties()[i].W(); } @@ -106,9 +101,8 @@ void LISA::atomizeParcel //scalar nuAverage = muAverage/rhoAverage; scalar sigma = fuels.sigma(pressure, p.T(), p.X()); - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - // The We and Re numbers are to be evaluated using the 1/3 rule. - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + // The We and Re numbers are to be evaluated using the 1/3 rule. scalar WeberNumber = p.We(vel, rhoAverage, sigma); @@ -124,12 +118,8 @@ void LISA::atomizeParcel scalar uGas = mag(vel & uDir); vector Ug = uGas*uDir; -/* - TL - It might be the relative velocity between Liquid and Gas, but I use the - absolute velocity of the parcel as suggested by the authors -*/ - + // Might be the relative velocity between Liquid and Gas, but using the + // absolute velocity of the parcel as suggested by the authors // scalar U = mag(p.Urel(vel)); scalar U = mag(p.U()); @@ -142,14 +132,16 @@ void LISA::atomizeParcel if (it.nHoles() > 1) { - Info << "Warning: This atomization model is not suitable for multihole injector." << endl - << "Only the first hole will be used." << endl; + Info<< "Warning: This atomization model is not suitable for " + << "multihole injectors. " + << "Only the first hole will be used." << endl; } const vector itPosition = it.position(0); scalar pWalk = mag(p.position() - itPosition); -// Updating liquid sheet tickness... that is the droplet diameter + + // Updating liquid sheet tickness... that is the droplet diameter const vector direction = it.direction(0, spray_.runTime().value()); @@ -163,36 +155,30 @@ void LISA::atomizeParcel scalar massFlow = it.massFlowRate(max(0.0,elapsedTime-time)); - scalar hSheet = massFlow/(mathematicalConstant::pi*d*rhoFuel*mag(p.U())); + scalar hSheet = massFlow/(constant::math::pi*d*rhoFuel*mag(p.U())); p.d() = min(hSheet,p.d()); - if(WeberNumber > 27.0/16.0) + if (WeberNumber > 27.0/16.0) { - scalar kPos = 0.0; - scalar kNeg = Q*pow(U, 2.0)*rhoFuel/sigma; + scalar kNeg = Q*sqr(U)*rhoFuel/sigma; - scalar derivativePos = sqrt - ( - Q*pow(U,2.0) - ); + scalar derivativePos = sqrt(Q*pow(U,2.0)); scalar derivativeNeg = ( - 8.0*pow(nuFuel, 2.0)*pow(kNeg, 3.0) - + Q*pow(U, 2.0)*kNeg - - 3.0*sigma/2.0/rhoFuel*pow(kNeg, 2.0) + 8.0*sqr(nuFuel)*pow3(kNeg) + + Q*sqr(U)*kNeg + - 3.0*sigma/2.0/rhoFuel*sqr(kNeg) ) - / - sqrt + /sqrt ( - 4.0*pow(nuFuel, 2.0)*pow(kNeg, 4.0) - + Q*pow(U, 2.0)*pow(kNeg, 2.0) - - sigma*pow(kNeg, 3.0)/rhoFuel + 4.0*sqr(nuFuel)*pow4(kNeg) + + Q*sqr(U)*sqr(kNeg) + - sigma*pow3(kNeg)/rhoFuel ) - - - 4.0*nuFuel*kNeg; + - 4.0*nuFuel*kNeg; scalar kOld = 0.0; @@ -200,25 +186,24 @@ void LISA::atomizeParcel for(label i=0; i<40; i++) { - k = kPos - (derivativePos/((derivativeNeg-derivativePos)/(kNeg-kPos))); + k = kPos + - (derivativePos/((derivativeNeg - derivativePos)/(kNeg - kPos))); scalar derivativek = ( - 8.0*pow(nuFuel, 2.0)*pow(k, 3.0) - + Q*pow(U, 2.0)*k - - 3.0*sigma/2.0/rhoFuel*pow(k, 2.0) + 8.0*sqr(nuFuel)*pow3(k) + + Q*sqr(U)*k + - 3.0*sigma/2.0/rhoFuel*sqr(k) ) - / - sqrt + /sqrt ( - 4.0*pow(nuFuel, 2.0)*pow(k, 4.0) - + Q*pow(U, 2.0)*pow(k, 2.0) - - sigma*pow(k, 3.0)/rhoFuel + 4.0*sqr(nuFuel)*pow4(k) + + Q*sqr(U)*sqr(k) + - sigma*pow3(k)/rhoFuel ) - - - 4.0*nuFuel*k; + - 4.0*nuFuel*k; - if(derivativek > 0) + if (derivativek > 0) { derivativePos = derivativek; kPos = k; @@ -229,55 +214,42 @@ void LISA::atomizeParcel kNeg = k; } - if(mag(k-kOld)/k < 1e-4) + if (mag(k - kOld)/k < 1e-4) { break; } kOld = k; - } scalar omegaS = - - 2.0 * nuFuel * pow(k, 2.0) - + sqrt - ( - 4.0*pow(nuFuel, 2.0)*pow(k, 4.0) - + Q*pow(U, 2.0)*pow(k, 2.0) - - sigma*pow(k, 3.0)/rhoFuel - ); + - 2.0 * nuFuel * pow(k, 2.0) + + sqrt + ( + 4.0*sqr(nuFuel)*pow4(k) + + Q*sqr(U)*sqr(k) + - sigma*pow3(k)/rhoFuel + ); tau = cTau_/omegaS; dL = sqrt(8.0*p.d()/k); - } else { - - k = - rhoAverage*pow(U, 2.0) - / - 2.0*sigma; + k = rhoAverage*pow(U, 2.0)/2.0*sigma; scalar J = pWalk*p.d()/2.0; - tau = pow(3.0*cTau_,2.0/3.0)*cbrt(J*sigma/(sqr(Q)*pow(U,4.0)*rhoFuel)); + tau = pow(3.0*cTau_, 2.0/3.0)*cbrt(J*sigma/(sqr(Q)*pow4(U)*rhoFuel)); dL = sqrt(4.0*p.d()/k); } + scalar kL = 1.0/(dL*sqrt(0.5 + 1.5*muFuel/sqrt(rhoFuel*sigma*dL))); - scalar kL = - 1.0 - / - ( - dL * - pow(0.5 + 1.5 * muFuel/pow((rhoFuel*sigma*dL), 0.5), 0.5) - ); - - scalar dD = cbrt(3.0*mathematicalConstant::pi*pow(dL, 2.0)/kL); + scalar dD = cbrt(3.0*constant::math::pi*sqr(dL)/kL); scalar lisaExp = 0.27; scalar ambientPressure = 1.0e+5; @@ -286,7 +258,8 @@ void LISA::atomizeParcel dD = dD*pow(pRatio,lisaExp); -// modifications to take account of the flash boiling on primary breakUp + + // modifications to take account of the flash boiling on primary breakUp scalar pExp = 0.135; @@ -296,26 +269,30 @@ void LISA::atomizeParcel scalar Td = p.T(); - for(label i = 0; i < Nf ; i++) + for (label i = 0; i < Nf; i++) { - - if(fuels.properties()[i].pv(spray_.ambientPressure(), Td) >= 0.999*spray_.ambientPressure()) + if + ( + fuels.properties()[i].pv(spray_.ambientPressure(), Td) + >= 0.999*spray_.ambientPressure() + ) { - -// The fuel is boiling..... -// Calculation of the boiling temperature + // The fuel is boiling..... + // Calculation of the boiling temperature scalar tBoilingSurface = Td; label Niter = 200; - for(label k=0; k< Niter ; k++) + for (label k=0; k< Niter ; k++) { - scalar pBoil = fuels.properties()[i].pv(pressure, tBoilingSurface); + scalar pBoil = + fuels.properties()[i].pv(pressure, tBoilingSurface); - if(pBoil > pressure) + if (pBoil > pressure) { - tBoilingSurface = tBoilingSurface - (Td-temperature)/Niter; + tBoilingSurface = + tBoilingSurface - (Td - temperature)/Niter; } else { @@ -323,12 +300,32 @@ void LISA::atomizeParcel } } - scalar hl = fuels.properties()[i].hl(spray_.ambientPressure(), tBoilingSurface); - scalar iTp = fuels.properties()[i].h(spray_.ambientPressure(), Td) - spray_.ambientPressure()/fuels.properties()[i].rho(spray_.ambientPressure(), Td); - scalar iTb = fuels.properties()[i].h(spray_.ambientPressure(), tBoilingSurface) - spray_.ambientPressure()/fuels.properties()[i].rho(spray_.ambientPressure(), tBoilingSurface); - - chi += p.X()[i]*(iTp-iTb)/hl; - + scalar hl = + fuels.properties()[i].hl + ( + spray_.ambientPressure(), + tBoilingSurface + ); + + scalar iTp = + fuels.properties()[i].h(spray_.ambientPressure(), Td) + - spray_.ambientPressure() + /fuels.properties()[i].rho(spray_.ambientPressure(), Td); + + scalar iTb = + fuels.properties()[i].h + ( + spray_.ambientPressure(), + tBoilingSurface + ) + - spray_.ambientPressure() + /fuels.properties()[i].rho + ( + spray_.ambientPressure(), + tBoilingSurface + ); + + chi += p.X()[i]*(iTp - iTb)/hl; } } @@ -343,18 +340,17 @@ void LISA::atomizeParcel scalar lBU = Cl_ * mag(p.U())*tau; - if(pWalk > lBU) + if (pWalk > lBU) { - p.liquidCore() = 0.0; -// calculate the new diameter with a Rosin Rammler distribution + // calculate the new diameter with a Rosin Rammler distribution - scalar minValue = min(p.d(),dD/10.0); + scalar minValue = min(p.d(), dD/10.0); scalar maxValue = dD; - if(maxValue - minValue < SMALL) + if (maxValue - minValue < SMALL) { minValue = p.d()/10.0; } @@ -363,38 +359,25 @@ void LISA::atomizeParcel scalar y = 0; scalar x = 0; + scalar px = 0.0; + scalar nExp = 1; - bool success = false; - - while(!success) + do { - x = minValue + range*rndGen_.scalar01(); y = rndGen_.scalar01(); - scalar p = 0.0; - - scalar nExp = 1; - scalar xx = pow(x/dD, nExp); - p = xx*exp(-xx); - - if (y<p) - { - success = true; - } + px = xx*exp(-xx); - } + } while (y >= px); -// New droplet diameter + // New droplet diameter p.d() = x; p.ct() = 0.0; - } - - } diff --git a/src/lagrangian/dieselSpray/spraySubModels/atomizationModel/LISA/LISA.H b/src/lagrangian/dieselSpray/spraySubModels/atomizationModel/LISA/LISA.H index ecca578e05474ab6b4315e111c1a26f4a7a855c0..aa922b03f06880c1638edb0ca7f475f495e28321 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/atomizationModel/LISA/LISA.H +++ b/src/lagrangian/dieselSpray/spraySubModels/atomizationModel/LISA/LISA.H @@ -75,6 +75,7 @@ private: scalar Q_; scalar J_; + public: //- Runtime type information @@ -84,16 +85,11 @@ public: // Constructors //- Construct from components - LISA - ( - const dictionary& dict, - spray& sm - ); - + LISA(const dictionary& dict, spray& sm); - // Destructor - ~LISA(); + //- Destructor + virtual ~LISA(); // Member Operators @@ -105,8 +101,6 @@ public: const vector& vel, const liquidMixture& fuels ) const; - - }; diff --git a/src/lagrangian/dieselSpray/spraySubModels/atomizationModel/atomizationModel/atomizationModel.H b/src/lagrangian/dieselSpray/spraySubModels/atomizationModel/atomizationModel/atomizationModel.H index 4de2e223a6b27652fd86f3004bd58a7b3f01e2d0..829a138ac66783a50071b69146c1856dba493a5f 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/atomizationModel/atomizationModel/atomizationModel.H +++ b/src/lagrangian/dieselSpray/spraySubModels/atomizationModel/atomizationModel/atomizationModel.H @@ -44,7 +44,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class atomizationModel Declaration + Class atomizationModel Declaration \*---------------------------------------------------------------------------*/ class atomizationModel @@ -58,10 +58,11 @@ protected: spray& spray_; Random& rndGen_; + public: //- Runtime type information - TypeName("atomizationModel"); + TypeName("atomizationModel"); // Declare runtime constructor selection table @@ -81,16 +82,11 @@ public: // Constructors //- Construct from components - atomizationModel - ( - const dictionary& dict, - spray& sm - ); - + atomizationModel(const dictionary& dict, spray& sm); - // Destructor - virtual ~atomizationModel(); + //- Destructor + virtual ~atomizationModel(); // Selector @@ -111,7 +107,6 @@ public: const vector& vel, const liquidMixture& fuels ) const = 0; - }; diff --git a/src/lagrangian/dieselSpray/spraySubModels/atomizationModel/blobsSheetAtomization/blobsSheetAtomization.C b/src/lagrangian/dieselSpray/spraySubModels/atomizationModel/blobsSheetAtomization/blobsSheetAtomization.C index c6fd3e3056ac912b893ac4e2b46d5b265e69005e..371c44cb844673c658777b097756ff6c3adc768b 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/atomizationModel/blobsSheetAtomization/blobsSheetAtomization.C +++ b/src/lagrangian/dieselSpray/spraySubModels/atomizationModel/blobsSheetAtomization/blobsSheetAtomization.C @@ -24,12 +24,10 @@ License \*---------------------------------------------------------------------------*/ -#include "error.H" - #include "blobsSheetAtomization.H" #include "addToRunTimeSelectionTable.H" #include "basicMultiComponentMixture.H" - +#include "mathConstants.H" #include "RosinRammler.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -81,17 +79,15 @@ void blobsSheetAtomization::atomizeParcel const liquidMixture& fuels ) const { - const PtrList<volScalarField>& Y = spray_.composition().Y(); - label Ns = Y.size(); label cellI = p.cell(); scalar pressure = spray_.p()[cellI]; scalar temperature = spray_.T()[cellI]; scalar Taverage = p.T() + (temperature - p.T())/3.0; scalar Winv = 0.0; - for(label i=0; i<Ns; i++) + forAll(Y, i) { Winv += Y[i][cellI]/spray_.gasProperties()[i].W(); } @@ -101,9 +97,8 @@ void blobsSheetAtomization::atomizeParcel scalar rhoAverage = pressure/R/Taverage; scalar sigma = fuels.sigma(pressure, p.T(), p.X()); - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - // The We and Re numbers are to be evaluated using the 1/3 rule. - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + // The We and Re numbers are to be evaluated using the 1/3 rule. scalar rhoFuel = fuels.rho(1.0e+5, p.T(), p.X()); @@ -116,7 +111,7 @@ void blobsSheetAtomization::atomizeParcel label nHoles = it.nHoles(); if (nHoles > 1) { - for(label i=0; i<nHoles;i++) + for (label i=0; i<nHoles;i++) { itPosition += it.position(i); } @@ -129,15 +124,16 @@ void blobsSheetAtomization::atomizeParcel // const vector itPosition = it.position(); - scalar lBU = B_ * sqrt - ( - rhoFuel * sigma * p.d() * cos(angle_*mathematicalConstant::pi/360.0) - / sqr(rhoAverage*U) - ); + scalar lBU = + B_*sqrt + ( + rhoFuel*sigma*p.d()*cos(angle_*constant::math::pi/360.0) + /sqr(rhoAverage*U) + ); scalar pWalk = mag(p.position() - itPosition); - if(pWalk > lBU && p.liquidCore() == 1.0) + if (pWalk > lBU && p.liquidCore() == 1.0) { p.liquidCore() = 0.0; } diff --git a/src/lagrangian/dieselSpray/spraySubModels/atomizationModel/blobsSheetAtomization/blobsSheetAtomization.H b/src/lagrangian/dieselSpray/spraySubModels/atomizationModel/blobsSheetAtomization/blobsSheetAtomization.H index e0683df7ae19e5c77d456ca37dc363712822848a..b742300a521271599fdcd275caa127f1d7c69016 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/atomizationModel/blobsSheetAtomization/blobsSheetAtomization.H +++ b/src/lagrangian/dieselSpray/spraySubModels/atomizationModel/blobsSheetAtomization/blobsSheetAtomization.H @@ -54,7 +54,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class blobsSheetAtomization Declaration + Class blobsSheetAtomization Declaration \*---------------------------------------------------------------------------*/ class blobsSheetAtomization @@ -70,6 +70,7 @@ private: scalar angle_; Random& rndGen_; + public: //- Runtime type information @@ -79,16 +80,11 @@ public: // Constructors //- Construct from components - blobsSheetAtomization - ( - const dictionary& dict, - spray& sm - ); - + blobsSheetAtomization(const dictionary& dict, spray& sm); - // Destructor - ~blobsSheetAtomization(); + //- Destructor + virtual ~blobsSheetAtomization(); // Member Operators @@ -100,8 +96,6 @@ public: const vector& vel, const liquidMixture& fuels ) const; - - }; diff --git a/src/lagrangian/dieselSpray/spraySubModels/atomizationModel/noAtomization/noAtomization.H b/src/lagrangian/dieselSpray/spraySubModels/atomizationModel/noAtomization/noAtomization.H index 8e9e34273cd80326f2eea9e766a47bdba51f1bce..85ced600ddf0744636ae3e00b774d7d8ac86c7ed 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/atomizationModel/noAtomization/noAtomization.H +++ b/src/lagrangian/dieselSpray/spraySubModels/atomizationModel/noAtomization/noAtomization.H @@ -41,7 +41,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class noAtomization Declaration + Class noAtomization Declaration \*---------------------------------------------------------------------------*/ class noAtomization @@ -58,16 +58,11 @@ public: // Constructors //- Construct from components - noAtomization - ( - const dictionary& dict, - spray& sm - ); - + noAtomization(const dictionary& dict, spray& sm); - // Destructor - ~noAtomization(); + //- Destructor + virtual ~noAtomization(); // Member Operators @@ -79,8 +74,6 @@ public: const vector& vel, const liquidMixture& fuels ) const; - - }; diff --git a/src/lagrangian/dieselSpray/spraySubModels/breakupModel/ETAB/ETAB.C b/src/lagrangian/dieselSpray/spraySubModels/breakupModel/ETAB/ETAB.C index 03d7c5e82cafa07108b7f3b1e390d673bc678541..bbb079469beb2e8cd31371dee4cf65d8a03b1d6f 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/breakupModel/ETAB/ETAB.C +++ b/src/lagrangian/dieselSpray/spraySubModels/breakupModel/ETAB/ETAB.C @@ -26,7 +26,7 @@ License #include "ETAB.H" #include "addToRunTimeSelectionTable.H" -#include "mathematicalConstants.H" +#include "mathConstants.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -64,7 +64,7 @@ ETAB::ETAB AWe_(0.0) { scalar k21 = k2_/k1_; - AWe_ = (k21*sqrt(WeTransition_) - 1.0)/pow(WeTransition_, 4.0); + AWe_ = (k21*sqrt(WeTransition_) - 1.0)/pow4(WeTransition_); } @@ -85,15 +85,15 @@ void ETAB::breakupParcel ) const { - scalar T = p.T(); - scalar pc = spray_.p()[p.cell()]; - scalar r = 0.5*p.d(); + scalar T = p.T(); + scalar pc = spray_.p()[p.cell()]; + scalar r = 0.5*p.d(); scalar r2 = r*r; scalar r3 = r*r2; - scalar rho = fuels.rho(pc, T, p.X()); + scalar rho = fuels.rho(pc, T, p.X()); scalar sigma = fuels.sigma(pc, T, p.X()); - scalar mu = fuels.mu(pc, T, p.X()); + scalar mu = fuels.mu(pc, T, p.X()); // inverse of characteristic viscous damping time scalar rtd = 0.5*Cmu_*mu/(rho*r2); @@ -116,7 +116,7 @@ void ETAB::breakupParcel scalar a = sqrt(y1*y1 + y2*y2); // scotty we may have break-up - if (a+Wetmp > 1.0) + if (a + Wetmp > 1.0) { scalar phic = y1/a; @@ -128,7 +128,7 @@ void ETAB::breakupParcel scalar quad = -y2/a; if (quad < 0) { - phi = 2*mathematicalConstant::pi - phit; + phi = constant::math::twoPi - phit; } scalar tb = 0; @@ -139,11 +139,11 @@ void ETAB::breakupParcel if (theta < phi) { - if (2*mathematicalConstant::pi-theta >= phi) + if (constant::math::twoPi - theta >= phi) { theta = -theta; } - theta += 2*mathematicalConstant::pi; + theta += constant::math::twoPi; } tb = (theta-phi)*romega; @@ -158,17 +158,17 @@ void ETAB::breakupParcel // update droplet size if (deltaT > tb) { - scalar sqrtWe = AWe_*pow(We, 4.0) + 1.0; + scalar sqrtWe = AWe_*pow4(We) + 1.0; scalar Kbr = k1_*omega*sqrtWe; if (We > WeTransition_) { sqrtWe = sqrt(We); - Kbr =k2_*omega*sqrtWe; + Kbr = k2_*omega*sqrtWe; } scalar rWetmp = 1.0/Wetmp; - scalar cosdtbu = max(-1.0, min(1.0, 1.0-rWetmp)); + scalar cosdtbu = max(-1.0, min(1.0, 1.0 - rWetmp)); scalar dtbu = romega*acos(cosdtbu); scalar decay = exp(-Kbr*dtbu); @@ -190,6 +190,7 @@ void ETAB::breakupParcel } } + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/lagrangian/dieselSpray/spraySubModels/breakupModel/ETAB/ETAB.H b/src/lagrangian/dieselSpray/spraySubModels/breakupModel/ETAB/ETAB.H index 6998220c827915e589080326a4883e81f74ade46..f8a413b2410b58e10d4858bb4acba50fe36692be 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/breakupModel/ETAB/ETAB.H +++ b/src/lagrangian/dieselSpray/spraySubModels/breakupModel/ETAB/ETAB.H @@ -87,6 +87,7 @@ private: scalar WeTransition_; scalar AWe_; + public: @@ -97,16 +98,11 @@ public: // Constructors //- Construct from components - ETAB - ( - const dictionary& dict, - spray& sm - ); + ETAB(const dictionary& dict, spray& sm); - // Destructor - - ~ETAB(); + //- Destructor + virtual ~ETAB(); // Member Functions @@ -118,7 +114,6 @@ public: const vector& Ug, const liquidMixture& fuels ) const; - }; diff --git a/src/lagrangian/dieselSpray/spraySubModels/breakupModel/SHF/SHF.C b/src/lagrangian/dieselSpray/spraySubModels/breakupModel/SHF/SHF.C index 34e3e6c3be50be3aa30df1277f9ca36fbfd0f141..879a0e0c893d773c9a1db2681453a6f090e1bd10 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/breakupModel/SHF/SHF.C +++ b/src/lagrangian/dieselSpray/spraySubModels/breakupModel/SHF/SHF.C @@ -26,7 +26,7 @@ License #include "SHF.H" #include "addToRunTimeSelectionTable.H" -#include "mathematicalConstants.H" +#include "mathConstants.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -106,7 +106,6 @@ void SHF::breakupParcel const liquidMixture& fuels ) const { - label celli = p.cell(); scalar T = p.T(); scalar pc = spray_.p()[celli]; @@ -116,8 +115,8 @@ void SHF::breakupParcel scalar muLiquid = fuels.mu(pc, T, p.X()); scalar rhoGas = spray_.rho()[celli]; - scalar weGas = p.We(vel, rhoGas, sigma); - scalar weLiquid = p.We(vel, rhoLiquid, sigma); + scalar weGas = p.We(vel, rhoGas, sigma); + scalar weLiquid = p.We(vel, rhoLiquid, sigma); // correct the Reynolds number. Reitz is using radius instead of diameter @@ -129,33 +128,28 @@ void SHF::breakupParcel vector vRel = p.Urel(vel); - scalar weGasCorr = weGas/(1.0 + weCorrCoeff_ * ohnesorge); + scalar weGasCorr = weGas/(1.0 + weCorrCoeff_*ohnesorge); // droplet deformation characteristic time scalar tChar = p.d()/mag(vRel)*sqrt(rhoLiquid/rhoGas); - scalar tFirst = cInit_ * tChar; + scalar tFirst = cInit_*tChar; scalar tSecond = 0; scalar tCharSecond = 0; - bool bag = false; - bool multimode = false; - bool shear = false; - bool success = false; - // updating the droplet characteristic time p.ct() += deltaT; - if(weGas > weConst_) + if (weGas > weConst_) { - if(weGas < weCrit1_) + if (weGas < weCrit1_) { tCharSecond = c1_*pow((weGas - weConst_),cExp1_); } - else if(weGas >= weCrit1_ && weGas <= weCrit2_) + else if (weGas >= weCrit1_ && weGas <= weCrit2_) { tCharSecond = c2_*pow((weGas - weConst_),cExp2_); } @@ -165,89 +159,80 @@ void SHF::breakupParcel } } - scalar weC = weBuCrit_*(1.0+ohnCoeffCrit_*pow(ohnesorge,ohnExpCrit_)); + scalar weC = weBuCrit_*(1.0+ohnCoeffCrit_*pow(ohnesorge, ohnExpCrit_)); scalar weB = weBuBag_*(1.0+ohnCoeffBag_*pow(ohnesorge, ohnExpBag_)); scalar weMM = weBuMM_*(1.0+ohnCoeffMM_*pow(ohnesorge, ohnExpMM_)); - if(weGas > weC && weGas < weB) - { - bag = true; - } + bool bag = (weGas > weC && weGas < weB); - if(weGas >= weB && weGas <= weMM) - { - multimode = true; - } + bool multimode = (weGas >= weB && weGas <= weMM); - if(weGas > weMM) - { - shear = true; - } + bool shear = (weGas > weMM); - tSecond = tCharSecond * tChar; + tSecond = tCharSecond*tChar; scalar tBreakUP = tFirst + tSecond; - if(p.ct() > tBreakUP) + if (p.ct() > tBreakUP) { - scalar d32 = coeffD_*p.d()*pow(ohnesorge,onExpD_)*pow(weGasCorr,weExpD_); + scalar d32 = + coeffD_*p.d()*pow(ohnesorge, onExpD_)*pow(weGasCorr, weExpD_); - if(bag || multimode) + if (bag || multimode) { - scalar d05 = d32Coeff_ * d32; + scalar d05 = d32Coeff_*d32; scalar x = 0.0; scalar y = 0.0; scalar d = 0.0; + scalar px = 0.0; - while(!success) + do { x = cDmaxBM_*rndGen_.scalar01(); d = sqr(x)*d05; y = rndGen_.scalar01(); - scalar p = x/(2.0*sqrt(2.0*mathematicalConstant::pi)*sigma_)*exp(-0.5*sqr((x-mu_)/sigma_)); + px = + x + /(2.0*sqrt(constant::math::twoPi)*sigma_) + *exp(-0.5*sqr((x-mu_)/sigma_)); - if (y<p) - { - success = true; - } - } + } while (y >= px); p.d() = d; p.ct() = 0.0; } - if(shear) + if (shear) { scalar dC = weConst_*sigma/(rhoGas*sqr(mag(vRel))); - scalar d32Red = 4.0*(d32 * dC)/(5.0 * dC - d32); + scalar d32Red = 4.0*(d32*dC)/(5.0*dC - d32); scalar initMass = p.m(); - scalar d05 = d32Coeff_ * d32Red; + scalar d05 = d32Coeff_*d32Red; scalar x = 0.0; scalar y = 0.0; scalar d = 0.0; + scalar px = 0.0; - while(!success) + do { x = cDmaxS_*rndGen_.scalar01(); d = sqr(x)*d05; y = rndGen_.scalar01(); - scalar p = x/(2.0*sqrt(2.0*mathematicalConstant::pi)*sigma_)*exp(-0.5*sqr((x-mu_)/sigma_)); - - if (y<p) - { - success = true; - } - } + px = + x + /(2.0*sqrt(constant::math::twoPi)*sigma_) + *exp(-0.5*sqr((x-mu_)/sigma_)); + } while (y >= px); p.d() = dC; - p.m() = corePerc_ * initMass; + p.m() = corePerc_*initMass; spray_.addParticle ( @@ -259,7 +244,7 @@ void SHF::breakupParcel p.n(), d, p.T(), - (1.0 - corePerc_)* initMass, + (1.0 - corePerc_)*initMass, 0.0, 0.0, 0.0, diff --git a/src/lagrangian/dieselSpray/spraySubModels/breakupModel/SHF/SHF.H b/src/lagrangian/dieselSpray/spraySubModels/breakupModel/SHF/SHF.H index ec16af53e117348cadcbe3e990253bfe5aa16eb0..baae28f17b9fc6a7c424e8f031bd549f2928d34a 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/breakupModel/SHF/SHF.H +++ b/src/lagrangian/dieselSpray/spraySubModels/breakupModel/SHF/SHF.H @@ -112,6 +112,7 @@ private: scalar corePerc_; + public: //- Runtime type information @@ -121,16 +122,11 @@ public: // Constructors //- Construct from components - SHF - ( - const dictionary& dict, - spray& sm - ); + SHF(const dictionary& dict, spray& sm); - // Destructor - - ~SHF(); + //- Destructor + virtual ~SHF(); // Member Operators @@ -142,7 +138,6 @@ public: const vector& vel, const liquidMixture& fuels ) const; - }; diff --git a/src/lagrangian/dieselSpray/spraySubModels/breakupModel/TAB/TAB.C b/src/lagrangian/dieselSpray/spraySubModels/breakupModel/TAB/TAB.C index 0879b185bf0482ae2fa0485a7bddb9666a17d20e..e05b6d1bf1caa5d33d67fff1bef22d8da04522ad 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/breakupModel/TAB/TAB.C +++ b/src/lagrangian/dieselSpray/spraySubModels/breakupModel/TAB/TAB.C @@ -26,7 +26,7 @@ License #include "TAB.H" #include "addToRunTimeSelectionTable.H" -#include "mathematicalConstants.H" +#include "mathConstants.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -62,9 +62,10 @@ TAB::TAB // calculate the inverse function of the Rossin-Rammler Distribution const scalar xx0 = 12.0; - const scalar rrd100 = 1.0/(1.0-exp(-xx0)*(1+xx0+pow(xx0, 2)/2+pow(xx0, 3)/6)); + const scalar rrd100 = + 1.0/(1.0 - exp(-xx0)*(1 + xx0 + sqr(xx0)/2 + pow3(xx0)/6)); - for(label n=0; n<100; n++) + for (label n=0; n<100; n++) { scalar xx = 0.12*(n+1); rrd_[n] = (1-exp(-xx)*(1 + xx + pow(xx, 2)/2 + pow(xx, 3)/6))*rrd100; @@ -88,7 +89,6 @@ void TAB::breakupParcel const liquidMixture& fuels ) const { - scalar T = p.T(); scalar pc = spray_.p()[p.cell()]; scalar r = 0.5*p.d(); @@ -101,7 +101,7 @@ void TAB::breakupParcel // inverse of characteristic viscous damping time scalar rtd = 0.5*Cmu_*mu/(rho*r2); - + // oscillation frequency (squared) scalar omega2 = Comega_*sigma/(rho*r3) - rtd*rtd; @@ -118,7 +118,7 @@ void TAB::breakupParcel scalar a = sqrt(y1*y1 + y2*y2); // scotty we may have break-up - if (a+Wetmp > 1.0) + if (a + Wetmp > 1.0) { scalar phic = y1/a; @@ -130,34 +130,30 @@ void TAB::breakupParcel scalar quad = -y2/a; if (quad < 0) { - phi = 2*mathematicalConstant::pi - phit; + phi = constant::math::twoPi - phit; } - + scalar tb = 0; - + if (mag(p.dev()) < 1.0) { scalar coste = 1.0; - if - ( - (Wetmp - a < -1) - && (p.ddev() < 0) - ) + if ((Wetmp - a < -1) && (p.ddev() < 0)) { coste = -1.0; } - + scalar theta = acos((coste-Wetmp)/a); - + if (theta < phi) { - if (2*mathematicalConstant::pi-theta >= phi) + if (constant::math::twoPi - theta >= phi) { theta = -theta; } - theta += 2*mathematicalConstant::pi; + theta += constant::math::twoPi; } - tb = (theta-phi)/omega; + tb = (theta - phi)/omega; // breakup occurs if (deltaT > tb) @@ -171,19 +167,20 @@ void TAB::breakupParcel // update droplet size if (deltaT > tb) { - scalar rs = r/ - ( - 1 - + (4.0/3.0)*pow(p.dev(), 2) - + rho*r3/(8*sigma)*pow(p.ddev(), 2) - ); - + scalar rs = + r + /( + 1 + + (4.0/3.0)*sqr(p.dev()) + + rho*r3/(8*sigma)*sqr(p.ddev()) + ); + label n = 0; bool found = false; scalar random = rndGen_.scalar01(); while (!found && (n<99)) { - if (rrd_[n]>random) + if (rrd_[n] > random) { found = true; } @@ -197,11 +194,9 @@ void TAB::breakupParcel p.dev() = 0; p.ddev() = 0; } - } - } - + } else { @@ -209,9 +204,9 @@ void TAB::breakupParcel p.dev() = 0; p.ddev() = 0; } - } + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/lagrangian/dieselSpray/spraySubModels/breakupModel/TAB/TAB.H b/src/lagrangian/dieselSpray/spraySubModels/breakupModel/TAB/TAB.H index 62de02b80c05514bb362eab83d6fe6c08bf4e00b..fd75e3d435cc5fdea171c8b3e4e167316f7b7843 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/breakupModel/TAB/TAB.H +++ b/src/lagrangian/dieselSpray/spraySubModels/breakupModel/TAB/TAB.H @@ -73,9 +73,9 @@ private: dictionary coeffsDict_; - // inverse function approximation - // of the Rossin-Rammler Distribution - // used when calculating the droplet size after breakup + // inverse function approximation + // of the Rossin-Rammler Distribution + // used when calculating the droplet size after breakup scalar rrd_[100]; // model constants @@ -84,6 +84,7 @@ private: scalar Comega_; scalar WeCrit_; + public: @@ -94,16 +95,11 @@ public: // Constructors //- Construct from components - TAB - ( - const dictionary& dict, - spray& sm - ); + TAB(const dictionary& dict, spray& sm); - // Destructor - - ~TAB(); + //- Destructor + virtual ~TAB(); // Member Functions @@ -115,7 +111,6 @@ public: const vector& Ug, const liquidMixture& fuels ) const; - }; diff --git a/src/lagrangian/dieselSpray/spraySubModels/breakupModel/breakupModel/breakupModel.C b/src/lagrangian/dieselSpray/spraySubModels/breakupModel/breakupModel/breakupModel.C index cf992103ebf29946a1702a8fd1e2a6a3af3ba4ce..ddf2ca7fe1fcd6182e3cfb84ddfa258020791ef8 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/breakupModel/breakupModel/breakupModel.C +++ b/src/lagrangian/dieselSpray/spraySubModels/breakupModel/breakupModel/breakupModel.C @@ -74,6 +74,7 @@ breakupModel::breakupModel breakupModel::~breakupModel() {} + // * * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * // void breakupModel::updateParcelProperties @@ -84,27 +85,26 @@ void breakupModel::updateParcelProperties const liquidMixture& fuels ) const { - - if(includeOscillation_) + if (includeOscillation_) { - + scalar T = p.T(); scalar pc = spray_.p()[p.cell()]; scalar r = 0.5 * p.d(); scalar r2 = r*r; scalar r3 = r*r2; - + scalar rho = fuels.rho(pc, T, p.X()); scalar sigma = fuels.sigma(pc, T, p.X()); scalar mu = fuels.mu(pc, T, p.X()); - - // inverse of characteristic viscous damping time + + // inverse of characteristic viscous damping time scalar rtd = 0.5*TABCmu_*mu/(rho*r2); - + // oscillation frequency (squared) scalar omega2 = TABComega_ * sigma /(rho*r3) - rtd*rtd; - - if(omega2 > 0) + + if (omega2 > 0) { scalar omega = sqrt(omega2); @@ -114,20 +114,20 @@ void breakupModel::updateParcelProperties scalar y1 = p.dev() - Wetmp; scalar y2 = p.ddev()/omega; - + // update distortion parameters scalar c = cos(omega*deltaT); scalar s = sin(omega*deltaT); scalar e = exp(-rtd*deltaT); y2 = (p.ddev() + y1*rtd)/omega; - + p.dev() = Wetmp + e*(y1*c + y2*s); if (p.dev() < 0) { p.dev() = 0.0; p.ddev() = 0.0; } - else + else { p.ddev() = (Wetmp-p.dev())*rtd + e*omega*(y2*c - y1*s); } @@ -138,9 +138,7 @@ void breakupModel::updateParcelProperties p.dev() = 0; p.ddev() = 0; } - } - } diff --git a/src/lagrangian/dieselSpray/spraySubModels/breakupModel/breakupModel/breakupModel.H b/src/lagrangian/dieselSpray/spraySubModels/breakupModel/breakupModel/breakupModel.H index 4583fb5c2e3032f86f7b3e572eb81f3d7489558d..6e237cc8763797211a396174f4d8f79210f35e3b 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/breakupModel/breakupModel/breakupModel.H +++ b/src/lagrangian/dieselSpray/spraySubModels/breakupModel/breakupModel/breakupModel.H @@ -58,16 +58,16 @@ protected: spray& spray_; Random& rndGen_; - + Switch includeOscillation_; - + dictionary TABcoeffsDict_; scalar y0_; scalar yDot0_; scalar TABComega_; scalar TABCmu_; scalar TABWeCrit_; - + public: @@ -92,16 +92,11 @@ public: // Constructors //- Construct from components - breakupModel - ( - const dictionary& dict, - spray& sm - ); - + breakupModel(const dictionary& dict, spray& sm); - // Destructor - virtual ~breakupModel(); + //- Destructor + virtual ~breakupModel(); // Selector @@ -142,7 +137,6 @@ public: const vector& vel, const liquidMixture& fuels ) const = 0; - }; diff --git a/src/lagrangian/dieselSpray/spraySubModels/breakupModel/breakupModel/newBreakupModel.C b/src/lagrangian/dieselSpray/spraySubModels/breakupModel/breakupModel/newBreakupModel.C index d0889443eb48df400bdc4a2e810c89cccad36403..52b3c4ad5c4a2620f69d4266f3ca3995e38eb2c6 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/breakupModel/breakupModel/newBreakupModel.C +++ b/src/lagrangian/dieselSpray/spraySubModels/breakupModel/breakupModel/newBreakupModel.C @@ -43,26 +43,20 @@ autoPtr<breakupModel> breakupModel::New spray& sm ) { - word breakupModelType - ( - dict.lookup("breakupModel") - ); + word breakupModelType(dict.lookup("breakupModel")); - Info<< "Selecting breakupModel " - << breakupModelType << endl; + Info<< "Selecting breakupModel " << breakupModelType << endl; dictionaryConstructorTable::iterator cstrIter = dictionaryConstructorTablePtr_->find(breakupModelType); if (cstrIter == dictionaryConstructorTablePtr_->end()) { - FatalError - << "breakupModel::New(const dictionary&, const spray&) : " << endl - << " unknown breakupModelType type " - << breakupModelType - << ", constructor not in hash table" << endl << endl - << " Valid breakupModel types are :" << endl; - Info<< dictionaryConstructorTablePtr_->sortedToc() << abort(FatalError); + FatalErrorIn("breakupModel::New(const dictionary&, const spray&)") + << " unknown breakupModelType type " << breakupModelType + << ", constructor not in hash table" << nl << nl + << " Valid breakupModel types are :" << nl + << dictionaryConstructorTablePtr_->sortedToc() << abort(FatalError); } return autoPtr<breakupModel>(cstrIter()(dict, sm)); diff --git a/src/lagrangian/dieselSpray/spraySubModels/breakupModel/noBreakup/noBreakup.H b/src/lagrangian/dieselSpray/spraySubModels/breakupModel/noBreakup/noBreakup.H index 7edd78b732cc9a611fa768882186a5d7c63e4d1f..c6cc88aeabffec512e652aa1fe0a24ab6507cb1e 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/breakupModel/noBreakup/noBreakup.H +++ b/src/lagrangian/dieselSpray/spraySubModels/breakupModel/noBreakup/noBreakup.H @@ -31,7 +31,6 @@ Description SourceFiles noBreakupI.H noBreakup.C - noBreakupIO.C \*---------------------------------------------------------------------------*/ @@ -46,7 +45,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class noBreakup Declaration + Class noBreakup Declaration \*---------------------------------------------------------------------------*/ class noBreakup @@ -63,16 +62,11 @@ public: // Constructors //- Construct from components - noBreakup - ( - const dictionary& dict, - spray& sm - ); + noBreakup(const dictionary& dict, spray& sm); // Destructor - - ~noBreakup(); + virtual ~noBreakup(); // Member Functions @@ -84,7 +78,6 @@ public: const vector& vel, const liquidMixture& fuels ) const; - }; diff --git a/src/lagrangian/dieselSpray/spraySubModels/breakupModel/reitzDiwakar/reitzDiwakar.C b/src/lagrangian/dieselSpray/spraySubModels/breakupModel/reitzDiwakar/reitzDiwakar.C index bfe3c4045e1b11417b19f23940f3f7c928efdbdd..b91afc3d7042718632e53eac1f6910371150ca0b 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/breakupModel/reitzDiwakar/reitzDiwakar.C +++ b/src/lagrangian/dieselSpray/spraySubModels/breakupModel/reitzDiwakar/reitzDiwakar.C @@ -80,17 +80,8 @@ void reitzDiwakar::breakupParcel const liquidMixture& fuels ) const { - /* - These are the default values for this model... - static const scalar Cbag = 6.0; - static const scalar Cb = 0.785; - static const scalar Cstrip = 0.5; - static const scalar Cs = 10.0; - */ - const PtrList<volScalarField>& Y = spray_.composition().Y(); - label Ns = Y.size(); label cellI = p.cell(); scalar pressure = spray_.p()[cellI]; scalar temperature = spray_.T()[cellI]; @@ -98,7 +89,7 @@ void reitzDiwakar::breakupParcel scalar muAverage = 0.0; scalar Winv = 0.0; - for(label i=0; i<Ns; i++) + forAll(Y, i) { Winv += Y[i][cellI]/spray_.gasProperties()[i].W(); muAverage += Y[i][cellI]*spray_.gasProperties()[i].mu(Taverage); @@ -110,9 +101,8 @@ void reitzDiwakar::breakupParcel scalar nuAverage = muAverage/rhoAverage; scalar sigma = fuels.sigma(pressure, p.T(), p.X()); - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - // The We and Re numbers are to be evaluated using the 1/3 rule. - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + // The We and Re numbers are to be evaluated using the 1/3 rule. scalar WeberNumber = p.We(vel, rhoAverage, sigma); scalar ReynoldsNumber = p.Re(vel, nuAverage); @@ -124,21 +114,17 @@ void reitzDiwakar::breakupParcel if (WeberNumber > Cstrip_*sqRey) { scalar dStrip = - pow(2.0*Cstrip_*sigma, 2.0)/ - ( + sqr(2.0*Cstrip_*sigma) + /( rhoAverage - * pow(mag(p.Urel(vel)), 3.0) - * muAverage + *pow3(mag(p.Urel(vel))) + *muAverage ); scalar tauStrip = - Cs_ * p.d() - * sqrt - ( - fuels.rho(pressure, p.T(), p.X()) - / rhoAverage - ) - / mag(p.Urel(vel)); + Cs_*p.d() + *sqrt(fuels.rho(pressure, p.T(), p.X())/rhoAverage) + /mag(p.Urel(vel)); scalar fraction = deltaT/tauStrip; @@ -147,30 +133,17 @@ void reitzDiwakar::breakupParcel } else { - scalar dBag = - 2.0 * Cbag_ * sigma - / ( - rhoAverage - * pow(mag(p.Urel(vel)), 2.0) - ); + scalar dBag = 2.0*Cbag_*sigma/(rhoAverage*sqr(mag(p.Urel(vel)))); scalar tauBag = - Cb_ * p.d() - * sqrt - ( - fuels.rho(pressure, p.T(), p.X()) - * p.d() - / sigma - ); + Cb_*p.d()*sqrt(fuels.rho(pressure, p.T(), p.X())*p.d()/sigma); scalar fraction = deltaT/tauBag; // new droplet diameter, implicit calculation p.d() = (fraction*dBag + p.d())/(1.0 + fraction); } - } - } diff --git a/src/lagrangian/dieselSpray/spraySubModels/breakupModel/reitzDiwakar/reitzDiwakar.H b/src/lagrangian/dieselSpray/spraySubModels/breakupModel/reitzDiwakar/reitzDiwakar.H index 8fac656acdae021c32d28a96c12ad4ce877cb9bf..c007752023e5ccfef0a4b8d81f935b894a9e646c 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/breakupModel/reitzDiwakar/reitzDiwakar.H +++ b/src/lagrangian/dieselSpray/spraySubModels/breakupModel/reitzDiwakar/reitzDiwakar.H @@ -28,6 +28,12 @@ Class Description secondary breakup model for the spray + Default model coefficients: + Cbag = 6.0; + Cb = 0.785; + Cstrip = 0.5; + Cs = 10.0; + \*---------------------------------------------------------------------------*/ #ifndef reitzDiwakar_H @@ -41,7 +47,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class reitzDiwakar Declaration + Class reitzDiwakar Declaration \*---------------------------------------------------------------------------*/ class reitzDiwakar @@ -58,6 +64,7 @@ private: scalar Cstrip_; scalar Cs_; + public: //- Runtime type information @@ -67,16 +74,11 @@ public: // Constructors //- Construct from components - reitzDiwakar - ( - const dictionary& dict, - spray& sm - ); + reitzDiwakar(const dictionary& dict, spray& sm); - // Destructor - - ~reitzDiwakar(); + //- Destructor + virtual ~reitzDiwakar(); // Member Operators @@ -88,8 +90,6 @@ public: const vector& vel, const liquidMixture& fuels ) const; - - }; diff --git a/src/lagrangian/dieselSpray/spraySubModels/breakupModel/reitzKHRT/reitzKHRT.C b/src/lagrangian/dieselSpray/spraySubModels/breakupModel/reitzKHRT/reitzKHRT.C index 85de5e5e973485ae0ac4cffebf4f1bae0f551702..3443e3883ea42c81079faaf84b4d2dab872a97d4 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/breakupModel/reitzKHRT/reitzKHRT.C +++ b/src/lagrangian/dieselSpray/spraySubModels/breakupModel/reitzKHRT/reitzKHRT.C @@ -26,7 +26,7 @@ License #include "reitzKHRT.H" #include "addToRunTimeSelectionTable.H" -#include "mathematicalConstants.H" +#include "mathConstants.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -82,7 +82,6 @@ void reitzKHRT::breakupParcel const liquidMixture& fuels ) const { - label celli = p.cell(); scalar T = p.T(); scalar r = 0.5*p.d(); @@ -93,7 +92,7 @@ void reitzKHRT::breakupParcel scalar muLiquid = fuels.mu(pc, T, p.X()); scalar rhoGas = spray_.rho()[celli]; scalar Np = p.N(rhoLiquid); - scalar semiMass = Np*pow(p.d(), 3.0); + scalar semiMass = Np*pow3(p.d()); scalar weGas = p.We(vel, rhoGas, sigma); scalar weLiquid = p.We(vel, rhoLiquid, sigma); @@ -110,7 +109,7 @@ void reitzKHRT::breakupParcel scalar omegaKH = (0.34 + 0.38*pow(weGas, 1.5)) /((1 + ohnesorge)*(1 + 1.4*pow(taylor, 0.6))) - *sqrt(sigma/(rhoLiquid*pow(r, 3))); + *sqrt(sigma/(rhoLiquid*pow3(r))); // corresponding KH wave-length. scalar lambdaKH = @@ -138,7 +137,7 @@ void reitzKHRT::breakupParcel scalar KRT = sqrt(helpVariable/(3.0*sigma + VSMALL)); // wavelength of the fastest growing RT frequency - scalar lambdaRT = 2.0*mathematicalConstant::pi*cRT_/(KRT + VSMALL); + scalar lambdaRT = constant::math::twoPi*cRT_/(KRT + VSMALL); // if lambdaRT < diameter, then RT waves are growing on the surface // and we start to keep track of how long they have been growing @@ -165,14 +164,13 @@ void reitzKHRT::breakupParcel // no breakup below Weber = 12 if (weGas > weberLimit_) { - label injector = label(p.injector()); scalar fraction = deltaT/tauKH; // reduce the diameter according to the rate-equation p.d() = (fraction*dc + p.d())/(1.0 + fraction); - scalar ms = rhoLiquid*Np*pow3(dc)*mathematicalConstant::pi/6.0; + scalar ms = rhoLiquid*Np*pow3(dc)*constant::math::pi/6.0; p.ms() += ms; // Total number of parcels for the whole injection event @@ -195,10 +193,7 @@ void reitzKHRT::breakupParcel // mass of stripped child parcel scalar mc = p.ms(); // Prevent child parcel from taking too much mass - if (mc > 0.5*p.m()) - { - mc = 0.5*p.m(); - } + mc = min(mc, 0.5*p.m()); spray_.addParticle ( diff --git a/src/lagrangian/dieselSpray/spraySubModels/breakupModel/reitzKHRT/reitzKHRT.H b/src/lagrangian/dieselSpray/spraySubModels/breakupModel/reitzKHRT/reitzKHRT.H index 87e9fa2114fb3549944221d6f7e513705b08bfde..006fb69a9088b8fcf1c31b366a0febf8174da669 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/breakupModel/reitzKHRT/reitzKHRT.H +++ b/src/lagrangian/dieselSpray/spraySubModels/breakupModel/reitzKHRT/reitzKHRT.H @@ -68,6 +68,7 @@ private: scalar msLimit_; scalar weberLimit_; + public: //- Runtime type information @@ -77,16 +78,11 @@ public: // Constructors //- Construct from components - reitzKHRT - ( - const dictionary& dict, - spray& sm - ); + reitzKHRT(const dictionary& dict, spray& sm); - // Destructor - - ~reitzKHRT(); + //- Destructor + virtual ~reitzKHRT(); // Member Operators @@ -98,7 +94,6 @@ public: const vector& vel, const liquidMixture& fuels ) const; - }; diff --git a/src/lagrangian/dieselSpray/spraySubModels/collisionModel/ORourke/ORourkeCollisionModel.C b/src/lagrangian/dieselSpray/spraySubModels/collisionModel/ORourke/ORourkeCollisionModel.C index 092fdc87ac822c0f6befb31c451c494f3e5eb186..f1983375052067efd94ede19767754300da06b73 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/collisionModel/ORourke/ORourkeCollisionModel.C +++ b/src/lagrangian/dieselSpray/spraySubModels/collisionModel/ORourke/ORourkeCollisionModel.C @@ -24,10 +24,9 @@ License \*---------------------------------------------------------------------------*/ -#include "error.H" - #include "ORourkeCollisionModel.H" #include "addToRunTimeSelectionTable.H" +#include "mathConstants.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -73,7 +72,6 @@ ORourkeCollisionModel::~ORourkeCollisionModel() void ORourkeCollisionModel::collideParcels(const scalar dt) const { - if (spray_.size() < 2) { return; @@ -96,39 +94,37 @@ void ORourkeCollisionModel::collideParcels(const scalar dt) const // No collision if parcels are not in the same cell if (cell1 == cell2) { -# include "sameCell.H" - } // if - parcels in same cell + #include "sameCell.H" + } // remove coalesced droplet - if (p2().m() < VSMALL) + if (p2().m() < VSMALL) { spray::iterator tmpElmnt = p2; ++tmpElmnt; spray_.deleteParticle(p2()); p2 = tmpElmnt; } - else + else { ++p2; } - - } // inner loop + } // remove coalesced droplet - if (p1().m() < VSMALL) + if (p1().m() < VSMALL) { spray::iterator tmpElmnt = p1; ++tmpElmnt; spray_.deleteParticle(p1()); p1 = tmpElmnt; } - else + else { ++p1; } - } // outer loop - -} // end + } +} // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/lagrangian/dieselSpray/spraySubModels/collisionModel/ORourke/ORourkeCollisionModel.H b/src/lagrangian/dieselSpray/spraySubModels/collisionModel/ORourke/ORourkeCollisionModel.H index ef500220e9383c2e8c1fc4f2662ef41596fa47ba..2345569bbdf78056cf1e06fe7a3533676e48528d 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/collisionModel/ORourke/ORourkeCollisionModel.H +++ b/src/lagrangian/dieselSpray/spraySubModels/collisionModel/ORourke/ORourkeCollisionModel.H @@ -44,7 +44,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class ORourkeCollisionModel Declaration + Class ORourkeCollisionModel Declaration \*---------------------------------------------------------------------------*/ class ORourkeCollisionModel @@ -53,11 +53,15 @@ class ORourkeCollisionModel { private: - // Reference to the cell volumes - const scalarField& vols_; - dictionary coeffsDict_; - Switch coalescence_; + // Private data + + // Reference to the cell volumes + const scalarField& vols_; + + dictionary coeffsDict_; + Switch coalescence_; + public: @@ -75,9 +79,9 @@ public: Random& rndGen ); - // Destructor - ~ORourkeCollisionModel(); + //- Destructor + virtual ~ORourkeCollisionModel(); // Member Functions diff --git a/src/lagrangian/dieselSpray/spraySubModels/collisionModel/ORourke/sameCell.H b/src/lagrangian/dieselSpray/spraySubModels/collisionModel/ORourke/sameCell.H index a0153c1422848397a8a6034e1ef05f1ce5bf019b..67085739ecbbbe56f5bfc2808bd8b3df1526dc99 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/collisionModel/ORourke/sameCell.H +++ b/src/lagrangian/dieselSpray/spraySubModels/collisionModel/ORourke/sameCell.H @@ -31,7 +31,7 @@ scalar nMin = pMin().N(rhoMin); scalar mdMin = mMin/nMin; -scalar nu0 = 0.25*mathematicalConstant::pi*sumD*sumD*magVRel*dt/vols_[cell1]; +scalar nu0 = 0.25*constant::math::pi*sumD*sumD*magVRel*dt/vols_[cell1]; scalar nu = nMin*nu0; scalar collProb = exp(-nu); scalar xx = rndGen_.scalar01(); @@ -62,7 +62,7 @@ if (( xx > collProb) && (mMin > VSMALL) && (mMax > VSMALL)) { if ( prob < coalesceProb && coalescence_) { // How 'many' of the droplets coalesce - // NN. This is the kiva way ... which actually works best + // This is the kiva way ... which actually works best scalar zz = collProb; scalar vnu = nu*collProb; @@ -92,7 +92,7 @@ if (( xx > collProb) && (mMin > VSMALL) && (mMax > VSMALL)) { scalar d3 = pow(dMax, 3) + nProb*pow(dMin,3); pMax().d() = cbrt(d3); pMax().U() = (momMax + (1.0-newMinMass/mMin)*momMin)/newMaxMass; - + // update the liquid molar fractions scalarField Ymin = spray_.fuels().Y(pMin().X()); scalarField Ymax = spray_.fuels().Y(pMax().X()); diff --git a/src/lagrangian/dieselSpray/spraySubModels/collisionModel/collisionModel/collisionModel.H b/src/lagrangian/dieselSpray/spraySubModels/collisionModel/collisionModel/collisionModel.H index 4cbebbffc2ee21cf81f00de36c2ee5e3c034a6d8..1bb72dfab7cbfde10361444ff92a7bf6647a7a83 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/collisionModel/collisionModel/collisionModel.H +++ b/src/lagrangian/dieselSpray/spraySubModels/collisionModel/collisionModel/collisionModel.H @@ -94,9 +94,8 @@ public: ); - // Destructor - - virtual ~collisionModel(); + //- Destructor + virtual ~collisionModel(); // Selector diff --git a/src/lagrangian/dieselSpray/spraySubModels/collisionModel/noCollision/noCollision.H b/src/lagrangian/dieselSpray/spraySubModels/collisionModel/noCollision/noCollision.H index b0d1fc80dc7645dd7ec8327f1f2b7ed43d204991..b4fca726f1f3f7205b67c4ee5202a831ef4d606a 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/collisionModel/noCollision/noCollision.H +++ b/src/lagrangian/dieselSpray/spraySubModels/collisionModel/noCollision/noCollision.H @@ -42,7 +42,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class noCollision Declaration + Class noCollision Declaration \*---------------------------------------------------------------------------*/ class noCollision @@ -66,9 +66,8 @@ public: Random& rndGen ); - // Destructor - - ~noCollision(); + //- Destructor + virtual ~noCollision(); // Member Functions diff --git a/src/lagrangian/dieselSpray/spraySubModels/collisionModel/trajectoryModel/trajectoryCM.H b/src/lagrangian/dieselSpray/spraySubModels/collisionModel/trajectoryModel/trajectoryCM.H index a7cca2b7e36c99ceff987257c4c3eb1c4e8faccf..fdc520610252cdbd1f4401d7f61e3d21c820c939 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/collisionModel/trajectoryModel/trajectoryCM.H +++ b/src/lagrangian/dieselSpray/spraySubModels/collisionModel/trajectoryModel/trajectoryCM.H @@ -40,14 +40,14 @@ if (vAlign > 0) beta /= v2Mag*dt; // is collision possible within this timestep - if ((alpha>0) && (alpha<1.0) && (beta>0) && (beta<1.0)) + if ((alpha>0) && (alpha<1.0) && (beta>0) && (beta<1.0)) { vector p1c = p1().position() + alpha*v1*dt; vector p2c = p2().position() + beta*v2*dt; scalar closestDist = mag(p1c-p2c); - scalar collProb = + scalar collProb = pow(0.5*sumD/max(0.5*sumD, closestDist), cSpace_) *exp(-cTime_*mag(alpha-beta)); @@ -90,7 +90,7 @@ if (vAlign > 0) // use mass-averaged temperature to calculate We number scalar averageTemp = (pMax().T()*mMax + pMin().T()*mMin)/mTot; // and mass averaged mole fractions ... - scalarField + scalarField Xav((pMax().m()*pMax().X()+pMin().m()*pMin().X()) /(pMax().m() + pMin().m())); @@ -99,7 +99,7 @@ if (vAlign > 0) scalar rho = spray_.fuels().rho(pc, averageTemp, Xav); scalar dMean = sqrt(dMin*dMax); - scalar WeColl = + scalar WeColl = max(1.0e-12, 0.5*rho*magVRel*magVRel*dMean/sigma); // coalescence only possible when parcels are close enoug @@ -109,7 +109,7 @@ if (vAlign > 0) scalar prob = rndGen_.scalar01(); // Coalescence - if ( prob < coalesceProb && coalescence_) + if ( prob < coalesceProb && coalescence_) { // How 'many' of the droplets coalesce scalar nProb = prob*nMin/nMax; @@ -122,18 +122,18 @@ if (vAlign > 0) scalar newMaxMass = mMax + (mMin - newMinMass); pMax().m() = newMaxMass; - pMax().T() = + pMax().T() = (averageTemp*mTot - newMinMass*pMin().T())/newMaxMass; rhoMax = spray_.fuels().rho(pc, pMax().T(), pMax().X()); - pMax().d() = + pMax().d() = pow ( - 6.0*newMaxMass/(rhoMax*mathematicalConstant::pi*nMax), + 6.0*newMaxMass/(rhoMax*constant::math::pi*nMax), 1.0/3.0 ); - pMax().U() = + pMax().U() = (momMax + (1.0-newMinMass/mMin)*momMin)/newMaxMass; // update the liquid molar fractions @@ -147,7 +147,7 @@ if (vAlign > 0) } forAll(Ynew, i) { - pMax().X()[i] = + pMax().X()[i] = Ynew[i]/(spray_.fuels().properties()[i].W()*Wlinv); } diff --git a/src/lagrangian/dieselSpray/spraySubModels/collisionModel/trajectoryModel/trajectoryModel.C b/src/lagrangian/dieselSpray/spraySubModels/collisionModel/trajectoryModel/trajectoryModel.C index c3b80068afb7c9d4789fa42b070edef764b9bde4..bda1b361ccaac9e1ea0f828dbc87ab4d4de891ab 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/collisionModel/trajectoryModel/trajectoryModel.C +++ b/src/lagrangian/dieselSpray/spraySubModels/collisionModel/trajectoryModel/trajectoryModel.C @@ -26,6 +26,7 @@ License #include "trajectoryModel.H" #include "addToRunTimeSelectionTable.H" +#include "mathConstants.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -88,22 +89,21 @@ void trajectoryCollisionModel::collideParcels(const scalar dt) const while (p2 != p1) { -# include "trajectoryCM.H" + #include "trajectoryCM.H" // remove coalesced droplets - if (p2().m() < VSMALL) + if (p2().m() < VSMALL) { spray::iterator tmpElmnt = p2; ++tmpElmnt; spray_.deleteParticle(p2()); p2 = tmpElmnt; } - else + else { ++p2; } - - } // end - inner loop + } // remove coalesced droplets if (p1().m() < VSMALL) @@ -117,9 +117,8 @@ void trajectoryCollisionModel::collideParcels(const scalar dt) const { ++p1; } - } // end - outer loop - -} // end + } +} // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/lagrangian/dieselSpray/spraySubModels/collisionModel/trajectoryModel/trajectoryModel.H b/src/lagrangian/dieselSpray/spraySubModels/collisionModel/trajectoryModel/trajectoryModel.H index 1f75a5d511fc67aa300574812dd0aa6e811fe178..7c34ddab6bbe152ca4511c9e121103a568325270 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/collisionModel/trajectoryModel/trajectoryModel.H +++ b/src/lagrangian/dieselSpray/spraySubModels/collisionModel/trajectoryModel/trajectoryModel.H @@ -55,13 +55,17 @@ class trajectoryCollisionModel { private: - // Reference to the cell volumes + + // Private data + + // Reference to the cell volumes dictionary coeffsDict_; scalar cSpace_; scalar cTime_; Switch coalescence_; + public: //- Runtime type information @@ -78,9 +82,9 @@ public: Random& rndGen ); - // Destructor - ~trajectoryCollisionModel(); + //- Destructor + virtual ~trajectoryCollisionModel(); // Member Functions diff --git a/src/lagrangian/dieselSpray/spraySubModels/dispersionModel/dispersionLESModel/dispersionLESModel.H b/src/lagrangian/dieselSpray/spraySubModels/dispersionModel/dispersionLESModel/dispersionLESModel.H index 9f9e3f1125aa9177fcd14134730989929861afcd..d6dfd094436d47572090016806394fe485e0f75b 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/dispersionModel/dispersionLESModel/dispersionLESModel.H +++ b/src/lagrangian/dieselSpray/spraySubModels/dispersionModel/dispersionLESModel/dispersionLESModel.H @@ -42,7 +42,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class dispersionLESModel Declaration + Class dispersionLESModel Declaration \*---------------------------------------------------------------------------*/ class dispersionLESModel @@ -63,16 +63,11 @@ public: // Constructors //- Construct from components - dispersionLESModel - ( - const dictionary& dict, - spray& sm - ); + dispersionLESModel(const dictionary& dict, spray& sm); - // Destructor - - virtual ~dispersionLESModel(); + //- Destructor + virtual ~dispersionLESModel(); // Member Functions diff --git a/src/lagrangian/dieselSpray/spraySubModels/dispersionModel/dispersionModel/dispersionModel.H b/src/lagrangian/dieselSpray/spraySubModels/dispersionModel/dispersionModel/dispersionModel.H index 101d746a1707448cbafb4e87aeb7fbfdf056acbd..e0995c83ceeb22de47adf87d50f77fe0533fa0ad 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/dispersionModel/dispersionModel/dispersionModel.H +++ b/src/lagrangian/dieselSpray/spraySubModels/dispersionModel/dispersionModel/dispersionModel.H @@ -44,7 +44,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class dispersionModel Declaration + Class dispersionModel Declaration \*---------------------------------------------------------------------------*/ class dispersionModel @@ -82,16 +82,11 @@ public: // Constructors //- Construct from components - dispersionModel - ( - const dictionary& dict, - spray& sm - ); - + dispersionModel(const dictionary& dict, spray& sm); - // Destructor - virtual ~dispersionModel(); + //- Destructor + virtual ~dispersionModel(); // Selector diff --git a/src/lagrangian/dieselSpray/spraySubModels/dispersionModel/dispersionRASModel/dispersionRASModel.H b/src/lagrangian/dieselSpray/spraySubModels/dispersionModel/dispersionRASModel/dispersionRASModel.H index 195fc2f6091cf2adc6a1b93d5af592a8b3cf2fa0..b5e70acce5172535bcf1bc5a839611964e6d1532 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/dispersionModel/dispersionRASModel/dispersionRASModel.H +++ b/src/lagrangian/dieselSpray/spraySubModels/dispersionModel/dispersionRASModel/dispersionRASModel.H @@ -64,16 +64,11 @@ public: // Constructors //- Construct from components - dispersionRASModel - ( - const dictionary& dict, - spray& sm - ); + dispersionRASModel(const dictionary& dict, spray& sm); - // Destructor - - virtual ~dispersionRASModel(); + //- Destructor + virtual ~dispersionRASModel(); // Member Functions diff --git a/src/lagrangian/dieselSpray/spraySubModels/dispersionModel/gradientDispersionRAS/gradientDispersionRAS.H b/src/lagrangian/dieselSpray/spraySubModels/dispersionModel/gradientDispersionRAS/gradientDispersionRAS.H index 78b91f0e5c4f54c7a32468b532847a7e22d8beb0..992b24027d11c2418945b237c8a5e7f40e1cb785 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/dispersionModel/gradientDispersionRAS/gradientDispersionRAS.H +++ b/src/lagrangian/dieselSpray/spraySubModels/dispersionModel/gradientDispersionRAS/gradientDispersionRAS.H @@ -28,7 +28,7 @@ Class Description The velocity is perturbed in the direction of -grad(k), with a Gaussian random number distribution with variance sigma. - where sigma is defined below + where sigma is defined below \*---------------------------------------------------------------------------*/ @@ -43,7 +43,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class gradientDispersionRAS Declaration + Class gradientDispersionRAS Declaration \*---------------------------------------------------------------------------*/ class gradientDispersionRAS @@ -60,16 +60,11 @@ public: // Constructors //- Construct from components - gradientDispersionRAS - ( - const dictionary& dict, - spray& sm - ); + gradientDispersionRAS(const dictionary& dict, spray& sm); - // Destructor - - ~gradientDispersionRAS(); + //- Destructor + virtual ~gradientDispersionRAS(); // Member Functions diff --git a/src/lagrangian/dieselSpray/spraySubModels/dispersionModel/noDispersion/noDispersion.C b/src/lagrangian/dieselSpray/spraySubModels/dispersionModel/noDispersion/noDispersion.C index b76865bcf4d598efaa4c6759cbbc078bee9f6d40..e3be5bf441e7eee580f39599e3b7e1d363f3231f 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/dispersionModel/noDispersion/noDispersion.C +++ b/src/lagrangian/dieselSpray/spraySubModels/dispersionModel/noDispersion/noDispersion.C @@ -49,11 +49,7 @@ addToRunTimeSelectionTable // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // Construct from components -noDispersion::noDispersion -( - const dictionary& dict, - spray& sm -) +noDispersion::noDispersion(const dictionary& dict, spray& sm) : dispersionModel(dict, sm) {} diff --git a/src/lagrangian/dieselSpray/spraySubModels/dispersionModel/noDispersion/noDispersion.H b/src/lagrangian/dieselSpray/spraySubModels/dispersionModel/noDispersion/noDispersion.H index 3fda8fdd281a5bc18224756f9bc44618bbd34884..60f6e214118c2303ecf478aa703c71504ddac90f 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/dispersionModel/noDispersion/noDispersion.H +++ b/src/lagrangian/dieselSpray/spraySubModels/dispersionModel/noDispersion/noDispersion.H @@ -41,7 +41,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class noDispersion Declaration + Class noDispersion Declaration \*---------------------------------------------------------------------------*/ class noDispersion @@ -58,21 +58,16 @@ public: // Constructors //- Construct from components - noDispersion - ( - const dictionary& dict, - spray& sm - ); + noDispersion(const dictionary& dict, spray& sm); - // Destructor - - ~noDispersion(); + //- Destructor + virtual ~noDispersion(); // Member Functions - void disperseParcels() const; + void disperseParcels() const; }; diff --git a/src/lagrangian/dieselSpray/spraySubModels/dispersionModel/stochasticDispersionRAS/stochasticDispersionRAS.H b/src/lagrangian/dieselSpray/spraySubModels/dispersionModel/stochasticDispersionRAS/stochasticDispersionRAS.H index 9cf767d49db6c07dfe2a6c2640877f07d3a36d1a..b7cd003b940e4658ec667551faf4a59acc3fc6bf 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/dispersionModel/stochasticDispersionRAS/stochasticDispersionRAS.H +++ b/src/lagrangian/dieselSpray/spraySubModels/dispersionModel/stochasticDispersionRAS/stochasticDispersionRAS.H @@ -28,7 +28,7 @@ Class Description The velocity is perturbed in random direction, with a Gaussian random number distribution with variance sigma. - where sigma is defined below + where sigma is defined below \*---------------------------------------------------------------------------*/ @@ -43,7 +43,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class stochasticDispersionRAS Declaration + Class stochasticDispersionRAS Declaration \*---------------------------------------------------------------------------*/ class stochasticDispersionRAS @@ -60,21 +60,16 @@ public: // Constructors //- Construct from components - stochasticDispersionRAS - ( - const dictionary& dict, - spray& sm - ); + stochasticDispersionRAS(const dictionary& dict, spray& sm); - // Destructor - - ~stochasticDispersionRAS(); + //- Destructor + virtual ~stochasticDispersionRAS(); // Member Functions - void disperseParcels() const; + void disperseParcels() const; }; diff --git a/src/lagrangian/dieselSpray/spraySubModels/dragModel/dragModel/dragModel.C b/src/lagrangian/dieselSpray/spraySubModels/dragModel/dragModel/dragModel.C index 0ea4ce9bca408ccba63fa24df54b0818f162e392..6f8308d1f833975a3d2c9e15df05aa908f7155e4 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/dragModel/dragModel/dragModel.C +++ b/src/lagrangian/dieselSpray/spraySubModels/dragModel/dragModel/dragModel.C @@ -34,7 +34,6 @@ License namespace Foam { - // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // defineTypeNameAndDebug(dragModel, 0); @@ -44,19 +43,18 @@ defineRunTimeSelectionTable(dragModel, dictionary); // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // Construct from components -dragModel::dragModel -( - const dictionary& dict -) +dragModel::dragModel(const dictionary& dict) : dict_(dict) {} + // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // dragModel::~dragModel() {} + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/lagrangian/dieselSpray/spraySubModels/dragModel/dragModel/dragModel.H b/src/lagrangian/dieselSpray/spraySubModels/dragModel/dragModel/dragModel.H index 854ce84866fab03130ebf2c64331a71d28774fa3..e3cecba0bae22a9136916568bb225e168e9f14fb 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/dragModel/dragModel/dragModel.H +++ b/src/lagrangian/dieselSpray/spraySubModels/dragModel/dragModel/dragModel.H @@ -77,15 +77,11 @@ public: // Constructors //- Construct from components - dragModel - ( - const dictionary& dict - ); - + dragModel(const dictionary& dict); - // Destructor - virtual ~dragModel(); + //- Destructor + virtual ~dragModel(); // Selector diff --git a/src/lagrangian/dieselSpray/spraySubModels/dragModel/dragModel/newDragModel.C b/src/lagrangian/dieselSpray/spraySubModels/dragModel/dragModel/newDragModel.C index 6fed754f9541b9256c78d628aff5fd1ba858a0fa..d0ee9d6a29386fcf4065d08e9cf7dda1954be575 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/dragModel/dragModel/newDragModel.C +++ b/src/lagrangian/dieselSpray/spraySubModels/dragModel/dragModel/newDragModel.C @@ -36,15 +36,9 @@ namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -autoPtr<dragModel> dragModel::New -( - const dictionary& dict -) +autoPtr<dragModel> dragModel::New(const dictionary& dict) { - word dragModelType - ( - dict.lookup("dragModel") - ); + word dragModelType(dict.lookup("dragModel")); Info<< "Selecting dragModel " << dragModelType << endl; @@ -54,13 +48,12 @@ autoPtr<dragModel> dragModel::New if (cstrIter == dictionaryConstructorTablePtr_->end()) { - FatalError - << "dragModel::New(const dictionary&) : " << endl - << " unknown dragModelType type " - << dragModelType - << ", constructor not in hash table" << endl << endl - << " Valid dragModel types are :" << endl; - Info<< dictionaryConstructorTablePtr_->sortedToc() << abort(FatalError); + FatalErrorIn("dragModel::New(const dictionary&)") + << "Unknown dragModelType type " << dragModelType + << ", constructor not in hash table" << nl << nl + << " Valid dragModel types are:" << nl + << dictionaryConstructorTablePtr_->sortedToc() + << abort(FatalError); } return autoPtr<dragModel>(cstrIter()(dict)); diff --git a/src/lagrangian/dieselSpray/spraySubModels/dragModel/noDragModel/noDragModel.C b/src/lagrangian/dieselSpray/spraySubModels/dragModel/noDragModel/noDragModel.C index 0b3423b72d349f79ffb2afeb60e31d2c351619c6..ad5ea2510d4503b552b96f1f1ef46d97c0a3032f 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/dragModel/noDragModel/noDragModel.C +++ b/src/lagrangian/dieselSpray/spraySubModels/dragModel/noDragModel/noDragModel.C @@ -48,14 +48,12 @@ addToRunTimeSelectionTable // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // Construct from components -noDragModel::noDragModel -( - const dictionary& dict -) +noDragModel::noDragModel(const dictionary& dict) : dragModel(dict) {} + // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // noDragModel::~noDragModel() @@ -87,6 +85,7 @@ scalar noDragModel::relaxationTime return GREAT; } + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/lagrangian/dieselSpray/spraySubModels/dragModel/noDragModel/noDragModel.H b/src/lagrangian/dieselSpray/spraySubModels/dragModel/noDragModel/noDragModel.H index 1d8b83a3bbbdc90bfd9b3a3d9af6ade4c3ef4f97..6320ceb93b949c5f17ad27ce2c7b902f7496a802 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/dragModel/noDragModel/noDragModel.H +++ b/src/lagrangian/dieselSpray/spraySubModels/dragModel/noDragModel/noDragModel.H @@ -52,21 +52,17 @@ class noDragModel public: //- Runtime type information - TypeName("noDragModel"); + TypeName("noDragModel"); // Constructors //- Construct from components - noDragModel - ( - const dictionary& dict - ); - + noDragModel(const dictionary& dict); - // Destructor - ~noDragModel(); + //- Destructor + virtual ~noDragModel(); // Member Functions @@ -86,7 +82,6 @@ public: const scalar nu, const scalar deviation ) const; - }; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/lagrangian/dieselSpray/spraySubModels/dragModel/standardDragModel/standardDragModel.C b/src/lagrangian/dieselSpray/spraySubModels/dragModel/standardDragModel/standardDragModel.C index 097ed5f218e5cece4a59d7cc5d63f43c870fe275..597e7eaea10f5fff17201447f63d475fd17e7d31 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/dragModel/standardDragModel/standardDragModel.C +++ b/src/lagrangian/dieselSpray/spraySubModels/dragModel/standardDragModel/standardDragModel.C @@ -48,10 +48,7 @@ addToRunTimeSelectionTable // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // Construct from components -standardDragModel::standardDragModel -( - const dictionary& dict -) +standardDragModel::standardDragModel(const dictionary& dict) : dragModel(dict), dragDict_(dict.subDict(typeName + "Coeffs")), @@ -62,6 +59,7 @@ standardDragModel::standardDragModel Cdistort_(readScalar(dragDict_.lookup("Cdistort"))) {} + // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // standardDragModel::~standardDragModel() @@ -87,7 +85,6 @@ scalar standardDragModel::Cd drag *= (1.0 + Cdistort_*dev); return drag; - } @@ -101,16 +98,12 @@ scalar standardDragModel::relaxationTime const scalar dev ) const { - scalar time = GREAT; scalar Re = mag(URel)*diameter/nu; if (Re > 0.1) { - time = 4.0*liquidDensity*diameter / - ( - 3.0*rho*Cd(Re, dev)*mag(URel) - ); + time = 4.0*liquidDensity*diameter/(3.0*rho*Cd(Re, dev)*mag(URel)); } else { @@ -118,11 +111,14 @@ scalar standardDragModel::relaxationTime // the nominator and denominator // use Cd = 24/Re and remove the SMALL/SMALL // expression for the velocities - time = liquidDensity*diameter*diameter/(18*rho*nu*(1.0 + Cdistort_*dev)); + time = + liquidDensity*diameter*diameter/(18*rho*nu*(1.0 + Cdistort_*dev)); } + return time; } + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/lagrangian/dieselSpray/spraySubModels/dragModel/standardDragModel/standardDragModel.H b/src/lagrangian/dieselSpray/spraySubModels/dragModel/standardDragModel/standardDragModel.H index 1ec05623c77171933350aff60e97487165f7b519..1a21c142e9b8d840caba1844b6210b2c3ace8325 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/dragModel/standardDragModel/standardDragModel.H +++ b/src/lagrangian/dieselSpray/spraySubModels/dragModel/standardDragModel/standardDragModel.H @@ -60,24 +60,21 @@ private: scalar CdLimiter_; scalar Cdistort_; + public: //- Runtime type information - TypeName("standardDragModel"); + TypeName("standardDragModel"); // Constructors //- Construct from components - standardDragModel - ( - const dictionary& dict - ); + standardDragModel(const dictionary& dict); - // Destructor - - ~standardDragModel(); + //- Destructor + virtual ~standardDragModel(); // Member Functions @@ -97,7 +94,6 @@ public: const scalar nu, const scalar deviation ) const; - }; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/RutlandFlashBoil/RutlandFlashBoil.C b/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/RutlandFlashBoil/RutlandFlashBoil.C index 735eae0e56cfebabc3be35bd40a57cb59234a7d3..fbb7d3447252a7b8b901b8b43e6d6c5a8c44a60b 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/RutlandFlashBoil/RutlandFlashBoil.C +++ b/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/RutlandFlashBoil/RutlandFlashBoil.C @@ -28,7 +28,8 @@ License #include "RutlandFlashBoil.H" #include "addToRunTimeSelectionTable.H" -#include "mathematicalConstants.H" +#include "mathConstants.H" + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam @@ -49,10 +50,7 @@ addToRunTimeSelectionTable // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // Construct from dictionary -RutlandFlashBoil::RutlandFlashBoil -( - const dictionary& dict -) +RutlandFlashBoil::RutlandFlashBoil( const dictionary& dict) : evaporationModel(dict), evapDict_(dict.subDict(typeName + "Coeffs")), @@ -62,20 +60,19 @@ RutlandFlashBoil::RutlandFlashBoil evaporationScheme_(evapDict_.lookup("evaporationScheme")), nEvapIter_(0) { - if (evaporationScheme_ == "implicit") + if (evaporationScheme_ == "implicit") { nEvapIter_ = 2; } - else if (evaporationScheme_ == "explicit") + else if (evaporationScheme_ == "explicit") { nEvapIter_ = 1; } - else + else { FatalError << "evaporationScheme type " << evaporationScheme_ - << " unknown.\n" - << "Use implicit or explicit." + << " unknown. Use implicit or explicit." << nl << abort(FatalError); } } @@ -94,6 +91,7 @@ bool RutlandFlashBoil::evaporation() const return true; } + // Correlation for the Sherwood Number scalar RutlandFlashBoil::Sh ( @@ -101,9 +99,14 @@ scalar RutlandFlashBoil::Sh const scalar SchmidtNumber ) const { - return 2.0 + preReScFactor_*pow(ReynoldsNumber,ReExponent_)*pow(SchmidtNumber,ScExponent_); + return + 2.0 + + preReScFactor_ + *pow(ReynoldsNumber, ReExponent_) + *pow(SchmidtNumber,ScExponent_); } + scalar RutlandFlashBoil::relaxationTime ( const scalar diameter, @@ -132,7 +135,7 @@ scalar RutlandFlashBoil::relaxationTime and Xratio -> infinity (as it should) ... this is numerically nasty - NB! by N. Nordin + NB! X_v,s = (p_v,s/p) X_v,d where X_v,d = 1 for single component fuel according to eq (3.136) @@ -149,31 +152,29 @@ scalar RutlandFlashBoil::relaxationTime // From Equation (3.79) in C. Kralj's Thesis: // Note that the 2.0 (instead of 6.0) below is correct, since evaporation // is d(diameter)/dt and not d(mass)/dt - + scalar Sherwood = Sh(ReynoldsNumber, SchmidtNumber); - + scalar FbExp = 0.7; - - scalar logXratio = log(1.0+Xratio); + + scalar logXratio = log(1.0 + Xratio); scalar Fb = 1.0; - + if(logXratio > SMALL) { - Fb = pow((1.0 + Xratio),FbExp) * log(1.0+Xratio)/Xratio; + Fb = pow((1.0 + Xratio), FbExp)*log(1.0 + Xratio)/Xratio; } -// TL: proposed correction to sherwood number, implemented + // proposed correction to sherwood number, implemented Sherwood = 2.0 + (Sherwood - 2.0)/Fb; scalar denominator = - 6.0 * massDiffusionCoefficient - * Sherwood - * rhoFuelVapor * lgExpr; + 6.0*massDiffusionCoefficient*Sherwood*rhoFuelVapor*lgExpr; if (denominator > SMALL) { - time = max(VSMALL, liquidDensity * pow(diameter, 2.0)/denominator); + time = max(VSMALL, liquidDensity*sqr(diameter)/denominator); } return time; @@ -200,7 +201,6 @@ scalar RutlandFlashBoil::boilingTime const scalar kLiq ) const { - scalar time = GREAT; // the deltaTemperature is limited to not go below .5 deg K @@ -208,30 +208,31 @@ scalar RutlandFlashBoil::boilingTime // This is probably not important, since it results in an upper // limit for the boiling time... which we have anyway. - // TL kSet to the k value at the droplet temperature, not as in the Rutland Paper - - if(liquidCore > 0.5) + // k set to the k value at the droplet temperature, not as in the Rutland + // Paper + + if (liquidCore > 0.5) { - if(tDrop > tBoilingSurface) - { - // Evaporation of the liquid sheet - + if (tDrop > tBoilingSurface) + { + // Evaporation of the liquid sheet + scalar psi = 2.72; - scalar kIncreased = psi * kLiq; - scalar alfa = psi * kIncreased/(liquidDensity * cpFuel); - scalar F = alfa * ct/sqr(0.5 * diameter); - + scalar kIncreased = psi*kLiq; + scalar alfa = psi*kIncreased/(liquidDensity*cpFuel); + scalar F = alfa*ct/sqr(0.5*diameter); + scalar expSum = 0.0; scalar expSumOld = expSum; - + label Niter = 200; - - for(label k=0; k < Niter ; k++) + + for (label k=0; k < Niter; k++) { - expSum += exp(sqr(-k*mathematicalConstant::pi*sqrt(F)/2.0)); - if(mag(expSum-expSumOld)/expSum < 1.0e-3) + expSum += exp(sqr(-k*constant::math::pi*sqrt(F)/2.0)); + if (mag(expSum-expSumOld)/expSum < 1.0e-3) { - break; + break; } expSumOld = expSum; } @@ -242,99 +243,95 @@ scalar RutlandFlashBoil::boilingTime scalar dTLB = min(0.5, tDrop - tBoilingSurface); scalar alfaS = 0.0; - if(dTLB >= 0.0 && dTLB < 5.0) + if (dTLB >= 0.0 && dTLB < 5.0) { - alfaS = 0.76 * pow(dTLB, 0.26); - } - if(dTLB >= 5.0 && dTLB < 25.0) + alfaS = 0.76*pow(dTLB, 0.26); + } + if (dTLB >= 5.0 && dTLB < 25.0) { - alfaS = 0.027 * pow(dTLB, 2.33); + alfaS = 0.027*pow(dTLB, 2.33); } - if(dTLB >= 25.0) + if (dTLB >= 25.0) { - alfaS = 13.8 * pow(dTLB, 0.39); - } - - scalar Gf = - ( - 4.0 * alfaS * dTLB * mathematicalConstant::pi * sqr(diameter/2.0) - ) - / - heatOfVapour; - - // calculation of the heat transfer vapourization at superheated conditions (temperature>tBoilingSurface) + alfaS = 13.8*pow(dTLB, 0.39); + } + + scalar Gf = + 4.0*alfaS*dTLB*constant::math::pi*sqr(diameter/2.0)/heatOfVapour; + + // calculation of the heat transfer vapourization at superheated + // conditions (temperature>tBoilingSurface) scalar G = 0.0; - if(temperature > tBoilingSurface) + if (temperature > tBoilingSurface) { scalar NusseltCorr = Nusselt ; - scalar A = mag((vapourFarEnthalpy-vapourSurfaceEnthalpy)/heatOfVapour); + scalar A = + mag((vapourFarEnthalpy-vapourSurfaceEnthalpy)/heatOfVapour); - // TL : 2.0? or 1.0? try 1! - scalar B = 1.0*mathematicalConstant::pi*kappa/cpGas*diameter*NusseltCorr; - scalar nPos = B * log(1.0 + A)/Gf + 1.0; + // 2.0? or 1.0? try 1! + scalar B = 1.0*constant::math::pi*kappa/cpGas*diameter*NusseltCorr; + scalar nPos = B*log(1.0 + A)/Gf + 1.0; scalar nNeg = (1.0/A)*(exp(Gf/B) - 1.0 - A) + 1.0; - + scalar Gpos = Gf*nPos; scalar Gneg = Gf/nNeg; - - //scalar FgPos = Gpos + Gf - B * log( 1.0 + ( 1.0 + Gf/Gpos ) * A); - scalar FgNeg = Gneg + Gf - B * log( 1.0 + ( 1.0 + Gf/Gneg ) * A); - - if(FgNeg > 0.0) + + //scalar FgPos = Gpos + Gf - B * log( 1.0 + ( 1.0 + Gf/Gpos )*A); + scalar FgNeg = Gneg + Gf - B*log(1.0 + (1.0 + Gf/Gneg )*A); + + if (FgNeg > 0.0) { - for(label j = 0; j < 20; j++) + for (label j = 0; j < 20; j++) { Gneg = Gneg/10.0; Gneg = max(Gneg, VSMALL); - FgNeg = Gneg + Gf - B * log( 1.0 + ( 1.0 + Gf/Gneg ) * A); + FgNeg = Gneg + Gf - B*log(1.0 + (1.0 + Gf/Gneg)*A); if(FgNeg < 0.0) { break; - } + } } - } - - FgNeg = Gneg + Gf - B * log( 1.0 + ( 1.0 + Gf/Gneg ) * A); - - G = 0.5*(Gpos+Gneg); + } + + FgNeg = Gneg + Gf - B*log( 1.0 + ( 1.0 + Gf/Gneg)*A); + + G = 0.5*(Gpos + Gneg); scalar Gold = -100; - + label Niter = 200; label k=0; - - if(FgNeg > 0.0) + + if (FgNeg > 0.0) { - Info << "no convergence" << endl; + Info << "no convergence" << endl; } - - - if(FgNeg < 0.0) + + + if (FgNeg < 0.0) { - - for(k=0; k<Niter ; k++) + for (k=0; k<Niter; k++) { + scalar Fg = G + Gf - B*log( 1.0 + ( 1.0 + Gf/G )*A); - scalar Fg = G + Gf - B * log( 1.0 + ( 1.0 + Gf/G ) * A); - - if(Fg > 0) + if (Fg > 0) { Gpos = G; - G = 0.5*(Gpos+Gneg); + G = 0.5*(Gpos + Gneg); } else { Gneg = G; - G = 0.5*(Gpos+Gneg); - } - + G = 0.5*(Gpos + Gneg); + } + Gold = G; - if(mag(G-Gold)/Gold < 1.0e-3) + if (mag(G - Gold)/Gold < 1.0e-3) { break; } } - - if(k >= Niter - 1) + + if (k >= Niter - 1) { Info << " No convergence for G " << endl; } @@ -344,18 +341,22 @@ scalar RutlandFlashBoil::boilingTime G = 0.0; } } - - time = ((4.0/3.0)*mathematicalConstant::pi*pow(diameter/2.0,3.0))*liquidDensity/(G+Gf); + + time = (constant::math::pi*pow3(diameter)/6.0)*liquidDensity/(G + Gf); + time = max(VSMALL, time); } return time; } + inline label RutlandFlashBoil::nEvapIter() const { return nEvapIter_; } + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/RutlandFlashBoil/RutlandFlashBoil.H b/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/RutlandFlashBoil/RutlandFlashBoil.H index a94431494834748e94802e27141b7ff0fcbf0f60..c207ea0d25b4bf388b6bd5e28570875b25b2d9b2 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/RutlandFlashBoil/RutlandFlashBoil.H +++ b/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/RutlandFlashBoil/RutlandFlashBoil.H @@ -51,7 +51,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class RutlandFlashBoil Declaration + Class RutlandFlashBoil Declaration \*---------------------------------------------------------------------------*/ class RutlandFlashBoil @@ -75,21 +75,17 @@ private: public: //- Runtime type information - TypeName("RutlandFlashBoil"); + TypeName("RutlandFlashBoil"); // Constructors //- Construct from dictionary - RutlandFlashBoil - ( - const dictionary& dict - ); - + RutlandFlashBoil(const dictionary& dict); - // Destructor - ~RutlandFlashBoil(); + //- Destructor + virtual ~RutlandFlashBoil(); // Member Functions diff --git a/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/evaporationModel/evaporationModel.C b/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/evaporationModel/evaporationModel.C index 6848da22e4c677eeb57edfce7015bf8de5a66790..96d1d6dd88514087f0ae5a99bb4f0603dab3e88a 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/evaporationModel/evaporationModel.C +++ b/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/evaporationModel/evaporationModel.C @@ -41,10 +41,7 @@ defineRunTimeSelectionTable(evaporationModel, dictionary); // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // Construct from dictionary -evaporationModel::evaporationModel -( - const dictionary& dict -) +evaporationModel::evaporationModel(const dictionary& dict) : dict_(dict) {} @@ -54,6 +51,9 @@ evaporationModel::evaporationModel evaporationModel::~evaporationModel() {} + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + } // End namespace Foam // ************************************************************************* // diff --git a/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/evaporationModel/evaporationModel.H b/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/evaporationModel/evaporationModel.H index ec66a2e2ea4c1ed44e8b2011612e8f864e68a8d4..94d31d74aa13169254d2596be29ba107858ec6ad 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/evaporationModel/evaporationModel.H +++ b/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/evaporationModel/evaporationModel.H @@ -43,7 +43,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class evaporationModel Declaration + Class evaporationModel Declaration \*---------------------------------------------------------------------------*/ class evaporationModel @@ -54,10 +54,11 @@ protected: const dictionary& dict_; + public: //- Runtime type information - TypeName("evaporationModel"); + TypeName("evaporationModel"); //- Evaluate the gaseous properties Tand Y (implicit/explicit) //word gasPropertyEvaluation_; @@ -81,28 +82,21 @@ public: // Constructors //- Construct from components - evaporationModel - ( - const dictionary& dict - ); + evaporationModel(const dictionary& dict); - // Destructor - - virtual ~evaporationModel(); + //- Destructor + virtual ~evaporationModel(); // Selector - static autoPtr<evaporationModel> New - ( - const dictionary& dict - ); + static autoPtr<evaporationModel> New(const dictionary& dict); // Member Functions - //- evaporation on/off + //- evaporation on/off virtual bool evaporation() const = 0; //- The Sherwood number diff --git a/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/evaporationModel/newEvaporationModel.C b/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/evaporationModel/newEvaporationModel.C index 2d400a09d4fa3fe51a89a22a03e2bad98ef24fca..2fa4aefce9d05c19fa9aa94436eba2102541f9e7 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/evaporationModel/newEvaporationModel.C +++ b/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/evaporationModel/newEvaporationModel.C @@ -38,15 +38,9 @@ namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -autoPtr<evaporationModel> evaporationModel::New -( - const dictionary& dict -) +autoPtr<evaporationModel> evaporationModel::New(const dictionary& dict) { - word evaporationModelType - ( - dict.lookup("evaporationModel") - ); + word evaporationModelType(dict.lookup("evaporationModel")); Info<< "Selecting evaporationModel " << evaporationModelType << endl; @@ -56,13 +50,12 @@ autoPtr<evaporationModel> evaporationModel::New if (cstrIter == dictionaryConstructorTablePtr_->end()) { - FatalError - << "evaporationModel::New(const dictionary&) : " << endl - << " unknown evaporationModelType type " - << evaporationModelType - << ", constructor not in hash table" << endl << endl - << " Valid evaporationModel types are :" << endl; - Info<< dictionaryConstructorTablePtr_->sortedToc() << abort(FatalError); + FatalErrorIn("evaporationModel::New(const dictionary&)") + << "Unknown evaporationModelType type " << evaporationModelType + << ", constructor not in hash table" << nl << nl + << " Valid evaporationModel types are: " << nl + << dictionaryConstructorTablePtr_->sortedToc() + << abort(FatalError); } return autoPtr<evaporationModel>(cstrIter()(dict)); diff --git a/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/noEvaporation/noEvaporation.C b/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/noEvaporation/noEvaporation.C index c8c7052eba0a36a46b54abce137c63b79814872b..b92e1824e1a24d850045ca5b7c841a9bb506248e 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/noEvaporation/noEvaporation.C +++ b/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/noEvaporation/noEvaporation.C @@ -48,14 +48,12 @@ addToRunTimeSelectionTable // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // Construct from dictionary -noEvaporation::noEvaporation -( - const dictionary& dict -) +noEvaporation::noEvaporation( const dictionary& dict) : evaporationModel(dict) {} + // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // noEvaporation::~noEvaporation() @@ -69,6 +67,7 @@ bool noEvaporation::evaporation() const return false; } + scalar noEvaporation::Sh ( const scalar, @@ -78,6 +77,7 @@ scalar noEvaporation::Sh return 0.0; } + scalar noEvaporation::relaxationTime ( const scalar, @@ -120,11 +120,13 @@ scalar noEvaporation::boilingTime return GREAT; } + inline label noEvaporation::nEvapIter() const { return 0; } + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/noEvaporation/noEvaporation.H b/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/noEvaporation/noEvaporation.H index cedd0fd44d09fc229f5dc338d3e356c20716123a..6aaf8038db11642f88cd5e3458718e6bf5c8e9db 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/noEvaporation/noEvaporation.H +++ b/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/noEvaporation/noEvaporation.H @@ -42,7 +42,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class noEvaporation Declaration + Class noEvaporation Declaration \*---------------------------------------------------------------------------*/ class noEvaporation @@ -59,15 +59,11 @@ public: // Constructors //- Construct from dictionary - noEvaporation - ( - const dictionary& dict - ); - + noEvaporation(const dictionary& dict); - // Destructor - ~noEvaporation(); + //- Destructor + virtual ~noEvaporation(); // Member Functions diff --git a/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/saturateEvaporationModel/saturateEvaporationModel.C b/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/saturateEvaporationModel/saturateEvaporationModel.C index c56c727d209958cbe02fae4e4bd37e1a430d9c36..ac6e8af4e0b1d39fd0f8079f90b6421f9ff019f4 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/saturateEvaporationModel/saturateEvaporationModel.C +++ b/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/saturateEvaporationModel/saturateEvaporationModel.C @@ -71,6 +71,7 @@ bool saturateEvaporationModel::evaporation() const return true; } + // Correlation for the Sherwood Number scalar saturateEvaporationModel::Sh ( @@ -81,6 +82,7 @@ scalar saturateEvaporationModel::Sh return 0.0; } + scalar saturateEvaporationModel::relaxationTime ( const scalar diameter, @@ -96,7 +98,7 @@ scalar saturateEvaporationModel::relaxationTime const scalar dt ) const { - return max(SMALL,dt*(m0/dm - 1.0)); + return max(SMALL, dt*(m0/dm - 1.0)); } @@ -109,15 +111,15 @@ scalar saturateEvaporationModel::boilingTime const scalar Nusselt, const scalar deltaTemp, const scalar diameter, - const scalar, - const scalar, - const scalar, - const scalar, - const scalar, - const scalar, - const scalar, - const scalar, - const scalar + const scalar, + const scalar, + const scalar, + const scalar, + const scalar, + const scalar, + const scalar, + const scalar, + const scalar ) const { scalar time = GREAT; @@ -128,20 +130,24 @@ scalar saturateEvaporationModel::boilingTime // limit for the boiling time... which we have anyway. scalar deltaT = max(0.5, deltaTemp); - time = liquidDensity*cpFuel*sqr(diameter)/ - ( - 6.0 * kappa * Nusselt * log(1.0 + cpFuel * deltaT/max(SMALL, heatOfVapour)) - ); + time = + liquidDensity*cpFuel*sqr(diameter) + /( + 6.0*kappa*Nusselt*log(1.0 + cpFuel*deltaT/max(SMALL, heatOfVapour)) + ); time = max(VSMALL, time); return time; } + inline label saturateEvaporationModel::nEvapIter() const { return 1; } + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/saturateEvaporationModel/saturateEvaporationModel.H b/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/saturateEvaporationModel/saturateEvaporationModel.H index f1baa0b0e40f4e4a0042f6974256459b9e0b1109..8a9bf1e3755c140476b4bc3a820e0656f16aae87 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/saturateEvaporationModel/saturateEvaporationModel.H +++ b/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/saturateEvaporationModel/saturateEvaporationModel.H @@ -28,7 +28,7 @@ Class Description saturate evaporation model. Characteristic time is calculated to immediately saturate the cell - It should be mentioned that this is coupled with the (implicit) way + It should be mentioned that this is coupled with the (implicit) way evaporation is done in parcel, since the evaporation time depends on the integration step @@ -45,7 +45,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class saturateEvaporationModel Declaration + Class saturateEvaporationModel Declaration \*---------------------------------------------------------------------------*/ class saturateEvaporationModel @@ -59,24 +59,21 @@ private: dictionary evapDict_; + public: //- Runtime type information - TypeName("saturateEvaporationModel"); + TypeName("saturateEvaporationModel"); // Constructors //- Construct from dictionary - saturateEvaporationModel - ( - const dictionary& dict - ); - + saturateEvaporationModel(const dictionary& dict); - // Destructor - ~saturateEvaporationModel(); + //- Destructor + virtual ~saturateEvaporationModel(); // Member Functions @@ -115,15 +112,15 @@ public: const scalar Nusselt, const scalar deltaTemp, const scalar diameter, - const scalar, - const scalar, - const scalar, - const scalar, - const scalar, - const scalar, - const scalar, - const scalar, - const scalar + const scalar, + const scalar, + const scalar, + const scalar, + const scalar, + const scalar, + const scalar, + const scalar, + const scalar ) const; inline label nEvapIter() const; diff --git a/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/standardEvaporationModel/standardEvaporationModel.C b/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/standardEvaporationModel/standardEvaporationModel.C index c8e7baebb4b7207a3ffeb013433d33443485502f..de169440c0a42df2127f508b9ecfb30d55d5a77a 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/standardEvaporationModel/standardEvaporationModel.C +++ b/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/standardEvaporationModel/standardEvaporationModel.C @@ -62,20 +62,19 @@ standardEvaporationModel::standardEvaporationModel evaporationScheme_(evapDict_.lookup("evaporationScheme")), nEvapIter_(0) { - if (evaporationScheme_ == "implicit") + if (evaporationScheme_ == "implicit") { nEvapIter_ = 2; } - else if (evaporationScheme_ == "explicit") + else if (evaporationScheme_ == "explicit") { nEvapIter_ = 1; } - else + else { FatalError << "evaporationScheme type " << evaporationScheme_ - << " unknown.\n" - << "Use implicit or explicit." + << " unknown. Use implicit or explicit." << nl << abort(FatalError); } } @@ -94,6 +93,7 @@ bool standardEvaporationModel::evaporation() const return true; } + // Correlation for the Sherwood Number scalar standardEvaporationModel::Sh ( @@ -101,9 +101,14 @@ scalar standardEvaporationModel::Sh const scalar SchmidtNumber ) const { - return 2.0 + preReScFactor_*pow(ReynoldsNumber,ReExponent_)*pow(SchmidtNumber,ScExponent_); + return + 2.0 + + preReScFactor_ + *pow(ReynoldsNumber, ReExponent_) + *pow(SchmidtNumber, ScExponent_); } + scalar standardEvaporationModel::relaxationTime ( const scalar diameter, @@ -132,7 +137,7 @@ scalar standardEvaporationModel::relaxationTime and Xratio -> infinity (as it should) ... this is numerically nasty - NB! by N. Nordin + NB! X_v,s = (p_v,s/p) X_v,d where X_v,d = 1 for single component fuel according to eq (3.136) @@ -151,13 +156,13 @@ scalar standardEvaporationModel::relaxationTime // is d(diameter)/dt and not d(mass)/dt scalar denominator = - 6.0 * massDiffusionCoefficient - * Sh(ReynoldsNumber, SchmidtNumber) - * rhoFuelVapor * lgExpr; + 6.0*massDiffusionCoefficient + *Sh(ReynoldsNumber, SchmidtNumber) + *rhoFuelVapor*lgExpr; if (denominator > SMALL) { - time = max(VSMALL, liquidDensity * pow(diameter, 2.0)/denominator); + time = max(VSMALL, liquidDensity*sqr(diameter)/denominator); } return time; @@ -173,15 +178,15 @@ scalar standardEvaporationModel::boilingTime const scalar Nusselt, const scalar deltaTemp, const scalar diameter, - const scalar, - const scalar, - const scalar, - const scalar, - const scalar, - const scalar, - const scalar, - const scalar, - const scalar + const scalar, + const scalar, + const scalar, + const scalar, + const scalar, + const scalar, + const scalar, + const scalar, + const scalar ) const { scalar time = GREAT; @@ -192,20 +197,22 @@ scalar standardEvaporationModel::boilingTime // limit for the boiling time... which we have anyway. scalar deltaT = max(0.5, deltaTemp); - time = liquidDensity*cpFuel*sqr(diameter)/ - ( - 6.0 * kappa * Nusselt * log(1.0 + cpFuel * deltaT/max(SMALL, heatOfVapour)) - ); + time = + liquidDensity*cpFuel*sqr(diameter) + /(6.0*kappa*Nusselt*log(1.0 + cpFuel*deltaT/max(SMALL, heatOfVapour))); time = max(VSMALL, time); return time; } + inline label standardEvaporationModel::nEvapIter() const { return nEvapIter_; } + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/standardEvaporationModel/standardEvaporationModel.H b/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/standardEvaporationModel/standardEvaporationModel.H index 24405d9c35c05325c63fb73f22304dd430185bbb..4083a7336b3ad5708435585488002398b524eb6f 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/standardEvaporationModel/standardEvaporationModel.H +++ b/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/standardEvaporationModel/standardEvaporationModel.H @@ -42,7 +42,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class standardEvaporationModel Declaration + Class standardEvaporationModel Declaration \*---------------------------------------------------------------------------*/ class standardEvaporationModel @@ -58,7 +58,7 @@ private: scalar preReScFactor_; scalar ReExponent_; scalar ScExponent_; - + word evaporationScheme_; label nEvapIter_; @@ -66,21 +66,17 @@ private: public: //- Runtime type information - TypeName("standardEvaporationModel"); + TypeName("standardEvaporationModel"); // Constructors //- Construct from dictionary - standardEvaporationModel - ( - const dictionary& dict - ); - + standardEvaporationModel(const dictionary& dict); - // Destructor - ~standardEvaporationModel(); + //- Destructor + virtual ~standardEvaporationModel(); // Member Functions @@ -119,15 +115,15 @@ public: const scalar Nusselt, const scalar deltaTemp, const scalar diameter, - const scalar, - const scalar, - const scalar, - const scalar, - const scalar, - const scalar, - const scalar, - const scalar, - const scalar + const scalar, + const scalar, + const scalar, + const scalar, + const scalar, + const scalar, + const scalar, + const scalar, + const scalar ) const; inline label nEvapIter() const; diff --git a/src/lagrangian/dieselSpray/spraySubModels/heatTransferModel/RanzMarshall/RanzMarshall.C b/src/lagrangian/dieselSpray/spraySubModels/heatTransferModel/RanzMarshall/RanzMarshall.C index 615a76860bd99d283a629098edf6d4d40b01570a..5b69f9183ef6f7e117d0f2b1c971ddd9853aefcd 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/heatTransferModel/RanzMarshall/RanzMarshall.C +++ b/src/lagrangian/dieselSpray/spraySubModels/heatTransferModel/RanzMarshall/RanzMarshall.C @@ -48,10 +48,7 @@ addToRunTimeSelectionTable // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // Construct from components -RanzMarshall::RanzMarshall -( - const dictionary& dict -) +RanzMarshall::RanzMarshall(const dictionary& dict) : heatTransferModel(dict), heatDict_(dict.subDict(typeName + "Coeffs")), @@ -60,6 +57,7 @@ RanzMarshall::RanzMarshall PrExponent_(readScalar(heatDict_.lookup("PrExponent"))) {} + // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // RanzMarshall::~RanzMarshall() @@ -73,15 +71,21 @@ bool RanzMarshall::heatTransfer() const return true; } + scalar RanzMarshall::Nu ( const scalar ReynoldsNumber, const scalar PrandtlNumber ) const { - return 2.0 + preRePrFactor_ * pow(ReynoldsNumber, ReExponent_) * pow(PrandtlNumber, PrExponent_); + return + 2.0 + + preRePrFactor_ + *pow(ReynoldsNumber, ReExponent_) + *pow(PrandtlNumber, PrExponent_); } + scalar RanzMarshall::relaxationTime ( const scalar liquidDensity, @@ -92,13 +96,18 @@ scalar RanzMarshall::relaxationTime const scalar PrandtlNumber ) const { - scalar time = liquidDensity*pow(diameter, 2.0)*liquidcL/(6.0*kappa*Nu(ReynoldsNumber, PrandtlNumber)); + scalar time = + liquidDensity + *sqr(diameter) + *liquidcL + /(6.0*kappa*Nu(ReynoldsNumber, PrandtlNumber)); time = max(SMALL, time); return time; } + scalar RanzMarshall::fCorrection(const scalar z) const { scalar correct; @@ -112,7 +121,6 @@ scalar RanzMarshall::fCorrection(const scalar z) const { correct = SMALL; } - } else { @@ -123,6 +131,7 @@ scalar RanzMarshall::fCorrection(const scalar z) const return correct; } + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/lagrangian/dieselSpray/spraySubModels/heatTransferModel/RanzMarshall/RanzMarshall.H b/src/lagrangian/dieselSpray/spraySubModels/heatTransferModel/RanzMarshall/RanzMarshall.H index 7441c9cfb105f00803e02de3c1da269f67dee037..d3e5f3f8396cff69613eae1125eba67b0600a083 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/heatTransferModel/RanzMarshall/RanzMarshall.H +++ b/src/lagrangian/dieselSpray/spraySubModels/heatTransferModel/RanzMarshall/RanzMarshall.H @@ -40,7 +40,7 @@ Description namespace Foam { /*---------------------------------------------------------------------------*\ - Class RanzMarshall Declaration + Class RanzMarshall Declaration \*---------------------------------------------------------------------------*/ class RanzMarshall @@ -56,6 +56,7 @@ private: scalar ReExponent_; scalar PrExponent_; + public: //- Runtime type information @@ -65,15 +66,11 @@ public: // Constructors //- Construct from dictionary - RanzMarshall - ( - const dictionary& dict - ); + RanzMarshall(const dictionary& dict); - // Destructor - - ~RanzMarshall(); + //- Destructor + virtual ~RanzMarshall(); // Member Functions @@ -98,7 +95,6 @@ public: ) const; scalar fCorrection(const scalar z) const; - }; diff --git a/src/lagrangian/dieselSpray/spraySubModels/heatTransferModel/heatTransferModel/heatTransferModel.C b/src/lagrangian/dieselSpray/spraySubModels/heatTransferModel/heatTransferModel/heatTransferModel.C index acf2bf13bd12e4a149230695d725bc1b09d333ec..0bc9c4604f28da01f41d00d51c7bd277f2a6d98f 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/heatTransferModel/heatTransferModel/heatTransferModel.C +++ b/src/lagrangian/dieselSpray/spraySubModels/heatTransferModel/heatTransferModel/heatTransferModel.C @@ -24,8 +24,6 @@ License \*---------------------------------------------------------------------------*/ -#include "error.H" - #include "heatTransferModel.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -42,17 +40,16 @@ defineRunTimeSelectionTable(heatTransferModel, dictionary); // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // Construct from dictionary -heatTransferModel::heatTransferModel -( - const dictionary& dict -) +heatTransferModel::heatTransferModel(const dictionary& dict) : dict_(dict) {} + heatTransferModel::~heatTransferModel() {} + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/lagrangian/dieselSpray/spraySubModels/heatTransferModel/heatTransferModel/heatTransferModel.H b/src/lagrangian/dieselSpray/spraySubModels/heatTransferModel/heatTransferModel/heatTransferModel.H index e2e7060a8c6f29c47f27f467231aad637cd56e49..0612bb6c558ed57a03f9ec2492894dd630c464e5 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/heatTransferModel/heatTransferModel/heatTransferModel.H +++ b/src/lagrangian/dieselSpray/spraySubModels/heatTransferModel/heatTransferModel/heatTransferModel.H @@ -43,23 +43,23 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class heatTransferModel Declaration + Class heatTransferModel Declaration \*---------------------------------------------------------------------------*/ class heatTransferModel - { protected: // Protected data - const dictionary& dict_; + const dictionary& dict_; + public: //- Runtime type information - TypeName("heatTransferModel"); + TypeName("heatTransferModel"); // Declare runtime constructor selection table @@ -79,15 +79,11 @@ public: // Constructors //- Construct from dictionary - heatTransferModel - ( - const dictionary& dict - ); - + heatTransferModel(const dictionary& dict); - // Destructor - virtual ~heatTransferModel(); + //- Destructor + virtual ~heatTransferModel(); // Selector @@ -123,7 +119,6 @@ public: //- Return the correction function f... virtual scalar fCorrection(const scalar z) const = 0; - }; diff --git a/src/lagrangian/dieselSpray/spraySubModels/heatTransferModel/heatTransferModel/newHeatTransferModel.C b/src/lagrangian/dieselSpray/spraySubModels/heatTransferModel/heatTransferModel/newHeatTransferModel.C index 308fbfa697f4290d18e1db7c29f3626e5ef7fde1..6aac6a09a8edb0ad7ed74716939e6567d730d258 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/heatTransferModel/heatTransferModel/newHeatTransferModel.C +++ b/src/lagrangian/dieselSpray/spraySubModels/heatTransferModel/heatTransferModel/newHeatTransferModel.C @@ -41,26 +41,22 @@ autoPtr<heatTransferModel> heatTransferModel::New const dictionary& dict ) { - word heatTransferModelType - ( - dict.lookup("heatTransferModel") - ); + word heatTransferModelType(dict.lookup("heatTransferModel")); - Info<< "Selecting heatTransferModel " - << heatTransferModelType << endl; + Info<< "Selecting heatTransferModel " << heatTransferModelType << endl; dictionaryConstructorTable::iterator cstrIter = dictionaryConstructorTablePtr_->find(heatTransferModelType); if (cstrIter == dictionaryConstructorTablePtr_->end()) { - FatalError - << "heatTransferModel::New(const dictionary&) : " << endl - << " unknown heatTransferModelType type " + FatalErrorIn("heatTransferModel::New(const dictionary&)") + << "Unknown heatTransferModelType type " << heatTransferModelType - << ", constructor not in hash table" << endl << endl - << " Valid heatTransferModel types are :" << endl; - Info<< dictionaryConstructorTablePtr_->sortedToc() << abort(FatalError); + << ", constructor not in hash table" << nl << nl + << " Valid heatTransferModel types are:" << nl + << dictionaryConstructorTablePtr_->sortedToc() + << abort(FatalError); } return autoPtr<heatTransferModel>(cstrIter()(dict)); diff --git a/src/lagrangian/dieselSpray/spraySubModels/heatTransferModel/noHeatTransfer/noHeatTransfer.C b/src/lagrangian/dieselSpray/spraySubModels/heatTransferModel/noHeatTransfer/noHeatTransfer.C index 498f984f489b5f06cb47d2a5d68da3636f549c44..6779a70445a87eaff71ed439647d682c55aba16e 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/heatTransferModel/noHeatTransfer/noHeatTransfer.C +++ b/src/lagrangian/dieselSpray/spraySubModels/heatTransferModel/noHeatTransfer/noHeatTransfer.C @@ -24,8 +24,6 @@ License \*---------------------------------------------------------------------------*/ -#include "error.H" - #include "noHeatTransfer.H" #include "addToRunTimeSelectionTable.H" @@ -45,17 +43,16 @@ addToRunTimeSelectionTable dictionary ); + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // Construct from components -noHeatTransfer::noHeatTransfer -( - const dictionary& dict -) +noHeatTransfer::noHeatTransfer(const dictionary& dict) : heatTransferModel(dict) {} + // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // noHeatTransfer::~noHeatTransfer() @@ -69,15 +66,13 @@ bool noHeatTransfer::heatTransfer() const return false; } -scalar noHeatTransfer::Nu -( - const scalar, - const scalar -) const + +scalar noHeatTransfer::Nu(const scalar, const scalar) const { return 0.0; } + scalar noHeatTransfer::relaxationTime ( const scalar, @@ -91,11 +86,13 @@ scalar noHeatTransfer::relaxationTime return GREAT; } + scalar noHeatTransfer::fCorrection(const scalar) const { return 1.0; } + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/lagrangian/dieselSpray/spraySubModels/heatTransferModel/noHeatTransfer/noHeatTransfer.H b/src/lagrangian/dieselSpray/spraySubModels/heatTransferModel/noHeatTransfer/noHeatTransfer.H index 1f468e7414c064a1bb800e874d92ae2109e36417..694dd1d02b2ab639e0583212f8bed5581fab135f 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/heatTransferModel/noHeatTransfer/noHeatTransfer.H +++ b/src/lagrangian/dieselSpray/spraySubModels/heatTransferModel/noHeatTransfer/noHeatTransfer.H @@ -42,7 +42,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class noHeatTransfer Declaration + Class noHeatTransfer Declaration \*---------------------------------------------------------------------------*/ class noHeatTransfer @@ -53,21 +53,17 @@ class noHeatTransfer public: //- Runtime type information - TypeName("off"); + TypeName("off"); // Constructors //- Construct from dictionary - noHeatTransfer - ( - const dictionary& dict - ); - + noHeatTransfer(const dictionary& dict); - // Destructor - ~noHeatTransfer(); + //- Destructor + virtual ~noHeatTransfer(); // Member Functions @@ -92,7 +88,6 @@ public: ) const; scalar fCorrection(const scalar z) const; - }; diff --git a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/Chomiak/Chomiak.C b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/Chomiak/Chomiak.C index 0fac3a1836888433a3263b92f5e87af5a80c25da..faedf5d5f92d570626cd3492372ad0d8bba6bea9 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/Chomiak/Chomiak.C +++ b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/Chomiak/Chomiak.C @@ -26,7 +26,7 @@ License #include "Chomiak.H" #include "addToRunTimeSelectionTable.H" -#include "mathematicalConstants.H" +#include "mathConstants.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -96,7 +96,7 @@ ChomiakInjector::~ChomiakInjector() scalar ChomiakInjector::d0 ( - const label, + const label, const scalar ) const { @@ -115,47 +115,53 @@ vector ChomiakInjector::direction scalar dMin = dropletPDF_->minValue(); scalar dMax = dropletPDF_->maxValue(); - scalar angle = (d-dMax)*maxSprayAngle_[n]/(dMin-dMax)*mathematicalConstant::pi/360.0; + scalar angle = + (d - dMax)*maxSprayAngle_[n] + /(dMin - dMax) + *constant::math::pi/360.0; scalar alpha = sin(angle); scalar dcorr = cos(angle); - scalar beta = 2.0*mathematicalConstant::pi*rndGen_.scalar01(); + scalar beta = constant::math::twoPi*rndGen_.scalar01(); // randomly distributed vector normal to the injection vector vector normal = vector::zero; - + if (sm_.twoD()) { scalar reduce = 0.01; // correct beta if this is a 2D run // map it onto the 'angleOfWedge' - beta *= (1.0-2.0*reduce)*0.5*sm_.angleOfWedge()/mathematicalConstant::pi; + beta *= (1.0-2.0*reduce)*0.5*sm_.angleOfWedge()/constant::math::pi; beta += reduce*sm_.angleOfWedge(); - normal = alpha* - ( - sm_.axisOfWedge()*cos(beta) + - sm_.axisOfWedgeNormal()*sin(beta) - ); + normal = + alpha + *( + sm_.axisOfWedge()*cos(beta) + + sm_.axisOfWedgeNormal()*sin(beta) + ); } else { - normal = alpha* - ( - injectors_[n].properties()->tan1(hole)*cos(beta) + - injectors_[n].properties()->tan2(hole)*sin(beta) - ); + normal = + alpha + *( + injectors_[n].properties()->tan1(hole)*cos(beta) + + injectors_[n].properties()->tan2(hole)*sin(beta) + ); } - + // set the direction of injection by adding the normal vector - vector dir = dcorr*injectors_[n].properties()->direction(hole, time) + normal; + vector dir = + dcorr*injectors_[n].properties()->direction(hole, time) + normal; dir /= mag(dir); return dir; - } + scalar ChomiakInjector::velocity ( const label i, @@ -177,16 +183,17 @@ scalar ChomiakInjector::velocity } } -scalar ChomiakInjector::averageVelocity -( - const label i -) const -{ + +scalar ChomiakInjector::averageVelocity(const label i) const +{ const injectorType& it = sm_.injectors()[i].properties(); scalar dt = it.teoi() - it.tsoi(); return it.integrateTable(it.velocityProfile())/dt; } + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + } // End namespace Foam // ************************************************************************* // diff --git a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/Chomiak/Chomiak.H b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/Chomiak/Chomiak.H index 2a62b9e668e861dd85311cb3a17bf463f2638fe9..50de0a31dcdeeafbcc51e898edc403993291ab39 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/Chomiak/Chomiak.H +++ b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/Chomiak/Chomiak.H @@ -50,7 +50,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class ChomiakInjector Declaration + Class ChomiakInjector Declaration \*---------------------------------------------------------------------------*/ class ChomiakInjector @@ -67,25 +67,21 @@ private: autoPtr<pdf> dropletPDF_; scalarList maxSprayAngle_; + public: //- Runtime type information - TypeName("ChomiakInjector"); + TypeName("ChomiakInjector"); // Constructors //- Construct from components - ChomiakInjector - ( - const dictionary& dict, - spray& sm - ); - + ChomiakInjector(const dictionary& dict, spray& sm); - // Destructor - ~ChomiakInjector(); + //- Destructor + virtual ~ChomiakInjector(); // Member Functions @@ -97,17 +93,17 @@ public: vector direction ( const label injector, - const label hole, + const label hole, const scalar time, const scalar d ) const; - + scalar velocity ( const label i, const scalar time ) const; - + scalar averageVelocity ( const label i diff --git a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/blobsSwirl/blobsSwirlInjector.C b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/blobsSwirl/blobsSwirlInjector.C index 7bf6571e178d941f6a875500c86563303ccb9158..80601db2d1cd73faa039551d7df004593c3c5f18 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/blobsSwirl/blobsSwirlInjector.C +++ b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/blobsSwirl/blobsSwirlInjector.C @@ -26,7 +26,7 @@ License #include "blobsSwirlInjector.H" #include "addToRunTimeSelectionTable.H" -#include "mathematicalConstants.H" +#include "mathConstants.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -63,7 +63,7 @@ blobsSwirlInjector::blobsSwirlInjector cD_(blobsSwirlInjectorDict_.lookup("cD")), cTau_(blobsSwirlInjectorDict_.lookup("cTau")), A_(blobsSwirlInjectorDict_.lookup("A")), - + angle_(0.0), u_(0.0), x_(0.0), @@ -83,9 +83,12 @@ blobsSwirlInjector::blobsSwirlInjector // correct velocityProfile forAll(sm.injectors(), i) { - sm.injectors()[i].properties()->correctProfiles(sm.fuels(), referencePressure); + sm.injectors()[i].properties()->correctProfiles + ( + sm.fuels(), + referencePressure + ); } - } @@ -99,7 +102,7 @@ blobsSwirlInjector::~blobsSwirlInjector() scalar blobsSwirlInjector::d0 ( - const label n, + const label n, const scalar t ) const { @@ -107,30 +110,30 @@ scalar blobsSwirlInjector::d0 scalar c = rndGen_.scalar01(); - angle_ = coneAngle_[n]/2.0 + c * coneInterval_[n]; + angle_ = coneAngle_[n]/2.0 + c*coneInterval_[n]; - angle_ *= mathematicalConstant::pi/180.0; + angle_ *= constant::math::pi/180.0; scalar injectedMassFlow = it.massFlowRate(t); - - scalar cosAngle = cos(angle_); - scalar rhoFuel = sm_.fuels().rho(sm_.ambientPressure(), it.T(t), it.X()); - + scalar cosAngle = cos(angle_); + + scalar rhoFuel = sm_.fuels().rho(sm_.ambientPressure(), it.T(t), it.X()); + scalar deltaPressure = deltaPressureInj(t,n); calculateHX(n, injectedMassFlow, deltaPressure, t); - + scalar kV = kv(n); - - scalar v = kV * sqrt(2.0*deltaPressure/rhoFuel); - u_ = v * cosAngle; - + scalar v = kV*sqrt(2.0*deltaPressure/rhoFuel); + + u_ = v*cosAngle; + return h_; - } + vector blobsSwirlInjector::direction ( const label n, @@ -139,39 +142,42 @@ vector blobsSwirlInjector::direction const scalar d ) const { - scalar alpha = sin(angle_); scalar dcorr = cos(angle_); - scalar beta = 2.0*mathematicalConstant::pi*rndGen_.scalar01(); + scalar beta = constant::math::twoPi*rndGen_.scalar01(); // randomly distributed vector normal to the injection vector vector normal = vector::zero; - + if (sm_.twoD()) { scalar reduce = 0.01; // correct beta if this is a 2D run // map it onto the 'angleOfWedge' - beta *= (1.0-2.0*reduce)*sm_.angleOfWedge()/(2.0*mathematicalConstant::pi); + beta *= (1.0 - 2.0*reduce)*sm_.angleOfWedge()/(constant::math::twoPi); beta += reduce*sm_.angleOfWedge(); - normal = alpha* - ( - sm_.axisOfWedge()*cos(beta) + - sm_.axisOfWedgeNormal()*sin(beta) - ); + normal = + alpha + *( + sm_.axisOfWedge()*cos(beta) + + sm_.axisOfWedgeNormal()*sin(beta) + ); } else { - normal = alpha* - ( - injectors_[n].properties()->tan1(hole)*cos(beta) + - injectors_[n].properties()->tan2(hole)*sin(beta) - ); + normal = + alpha + *( + injectors_[n].properties()->tan1(hole)*cos(beta) + + injectors_[n].properties()->tan2(hole)*sin(beta) + ); } - + // set the direction of injection by adding the normal vector - vector dir = dcorr*injectors_[n].properties()->direction(hole, time) + normal; + vector dir = + dcorr*injectors_[n].properties()->direction(hole, time) + + normal; dir /= mag(dir); return dir; @@ -187,12 +193,9 @@ scalar blobsSwirlInjector::velocity return u_*sqrt(1.0 + pow(tan(angle_),2.0)); } -scalar blobsSwirlInjector::averageVelocity -( - const label i -) const -{ +scalar blobsSwirlInjector::averageVelocity(const label i) const +{ const injectorType& it = sm_.injectors()[i].properties(); scalar dt = it.teoi() - it.tsoi(); @@ -201,23 +204,20 @@ scalar blobsSwirlInjector::averageVelocity scalar injectionPressure = averagePressure(i); scalar Tav = it.integrateTable(it.T())/dt; - scalar rhoFuel = sm_.fuels().rho(sm_.ambientPressure(), Tav, it.X()); + scalar rhoFuel = sm_.fuels().rho(sm_.ambientPressure(), Tav, it.X()); scalar kV = kv(i); return kV*sqrt(2.0*(injectionPressure-sm_.ambientPressure())/rhoFuel); - } -scalar blobsSwirlInjector::kv -( - const label inj -) const +scalar blobsSwirlInjector::kv(const label inj) const { - return cD_[inj]/cos(angle_) * sqrt((1.0 - x_)/(1.0 + x_)); + return cD_[inj]/cos(angle_) * sqrt((1.0 - x_)/(1.0 + x_)); } + void blobsSwirlInjector::calculateHX ( const label inj, @@ -226,92 +226,82 @@ void blobsSwirlInjector::calculateHX const scalar time ) const { - const injectorType& it = injectors_[inj].properties(); scalar Tfuel = it.T(time); - scalar rhoFuel = sm_.fuels().rho(sm_.ambientPressure(), Tfuel, it.X()); - scalar muFuel = sm_.fuels().mu(sm_.ambientPressure(), Tfuel, it.X()); - scalar injectorDiameter = it.d(); + scalar rhoFuel = sm_.fuels().rho(sm_.ambientPressure(), Tfuel, it.X()); + scalar muFuel = sm_.fuels().mu(sm_.ambientPressure(), Tfuel, it.X()); + scalar injectorDiameter = it.d(); x_ = 0.0; - - h_ = - sqrt - ( - ( - A_[inj] * - cTau_[inj] * - muFuel* - massFlow* - (1.0 + x_) - ) - / - ( - mathematicalConstant::pi* - injectorDiameter* - rhoFuel* - dPressure* - sqr(1.0 - x_) - ) - ); - - scalar hOLD = -100.0; - scalar xOLD = -100.0; - - label i; - - for(i=0; i<20; i++) - { - - h_ = + h_ = sqrt ( - ( - A_[inj] * - cTau_[inj] * - muFuel* - massFlow* - (1.0 + x_) - ) - / - ( - mathematicalConstant::pi* - injectorDiameter* - rhoFuel* - dPressure* - sqr(1.0 - x_) + (A_[inj]*cTau_[inj]*muFuel*massFlow*(1.0 + x_)) + /( + constant::math::pi + *injectorDiameter + *rhoFuel + *dPressure + *sqr(1.0 - x_) ) ); - x_ = sqr(1.0 - 2.0 * h_/injectorDiameter); + scalar hOLD = -100.0; + scalar xOLD = -100.0; + + label i; + + for (i=0; i<20; i++) + { + h_ = + sqrt + ( + (A_[inj]*cTau_[inj]*muFuel*massFlow*(1.0 + x_)) + /( + constant::math::pi + *injectorDiameter + *rhoFuel + *dPressure + *sqr(1.0 - x_) + ) + ); + + x_ = sqr(1.0 - 2.0*h_/injectorDiameter); hOLD = h_; xOLD = x_; - + } - x_ = sqr(1.0 - 2.0 * h_/injectorDiameter); - + x_ = sqr(1.0 - 2.0*h_/injectorDiameter); } - -scalar blobsSwirlInjector::deltaPressureInj(const scalar time, const label inj) const +scalar blobsSwirlInjector::deltaPressureInj +( + const scalar time, + const label inj +) const { - return injectors_[inj].properties()->injectionPressure(time) - sm_.ambientPressure(); + return + injectors_[inj].properties()->injectionPressure(time) + - sm_.ambientPressure(); } + scalar blobsSwirlInjector::averagePressure(const label inj) const { - const injectorType& it = sm_.injectors()[inj].properties(); scalar dt = it.teoi() - it.tsoi(); return it.integrateTable(it.injectionPressureProfile())/dt; } + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + } // End namespace Foam // ************************************************************************* // diff --git a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/blobsSwirl/blobsSwirlInjector.H b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/blobsSwirl/blobsSwirlInjector.H index a122fdcf72eed43f1a397f947424933e98532e3b..f081cbda02bfe54a00f6fc73d567dc6e5ab5013f 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/blobsSwirl/blobsSwirlInjector.H +++ b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/blobsSwirl/blobsSwirlInjector.H @@ -54,8 +54,9 @@ Description namespace Foam { + /*---------------------------------------------------------------------------*\ - Class blobsSwirlInjector Declaration + Class blobsSwirlInjector Declaration \*---------------------------------------------------------------------------*/ class blobsSwirlInjector @@ -76,26 +77,22 @@ private: scalarList cTau_; scalarList A_; - // The initial spray angle for the parcels + //- Initial spray angle for the parcels mutable scalar angle_; - // The initial velocity for the parcels + //- Initial velocity for the parcels mutable scalar u_; - // The orifice-air cone area ratio - + //- Orifice-air cone area ratio mutable scalar x_; - // The initial sheet tickness - + //- Initial sheet tickness mutable scalar h_; + // private member functions - scalar kv - ( - const label inj - ) const; + scalar kv(const label inj) const; scalar deltaPressureInj(const scalar time, const label inj) const; scalar averagePressure(const label inj) const; @@ -108,25 +105,21 @@ private: const scalar time ) const; + public: //- Runtime type information - TypeName("blobsSwirlInjector"); + TypeName("blobsSwirlInjector"); // Constructors //- Construct from components - blobsSwirlInjector - ( - const dictionary& dict, - spray& sm - ); - + blobsSwirlInjector(const dictionary& dict, spray& sm); - // Destructor - ~blobsSwirlInjector(); + //- Destructor + virtual ~blobsSwirlInjector(); // Member Functions @@ -153,8 +146,6 @@ public: ( const label i ) const; - - }; diff --git a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/constant/constInjector.C b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/constant/constInjector.C index 1a49bbef21ab9b3ef4f306cce4bdb118ebc80043..1b89c250bc26d3fdad6fd9bf626d2aa97400aec0 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/constant/constInjector.C +++ b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/constant/constInjector.C @@ -26,7 +26,7 @@ License #include "constInjector.H" #include "addToRunTimeSelectionTable.H" -#include "mathematicalConstants.H" +#include "mathConstants.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -61,17 +61,19 @@ constInjector::constInjector { if (sm.injectors().size() != dropletNozzleDiameterRatio_.size()) { - FatalError << "constInjector::constInjector" - << "(const dictionary& dict, spray& sm)\n" - << "Wrong number of entries in dropletNozzleDiameterRatio" + FatalErrorIn + ( + "constInjector::constInjector(const dictionary& dict, spray& sm)" + ) << "Wrong number of entries in dropletNozzleDiameterRatio" << nl << abort(FatalError); } if (sm.injectors().size() != sprayAngle_.size()) { - FatalError << "constInjector::constInjector" - << "(const dictionary& dict, spray& sm)\n" - << "Wrong number of entries in sprayAngle" + FatalErrorIn + ( + "constInjector::constInjector(const dictionary& dict, spray& sm)" + ) << "Wrong number of entries in sprayAngle" << nl << abort(FatalError); } @@ -80,9 +82,12 @@ constInjector::constInjector // correct velocity and pressure profiles forAll(sm.injectors(), i) { - sm.injectors()[i].properties()->correctProfiles(sm.fuels(), referencePressure); + sm.injectors()[i].properties()->correctProfiles + ( + sm.fuels(), + referencePressure + ); } - } @@ -96,7 +101,7 @@ constInjector::~constInjector() scalar constInjector::d0 ( - const label n, + const label n, const scalar ) const { @@ -119,48 +124,50 @@ vector constInjector::direction alpha = radius of the two normal vectors, = maximum sin(sprayAngle/2) beta = angle in the normal plane - + o / (beta) |\ / | \ /) | \ o-----------> (x-axis) | \ v (alpha) - */ + */ - scalar angle = rndGen_.scalar01()*sprayAngle_[n]*mathematicalConstant::pi/360.0; + scalar angle = rndGen_.scalar01()*sprayAngle_[n]*constant::math::pi/360.0; scalar alpha = sin(angle); scalar dcorr = cos(angle); - scalar beta = 2.0*mathematicalConstant::pi*rndGen_.scalar01(); + scalar beta = constant::math::twoPi*rndGen_.scalar01(); // randomly distributed vector normal to the injection vector vector normal = vector::zero; - + if (sm_.twoD()) { scalar reduce = 0.01; // correct beta if this is a 2D run // map it onto the 'angleOfWedge' - beta *= (1.0-2.0*reduce)*0.5*sm_.angleOfWedge()/mathematicalConstant::pi; + beta *= (1.0 - 2.0*reduce)*0.5*sm_.angleOfWedge()/constant::math::pi; beta += reduce*sm_.angleOfWedge(); - normal = alpha* - ( - sm_.axisOfWedge()*cos(beta) + - sm_.axisOfWedgeNormal()*sin(beta) - ); + normal = + alpha + *( + sm_.axisOfWedge()*cos(beta) + + sm_.axisOfWedgeNormal()*sin(beta) + ); } else { - normal = alpha* - ( - injectors_[n].properties()->tan1(hole)*cos(beta) + - injectors_[n].properties()->tan2(hole)*sin(beta) - ); + normal = + alpha + *( + injectors_[n].properties()->tan1(hole)*cos(beta) + + injectors_[n].properties()->tan2(hole)*sin(beta) + ); } - + // set the direction of injection by adding the normal vector vector dir = dcorr*injectors_[n].properties()->direction(n, time) + normal; dir /= mag(dir); @@ -168,6 +175,7 @@ vector constInjector::direction return dir; } + scalar constInjector::velocity ( const label i, @@ -189,17 +197,18 @@ scalar constInjector::velocity } } -scalar constInjector::averageVelocity -( - const label i -) const -{ + +scalar constInjector::averageVelocity(const label i) const +{ const injectorType& it = sm_.injectors()[i].properties(); scalar dt = it.teoi() - it.tsoi(); return it.integrateTable(it.velocityProfile())/dt; } + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + } // End namespace Foam // ************************************************************************* // diff --git a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/constant/constInjector.H b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/constant/constInjector.H index 81e645d92452c242a77cb8f115f40230140335ec..69afa401324619df5f7fd9b84ab045875176be56 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/constant/constInjector.H +++ b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/constant/constInjector.H @@ -26,8 +26,8 @@ Class Foam::constInjector Description - Injector model with - specified Constant values for the droplet diameter and spray cone angle + Injector model with specified Constant values for the droplet diameter + and spray cone angle \*---------------------------------------------------------------------------*/ @@ -42,7 +42,7 @@ Description namespace Foam { /*---------------------------------------------------------------------------*\ - Class constInjector Declaration + Class constInjector Declaration \*---------------------------------------------------------------------------*/ class constInjector @@ -59,25 +59,21 @@ private: scalarList dropletNozzleDiameterRatio_; scalarList sprayAngle_; + public: //- Runtime type information - TypeName("constInjector"); + TypeName("constInjector"); // Constructors //- Construct from components - constInjector - ( - const dictionary& dict, - spray& sm - ); + constInjector(const dictionary& dict, spray& sm); - // Destructor - - ~constInjector(); + //- Destructor + virtual ~constInjector(); // Member Functions @@ -88,23 +84,15 @@ public: //- Return the spray angle of the injector vector direction ( - const label injector, + const label injector, const label hole, const scalar time, const scalar d ) const; - scalar velocity - ( - const label i, - const scalar time - ) const; - - scalar averageVelocity - ( - const label i - ) const; + scalar velocity(const label i, const scalar time) const; + scalar averageVelocity(const label i) const; }; diff --git a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/definedHollowCone/definedHollowCone.C b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/definedHollowCone/definedHollowCone.C index fce8ea2321c687214a1a87a148e346f7b553dd48..78740f67daebb317404b8168fce8b7c2149005bf 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/definedHollowCone/definedHollowCone.C +++ b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/definedHollowCone/definedHollowCone.C @@ -26,7 +26,7 @@ License #include "definedHollowCone.H" #include "addToRunTimeSelectionTable.H" -#include "mathematicalConstants.H" +#include "mathConstants.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -67,53 +67,62 @@ definedHollowConeInjector::definedHollowConeInjector innerConeAngle_(definedHollowConeDict_.lookup("innerConeAngle")), outerConeAngle_(definedHollowConeDict_.lookup("outerConeAngle")) { - // convert CA to real time - inner cone angle forAll(innerConeAngle_, i) { - innerConeAngle_[i][0] = sm.runTime().userTimeToTime(innerConeAngle_[i][0]); + innerConeAngle_[i][0] = + sm.runTime().userTimeToTime(innerConeAngle_[i][0]); } // convert CA to real time - outer cone angle forAll(outerConeAngle_, i) { - outerConeAngle_[i][0] = sm.runTime().userTimeToTime(outerConeAngle_[i][0]); + outerConeAngle_[i][0] = + sm.runTime().userTimeToTime(outerConeAngle_[i][0]); } // check number of injectors if (sm.injectors().size() != 1) { - Info << "Warning!!!\n" - << "definedHollowConeInjector::definedHollowConeInjector" - << "(const dictionary& dict, spray& sm)\n" - << "Same inner/outer cone angle profiles applied to each injector" - << endl; + WarningIn + ( + "definedHollowConeInjector::definedHollowConeInjector" + "(const dictionary& dict, spray& sm)" + ) << "Same inner/outer cone angle profiles applied to each injector" + << endl; } - + // check number of entries in innerConeAngle list if (innerConeAngle_.empty()) { - FatalError << "definedHollowConeInjector::definedHollowConeInjector" - << "(const dictionary& dict, spray& sm)\n" - << "Number of entries in innerConeAngle must be greater than zero" - << abort(FatalError); + FatalErrorIn + ( + "definedHollowConeInjector::definedHollowConeInjector" + "(const dictionary& dict, spray& sm)" + ) << "Number of entries in innerConeAngle must be greater than zero" + << abort(FatalError); } // check number of entries in outerConeAngle list if (outerConeAngle_.empty()) { - FatalError << "definedHollowConeInjector::definedHollowConeInjector" - << "(const dictionary& dict, spray& sm)\n" - << "Number of entries in outerConeAngle must be greater than zero" - << abort(FatalError); + FatalErrorIn + ( + "definedHollowConeInjector::definedHollowConeInjector" + "(const dictionary& dict, spray& sm)" + ) << "Number of entries in outerConeAngle must be greater than zero" + << abort(FatalError); } scalar referencePressure = sm.p().average().value(); // correct pressureProfile forAll(sm.injectors(), i) { - sm.injectors()[i].properties()->correctProfiles(sm.fuels(), referencePressure); + sm.injectors()[i].properties()->correctProfiles + ( + sm.fuels(), + referencePressure + ); } - } @@ -127,7 +136,7 @@ definedHollowConeInjector::~definedHollowConeInjector() scalar definedHollowConeInjector::d0 ( - const label n, + const label n, const scalar t ) const { @@ -145,7 +154,6 @@ vector definedHollowConeInjector::direction const scalar d ) const { - const injectorType& it = injectors_[n].properties(); // interpolate to find inner and outer angles at time, t @@ -153,47 +161,49 @@ vector definedHollowConeInjector::direction scalar angleOuter = it.getTableValue(outerConeAngle_, t); // use random number to generate angle between inner/outer cone angles - scalar angle = angleInner + rndGen_.scalar01()*(angleOuter-angleInner); + scalar angle = angleInner + rndGen_.scalar01()*(angleOuter - angleInner); - scalar alpha = sin(angle*mathematicalConstant::pi/360.0); - scalar dcorr = cos(angle*mathematicalConstant::pi/360.0); - scalar beta = 2.0*mathematicalConstant::pi*rndGen_.scalar01(); + scalar alpha = sin(angle*constant::math::pi/360.0); + scalar dcorr = cos(angle*constant::math::pi/360.0); + scalar beta = constant::math::twoPi*rndGen_.scalar01(); // randomly distributed vector normal to the injection vector vector normal = vector::zero; - + if (sm_.twoD()) { scalar reduce = 0.01; // correct beta if this is a 2D run // map it onto the 'angleOfWedge' - beta *= (1.0-2.0*reduce)*sm_.angleOfWedge()/(2.0*mathematicalConstant::pi); + beta *= (1.0 - 2.0*reduce)*sm_.angleOfWedge()/(constant::math::twoPi); beta += reduce*sm_.angleOfWedge(); - normal = alpha* - ( - sm_.axisOfWedge()*cos(beta) + - sm_.axisOfWedgeNormal()*sin(beta) - ); + normal = + alpha + *( + sm_.axisOfWedge()*cos(beta) + + sm_.axisOfWedgeNormal()*sin(beta) + ); } else { - normal = alpha* - ( - injectors_[n].properties()->tan1(hole)*cos(beta) + - injectors_[n].properties()->tan2(hole)*sin(beta) - ); + normal = + alpha + *( + injectors_[n].properties()->tan1(hole)*cos(beta) + + injectors_[n].properties()->tan2(hole)*sin(beta) + ); } - + // set the direction of injection by adding the normal vector vector dir = dcorr*injectors_[n].properties()->direction(hole, t) + normal; // normailse direction vector dir /= mag(dir); return dir; - } + scalar definedHollowConeInjector::velocity ( const label i, @@ -215,16 +225,15 @@ scalar definedHollowConeInjector::velocity } } -scalar definedHollowConeInjector::averageVelocity -( - const label i -) const -{ + +scalar definedHollowConeInjector::averageVelocity(const label i) const +{ const injectorType& it = sm_.injectors()[i].properties(); scalar dt = it.teoi() - it.tsoi(); return it.integrateTable(it.velocityProfile())/dt; } + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/definedHollowCone/definedHollowCone.H b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/definedHollowCone/definedHollowCone.H index be8a569979b1d05f09e8935adf40e5bc926fcc17..56d6241892ecee266bb7e5428335a8e4a5e90106 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/definedHollowCone/definedHollowCone.H +++ b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/definedHollowCone/definedHollowCone.H @@ -46,7 +46,7 @@ Description namespace Foam { /*---------------------------------------------------------------------------*\ - Class definedHollowConeInjector Declaration + Class definedHollowConeInjector Declaration \*---------------------------------------------------------------------------*/ class definedHollowConeInjector @@ -63,11 +63,12 @@ private: dictionary definedHollowConeDict_; autoPtr<pdf> dropletPDF_; - // inner and outer cone angle time histories + // inner and outer cone angle time histories // 2 column vectors = (time, coneAngle) List<pair> innerConeAngle_; List<pair> outerConeAngle_; + public: //- Runtime type information @@ -77,16 +78,11 @@ public: // Constructors //- Construct from components - definedHollowConeInjector - ( - const dictionary& dict, - spray& sm - ); + definedHollowConeInjector(const dictionary& dict, spray& sm); - // Destructor - - ~definedHollowConeInjector(); + //- Destructor + virtual ~definedHollowConeInjector(); // Member Functions @@ -103,17 +99,9 @@ public: const scalar d ) const; - scalar velocity - ( - const label i, - const scalar time - ) const; - - scalar averageVelocity - ( - const label i - ) const; + scalar velocity(const label i, const scalar time) const; + scalar averageVelocity( const label i) const; }; diff --git a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/definedPressureSwirl/definedPressureSwirl.C b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/definedPressureSwirl/definedPressureSwirl.C index 6e14912ac7fbf9a27087aa43f5fa389b9a98079e..7257ae0a03304ad1c611a85bc6c9633305e40e55 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/definedPressureSwirl/definedPressureSwirl.C +++ b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/definedPressureSwirl/definedPressureSwirl.C @@ -26,7 +26,7 @@ License #include "definedPressureSwirl.H" #include "addToRunTimeSelectionTable.H" -#include "mathematicalConstants.H" +#include "mathConstants.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -69,9 +69,12 @@ definedPressureSwirlInjector::definedPressureSwirlInjector // correct velocityProfile forAll(sm.injectors(), i) { - sm.injectors()[i].properties()->correctProfiles(sm.fuels(), referencePressure); + sm.injectors()[i].properties()->correctProfiles + ( + sm.fuels(), + referencePressure + ); } - } @@ -85,7 +88,7 @@ definedPressureSwirlInjector::~definedPressureSwirlInjector() scalar definedPressureSwirlInjector::d0 ( - const label n, + const label n, const scalar t ) const { @@ -95,38 +98,41 @@ scalar definedPressureSwirlInjector::d0 scalar coneAngle = it.getTableValue(coneAngle_, t); scalar coneInterval = it.getTableValue(coneInterval_, t); angle_ = coneAngle ; - -// modifications to take account of flash boiling.... + + // modifications to take account of flash boiling.... const liquidMixture& fuels = sm_.fuels(); scalar chi = 0.0; scalar Tinj = it.T(t); - label Nf = fuels.components().size(); + label Nf = fuels.components().size(); scalar temperature = sm_.ambientTemperature(); scalar pressure = sm_.ambientPressure(); - - - for(label i = 0; i < Nf ; i++) + + for (label i = 0; i < Nf ; i++) { - - if(fuels.properties()[i].pv(sm_.ambientPressure(), Tinj) >= 0.999*sm_.ambientPressure()) - { + if + ( + fuels.properties()[i].pv(sm_.ambientPressure(), Tinj) + >= 0.999*sm_.ambientPressure() + ) + { // The fuel is boiling..... -// Calculation of the boiling temperature - +// Calculation of the boiling temperature + scalar tBoilingSurface = Tinj ; - + label Niter = 200; - - for(label k=0; k< Niter ; k++) + + for (label k=0; k< Niter ; k++) { + scalar pBoil = + fuels.properties()[i].pv(pressure, tBoilingSurface); - scalar pBoil = fuels.properties()[i].pv(pressure, tBoilingSurface); - - if(pBoil > pressure) + if (pBoil > pressure) { - tBoilingSurface = tBoilingSurface - (Tinj-temperature)/Niter; + tBoilingSurface = + tBoilingSurface - (Tinj-temperature)/Niter; } else { @@ -134,65 +140,72 @@ scalar definedPressureSwirlInjector::d0 } } - - scalar hl = fuels.properties()[i].hl(sm_.ambientPressure(), tBoilingSurface); - scalar iTp = fuels.properties()[i].h(sm_.ambientPressure(), Tinj) - sm_.ambientPressure()/fuels.properties()[i].rho(sm_.ambientPressure(), Tinj); - scalar iTb = fuels.properties()[i].h(sm_.ambientPressure(), tBoilingSurface) - sm_.ambientPressure()/fuels.properties()[i].rho(sm_.ambientPressure(), tBoilingSurface); - + + scalar hl = + fuels.properties()[i].hl + ( + sm_.ambientPressure(), + tBoilingSurface + ); + scalar iTp = + fuels.properties()[i].h(sm_.ambientPressure(), Tinj) + - sm_.ambientPressure() + /fuels.properties()[i].rho(sm_.ambientPressure(), Tinj); + scalar iTb = + fuels.properties()[i].h(sm_.ambientPressure(), tBoilingSurface) + - sm_.ambientPressure() + /fuels.properties()[i].rho + ( + sm_.ambientPressure(), + tBoilingSurface + ); + chi += it.X()[i]*(iTp-iTb)/hl; - } - } - - // bounding chi - + } + + // bounding chi + chi = max(chi, 0.0); chi = min(chi, 1.0); - - angle_ = angle_ + (144.0 - angle_) * sqr(chi) + 2.0 * coneInterval * (0.5 - c); -// end modifications + angle_ = + angle_ + (144.0 - angle_) * sqr(chi) + 2.0*coneInterval*(0.5 - c); + + // end modifications - angle_ *= mathematicalConstant::pi/360.0; + angle_ *= constant::math::pi/360.0; scalar injectedMassFlow = it.massFlowRate(t); - - scalar cosAngle = cos(angle_); - scalar rhoFuel = sm_.fuels().rho(sm_.ambientPressure(), it.T(t), it.X()); - scalar injectorDiameter = it.d(); - + scalar cosAngle = cos(angle_); + + scalar rhoFuel = sm_.fuels().rho(sm_.ambientPressure(), it.T(t), it.X()); + scalar injectorDiameter = it.d(); + scalar deltaPressure = deltaPressureInj(t,n); - + scalar kV = kv(n, injectedMassFlow, deltaPressure, t); - - scalar v = kV * sqrt(2.0*deltaPressure/rhoFuel); - u_ = v * cosAngle; - - scalar A = injectedMassFlow/(mathematicalConstant::pi*rhoFuel*u_); + scalar v = kV*sqrt(2.0*deltaPressure/rhoFuel); -/* + u_ = v*cosAngle; - TL - The formula for the sheet tickness proposed by the authors is, - in my opinion, "strange"..... - I modified it multiplying the sheet tickness for the cone angle cosinus. + scalar A = injectedMassFlow/(constant::math::pi*rhoFuel*u_); -*/ + // Not using the authors definition for sheet thickness + // modified by multiplying the sheet tickness for the cone angle cosinus. scalar angleT = angle_; - return (injectorDiameter-sqrt(pow(injectorDiameter,2.0)-4.0*A))*cos(angleT)/2.0; + return + (injectorDiameter - sqrt(sqr(injectorDiameter) - 4.0*A)) + *cos(angleT)/2.0; -// original implementation - -/* - return (injectorDiameter-sqrt(pow(injectorDiameter,2)-4.0*A))/2.0; -*/ - - + // original implementation + // return (injectorDiameter-sqrt(sqr(injectorDiameter) - 4.0*A))/2.0; } + vector definedPressureSwirlInjector::direction ( const label n, @@ -201,39 +214,41 @@ vector definedPressureSwirlInjector::direction const scalar d ) const { - scalar alpha = sin(angle_); scalar dcorr = cos(angle_); - scalar beta = 2.0*mathematicalConstant::pi*rndGen_.scalar01(); + scalar beta = constant::math::twoPi*rndGen_.scalar01(); // randomly distributed vector normal to the injection vector vector normal = vector::zero; - + if (sm_.twoD()) { scalar reduce = 0.01; // correct beta if this is a 2D run // map it onto the 'angleOfWedge' - beta *= (1.0-2.0*reduce)*sm_.angleOfWedge()/(2.0*mathematicalConstant::pi); + beta *= (1.0 - 2.0*reduce)*sm_.angleOfWedge()/(constant::math::twoPi); beta += reduce*sm_.angleOfWedge(); - normal = alpha* - ( - sm_.axisOfWedge()*cos(beta) + - sm_.axisOfWedgeNormal()*sin(beta) - ); + normal = + alpha + *( + sm_.axisOfWedge()*cos(beta) + + sm_.axisOfWedgeNormal()*sin(beta) + ); } else { - normal = alpha* - ( - injectors_[n].properties()->tan1(hole)*cos(beta) + - injectors_[n].properties()->tan2(hole)*sin(beta) - ); + normal = + alpha + *( + injectors_[n].properties()->tan1(hole)*cos(beta) + + injectors_[n].properties()->tan2(hole)*sin(beta) + ); } - + // set the direction of injection by adding the normal vector - vector dir = dcorr*injectors_[n].properties()->direction(hole, time) + normal; + vector dir = + dcorr*injectors_[n].properties()->direction(hole, time) + normal; dir /= mag(dir); return dir; @@ -249,12 +264,9 @@ scalar definedPressureSwirlInjector::velocity return u_*sqrt(1.0 + pow(tan(angle_),2.0)); } -scalar definedPressureSwirlInjector::averageVelocity -( - const label i -) const -{ +scalar definedPressureSwirlInjector::averageVelocity(const label i) const +{ const injectorType& it = sm_.injectors()[i].properties(); scalar dt = it.teoi() - it.tsoi(); @@ -264,12 +276,11 @@ scalar definedPressureSwirlInjector::averageVelocity scalar injectionPressure = averagePressure(i); scalar Tav = it.integrateTable(it.T())/dt; - scalar rhoFuel = sm_.fuels().rho(sm_.ambientPressure(), Tav, it.X()); + scalar rhoFuel = sm_.fuels().rho(sm_.ambientPressure(), Tav, it.X()); scalar kV = kv(i, injectedMassFlow, injectionPressure, 0); return kV*sqrt(2.0*(injectionPressure-sm_.ambientPressure())/rhoFuel); - } @@ -281,49 +292,53 @@ scalar definedPressureSwirlInjector::kv const scalar t ) const { - const injectorType& it = injectors_[inj].properties(); scalar coneAngle = it.getTableValue(coneAngle_, t); - coneAngle *= mathematicalConstant::pi/360.0; + coneAngle *= constant::math::pi/360.0; scalar cosAngle = cos(coneAngle); - scalar Tav = it.integrateTable(it.T())/(it.teoi()-it.tsoi()); + scalar Tav = it.integrateTable(it.T())/(it.teoi() - it.tsoi()); + + scalar rhoFuel = sm_.fuels().rho(sm_.ambientPressure(), Tav, it.X()); + scalar injectorDiameter = it.d(); - scalar rhoFuel = sm_.fuels().rho(sm_.ambientPressure(), Tav, it.X()); - scalar injectorDiameter = it.d(); - scalar kv = max ( - it.getTableValue(maxKv_, t), + it.getTableValue(maxKv_, t), 4.0*massFlow - * - sqrt(rhoFuel/2.0/dPressure) - / - (mathematicalConstant::pi*pow(injectorDiameter, 2.0)*rhoFuel*cosAngle) + *sqrt(rhoFuel/2.0/dPressure) + /(constant::math::pi*sqr(injectorDiameter)*rhoFuel*cosAngle) ); - return min(1.0,kv); + return min(1.0, kv); } - - -scalar definedPressureSwirlInjector::deltaPressureInj(const scalar time, const label inj) const +scalar definedPressureSwirlInjector::deltaPressureInj +( + const scalar time, + const label inj +) const { - return injectors_[inj].properties()->injectionPressure(time) - sm_.ambientPressure(); + return + injectors_[inj].properties()->injectionPressure(time) + - sm_.ambientPressure(); } + scalar definedPressureSwirlInjector::averagePressure(const label inj) const { - const injectorType& it = sm_.injectors()[inj].properties(); scalar dt = it.teoi() - it.tsoi(); return it.integrateTable(it.injectionPressureProfile())/dt; } + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + } // End namespace Foam // ************************************************************************* // diff --git a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/definedPressureSwirl/definedPressureSwirl.H b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/definedPressureSwirl/definedPressureSwirl.H index 197e76b0fb829c24c7222a6411069e4d955c6ba3..f4eda52a58e512e978f05378040656738ebf8627 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/definedPressureSwirl/definedPressureSwirl.H +++ b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/definedPressureSwirl/definedPressureSwirl.H @@ -26,7 +26,7 @@ Class Foam::definedPressureSwirlInjector Description - Pressure swirl injector model with user-defined + Pressure swirl injector model with user-defined cone-angle/interval vs. time \*---------------------------------------------------------------------------*/ @@ -44,7 +44,7 @@ Description namespace Foam { /*---------------------------------------------------------------------------*\ - Class definedPressureSwirlInjector Declaration + Class definedPressureSwirlInjector Declaration \*---------------------------------------------------------------------------*/ class definedPressureSwirlInjector @@ -65,12 +65,13 @@ private: List<pair> maxKv_; - // The initial spray angle for the parcels + //- Initial spray angle for the parcels mutable scalar angle_; - // The initial velocity for the parcels + //- Initial velocity for the parcels mutable scalar u_; + // private member functions scalar kv @@ -84,25 +85,21 @@ private: scalar deltaPressureInj(const scalar time, const label inj) const; scalar averagePressure(const label inj) const; + public: //- Runtime type information - TypeName("definedPressureSwirlInjector"); + TypeName("definedPressureSwirlInjector"); // Constructors //- Construct from components - definedPressureSwirlInjector - ( - const dictionary& dict, - spray& sm - ); + definedPressureSwirlInjector(const dictionary& dict, spray& sm); - // Destructor - - ~definedPressureSwirlInjector(); + //- Destructor + virtual ~definedPressureSwirlInjector(); // Member Functions @@ -119,18 +116,9 @@ public: const scalar d ) const; - scalar velocity - ( - const label i, - const scalar time - ) const; - - scalar averageVelocity - ( - const label i - ) const; - + scalar velocity(const label i, const scalar time) const; + scalar averageVelocity(const label i) const; }; diff --git a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/hollowCone/hollowCone.C b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/hollowCone/hollowCone.C index 2613f8584f4fa8d6195ff7a7ccab85525dcaaebc..3c89eaba4fae1831d6a46da90bde9ee081cae1d3 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/hollowCone/hollowCone.C +++ b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/hollowCone/hollowCone.C @@ -26,7 +26,7 @@ License #include "hollowCone.H" #include "addToRunTimeSelectionTable.H" -#include "mathematicalConstants.H" +#include "mathConstants.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -70,17 +70,21 @@ hollowConeInjector::hollowConeInjector if (sm.injectors().size() != innerAngle_.size()) { - FatalError << "hollowConeInjector::hollowConeInjector" - << "(const dictionary& dict, spray& sm)\n" - << "Wrong number of entries in innerAngle" + FatalErrorIn + ( + "hollowConeInjector::hollowConeInjector" + "(const dictionary& dict, spray& sm)" + ) << "Wrong number of entries in innerAngle" << abort(FatalError); } if (sm.injectors().size() != outerAngle_.size()) { - FatalError << "hollowConeInjector::hollowConeInjector" - << "(const dictionary& dict, spray& sm)\n" - << "Wrong number of entries in outerAngle" + FatalErrorIn + ( + "hollowConeInjector::hollowConeInjector" + "(const dictionary& dict, spray& sm)" + ) << "Wrong number of entries in outerAngle" << abort(FatalError); } @@ -89,9 +93,12 @@ hollowConeInjector::hollowConeInjector // correct velocityProfile forAll(sm.injectors(), i) { - sm.injectors()[i].properties()->correctProfiles(sm.fuels(), referencePressure); + sm.injectors()[i].properties()->correctProfiles + ( + sm.fuels(), + referencePressure + ); } - } @@ -105,7 +112,7 @@ hollowConeInjector::~hollowConeInjector() scalar hollowConeInjector::d0 ( - const label, + const label, const scalar ) const { @@ -121,45 +128,49 @@ vector hollowConeInjector::direction const scalar d ) const { - scalar angle = innerAngle_[n] + rndGen_.scalar01()*(outerAngle_[n]-innerAngle_[n]); - scalar alpha = sin(angle*mathematicalConstant::pi/360.0); - scalar dcorr = cos(angle*mathematicalConstant::pi/360.0); - scalar beta = 2.0*mathematicalConstant::pi*rndGen_.scalar01(); + scalar angle = + innerAngle_[n] + rndGen_.scalar01()*(outerAngle_[n]-innerAngle_[n]); + scalar alpha = sin(angle*constant::math::pi/360.0); + scalar dcorr = cos(angle*constant::math::pi/360.0); + scalar beta = constant::math::twoPi*rndGen_.scalar01(); // randomly distributed vector normal to the injection vector vector normal = vector::zero; - + if (sm_.twoD()) { scalar reduce = 0.01; // correct beta if this is a 2D run // map it onto the 'angleOfWedge' - beta *= (1.0-2.0*reduce)*sm_.angleOfWedge()/(2.0*mathematicalConstant::pi); + beta *= (1.0 - 2.0*reduce)*sm_.angleOfWedge()/(constant::math::twoPi); beta += reduce*sm_.angleOfWedge(); - normal = alpha* - ( - sm_.axisOfWedge()*cos(beta) + - sm_.axisOfWedgeNormal()*sin(beta) - ); + normal = + alpha + *( + sm_.axisOfWedge()*cos(beta) + + sm_.axisOfWedgeNormal()*sin(beta) + ); } else { - normal = alpha* - ( - injectors_[n].properties()->tan1(hole)*cos(beta) + - injectors_[n].properties()->tan2(hole)*sin(beta) - ); + normal = + alpha + *( + injectors_[n].properties()->tan1(hole)*cos(beta) + + injectors_[n].properties()->tan2(hole)*sin(beta) + ); } - + // set the direction of injection by adding the normal vector - vector dir = dcorr*injectors_[n].properties()->direction(hole, time) + normal; + vector dir = + dcorr*injectors_[n].properties()->direction(hole, time) + normal; dir /= mag(dir); return dir; - } + scalar hollowConeInjector::velocity ( const label i, @@ -179,19 +190,19 @@ scalar hollowConeInjector::velocity scalar dp = max(0.0, Pinj - Pref); return sqrt(2.0*dp/rho); } - } -scalar hollowConeInjector::averageVelocity -( - const label i -) const -{ + +scalar hollowConeInjector::averageVelocity(const label i) const +{ const injectorType& it = sm_.injectors()[i].properties(); scalar dt = it.teoi() - it.tsoi(); return it.integrateTable(it.velocityProfile())/dt; } + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + } // End namespace Foam // ************************************************************************* // diff --git a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/hollowCone/hollowCone.H b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/hollowCone/hollowCone.H index b18af3f1da626f7a6b217005fa89496aa1a755d8..985d7c6073236e56c1a34849b8a8dea448b751ef 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/hollowCone/hollowCone.H +++ b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/hollowCone/hollowCone.H @@ -45,7 +45,7 @@ Description namespace Foam { /*---------------------------------------------------------------------------*\ - Class hollowConeInjector Declaration + Class hollowConeInjector Declaration \*---------------------------------------------------------------------------*/ class hollowConeInjector @@ -63,25 +63,21 @@ private: scalarList innerAngle_; scalarList outerAngle_; + public: //- Runtime type information - TypeName("hollowConeInjector"); + TypeName("hollowConeInjector"); // Constructors //- Construct from components - hollowConeInjector - ( - const dictionary& dict, - spray& sm - ); - + hollowConeInjector(const dictionary& dict, spray& sm); - // Destructor - ~hollowConeInjector(); + //- Destructor + virtual ~hollowConeInjector(); // Member Functions @@ -97,17 +93,10 @@ public: const scalar time, const scalar d ) const; - - scalar velocity - ( - const label i, - const scalar time - ) const; - - scalar averageVelocity - ( - const label i - ) const; + + scalar velocity(const label i, const scalar time) const; + + scalar averageVelocity(const label i) const; }; diff --git a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/injectorModel/injectorModel.C b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/injectorModel/injectorModel.C index 86342a507c7f6bfe9e14e3b53f104e53c4073734..0e428b3066bae7b2a94c918a5b42b322ce8d1b99 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/injectorModel/injectorModel.C +++ b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/injectorModel/injectorModel.C @@ -55,11 +55,13 @@ injectorModel::injectorModel rndGen_(sm.rndGen()) {} + // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // injectorModel::~injectorModel() {} + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/injectorModel/injectorModel.H b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/injectorModel/injectorModel.H index 17c3e62f2265596929fb220db1606b3d1ec8c547..26923ced97ba5be5bcf4c2526c9ae42713a2a6dc 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/injectorModel/injectorModel.H +++ b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/injectorModel/injectorModel.H @@ -28,7 +28,7 @@ Class Description The injectormodel is used to set initial droplet size and the - velocity direction + velocity direction \*---------------------------------------------------------------------------*/ @@ -49,7 +49,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class injectorModel Declaration + Class injectorModel Declaration \*---------------------------------------------------------------------------*/ class injectorModel @@ -62,13 +62,14 @@ protected: const dictionary& dict_; spray& sm_; - const PtrList<injector>& injectors_; + const PtrList<injector>& injectors_; Random& rndGen_; + public: //-Runtime type information - TypeName("injectorModel"); + TypeName("injectorModel"); // Declare runtime constructor selection table @@ -88,16 +89,11 @@ public: // Constructors //- Construct from components - injectorModel - ( - const dictionary& dict, - spray& sm - ); - + injectorModel(const dictionary& dict, spray& sm); - // Destructor - virtual ~injectorModel(); + //- Destructor + virtual ~injectorModel(); // Selector @@ -117,22 +113,15 @@ public: //- Return the spray angle of the injector virtual vector direction ( - const label injector, + const label injector, const label hole, const scalar time, const scalar d ) const = 0; - virtual scalar velocity - ( - const label i, - const scalar time - ) const = 0; - - virtual scalar averageVelocity - ( - const label i - ) const = 0; + virtual scalar velocity(const label i, const scalar time) const = 0; + + virtual scalar averageVelocity(const label i) const = 0; }; diff --git a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/injectorModel/newInjectorModel.C b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/injectorModel/newInjectorModel.C index 41758a82597ce5fb22bbb1db428d3f9328b824f3..b4b5f980288b3b1e73fb220965cbca391c96c0b9 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/injectorModel/newInjectorModel.C +++ b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/injectorModel/newInjectorModel.C @@ -42,10 +42,7 @@ autoPtr<injectorModel> injectorModel::New spray& sm ) { - word injectorModelType - ( - dict.lookup("injectorModel") - ); + word injectorModelType(dict.lookup("injectorModel")); Info<< "Selecting injectorModel " << injectorModelType << endl; @@ -55,13 +52,12 @@ autoPtr<injectorModel> injectorModel::New if (cstrIter == dictionaryConstructorTablePtr_->end()) { - FatalError - << "injectorModel::New(const dictionary&, spray&) : " << endl - << " unknown injectorModelType type " - << injectorModelType - << ", constructor not in hash table" << endl << endl - << " Valid injectorModel types are :" << endl; - Info<< dictionaryConstructorTablePtr_->sortedToc() << abort(FatalError); + FatalErrorIn("injectorModel::New(const dictionary&, spray&)") + << "Unknown injectorModelType type " << injectorModelType + << ", constructor not in hash table" << nl << nl + << " Valid injectorModel types are:" << nl + << dictionaryConstructorTablePtr_->sortedToc() + << abort(FatalError); } return autoPtr<injectorModel>(cstrIter()(dict, sm)); diff --git a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/pressureSwirl/pressureSwirlInjector.C b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/pressureSwirl/pressureSwirlInjector.C index eb286bac36d3fc1340b6ec8b50bb99cba3ac6502..c5510ecc26a829e80a101287176c92ef3d3f9d22 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/pressureSwirl/pressureSwirlInjector.C +++ b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/pressureSwirl/pressureSwirlInjector.C @@ -26,7 +26,7 @@ License #include "pressureSwirlInjector.H" #include "addToRunTimeSelectionTable.H" -#include "mathematicalConstants.H" +#include "mathConstants.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -66,9 +66,11 @@ pressureSwirlInjector::pressureSwirlInjector if (sm.injectors().size() != coneAngle_.size()) { - FatalError << "pressureSwirlInjector::pressureSwirlInjector" - << "(const dictionary& dict, spray& sm)\n" - << "Wrong number of entries in innerAngle" + FatalErrorIn + ( + "pressureSwirlInjector::pressureSwirlInjector" + "(const dictionary& dict, spray& sm)" + ) << "Wrong number of entries in innerAngle" << nl << abort(FatalError); } @@ -77,9 +79,12 @@ pressureSwirlInjector::pressureSwirlInjector // correct velocityProfile forAll(sm.injectors(), i) { - sm.injectors()[i].properties()->correctProfiles(sm.fuels(), referencePressure); + sm.injectors()[i].properties()->correctProfiles + ( + sm.fuels(), + referencePressure + ); } - } @@ -93,35 +98,36 @@ pressureSwirlInjector::~pressureSwirlInjector() scalar pressureSwirlInjector::d0 ( - const label n, + const label n, const scalar t ) const { const injectorType& it = injectors_[n].properties(); scalar c = rndGen_.scalar01(); - angle_ = coneAngle_[n] + 2.0 * coneInterval_[n] * (0.5 - c) ; + angle_ = coneAngle_[n] + 2.0*coneInterval_[n]*(0.5 - c); - angle_ *= mathematicalConstant::pi/360.0; + angle_ *= constant::math::pi/360.0; scalar injectedMassFlow = it.massFlowRate(t); - - scalar cosAngle = cos(angle_); - scalar rhoFuel = sm_.fuels().rho(sm_.ambientPressure(), it.T(t), it.X()); - scalar injectorDiameter = it.d(); - + scalar cosAngle = cos(angle_); + + scalar rhoFuel = sm_.fuels().rho(sm_.ambientPressure(), it.T(t), it.X()); + scalar injectorDiameter = it.d(); + scalar deltaPressure = deltaPressureInj(t,n); scalar kV = kv(n, injectedMassFlow, deltaPressure); - scalar v = kV * sqrt(2.0*deltaPressure/rhoFuel); + scalar v = kV*sqrt(2.0*deltaPressure/rhoFuel); + + u_ = v*cosAngle; - u_ = v * cosAngle; - - scalar A = injectedMassFlow/(mathematicalConstant::pi*rhoFuel*u_); + scalar A = injectedMassFlow/(constant::math::pi*rhoFuel*u_); return (injectorDiameter-sqrt(pow(injectorDiameter,2)-4.0*A))/2.0; } + vector pressureSwirlInjector::direction ( const label n, @@ -130,39 +136,41 @@ vector pressureSwirlInjector::direction const scalar d ) const { - scalar alpha = sin(angle_); scalar dcorr = cos(angle_); - scalar beta = 2.0*mathematicalConstant::pi*rndGen_.scalar01(); + scalar beta = constant::math::twoPi*rndGen_.scalar01(); // randomly distributed vector normal to the injection vector vector normal = vector::zero; - + if (sm_.twoD()) { scalar reduce = 0.01; // correct beta if this is a 2D run // map it onto the 'angleOfWedge' - beta *= (1.0-2.0*reduce)*sm_.angleOfWedge()/(2.0*mathematicalConstant::pi); + beta *= (1.0 - 2.0*reduce)*sm_.angleOfWedge()/(constant::math::twoPi); beta += reduce*sm_.angleOfWedge(); - normal = alpha* - ( - sm_.axisOfWedge()*cos(beta) + - sm_.axisOfWedgeNormal()*sin(beta) - ); + normal = + alpha + *( + sm_.axisOfWedge()*cos(beta) + + sm_.axisOfWedgeNormal()*sin(beta) + ); } else { - normal = alpha* - ( - injectors_[n].properties()->tan1(hole)*cos(beta) + - injectors_[n].properties()->tan2(hole)*sin(beta) - ); + normal = + alpha + *( + injectors_[n].properties()->tan1(hole)*cos(beta) + + injectors_[n].properties()->tan2(hole)*sin(beta) + ); } - + // set the direction of injection by adding the normal vector - vector dir = dcorr*injectors_[n].properties()->direction(hole, time) + normal; + vector dir = + dcorr*injectors_[n].properties()->direction(hole, time) + normal; dir /= mag(dir); return dir; @@ -178,12 +186,9 @@ scalar pressureSwirlInjector::velocity return u_*sqrt(1.0 + pow(tan(angle_),2.0)); } -scalar pressureSwirlInjector::averageVelocity -( - const label i -) const -{ +scalar pressureSwirlInjector::averageVelocity(const label i) const +{ const injectorType& it = sm_.injectors()[i].properties(); scalar dt = it.teoi() - it.tsoi(); @@ -193,7 +198,7 @@ scalar pressureSwirlInjector::averageVelocity scalar injectionPressure = averagePressure(i); scalar Tav = it.integrateTable(it.T())/dt; - scalar rhoFuel = sm_.fuels().rho(sm_.ambientPressure(), Tav, it.X()); + scalar rhoFuel = sm_.fuels().rho(sm_.ambientPressure(), Tav, it.X()); scalar kV = kv(i, injectedMassFlow, injectionPressure); @@ -208,40 +213,42 @@ scalar pressureSwirlInjector::kv const scalar dPressure ) const { - const injectorType& it = injectors_[inj].properties(); scalar coneAngle = coneAngle_[inj]; - coneAngle *= mathematicalConstant::pi/360.0; + coneAngle *= constant::math::pi/360.0; scalar cosAngle = cos(coneAngle); scalar Tav = it.integrateTable(it.T())/(it.teoi()-it.tsoi()); - scalar rhoFuel = sm_.fuels().rho(sm_.ambientPressure(), Tav, it.X()); - scalar injectorDiameter = it.d(); - + scalar rhoFuel = sm_.fuels().rho(sm_.ambientPressure(), Tav, it.X()); + scalar injectorDiameter = it.d(); + scalar kv = max ( - maxKv_[inj], + maxKv_[inj], 4.0*massFlow - * - sqrt(rhoFuel/2.0/dPressure) - / - (mathematicalConstant::pi*pow(injectorDiameter, 2.0)*rhoFuel*cosAngle) + *sqrt(rhoFuel/2.0/dPressure) + /(constant::math::pi*sqr(injectorDiameter)*rhoFuel*cosAngle) ); - return min(1.0, kv); + return min(1.0, kv); } - - -scalar pressureSwirlInjector::deltaPressureInj(const scalar time, const label inj) const +scalar pressureSwirlInjector::deltaPressureInj +( + const scalar time, + const label inj +) const { - return injectors_[inj].properties()->injectionPressure(time) - sm_.ambientPressure(); + return + injectors_[inj].properties()->injectionPressure(time) + - sm_.ambientPressure(); } + scalar pressureSwirlInjector::averagePressure(const label inj) const { @@ -251,6 +258,9 @@ scalar pressureSwirlInjector::averagePressure(const label inj) const return it.integrateTable(it.injectionPressureProfile())/dt; } + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + } // End namespace Foam // ************************************************************************* // diff --git a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/pressureSwirl/pressureSwirlInjector.H b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/pressureSwirl/pressureSwirlInjector.H index 56fe236c0163a5bb990ec58fc5fa3868fb892918..b369f34885adc614d9c01b1364a383d84b55e84c 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/pressureSwirl/pressureSwirlInjector.H +++ b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/pressureSwirl/pressureSwirlInjector.H @@ -61,44 +61,41 @@ private: scalarList coneAngle_; scalarList coneInterval_; scalarList maxKv_; - - // The initial spray angle for the parcels + + //- Initial spray angle for the parcels mutable scalar angle_; - - // The initial velocity for the parcels + + //- Initial velocity for the parcels mutable scalar u_; + // private member functions - + scalar kv ( - const label inj, + const label inj, const scalar massFlow, const scalar dPressure ) const; - + scalar deltaPressureInj(const scalar time, const label inj) const; scalar averagePressure(const label inj) const; + public: //- Runtime type information - TypeName("pressureSwirlInjector"); + TypeName("pressureSwirlInjector"); // Constructors //- Construct from components - pressureSwirlInjector - ( - const dictionary& dict, - spray& sm - ); + pressureSwirlInjector(const dictionary& dict, spray& sm); - // Destructor - - ~pressureSwirlInjector(); + //- Destructor + virtual ~pressureSwirlInjector(); // Member Functions @@ -110,23 +107,14 @@ public: vector direction ( const label injector, - const label hole, + const label hole, const scalar time, const scalar d ) const; - - scalar velocity - ( - const label i, - const scalar time - ) const; - - scalar averageVelocity - ( - const label i - ) const; - + scalar velocity(const label i, const scalar time) const; + + scalar averageVelocity(const label i) const; }; diff --git a/src/lagrangian/dieselSpray/spraySubModels/wallModel/reflectParcel/reflectParcel.C b/src/lagrangian/dieselSpray/spraySubModels/wallModel/reflectParcel/reflectParcel.C index b10ad3274d626cfbef3c20f323fe400b92578ac0..8948633e7adff68130dbd29568c0568160652acc 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/wallModel/reflectParcel/reflectParcel.C +++ b/src/lagrangian/dieselSpray/spraySubModels/wallModel/reflectParcel/reflectParcel.C @@ -92,12 +92,11 @@ bool reflectParcel::wallTreatment { // static mesh scalar Un = p.U() & Sf; - + if (Un > 0) { p.U() -= (1.0 + elasticity_)*Un*Sf; } - } else { @@ -127,7 +126,7 @@ bool reflectParcel::wallTreatment scalar magSfDiff = mag(Sf - Sf0); vector Ub = Ub0 + p.stepFraction()*(Ub1 - Ub0); - + if (magSfDiff > SMALL) { // rotation + translation @@ -136,17 +135,17 @@ bool reflectParcel::wallTreatment vector omega = Sf0 ^ Sf; scalar magOmega = mag(omega); omega /= magOmega+SMALL; - + scalar phiVel = ::asin(magOmega)/dt; - + scalar dist = (p.position() - Cf) & Sfp; vector pos = p.position() - dist*Sfp; vector vrot = phiVel*(omega ^ (pos - Cf)); vector v = Ub + vrot; - + scalar Un = ((p.U() - v) & Sfp); - + if (Un > 0.0) { p.U() -= (1.0 + elasticity_)*Un*Sfp; @@ -179,16 +178,15 @@ bool reflectParcel::wallTreatment } else { - FatalError - << "bool reflectParcel::wallTreatment(parcel& parcel) const " - << " parcel has hit a boundary " - << mesh_.boundary()[patchi].type() - << " which not yet has been implemented." + FatalErrorIn("bool reflectParcel::wallTreatment(parcel& parcel) const") + << " parcel has hit a boundary " << mesh_.boundary()[patchi].type() + << " which not yet has been implemented." << nl << abort(FatalError); } return true; } + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/lagrangian/dieselSpray/spraySubModels/wallModel/reflectParcel/reflectParcel.H b/src/lagrangian/dieselSpray/spraySubModels/wallModel/reflectParcel/reflectParcel.H index f2261ca5b3c63a62758a8d812560ae1ea85d8882..c13c5f5882cee00408be5b230d22468929b15d74 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/wallModel/reflectParcel/reflectParcel.H +++ b/src/lagrangian/dieselSpray/spraySubModels/wallModel/reflectParcel/reflectParcel.H @@ -50,16 +50,18 @@ class reflectParcel { private: + // Private data const volVectorField& U_; dictionary coeffsDict_; - // model constants + // model constants + + //- Elasticity constant v^2_out = elasticity*v^2_in + scalar elasticity_; - //- Elasticity constant v^2_out = elasticity * v^2_in - scalar elasticity_; public: @@ -78,22 +80,15 @@ public: ); - // Destructor - - virtual ~reflectParcel(); + //- Destructor + virtual ~reflectParcel(); // Member Functions //- Return true if parcel is to be kept, and false if it is to be // removed - bool wallTreatment - ( - parcel& parcel, - const label facei - ) const; - - + bool wallTreatment(parcel& parcel, const label facei) const; }; diff --git a/src/lagrangian/dieselSpray/spraySubModels/wallModel/removeParcel/removeParcel.H b/src/lagrangian/dieselSpray/spraySubModels/wallModel/removeParcel/removeParcel.H index 0dbf2541a7871cceb6951f500fa479a1fea357c7..453d02986ba23f39cf2ecbb1842e1cbabfb073e0 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/wallModel/removeParcel/removeParcel.H +++ b/src/lagrangian/dieselSpray/spraySubModels/wallModel/removeParcel/removeParcel.H @@ -41,7 +41,7 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class removeParcel Declaration + Class removeParcel Declaration \*---------------------------------------------------------------------------*/ class removeParcel @@ -66,21 +66,15 @@ public: ); - // Destructor - - virtual ~removeParcel(); + //- Destructor + virtual ~removeParcel(); // Member Functions //- Return true if parcel is to be kept, and false if it is to be // removed - bool wallTreatment - ( - parcel& parcel, - const label facei - ) const; - + bool wallTreatment(parcel& parcel, const label facei) const; }; diff --git a/src/lagrangian/dieselSpray/spraySubModels/wallModel/wallModel/newWallModel.C b/src/lagrangian/dieselSpray/spraySubModels/wallModel/wallModel/newWallModel.C index 3274533b1d7d9253b345120eaa2481067cc95a2e..f96b9cb029f6c67fc312f1b9153a3f788e3e1f20 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/wallModel/wallModel/newWallModel.C +++ b/src/lagrangian/dieselSpray/spraySubModels/wallModel/wallModel/newWallModel.C @@ -42,26 +42,21 @@ autoPtr<wallModel> wallModel::New spray& sm ) { - word wallModelType - ( - dict.lookup("wallModel") - ); + word wallModelType(dict.lookup("wallModel")); - Info<< "Selecting wallModel " - << wallModelType << endl; + Info<< "Selecting wallModel " << wallModelType << endl; dictionaryConstructorTable::iterator cstrIter = dictionaryConstructorTablePtr_->find(wallModelType); if (cstrIter == dictionaryConstructorTablePtr_->end()) { - FatalError - << "wallModel::New(const dictionary&, const spray&) : " << endl - << " unknown wallModelType type " - << wallModelType - << ", constructor not in hash table" << endl << endl - << " Valid wallModel types are :" << endl; - Info<< dictionaryConstructorTablePtr_->sortedToc() << abort(FatalError); + FatalErrorIn("wallModel::New(const dictionary&, const spray&)") + << "Unknown wallModelType type " << wallModelType + << ", constructor not in hash table" << nl << nl + << " Valid wallModel types are:" << nl + << dictionaryConstructorTablePtr_->sortedToc() + << abort(FatalError); } return autoPtr<wallModel>(cstrIter()(dict, U, sm)); diff --git a/src/lagrangian/dieselSpray/spraySubModels/wallModel/wallModel/wallModel.C b/src/lagrangian/dieselSpray/spraySubModels/wallModel/wallModel/wallModel.C index 8785ad0cf4c0d296bccb620f1f6b7fca85dc8b90..0fbe08c755a27d0e82b34b1dd3cf19a41e9f8795 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/wallModel/wallModel/wallModel.C +++ b/src/lagrangian/dieselSpray/spraySubModels/wallModel/wallModel/wallModel.C @@ -24,7 +24,6 @@ License \*---------------------------------------------------------------------------*/ -#include "error.H" #include "wallModel.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -41,9 +40,6 @@ defineRunTimeSelectionTable(wallModel, dictionary); // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -// Construct from components - wallModel::wallModel ( const dictionary& dict, @@ -62,6 +58,7 @@ wallModel::wallModel wallModel::~wallModel() {} + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/lagrangian/dieselSpray/spraySubModels/wallModel/wallModel/wallModel.H b/src/lagrangian/dieselSpray/spraySubModels/wallModel/wallModel/wallModel.H index fa9942f49b676bc84e05a15fa4ce740521420101..75bf1b302214fe7b41e7bfaf7f20a5b79d3dedda 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/wallModel/wallModel/wallModel.H +++ b/src/lagrangian/dieselSpray/spraySubModels/wallModel/wallModel/wallModel.H @@ -97,9 +97,8 @@ public: ); - // Destructor - - virtual ~wallModel(); + //- Destructor + virtual ~wallModel(); // Selector @@ -120,7 +119,6 @@ public: parcel& parcel, const label facei ) const = 0; - }; diff --git a/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloudI.H b/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloudI.H index 3529702fdd6b5591a6c588a0890b0a417dbcae2d..492bc98e18d260bb8effeb949ef0bde10a805f34 100644 --- a/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloudI.H +++ b/src/lagrangian/dsmc/clouds/Templates/DsmcCloud/DsmcCloudI.H @@ -24,6 +24,8 @@ License \*---------------------------------------------------------------------------*/ +#include "mathConstants.H" + // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class ParcelType> @@ -312,7 +314,7 @@ inline Foam::scalar Foam::DsmcCloud<ParcelType>::maxwellianAverageSpeed scalar mass ) const { - return 2.0*sqrt(2.0*kb*temperature/(mathematicalConstant::pi*mass)); + return 2.0*sqrt(2.0*kb*temperature/(constant::math::pi*mass)); } @@ -323,7 +325,7 @@ inline Foam::scalarField Foam::DsmcCloud<ParcelType>::maxwellianAverageSpeed scalar mass ) const { - return 2.0*sqrt(2.0*kb*temperature/(mathematicalConstant::pi*mass)); + return 2.0*sqrt(2.0*kb*temperature/(constant::math::pi*mass)); } diff --git a/src/lagrangian/dsmc/parcels/Templates/DsmcParcel/DsmcParcel.C b/src/lagrangian/dsmc/parcels/Templates/DsmcParcel/DsmcParcel.C index c52d92d20fef43858cfdd7075883003e6a043b76..287a0faf2769001e6213fb9acb3aa0da1bf32474 100644 --- a/src/lagrangian/dsmc/parcels/Templates/DsmcParcel/DsmcParcel.C +++ b/src/lagrangian/dsmc/parcels/Templates/DsmcParcel/DsmcParcel.C @@ -25,7 +25,6 @@ License \*---------------------------------------------------------------------------*/ #include "DsmcParcel.H" -#include "dimensionedConstants.H" // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // diff --git a/src/lagrangian/dsmc/parcels/Templates/DsmcParcel/DsmcParcel.H b/src/lagrangian/dsmc/parcels/Templates/DsmcParcel/DsmcParcel.H index af8e350e7fd8ec756ba9957eb74c4f00b9152157..d96d51584344609f421672f2f9e128450c3f7a5a 100644 --- a/src/lagrangian/dsmc/parcels/Templates/DsmcParcel/DsmcParcel.H +++ b/src/lagrangian/dsmc/parcels/Templates/DsmcParcel/DsmcParcel.H @@ -42,7 +42,6 @@ SourceFiles #include "IOstream.H" #include "autoPtr.H" #include "contiguous.H" -#include "mathematicalConstants.H" #include "DsmcCloud.H" diff --git a/src/lagrangian/dsmc/parcels/Templates/DsmcParcel/DsmcParcelI.H b/src/lagrangian/dsmc/parcels/Templates/DsmcParcel/DsmcParcelI.H index 239571ceaef99cb46f15003212de45ba09cbeb88..274d634b3f6d43f0046a582002dca68acb1b4a9e 100644 --- a/src/lagrangian/dsmc/parcels/Templates/DsmcParcel/DsmcParcelI.H +++ b/src/lagrangian/dsmc/parcels/Templates/DsmcParcel/DsmcParcelI.H @@ -24,6 +24,8 @@ License \*---------------------------------------------------------------------------*/ +#include "mathConstants.H" + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template <class ParcelType> @@ -101,7 +103,7 @@ template <class ParcelType> inline Foam::scalar Foam::DsmcParcel<ParcelType>::constantProperties::sigmaT() const { - return mathematicalConstant::pi*d_*d_; + return constant::math::pi*d_*d_; } diff --git a/src/lagrangian/dsmc/submodels/BinaryCollisionModel/LarsenBorgnakkeVariableHardSphere/LarsenBorgnakkeVariableHardSphere.C b/src/lagrangian/dsmc/submodels/BinaryCollisionModel/LarsenBorgnakkeVariableHardSphere/LarsenBorgnakkeVariableHardSphere.C index 69af3a855b3f2f60a81d80b1441a4028e7ac079b..3ab8c5511e1ccf6114859e479003e96b0de23443 100644 --- a/src/lagrangian/dsmc/submodels/BinaryCollisionModel/LarsenBorgnakkeVariableHardSphere/LarsenBorgnakkeVariableHardSphere.C +++ b/src/lagrangian/dsmc/submodels/BinaryCollisionModel/LarsenBorgnakkeVariableHardSphere/LarsenBorgnakkeVariableHardSphere.C @@ -25,6 +25,7 @@ License \*---------------------------------------------------------------------------*/ #include "LarsenBorgnakkeVariableHardSphere.H" +#include "mathConstants.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -156,7 +157,7 @@ Foam::scalar Foam::LarsenBorgnakkeVariableHardSphere<CloudType>::sigmaTcR // calculating cross section = pi*dPQ^2, where dPQ is from Bird, eq. 4.79 scalar sigmaTPQ = - mathematicalConstant::pi*dPQ*dPQ + constant::math::pi*dPQ*dPQ *pow(2.0*CloudType::kb*Tref_/(mR*cR*cR), omegaPQ - 0.5) /exp(Foam::lgamma(2.5 - omegaPQ)); @@ -252,7 +253,7 @@ void Foam::LarsenBorgnakkeVariableHardSphere<CloudType>::collide scalar sinTheta = sqrt(1.0 - cosTheta*cosTheta); - scalar phi = 2.0*mathematicalConstant::pi*rndGen.scalar01(); + scalar phi = constant::math::twoPi*rndGen.scalar01(); vector postCollisionRelU = cR diff --git a/src/lagrangian/dsmc/submodels/BinaryCollisionModel/VariableHardSphere/VariableHardSphere.C b/src/lagrangian/dsmc/submodels/BinaryCollisionModel/VariableHardSphere/VariableHardSphere.C index 29b389a65ae197b866edb2019069e3667be96c07..8afc892c84b7a67234154c845c21b347693b37e1 100644 --- a/src/lagrangian/dsmc/submodels/BinaryCollisionModel/VariableHardSphere/VariableHardSphere.C +++ b/src/lagrangian/dsmc/submodels/BinaryCollisionModel/VariableHardSphere/VariableHardSphere.C @@ -25,6 +25,7 @@ License \*---------------------------------------------------------------------------*/ #include "VariableHardSphere.H" +#include "mathConstants.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -90,7 +91,7 @@ Foam::scalar Foam::VariableHardSphere<CloudType>::sigmaTcR // calculating cross section = pi*dPQ^2, where dPQ is from Bird, eq. 4.79 scalar sigmaTPQ = - mathematicalConstant::pi*dPQ*dPQ + constant::math::pi*dPQ*dPQ *pow(2.0*CloudType::kb*Tref_/(mR*cR*cR), omegaPQ - 0.5) /exp(Foam::lgamma(2.5 - omegaPQ)); @@ -125,7 +126,7 @@ void Foam::VariableHardSphere<CloudType>::collide scalar sinTheta = sqrt(1.0 - cosTheta*cosTheta); - scalar phi = 2.0*mathematicalConstant::pi*rndGen.scalar01(); + scalar phi = constant::math::twoPi*rndGen.scalar01(); vector postCollisionRelU = cR diff --git a/src/lagrangian/dsmc/submodels/InflowBoundaryModel/FreeStream/FreeStream.C b/src/lagrangian/dsmc/submodels/InflowBoundaryModel/FreeStream/FreeStream.C index 0f0e135e4c9ab1042852cd547c000c9a00c2ae3c..5472e6c237b51f30e3c0badfc902d8ed9931a8f6 100644 --- a/src/lagrangian/dsmc/submodels/InflowBoundaryModel/FreeStream/FreeStream.C +++ b/src/lagrangian/dsmc/submodels/InflowBoundaryModel/FreeStream/FreeStream.C @@ -25,6 +25,7 @@ License \*---------------------------------------------------------------------------*/ #include "FreeStream.H" +#include "mathConstants.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -130,7 +131,7 @@ void Foam::FreeStream<CloudType>::inflow() Random& rndGen(cloud.rndGen()); - scalar sqrtPi = sqrt(mathematicalConstant::pi); + scalar sqrtPi = sqrt(constant::math::pi); label particlesInserted = 0; diff --git a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloudI.H b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloudI.H index ee38bfd4533d18b89b1c5f7dac6188deb4fb01c7..d99c35dcfb32673931336d8c28021c21e03bb77a 100644 --- a/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloudI.H +++ b/src/lagrangian/intermediate/clouds/Templates/ThermoCloud/ThermoCloudI.H @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ -#include "radiationConstants.H" +#include "physicoChemicalConstants.H" // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // @@ -229,7 +229,7 @@ Foam::ThermoCloud<ParcelType>::Ep() const Ep[cellI] += p.nParticle()*p.areaP()*pow4(p.T()); } - Ep *= epsilon*radiation::sigmaSB.value()/V; + Ep *= epsilon*constant::physicoChemical::sigma.value()/V; } return tEp; diff --git a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C index cf4dc68acb02f7bf0059016e305ce0516e0aa971..c7a4b464c5b977c10243e645e6e71215b136cb92 100644 --- a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C +++ b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.C @@ -25,7 +25,6 @@ License \*---------------------------------------------------------------------------*/ #include "KinematicParcel.H" -#include "dimensionedConstants.H" // * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * // diff --git a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.H b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.H index 049ab26bac5569c8f4bf98716ef9309ff10b5f9d..04615ab6055b7761fcfeaacf2683cf87039be00d 100644 --- a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.H +++ b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcel.H @@ -49,7 +49,6 @@ SourceFiles #include "autoPtr.H" #include "interpolationCellPoint.H" #include "contiguous.H" -#include "mathematicalConstants.H" #include "KinematicCloud.H" diff --git a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcelI.H b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcelI.H index e0d927153780af56e42ac11af2db03636bd583b0..30dc8ca1e7c22e1e2998674ede813bfe567acd0a 100644 --- a/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcelI.H +++ b/src/lagrangian/intermediate/parcels/Templates/KinematicParcel/KinematicParcelI.H @@ -24,6 +24,8 @@ License \*---------------------------------------------------------------------------*/ +#include "mathConstants.H" + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template <class ParcelType> @@ -349,7 +351,7 @@ template <class ParcelType> inline Foam::scalar Foam::KinematicParcel<ParcelType>::volume(const scalar d) const { - return mathematicalConstant::pi/6.0*pow3(d); + return constant::math::pi/6.0*pow3(d); } @@ -379,7 +381,7 @@ template <class ParcelType> inline Foam::scalar Foam::KinematicParcel<ParcelType>::areaS(const scalar d) const { - return mathematicalConstant::pi*d*d; + return constant::math::pi*d*d; } diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.C b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.C index 682cad335ad2c0c9ad36aa89c11f5799adfc47dc..a215242cbc7f95a4e4fde5357c66bde45d804ae8 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.C +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.C @@ -25,6 +25,7 @@ License \*---------------------------------------------------------------------------*/ #include "ReactingMultiphaseParcel.H" +#include "mathConstants.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -442,7 +443,7 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc } else { - this->d_ = cbrt(mass1/this->rho_*6.0/mathematicalConstant::pi); + this->d_ = cbrt(mass1/this->rho_*6.0/constant::math::pi); } } } diff --git a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C index 8d388e6d6692b86d40f297bdc67397b1afc6ad42..3d534e39d44e30131a0aebb96ce48264ac33bed6 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C +++ b/src/lagrangian/intermediate/parcels/Templates/ReactingParcel/ReactingParcel.C @@ -25,6 +25,7 @@ License \*---------------------------------------------------------------------------*/ #include "ReactingParcel.H" +#include "mathConstants.H" // * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * // @@ -257,7 +258,7 @@ void Foam::ReactingParcel<ParcelType>::calc } else { - this->d_ = cbrt(mass1/this->rho_*6.0/mathematicalConstant::pi); + this->d_ = cbrt(mass1/this->rho_*6.0/constant::math::pi); } } } diff --git a/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcel.C b/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcel.C index 6449b95dbacdf47a075589230aeb425d026f4bb1..8bd9a3a1268ef1e4e09f7847930a4a959b2e6374 100644 --- a/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcel.C +++ b/src/lagrangian/intermediate/parcels/Templates/ThermoParcel/ThermoParcel.C @@ -25,6 +25,7 @@ License \*---------------------------------------------------------------------------*/ #include "ThermoParcel.H" +#include "physicoChemicalConstants.H" // * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * // @@ -188,7 +189,7 @@ Foam::scalar Foam::ThermoParcel<ParcelType>::calcHeatTransfer { const scalarField& G = td.cloud().mesh().objectRegistry::lookupObject<volScalarField>("G"); - const scalar sigma = radiation::sigmaSB.value(); + const scalar sigma = constant::physicoChemical::sigma.value(); const scalar epsilon = td.constProps().epsilon0(); ap = diff --git a/src/lagrangian/intermediate/parcels/include/createTrackedReactingParcelTypes.H b/src/lagrangian/intermediate/parcels/include/createTrackedReactingParcelTypes.H deleted file mode 100644 index 95e46e3d6fed33aea291f3b0313ad727b8cff119..0000000000000000000000000000000000000000 --- a/src/lagrangian/intermediate/parcels/include/createTrackedReactingParcelTypes.H +++ /dev/null @@ -1,75 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2008-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 - -\*---------------------------------------------------------------------------*/ - -#ifndef createTrackedReactingParcelTypes_H -#define createTrackedReactingParcelTypes_H - -#include "createReactingParcelTypes.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#define createTrackedReactingParcelType(ParcelType) \ - \ - createTrackedReactingParcelThermoType \ - ( \ - ParcelType, \ - constGasThermoPhysics \ - ); \ - createTrackedReactingParcelThermoType \ - ( \ - ParcelType, \ - gasThermoPhysics \ - ); \ - createTrackedReactingParcelThermoType \ - ( \ - ParcelType, \ - icoPoly8ThermoPhysics \ - ); - - -#define createTrackedReactingParcelThermoType(ParcelType, ThermoType) \ - \ - createReactingParcelThermoType(ParcelType, ThermoType); \ - \ - typedef ParcelType<ThermoType> ParcelType##ThermoType; \ - \ - defineParcelTypeNameAndDebug \ - ( \ - TrackedReactingParcel<ParcelType##ThermoType>, \ - 0 \ - ); \ - defineTemplateTypeNameAndDebug \ - ( \ - TrackedReactingParcel<ParcelType##ThermoType>, \ - 0 \ - ); - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjection/ConeInjection.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjection/ConeInjection.C index b7dd300b45857b920c986b79e63726db8020f478..a6297af086ff0904f872be312e425afbf9adb2b7 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjection/ConeInjection.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjection/ConeInjection.C @@ -26,6 +26,7 @@ License #include "ConeInjection.H" #include "DataEntry.H" +#include "mathConstants.H" // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // @@ -200,7 +201,7 @@ void Foam::ConeInjection<CloudType>::setProperties ) { // set particle velocity - const scalar deg2Rad = mathematicalConstant::pi/180.0; + const scalar deg2Rad = constant::math::pi/180.0; scalar t = time - this->SOI_; scalar ti = thetaInner_().value(t); @@ -210,8 +211,7 @@ void Foam::ConeInjection<CloudType>::setProperties coneAngle *= deg2Rad; scalar alpha = sin(coneAngle); scalar dcorr = cos(coneAngle); - scalar beta = - 2.0*mathematicalConstant::pi*this->owner().rndGen().scalar01(); + scalar beta = constant::math::twoPi*this->owner().rndGen().scalar01(); vector normal = alpha*(tanVec1_*cos(beta) + tanVec2_*sin(beta)); vector dirVec = dcorr*direction_; diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjectionMP/ConeInjectionMP.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjectionMP/ConeInjectionMP.C index 8d1b57f2317001594da9a904742f28524bb93c6e..94a58b41c4f28bb2657357926e8b2ec8a55d00c4 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjectionMP/ConeInjectionMP.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ConeInjectionMP/ConeInjectionMP.C @@ -26,6 +26,7 @@ License #include "ConeInjectionMP.H" #include "DataEntry.H" +#include "mathConstants.H" // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // @@ -246,7 +247,7 @@ void Foam::ConeInjectionMP<CloudType>::setProperties // set particle velocity const label i = parcelI%positions_.size(); - const scalar deg2Rad = mathematicalConstant::pi/180.0; + const scalar deg2Rad = constant::math::pi/180.0; scalar t = time - this->SOI_; scalar ti = thetaInner_().value(t); @@ -256,8 +257,7 @@ void Foam::ConeInjectionMP<CloudType>::setProperties coneAngle *= deg2Rad; scalar alpha = sin(coneAngle); scalar dcorr = cos(coneAngle); - scalar beta = - 2.0*mathematicalConstant::pi*this->owner().rndGen().scalar01(); + scalar beta = constant::math::twoPi*this->owner().rndGen().scalar01(); vector normal = alpha*(tanVec1_[i]*cos(beta) + tanVec2_[i]*sin(beta)); vector dirVec = dcorr*axes_[i]; diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/FieldActivatedInjection/FieldActivatedInjection.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/FieldActivatedInjection/FieldActivatedInjection.C index 8429ca7ca6543c88b80066ec1bfde05d61063e82..d10171de3d4bcccd13dac895e886b18e1acb5f4b 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/FieldActivatedInjection/FieldActivatedInjection.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/FieldActivatedInjection/FieldActivatedInjection.C @@ -26,6 +26,7 @@ License #include "FieldActivatedInjection.H" #include "volFields.H" +#include "mathConstants.H" // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // @@ -129,7 +130,7 @@ Foam::FieldActivatedInjection<CloudType>::FieldActivatedInjection this->volumeTotal_ = nParcelsPerInjector_ *sum(pow3(diameters_)) - *mathematicalConstant::pi/6.0; + *constant::math::pi/6.0; // Set/cache the injector cells forAll(positions_, i) diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.C index 42134dcdeddd0165892180182f72211cd61f4ffd..ccb56a47671185a7b33ae3178b7321382d5eae6e 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/InjectionModel/InjectionModel.C @@ -25,7 +25,7 @@ License \*---------------------------------------------------------------------------*/ #include "InjectionModel.H" -#include "mathematicalConstants.H" +#include "mathConstants.H" #include "meshTools.H" // * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * // @@ -197,7 +197,7 @@ Foam::scalar Foam::InjectionModel<CloudType>::setNumberOfParticles { nP = volume/volumeTotal_ *massTotal_/rho - /(parcels*mathematicalConstant::pi/6.0*pow3(diameter)); + /(parcels*constant::math::pi/6.0*pow3(diameter)); break; } case pbNumber: diff --git a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ManualInjection/ManualInjection.C b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ManualInjection/ManualInjection.C index dab3cf6f13a61c9c6c669789158c590607dbff06..d0018efbd6a4942de5762cac4da45a767b9bc568 100644 --- a/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ManualInjection/ManualInjection.C +++ b/src/lagrangian/intermediate/submodels/Kinematic/InjectionModel/ManualInjection/ManualInjection.C @@ -25,6 +25,7 @@ License \*---------------------------------------------------------------------------*/ #include "ManualInjection.H" +#include "mathConstants.H" // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // @@ -105,7 +106,7 @@ Foam::ManualInjection<CloudType>::ManualInjection } // Determine volume of particles to inject - this->volumeTotal_ = sum(pow3(diameters_))*mathematicalConstant::pi/6.0; + this->volumeTotal_ = sum(pow3(diameters_))*constant::math::pi/6.0; } diff --git a/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/LiquidEvaporation/LiquidEvaporation.C b/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/LiquidEvaporation/LiquidEvaporation.C index 91274c245824fa7d76bd5caa3f43f8d77a49a129..324e4f80bc8f279af55a0da190caab3b796f92fc 100644 --- a/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/LiquidEvaporation/LiquidEvaporation.C +++ b/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/LiquidEvaporation/LiquidEvaporation.C @@ -26,6 +26,7 @@ License #include "LiquidEvaporation.H" #include "specie.H" +#include "mathConstants.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -148,7 +149,7 @@ void Foam::LiquidEvaporation<CloudType>::calculate scalarField Xc = calcXc(cellI); // droplet surface area - scalar A = mathematicalConstant::pi*sqr(d); + scalar A = constant::math::pi*sqr(d); // Reynolds number scalar Re = mag(Ur)*d/(nuc + ROOTVSMALL); diff --git a/src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloud.C b/src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloud.C index 113fb829421dc6bc1591701c4a54c4e4cd3f05d5..40ebfba487242eb91a7e8549d3091d32958e7cc1 100644 --- a/src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloud.C +++ b/src/lagrangian/molecularDynamics/molecule/moleculeCloud/moleculeCloud.C @@ -26,6 +26,7 @@ License #include "moleculeCloud.H" #include "fvMesh.H" +#include "mathConstants.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -623,20 +624,11 @@ void Foam::moleculeCloud::initialiseMolecules zoneDict.lookup("orientationAngles") ); - scalar phi - ( - orientationAngles.x()*mathematicalConstant::pi/180.0 - ); + scalar phi(orientationAngles.x()*constant::math::pi/180.0); - scalar theta - ( - orientationAngles.y()*mathematicalConstant::pi/180.0 - ); + scalar theta(orientationAngles.y()*constant::math::pi/180.0); - scalar psi - ( - orientationAngles.z()*mathematicalConstant::pi/180.0 - ); + scalar psi(orientationAngles.z()*constant::math::pi/180.0); const tensor R ( @@ -1002,11 +994,11 @@ void Foam::moleculeCloud::createMolecule { pi = equipartitionAngularMomentum(temperature, cP); - scalar phi(rndGen_.scalar01()*mathematicalConstant::twoPi); + scalar phi(rndGen_.scalar01()*constant::math::twoPi); - scalar theta(rndGen_.scalar01()*mathematicalConstant::twoPi); + scalar theta(rndGen_.scalar01()*constant::math::twoPi); - scalar psi(rndGen_.scalar01()*mathematicalConstant::twoPi); + scalar psi(rndGen_.scalar01()*constant::math::twoPi); Q = tensor ( diff --git a/src/lagrangian/molecularDynamics/potential/electrostaticPotential/electrostaticPotential.C b/src/lagrangian/molecularDynamics/potential/electrostaticPotential/electrostaticPotential.C index 1dff432741c4766ee3c86003af8a62f97fde9a4a..b6f5886f67bd54892a35a6abbc9712cf2d06185f 100644 --- a/src/lagrangian/molecularDynamics/potential/electrostaticPotential/electrostaticPotential.C +++ b/src/lagrangian/molecularDynamics/potential/electrostaticPotential/electrostaticPotential.C @@ -25,13 +25,13 @@ License \*---------------------------------------------------------------------------*/ #include "electrostaticPotential.H" -#include "mathematicalConstants.H" +#include "mathConstants.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::electrostaticPotential::electrostaticPotential() : - prefactor(1.0/(4.0 * mathematicalConstant::pi * 8.854187817e-12)) + prefactor(1.0/(4.0*constant::math::pi*8.854187817e-12)) {} // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // diff --git a/src/lagrangian/molecularDynamics/potential/pairPotential/basic/pairPotential.H b/src/lagrangian/molecularDynamics/potential/pairPotential/basic/pairPotential.H index 9be12ebd0c840a0ec84e5c75f25d036586eaa338..8b2742f23455e9624e95b954b5f0f87fb0602aef 100644 --- a/src/lagrangian/molecularDynamics/potential/pairPotential/basic/pairPotential.H +++ b/src/lagrangian/molecularDynamics/potential/pairPotential/basic/pairPotential.H @@ -43,7 +43,6 @@ SourceFiles #include "List.H" #include "Pair.H" #include "Switch.H" -#include "mathematicalConstants.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/lagrangian/molecularDynamics/potential/pairPotential/derived/coulomb/coulomb.C b/src/lagrangian/molecularDynamics/potential/pairPotential/derived/coulomb/coulomb.C index 7dd02320322136e8f29a46ed1e0a7010c46615db..f66971bf8ed8b931474ffd9f30c44db25f68cbe0 100644 --- a/src/lagrangian/molecularDynamics/potential/pairPotential/derived/coulomb/coulomb.C +++ b/src/lagrangian/molecularDynamics/potential/pairPotential/derived/coulomb/coulomb.C @@ -25,7 +25,7 @@ License \*---------------------------------------------------------------------------*/ #include "coulomb.H" -#include "mathematicalConstants.H" +#include "mathConstants.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -47,7 +47,7 @@ addToRunTimeSelectionTable ); scalar coulomb::oneOverFourPiEps0 = - 1.0/(4.0 * mathematicalConstant::pi * 8.854187817e-12); + 1.0/(4.0*constant::math::pi*8.854187817e-12); // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // diff --git a/src/lagrangian/molecularDynamics/potential/pairPotential/derived/dampedCoulomb/dampedCoulomb.C b/src/lagrangian/molecularDynamics/potential/pairPotential/derived/dampedCoulomb/dampedCoulomb.C index fd771e1854e3d44980b6dd86cfa1e746a4d40b78..5fbf371f6463e1921db0fc9283d02e4891b287a4 100644 --- a/src/lagrangian/molecularDynamics/potential/pairPotential/derived/dampedCoulomb/dampedCoulomb.C +++ b/src/lagrangian/molecularDynamics/potential/pairPotential/derived/dampedCoulomb/dampedCoulomb.C @@ -25,7 +25,7 @@ License \*---------------------------------------------------------------------------*/ #include "dampedCoulomb.H" -#include "mathematicalConstants.H" +#include "mathConstants.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -47,7 +47,7 @@ addToRunTimeSelectionTable ); scalar dampedCoulomb::oneOverFourPiEps0 = - 1.0/(4.0 * mathematicalConstant::pi * 8.854187817e-12); + 1.0/(4.0*constant::math::pi*8.854187817e-12); // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // diff --git a/src/meshTools/cellQuality/cellQuality.C b/src/meshTools/cellQuality/cellQuality.C index b1c47e8f10dd2debc2f77bf1891f7667a67e491d..19bef0e5face5e7cc6a162f1fc4d656e925cac56 100644 --- a/src/meshTools/cellQuality/cellQuality.C +++ b/src/meshTools/cellQuality/cellQuality.C @@ -26,7 +26,7 @@ License \*---------------------------------------------------------------------------*/ #include "cellQuality.H" -#include "mathematicalConstants.H" +#include "mathConstants.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -67,7 +67,7 @@ Foam::tmp<Foam::scalarField> Foam::cellQuality::nonOrthogonality() const scalar cosDDotS = Foam::acos(min(1.0, (d & s)/(mag(d)*magS + VSMALL))) - *180.0/mathematicalConstant::pi; + *180.0/constant::math::pi; result[own[faceI]] = max(cosDDotS, result[own[faceI]]); @@ -76,7 +76,7 @@ Foam::tmp<Foam::scalarField> Foam::cellQuality::nonOrthogonality() const forAll (mesh_.boundaryMesh(), patchI) { - const unallocLabelList& faceCells = + const unallocLabelList& faceCells = mesh_.boundaryMesh()[patchI].faceCells(); const vectorField::subField faceCentres = @@ -93,7 +93,7 @@ Foam::tmp<Foam::scalarField> Foam::cellQuality::nonOrthogonality() const scalar cosDDotS = Foam::acos(min(1.0, (d & s)/(mag(d)*magS + VSMALL))) - *180.0/mathematicalConstant::pi; + *180.0/constant::math::pi; result[faceCells[faceI]] = max(cosDDotS, result[faceCells[faceI]]); } @@ -139,7 +139,7 @@ Foam::tmp<Foam::scalarField> Foam::cellQuality::skewness() const cellCtrs[own[faceI]] + (dOwn/(dOwn+dNei))*(cellCtrs[nei[faceI]] - cellCtrs[own[faceI]]); - scalar skewness = + scalar skewness = mag(faceCtrs[faceI] - faceIntersection) /(mag(cellCtrs[nei[faceI]] - cellCtrs[own[faceI]]) + VSMALL); @@ -150,7 +150,7 @@ Foam::tmp<Foam::scalarField> Foam::cellQuality::skewness() const forAll (mesh_.boundaryMesh(), patchI) { - const unallocLabelList& faceCells = + const unallocLabelList& faceCells = mesh_.boundaryMesh()[patchI].faceCells(); const vectorField::subField faceCentres = @@ -167,10 +167,10 @@ Foam::tmp<Foam::scalarField> Foam::cellQuality::skewness() const cellCtrs[faceCells[faceI]] + ((faceCentres[faceI] - cellCtrs[faceCells[faceI]])&n)*n; - scalar skewness = + scalar skewness = mag(faceCentres[faceI] - faceIntersection) /( - mag(faceCentres[faceI] - cellCtrs[faceCells[faceI]]) + mag(faceCentres[faceI] - cellCtrs[faceCells[faceI]]) + VSMALL ); @@ -208,7 +208,7 @@ Foam::tmp<Foam::scalarField> Foam::cellQuality::faceNonOrthogonality() const scalar cosDDotS = Foam::acos(min(1.0, (d & s)/(mag(d)*magS + VSMALL))) - *180.0/mathematicalConstant::pi; + *180.0/constant::math::pi; result[faceI] = cosDDotS; } @@ -217,7 +217,7 @@ Foam::tmp<Foam::scalarField> Foam::cellQuality::faceNonOrthogonality() const forAll (mesh_.boundaryMesh(), patchI) { - const unallocLabelList& faceCells = + const unallocLabelList& faceCells = mesh_.boundaryMesh()[patchI].faceCells(); const vectorField::subField faceCentres = @@ -234,7 +234,7 @@ Foam::tmp<Foam::scalarField> Foam::cellQuality::faceNonOrthogonality() const scalar cosDDotS = Foam::acos(min(1.0, (d & s)/(mag(d)*magS + VSMALL))) - *180.0/mathematicalConstant::pi; + *180.0/constant::math::pi; result[globalFaceI++] = cosDDotS; } @@ -279,7 +279,7 @@ Foam::tmp<Foam::scalarField> Foam::cellQuality::faceSkewness() const cellCtrs[own[faceI]] + (dOwn/(dOwn+dNei))*(cellCtrs[nei[faceI]] - cellCtrs[own[faceI]]); - result[faceI] = + result[faceI] = mag(faceCtrs[faceI] - faceIntersection) /(mag(cellCtrs[nei[faceI]] - cellCtrs[own[faceI]]) + VSMALL); } @@ -289,7 +289,7 @@ Foam::tmp<Foam::scalarField> Foam::cellQuality::faceSkewness() const forAll (mesh_.boundaryMesh(), patchI) { - const unallocLabelList& faceCells = + const unallocLabelList& faceCells = mesh_.boundaryMesh()[patchI].faceCells(); const vectorField::subField faceCentres = @@ -306,10 +306,10 @@ Foam::tmp<Foam::scalarField> Foam::cellQuality::faceSkewness() const cellCtrs[faceCells[faceI]] + ((faceCentres[faceI] - cellCtrs[faceCells[faceI]])&n)*n; - result[globalFaceI++] = + result[globalFaceI++] = mag(faceCentres[faceI] - faceIntersection) /( - mag(faceCentres[faceI] - cellCtrs[faceCells[faceI]]) + mag(faceCentres[faceI] - cellCtrs[faceCells[faceI]]) + VSMALL ); } diff --git a/src/meshTools/coordinateSystems/coordinateRotation/EulerCoordinateRotation.C b/src/meshTools/coordinateSystems/coordinateRotation/EulerCoordinateRotation.C index 963d5084dbf3addb27b6f00a4d41155709bdda1b..f3afa950ae436b5c00db0c2cd5a5765a19ba95f5 100644 --- a/src/meshTools/coordinateSystems/coordinateRotation/EulerCoordinateRotation.C +++ b/src/meshTools/coordinateSystems/coordinateRotation/EulerCoordinateRotation.C @@ -27,7 +27,7 @@ License #include "EulerCoordinateRotation.H" #include "Switch.H" -#include "mathematicalConstants.H" +#include "mathConstants.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -59,9 +59,9 @@ void Foam::EulerCoordinateRotation::calcTransform if (inDegrees) { - phi *= mathematicalConstant::pi/180.0; - theta *= mathematicalConstant::pi/180.0; - psi *= mathematicalConstant::pi/180.0; + phi *= constant::math::pi/180.0; + theta *= constant::math::pi/180.0; + psi *= constant::math::pi/180.0; } tensor::operator= diff --git a/src/meshTools/coordinateSystems/coordinateRotation/STARCDCoordinateRotation.C b/src/meshTools/coordinateSystems/coordinateRotation/STARCDCoordinateRotation.C index 168a25ef798bdaca541d504d2a9e67e6005fb33e..1350ed3bc56a60b8023d50b61a2482badc8a3cff 100644 --- a/src/meshTools/coordinateSystems/coordinateRotation/STARCDCoordinateRotation.C +++ b/src/meshTools/coordinateSystems/coordinateRotation/STARCDCoordinateRotation.C @@ -27,7 +27,7 @@ License #include "STARCDCoordinateRotation.H" #include "Switch.H" -#include "mathematicalConstants.H" +#include "mathConstants.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -60,9 +60,9 @@ void Foam::STARCDCoordinateRotation::calcTransform if (inDegrees) { - x *= mathematicalConstant::pi/180.0; - y *= mathematicalConstant::pi/180.0; - z *= mathematicalConstant::pi/180.0; + x *= constant::math::pi/180.0; + y *= constant::math::pi/180.0; + z *= constant::math::pi/180.0; } tensor::operator= diff --git a/src/meshTools/coordinateSystems/cylindricalCS.C b/src/meshTools/coordinateSystems/cylindricalCS.C index 33a7455cc2d66819a6a2ccf6c707905863c5fa71..31d8456ec5d76c11c23eea6ebb2d32d4f4c28ac8 100644 --- a/src/meshTools/coordinateSystems/cylindricalCS.C +++ b/src/meshTools/coordinateSystems/cylindricalCS.C @@ -28,7 +28,7 @@ License #include "one.H" #include "Switch.H" -#include "mathematicalConstants.H" +#include "mathConstants.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -133,7 +133,7 @@ Foam::vector Foam::cylindricalCS::localToGlobal { scalar theta ( - local.y() * ( inDegrees_ ? mathematicalConstant::pi/180.0 : 1.0 ) + local.y()*(inDegrees_ ? constant::math::pi/180.0 : 1.0) ); return coordinateSystem::localToGlobal @@ -153,7 +153,7 @@ Foam::tmp<Foam::vectorField> Foam::cylindricalCS::localToGlobal scalarField theta = ( local.component(vector::Y) - * ( inDegrees_ ? mathematicalConstant::pi/180.0 : 1.0 ) + *(inDegrees_ ? constant::math::pi/180.0 : 1.0) ); @@ -181,7 +181,7 @@ Foam::vector Foam::cylindricalCS::globalToLocal ( lc.y(), lc.x() - ) * ( inDegrees_ ? 180.0/mathematicalConstant::pi : 1.0 ), + )*(inDegrees_ ? 180.0/constant::math::pi : 1.0), lc.z() ); } @@ -212,7 +212,7 @@ Foam::tmp<Foam::vectorField> Foam::cylindricalCS::globalToLocal ( lc.component(vector::Y), lc.component(vector::X) - ) * ( inDegrees_ ? 180.0/mathematicalConstant::pi : 1.0 ) + )*(inDegrees_ ? 180.0/constant::math::pi : 1.0) ); result.replace(vector::Z, lc.component(vector::Z)); diff --git a/src/meshTools/coordinateSystems/sphericalCS.C b/src/meshTools/coordinateSystems/sphericalCS.C index 0e3f2663e5b6799c9fe42e61ef7758216c41616e..e36d0e50a78b180cc25a794c4272e5fce8429def 100644 --- a/src/meshTools/coordinateSystems/sphericalCS.C +++ b/src/meshTools/coordinateSystems/sphericalCS.C @@ -28,7 +28,7 @@ License #include "one.H" #include "Switch.H" -#include "mathematicalConstants.H" +#include "mathConstants.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -135,12 +135,12 @@ Foam::vector Foam::sphericalCS::localToGlobal const scalar theta ( local.y() - * ( inDegrees_ ? mathematicalConstant::pi/180.0 : 1.0 ) + *(inDegrees_ ? constant::math::pi/180.0 : 1.0) ); const scalar phi ( local.z() - * ( inDegrees_ ? mathematicalConstant::pi/180.0 : 1.0 ) + *(inDegrees_ ? constant::math::pi/180.0 : 1.0) ); return coordinateSystem::localToGlobal @@ -161,12 +161,12 @@ Foam::tmp<Foam::vectorField> Foam::sphericalCS::localToGlobal const scalarField theta ( local.component(vector::Y) - * ( inDegrees_ ? mathematicalConstant::pi/180.0 : 1.0 ) + *(inDegrees_ ? constant::math::pi/180.0 : 1.0) ); const scalarField phi ( local.component(vector::Z) - * ( inDegrees_ ? mathematicalConstant::pi/180.0 : 1.0 ) + *(inDegrees_ ? constant::math::pi/180.0 : 1.0) ); vectorField lc(local.size()); @@ -193,11 +193,11 @@ Foam::vector Foam::sphericalCS::globalToLocal atan2 ( lc.y(), lc.x() - ) * ( inDegrees_ ? 180.0/mathematicalConstant::pi : 1.0 ), + )*(inDegrees_ ? 180.0/constant::math::pi : 1.0), acos ( lc.z()/(r + SMALL) - ) * ( inDegrees_ ? 180.0/mathematicalConstant::pi : 1.0 ) + )*(inDegrees_ ? 180.0/constant::math::pi : 1.0) ); } @@ -227,7 +227,7 @@ Foam::tmp<Foam::vectorField> Foam::sphericalCS::globalToLocal ( lc.component(vector::Y), lc.component(vector::X) - ) * ( inDegrees_ ? 180.0/mathematicalConstant::pi : 1.0 ) + )*(inDegrees_ ? 180.0/constant::math::pi : 1.0) ); result.replace @@ -236,7 +236,7 @@ Foam::tmp<Foam::vectorField> Foam::sphericalCS::globalToLocal acos ( lc.component(vector::Z)/(r + SMALL) - ) * ( inDegrees_ ? 180.0/mathematicalConstant::pi : 1.0 ) + )*(inDegrees_ ? 180.0/constant::math::pi : 1.0) ); return tresult; diff --git a/src/meshTools/coordinateSystems/toroidalCS.C b/src/meshTools/coordinateSystems/toroidalCS.C index 189e0e4979082509ad2211b952cc026ee833c3e8..c9d8c82f27011b341f7e97aae29b12fa4a8fd395 100644 --- a/src/meshTools/coordinateSystems/toroidalCS.C +++ b/src/meshTools/coordinateSystems/toroidalCS.C @@ -26,7 +26,7 @@ License #include "toroidalCS.H" #include "addToRunTimeSelectionTable.H" -#include "mathematicalConstants.H" +#include "mathConstants.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -72,8 +72,8 @@ Foam::vector Foam::toroidalCS::localToGlobal ) const { // Notation: r = local.x() - scalar theta = local.y()*mathematicalConstant::pi/180.0; - scalar phi = local.z()*mathematicalConstant::pi/180.0; + scalar theta = local.y()*constant::math::pi/180.0; + scalar phi = local.z()*constant::math::pi/180.0; scalar rprime = radius_ + local.x()*sin(phi); @@ -101,10 +101,10 @@ Foam::tmp<Foam::vectorField> Foam::toroidalCS::localToGlobal const scalarField r = local.component(vector::X); const scalarField theta = - local.component(vector::Y)*mathematicalConstant::pi/180.0; + local.component(vector::Y)*constant::math::pi/180.0; const scalarField phi = - local.component(vector::Z)*mathematicalConstant::pi/180.0; + local.component(vector::Z)*constant::math::pi/180.0; const scalarField rprime = radius_ + r*sin(phi); diff --git a/src/meshTools/primitiveMeshGeometry/primitiveMeshGeometry.C b/src/meshTools/primitiveMeshGeometry/primitiveMeshGeometry.C index 37f3c21fd0b26d5fb7fa1afc0af77ebf62465c72..56e878938e6a2e17817c65276ab796cf77bbb9c4 100644 --- a/src/meshTools/primitiveMeshGeometry/primitiveMeshGeometry.C +++ b/src/meshTools/primitiveMeshGeometry/primitiveMeshGeometry.C @@ -26,14 +26,13 @@ License #include "primitiveMeshGeometry.H" #include "pyramidPointFaceRef.H" - -namespace Foam -{ +#include "mathConstants.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -defineTypeNameAndDebug(primitiveMeshGeometry, 0); - +namespace Foam +{ + defineTypeNameAndDebug(primitiveMeshGeometry, 0); } @@ -273,7 +272,7 @@ bool Foam::primitiveMeshGeometry::checkFaceDotProduct // Severe nonorthogonality threshold const scalar severeNonorthogonalityThreshold = - ::cos(orthWarn/180.0*mathematicalConstant::pi); + ::cos(orthWarn/180.0*constant::math::pi); scalar minDDotS = GREAT; @@ -305,7 +304,7 @@ bool Foam::primitiveMeshGeometry::checkFaceDotProduct << " between cells " << own[faceI] << " and " << nei[faceI] << ": Angle = " - << ::acos(dDotS)/mathematicalConstant::pi*180.0 + << ::acos(dDotS)/constant::math::pi*180.0 << " deg." << endl; } @@ -331,7 +330,7 @@ bool Foam::primitiveMeshGeometry::checkFaceDotProduct << " between cells " << own[faceI] << " and " << nei[faceI] << ": Angle = " - << ::acos(dDotS)/mathematicalConstant::pi*180.0 + << ::acos(dDotS)/constant::math::pi*180.0 << " deg." << endl; } @@ -377,9 +376,9 @@ bool Foam::primitiveMeshGeometry::checkFaceDotProduct if (neiSize > 0) { 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; } } @@ -561,7 +560,7 @@ bool Foam::primitiveMeshGeometry::checkFaceSkewness cellCentres[own[faceI]]*dNei/(dOwn+dNei) + cellCentres[nei[faceI]]*dOwn/(dOwn+dNei); - scalar skewness = + scalar skewness = mag(faceCentres[faceI] - faceIntersection) / ( mag(cellCentres[nei[faceI]]-cellCentres[own[faceI]]) @@ -781,7 +780,7 @@ bool Foam::primitiveMeshGeometry::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(); @@ -862,7 +861,7 @@ bool Foam::primitiveMeshGeometry::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" @@ -1248,7 +1247,7 @@ bool Foam::primitiveMeshGeometry::checkCellDeterminant forAll(cFaces, cFaceI) { label faceI = cFaces[cFaceI]; - + scalar magArea = mag(faceAreas[faceI]); magAreaSum += magArea; @@ -1275,7 +1274,7 @@ bool Foam::primitiveMeshGeometry::checkCellDeterminant nWarnDet++; } } - + reduce(minDet, minOp<scalar>()); reduce(sumDet, sumOp<scalar>()); reduce(nSumDet, sumOp<label>()); diff --git a/src/meshTools/sets/cellSources/shapeToCell/shapeToCell.C b/src/meshTools/sets/cellSources/shapeToCell/shapeToCell.C index c8f23570d4d9adabdbf22a4f0add95fe7581c730..ba460f73813cd85078f7906c88974e6d144c1212 100644 --- a/src/meshTools/sets/cellSources/shapeToCell/shapeToCell.C +++ b/src/meshTools/sets/cellSources/shapeToCell/shapeToCell.C @@ -26,7 +26,7 @@ License #include "shapeToCell.H" #include "polyMesh.H" -#include "mathematicalConstants.H" +#include "mathConstants.H" #include "hexMatcher.H" #include "cellFeatures.H" @@ -57,7 +57,7 @@ Foam::topoSetSource::addToUsageTable Foam::shapeToCell::usage_ // Angle for polys to be considered splitHexes. Foam::scalar Foam::shapeToCell::featureCos = - Foam::cos(10.0 * mathematicalConstant::pi/180.0); + Foam::cos(10.0*Foam::constant::math::pi/180.0); // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/src/meshTools/triSurface/booleanOps/surfaceIntersection/edgeIntersections.C b/src/meshTools/triSurface/booleanOps/surfaceIntersection/edgeIntersections.C index 7ff2327196dd4b6242a20163dca54b3697725d6b..1666da5a8eb8c518f2fe14b2d6310bbc0d45298d 100644 --- a/src/meshTools/triSurface/booleanOps/surfaceIntersection/edgeIntersections.C +++ b/src/meshTools/triSurface/booleanOps/surfaceIntersection/edgeIntersections.C @@ -36,7 +36,7 @@ License #include "meshTools.H" #include "plane.H" #include "Random.H" -#include "mathematicalConstants.H" +#include "mathConstants.H" #include "treeBoundBox.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -44,7 +44,7 @@ License defineTypeNameAndDebug(Foam::edgeIntersections, 0); Foam::scalar Foam::edgeIntersections::alignedCos_ = - Foam::cos(89.0*Foam::mathematicalConstant::pi/180.0); + Foam::cos(89.0*Foam::constant::math::pi/180.0); // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/src/meshTools/triSurface/surfaceFeatures/surfaceFeatures.C b/src/meshTools/triSurface/surfaceFeatures/surfaceFeatures.C index af3be4840a9248cb807a0c57a22766cdb47577f0..dceed6d2c991f8f9f09bc00296a120d06b81ffd1 100644 --- a/src/meshTools/triSurface/surfaceFeatures/surfaceFeatures.C +++ b/src/meshTools/triSurface/surfaceFeatures/surfaceFeatures.C @@ -33,6 +33,7 @@ License #include "linePointRef.H" #include "OFstream.H" #include "IFstream.H" +#include "mathConstants.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -490,11 +491,7 @@ Foam::labelList Foam::surfaceFeatures::selectFeatureEdges void Foam::surfaceFeatures::findFeatures(const scalar includedAngle) { scalar minCos = - Foam::cos - ( - (180.0-includedAngle) - * mathematicalConstant::pi/180.0 - ); + Foam::cos((180.0 - includedAngle)*constant::math::pi/180.0); const labelListList& edgeFaces = surf_.edgeFaces(); const vectorField& faceNormals = surf_.faceNormals(); diff --git a/src/randomProcesses/Kmesh/Kmesh.C b/src/randomProcesses/Kmesh/Kmesh.C index 462e8fd6d5b3d88381310a00263027810f7deb32..93091114f19559168748584733ec1f07f564afd8 100644 --- a/src/randomProcesses/Kmesh/Kmesh.C +++ b/src/randomProcesses/Kmesh/Kmesh.C @@ -27,7 +27,7 @@ License #include "Kmesh.H" #include "polyMesh.H" #include "volFields.H" -#include "mathematicalConstants.H" +#include "mathConstants.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -57,14 +57,11 @@ Foam::Kmesh::Kmesh(const fvMesh& mesh) vectorField(mesh.V().size()), NN(vector::dim) { - const scalar pi = mathematicalConstant::pi; - const scalar twoPi = 2.0*pi; - boundBox box = mesh.bounds(); L = box.span(); vector cornerCellCentre = ::Foam::max(mesh.C().internalField()); - vector cellL = 2 * (box.max() - cornerCellCentre); + vector cellL = 2*(box.max() - cornerCellCentre); vector rdeltaByL; label nTot = 1; @@ -92,15 +89,15 @@ Foam::Kmesh::Kmesh(const fvMesh& mesh) for (i=0; i<NN[0]; i++) { - scalar k1 = (i - NN[0]/2)*twoPi/L[0]; + scalar k1 = (i - NN[0]/2)*constant::math::twoPi/L[0]; for (label j=0; j<NN[1]; j++) { - scalar k2 = (j - NN[1]/2)*twoPi/L[1]; + scalar k2 = (j - NN[1]/2)*constant::math::twoPi/L[1]; for (label k=0; k<NN[2]; k++) { - scalar k3 = (k - NN[2]/2)*twoPi/L[2]; + scalar k3 = (k - NN[2]/2)*constant::math::twoPi/L[2]; (*this)[rep(i, j, k, NN)] = vector(k1, k2, k3); } diff --git a/src/randomProcesses/fft/kShellIntegration.C b/src/randomProcesses/fft/kShellIntegration.C index e7dc77b0c56c34c8b8857e64b94e1887a8e49346..c007425c810dc4492310cabe2352ce5db739c33c 100644 --- a/src/randomProcesses/fft/kShellIntegration.C +++ b/src/randomProcesses/fft/kShellIntegration.C @@ -25,7 +25,7 @@ License \*---------------------------------------------------------------------------*/ #include "kShellIntegration.H" -#include "mathematicalConstants.H" +#include "mathConstants.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -51,12 +51,12 @@ graph kShellIntegration // spectra E(k). int E(k) dk is now the total energy in a box // of side 2pi - y *= sqr(x)*4.0*mathematicalConstant::pi; + y *= sqr(x)*4.0*constant::math::pi; // now scale this to get the energy in a box of side l0 - scalar l0(K.sizeOfBox()[0]*(scalar(K.nn()[0])/(scalar(K.nn()[0])-1.0))); - scalar factor = pow((l0/(2.0*mathematicalConstant::pi)),3.0); + scalar l0(K.sizeOfBox()[0]*(scalar(K.nn()[0])/(scalar(K.nn()[0]) - 1.0))); + scalar factor = pow3(l0/constant::math::twoPi); y *= factor; diff --git a/src/randomProcesses/noise/noiseFFT.C b/src/randomProcesses/noise/noiseFFT.C index e899ae0dceb01e071826a5ffcb6aa27ffcab0943..d843e871b72d97bdd38700b37e332aae3b645b68 100644 --- a/src/randomProcesses/noise/noiseFFT.C +++ b/src/randomProcesses/noise/noiseFFT.C @@ -28,7 +28,7 @@ License #include "IFstream.H" #include "DynamicList.H" #include "fft.H" -#include "mathematicalConstants.H" +#include "mathConstants.H" #include "SubField.H" // * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * * // @@ -170,7 +170,7 @@ Foam::tmp<Foam::scalarField> Foam::noiseFFT::Hanning(const label N) const scalar T = N*deltat_; - return 2*(0.5 - 0.5*cos(2*mathematicalConstant::pi*t/T)); + return 2*(0.5 - 0.5*cos(constant::math::twoPi*t/T)); } diff --git a/src/randomProcesses/turbulence/turbGen.C b/src/randomProcesses/turbulence/turbGen.C index 1a353d04104c42ab9a3ffcf0edaf940fc0e09801..6ac9c90804dab6e86a043e93e13d847f7800f6de 100644 --- a/src/randomProcesses/turbulence/turbGen.C +++ b/src/randomProcesses/turbulence/turbGen.C @@ -29,7 +29,7 @@ License #include "Kmesh.H" #include "primitiveFields.H" #include "Ek.H" -#include "mathematicalConstants.H" +#include "mathConstants.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -53,8 +53,6 @@ turbGen::turbGen(const Kmesh& k, const scalar EA, const scalar K0) // generate and return a velocity field vectorField turbGen::U() { - scalar pi2=2*mathematicalConstant::pi; - vectorField s(K.size()); scalarField rndPhases(K.size()); @@ -69,11 +67,13 @@ vectorField turbGen::U() s = Ek(Ea, k0, mag(K))*s; - complexVectorField up = fft::reverseTransform - ( - ComplexField(cos(pi2*rndPhases)*s, sin(pi2*rndPhases)*s), - K.nn() - ); + complexVectorField up = + fft::reverseTransform + ( + ComplexField(cos(constant::math::twoPi*rndPhases)*s, + sin(constant::math::twoPi*rndPhases)*s), + K.nn() + ); return ReImSum(up); } diff --git a/src/thermophysicalModels/laminarFlameSpeed/Gulders/Gulders.H b/src/thermophysicalModels/laminarFlameSpeed/Gulders/Gulders.H index be68a8c5dc82def95cfda3a352532c313aaf2577..4b133caa15ce458a3d79cce32e023602c412f55d 100644 --- a/src/thermophysicalModels/laminarFlameSpeed/Gulders/Gulders.H +++ b/src/thermophysicalModels/laminarFlameSpeed/Gulders/Gulders.H @@ -115,9 +115,8 @@ public: ); - // Destructor - - ~Gulders(); + //- Destructor + virtual ~Gulders(); // Member functions diff --git a/src/thermophysicalModels/laminarFlameSpeed/GuldersEGR/GuldersEGR.H b/src/thermophysicalModels/laminarFlameSpeed/GuldersEGR/GuldersEGR.H index c7c837e68a4658abdc3c4f4bf162bd02119e9836..0ae3402871b4198c3c061ac72be8db93defe058d 100644 --- a/src/thermophysicalModels/laminarFlameSpeed/GuldersEGR/GuldersEGR.H +++ b/src/thermophysicalModels/laminarFlameSpeed/GuldersEGR/GuldersEGR.H @@ -116,9 +116,8 @@ public: ); - // Destructor - - ~GuldersEGR(); + //- Destructor + virtual ~GuldersEGR(); // Member functions diff --git a/src/thermophysicalModels/laminarFlameSpeed/constant/constant.H b/src/thermophysicalModels/laminarFlameSpeed/constant/constant.H index dce52f5d14a4f5e6099fb24d3a44bc0ed727a7ad..a549adf7bffb6df6bd9152959a3e4a6d92450a9f 100644 --- a/src/thermophysicalModels/laminarFlameSpeed/constant/constant.H +++ b/src/thermophysicalModels/laminarFlameSpeed/constant/constant.H @@ -84,9 +84,8 @@ public: ); - // Destructor - - ~constant(); + //- Destructor + virtual ~constant(); // Member functions diff --git a/src/thermophysicalModels/laminarFlameSpeed/laminarFlameSpeed/laminarFlameSpeed.H b/src/thermophysicalModels/laminarFlameSpeed/laminarFlameSpeed/laminarFlameSpeed.H index f6568a3743365bbb821e114586d5623c30e21f0b..5ee73bdba37a1864ff35ff3adc5fa0c378d30329 100644 --- a/src/thermophysicalModels/laminarFlameSpeed/laminarFlameSpeed/laminarFlameSpeed.H +++ b/src/thermophysicalModels/laminarFlameSpeed/laminarFlameSpeed/laminarFlameSpeed.H @@ -121,9 +121,8 @@ public: ); - // Destructor - - virtual ~laminarFlameSpeed(); + //- Destructor + virtual ~laminarFlameSpeed(); // Member functions diff --git a/src/thermophysicalModels/radiation/Make/files b/src/thermophysicalModels/radiation/Make/files index 4e7fb1b11cbaab0879b316bb76a2bde95eb4fa0d..efa6279d30553c367e88b86c6d95f34f34956c76 100644 --- a/src/thermophysicalModels/radiation/Make/files +++ b/src/thermophysicalModels/radiation/Make/files @@ -1,6 +1,3 @@ -/* Radiation constants */ -radiationConstants/radiationConstants.C - /* Radiation model */ radiationModel/radiationModel/radiationModel.C radiationModel/radiationModel/newRadiationModel.C diff --git a/src/thermophysicalModels/radiation/derivedFvPatchFields/MarshakRadiation/MarshakRadiationMixedFvPatchScalarField.C b/src/thermophysicalModels/radiation/derivedFvPatchFields/MarshakRadiation/MarshakRadiationMixedFvPatchScalarField.C index d6fc4a378adf4a8f7dcb27bf37063bac4b942484..f599c447f64ef24e47ab82b12c9243a981a58b7c 100644 --- a/src/thermophysicalModels/radiation/derivedFvPatchFields/MarshakRadiation/MarshakRadiationMixedFvPatchScalarField.C +++ b/src/thermophysicalModels/radiation/derivedFvPatchFields/MarshakRadiation/MarshakRadiationMixedFvPatchScalarField.C @@ -31,7 +31,7 @@ License #include "fvc.H" #include "radiationModel.H" -#include "radiationConstants.H" +#include "physicoChemicalConstants.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -79,7 +79,7 @@ Foam::MarshakRadiationFvPatchScalarField::MarshakRadiationFvPatchScalarField const scalarField& Tp = patch().lookupPatchField<volScalarField, scalar>(TName_); - refValue() = 4.0*radiation::sigmaSB.value()*pow4(Tp); + refValue() = 4.0*constant::physicoChemical::sigma.value()*pow4(Tp); refGrad() = 0.0; if (dict.found("value")) @@ -152,7 +152,7 @@ void Foam::MarshakRadiationFvPatchScalarField::updateCoeffs() patch().lookupPatchField<volScalarField, scalar>(TName_); // Re-calc reference value - refValue() = 4.0*radiation::sigmaSB.value()*pow4(Tp); + refValue() = 4.0*constant::physicoChemical::sigma.value()*pow4(Tp); // Diffusion coefficient - created by radiation model's ::updateCoeffs() const scalarField& gamma = diff --git a/src/thermophysicalModels/radiation/derivedFvPatchFields/MarshakRadiationFixedT/MarshakRadiationFixedTMixedFvPatchScalarField.C b/src/thermophysicalModels/radiation/derivedFvPatchFields/MarshakRadiationFixedT/MarshakRadiationFixedTMixedFvPatchScalarField.C index d8e8957270d558e60ca0a214b4625d5fb4779d74..2620d111cba736293c376a37238fc4ca15e7affc 100644 --- a/src/thermophysicalModels/radiation/derivedFvPatchFields/MarshakRadiationFixedT/MarshakRadiationFixedTMixedFvPatchScalarField.C +++ b/src/thermophysicalModels/radiation/derivedFvPatchFields/MarshakRadiationFixedT/MarshakRadiationFixedTMixedFvPatchScalarField.C @@ -31,7 +31,7 @@ License #include "fvc.H" #include "radiationModel.H" -#include "radiationConstants.H" +#include "physicoChemicalConstants.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -79,7 +79,7 @@ MarshakRadiationFixedTMixedFvPatchScalarField Trad_("Trad", dict, p.size()), emissivity_(readScalar(dict.lookup("emissivity"))) { - refValue() = 4.0*radiation::sigmaSB.value()*pow4(Trad_); + refValue() = 4.0*constant::physicoChemical::sigma.value()*pow4(Trad_); refGrad() = 0.0; if (dict.found("value")) @@ -156,7 +156,7 @@ void Foam::MarshakRadiationFixedTMixedFvPatchScalarField::updateCoeffs() } // Re-calc reference value - refValue() = 4.0*radiation::sigmaSB.value()*pow4(Trad_); + refValue() = 4.0*constant::physicoChemical::sigma.value()*pow4(Trad_); // Diffusion coefficient - created by radiation model's ::updateCoeffs() const scalarField& gamma = diff --git a/src/thermophysicalModels/radiation/derivedFvPatchFields/greyDiffusiveRadiation/greyDiffusiveRadiationMixedFvPatchScalarField.C b/src/thermophysicalModels/radiation/derivedFvPatchFields/greyDiffusiveRadiation/greyDiffusiveRadiationMixedFvPatchScalarField.C index 80c3c2dc694839322ceaf2cfa40b1df6929fe6be..252bfbde1b4d8675175ccd87a78780e3515c0e7c 100644 --- a/src/thermophysicalModels/radiation/derivedFvPatchFields/greyDiffusiveRadiation/greyDiffusiveRadiationMixedFvPatchScalarField.C +++ b/src/thermophysicalModels/radiation/derivedFvPatchFields/greyDiffusiveRadiation/greyDiffusiveRadiationMixedFvPatchScalarField.C @@ -30,9 +30,9 @@ License #include "volFields.H" #include "fvDOM.H" -#include "radiationConstants.H" -#include "mathematicalConstants.H" +#include "constants.H" +using namespace Foam::constant; // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -84,8 +84,7 @@ greyDiffusiveRadiationMixedFvPatchScalarField patch().lookupPatchField<volScalarField, scalar>(TName_); refValue() = - emissivity_*4.0*radiation::sigmaSB.value()*pow4(Tp) - /Foam::mathematicalConstant::pi; + emissivity_*4.0*physicoChemical::sigma.value()*pow4(Tp)/math::pi; refGrad() = 0.0; @@ -199,9 +198,9 @@ updateCoeffs() refValue()[faceI] = ( Ir*(1.0 - emissivity_) - + emissivity_*radiation::sigmaSB.value()*pow4(Tp[faceI]) + + emissivity_*physicoChemical::sigma.value()*pow4(Tp[faceI]) ) - /mathematicalConstant::pi; + /constant::math::pi; } else diff --git a/src/thermophysicalModels/radiation/derivedFvPatchFields/wideBandDiffusiveRadiation/wideBandDiffusiveRadiationMixedFvPatchScalarField.C b/src/thermophysicalModels/radiation/derivedFvPatchFields/wideBandDiffusiveRadiation/wideBandDiffusiveRadiationMixedFvPatchScalarField.C index 08dbb061ed6e9c8b63b9032c0b7e33ce8e6ee277..6201dc66ed12a003f527a45fe5ec57b52301071c 100644 --- a/src/thermophysicalModels/radiation/derivedFvPatchFields/wideBandDiffusiveRadiation/wideBandDiffusiveRadiationMixedFvPatchScalarField.C +++ b/src/thermophysicalModels/radiation/derivedFvPatchFields/wideBandDiffusiveRadiation/wideBandDiffusiveRadiationMixedFvPatchScalarField.C @@ -31,8 +31,9 @@ License #include "fvDOM.H" #include "wideBandAbsorptionEmission.H" -#include "radiationConstants.H" -#include "mathematicalConstants.H" +#include "constants.H" + +using namespace Foam::constant; // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -84,8 +85,7 @@ wideBandDiffusiveRadiationMixedFvPatchScalarField patch().lookupPatchField<volScalarField, scalar>(TName_); refValue() = - emissivity_*4.0*radiation::sigmaSB.value()*pow4(Tp) - /Foam::mathematicalConstant::pi; + emissivity_*4.0*physicoChemical::sigma.value()*pow4(Tp)/math::pi; refGrad() = 0.0; if (dict.found("value")) @@ -198,7 +198,7 @@ updateCoeffs() Ir*(1.0 - emissivity_) + emissivity_*Eb[faceI] ) - /mathematicalConstant::pi; + /math::pi; } else { diff --git a/src/thermophysicalModels/radiation/radiationModel/P1/P1.C b/src/thermophysicalModels/radiation/radiationModel/P1/P1.C index dee96292927b8c0032fd5ab2400cfb77c1b78611..983e5cb0c7094b6d924502230e737d8e7f0a3fb5 100644 --- a/src/thermophysicalModels/radiation/radiationModel/P1/P1.C +++ b/src/thermophysicalModels/radiation/radiationModel/P1/P1.C @@ -30,8 +30,9 @@ License #include "absorptionEmissionModel.H" #include "scatterModel.H" -#include "mathematicalConstants.H" -#include "radiationConstants.H" +#include "constants.H" + +using namespace Foam::constant; // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -160,7 +161,7 @@ void Foam::radiation::P1::calculate() fvm::laplacian(gamma, G_) - fvm::Sp(a_, G_) == - - 4.0*(e_*radiation::sigmaSB*pow4(T_) + E_) + - 4.0*(e_*physicoChemical::sigma*pow4(T_) + E_) ); } @@ -180,7 +181,7 @@ Foam::tmp<Foam::volScalarField> Foam::radiation::P1::Rp() const IOobject::NO_WRITE, false ), - 4.0*absorptionEmission_->eCont()*radiation::sigmaSB + 4.0*absorptionEmission_->eCont()*physicoChemical::sigma ) ); } diff --git a/src/thermophysicalModels/radiation/radiationModel/fvDOM/blackBodyEmission/blackBodyEmission.C b/src/thermophysicalModels/radiation/radiationModel/fvDOM/blackBodyEmission/blackBodyEmission.C index bc21f3bfe0bfc027479aef047315895b4db061c4..29eb2a6513cb600a750710080044dbaef240ed37 100644 --- a/src/thermophysicalModels/radiation/radiationModel/fvDOM/blackBodyEmission/blackBodyEmission.C +++ b/src/thermophysicalModels/radiation/radiationModel/fvDOM/blackBodyEmission/blackBodyEmission.C @@ -25,7 +25,9 @@ License \*---------------------------------------------------------------------------*/ #include "blackBodyEmission.H" -#include "dimensionedConstants.H" +#include "physicoChemicalConstants.H" + +using namespace Foam::constant; // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -171,7 +173,7 @@ Foam::radiation::blackBodyEmission::blackBodyEmission IOobject::NO_READ, IOobject::NO_WRITE ), - radiation::sigmaSB*pow4(T) + physicoChemical::sigma*pow4(T) ) ); @@ -215,7 +217,7 @@ Foam::radiation::blackBodyEmission::EbDeltaLambdaT IOobject::NO_READ, IOobject::NO_WRITE ), - radiation::sigmaSB*pow4(T) + physicoChemical::sigma*pow4(T) ) ); diff --git a/src/thermophysicalModels/radiation/radiationModel/fvDOM/blackBodyEmission/blackBodyEmission.H b/src/thermophysicalModels/radiation/radiationModel/fvDOM/blackBodyEmission/blackBodyEmission.H index 958f6d6d7e0bb1a9e6a611e625ad42f6def1b957..ab0d2e27583b66e253d07cf74a9af0a65924744d 100644 --- a/src/thermophysicalModels/radiation/radiationModel/fvDOM/blackBodyEmission/blackBodyEmission.H +++ b/src/thermophysicalModels/radiation/radiationModel/fvDOM/blackBodyEmission/blackBodyEmission.H @@ -41,8 +41,6 @@ SourceFiles #include "volFields.H" #include "dimensionedScalar.H" -#include "mathematicalConstants.H" -#include "radiationConstants.H" #include "interpolationTable.H" #include "Vector2D.H" diff --git a/src/thermophysicalModels/radiation/radiationModel/fvDOM/fvDOM/fvDOM.C b/src/thermophysicalModels/radiation/radiationModel/fvDOM/fvDOM/fvDOM.C index bfcf1309e881dd41bea7d8f97671ca315f8d2236..81f8457ba4606ef70acb9748aca658ec28c5a9a1 100644 --- a/src/thermophysicalModels/radiation/radiationModel/fvDOM/fvDOM/fvDOM.C +++ b/src/thermophysicalModels/radiation/radiationModel/fvDOM/fvDOM/fvDOM.C @@ -30,8 +30,9 @@ License #include "absorptionEmissionModel.H" #include "scatterModel.H" -#include "mathematicalConstants.H" -#include "radiationConstants.H" +#include "constants.H" + +using namespace Foam::constant; // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -135,8 +136,8 @@ Foam::radiation::fvDOM::fvDOM(const volScalarField& T) { nRay_ = 4*nPhi_*nTheta_; IRay_.setSize(nRay_); - scalar deltaPhi = mathematicalConstant::pi/(2.0*nPhi_); - scalar deltaTheta = mathematicalConstant::pi/nTheta_; + scalar deltaPhi = math::pi/(2.0*nPhi_); + scalar deltaTheta = math::pi/nTheta_; label i = 0; for (label n = 1; n <= nTheta_; n++) { @@ -168,11 +169,11 @@ Foam::radiation::fvDOM::fvDOM(const volScalarField& T) { if (mesh_.nSolutionD() == 2) //2D (X & Y) { - scalar thetai = mathematicalConstant::pi/2.0; - scalar deltaTheta = mathematicalConstant::pi; + scalar thetai = math::piByTwo; + scalar deltaTheta = math::pi; nRay_ = 4*nPhi_; IRay_.setSize(nRay_); - scalar deltaPhi = mathematicalConstant::pi/(2.0*nPhi_); + scalar deltaPhi = math::pi/(2.0*nPhi_); label i = 0; for (label m = 1; m <= 4*nPhi_; m++) { @@ -198,11 +199,11 @@ Foam::radiation::fvDOM::fvDOM(const volScalarField& T) } else //1D (X) { - scalar thetai = mathematicalConstant::pi/2.0; - scalar deltaTheta = mathematicalConstant::pi; + scalar thetai = math::piByTwo; + scalar deltaTheta = math::pi; nRay_ = 2; IRay_.setSize(nRay_); - scalar deltaPhi = mathematicalConstant::pi; + scalar deltaPhi = math::pi; label i = 0; for (label m = 1; m <= 2; m++) { @@ -329,7 +330,7 @@ Foam::tmp<Foam::volScalarField> Foam::radiation::fvDOM::Rp() const IOobject::NO_WRITE, false ), - 4.0*a_*radiation::sigmaSB //absorptionEmission_->a() + 4.0*a_*physicoChemical::sigma //absorptionEmission_->a() ) ); } diff --git a/src/thermophysicalModels/radiation/radiationModel/fvDOM/radiativeIntensityRay/radiativeIntensityRay.C b/src/thermophysicalModels/radiation/radiationModel/fvDOM/radiativeIntensityRay/radiativeIntensityRay.C index ff22c6335933fb2ba307b82cfb7093432b4f7c30..cb94ca5f9da71544d7d06787a85902d41fc546af 100644 --- a/src/thermophysicalModels/radiation/radiationModel/fvDOM/radiativeIntensityRay/radiativeIntensityRay.C +++ b/src/thermophysicalModels/radiation/radiationModel/fvDOM/radiativeIntensityRay/radiativeIntensityRay.C @@ -30,8 +30,7 @@ License #include "absorptionEmissionModel.H" #include "scatterModel.H" -#include "mathematicalConstants.H" -#include "radiationConstants.H" +#include "mathConstants.H" #include "radiationModel.H" #include "Vector2D.H" @@ -203,7 +202,7 @@ Foam::scalar Foam::radiation::radiativeIntensityRay::correct() fvm::div(Ji, ILambda_[lambdaI], "div(Ji,Ii_h)") + fvm::Sp(k*omega_, ILambda_[lambdaI]) == - 1.0/Foam::mathematicalConstant::pi + 1.0/constant::math::pi *( k*omega_*blackBody_.bLambda(lambdaI) + absorptionEmission_.ECont(lambdaI) diff --git a/src/thermophysicalModels/radiation/radiationModel/noRadiation/noRadiation.C b/src/thermophysicalModels/radiation/radiationModel/noRadiation/noRadiation.C index fc6fbc549a3e3237ba7238436db5dbc8f93e2d8f..8ef1082187e1029aed294158dc8f50717e2980de 100644 --- a/src/thermophysicalModels/radiation/radiationModel/noRadiation/noRadiation.C +++ b/src/thermophysicalModels/radiation/radiationModel/noRadiation/noRadiation.C @@ -24,11 +24,9 @@ License \*---------------------------------------------------------------------------*/ -#include "error.H" - #include "noRadiation.H" #include "addToRunTimeSelectionTable.H" -#include "radiationConstants.H" +#include "physicoChemicalConstants.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -94,7 +92,7 @@ Foam::tmp<Foam::volScalarField> Foam::radiation::noRadiation::Rp() const dimensionedScalar ( "Rp", - radiation::sigmaSB.dimensions()/dimLength, + constant::physicoChemical::sigma.dimensions()/dimLength, 0.0 ) ) diff --git a/src/thermophysicalModels/specie/specie/specie.C b/src/thermophysicalModels/specie/specie/specie.C index 03dd826197b7ea0d3358dc6a34fd7a48d4fe2f35..49709d4f36a3d39e7cde52020535a71f98165fc0 100644 --- a/src/thermophysicalModels/specie/specie/specie.C +++ b/src/thermophysicalModels/specie/specie/specie.C @@ -26,18 +26,18 @@ License #include "specie.H" #include "IOstreams.H" -#include "dimensionedConstants.H" +#include "constants.H" -/* * * * * * * * * * * * * public constants * * * * * * * * * * * * */ +/* * * * * * * * * * * * * * * public constants * * * * * * * * * * * * * * */ //- Universal gas constant (default in [J/(kmol K)]) -const Foam::scalar Foam::specie::RR = dimensionedConstant("R", 8314.51); +const Foam::scalar Foam::specie::RR = constant::physicoChemical::R.value()*1000; //- Standard pressure (default in [Pa]) -const Foam::scalar Foam::specie::Pstd = dimensionedConstant("Pstd", 1.0e5); +const Foam::scalar Foam::specie::Pstd = constant::standard::Pstd.value(); //- Standard temperature (default in [K]) -const Foam::scalar Foam::specie::Tstd = dimensionedConstant("Tstd", 298.15); +const Foam::scalar Foam::specie::Tstd = constant::standard::Tstd.value(); // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // diff --git a/src/transportModels/interfaceProperties/interfaceProperties.C b/src/transportModels/interfaceProperties/interfaceProperties.C index 53c4e904964c37a6c294c155860353f2bd144bc4..22f4da24b3e31445d46ee80963dc7419bb016d75 100644 --- a/src/transportModels/interfaceProperties/interfaceProperties.C +++ b/src/transportModels/interfaceProperties/interfaceProperties.C @@ -26,7 +26,7 @@ License #include "interfaceProperties.H" #include "alphaContactAngleFvPatchScalarField.H" -#include "mathematicalConstants.H" +#include "mathConstants.H" #include "surfaceInterpolate.H" #include "fvcDiv.H" #include "fvcGrad.H" @@ -35,7 +35,7 @@ License // * * * * * * * * * * * * * * * Static Member Data * * * * * * * * * * * * // const Foam::scalar Foam::interfaceProperties::convertToRad = - Foam::mathematicalConstant::pi/180.0; + Foam::constant::math::pi/180.0; // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // diff --git a/tutorials/compressible/rhoCentralFoam/biconic25-55Run35/datToFoam/datToFoam.C b/tutorials/compressible/rhoCentralFoam/biconic25-55Run35/datToFoam/datToFoam.C index 23a048a4d68141a3c90a93f6832a94205ca2316a..82454b8c2eb37ac89d03e5c9f197352672619533 100644 --- a/tutorials/compressible/rhoCentralFoam/biconic25-55Run35/datToFoam/datToFoam.C +++ b/tutorials/compressible/rhoCentralFoam/biconic25-55Run35/datToFoam/datToFoam.C @@ -43,7 +43,7 @@ Description #include "cellShape.H" #include "cellModeller.H" #include "mergePoints.H" -#include "mathematicalConstants.H" +#include "mathConstants.H" using namespace Foam; @@ -128,7 +128,7 @@ int main(int argc, char *argv[]) fileName pointsFile(runTime.constantPath()/"points.tmp"); OFstream pFile(pointsFile); - scalar a(0.1*mathematicalConstant::pi/180.0); + scalar a(0.1*constant::math::pi/180.0); tensor rotateZ = tensor (