diff --git a/src/thermophysicalModels/basic/basicThermo/basicThermo.H b/src/thermophysicalModels/basic/basicThermo/basicThermo.H index 83da7eb562..a708677653 100644 --- a/src/thermophysicalModels/basic/basicThermo/basicThermo.H +++ b/src/thermophysicalModels/basic/basicThermo/basicThermo.H @@ -178,8 +178,7 @@ public: ( const dictionary& thermoTypeDict, Table* tablePtr, - const int nCmpt, - const char* cmptNames[], + std::initializer_list cmptNames, const word& thermoTypeName ); diff --git a/src/thermophysicalModels/basic/basicThermo/basicThermoTemplates.C b/src/thermophysicalModels/basic/basicThermo/basicThermoTemplates.C index 08693c9f64..8d9553602b 100644 --- a/src/thermophysicalModels/basic/basicThermo/basicThermoTemplates.C +++ b/src/thermophysicalModels/basic/basicThermo/basicThermoTemplates.C @@ -32,8 +32,7 @@ typename Table::iterator Foam::basicThermo::lookupThermo ( const dictionary& thermoTypeDict, Table* tablePtr, - const int nCmpt, - const char* cmptNames[], + std::initializer_list cmptNames, const word& thermoTypeName ) { @@ -62,15 +61,19 @@ typename Table::iterator Foam::basicThermo::lookupThermo validThermoTypeNames.size() + 1 ); + const int nCmpt = cmptNames.size(); validThermoTypeNameCmpts[0].setSize(nCmpt); - forAll(validThermoTypeNameCmpts[0], j) + + label j = 0; + for (const char* cmptName : cmptNames) { - validThermoTypeNameCmpts[0][j] = cmptNames[j]; + validThermoTypeNameCmpts[0][j] = cmptName; + ++j; } // Split the thermo package names into their constituent parts // Removing incompatible entries from the list - label j = 0; + j = 0; forAll(validThermoTypeNames, i) { wordList names @@ -111,8 +114,7 @@ typename Table::iterator Foam::basicThermo::lookupThermo if (thermoTypeDict.found("properties")) { - const int nCmpt = 4; - const char* cmptNames[nCmpt] = + std::initializer_list cmptNames { "type", "mixture", @@ -133,15 +135,13 @@ typename Table::iterator Foam::basicThermo::lookupThermo ( thermoTypeDict, tablePtr, - nCmpt, cmptNames, thermoTypeName ); } else { - const int nCmpt = 7; - const char* cmptNames[nCmpt] = + std::initializer_list cmptNames { "type", "mixture", @@ -168,7 +168,6 @@ typename Table::iterator Foam::basicThermo::lookupThermo ( thermoTypeDict, tablePtr, - nCmpt, cmptNames, thermoTypeName ); diff --git a/src/thermophysicalModels/reactionThermo/mixtures/SpecieMixture/SpecieMixture.H b/src/thermophysicalModels/reactionThermo/mixtures/SpecieMixture/SpecieMixture.H index a8a7627e3b..5b6ed8c328 100644 --- a/src/thermophysicalModels/reactionThermo/mixtures/SpecieMixture/SpecieMixture.H +++ b/src/thermophysicalModels/reactionThermo/mixtures/SpecieMixture/SpecieMixture.H @@ -236,7 +236,7 @@ public: } // End namespace Foam -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #ifdef NoRepository #include "SpecieMixture.C" diff --git a/src/thermophysicalModels/reactionThermo/mixtures/egrMixture/egrMixture.C b/src/thermophysicalModels/reactionThermo/mixtures/egrMixture/egrMixture.C index 2a36c957fc..449a62da61 100644 --- a/src/thermophysicalModels/reactionThermo/mixtures/egrMixture/egrMixture.C +++ b/src/thermophysicalModels/reactionThermo/mixtures/egrMixture/egrMixture.C @@ -26,12 +26,6 @@ License #include "egrMixture.H" #include "fvMesh.H" -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -template -const char* Foam::egrMixture::specieNames_[3] = {"ft", "b", "egr"}; - - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template @@ -45,7 +39,7 @@ Foam::egrMixture::egrMixture basicCombustionMixture ( thermoDict, - speciesTable(nSpecies_, specieNames_), + speciesTable({"ft", "b", "egr"}), mesh, phaseName ), diff --git a/src/thermophysicalModels/reactionThermo/mixtures/egrMixture/egrMixture.H b/src/thermophysicalModels/reactionThermo/mixtures/egrMixture/egrMixture.H index ae3c0947d5..81879741e4 100644 --- a/src/thermophysicalModels/reactionThermo/mixtures/egrMixture/egrMixture.H +++ b/src/thermophysicalModels/reactionThermo/mixtures/egrMixture/egrMixture.H @@ -28,7 +28,7 @@ Group grpReactionThermophysicalMixtures Description - Foam::egrMixture + The egr mixture contains species ("ft", "b", "egr"). SourceFiles egrMixture.C @@ -54,10 +54,7 @@ class egrMixture : public basicCombustionMixture { - // Private data - - static const int nSpecies_ = 3; - static const char* specieNames_[3]; + // Private Data dimensionedScalar stoicRatio_; @@ -190,7 +187,7 @@ public: } // End namespace Foam -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #ifdef NoRepository #include "egrMixture.C" diff --git a/src/thermophysicalModels/reactionThermo/mixtures/homogeneousMixture/homogeneousMixture.C b/src/thermophysicalModels/reactionThermo/mixtures/homogeneousMixture/homogeneousMixture.C index 4ae9bc10bd..89ce85c6cd 100644 --- a/src/thermophysicalModels/reactionThermo/mixtures/homogeneousMixture/homogeneousMixture.C +++ b/src/thermophysicalModels/reactionThermo/mixtures/homogeneousMixture/homogeneousMixture.C @@ -26,12 +26,6 @@ License #include "homogeneousMixture.H" #include "fvMesh.H" -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -template -const char* Foam::homogeneousMixture::specieNames_[1] = {"b"}; - - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template @@ -45,7 +39,7 @@ Foam::homogeneousMixture::homogeneousMixture basicCombustionMixture ( thermoDict, - speciesTable(nSpecies_, specieNames_), + speciesTable({"b"}), mesh, phaseName ), diff --git a/src/thermophysicalModels/reactionThermo/mixtures/homogeneousMixture/homogeneousMixture.H b/src/thermophysicalModels/reactionThermo/mixtures/homogeneousMixture/homogeneousMixture.H index 3c600668e8..77ba0b52d3 100644 --- a/src/thermophysicalModels/reactionThermo/mixtures/homogeneousMixture/homogeneousMixture.H +++ b/src/thermophysicalModels/reactionThermo/mixtures/homogeneousMixture/homogeneousMixture.H @@ -28,7 +28,7 @@ Group grpReactionThermophysicalMixtures Description - Foam::homogeneousMixture + The homogeneous mixture contains species ("b"). SourceFiles homogeneousMixture.C @@ -54,10 +54,7 @@ class homogeneousMixture : public basicCombustionMixture { - // Private data - - static const int nSpecies_ = 1; - static const char* specieNames_[1]; + // Private Data ThermoType reactants_; ThermoType products_; @@ -148,7 +145,7 @@ public: } // End namespace Foam -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #ifdef NoRepository #include "homogeneousMixture.C" diff --git a/src/thermophysicalModels/reactionThermo/mixtures/inhomogeneousMixture/inhomogeneousMixture.C b/src/thermophysicalModels/reactionThermo/mixtures/inhomogeneousMixture/inhomogeneousMixture.C index 53346cbbe1..0d65c63e50 100644 --- a/src/thermophysicalModels/reactionThermo/mixtures/inhomogeneousMixture/inhomogeneousMixture.C +++ b/src/thermophysicalModels/reactionThermo/mixtures/inhomogeneousMixture/inhomogeneousMixture.C @@ -26,16 +26,6 @@ License #include "inhomogeneousMixture.H" #include "fvMesh.H" -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -template -const char* Foam::inhomogeneousMixture::specieNames_[2] = -{ - "ft", - "b" -}; - - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template @@ -49,7 +39,7 @@ Foam::inhomogeneousMixture::inhomogeneousMixture basicCombustionMixture ( thermoDict, - speciesTable(nSpecies_, specieNames_), + speciesTable({"ft", "b"}), mesh, phaseName ), diff --git a/src/thermophysicalModels/reactionThermo/mixtures/inhomogeneousMixture/inhomogeneousMixture.H b/src/thermophysicalModels/reactionThermo/mixtures/inhomogeneousMixture/inhomogeneousMixture.H index efebb9fa51..43a432491a 100644 --- a/src/thermophysicalModels/reactionThermo/mixtures/inhomogeneousMixture/inhomogeneousMixture.H +++ b/src/thermophysicalModels/reactionThermo/mixtures/inhomogeneousMixture/inhomogeneousMixture.H @@ -28,7 +28,7 @@ Group grpReactionThermophysicalMixtures Description - Foam::inhomogeneousMixture + The inhomogeneous mixture contains species ("ft", "b"). SourceFiles inhomogeneousMixture.C @@ -54,10 +54,7 @@ class inhomogeneousMixture : public basicCombustionMixture { - // Private data - - static const int nSpecies_ = 2; - static const char* specieNames_[2]; + // Private Data dimensionedScalar stoicRatio_; @@ -182,7 +179,7 @@ public: } // End namespace Foam -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #ifdef NoRepository #include "inhomogeneousMixture.C" diff --git a/src/thermophysicalModels/reactionThermo/mixtures/veryInhomogeneousMixture/veryInhomogeneousMixture.C b/src/thermophysicalModels/reactionThermo/mixtures/veryInhomogeneousMixture/veryInhomogeneousMixture.C index a745c41d3a..0ed7b76702 100644 --- a/src/thermophysicalModels/reactionThermo/mixtures/veryInhomogeneousMixture/veryInhomogeneousMixture.C +++ b/src/thermophysicalModels/reactionThermo/mixtures/veryInhomogeneousMixture/veryInhomogeneousMixture.C @@ -26,17 +26,6 @@ License #include "veryInhomogeneousMixture.H" #include "fvMesh.H" -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -template -const char* Foam::veryInhomogeneousMixture::specieNames_[3] = -{ - "ft", - "fu", - "b" -}; - - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template @@ -50,7 +39,7 @@ Foam::veryInhomogeneousMixture::veryInhomogeneousMixture basicCombustionMixture ( thermoDict, - speciesTable(nSpecies_, specieNames_), + speciesTable({"ft", "fu", "b"}), mesh, phaseName ), diff --git a/src/thermophysicalModels/reactionThermo/mixtures/veryInhomogeneousMixture/veryInhomogeneousMixture.H b/src/thermophysicalModels/reactionThermo/mixtures/veryInhomogeneousMixture/veryInhomogeneousMixture.H index e6ab583aa0..6286beab63 100644 --- a/src/thermophysicalModels/reactionThermo/mixtures/veryInhomogeneousMixture/veryInhomogeneousMixture.H +++ b/src/thermophysicalModels/reactionThermo/mixtures/veryInhomogeneousMixture/veryInhomogeneousMixture.H @@ -28,7 +28,7 @@ Group grpReactionThermophysicalMixtures Description - Foam::veryInhomogeneousMixture + The very inhomogeneous mixture contains species ("ft", "fu", "b"). SourceFiles veryInhomogeneousMixture.C @@ -54,10 +54,7 @@ class veryInhomogeneousMixture : public basicCombustionMixture { - // Private data - - static const int nSpecies_ = 3; - static const char* specieNames_[3]; + // Private Data dimensionedScalar stoicRatio_; @@ -183,7 +180,7 @@ public: } // End namespace Foam -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #ifdef NoRepository #include "veryInhomogeneousMixture.C" diff --git a/src/thermophysicalModels/solidChemistryModel/basicSolidChemistryModel/basicSolidChemistryModelNew.C b/src/thermophysicalModels/solidChemistryModel/basicSolidChemistryModel/basicSolidChemistryModelNew.C index 0e7f7551ee..3a0786137e 100644 --- a/src/thermophysicalModels/solidChemistryModel/basicSolidChemistryModel/basicSolidChemistryModelNew.C +++ b/src/thermophysicalModels/solidChemistryModel/basicSolidChemistryModel/basicSolidChemistryModelNew.C @@ -50,8 +50,7 @@ Foam::basicSolidChemistryModel::New(solidReactionThermo& thermo) Info<< "Selecting chemistry type " << chemistryTypeDict << endl; - const int nCmpt = 13; - const char* cmptNames[nCmpt] = + std::initializer_list cmptNames { "chemistrySolver", "chemistryThermo", @@ -136,10 +135,14 @@ Foam::basicSolidChemistryModel::New(solidReactionThermo& thermo) validChemistryTypeNames.size() + 1 ); + const int nCmpt = cmptNames.size(); validChemistryTypeNameCmpts[0].setSize(nCmpt); - forAll(validChemistryTypeNameCmpts[0], j) + + label j = 0; + for (const char* cmptName : cmptNames) { - validChemistryTypeNameCmpts[0][j] = cmptNames[j]; + validChemistryTypeNameCmpts[0][j] = cmptName; + ++j; } // Split the thermo package names into their constituent parts