From 5acfe8b20ac02c34fb8232db78a077b83703e64b Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Fri, 2 Aug 2019 22:47:45 +0100 Subject: [PATCH] reactingMixture: Rationalised the reading of the species thermo and reactions which are now read directly from the thermophysicalProperties dictionary for consistency with non-reacting mixture thermodynamics. The species thermo and reactions lists can still be in separate files if convenient and included into the thermophysicalProperties file using the standard dictionary #include. --- .../chemkinToFoam/chemkinToFoam.C | 40 +- etc/caseDicts/annotated/collapseDict | 2 +- .../singleFluidCHT/templates/0/fluid/T | 2 +- .../singleFluidCHT/templates/0/fluid/p | 2 +- .../singleFluidCHT/templates/0/fluid/p_rgh | 2 +- .../singleFluidCHT/templates/0/solid/T | 2 +- .../singleFluidCHT/templates/0/solid/p | 2 +- .../multiComponentMixture.C | 30 +- .../multiComponentMixture.H | 11 - .../foamChemistryReader/foamChemistryReader.C | 185 --- .../foamChemistryReader/foamChemistryReader.H | 178 --- .../reactingMixture/reactingMixture.C | 96 +- .../reactingMixture/reactingMixture.H | 18 +- .../const/constAnIsoSolidTransport.H | 3 + .../const/constAnIsoSolidTransportI.H | 11 + .../transport/const/constIsoSolidTransport.H | 3 + .../transport/const/constIsoSolidTransportI.H | 60 +- .../exponential/exponentialSolidTransport.H | 3 + .../exponential/exponentialSolidTransportI.H | 11 + .../Reactions/ReactionList/ReactionList.H | 10 +- tutorials/combustion/chemFoam/gri/Allclean | 2 +- tutorials/combustion/chemFoam/gri/Allrun | 2 +- .../combustion/chemFoam/gri/constant/thermo | 1392 +++++++++++++++++ .../gri/constant/thermophysicalProperties | 4 +- tutorials/combustion/chemFoam/h2/Allclean | 2 +- tutorials/combustion/chemFoam/h2/Allrun | 2 +- .../h2/constant/thermophysicalProperties | 4 +- tutorials/combustion/chemFoam/ic8h18/Allclean | 2 +- tutorials/combustion/chemFoam/ic8h18/Allrun | 2 +- .../ic8h18/constant/thermophysicalProperties | 4 +- .../combustion/chemFoam/ic8h18_TDAC/Allclean | 2 +- .../combustion/chemFoam/ic8h18_TDAC/Allrun | 2 +- .../constant/thermophysicalProperties | 4 +- tutorials/combustion/chemFoam/nc7h16/Allclean | 2 +- tutorials/combustion/chemFoam/nc7h16/Allrun | 2 +- .../nc7h16/constant/thermophysicalProperties | 4 +- .../constant/thermophysicalProperties | 7 +- .../pyrolysisRegion/thermophysicalProperties | 9 +- .../constant/thermophysicalProperties | 4 +- .../panelRegion/thermophysicalProperties | 8 +- .../constant/thermophysicalProperties | 4 +- .../constant/thermophysicalProperties | 4 +- .../constant/thermophysicalProperties | 4 +- .../RAS/DLR_A_LTS/constant/reactionsGRI | 118 +- .../constant/thermo.compressibleGasGRI | 2 + .../constant/thermophysicalProperties | 4 +- .../constant/thermophysicalProperties | 4 +- .../constant/thermophysicalProperties | 4 +- .../constant/thermophysicalProperties | 4 +- .../constant/thermophysicalProperties | 4 +- .../constant/thermophysicalProperties | 4 +- .../constant/thermophysicalProperties | 4 +- .../constant/thermophysicalProperties | 4 +- .../coolingSphere/templates/0/fluid/T | 2 +- .../coolingSphere/templates/0/fluid/p | 2 +- .../coolingSphere/templates/0/fluid/p_rgh | 2 +- .../coolingSphere/templates/0/solid/T | 2 +- .../coolingSphere/templates/0/solid/p | 2 +- .../constant/gas/thermophysicalProperties | 7 +- .../straightDuctImplicit/system/collapseDict | 2 +- .../system/collapseDict.collapseFaces | 2 +- .../system/collapseDict.indirectPatchFaces | 2 +- .../constant/{foam.inp => reactions} | 10 - .../constant/{foam.dat => speciesThermo} | 25 +- .../constant/thermophysicalProperties | 4 +- .../constant/thermophysicalProperties | 4 +- .../cylinder/constant/foam.inp | 10 - .../cylinder/constant/reactions | 2 + .../constant/{foam.dat => speciesThermo} | 22 +- .../constant/thermophysicalProperties | 4 +- .../filter/constant/thermophysicalProperties | 4 +- .../hotBoxes/constant/foam.inp | 10 - .../hotBoxes/constant/reactions | 2 + .../constant/{foam.dat => speciesThermo} | 22 +- .../constant/thermophysicalProperties | 4 +- .../constant/thermophysicalProperties | 4 +- .../rivuletPanel/constant/foam.inp | 10 - .../rivuletPanel/constant/reactions | 2 + .../constant/{foam.dat => speciesThermo} | 22 +- .../constant/thermophysicalProperties | 4 +- .../splashPanel/constant/foam.inp | 10 - .../splashPanel/constant/reactions | 2 + .../constant/{foam.dat => speciesThermo} | 22 +- .../constant/thermophysicalProperties | 4 +- .../constant/thermophysicalProperties | 4 +- .../constant/thermophysicalProperties | 4 +- .../constant/thermophysicalProperties | 4 +- .../lagrangian/sprayFoam/aachenBomb/Allclean | 2 +- .../lagrangian/sprayFoam/aachenBomb/Allrun | 2 +- .../constant/thermophysicalProperties | 4 +- .../foamyHexMesh/blob/system/collapseDict | 2 +- .../foamyHexMesh/flange/system/collapseDict | 2 +- .../system/collapseDict.collapseFaces | 2 +- .../system/collapseDict.indirectPatchFaces | 2 +- .../simpleShapes/system/collapseDict | 2 +- .../jaggedBoundary/system/foamyQuadMeshDict | 2 +- .../square/system/foamyQuadMeshDict | 2 +- .../interFoam/RAS/DTCHullWave/0/U.orig | 2 +- .../constant/thermophysicalProperties.gas | 7 +- 99 files changed, 1759 insertions(+), 805 deletions(-) delete mode 100644 src/thermophysicalModels/reactionThermo/mixtures/reactingMixture/foamChemistryReader/foamChemistryReader.C delete mode 100644 src/thermophysicalModels/reactionThermo/mixtures/reactingMixture/foamChemistryReader/foamChemistryReader.H create mode 100644 tutorials/combustion/chemFoam/gri/constant/thermo rename tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/{foam.inp => reactions} (89%) rename tutorials/lagrangian/coalChemistryFoam/simplifiedSiwek/constant/{foam.dat => speciesThermo} (82%) delete mode 100644 tutorials/lagrangian/reactingParcelFoam/cylinder/constant/foam.inp create mode 100644 tutorials/lagrangian/reactingParcelFoam/cylinder/constant/reactions rename tutorials/lagrangian/reactingParcelFoam/cylinder/constant/{foam.dat => speciesThermo} (71%) delete mode 100644 tutorials/lagrangian/reactingParcelFoam/hotBoxes/constant/foam.inp create mode 100644 tutorials/lagrangian/reactingParcelFoam/hotBoxes/constant/reactions rename tutorials/lagrangian/reactingParcelFoam/hotBoxes/constant/{foam.dat => speciesThermo} (71%) delete mode 100644 tutorials/lagrangian/reactingParcelFoam/rivuletPanel/constant/foam.inp create mode 100644 tutorials/lagrangian/reactingParcelFoam/rivuletPanel/constant/reactions rename tutorials/lagrangian/reactingParcelFoam/rivuletPanel/constant/{foam.dat => speciesThermo} (71%) delete mode 100644 tutorials/lagrangian/reactingParcelFoam/splashPanel/constant/foam.inp create mode 100644 tutorials/lagrangian/reactingParcelFoam/splashPanel/constant/reactions rename tutorials/lagrangian/reactingParcelFoam/splashPanel/constant/{foam.dat => speciesThermo} (71%) diff --git a/applications/utilities/thermophysical/chemkinToFoam/chemkinToFoam.C b/applications/utilities/thermophysical/chemkinToFoam/chemkinToFoam.C index dabdc9ae5b..5bb1758577 100644 --- a/applications/utilities/thermophysical/chemkinToFoam/chemkinToFoam.C +++ b/applications/utilities/thermophysical/chemkinToFoam/chemkinToFoam.C @@ -64,43 +64,47 @@ int main(int argc, char *argv[]) bool newFormat = args.optionFound("newFormat"); speciesTable species; - chemkinReader cr(species, args[1], args[3], args[2], newFormat); + const HashPtrTable& speciesThermo = cr.speciesThermo(); - OFstream reactionsFile(args[4]); - writeEntry(reactionsFile, "elements", cr.elementNames()); - reactionsFile << nl; - writeEntry(reactionsFile, "species", cr.species()); - reactionsFile << nl; - cr.reactions().write(reactionsFile); + dictionary thermoDict; + thermoDict.add("species", cr.species()); + + // Add the species thermo formatted entries + { + OStringStream os; + speciesThermo.write(os); + dictionary speciesThermoDict(IStringStream(os.str())()); + thermoDict.merge(speciesThermoDict); + } // Temporary hack to splice the specie composition data into the thermo file // pending complete integration into the thermodynamics structure - OStringStream os; - cr.speciesThermo().write(os); - dictionary thermoDict(IStringStream(os.str())()); - - wordList speciesList(thermoDict.toc()); - // Add elements - forAll(speciesList, si) + forAllConstIter(HashPtrTable, speciesThermo, iter) { + const word specieName(iter.key()); + dictionary elementsDict("elements"); - forAll(cr.specieComposition()[speciesList[si]], ei) + forAll(cr.specieComposition()[specieName], ei) { elementsDict.add ( - cr.specieComposition()[speciesList[si]][ei].name(), - cr.specieComposition()[speciesList[si]][ei].nAtoms() + cr.specieComposition()[specieName][ei].name(), + cr.specieComposition()[specieName][ei].nAtoms() ); } - thermoDict.subDict(speciesList[si]).add("elements", elementsDict); + thermoDict.subDict(specieName).add("elements", elementsDict); } thermoDict.write(OFstream(args[5])(), false); + + OFstream reactionsFile(args[4]); + cr.reactions().write(reactionsFile); + reactionsFile << nl; writeEntry diff --git a/etc/caseDicts/annotated/collapseDict b/etc/caseDicts/annotated/collapseDict index f8bcef89d4..762623088c 100644 --- a/etc/caseDicts/annotated/collapseDict +++ b/etc/caseDicts/annotated/collapseDict @@ -72,7 +72,7 @@ controlMeshQualityCoeffs { // Name of the dictionary that has the mesh quality coefficients used // by motionSmoother::checkMesh - #include "meshQualityDict"; + #include "meshQualityDict" // The amount that minimumEdgeLength will be reduced by for each // edge if that edge's collapse generates a poor quality face diff --git a/etc/templates/singleFluidCHT/templates/0/fluid/T b/etc/templates/singleFluidCHT/templates/0/fluid/T index fa5585b887..ce5bce2ca0 100644 --- a/etc/templates/singleFluidCHT/templates/0/fluid/T +++ b/etc/templates/singleFluidCHT/templates/0/fluid/T @@ -14,7 +14,7 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -#include "$FOAM_CASE/constant/initialConditions"; +#include "$FOAM_CASE/constant/initialConditions" dimensions [0 0 0 1 0 0 0]; diff --git a/etc/templates/singleFluidCHT/templates/0/fluid/p b/etc/templates/singleFluidCHT/templates/0/fluid/p index fbc3458cb7..afd98aede4 100644 --- a/etc/templates/singleFluidCHT/templates/0/fluid/p +++ b/etc/templates/singleFluidCHT/templates/0/fluid/p @@ -14,7 +14,7 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -#include "$FOAM_CASE/constant/initialConditions"; +#include "$FOAM_CASE/constant/initialConditions" dimensions [1 -1 -2 0 0 0 0]; diff --git a/etc/templates/singleFluidCHT/templates/0/fluid/p_rgh b/etc/templates/singleFluidCHT/templates/0/fluid/p_rgh index 40508e261e..cc9d4b9bcd 100644 --- a/etc/templates/singleFluidCHT/templates/0/fluid/p_rgh +++ b/etc/templates/singleFluidCHT/templates/0/fluid/p_rgh @@ -14,7 +14,7 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -#include "$FOAM_CASE/constant/initialConditions"; +#include "$FOAM_CASE/constant/initialConditions" dimensions [ 1 -1 -2 0 0 0 0 ]; diff --git a/etc/templates/singleFluidCHT/templates/0/solid/T b/etc/templates/singleFluidCHT/templates/0/solid/T index 9908547d97..b882807c73 100644 --- a/etc/templates/singleFluidCHT/templates/0/solid/T +++ b/etc/templates/singleFluidCHT/templates/0/solid/T @@ -14,7 +14,7 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -#include "$FOAM_CASE/constant/initialConditions"; +#include "$FOAM_CASE/constant/initialConditions" dimensions [ 0 0 0 1 0 0 0 ]; diff --git a/etc/templates/singleFluidCHT/templates/0/solid/p b/etc/templates/singleFluidCHT/templates/0/solid/p index 8d32216a66..f7698db520 100644 --- a/etc/templates/singleFluidCHT/templates/0/solid/p +++ b/etc/templates/singleFluidCHT/templates/0/solid/p @@ -14,7 +14,7 @@ FoamFile } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -#include "$FOAM_CASE/constant/initialConditions"; +#include "$FOAM_CASE/constant/initialConditions" dimensions [1 -1 -2 0 0 0 0]; diff --git a/src/thermophysicalModels/reactionThermo/mixtures/multiComponentMixture/multiComponentMixture.C b/src/thermophysicalModels/reactionThermo/mixtures/multiComponentMixture/multiComponentMixture.C index e0a15431b5..dabc9779e8 100644 --- a/src/thermophysicalModels/reactionThermo/mixtures/multiComponentMixture/multiComponentMixture.C +++ b/src/thermophysicalModels/reactionThermo/mixtures/multiComponentMixture/multiComponentMixture.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -73,34 +73,6 @@ void Foam::multiComponentMixture::correctMassFractions() // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -template -Foam::multiComponentMixture::multiComponentMixture -( - const dictionary& thermoDict, - const wordList& specieNames, - const HashPtrTable& thermoData, - const fvMesh& mesh, - const word& phaseName -) -: - basicSpecieMixture(thermoDict, specieNames, mesh, phaseName), - speciesData_(species_.size()), - mixture_("mixture", *thermoData[specieNames[0]]), - mixtureVol_("volMixture", *thermoData[specieNames[0]]) -{ - forAll(species_, i) - { - speciesData_.set - ( - i, - new ThermoType(*thermoData[species_[i]]) - ); - } - - correctMassFractions(); -} - - template Foam::multiComponentMixture::multiComponentMixture ( diff --git a/src/thermophysicalModels/reactionThermo/mixtures/multiComponentMixture/multiComponentMixture.H b/src/thermophysicalModels/reactionThermo/mixtures/multiComponentMixture/multiComponentMixture.H index c300c99206..c7a3cb0401 100644 --- a/src/thermophysicalModels/reactionThermo/mixtures/multiComponentMixture/multiComponentMixture.H +++ b/src/thermophysicalModels/reactionThermo/mixtures/multiComponentMixture/multiComponentMixture.H @@ -86,17 +86,6 @@ public: // Constructors - //- Construct from dictionary, specie names, thermo database, - // mesh and phase name - multiComponentMixture - ( - const dictionary&, - const wordList& specieNames, - const HashPtrTable& thermoData, - const fvMesh&, - const word& - ); - //- Construct from dictionary, mesh and phase name multiComponentMixture(const dictionary&, const fvMesh&, const word&); diff --git a/src/thermophysicalModels/reactionThermo/mixtures/reactingMixture/foamChemistryReader/foamChemistryReader.C b/src/thermophysicalModels/reactionThermo/mixtures/reactingMixture/foamChemistryReader/foamChemistryReader.C deleted file mode 100644 index 328dbb9a43..0000000000 --- a/src/thermophysicalModels/reactionThermo/mixtures/reactingMixture/foamChemistryReader/foamChemistryReader.C +++ /dev/null @@ -1,185 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2019 OpenFOAM Foundation - \\/ 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 3 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, see . - -\*---------------------------------------------------------------------------*/ - -#include "foamChemistryReader.H" -#include "IFstream.H" -#include "addToRunTimeSelectionTable.H" - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -template -Foam::speciesTable& Foam::foamChemistryReader::setSpecies -( - const dictionary& dict, - speciesTable& species -) -{ - wordList s(dict.lookup("species")); - species.transfer(s); - return species; -} - - -template -void Foam::foamChemistryReader::readSpeciesComposition() -{ - if (!chemDict_.found("elements")) - { - Info<< " elements not defined in " << chemDict_.name() << endl; - return; - } - - wordList e(chemDict_.lookup("elements")); - label currentElementIndex(0); - - DynamicList elementNames_; - HashTable