From 7eb40198779ee0f5be79e5a889f65e9ad66a05cf Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 25 Aug 2009 17:57:06 +0100 Subject: [PATCH 1/8] improved pdfPlot utility --- .../miscellaneous/pdfPlot/Make/options | 8 ++-- .../miscellaneous/pdfPlot/createFields.H | 19 ++------ .../miscellaneous/pdfPlot/pdfDict | 35 ++++++++++++++ .../miscellaneous/pdfPlot/pdfPlot.C | 46 +++++++++++-------- 4 files changed, 72 insertions(+), 36 deletions(-) create mode 100644 applications/utilities/postProcessing/miscellaneous/pdfPlot/pdfDict diff --git a/applications/utilities/postProcessing/miscellaneous/pdfPlot/Make/options b/applications/utilities/postProcessing/miscellaneous/pdfPlot/Make/options index f248721341..a140053895 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 c9255fc4cf..2dc6e7af70 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 nIntervals(readLabel(pdfDictionary.lookup("nIntervals"))); - label nSamples - ( - readLabel(pdfDictionary.lookup("nSamples")) - ); + label nSamples(readLabel(pdfDictionary.lookup("nSamples"))); - label samples[nIntervals]; - - for(label i=0;i p - ( - pdf::New(pdfDictionary, rndGen) - ); + autoPtr p(pdf::New(pdfDictionary, rndGen)); scalar xMin = p->minValue(); - scalar xMax = p->maxValue(); - for(label i=0;isample(); - 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;itype(), pdfPath, runTime.graphFormat()); + Info << "End\n" << endl; return 0; From 0ce344968133d0d45a4fd46001f3083f5c0d04d9 Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 25 Aug 2009 18:38:54 +0100 Subject: [PATCH 2/8] improved setFields utility --- .../preProcessing/setFields/setFields.C | 65 +++++++++---------- 1 file changed, 29 insertions(+), 36 deletions(-) diff --git a/applications/utilities/preProcessing/setFields/setFields.C b/applications/utilities/preProcessing/setFields/setFields.C index 5ba3727b39..d164709504 100644 --- a/applications/utilities/preProcessing/setFields/setFields.C +++ b/applications/utilities/preProcessing/setFields/setFields.C @@ -37,14 +37,22 @@ Description using namespace Foam; -template -void setFieldType +template +bool setFieldType ( + const word& fieldTypeDesc, const fvMesh& mesh, const labelList& selectedCells, Istream& fieldValueStream ) { + typedef GeometricField 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 - ( - pTraits(fieldValueStream) - ) - ); + const Type& value = pTraits(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 - (mesh_, selectedCells_, fieldValues); - } - else if (fieldType == "volVectorFieldValue") - { - setFieldType - (mesh_, selectedCells_, fieldValues); - } - else if (fieldType == "volSphericalTensorFieldValue") - { - setFieldType - (mesh_, selectedCells_, fieldValues); - } - else if (fieldType == "volSymmTensorFieldValue") - { - setFieldType - (mesh_, selectedCells_, fieldValues); - } - else if (fieldType == "volTensorFieldValue") - { - setFieldType - (mesh_, selectedCells_, fieldValues); - } - else + if + ( + !( + setFieldType + (fieldType, mesh_, selectedCells_, fieldValues) + || setFieldType + (fieldType, mesh_, selectedCells_, fieldValues) + || setFieldType + (fieldType, mesh_, selectedCells_, fieldValues) + || setFieldType + (fieldType, mesh_, selectedCells_, fieldValues) + || setFieldType + (fieldType, mesh_, selectedCells_, fieldValues) + ) + ) { WarningIn("setField::iNew::operator()(Istream& is)") << "field type " << fieldType << " not currently supported" From 45ca783a4f6c255989c9d8295a4e9572dc698a38 Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 26 Aug 2009 10:21:51 +0100 Subject: [PATCH 3/8] use token::END_STATEMENT instead of ; --- .../utilities/thermophysical/chemkinToFoam/chemkinToFoam.C | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/applications/utilities/thermophysical/chemkinToFoam/chemkinToFoam.C b/applications/utilities/thermophysical/chemkinToFoam/chemkinToFoam.C index ce8a3e16f4..18befde0af 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; From 871d2afcdda5b380fadef6863f899392e4630ad7 Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 26 Aug 2009 12:46:48 +0100 Subject: [PATCH 4/8] removing old file --- .../createTrackedReactingParcelTypes.H | 75 ------------------- 1 file changed, 75 deletions(-) delete mode 100644 src/lagrangian/intermediate/parcels/include/createTrackedReactingParcelTypes.H diff --git a/src/lagrangian/intermediate/parcels/include/createTrackedReactingParcelTypes.H b/src/lagrangian/intermediate/parcels/include/createTrackedReactingParcelTypes.H deleted file mode 100644 index 95e46e3d6f..0000000000 --- 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 ParcelType##ThermoType; \ - \ - defineParcelTypeNameAndDebug \ - ( \ - TrackedReactingParcel, \ - 0 \ - ); \ - defineTemplateTypeNameAndDebug \ - ( \ - TrackedReactingParcel, \ - 0 \ - ); - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // From a347e840b1459feb7c0c4bb845e7d093eead5661 Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 26 Aug 2009 17:52:49 +0100 Subject: [PATCH 5/8] code clean-up - still not great... --- .../commonRailInjector/commonRailInjector.C | 124 ++++++---- .../commonRailInjector/commonRailInjector.H | 20 +- .../definedInjector/definedInjector.C | 90 ++++--- .../definedInjector/definedInjector.H | 25 +- .../dieselSpray/injector/injector/injector.C | 5 +- .../dieselSpray/injector/injector/injector.H | 4 +- .../injector/injectorType/injectorType.C | 34 ++- .../injector/injectorType/injectorType.H | 32 ++- .../multiHoleInjector/multiHoleInjector.C | 117 ++++++---- .../multiHoleInjector/multiHoleInjector.H | 14 +- .../injector/swirlInjector/swirlInjector.C | 56 ++++- .../injector/swirlInjector/swirlInjector.H | 21 +- .../injector/unitInjector/unitInjector.C | 19 +- .../injector/unitInjector/unitInjector.H | 18 +- src/lagrangian/dieselSpray/parcel/parcel.C | 1 - .../dieselSpray/spray/findInjectorCell.H | 17 +- .../dieselSpray/spray/sprayFunctions.C | 11 +- .../atomizationModel/LISA/LISA.C | 207 ++++++++-------- .../atomizationModel/LISA/LISA.H | 14 +- .../atomizationModel/atomizationModel.H | 17 +- .../blobsSheetAtomization.C | 24 +- .../blobsSheetAtomization.H | 16 +- .../noAtomization/noAtomization.H | 15 +- .../spraySubModels/breakupModel/ETAB/ETAB.C | 23 +- .../spraySubModels/breakupModel/ETAB/ETAB.H | 13 +- .../spraySubModels/breakupModel/SHF/SHF.C | 87 +++---- .../spraySubModels/breakupModel/SHF/SHF.H | 13 +- .../spraySubModels/breakupModel/TAB/TAB.C | 51 ++-- .../spraySubModels/breakupModel/TAB/TAB.H | 19 +- .../breakupModel/breakupModel/breakupModel.C | 26 +-- .../breakupModel/breakupModel/breakupModel.H | 18 +- .../breakupModel/newBreakupModel.C | 20 +- .../breakupModel/noBreakup/noBreakup.H | 13 +- .../breakupModel/reitzDiwakar/reitzDiwakar.C | 51 +--- .../breakupModel/reitzDiwakar/reitzDiwakar.H | 22 +- .../breakupModel/reitzKHRT/reitzKHRT.C | 11 +- .../breakupModel/reitzKHRT/reitzKHRT.H | 13 +- .../ORourke/ORourkeCollisionModel.C | 21 +- .../ORourke/ORourkeCollisionModel.H | 18 +- .../collisionModel/ORourke/sameCell.H | 4 +- .../collisionModel/collisionModel.H | 5 +- .../collisionModel/noCollision/noCollision.H | 7 +- .../trajectoryModel/trajectoryModel.C | 14 +- .../trajectoryModel/trajectoryModel.H | 10 +- .../dispersionLESModel/dispersionLESModel.H | 13 +- .../dispersionModel/dispersionModel.H | 13 +- .../dispersionRASModel/dispersionRASModel.H | 11 +- .../gradientDispersionRAS.H | 15 +- .../noDispersion/noDispersion.C | 6 +- .../noDispersion/noDispersion.H | 15 +- .../stochasticDispersionRAS.H | 17 +- .../dragModel/dragModel/dragModel.C | 8 +- .../dragModel/dragModel/dragModel.H | 10 +- .../dragModel/dragModel/newDragModel.C | 23 +- .../dragModel/noDragModel/noDragModel.C | 7 +- .../dragModel/noDragModel/noDragModel.H | 13 +- .../standardDragModel/standardDragModel.C | 18 +- .../standardDragModel/standardDragModel.H | 14 +- .../RutlandFlashBoil/RutlandFlashBoil.C | 198 ++++++++-------- .../RutlandFlashBoil/RutlandFlashBoil.H | 14 +- .../evaporationModel/evaporationModel.C | 8 +- .../evaporationModel/evaporationModel.H | 22 +- .../evaporationModel/newEvaporationModel.C | 23 +- .../noEvaporation/noEvaporation.C | 10 +- .../noEvaporation/noEvaporation.H | 12 +- .../saturateEvaporationModel.C | 34 +-- .../saturateEvaporationModel.H | 35 ++- .../standardEvaporationModel.C | 55 +++-- .../standardEvaporationModel.H | 34 ++- .../RanzMarshall/RanzMarshall.C | 23 +- .../RanzMarshall/RanzMarshall.H | 14 +- .../heatTransferModel/heatTransferModel.C | 9 +- .../heatTransferModel/heatTransferModel.H | 19 +- .../heatTransferModel/newHeatTransferModel.C | 20 +- .../noHeatTransfer/noHeatTransfer.C | 19 +- .../noHeatTransfer/noHeatTransfer.H | 15 +- .../injectorModel/Chomiak/Chomiak.C | 52 +++-- .../injectorModel/Chomiak/Chomiak.H | 22 +- .../blobsSwirl/blobsSwirlInjector.C | 191 ++++++++------- .../blobsSwirl/blobsSwirlInjector.H | 35 ++- .../injectorModel/constant/constInjector.C | 71 +++--- .../injectorModel/constant/constInjector.H | 34 +-- .../definedHollowCone/definedHollowCone.C | 92 ++++---- .../definedHollowCone/definedHollowCone.H | 28 +-- .../definedPressureSwirl.C | 220 ++++++++++-------- .../definedPressureSwirl.H | 36 +-- .../injectorModel/hollowCone/hollowCone.C | 74 +++--- .../injectorModel/hollowCone/hollowCone.H | 31 +-- .../injectorModel/injectorModel.C | 2 + .../injectorModel/injectorModel.H | 35 +-- .../injectorModel/newInjectorModel.C | 18 +- .../pressureSwirl/pressureSwirlInjector.C | 111 +++++---- .../pressureSwirl/pressureSwirlInjector.H | 46 ++-- .../wallModel/reflectParcel/reflectParcel.C | 22 +- .../wallModel/reflectParcel/reflectParcel.H | 21 +- .../wallModel/removeParcel/removeParcel.H | 14 +- .../wallModel/wallModel/newWallModel.C | 21 +- .../wallModel/wallModel/wallModel.C | 5 +- .../wallModel/wallModel/wallModel.H | 6 +- 99 files changed, 1573 insertions(+), 1721 deletions(-) diff --git a/src/lagrangian/dieselSpray/injector/commonRailInjector/commonRailInjector.C b/src/lagrangian/dieselSpray/injector/commonRailInjector/commonRailInjector.C index 49b5b4ad3a..9800170b70 100644 --- a/src/lagrangian/dieselSpray/injector/commonRailInjector/commonRailInjector.C +++ b/src/lagrangian/dieselSpray/injector/commonRailInjector/commonRailInjector.C @@ -32,17 +32,15 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { + defineTypeNameAndDebug(commonRailInjector, 0); -defineTypeNameAndDebug(commonRailInjector, 0); - -addToRunTimeSelectionTable -( - injectorType, - commonRailInjector, - dictionary -); + addToRunTimeSelectionTable + ( + injectorType, + commonRailInjector, + dictionary + ); } -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -71,38 +69,58 @@ Foam::commonRailInjector::commonRailInjector averageParcelMass_(mass_/nParcels_), pressureIndependentVelocity_(false) { - // convert CA to real time forAll(massFlowRateProfile_, i) { - massFlowRateProfile_[i][0] = t.userTimeToTime(massFlowRateProfile_[i][0]); + massFlowRateProfile_[i][0] = + t.userTimeToTime(massFlowRateProfile_[i][0]); velocityProfile_[i][0] = t.userTimeToTime(massFlowRateProfile_[i][0]); } forAll(injectionPressureProfile_, i) { - injectionPressureProfile_[i][0] = t.userTimeToTime(injectionPressureProfile_[i][0]); + injectionPressureProfile_[i][0] = + t.userTimeToTime(injectionPressureProfile_[i][0]); } - if (mag(injectionPressureProfile_[0][0]-massFlowRateProfile_[0][0]) > SMALL) + if + ( + mag(injectionPressureProfile_[0][0] - massFlowRateProfile_[0][0]) + > SMALL + ) { - FatalError << "commonRailInjector::commonRailInjector(const time& t, const dictionary dict) " << endl - << " start-time entries for injectionPressureProfile and massFlowRateProfile do no match" - << abort(FatalError); + FatalErrorIn + ( + "commonRailInjector::commonRailInjector" + "(const time& t, const dictionary dict)" + ) << " start-time entries for injectionPressureProfile and " + << "massFlowRateProfile do no match" + << abort(FatalError); } - Info << "injectionPressureProfile_.size() = " << injectionPressureProfile_.size() + Info<< "injectionPressureProfile_.size() = " + << injectionPressureProfile_.size() << ", massFlowRateProfile_.size() = " << massFlowRateProfile_.size() << endl; - if (mag(injectionPressureProfile_[injectionPressureProfile_.size()-1][0]-massFlowRateProfile_[massFlowRateProfile_.size()-1][0]) > SMALL) + if + ( + mag(injectionPressureProfile_[injectionPressureProfile_.size()-1][0] + - massFlowRateProfile_[massFlowRateProfile_.size()-1][0]) + > SMALL + ) { - FatalError << "commonRailInjector::commonRailInjector(const time& t, const dictionary dict) " << endl - << " end-time entries for injectionPressureProfile and massFlowRateProfile do no match" - << abort(FatalError); + FatalErrorIn + ( + "commonRailInjector::commonRailInjector" + "(const time& t, const dictionary dict)" + ) << "End-time entries for injectionPressureProfile and " + << "massFlowRateProfile do no match" + << abort(FatalError); } scalar integratedMFR = integrateTable(massFlowRateProfile_); - scalar integratedP = integrateTable(injectionPressureProfile_)/(teoi()-tsoi()); + scalar integratedP = + integrateTable(injectionPressureProfile_)/(teoi() - tsoi()); forAll(massFlowRateProfile_, i) { @@ -113,7 +131,6 @@ Foam::commonRailInjector::commonRailInjector TProfile_[i][1] = T_; CdProfile_[i][0] = massFlowRateProfile_[i][0]; - } forAll(injectionPressureProfile_, i) @@ -122,7 +139,7 @@ Foam::commonRailInjector::commonRailInjector } // Normalize the direction vector direction_ /= mag(direction_); - + setTangentialVectors(); // check molar fractions @@ -134,18 +151,22 @@ Foam::commonRailInjector::commonRailInjector if (mag(Xsum - 1.0) > SMALL) { - Info << "Warning!!!\n commonRailInjector::commonRailInjector(const time& t, Istream& is)" - << "X does not add up to 1.0, correcting molar fractions." + WarningIn + ( + "commonRailInjector::commonRailInjector" + "(const time& t, const dictionary dict)" + ) << "X does not add up to 1.0, correcting molar fractions." << endl; forAll(X_, i) { X_[i] /= Xsum; } } - Info << "end constructor. in commonRail" << endl; + Info << "end constructor. in commonRail" << endl; } + // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // Foam::commonRailInjector::~commonRailInjector() @@ -181,17 +202,20 @@ Foam::label Foam::commonRailInjector::nParcelsToInject ) const { - scalar mInj = mass_*(fractionOfInjection(time1)-fractionOfInjection(time0)); + scalar mInj = + mass_*(fractionOfInjection(time1) - fractionOfInjection(time0)); label nParcels = label(mInj/averageParcelMass_ + 0.49); - + return nParcels; } + const Foam::vector Foam::commonRailInjector::position(const label n) const { return position_; } + Foam::vector Foam::commonRailInjector::position ( const label n, @@ -223,30 +247,32 @@ Foam::vector Foam::commonRailInjector::position scalar iAngle = 2.0*mathematicalConstant::pi*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,9 +291,10 @@ 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; @@ -275,36 +303,43 @@ Foam::scalar Foam::commonRailInjector::mass return mInj; } + Foam::scalar Foam::commonRailInjector::mass() const { return mass_; } + const Foam::scalarField& Foam::commonRailInjector::X() const { return X_; } + Foam::List 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::CdProfile() const + +Foam::List 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 @@ -368,7 +410,8 @@ void Foam::commonRailInjector::correctProfiles 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 17abfdd51d..7aa1e3f87f 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 velocityProfile() const { return velocityProfile_; } - + scalar velocity(const scalar time) const; List 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 b483a3bdf3..7744e63add 100644 --- a/src/lagrangian/dieselSpray/injector/definedInjector/definedInjector.C +++ b/src/lagrangian/dieselSpray/injector/definedInjector/definedInjector.C @@ -32,16 +32,14 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { + defineTypeNameAndDebug(definedInjector, 0); -defineTypeNameAndDebug(definedInjector, 0); - -addToRunTimeSelectionTable -( - injectorType, - definedInjector, - dictionary -); - + addToRunTimeSelectionTable + ( + injectorType, + definedInjector, + dictionary + ); } @@ -73,12 +71,13 @@ Foam::definedInjector::definedInjector // convert CA to real time - mass flow rate profile forAll(massFlowRateProfile_, i) { - massFlowRateProfile_[i][0] = t.userTimeToTime(massFlowRateProfile_[i][0]); - // dummy - injectionPressureProfile_[i][0] = massFlowRateProfile_[i][0]; - injectionPressureProfile_[i][1] = 0.0; - CdProfile_[i][0] = massFlowRateProfile_[i][0]; - CdProfile_[i][1] = 1.0; + massFlowRateProfile_[i][0] = + t.userTimeToTime(massFlowRateProfile_[i][0]); + // dummy + injectionPressureProfile_[i][0] = massFlowRateProfile_[i][0]; + injectionPressureProfile_[i][1] = 0.0; + CdProfile_[i][0] = massFlowRateProfile_[i][0]; + CdProfile_[i][1] = 1.0; } forAll(velocityProfile_, i) @@ -89,15 +88,28 @@ Foam::definedInjector::definedInjector // check if time entries match if (mag(massFlowRateProfile_[0][0]-velocityProfile_[0][0]) > SMALL) { - FatalError << "definedInjector::definedInjector(const time& t, const dictionary dict) " << endl - << " start-times do not match for velocityProfile and massFlowRateProfile." + FatalErrorIn + ( + "definedInjector::definedInjector" + "(const time& t, const dictionary dict)" + ) << "Start-times do not match for velocityProfile and " + << "massFlowRateProfile." << nl << abort(FatalError); } - if (mag(massFlowRateProfile_[massFlowRateProfile_.size()-1][0]-velocityProfile_[velocityProfile_.size()-1][0]) > SMALL) + if + ( + mag(massFlowRateProfile_[massFlowRateProfile_.size()-1][0] + - velocityProfile_[velocityProfile_.size()-1][0]) + > SMALL + ) { - FatalError << "definedInjector::definedInjector(const time& t, const dictionary dict) " << endl - << " end-times do not match for velocityProfile and massFlowRateProfile." + FatalErrorIn + ( + "definedInjector::definedInjector" + "(const time& t, const dictionary dict)" + ) << "End-times do not match for velocityProfile and " + << "massFlowRateProfile." << abort(FatalError); } @@ -112,7 +124,7 @@ Foam::definedInjector::definedInjector // Normalize the direction vector direction_ /= mag(direction_); - + setTangentialVectors(); // check molar fractions @@ -126,7 +138,8 @@ Foam::definedInjector::definedInjector { WarningIn ( - "definedInjector::definedInjector(const time& t, Istream& is)" + "definedInjector::definedInjector" + "(const time& t, const dictionary dict)" ) << "X does not add up to 1.0, correcting molar fractions." << endl; @@ -174,15 +187,17 @@ Foam::label Foam::definedInjector::nParcelsToInject scalar mInj = mass_*(fractionOfInjection(time1)-fractionOfInjection(time0)); label nParcels = label(mInj/averageParcelMass_ + 0.49); - + return nParcels; } + const Foam::vector Foam::definedInjector::position(const label n) const { return position_; } + Foam::vector Foam::definedInjector::position ( const label n, @@ -214,7 +229,7 @@ Foam::vector Foam::definedInjector::position scalar iAngle = 2.0*mathematicalConstant::pi*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,9 +274,10 @@ 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; @@ -266,51 +286,61 @@ Foam::scalar Foam::definedInjector::mass 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::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,6 +367,7 @@ Foam::scalar Foam::definedInjector::injectedMass return mass_*fractionOfInjection(t); } + void Foam::definedInjector::correctProfiles ( const liquidMixture& fuel, @@ -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 fff583391a..e2028f6e14 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 massFlowRateProfile_; // aj - List velocityProfile_; // aj + List massFlowRateProfile_; + List velocityProfile_; List injectionPressureProfile_; List CdProfile_; List 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 velocityProfile() const { return velocityProfile_; } - + scalar velocity(const scalar time) const; List 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 9b32014ac1..5d611b3ced 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 90303b6040..2a67692471 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 8607b8eab1..5a6edcda83 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::New @@ -55,30 +54,25 @@ Foam::autoPtr 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(cstrIter()(t, dict)); - } @@ -87,6 +81,7 @@ Foam::autoPtr Foam::injectorType::New Foam::injectorType::~injectorType() {} + Foam::scalar Foam::injectorType::getTableValue ( const List& 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& table, @@ -162,6 +158,7 @@ Foam::scalar Foam::injectorType::integrateTable return sum; } + Foam::scalar Foam::injectorType::integrateTable ( const List& 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 5b0e2ceefa..9943bc10db 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, scalar, 2> pair; + typedef VectorSpace, 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 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 2b0147d77e..fee7eb3473 100644 --- a/src/lagrangian/dieselSpray/injector/multiHoleInjector/multiHoleInjector.C +++ b/src/lagrangian/dieselSpray/injector/multiHoleInjector/multiHoleInjector.C @@ -32,17 +32,15 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { + defineTypeNameAndDebug(multiHoleInjector, 0); -defineTypeNameAndDebug(multiHoleInjector, 0); - -addToRunTimeSelectionTable -( - injectorType, - multiHoleInjector, - dictionary -); + addToRunTimeSelectionTable + ( + injectorType, + multiHoleInjector, + dictionary + ); } -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -79,31 +77,43 @@ Foam::multiHoleInjector::multiHoleInjector tangentialInjectionVector1_(nHoles_), tangentialInjectionVector2_(nHoles_) { - - // check if time entries for soi and eoi match - if (mag(massFlowRateProfile_[0][0]-TProfile_[0][0]) > SMALL) + if (mag(massFlowRateProfile_[0][0] - TProfile_[0][0]) > SMALL) { - FatalError << "multiHoleInjector::multiHoleInjector(const time& t, const dictionary dict) " << endl - << " start-times do not match for TemperatureProfile and massFlowRateProfile." + FatalErrorIn + ( + "multiHoleInjector::multiHoleInjector" + "(const time& t, const dictionary dict)" + ) << "Start-times do not match for TemperatureProfile and " + << "massFlowRateProfile." << abort(FatalError); } - if (mag(massFlowRateProfile_[massFlowRateProfile_.size()-1][0]-TProfile_[TProfile_.size()-1][0]) > SMALL) + if + ( + mag(massFlowRateProfile_[massFlowRateProfile_.size()-1][0] + - TProfile_[TProfile_.size()-1][0]) + > SMALL + ) { - FatalError << "multiHoleInjector::multiHoleInjector(const time& t, const dictionary dict) " << endl - << " end-times do not match for TemperatureProfile and massFlowRateProfile." + FatalErrorIn + ( + "multiHoleInjector::multiHoleInjector" + "(const time& t, const dictionary dict)" + ) << "End-times do not match for TemperatureProfile and " + << "massFlowRateProfile." << abort(FatalError); } // convert CA to real time forAll(massFlowRateProfile_, i) { - massFlowRateProfile_[i][0] = t.userTimeToTime(massFlowRateProfile_[i][0]); + massFlowRateProfile_[i][0] = + t.userTimeToTime(massFlowRateProfile_[i][0]); velocityProfile_[i][0] = massFlowRateProfile_[i][0]; injectionPressureProfile_[i][0] = massFlowRateProfile_[i][0]; } - + forAll(TProfile_, i) { TProfile_[i][0] = t.userTimeToTime(TProfile_[i][0]); @@ -115,7 +125,7 @@ Foam::multiHoleInjector::multiHoleInjector { // correct the massFlowRateProfile to match the injected mass massFlowRateProfile_[i][1] *= mass_/integratedMFR; - + CdProfile_[i][0] = massFlowRateProfile_[i][0]; CdProfile_[i][1] = Cd_; } @@ -131,17 +141,20 @@ Foam::multiHoleInjector::multiHoleInjector if (mag(Xsum - 1.0) > SMALL) { - Info << "Warning!!!\n multiHoleInjector::multiHoleInjector(const time& t, Istream& is)" - << "X does not add up to 1.0, correcting molar fractions." + WarningIn + ( + "multiHoleInjector::multiHoleInjector" + "(const time& t, const dictionary dict)" + ) << "X does not add up to 1.0, correcting molar fractions." << endl; forAll(X_, i) { X_[i] /= Xsum; } } - } + // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // Foam::multiHoleInjector::~multiHoleInjector() @@ -172,7 +185,7 @@ void Foam::multiHoleInjector::setTangentialVectors() scalar angle = 0.0; scalar u = umbrellaAngle_*pi180/2.0; - for(label i=0; i Foam::swirlInjector::massFlowRateProfile() const { return massFlowRateProfile_; } + Foam::scalar Foam::swirlInjector::massFlowRate(const scalar time) const { return getTableValue(massFlowRateProfile_, time); } + Foam::List Foam::swirlInjector::injectionPressureProfile() const { return injectionPressureProfile_; } + Foam::scalar Foam::swirlInjector::injectionPressure(const scalar time) const { return getTableValue(injectionPressureProfile_, time); } + Foam::List Foam::swirlInjector::velocityProfile() const { return velocityProfile_; } + Foam::scalar Foam::swirlInjector::velocity(const scalar time) const { return getTableValue(velocityProfile_, time); } + Foam::List 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::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*mathematicalConstant::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 9f7f3347ab..767601d8b3 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 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 6b1b07dc7a..285462f67b 100644 --- a/src/lagrangian/dieselSpray/injector/unitInjector/unitInjector.C +++ b/src/lagrangian/dieselSpray/injector/unitInjector/unitInjector.C @@ -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; } @@ -230,7 +231,6 @@ Foam::vector Foam::unitInjector::position + tangentialInjectionVector2_*sin(iAngle) ) ); - } return position_; @@ -267,7 +267,8 @@ 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) @@ -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*mathematicalConstant::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 a2b9fd5c7a..438ccd533a 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 velocityProfile() const { return velocityProfile_; } - + scalar velocity(const scalar time) const; List 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 0dd861683b..49c4d5db48 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/spray/findInjectorCell.H b/src/lagrangian/dieselSpray/spray/findInjectorCell.H index f1a8d7fc15..ff4eea7904 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()); -// 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()); - + if (!foundCell) { - FatalError - << "Cannot find injection position " + FatalError + << "Cannot find injection position " << injectionPosition << abort(FatalError); } diff --git a/src/lagrangian/dieselSpray/spray/sprayFunctions.C b/src/lagrangian/dieselSpray/spray/sprayFunctions.C index f6a7a02476..da667fc2f8 100644 --- a/src/lagrangian/dieselSpray/spray/sprayFunctions.C +++ b/src/lagrangian/dieselSpray/spray/sprayFunctions.C @@ -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; } @@ -180,7 +180,7 @@ scalar spray::liquidTotalEnthalpy() const for(label j=0; j 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/spraySubModels/atomizationModel/LISA/LISA.C b/src/lagrangian/dieselSpray/spraySubModels/atomizationModel/LISA/LISA.C index 742f1fe1b3..17756e7a35 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/atomizationModel/LISA/LISA.C +++ b/src/lagrangian/dieselSpray/spraySubModels/atomizationModel/LISA/LISA.C @@ -24,8 +24,6 @@ License \*---------------------------------------------------------------------------*/ -#include "error.H" - #include "LISA.H" #include "addToRunTimeSelectionTable.H" #include "basicMultiComponentMixture.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& 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 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()); @@ -167,32 +159,26 @@ void LISA::atomizeParcel 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*mathematicalConstant::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); + scalar hl = + fuels.properties()[i].hl + ( + spray_.ambientPressure(), + tBoilingSurface + ); - chi += p.X()[i]*(iTp-iTb)/hl; + 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); + px = xx*exp(-xx); - if (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 ecca578e05..aa922b03f0 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 4de2e223a6..829a138ac6 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 c6fd3e3056..a380a61c99 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/atomizationModel/blobsSheetAtomization/blobsSheetAtomization.C +++ b/src/lagrangian/dieselSpray/spraySubModels/atomizationModel/blobsSheetAtomization/blobsSheetAtomization.C @@ -81,17 +81,15 @@ void blobsSheetAtomization::atomizeParcel const liquidMixture& fuels ) const { - const PtrList& 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 1) { - for(label i=0; i 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 e0683df7ae..b742300a52 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 8e9e34273c..85ced600dd 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 03d7c5e82c..98198e184f 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/breakupModel/ETAB/ETAB.C +++ b/src/lagrangian/dieselSpray/spraySubModels/breakupModel/ETAB/ETAB.C @@ -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; @@ -139,7 +139,7 @@ void ETAB::breakupParcel if (theta < phi) { - if (2*mathematicalConstant::pi-theta >= phi) + if (2*mathematicalConstant::pi - theta >= phi) { theta = -theta; } @@ -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 6998220c82..f8a413b241 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 34e3e6c3be..5df879fa58 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/breakupModel/SHF/SHF.C +++ b/src/lagrangian/dieselSpray/spraySubModels/breakupModel/SHF/SHF.C @@ -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(2.0*mathematicalConstant::pi)*sigma_) + *exp(-0.5*sqr((x-mu_)/sigma_)); - if (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= 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 ec16af53e1..baae28f17b 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 0879b185bf..970097ec17 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/breakupModel/TAB/TAB.C +++ b/src/lagrangian/dieselSpray/spraySubModels/breakupModel/TAB/TAB.C @@ -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; @@ -132,32 +132,28 @@ void TAB::breakupParcel { phi = 2*mathematicalConstant::pi - 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 (2*mathematicalConstant::pi - theta >= phi) { theta = -theta; } theta += 2*mathematicalConstant::pi; } - 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 62de02b80c..fd75e3d435 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 cf992103eb..ddf2ca7fe1 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 4583fb5c2e..6e237cc876 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 d0889443eb..52b3c4ad5c 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::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(cstrIter()(dict, sm)); diff --git a/src/lagrangian/dieselSpray/spraySubModels/breakupModel/noBreakup/noBreakup.H b/src/lagrangian/dieselSpray/spraySubModels/breakupModel/noBreakup/noBreakup.H index 7edd78b732..c6cc88aeab 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 bfe3c4045e..b91afc3d70 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& 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 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 8fac656acd..c007752023 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 85de5e5e97..5bd8ce5f89 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/breakupModel/reitzKHRT/reitzKHRT.C +++ b/src/lagrangian/dieselSpray/spraySubModels/breakupModel/reitzKHRT/reitzKHRT.C @@ -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 = @@ -165,7 +164,6 @@ void reitzKHRT::breakupParcel // no breakup below Weber = 12 if (weGas > weberLimit_) { - label injector = label(p.injector()); scalar fraction = deltaT/tauKH; @@ -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 87e9fa2114..006fb69a90 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 092fdc87ac..6ab6403b01 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/collisionModel/ORourke/ORourkeCollisionModel.C +++ b/src/lagrangian/dieselSpray/spraySubModels/collisionModel/ORourke/ORourkeCollisionModel.C @@ -73,7 +73,6 @@ ORourkeCollisionModel::~ORourkeCollisionModel() void ORourkeCollisionModel::collideParcels(const scalar dt) const { - if (spray_.size() < 2) { return; @@ -96,39 +95,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 ef500220e9..2345569bbd 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 a0153c1422..1ee072ddad 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/collisionModel/ORourke/sameCell.H +++ b/src/lagrangian/dieselSpray/spraySubModels/collisionModel/ORourke/sameCell.H @@ -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 4cbebbffc2..1bb72dfab7 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 b0d1fc80dc..b4fca726f1 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/trajectoryModel.C b/src/lagrangian/dieselSpray/spraySubModels/collisionModel/trajectoryModel/trajectoryModel.C index c3b80068af..f1b4ca0038 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/collisionModel/trajectoryModel/trajectoryModel.C +++ b/src/lagrangian/dieselSpray/spraySubModels/collisionModel/trajectoryModel/trajectoryModel.C @@ -88,22 +88,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 +116,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 1f75a5d511..7c34ddab6b 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 9f9e3f1125..d6dfd09443 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 101d746a17..e0995c83ce 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 195fc2f609..b5e70acce5 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 78b91f0e5c..992b24027d 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 b76865bcf4..e3be5bf441 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 3fda8fdd28..60f6e21411 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 9cf767d49d..b7cd003b94 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 0ea4ce9bca..6f8308d1f8 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 854ce84866..e3cecba0ba 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 6fed754f95..d0ee9d6a29 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::New -( - const dictionary& dict -) +autoPtr 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::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(cstrIter()(dict)); diff --git a/src/lagrangian/dieselSpray/spraySubModels/dragModel/noDragModel/noDragModel.C b/src/lagrangian/dieselSpray/spraySubModels/dragModel/noDragModel/noDragModel.C index 0b3423b72d..ad5ea2510d 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 1d8b83a3bb..6320ceb93b 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 097ed5f218..597e7eaea1 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 1ec05623c7..1a21c142e9 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 735eae0e56..3de8d579a7 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/RutlandFlashBoil/RutlandFlashBoil.C +++ b/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/RutlandFlashBoil/RutlandFlashBoil.C @@ -49,10 +49,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 +59,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 +90,7 @@ bool RutlandFlashBoil::evaporation() const return true; } + // Correlation for the Sherwood Number scalar RutlandFlashBoil::Sh ( @@ -101,9 +98,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 +134,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 +151,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 +200,6 @@ scalar RutlandFlashBoil::boilingTime const scalar kLiq ) const { - scalar time = GREAT; // the deltaTemperature is limited to not go below .5 deg K @@ -208,30 +207,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) + if (mag(expSum-expSumOld)/expSum < 1.0e-3) { - break; + break; } expSumOld = expSum; } @@ -242,99 +242,97 @@ 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.027 * pow(dTLB, 2.33); + alfaS = 0.76*pow(dTLB, 0.26); } - if(dTLB >= 25.0) + if (dTLB >= 5.0 && 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 = 0.027*pow(dTLB, 2.33); + } + 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) 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*mathematicalConstant::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 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 +342,24 @@ scalar RutlandFlashBoil::boilingTime G = 0.0; } } - - time = ((4.0/3.0)*mathematicalConstant::pi*pow(diameter/2.0,3.0))*liquidDensity/(G+Gf); + + time = + ((4.0/3.0)*mathematicalConstant::pi*pow3(diameter/2.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 a944314948..c207ea0d25 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 6848da22e4..96d1d6dd88 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 ec66a2e2ea..94d31d74aa 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 New - ( - const dictionary& dict - ); + static autoPtr 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 2d400a09d4..2fa4aefce9 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::New -( - const dictionary& dict -) +autoPtr 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::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(cstrIter()(dict)); diff --git a/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/noEvaporation/noEvaporation.C b/src/lagrangian/dieselSpray/spraySubModels/evaporationModel/noEvaporation/noEvaporation.C index c8c7052eba..b92e1824e1 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 cedd0fd44d..6aaf8038db 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 c56c727d20..ac6e8af4e0 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 f1baa0b0e4..8a9bf1e375 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 c8e7baebb4..de169440c0 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 24405d9c35..4083a7336b 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 615a76860b..5b69f9183e 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 7441c9cfb1..d3e5f3f839 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 acf2bf13bd..0bc9c4604f 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 e2e7060a8c..0612bb6c55 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 308fbfa697..6aac6a09a8 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::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(cstrIter()(dict)); diff --git a/src/lagrangian/dieselSpray/spraySubModels/heatTransferModel/noHeatTransfer/noHeatTransfer.C b/src/lagrangian/dieselSpray/spraySubModels/heatTransferModel/noHeatTransfer/noHeatTransfer.C index 498f984f48..6779a70445 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 1f468e7414..694dd1d02b 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 0fac3a1836..9808fbf6ca 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/Chomiak/Chomiak.C +++ b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/Chomiak/Chomiak.C @@ -96,7 +96,7 @@ ChomiakInjector::~ChomiakInjector() scalar ChomiakInjector::d0 ( - const label, + const label, const scalar ) const { @@ -115,7 +115,10 @@ 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) + *mathematicalConstant::pi/360.0; scalar alpha = sin(angle); scalar dcorr = cos(angle); @@ -123,39 +126,43 @@ vector ChomiakInjector::direction // 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()/mathematicalConstant::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 +184,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 2a62b9e668..50de0a31dc 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 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 7bf6571e17..744ff70657 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/blobsSwirl/blobsSwirlInjector.C +++ b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/blobsSwirl/blobsSwirlInjector.C @@ -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; 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 kV = kv(n); + + scalar v = kV*sqrt(2.0*deltaPressure/rhoFuel); + + u_ = v*cosAngle; + return h_; - } + vector blobsSwirlInjector::direction ( const label n, @@ -139,39 +142,45 @@ vector blobsSwirlInjector::direction const scalar d ) const { - scalar alpha = sin(angle_); scalar dcorr = cos(angle_); scalar beta = 2.0*mathematicalConstant::pi*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() + /(2.0*mathematicalConstant::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; @@ -187,12 +196,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 +207,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 +229,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_)) + /( + mathematicalConstant::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_)) + /( + mathematicalConstant::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 a122fdcf72..f081cbda02 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 1a49bbef21..ebeb7d71bb 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/constant/constInjector.C +++ b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/constant/constInjector.C @@ -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,16 +124,17 @@ 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]*mathematicalConstant::pi/360.0; scalar alpha = sin(angle); scalar dcorr = cos(angle); @@ -136,31 +142,34 @@ vector constInjector::direction // 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()/mathematicalConstant::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 +177,7 @@ vector constInjector::direction return dir; } + scalar constInjector::velocity ( const label i, @@ -189,17 +199,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 81e645d924..69afa40132 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 fce8ea2321..2b42660b26 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/definedHollowCone/definedHollowCone.C +++ b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/definedHollowCone/definedHollowCone.C @@ -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,7 +161,7 @@ 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); @@ -161,39 +169,42 @@ vector definedHollowConeInjector::direction // 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()/(2.0*mathematicalConstant::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, t) + normal; // normailse direction vector dir /= mag(dir); return dir; - } + scalar definedHollowConeInjector::velocity ( const label i, @@ -215,16 +226,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 be8a569979..56d6241892 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 dropletPDF_; - // inner and outer cone angle time histories + // inner and outer cone angle time histories // 2 column vectors = (time, coneAngle) List innerConeAngle_; List 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 6e14912ac7..66a051d188 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/definedPressureSwirl/definedPressureSwirl.C +++ b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/definedPressureSwirl/definedPressureSwirl.C @@ -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 - - scalar tBoilingSurface = Tinj ; - - label Niter = 200; - - for(label k=0; k< Niter ; k++) - { +// Calculation of the boiling temperature - scalar pBoil = fuels.properties()[i].pv(pressure, tBoilingSurface); - - if(pBoil > pressure) + scalar tBoilingSurface = Tinj ; + + label Niter = 200; + + for (label k=0; k< Niter ; k++) + { + scalar pBoil = + fuels.properties()[i].pv(pressure, tBoilingSurface); + + 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; 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 kV = kv(n, injectedMassFlow, deltaPressure, t); + + scalar v = kV*sqrt(2.0*deltaPressure/rhoFuel); + + u_ = v*cosAngle; + scalar A = injectedMassFlow/(mathematicalConstant::pi*rhoFuel*u_); -/* - - 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. - -*/ + // 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,42 @@ vector definedPressureSwirlInjector::direction const scalar d ) const { - scalar alpha = sin(angle_); scalar dcorr = cos(angle_); scalar beta = 2.0*mathematicalConstant::pi*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()/(2.0*mathematicalConstant::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; @@ -249,12 +265,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 +277,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,7 +293,6 @@ scalar definedPressureSwirlInjector::kv const scalar t ) const { - const injectorType& it = injectors_[inj].properties(); scalar coneAngle = it.getTableValue(coneAngle_, t); @@ -289,41 +300,46 @@ scalar definedPressureSwirlInjector::kv coneAngle *= mathematicalConstant::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) + /(mathematicalConstant::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 197e76b0fb..f4eda52a58 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 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 2613f8584f..0a88d280f8 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/hollowCone/hollowCone.C +++ b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/hollowCone/hollowCone.C @@ -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,50 @@ vector hollowConeInjector::direction const scalar d ) const { - scalar angle = innerAngle_[n] + rndGen_.scalar01()*(outerAngle_[n]-innerAngle_[n]); + 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(); // 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()/(2.0*mathematicalConstant::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 hollowConeInjector::velocity ( const label i, @@ -179,19 +191,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 b18af3f1da..985d7c6073 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 86342a507c..0e428b3066 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 17c3e62f22..26923ced97 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& injectors_; + const PtrList& 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 41758a8259..b4b5f98028 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::New spray& sm ) { - word injectorModelType - ( - dict.lookup("injectorModel") - ); + word injectorModelType(dict.lookup("injectorModel")); Info<< "Selecting injectorModel " << injectorModelType << endl; @@ -55,13 +52,12 @@ autoPtr 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(cstrIter()(dict, sm)); diff --git a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/pressureSwirl/pressureSwirlInjector.C b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/pressureSwirl/pressureSwirlInjector.C index eb286bac36..eda82a87ef 100644 --- a/src/lagrangian/dieselSpray/spraySubModels/injectorModel/pressureSwirl/pressureSwirlInjector.C +++ b/src/lagrangian/dieselSpray/spraySubModels/injectorModel/pressureSwirl/pressureSwirlInjector.C @@ -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; 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_); return (injectorDiameter-sqrt(pow(injectorDiameter,2)-4.0*A))/2.0; } + vector pressureSwirlInjector::direction ( const label n, @@ -130,39 +136,42 @@ vector pressureSwirlInjector::direction const scalar d ) const { - scalar alpha = sin(angle_); scalar dcorr = cos(angle_); scalar beta = 2.0*mathematicalConstant::pi*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()/(2.0*mathematicalConstant::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; @@ -178,12 +187,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 +199,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,7 +214,6 @@ scalar pressureSwirlInjector::kv const scalar dPressure ) const { - const injectorType& it = injectors_[inj].properties(); scalar coneAngle = coneAngle_[inj]; @@ -218,30 +223,33 @@ scalar pressureSwirlInjector::kv 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) + /(mathematicalConstant::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 +259,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 56fe236c01..b369f34885 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 b10ad3274d..8948633e7a 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 f2261ca5b3..c13c5f5882 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 0dbf2541a7..453d02986b 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 3274533b1d..f96b9cb029 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::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(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 8785ad0cf4..0fbe08c755 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 fa9942f49b..75bf1b3022 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; - }; From 6e527c58d086fe89c88f6e1901926e6d5301237b Mon Sep 17 00:00:00 2001 From: andy Date: Wed, 26 Aug 2009 18:38:06 +0100 Subject: [PATCH 6/8] made destructirs virtual --- src/thermophysicalModels/laminarFlameSpeed/Gulders/Gulders.H | 5 ++--- .../laminarFlameSpeed/GuldersEGR/GuldersEGR.H | 5 ++--- .../laminarFlameSpeed/constant/constant.H | 5 ++--- .../laminarFlameSpeed/laminarFlameSpeed/laminarFlameSpeed.H | 5 ++--- 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/thermophysicalModels/laminarFlameSpeed/Gulders/Gulders.H b/src/thermophysicalModels/laminarFlameSpeed/Gulders/Gulders.H index be68a8c5dc..4b133caa15 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 c7c837e68a..0ae3402871 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 dce52f5d14..a549adf7bf 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 f6568a3743..5ee73bdba3 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 From 243bff1a55f18b3e80e97bca677446d9f1d3143f Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 28 Aug 2009 15:23:01 +0100 Subject: [PATCH 7/8] initial commit of updated dimensioned constants --- etc/controlDict | 88 +++++++--- src/OpenFOAM/Make/files | 1 + .../constants/atomic/atomicConstants.C | 132 ++++++++++++++ .../constants/atomic/atomicConstants.H | 81 +++++++++ .../constants/constants.C | 42 +++++ .../constants/constants.H | 59 +++++++ .../electromagneticConstants.C | 164 ++++++++++++++++++ .../electromagneticConstants.H | 89 ++++++++++ .../fundamental/fundamentalConstants.C | 128 ++++++++++++++ .../fundamental/fundamentalConstants.H | 101 +++++++++++ .../constants/math/mathConstants.H | 69 ++++++++ .../physicoChemicalConstants.C | 132 ++++++++++++++ .../physicoChemicalConstants.H | 85 +++++++++ .../constants/universal/universalConstants.C | 53 ++++++ .../constants/universal/universalConstants.H | 66 +++++++ .../dimensionedConstants.C | 19 ++ .../dimensionedConstants.H | 33 +++- 17 files changed, 1310 insertions(+), 32 deletions(-) create mode 100644 src/OpenFOAM/global/dimensionedConstants/constants/atomic/atomicConstants.C create mode 100644 src/OpenFOAM/global/dimensionedConstants/constants/atomic/atomicConstants.H create mode 100644 src/OpenFOAM/global/dimensionedConstants/constants/constants.C create mode 100644 src/OpenFOAM/global/dimensionedConstants/constants/constants.H create mode 100644 src/OpenFOAM/global/dimensionedConstants/constants/electromagnetic/electromagneticConstants.C create mode 100644 src/OpenFOAM/global/dimensionedConstants/constants/electromagnetic/electromagneticConstants.H create mode 100644 src/OpenFOAM/global/dimensionedConstants/constants/fundamental/fundamentalConstants.C create mode 100644 src/OpenFOAM/global/dimensionedConstants/constants/fundamental/fundamentalConstants.H create mode 100644 src/OpenFOAM/global/dimensionedConstants/constants/math/mathConstants.H create mode 100644 src/OpenFOAM/global/dimensionedConstants/constants/physicoChemical/physicoChemicalConstants.C create mode 100644 src/OpenFOAM/global/dimensionedConstants/constants/physicoChemical/physicoChemicalConstants.H create mode 100644 src/OpenFOAM/global/dimensionedConstants/constants/universal/universalConstants.C create mode 100644 src/OpenFOAM/global/dimensionedConstants/constants/universal/universalConstants.H diff --git a/etc/controlDict b/etc/controlDict index c1d7416515..97af349e7a 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 7bff2143ec..6ba6b90cf1 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 0000000000..943bdc5c38 --- /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 0000000000..c257374441 --- /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/OpenFOAM/global/dimensionedConstants/constants/constants.C b/src/OpenFOAM/global/dimensionedConstants/constants/constants.C new file mode 100644 index 0000000000..f921cba983 --- /dev/null +++ b/src/OpenFOAM/global/dimensionedConstants/constants/constants.C @@ -0,0 +1,42 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 + Collection of dimensioned constants + +\*---------------------------------------------------------------------------*/ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +// Constants supplied in the main controlDict +#include "fundamentalConstants.C" + +// Derived constants +#include "universalConstants.C" +#include "electromagneticConstants.C" +#include "atomicConstants.C" +#include "physicoChemicalConstants.C" + + +// ************************************************************************* // diff --git a/src/OpenFOAM/global/dimensionedConstants/constants/constants.H b/src/OpenFOAM/global/dimensionedConstants/constants/constants.H new file mode 100644 index 0000000000..14ab108667 --- /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 0000000000..77e2fec40c --- /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 0000000000..54586cda47 --- /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 0000000000..37e7bf4806 --- /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 0000000000..de30291fe8 --- /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/global/dimensionedConstants/constants/math/mathConstants.H b/src/OpenFOAM/global/dimensionedConstants/constants/math/mathConstants.H new file mode 100644 index 0000000000..f18f97d749 --- /dev/null +++ b/src/OpenFOAM/global/dimensionedConstants/constants/math/mathConstants.H @@ -0,0 +1,69 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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::math + +Description + mathematical constants + +\*---------------------------------------------------------------------------*/ + +#ifndef mathConstants_H +#define mathConstants_H + +#include "scalar.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +namespace constant +{ +namespace math +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + + 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 + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#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 0000000000..7446c67d97 --- /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 0000000000..28ddd776c8 --- /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/kg/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/OpenFOAM/global/dimensionedConstants/constants/universal/universalConstants.C b/src/OpenFOAM/global/dimensionedConstants/constants/universal/universalConstants.C new file mode 100644 index 0000000000..3284c51d4d --- /dev/null +++ b/src/OpenFOAM/global/dimensionedConstants/constants/universal/universalConstants.C @@ -0,0 +1,53 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 "universalConstants.H" +#include "mathConstants.H" + +#include "dimensionedConstants.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +const char* Foam::constant::universal::group = "universal"; + + +const Foam::dimensionedScalar Foam::constant::universal::hr +( + dimensionedConstant + ( + group, + "hr", + dimensionedScalar + ( + "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 0000000000..305e30fe19 --- /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 a3a9893fde..b9a7d4277b 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 476638dbc7..989089c0b0 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 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(dimensionedConstants().lookup(switchName)); + dictionary& groupDict = unitDict.subDict(group); + if (groupDict.found(varName)) + { + return pTraits(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; } } From 8dcea0f8cdcca441a2dd6da15d9fea0f04140a62 Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 28 Aug 2009 18:04:22 +0100 Subject: [PATCH 8/8] using new constant definitions --- .../combustion/dieselEngineFoam/createSpray.H | 2 +- .../dieselEngineFoam/dieselEngineFoam.C | 1 + .../dieselEngineFoam/spraySummary.H | 2 +- .../combustion/dieselFoam/dieselFoam.C | 1 + .../combustion/engineFoam/engineFoam.C | 1 + .../T/smoluchowskiJumpTFvPatchScalarField.C | 4 +- .../BCs/U/maxwellSlipUFvPatchVectorField.C | 4 +- .../SchnerrSauer/SchnerrSauer.C | 6 +- .../multiphaseMixture/multiphaseMixture.C | 3 +- .../Gidaspow/GidaspowConductivity.C | 6 +- .../HrenyaSinclairConductivity.C | 6 +- .../Syamlal/SyamlalConductivity.C | 4 +- .../kineticTheoryModel/kineticTheoryModel.C | 4 +- .../Gidaspow/GidaspowViscosity.C | 4 +- .../HrenyaSinclair/HrenyaSinclairViscosity.C | 4 +- .../viscosityModel/Syamlal/SyamlalViscosity.C | 4 +- applications/test/graphXi/graphXi.C | 4 +- .../advanced/collapseEdges/collapseEdges.C | 4 +- .../combinePatchFaces/combinePatchFaces.C | 6 +- .../mesh/advanced/splitCells/splitCells.C | 4 +- .../mesh/conversion/kivaToFoam/kivaToFoam.C | 2 +- .../mesh/conversion/kivaToFoam/readKivaGrid.H | 4 +- .../conversion/polyDualMesh/polyDualMeshApp.C | 6 +- .../starToFoam/createCoupleMatches.C | 4 +- .../blockMesh/curvedEdges/arcEdge.C | 6 +- .../mesh/generation/extrudeMesh/extrudeMesh.C | 1 - .../extrudeMesh/extrudeModel/wedge/wedge.C | 4 +- .../mesh/manipulation/autoPatch/autoPatch.C | 4 +- .../transformPoints/transformPoints.C | 3 +- .../preProcessing/engineSwirl/engineSwirl.C | 4 +- .../surfaceTransformPoints.C | 3 +- .../physicoChemicalConstants.H | 2 +- src/OpenFOAM/meshes/meshShapes/face/face.C | 8 +-- .../primitiveMeshCheck/primitiveMeshCheck.C | 12 ++-- .../primitiveMeshCheckMotion.C | 4 +- .../primitiveShapes/triangle/triangleI.H | 8 +-- .../labelSymmTensor/labelSymmTensor.C | 1 - .../primitives/Tensor/tensor/tensor.C | 14 ++--- .../primitives/Tensor2D/tensor2D/tensor2D.C | 1 - .../mathematicalConstants.H | 61 ------------------- src/OpenFOAM/primitives/transform/transform.H | 10 +-- .../autoHexMeshDriver/autoLayerDriver.C | 18 ++---- .../autoHexMeshDriver/autoRefineDriver.C | 7 ++- .../layerParameters/layerParameters.C | 20 ++---- .../refinementParameters.C | 4 +- .../meshRefinementProblemCells.C | 8 +-- .../dynamicInkJetFvMesh/dynamicInkJetFvMesh.C | 6 +- .../solidBodyMotionFunctions/SDA/SDA.C | 10 +-- .../solidBodyMotionFunctions/SKA/SKA.C | 4 +- .../solidBodyMotionFvMesh.C | 3 - .../meshCut/cellLooper/hexCellLooper.C | 9 +-- .../meshCut/cellLooper/topoCellLooper.C | 7 +-- .../undoableMeshCutter/undoableMeshCutter.C | 8 +-- .../polyMeshGeometry/polyMeshGeometry.C | 21 ++++--- src/engine/engineTime/engineTime.C | 6 +- src/engine/include/StCorr.H | 10 +-- .../cfdTools/general/SRF/SRFModel/rpm/rpm.C | 8 +-- .../cfdTools/general/include/fvCFD.H | 2 +- .../oscillatingFixedValueFvPatchField.C | 6 +- .../surfaceInterpolation.C | 4 +- .../COxidationDiffusionLimitedRate.C | 4 +- .../COxidationKineticDiffusionLimitedRate.C | 3 +- .../COxidationMurphyShaddix.C | 3 +- .../commonRailInjector/commonRailInjector.C | 8 +-- .../definedInjector/definedInjector.C | 8 +-- .../multiHoleInjector/multiHoleInjector.C | 10 +-- .../injector/swirlInjector/swirlInjector.C | 8 +-- .../injector/unitInjector/unitInjector.C | 8 +-- .../dieselSpray/parcel/parcelFunctions.C | 6 +- src/lagrangian/dieselSpray/spray/spray.C | 8 +-- .../dieselSpray/spray/sprayFunctions.C | 10 +-- src/lagrangian/dieselSpray/spray/sprayOps.C | 1 - .../atomizationModel/LISA/LISA.C | 6 +- .../blobsSheetAtomization.C | 6 +- .../spraySubModels/breakupModel/ETAB/ETAB.C | 8 +-- .../spraySubModels/breakupModel/SHF/SHF.C | 6 +- .../spraySubModels/breakupModel/TAB/TAB.C | 8 +-- .../breakupModel/reitzKHRT/reitzKHRT.C | 6 +- .../ORourke/ORourkeCollisionModel.C | 3 +- .../collisionModel/ORourke/sameCell.H | 2 +- .../trajectoryModel/trajectoryCM.H | 20 +++--- .../trajectoryModel/trajectoryModel.C | 1 + .../RutlandFlashBoil/RutlandFlashBoil.C | 15 ++--- .../injectorModel/Chomiak/Chomiak.C | 9 ++- .../blobsSwirl/blobsSwirlInjector.C | 15 ++--- .../injectorModel/constant/constInjector.C | 10 ++- .../definedHollowCone/definedHollowCone.C | 11 ++-- .../definedPressureSwirl.C | 15 +++-- .../injectorModel/hollowCone/hollowCone.C | 11 ++-- .../pressureSwirl/pressureSwirlInjector.C | 15 +++-- .../clouds/Templates/DsmcCloud/DsmcCloudI.H | 6 +- .../parcels/Templates/DsmcParcel/DsmcParcel.C | 1 - .../parcels/Templates/DsmcParcel/DsmcParcel.H | 1 - .../Templates/DsmcParcel/DsmcParcelI.H | 4 +- .../LarsenBorgnakkeVariableHardSphere.C | 5 +- .../VariableHardSphere/VariableHardSphere.C | 5 +- .../FreeStream/FreeStream.C | 3 +- .../Templates/ThermoCloud/ThermoCloudI.H | 4 +- .../KinematicParcel/KinematicParcel.C | 1 - .../KinematicParcel/KinematicParcel.H | 1 - .../KinematicParcel/KinematicParcelI.H | 6 +- .../ReactingMultiphaseParcel.C | 3 +- .../Templates/ReactingParcel/ReactingParcel.C | 3 +- .../Templates/ThermoParcel/ThermoParcel.C | 3 +- .../ConeInjection/ConeInjection.C | 6 +- .../ConeInjectionMP/ConeInjectionMP.C | 6 +- .../FieldActivatedInjection.C | 3 +- .../InjectionModel/InjectionModel.C | 4 +- .../ManualInjection/ManualInjection.C | 3 +- .../LiquidEvaporation/LiquidEvaporation.C | 3 +- .../molecule/moleculeCloud/moleculeCloud.C | 22 +++---- .../electrostaticPotential.C | 4 +- .../pairPotential/basic/pairPotential.H | 1 - .../pairPotential/derived/coulomb/coulomb.C | 4 +- .../derived/dampedCoulomb/dampedCoulomb.C | 4 +- src/meshTools/cellQuality/cellQuality.C | 30 ++++----- .../EulerCoordinateRotation.C | 8 +-- .../STARCDCoordinateRotation.C | 8 +-- .../coordinateSystems/cylindricalCS.C | 10 +-- src/meshTools/coordinateSystems/sphericalCS.C | 18 +++--- src/meshTools/coordinateSystems/toroidalCS.C | 10 +-- .../primitiveMeshGeometry.C | 29 +++++---- .../cellSources/shapeToCell/shapeToCell.C | 4 +- .../surfaceIntersection/edgeIntersections.C | 4 +- .../surfaceFeatures/surfaceFeatures.C | 7 +-- src/randomProcesses/Kmesh/Kmesh.C | 13 ++-- src/randomProcesses/fft/kShellIntegration.C | 8 +-- src/randomProcesses/noise/noiseFFT.C | 4 +- src/randomProcesses/turbulence/turbGen.C | 16 ++--- src/thermophysicalModels/radiation/Make/files | 3 - .../MarshakRadiationMixedFvPatchScalarField.C | 6 +- ...akRadiationFixedTMixedFvPatchScalarField.C | 6 +- ...iffusiveRadiationMixedFvPatchScalarField.C | 11 ++-- ...iffusiveRadiationMixedFvPatchScalarField.C | 10 +-- .../radiationConstants/radiationConstants.C | 48 --------------- .../radiationConstants/radiationConstants.H | 53 ---------------- .../radiation/radiationModel/P1/P1.C | 9 +-- .../blackBodyEmission/blackBodyEmission.C | 8 ++- .../blackBodyEmission/blackBodyEmission.H | 2 - .../radiationModel/fvDOM/fvDOM/fvDOM.C | 23 +++---- .../radiativeIntensityRay.C | 5 +- .../radiationModel/noRadiation/noRadiation.C | 6 +- .../specie/specie/specie.C | 10 +-- .../interfaceProperties/interfaceProperties.C | 4 +- .../biconic25-55Run35/datToFoam/datToFoam.C | 4 +- 145 files changed, 452 insertions(+), 672 deletions(-) delete mode 100644 src/OpenFOAM/primitives/mathematicalConstants/mathematicalConstants.H delete mode 100644 src/thermophysicalModels/radiation/radiationConstants/radiationConstants.C delete mode 100644 src/thermophysicalModels/radiation/radiationConstants/radiationConstants.H diff --git a/applications/solvers/combustion/dieselEngineFoam/createSpray.H b/applications/solvers/combustion/dieselEngineFoam/createSpray.H index ea4d0121b6..6b78689f09 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 e3f9c0b118..709b70f7a6 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 31337d0a77..2bacaa91ee 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 86460c1e9a..8d5dd0d9fa 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 9adf73cc67..8ff998217d 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 b2d007094e..276cac6ae0 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 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 a087d0c964..7cf2ab1f25 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& ppsi = patch().lookupPatchField("psi"); - Field C1 = sqrt(ppsi*mathematicalConstant::pi/2.0) + Field C1 = sqrt(ppsi*constant::math::piByTwo) *(2.0 - accommodationCoeff_)/accommodationCoeff_; Field pnu = pmu/prho; diff --git a/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/SchnerrSauer/SchnerrSauer.C b/applications/solvers/multiphase/interPhaseChangeFoam/phaseChangeTwoPhaseMixtures/SchnerrSauer/SchnerrSauer.C index 02d220138b..03e46a5c63 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 613dbfbaef..240207c8ab 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 5eb399afbf..fe24603713 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::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 3fdd409f5b..2d0acca9fa 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::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 8e555dd487..40c296f7e0 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::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 5a6d4aa52d..dd3f345179 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 b1a127e2e5..2a1c00b188 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 8b43147895..b5e60e94c2 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 28c2c56b07..892319df6c 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::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 2c3a5750f3..c717f6cc1f 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 d4d6d11539..0905771d19 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 60c9439561..de7af2b077 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 85afb3a771..1d9c0e5b54 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 1da7ba049e..996cd67d4c 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 d315dce4a0..f1ec25a59c 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::iterator iterf = pFaces[WEDGE][0].begin(); SLList::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 2707469a6c..65dd5c952d 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 910df915d8..0b135188e0 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 886281274b..2039ffb0bb 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 4d5bca0e82..4d7d6bc81d 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 5d0a3621b4..07ddf34eaf 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 758592590c..3c48f6d7d7 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 e77fbaf022..c6d7b8f61e 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/preProcessing/engineSwirl/engineSwirl.C b/applications/utilities/preProcessing/engineSwirl/engineSwirl.C index e9171c330c..92e3057093 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/surface/surfaceTransformPoints/surfaceTransformPoints.C b/applications/utilities/surface/surfaceTransformPoints/surfaceTransformPoints.C index c3243b71ae..78716d63c7 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/src/OpenFOAM/global/dimensionedConstants/constants/physicoChemical/physicoChemicalConstants.H b/src/OpenFOAM/global/dimensionedConstants/constants/physicoChemical/physicoChemicalConstants.H index 28ddd776c8..7f25e0dfb7 100644 --- a/src/OpenFOAM/global/dimensionedConstants/constants/physicoChemical/physicoChemicalConstants.H +++ b/src/OpenFOAM/global/dimensionedConstants/constants/physicoChemical/physicoChemicalConstants.H @@ -49,7 +49,7 @@ namespace physicoChemical //- Group name for physico-chemical constants extern const char* group; - //- Universal gas constant: default SI units: [J/kg/K] + //- Universal gas constant: default SI units: [J/mol/K] extern const dimensionedScalar R; //- Faraday constant: default SI units: [C/mol] diff --git a/src/OpenFOAM/meshes/meshShapes/face/face.C b/src/OpenFOAM/meshes/meshShapes/face/face.C index f371e697a1..a7bbf88005 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 29841d3ec8..01879f089f 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 8a82cc4189..1dafd61f61 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 a21461bc62..881fb1d520 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::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 cd8ed8f9b5..7668cfe0e9 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 f365893125..6ecc1da313 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 e782cd0fea..b817d4ab5e 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/mathematicalConstants/mathematicalConstants.H b/src/OpenFOAM/primitives/mathematicalConstants/mathematicalConstants.H deleted file mode 100644 index c1b45e9694..0000000000 --- a/src/OpenFOAM/primitives/mathematicalConstants/mathematicalConstants.H +++ /dev/null @@ -1,61 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. - \\/ M anipulation | -------------------------------------------------------------------------------- -License - This file is part of OpenFOAM. - - OpenFOAM is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by the - Free Software Foundation; either version 2 of the License, or (at your - option) any later version. - - OpenFOAM is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - for more details. - - You should have received a copy of the GNU General Public License - along with OpenFOAM; if not, write to the Free Software Foundation, - Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -Namespace - Foam::mathematicalConstant - -Description - Mathematical constants such as pi, e. - -\*---------------------------------------------------------------------------*/ - -#ifndef mathematicalConstants_H -#define mathematicalConstants_H - -#include "scalar.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace mathematicalConstant -{ - const scalar e(M_E); - const scalar pi(M_PI); - const scalar twoPi(2*pi); - const scalar piByTwo(0.5*pi); -} - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/OpenFOAM/primitives/transform/transform.H b/src/OpenFOAM/primitives/transform/transform.H index 33bf2b1d39..8d6657b41f 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 transform(const tensor& tt, const Tensor& 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 transform(const tensor& tt, const SymmTensor& 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 716bdc6ddf..27ca388fe3 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 1ba66fffe9..3ea198e6c4 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 fad6642296..ea57136c1d 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 d63d527fae..ce3b82bfc6 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 fb0a7e2121..2f3f4e60ca 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::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 3b1045cdb3..5fa27e142a 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(lookupObject("U")); U.correctBoundaryConditions(); diff --git a/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/SDA/SDA.C b/src/dynamicFvMesh/solidBodyMotionFvMesh/solidBodyMotionFunctions/SDA/SDA.C index d2f0c467d2..1fbd323685 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 6d4cdc4427..e15523f983 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 e41ed4b427..7329c1dd90 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 e31ad4c2a1..8e705ae525 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 3572546e75..8f4a57aca7 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 15478458c9..57dd15eb54 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 37882a2cc0..4fbd137526 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()); reduce(sumDet, sumOp()); reduce(nSumDet, sumOp