From 966457788c6de44c4fd09ba8760915b2d5c40774 Mon Sep 17 00:00:00 2001 From: Will Bainbridge Date: Tue, 23 May 2023 09:14:40 +0100 Subject: [PATCH 1/4] IOerror: Split location into separate class This simplifies the IOerror constructors and allows for the location to be conveniently cached for errors that can't be triggered until after the IO operation. --- src/OpenFOAM/db/error/IOerror.C | 89 +++++++-------- src/OpenFOAM/db/error/error.H | 106 ++++++++++-------- .../uncollatedFileOperation.C | 5 +- 3 files changed, 104 insertions(+), 96 deletions(-) diff --git a/src/OpenFOAM/db/error/IOerror.C b/src/OpenFOAM/db/error/IOerror.C index 68bf428bf0..d0f9de1397 100644 --- a/src/OpenFOAM/db/error/IOerror.C +++ b/src/OpenFOAM/db/error/IOerror.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -32,75 +32,66 @@ License // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -Foam::IOerror::IOerror(const string& title) +Foam::IOerrorLocation::IOerrorLocation() : - error(title), ioFileName_("unknown"), ioStartLineNumber_(-1), ioEndLineNumber_(-1) {} +Foam::IOerrorLocation::IOerrorLocation +( + const string& ioFileName, + const label ioStartLineNumber, + const label ioEndLineNumber +) +: + ioFileName_(ioFileName), + ioStartLineNumber_(ioStartLineNumber), + ioEndLineNumber_(ioEndLineNumber) +{} + + +Foam::IOerrorLocation::IOerrorLocation(const IOstream& ios) +: + ioFileName_(ios.name()), + ioStartLineNumber_(ios.lineNumber()), + ioEndLineNumber_(-1) +{} + + +Foam::IOerrorLocation::IOerrorLocation(const dictionary& dict) +: + ioFileName_(dict.name()), + ioStartLineNumber_(dict.startLineNumber()), + ioEndLineNumber_(dict.endLineNumber()) +{} + + +Foam::IOerror::IOerror(const string& title) +: + error(title), + IOerrorLocation() +{} + + Foam::OSstream& Foam::IOerror::operator() ( const char* functionName, const char* sourceFileName, const int sourceFileLineNumber, - const string& ioFileName, - const label ioStartLineNumber, - const label ioEndLineNumber + const IOerrorLocation& location ) { error::operator()(functionName, sourceFileName, sourceFileLineNumber); - ioFileName_ = ioFileName; - ioStartLineNumber_ = ioStartLineNumber; - ioEndLineNumber_ = ioEndLineNumber; + IOerrorLocation::operator=(location); return operator OSstream&(); } -Foam::OSstream& Foam::IOerror::operator() -( - const char* functionName, - const char* sourceFileName, - const int sourceFileLineNumber, - const IOstream& ioStream -) -{ - return operator() - ( - functionName, - sourceFileName, - sourceFileLineNumber, - ioStream.name(), - ioStream.lineNumber(), - -1 - ); -} - - -Foam::OSstream& Foam::IOerror::operator() -( - const char* functionName, - const char* sourceFileName, - const int sourceFileLineNumber, - const dictionary& dict -) -{ - return operator() - ( - functionName, - sourceFileName, - sourceFileLineNumber, - dict.name(), - dict.startLineNumber(), - dict.endLineNumber() - ); -} - - void Foam::IOerror::SafeFatalIOError ( const char* functionName, diff --git a/src/OpenFOAM/db/error/error.H b/src/OpenFOAM/db/error/error.H index 479cb9bf7b..ef96a28ff9 100644 --- a/src/OpenFOAM/db/error/error.H +++ b/src/OpenFOAM/db/error/error.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -181,21 +181,76 @@ Ostream& operator<<(Ostream&, const IOerror&); /*---------------------------------------------------------------------------*\ - Class IOerror Declaration + Class IOerrorLocation Declaration \*---------------------------------------------------------------------------*/ -//- Report an I/O error -class IOerror -: - public error +class IOerrorLocation { // Private Data + //- File name string ioFileName_; + + //- Start line number label ioStartLineNumber_; + + //- End Line number label ioEndLineNumber_; +public: + + // Constructors + + //- Construct null + IOerrorLocation(); + + //- Construct from components + IOerrorLocation + ( + const string& ioFileName, + const label ioStartLineNumber = -1, + const label ioEndLineNumber = -1 + ); + + //- Construct from a stream + IOerrorLocation(const IOstream&); + + //- Construct from a dictionary + IOerrorLocation(const dictionary&); + + + // Member Functions + + //- Access the file name + inline const string& ioFileName() const + { + return ioFileName_; + } + + //- Access the start line number + inline label ioStartLineNumber() const + { + return ioStartLineNumber_; + } + + //- Access the end line number + inline label ioEndLineNumber() const + { + return ioEndLineNumber_; + } +}; + + +/*---------------------------------------------------------------------------*\ + Class IOerror Declaration +\*---------------------------------------------------------------------------*/ + +class IOerror +: + public error, + public IOerrorLocation +{ public: // Constructors @@ -206,21 +261,6 @@ public: // Member Functions - const string& ioFileName() const - { - return ioFileName_; - } - - label ioStartLineNumber() const - { - return ioStartLineNumber_; - } - - label ioEndLineNumber() const - { - return ioEndLineNumber_; - } - //- Convert to OSstream // Prints basic message and returns OSstream for further info. OSstream& operator() @@ -228,29 +268,7 @@ public: const char* functionName, const char* sourceFileName, const int sourceFileLineNumber, - const string& ioFileName, - const label ioStartLineNumber = -1, - const label ioEndLineNumber = -1 - ); - - //- Convert to OSstream - // Prints basic message and returns OSstream for further info. - OSstream& operator() - ( - const char* functionName, - const char* sourceFileName, - const int sourceFileLineNumber, - const IOstream& - ); - - //- Convert to OSstream - // Prints basic message and returns OSstream for further info. - OSstream& operator() - ( - const char* functionName, - const char* sourceFileName, - const int sourceFileLineNumber, - const dictionary& + const IOerrorLocation& location ); //- Print basic message and exit. Uses cerr if streams not constructed diff --git a/src/OpenFOAM/global/fileOperations/uncollatedFileOperation/uncollatedFileOperation.C b/src/OpenFOAM/global/fileOperations/uncollatedFileOperation/uncollatedFileOperation.C index e9dc884cde..8d749073ae 100644 --- a/src/OpenFOAM/global/fileOperations/uncollatedFileOperation/uncollatedFileOperation.C +++ b/src/OpenFOAM/global/fileOperations/uncollatedFileOperation/uncollatedFileOperation.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2017-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2017-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -550,8 +550,7 @@ Foam::fileOperations::uncollatedFileOperation::readStream "uncollatedFileOperation::readStream()", __FILE__, __LINE__, - fName, - 0 + IOerrorLocation(fName, 0) ) << "cannot open file" << exit(FatalIOError); } From 3c542d664bcb002cf8913f25e3a5b5c647c0c6ed Mon Sep 17 00:00:00 2001 From: Will Bainbridge Date: Tue, 30 May 2023 08:01:28 +0100 Subject: [PATCH 2/4] thermophysicalModels: Primitive mixture classes Mixture classes (e.g., pureMixtrure, coefficientMulticomponentMixture), now have no fvMesh or volScalarField dependence. They operate on primitive values only. All the fvMesh-dependent functionality has been moved into the base thermodynamic classes. The 'composition()' access function has been removed from multi-component thermo models. Functions that were once provided by composition base classes such as basicSpecieMixture and basicCombustionMixture are now implemented directly in the relevant multi-component thermo base class. --- applications/legacy/combustion/PDRFoam/bEqn.H | 4 +- .../legacy/combustion/PDRFoam/createFields.H | 8 +- .../legacy/combustion/PDRFoam/ftEqn.H | 4 +- .../SCOPE/SCOPELaminarFlameSpeed.C | 10 +- applications/modules/XiFluid/XiFluid.C | 8 +- applications/modules/XiFluid/XiFluid.H | 4 - .../modules/XiFluid/thermophysicalPredictor.C | 4 +- .../multicomponentFluid/multicomponentFluid.C | 4 +- .../multicomponentFluid/multicomponentFluid.H | 1 - .../modules/multicomponentFluid/setRDeltaT.C | 2 +- .../thermophysicalPredictor.C | 4 +- .../interfaceCompositionModels/Henry/Henry.C | 4 +- .../Raoult/Raoult.C | 12 +- .../interfaceCompositionModel.C | 12 +- .../interfaceCompositionModel.H | 11 +- .../interfaceCompositionModelI.H | 20 +- .../nonRandomTwoLiquid/nonRandomTwoLiquid.C | 24 +- .../saturated/saturated.C | 16 +- .../HeatTransferPhaseSystem.C | 136 ++--- .../MulticomponentPhaseModel.C | 12 +- .../solvers/chemFoam/createFieldRefs.H | 3 +- .../solvers/chemFoam/thermoTypeFunctions.H | 10 +- .../fluidMulticomponentThermoTemplate.C | 42 +- .../dynamicCode/fluidThermoTemplate.C | 39 +- .../psiuMulticomponentThermoTemplate.C | 31 +- .../dynamicCode/solidThermoTemplate.C | 31 +- .../fluid/laminar/Fickian/Fickian.C | 73 ++- .../laminar/MaxwellStefan/MaxwellStefan.C | 85 ++- .../nonUnityLewisEddyDiffusivity.C | 12 +- src/combustionModels/EDC/EDC.C | 2 +- src/combustionModels/FSD/FSD.C | 8 +- src/combustionModels/diffusion/diffusion.C | 9 +- .../adjustTimeStepToCombustion.C | 4 +- .../infinitelyFastChemistry.C | 8 +- src/combustionModels/laminar/laminar.C | 2 +- .../noCombustion/noCombustion.C | 2 +- .../mixtureFraction/mixtureFraction.C | 15 +- .../singleStepCombustion.C | 51 +- .../singleStepCombustion.H | 9 +- .../singleStepCombustionI.H | 8 +- .../parcel/fvModels/clouds/clouds.C | 38 +- .../ReactingMultiphaseParcel.C | 10 +- .../Templates/ReactingParcel/ReactingParcel.C | 25 +- .../CompositionModel/CompositionModel.C | 43 +- .../CompositionModel/CompositionModel.H | 12 +- .../LiquidEvaporation/LiquidEvaporation.C | 4 +- .../LiquidEvaporationBoil.C | 13 +- .../COxidationDiffusionLimitedRate.C | 9 +- .../COxidationHurtMitchell.C | 9 +- .../COxidationIntrinsicRate.C | 9 +- .../COxidationKineticDiffusionLimitedRate.C | 9 +- .../COxidationMurphyShaddix.C | 9 +- .../greyMean/greyMean.C | 18 +- .../wideBand/wideBand.C | 23 +- ...adsorptionMassFractionFvPatchScalarField.C | 6 +- ...adsorptionMassFractionFvPatchScalarField.H | 2 - ...ableBaffleMassFractionFvPatchScalarField.C | 6 +- ...ableBaffleMassFractionFvPatchScalarField.H | 2 - ...ieTransferMassFractionFvPatchScalarField.C | 12 +- ...ieTransferMassFractionFvPatchScalarField.H | 9 +- ...cieTransferTemperatureFvPatchScalarField.C | 11 +- ...specieTransferVelocityFvPatchVectorField.C | 4 +- src/thermophysicalModels/basic/Make/files | 8 +- .../basic/PhysicalPropertiesThermo.C | 82 +++ .../basic/PhysicalPropertiesThermo.H | 96 ++++ .../basic/basicThermo/basicThermo.C | 13 +- .../basic/basicThermo/basicThermo.H | 30 +- .../basic/basicThermo/basicThermoTemplates.C | 5 +- .../basic/fluidThermo/fluidThermo.C | 3 +- .../basic/fluidThermo/fluidThermo.H | 6 +- .../basic/heThermo/heThermo.C | 255 +++++---- .../basic/heThermo/heThermo.H | 109 ++-- .../basic/heThermo/heThermoName.C | 36 ++ .../liquidThermo/heLiquidThermo.C} | 64 ++- .../heLiquidThermo.H} | 101 ++-- .../basic/liquidThermo/liquidThermo.C | 55 ++ .../basic/liquidThermo/liquidThermo.H | 153 ++++++ .../basic/liquidThermo/liquidThermos.C | 66 +++ .../liquidThermo.H => makeFluidThermo.H} | 61 +-- .../basic/mixtures/pureMixture/pureMixture.C | 15 +- .../basic/mixtures/pureMixture/pureMixture.H | 76 +-- .../basic/psiThermo/hePsiThermo.C | 57 +- .../basic/psiThermo/hePsiThermo.H | 25 +- .../basic/psiThermo/psiThermo.C | 5 +- .../basic/psiThermo/psiThermo.H | 32 +- .../basic/psiThermo/psiThermos.C | 6 +- .../basic/pureThermo/pureThermo.C | 34 ++ .../pureThermo.H} | 50 +- .../basic/pureThermo/pureThermoI.H | 46 ++ .../basic/rhoThermo/heRhoThermo.C | 57 +- .../basic/rhoThermo/heRhoThermo.H | 25 +- .../basic/rhoThermo/rhoThermo.C | 5 +- .../basic/rhoThermo/rhoThermo.H | 33 +- .../basic/rhoThermo/rhoThermos.C | 10 +- .../chemistryModel/chemistryModel.C | 27 +- .../chemistryModel/chemistryModel.H | 11 +- .../chemistryModel/chemistryModelI.H | 16 +- .../chemistryModel/reduction/DAC/DAC.C | 6 +- .../chemistryModel/reduction/DRG/DRG.C | 4 +- .../chemistryModel/reduction/DRGEP/DRGEP.C | 4 +- .../chemistryModel/reduction/PFA/PFA.C | 4 +- .../chemistryReductionMethod.C | 6 +- .../specieReactionRates/specieReactionRates.C | 2 +- .../odeChemistryModel/odeChemistryModel.C | 4 +- .../laminarFlameSpeed/Gulders/Gulders.C | 7 +- .../laminarFlameSpeed/GuldersEGR/GuldersEGR.C | 10 +- .../RaviPetersen/RaviPetersen.C | 7 +- .../laminarFlameSpeed/laminarFlameSpeed.C | 2 +- .../multicomponentThermo/Make/files | 3 +- .../fluidMulticomponentThermo.C | 15 +- .../fluidMulticomponentThermo.H | 52 +- .../heFluidMulticomponentThermo.C | 84 +++ .../heFluidMulticomponentThermo.H | 114 ++++ .../makeFluidMulticomponentThermo.H | 58 +++ .../massFractions/massFractions.C | 6 +- .../moleFractions/moleFractions.C | 4 +- .../include/FieldListSlice.H | 111 ++++ .../include/GeometricFieldListSlicer.H | 153 ++++++ .../makeMulticomponentThermo.H | 129 ----- .../basicSpecieMixture/basicSpecieMixtureI.H | 131 ----- .../coefficientMulticomponentMixture.C | 52 +- .../coefficientMulticomponentMixture.H | 72 +-- .../coefficientWilkeMulticomponentMixture.C | 229 +++----- .../coefficientWilkeMulticomponentMixture.H | 127 ++--- .../mixtures/egrMixture/egrMixture.C | 128 +++-- .../mixtures/egrMixture/egrMixture.H | 180 +++---- .../homogeneousMixture/homogeneousMixture.C | 97 ++-- .../homogeneousMixture/homogeneousMixture.H | 131 ++--- .../inhomogeneousMixture.C | 132 +++-- .../inhomogeneousMixture.H | 160 ++---- .../multicomponentMixture.C | 137 ++--- .../multicomponentMixture.H | 45 +- .../singleComponentMixture.C | 11 +- .../singleComponentMixture.H | 63 +-- .../valueMulticomponentMixture.C | 186 +++---- .../valueMulticomponentMixture.H | 265 +++++----- .../veryInhomogeneousMixture.C | 129 ++--- .../veryInhomogeneousMixture.H | 167 ++---- .../heMulticomponentThermo.C} | 286 +++++----- .../heMulticomponentThermo.H} | 152 ++---- .../multicomponentThermo.C} | 186 ++++--- .../multicomponentThermo.H} | 493 ++++++++++-------- .../multicomponentThermoI.H | 128 +++++ .../psiMulticomponentThermo.C | 15 +- .../psiMulticomponentThermo.H | 72 +-- .../psiMulticomponentThermos.C | 44 +- .../psiuMulticomponentThermo/heheuPsiThermo.C | 131 +++-- .../psiuMulticomponentThermo/heheuPsiThermo.H | 34 +- .../psiuMulticomponentThermo.C | 59 ++- .../psiuMulticomponentThermo.H | 115 +++- .../psiuMulticomponentThermoI.H} | 36 +- .../psiuMulticomponentThermos.C | 19 +- .../rhoMulticomponentThermo.C | 15 +- .../rhoMulticomponentThermo.H | 73 +-- .../rhoMulticomponentThermos.C | 78 +-- .../constSolidThermo/constSolidThermo.C | 10 +- .../constSolidThermo/constSolidThermo.H | 11 +- .../solidThermo/makeSolidThermo.H | 97 ---- .../solidSpecie/include/forSolids.H | 6 +- .../solidThermo/solidThermo/heSolidThermo.C | 64 +-- .../solidThermo/solidThermo/heSolidThermo.H | 30 +- .../solidThermo/solidThermo/solidThermo.C | 18 +- .../solidThermo/solidThermo/solidThermo.H | 50 +- .../solidThermo/solidThermo/solidThermos.C | 6 +- .../specie/include/makeThermo.H | 41 +- .../thermophysicalProperties/Make/files | 1 + .../liquidProperties/liquidProperties.C | 63 +-- .../liquidProperties/liquidPropertiesNew.C | 87 ++++ .../liquidPropertiesSelector.H} | 81 +-- .../liquidPropertiesSelectorI.H | 50 ++ .../thermophysicalProperties.H | 15 +- .../thermophysicalPropertiesSelector.C | 0 .../thermophysicalPropertiesSelector.H | 27 +- .../thermophysicalPropertiesSelectorI.H | 15 +- .../liquidPropertiesSurfaceTension.C | 56 +- .../constant/physicalProperties.water | 36 -- .../constant/physicalProperties.water | 36 -- 177 files changed, 4539 insertions(+), 4124 deletions(-) create mode 100644 src/thermophysicalModels/basic/PhysicalPropertiesThermo.C create mode 100644 src/thermophysicalModels/basic/PhysicalPropertiesThermo.H create mode 100644 src/thermophysicalModels/basic/heThermo/heThermoName.C rename src/thermophysicalModels/{multicomponentThermo/mixtures/basicCombustionMixture/basicCombustionMixture.C => basic/liquidThermo/heLiquidThermo.C} (60%) rename src/thermophysicalModels/basic/{rhoThermo/liquidThermo.C => liquidThermo/heLiquidThermo.H} (52%) create mode 100644 src/thermophysicalModels/basic/liquidThermo/liquidThermo.C create mode 100644 src/thermophysicalModels/basic/liquidThermo/liquidThermo.H create mode 100644 src/thermophysicalModels/basic/liquidThermo/liquidThermos.C rename src/thermophysicalModels/basic/{rhoThermo/liquidThermo.H => makeFluidThermo.H} (59%) create mode 100644 src/thermophysicalModels/basic/pureThermo/pureThermo.C rename src/thermophysicalModels/basic/{mixtures/basicMixture/basicMixture.H => pureThermo/pureThermo.H} (67%) create mode 100644 src/thermophysicalModels/basic/pureThermo/pureThermoI.H create mode 100644 src/thermophysicalModels/multicomponentThermo/fluidMulticomponentThermo/heFluidMulticomponentThermo.C create mode 100644 src/thermophysicalModels/multicomponentThermo/fluidMulticomponentThermo/heFluidMulticomponentThermo.H create mode 100644 src/thermophysicalModels/multicomponentThermo/fluidMulticomponentThermo/makeFluidMulticomponentThermo.H create mode 100644 src/thermophysicalModels/multicomponentThermo/include/FieldListSlice.H create mode 100644 src/thermophysicalModels/multicomponentThermo/include/GeometricFieldListSlicer.H delete mode 100644 src/thermophysicalModels/multicomponentThermo/makeMulticomponentThermo.H delete mode 100644 src/thermophysicalModels/multicomponentThermo/mixtures/basicSpecieMixture/basicSpecieMixtureI.H rename src/thermophysicalModels/multicomponentThermo/{mixtures/SpecieMixture/SpecieMixture.C => multicomponentThermo/heMulticomponentThermo.C} (51%) rename src/thermophysicalModels/multicomponentThermo/{mixtures/SpecieMixture/SpecieMixture.H => multicomponentThermo/heMulticomponentThermo.H} (61%) rename src/thermophysicalModels/multicomponentThermo/{mixtures/basicSpecieMixture/basicSpecieMixture.C => multicomponentThermo/multicomponentThermo.C} (65%) rename src/thermophysicalModels/multicomponentThermo/{mixtures/basicSpecieMixture/basicSpecieMixture.H => multicomponentThermo/multicomponentThermo.H} (51%) create mode 100644 src/thermophysicalModels/multicomponentThermo/multicomponentThermo/multicomponentThermoI.H rename src/thermophysicalModels/multicomponentThermo/{mixtures/basicCombustionMixture/basicCombustionMixtureI.H => psiuMulticomponentThermo/psiuMulticomponentThermoI.H} (60%) delete mode 100644 src/thermophysicalModels/solidThermo/makeSolidThermo.H create mode 100644 src/thermophysicalModels/thermophysicalProperties/liquidProperties/liquidProperties/liquidPropertiesNew.C rename src/thermophysicalModels/{multicomponentThermo/mixtures/basicCombustionMixture/basicCombustionMixture.H => thermophysicalProperties/liquidProperties/liquidProperties/liquidPropertiesSelector.H} (51%) create mode 100644 src/thermophysicalModels/thermophysicalProperties/liquidProperties/liquidProperties/liquidPropertiesSelectorI.H rename src/thermophysicalModels/thermophysicalProperties/{thermophysicalPropertiesSelector => thermophysicalProperties}/thermophysicalPropertiesSelector.C (100%) rename src/thermophysicalModels/thermophysicalProperties/{thermophysicalPropertiesSelector => thermophysicalProperties}/thermophysicalPropertiesSelector.H (90%) rename src/thermophysicalModels/thermophysicalProperties/{thermophysicalPropertiesSelector => thermophysicalProperties}/thermophysicalPropertiesSelectorI.H (94%) diff --git a/applications/legacy/combustion/PDRFoam/bEqn.H b/applications/legacy/combustion/PDRFoam/bEqn.H index bee9c5e682..1f90cfe0e8 100644 --- a/applications/legacy/combustion/PDRFoam/bEqn.H +++ b/applications/legacy/combustion/PDRFoam/bEqn.H @@ -94,9 +94,9 @@ if (ign.ignited()) Info<< "min(b) = " << min(b).value() << endl; - if (composition.contains("ft")) + if (thermo.containsSpecie("ft")) { - volScalarField& ft = composition.Y("ft"); + volScalarField& ft = thermo.Y("ft"); Info<< "Combustion progress = " << 100*(1.0 - b)().weightedAverage(mesh.V()*ft).value() << "%" diff --git a/applications/legacy/combustion/PDRFoam/createFields.H b/applications/legacy/combustion/PDRFoam/createFields.H index 870b55c465..391b2bb0bb 100644 --- a/applications/legacy/combustion/PDRFoam/createFields.H +++ b/applications/legacy/combustion/PDRFoam/createFields.H @@ -7,8 +7,6 @@ autoPtr pThermo psiuMulticomponentThermo& thermo = pThermo(); thermo.validate(args.executable(), "ha", "ea"); -basicCombustionMixture& composition = thermo.composition(); - volScalarField rho ( IOobject @@ -24,7 +22,7 @@ volScalarField rho volScalarField& p = thermo.p(); -volScalarField& b = composition.Y("b"); +volScalarField& b = thermo.Y("b"); Info<< "min(b) = " << min(b).value() << endl; Info<< "\nReading field U\n" << endl; @@ -229,9 +227,9 @@ volScalarField St multivariateSurfaceInterpolationScheme::fieldTable fields; -if (composition.contains("ft")) +if (thermo.containsSpecie("ft")) { - fields.add(composition.Y("ft")); + fields.add(thermo.Y("ft")); } fields.add(b); diff --git a/applications/legacy/combustion/PDRFoam/ftEqn.H b/applications/legacy/combustion/PDRFoam/ftEqn.H index e9a4404789..adca87d088 100644 --- a/applications/legacy/combustion/PDRFoam/ftEqn.H +++ b/applications/legacy/combustion/PDRFoam/ftEqn.H @@ -1,6 +1,6 @@ -if (composition.contains("ft")) +if (thermo.containsSpecie("ft")) { - volScalarField& ft = composition.Y("ft"); + volScalarField& ft = thermo.Y("ft"); solve ( diff --git a/applications/legacy/combustion/PDRFoam/laminarFlameSpeed/SCOPE/SCOPELaminarFlameSpeed.C b/applications/legacy/combustion/PDRFoam/laminarFlameSpeed/SCOPE/SCOPELaminarFlameSpeed.C index 271410d771..41c710e33f 100644 --- a/applications/legacy/combustion/PDRFoam/laminarFlameSpeed/SCOPE/SCOPELaminarFlameSpeed.C +++ b/applications/legacy/combustion/PDRFoam/laminarFlameSpeed/SCOPE/SCOPELaminarFlameSpeed.C @@ -368,10 +368,9 @@ Foam::tmp Foam::laminarFlameSpeedModels::SCOPE::Ma Foam::tmp Foam::laminarFlameSpeedModels::SCOPE::Ma() const { - if (psiuMulticomponentThermo_.composition().contains("ft")) + if (psiuMulticomponentThermo_.containsSpecie("ft")) { - const volScalarField& ft = - psiuMulticomponentThermo_.composition().Y("ft"); + const volScalarField& ft = psiuMulticomponentThermo_.Y("ft"); return Ma ( @@ -403,10 +402,9 @@ Foam::laminarFlameSpeedModels::SCOPE::Ma() const Foam::tmp Foam::laminarFlameSpeedModels::SCOPE::operator()() const { - if (psiuMulticomponentThermo_.composition().contains("ft")) + if (psiuMulticomponentThermo_.containsSpecie("ft")) { - const volScalarField& ft = - psiuMulticomponentThermo_.composition().Y("ft"); + const volScalarField& ft = psiuMulticomponentThermo_.Y("ft"); return Su0pTphi ( diff --git a/applications/modules/XiFluid/XiFluid.C b/applications/modules/XiFluid/XiFluid.C index cd52675300..b7038fe895 100644 --- a/applications/modules/XiFluid/XiFluid.C +++ b/applications/modules/XiFluid/XiFluid.C @@ -51,9 +51,7 @@ Foam::solvers::XiFluid::XiFluid(fvMesh& mesh) thermo_(refCast(isothermalFluid::thermo_)), - composition(thermo_.composition()), - - b_(composition.Y("b")), + b_(thermo_.Y("b")), unstrainedLaminarFlameSpeed(laminarFlameSpeed::New(thermo_)), @@ -144,9 +142,9 @@ Foam::solvers::XiFluid::XiFluid(fvMesh& mesh) { thermo.validate(type(), "ha", "ea"); - if (composition.contains("ft")) + if (thermo_.containsSpecie("ft")) { - fields.add(composition.Y("ft")); + fields.add(thermo_.Y("ft")); } fields.add(b); diff --git a/applications/modules/XiFluid/XiFluid.H b/applications/modules/XiFluid/XiFluid.H index 243be21194..306cd0be83 100644 --- a/applications/modules/XiFluid/XiFluid.H +++ b/applications/modules/XiFluid/XiFluid.H @@ -106,11 +106,7 @@ protected: // Composition - //- Reference to the combustion mixture - basicCombustionMixture& composition; - //- Reference to the combustion regress variable - // obtained from the combustion mixture volScalarField& b_; //- Set of fields used for the multivariate convection scheme diff --git a/applications/modules/XiFluid/thermophysicalPredictor.C b/applications/modules/XiFluid/thermophysicalPredictor.C index 3de2274c3b..15a325eedc 100644 --- a/applications/modules/XiFluid/thermophysicalPredictor.C +++ b/applications/modules/XiFluid/thermophysicalPredictor.C @@ -38,7 +38,7 @@ void Foam::solvers::XiFluid::ftSolve const fv::convectionScheme& mvConvection ) { - volScalarField& ft = composition.Y("ft"); + volScalarField& ft = thermo_.Y("ft"); fvScalarMatrix ftEqn ( @@ -569,7 +569,7 @@ void Foam::solvers::XiFluid::thermophysicalPredictor() ) ); - if (composition.contains("ft")) + if (thermo_.containsSpecie("ft")) { ftSolve(mvConvection()); } diff --git a/applications/modules/multicomponentFluid/multicomponentFluid.C b/applications/modules/multicomponentFluid/multicomponentFluid.C index 1008190ed2..1f4691ba14 100644 --- a/applications/modules/multicomponentFluid/multicomponentFluid.C +++ b/applications/modules/multicomponentFluid/multicomponentFluid.C @@ -51,9 +51,7 @@ Foam::solvers::multicomponentFluid::multicomponentFluid(fvMesh& mesh) thermo_(refCast(isothermalFluid::thermo_)), - composition(thermo_.composition()), - - Y_(composition.Y()), + Y_(thermo_.Y()), reaction(combustionModel::New(thermo_, momentumTransport())), diff --git a/applications/modules/multicomponentFluid/multicomponentFluid.H b/applications/modules/multicomponentFluid/multicomponentFluid.H index 85260f72ff..f115981b93 100644 --- a/applications/modules/multicomponentFluid/multicomponentFluid.H +++ b/applications/modules/multicomponentFluid/multicomponentFluid.H @@ -86,7 +86,6 @@ protected: // Composition - basicSpecieMixture& composition; PtrList& Y_; diff --git a/applications/modules/multicomponentFluid/setRDeltaT.C b/applications/modules/multicomponentFluid/setRDeltaT.C index e63f990048..a2c1c0be66 100644 --- a/applications/modules/multicomponentFluid/setRDeltaT.C +++ b/applications/modules/multicomponentFluid/setRDeltaT.C @@ -106,7 +106,7 @@ void Foam::solvers::multicomponentFluid::setRDeltaT() forAll(Y, i) { - if (composition.solve(i)) + if (thermo_.solveSpecie(i)) { volScalarField& Yi = Y_[i]; diff --git a/applications/modules/multicomponentFluid/thermophysicalPredictor.C b/applications/modules/multicomponentFluid/thermophysicalPredictor.C index 7504e565fb..607724da94 100644 --- a/applications/modules/multicomponentFluid/thermophysicalPredictor.C +++ b/applications/modules/multicomponentFluid/thermophysicalPredictor.C @@ -45,7 +45,7 @@ void Foam::solvers::multicomponentFluid::thermophysicalPredictor() forAll(Y, i) { - if (composition.solve(i)) + if (thermo_.solveSpecie(i)) { volScalarField& Yi = Y_[i]; @@ -69,7 +69,7 @@ void Foam::solvers::multicomponentFluid::thermophysicalPredictor() } } - composition.normalise(); + thermo_.normaliseY(); volScalarField& he = thermo_.he(); diff --git a/applications/modules/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/Henry/Henry.C b/applications/modules/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/Henry/Henry.C index 42e6f28a78..2270f7b61c 100644 --- a/applications/modules/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/Henry/Henry.C +++ b/applications/modules/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/Henry/Henry.C @@ -100,12 +100,12 @@ Foam::tmp Foam::interfaceCompositionModels::Henry::Yf return k_[index] - *otherComposition().Y(speciesName) + *otherMulticomponentThermo().Y(speciesName) *otherThermo().rho()/thermo().rho(); } else { - return YSolvent_*composition().Y(speciesName); + return YSolvent_*thermo().Y(speciesName); } } diff --git a/applications/modules/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/Raoult/Raoult.C b/applications/modules/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/Raoult/Raoult.C index a6b352cbec..b1a396b03f 100644 --- a/applications/modules/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/Raoult/Raoult.C +++ b/applications/modules/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/Raoult/Raoult.C @@ -110,11 +110,11 @@ void Foam::interfaceCompositionModels::Raoult::update(const volScalarField& Tf) iter()->update(Tf); YNonVapour_ -= - otherComposition().Y(iter.key()) + otherMulticomponentThermo().Y(iter.key()) *iter()->Yf(iter.key(), Tf); YNonVapourPrime_ -= - otherComposition().Y(iter.key()) + otherMulticomponentThermo().Y(iter.key()) *iter()->YfPrime(iter.key(), Tf); } } @@ -129,12 +129,12 @@ Foam::tmp Foam::interfaceCompositionModels::Raoult::Yf if (species().found(speciesName)) { return - otherComposition().Y(speciesName) + otherMulticomponentThermo().Y(speciesName) *speciesModels_[speciesName]->Yf(speciesName, Tf); } else { - return composition().Y(speciesName)*YNonVapour_; + return thermo().Y(speciesName)*YNonVapour_; } } @@ -149,12 +149,12 @@ Foam::interfaceCompositionModels::Raoult::YfPrime if (species().found(speciesName)) { return - otherComposition().Y(speciesName) + otherMulticomponentThermo().Y(speciesName) *speciesModels_[speciesName]->YfPrime(speciesName, Tf); } else { - return composition().Y(speciesName)*YNonVapourPrime_; + return thermo().Y(speciesName)*YNonVapourPrime_; } } diff --git a/applications/modules/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/interfaceCompositionModel/interfaceCompositionModel.C b/applications/modules/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/interfaceCompositionModel/interfaceCompositionModel.C index 4da2c781f8..d35df1cdc6 100644 --- a/applications/modules/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/interfaceCompositionModel/interfaceCompositionModel.C +++ b/applications/modules/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/interfaceCompositionModel/interfaceCompositionModel.C @@ -74,9 +74,9 @@ Foam::tmp Foam::interfaceCompositionModel::dY const volScalarField& Tf ) const { - const label speciei = composition().species()[speciesName]; + const label speciei = thermo().species()[speciesName]; - return Yf(speciesName, Tf) - composition().Y()[speciei]; + return Yf(speciesName, Tf) - thermo().Y()[speciei]; } @@ -95,16 +95,16 @@ Foam::tmp Foam::interfaceCompositionModel::D const word& speciesName ) const { - const label speciei = composition().species()[speciesName]; + const label speciei = thermo().species()[speciesName]; const volScalarField& p(thermo_.p()); const volScalarField& T(thermo_.T()); return volScalarField::New ( IOobject::groupName("D" + speciesName, interface_.name()), - composition().kappa(speciei, p, T) - /composition().Cp(speciei, p, T) - /composition().rho(speciei, p, T) + thermo().kappai(speciei, p, T) + /thermo().Cpi(speciei, p, T) + /thermo().rhoi(speciei, p, T) /Le_ ); } diff --git a/applications/modules/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/interfaceCompositionModel/interfaceCompositionModel.H b/applications/modules/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/interfaceCompositionModel/interfaceCompositionModel.H index ecd4b18872..c0e53f757e 100644 --- a/applications/modules/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/interfaceCompositionModel/interfaceCompositionModel.H +++ b/applications/modules/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/interfaceCompositionModel/interfaceCompositionModel.H @@ -132,17 +132,12 @@ public: //- Return the thermo inline const rhoMulticomponentThermo& thermo() const; - //- Return the composition - inline const basicSpecieMixture& composition() const; - //- Return the other thermo inline const rhoThermo& otherThermo() const; - //- Return whether the other side has a multi-specie composition - inline bool otherHasComposition() const; - - //- Return the other composition - inline const basicSpecieMixture& otherComposition() const; + //- Return the other multicomponent thermo + inline const rhoMulticomponentThermo& + otherMulticomponentThermo() const; // Evaluation diff --git a/applications/modules/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/interfaceCompositionModel/interfaceCompositionModelI.H b/applications/modules/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/interfaceCompositionModel/interfaceCompositionModelI.H index 67ad015db6..c329d1dabe 100644 --- a/applications/modules/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/interfaceCompositionModel/interfaceCompositionModelI.H +++ b/applications/modules/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/interfaceCompositionModel/interfaceCompositionModelI.H @@ -24,6 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "interfaceCompositionModel.H" +#include "rhoMulticomponentThermo.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -47,29 +48,16 @@ Foam::interfaceCompositionModel::thermo() const } -const Foam::basicSpecieMixture& -Foam::interfaceCompositionModel::composition() const -{ - return thermo_.composition(); -} - - const Foam::rhoThermo& Foam::interfaceCompositionModel::otherThermo() const { return otherThermo_; } -bool Foam::interfaceCompositionModel::otherHasComposition() const +const Foam::rhoMulticomponentThermo& +Foam::interfaceCompositionModel::otherMulticomponentThermo() const { - return isA(otherThermo_); -} - - -const Foam::basicSpecieMixture& -Foam::interfaceCompositionModel::otherComposition() const -{ - return refCast(otherThermo_).composition(); + return refCast(otherThermo_); } diff --git a/applications/modules/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/nonRandomTwoLiquid/nonRandomTwoLiquid.C b/applications/modules/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/nonRandomTwoLiquid/nonRandomTwoLiquid.C index c6c0bd9922..14c1aa6967 100644 --- a/applications/modules/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/nonRandomTwoLiquid/nonRandomTwoLiquid.C +++ b/applications/modules/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/nonRandomTwoLiquid/nonRandomTwoLiquid.C @@ -87,8 +87,8 @@ Foam::interfaceCompositionModels::nonRandomTwoLiquid::nonRandomTwoLiquid species1Name_ = species()[0]; species2Name_ = species()[1]; - species1Index_ = composition().species()[species1Name_]; - species2Index_ = composition().species()[species2Name_]; + species1Index_ = thermo().species()[species1Name_]; + species2Index_ = thermo().species()[species2Name_]; alpha12_ = dimensionedScalar ( @@ -171,25 +171,25 @@ void Foam::interfaceCompositionModels::nonRandomTwoLiquid::update const volScalarField X1 ( - composition().Y(species1Index_) + thermo().Y(species1Index_) *W /dimensionedScalar ( "W", dimMass/dimMoles, - composition().Wi(species1Index_) + thermo().Wi(species1Index_) ) ); const volScalarField X2 ( - composition().Y(species2Index_) + thermo().Y(species2Index_) *W /dimensionedScalar ( "W", dimMass/dimMoles, - composition().Wi(species2Index_) + thermo().Wi(species2Index_) ) ); @@ -233,21 +233,21 @@ Foam::interfaceCompositionModels::nonRandomTwoLiquid::Yf if (speciesName == species1Name_) { return - otherComposition().Y(speciesName) + otherMulticomponentThermo().Y(speciesName) *speciesModel1_->Yf(speciesName, Tf) *gamma1_; } else if (speciesName == species2Name_) { return - otherComposition().Y(speciesName) + otherMulticomponentThermo().Y(speciesName) *speciesModel2_->Yf(speciesName, Tf) *gamma2_; } else { return - composition().Y(speciesName) + thermo().Y(speciesName) *(scalar(1) - Yf(species1Name_, Tf) - Yf(species2Name_, Tf)); } } @@ -263,21 +263,21 @@ Foam::interfaceCompositionModels::nonRandomTwoLiquid::YfPrime if (speciesName == species1Name_) { return - otherComposition().Y(speciesName) + otherMulticomponentThermo().Y(speciesName) *speciesModel1_->YfPrime(speciesName, Tf) *gamma1_; } else if (speciesName == species2Name_) { return - otherComposition().Y(speciesName) + otherMulticomponentThermo().Y(speciesName) *speciesModel2_->YfPrime(speciesName, Tf) *gamma2_; } else { return - - composition().Y(speciesName) + - thermo().Y(speciesName) *(YfPrime(species1Name_, Tf) + YfPrime(species2Name_, Tf)); } } diff --git a/applications/modules/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/saturated/saturated.C b/applications/modules/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/saturated/saturated.C index 7e12e059de..f7a8841b02 100644 --- a/applications/modules/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/saturated/saturated.C +++ b/applications/modules/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/saturated/saturated.C @@ -52,7 +52,7 @@ Foam::interfaceCompositionModels::saturated::wRatioByP() const ( "W", dimMass/dimMoles, - composition().Wi(saturatedIndex_) + thermo().Wi(saturatedIndex_) ); return Wi/thermo().W()/thermo().p(); @@ -69,7 +69,7 @@ Foam::interfaceCompositionModels::saturated::saturated : interfaceCompositionModel(dict, interface), saturatedName_(species()[0]), - saturatedIndex_(composition().species()[saturatedName_]), + saturatedIndex_(thermo().species()[saturatedName_]), saturationModel_(saturationPressureModel::New("pSat", dict)) { if (species().size() != 1) @@ -108,12 +108,12 @@ Foam::tmp Foam::interfaceCompositionModels::saturated::Yf } else { - const label speciesIndex = composition().species()[speciesName]; + const label speciesIndex = thermo().species()[speciesName]; return - composition().Y()[speciesIndex] + thermo().Y()[speciesIndex] *(scalar(1) - wRatioByP()*saturationModel_->pSat(Tf)) - /max(scalar(1) - composition().Y()[saturatedIndex_], small); + /max(scalar(1) - thermo().Y()[saturatedIndex_], small); } } @@ -131,12 +131,12 @@ Foam::interfaceCompositionModels::saturated::YfPrime } else { - const label speciesIndex = composition().species()[speciesName]; + const label speciesIndex = thermo().species()[speciesName]; return - - composition().Y()[speciesIndex] + - thermo().Y()[speciesIndex] *wRatioByP()*saturationModel_->pSatPrime(Tf) - /max(scalar(1) - composition().Y()[saturatedIndex_], small); + /max(scalar(1) - thermo().Y()[saturatedIndex_], small); } } diff --git a/applications/modules/multiphaseEuler/multiphaseThermophysicalTransportModels/HeatTransferPhaseSystem/HeatTransferPhaseSystem.C b/applications/modules/multiphaseEuler/multiphaseThermophysicalTransportModels/HeatTransferPhaseSystem/HeatTransferPhaseSystem.C index 5db3155369..45b00fa966 100644 --- a/applications/modules/multiphaseEuler/multiphaseThermophysicalTransportModels/HeatTransferPhaseSystem/HeatTransferPhaseSystem.C +++ b/applications/modules/multiphaseEuler/multiphaseThermophysicalTransportModels/HeatTransferPhaseSystem/HeatTransferPhaseSystem.C @@ -91,14 +91,14 @@ void Foam::HeatTransferPhaseSystem::addDmidtHefs const phaseModel& phase2 = interface.phase2(); const rhoThermo& thermo1 = phase1.thermo(); const rhoThermo& thermo2 = phase2.thermo(); - const basicSpecieMixture* compositionPtr1 = + const rhoMulticomponentThermo* mcThermoPtr1 = isA(thermo1) - ? &refCast(thermo1).composition() - : static_cast(nullptr); - const basicSpecieMixture* compositionPtr2 = + ? &refCast(thermo1) + : static_cast(nullptr); + const rhoMulticomponentThermo* mcThermoPtr2 = isA(thermo2) - ? &refCast(thermo2).composition() - : static_cast(nullptr); + ? &refCast(thermo2) + : static_cast(nullptr); const volScalarField& he1 = thermo1.he(); const volScalarField& he2 = thermo2.he(); const volScalarField hs1(thermo1.hs()); @@ -118,21 +118,21 @@ void Foam::HeatTransferPhaseSystem::addDmidtHefs // Specie indices const label speciei1 = - compositionPtr1 ? compositionPtr1->species()[specie] : -1; + mcThermoPtr1 ? mcThermoPtr1->species()[specie] : -1; const label speciei2 = - compositionPtr2 ? compositionPtr2->species()[specie] : -1; + mcThermoPtr2 ? mcThermoPtr2->species()[specie] : -1; // Enthalpies const volScalarField hsi1 ( - compositionPtr1 - ? compositionPtr1->Hs(speciei1, thermo1.p(), thermo1.T()) + mcThermoPtr1 + ? mcThermoPtr1->hsi(speciei1, thermo1.p(), thermo1.T()) : tmp(hs1) ); const volScalarField hsi2 ( - compositionPtr2 - ? compositionPtr2->Hs(speciei2, thermo2.p(), thermo2.T()) + mcThermoPtr2 + ? mcThermoPtr2->hsi(speciei2, thermo2.p(), thermo2.T()) : tmp(hs2) ); @@ -141,12 +141,12 @@ void Foam::HeatTransferPhaseSystem::addDmidtHefs if (residualY_ > 0) { tYi1 = - compositionPtr1 - ? max(compositionPtr1->Y(speciei1), residualY_) + mcThermoPtr1 + ? max(mcThermoPtr1->Y(speciei1), residualY_) : volScalarField::New("Yi1", this->mesh(), one); tYi2 = - compositionPtr2 - ? max(compositionPtr2->Y(speciei2), residualY_) + mcThermoPtr2 + ? max(mcThermoPtr2->Y(speciei2), residualY_) : volScalarField::New("Yi2", this->mesh(), one); } @@ -307,14 +307,14 @@ void Foam::HeatTransferPhaseSystem::addDmidtHefsWithoutL const phaseModel& phase2 = interface.phase2(); const rhoThermo& thermo1 = phase1.thermo(); const rhoThermo& thermo2 = phase2.thermo(); - const basicSpecieMixture* compositionPtr1 = + const rhoMulticomponentThermo* mcThermoPtr1 = isA(thermo1) - ? &refCast(thermo1).composition() - : static_cast(nullptr); - const basicSpecieMixture* compositionPtr2 = + ? &refCast(thermo1) + : static_cast(nullptr); + const rhoMulticomponentThermo* mcThermoPtr2 = isA(thermo2) - ? &refCast(thermo2).composition() - : static_cast(nullptr); + ? &refCast(thermo2) + : static_cast(nullptr); const volScalarField& he1 = thermo1.he(); const volScalarField& he2 = thermo2.he(); const volScalarField K1(phase1.K()); @@ -336,21 +336,21 @@ void Foam::HeatTransferPhaseSystem::addDmidtHefsWithoutL // Specie indices const label speciei1 = - compositionPtr1 ? compositionPtr1->species()[specie] : -1; + mcThermoPtr1 ? mcThermoPtr1->species()[specie] : -1; const label speciei2 = - compositionPtr2 ? compositionPtr2->species()[specie] : -1; + mcThermoPtr2 ? mcThermoPtr2->species()[specie] : -1; // Interface enthalpies const volScalarField hsfi1 ( - compositionPtr1 - ? compositionPtr1->Hs(speciei1, thermo1.p(), Tf) + mcThermoPtr1 + ? mcThermoPtr1->hsi(speciei1, thermo1.p(), Tf) : tmp(hsf1) ); const volScalarField hsfi2 ( - compositionPtr2 - ? compositionPtr2->Hs(speciei2, thermo2.p(), Tf) + mcThermoPtr2 + ? mcThermoPtr2->hsi(speciei2, thermo2.p(), Tf) : tmp(hsf2) ); @@ -359,12 +359,12 @@ void Foam::HeatTransferPhaseSystem::addDmidtHefsWithoutL if (this->residualY_ > 0) { tYi1 = - compositionPtr1 - ? max(compositionPtr1->Y(speciei1), this->residualY_) + mcThermoPtr1 + ? max(mcThermoPtr1->Y(speciei1), this->residualY_) : volScalarField::New("Yi1", this->mesh(), one); tYi2 = - compositionPtr2 - ? max(compositionPtr2->Y(speciei2), this->residualY_) + mcThermoPtr2 + ? max(mcThermoPtr2->Y(speciei2), this->residualY_) : volScalarField::New("Yi2", this->mesh(), one); } @@ -383,14 +383,14 @@ void Foam::HeatTransferPhaseSystem::addDmidtHefsWithoutL // Bulk enthalpies const volScalarField hsi1 ( - compositionPtr1 - ? compositionPtr1->Hs(speciei1, thermo1.p(), thermo1.T()) + mcThermoPtr1 + ? mcThermoPtr1->hsi(speciei1, thermo1.p(), thermo1.T()) : thermo1.hs() ); const volScalarField hsi2 ( - compositionPtr2 - ? compositionPtr2->Hs(speciei2, thermo2.p(), thermo2.T()) + mcThermoPtr2 + ? mcThermoPtr2->hsi(speciei2, thermo2.p(), thermo2.T()) : thermo2.hs() ); @@ -597,30 +597,30 @@ Foam::HeatTransferPhaseSystem::Li { const rhoThermo& thermo1 = interface.phase1().thermo(); const rhoThermo& thermo2 = interface.phase2().thermo(); - const basicSpecieMixture* compositionPtr1 = + const rhoMulticomponentThermo* mcThermoPtr1 = isA(thermo1) - ? &refCast(thermo1).composition() - : static_cast(nullptr); - const basicSpecieMixture* compositionPtr2 = + ? &refCast(thermo1) + : static_cast(nullptr); + const rhoMulticomponentThermo* mcThermoPtr2 = isA(thermo2) - ? &refCast(thermo2).composition() - : static_cast(nullptr); + ? &refCast(thermo2) + : static_cast(nullptr); const label speciei1 = - compositionPtr1 ? compositionPtr1->species()[specie] : -1; + mcThermoPtr1 ? mcThermoPtr1->species()[specie] : -1; const label speciei2 = - compositionPtr2 ? compositionPtr2->species()[specie] : -1; + mcThermoPtr2 ? mcThermoPtr2->species()[specie] : -1; // Interface enthalpies const volScalarField hafi1 ( - compositionPtr1 - ? compositionPtr1->Ha(speciei1, thermo1.p(), Tf) + mcThermoPtr1 + ? mcThermoPtr1->hai(speciei1, thermo1.p(), Tf) : thermo1.ha(thermo1.p(), Tf) ); const volScalarField hafi2 ( - compositionPtr2 - ? compositionPtr2->Ha(speciei2, thermo2.p(), Tf) + mcThermoPtr2 + ? mcThermoPtr2->hai(speciei2, thermo2.p(), Tf) : thermo2.ha(thermo1.p(), Tf) ); @@ -635,14 +635,14 @@ Foam::HeatTransferPhaseSystem::Li // Bulk enthalpies const volScalarField hai1 ( - compositionPtr1 - ? compositionPtr1->Ha(speciei1, thermo1.p(), thermo1.T()) + mcThermoPtr1 + ? mcThermoPtr1->hai(speciei1, thermo1.p(), thermo1.T()) : thermo1.ha() ); const volScalarField hai2 ( - compositionPtr2 - ? compositionPtr2->Ha(speciei2, thermo2.p(), thermo2.T()) + mcThermoPtr2 + ? mcThermoPtr2->hai(speciei2, thermo2.p(), thermo2.T()) : thermo2.ha() ); @@ -670,18 +670,18 @@ Foam::HeatTransferPhaseSystem::Li { const rhoThermo& thermo1 = interface.phase1().thermo(); const rhoThermo& thermo2 = interface.phase2().thermo(); - const basicSpecieMixture* compositionPtr1 = + const rhoMulticomponentThermo* mcThermoPtr1 = isA(thermo1) - ? &refCast(thermo1).composition() - : static_cast(nullptr); - const basicSpecieMixture* compositionPtr2 = + ? &refCast(thermo1) + : static_cast(nullptr); + const rhoMulticomponentThermo* mcThermoPtr2 = isA(thermo2) - ? &refCast(thermo2).composition() - : static_cast(nullptr); + ? &refCast(thermo2) + : static_cast(nullptr); const label speciei1 = - compositionPtr1 ? compositionPtr1->species()[specie] : -1; + mcThermoPtr1 ? mcThermoPtr1->species()[specie] : -1; const label speciei2 = - compositionPtr2 ? compositionPtr2->species()[specie] : -1; + mcThermoPtr2 ? mcThermoPtr2->species()[specie] : -1; const scalarField p1(UIndirectList(thermo1.p(), cells)); const scalarField p2(UIndirectList(thermo2.p(), cells)); @@ -689,14 +689,14 @@ Foam::HeatTransferPhaseSystem::Li // Interface enthalpies const scalarField hafi1 ( - compositionPtr1 - ? compositionPtr1->Ha(speciei1, p1, Tf) + mcThermoPtr1 + ? mcThermoPtr1->hai(speciei1, p1, Tf) : thermo1.ha(Tf, cells) ); const scalarField hafi2 ( - compositionPtr2 - ? compositionPtr2->Ha(speciei2, p2, Tf) + mcThermoPtr2 + ? mcThermoPtr2->hai(speciei2, p2, Tf) : thermo2.ha(Tf, cells) ); @@ -714,14 +714,14 @@ Foam::HeatTransferPhaseSystem::Li // Bulk enthalpies const scalarField hai1 ( - compositionPtr1 - ? compositionPtr1->Ha(speciei1, p1, T1) + mcThermoPtr1 + ? mcThermoPtr1->hai(speciei1, p1, T1) : thermo1.ha(T1, cells) ); const scalarField hai2 ( - compositionPtr2 - ? compositionPtr2->Ha(speciei2, p2, T2) + mcThermoPtr2 + ? mcThermoPtr2->hai(speciei2, p2, T2) : thermo2.ha(T2, cells) ); diff --git a/applications/modules/multiphaseEuler/phaseSystems/phaseModel/MulticomponentPhaseModel/MulticomponentPhaseModel.C b/applications/modules/multiphaseEuler/phaseSystems/phaseModel/MulticomponentPhaseModel/MulticomponentPhaseModel.C index 0b79b2270a..97146e8b9e 100644 --- a/applications/modules/multiphaseEuler/phaseSystems/phaseModel/MulticomponentPhaseModel/MulticomponentPhaseModel.C +++ b/applications/modules/multiphaseEuler/phaseSystems/phaseModel/MulticomponentPhaseModel/MulticomponentPhaseModel.C @@ -48,11 +48,11 @@ Foam::MulticomponentPhaseModel::MulticomponentPhaseModel : BasePhaseModel(fluid, phaseName, referencePhase, index) { - PtrList& Y = this->thermo_->composition().Y(); + PtrList& Y = this->thermo_->Y(); forAll(Y, i) { - if (this->thermo_->composition().solve(i)) + if (this->thermo_->solveSpecie(i)) { const label j = YActive_.size(); YActive_.resize(j + 1); @@ -74,7 +74,7 @@ Foam::MulticomponentPhaseModel::~MulticomponentPhaseModel() template void Foam::MulticomponentPhaseModel::correctSpecies() { - this->thermo_->composition().normalise(); + this->thermo_->normaliseY(); BasePhaseModel::correctSpecies(); } @@ -121,7 +121,7 @@ template const Foam::PtrList& Foam::MulticomponentPhaseModel::Y() const { - return this->thermo_->composition().Y(); + return this->thermo_->Y(); } @@ -129,7 +129,7 @@ template const Foam::volScalarField& Foam::MulticomponentPhaseModel::Y(const word& name) const { - return this->thermo_->composition().Y(name); + return this->thermo_->Y(name); } @@ -137,7 +137,7 @@ template Foam::PtrList& Foam::MulticomponentPhaseModel::YRef() { - return this->thermo_->composition().Y(); + return this->thermo_->Y(); } diff --git a/applications/solvers/chemFoam/createFieldRefs.H b/applications/solvers/chemFoam/createFieldRefs.H index 80189ebd74..31f03d179d 100644 --- a/applications/solvers/chemFoam/createFieldRefs.H +++ b/applications/solvers/chemFoam/createFieldRefs.H @@ -1,5 +1,4 @@ basicChemistryModel& chemistry = pChemistry(); scalar dtChem = min(chemistry.deltaTChem()[0], runTime.deltaT().value()); -basicSpecieMixture& composition = thermo.composition(); -PtrList& Y = composition.Y(); +PtrList& Y = thermo.Y(); volScalarField& p = thermo.p(); diff --git a/applications/solvers/chemFoam/thermoTypeFunctions.H b/applications/solvers/chemFoam/thermoTypeFunctions.H index 34788dc0da..e82408209e 100644 --- a/applications/solvers/chemFoam/thermoTypeFunctions.H +++ b/applications/solvers/chemFoam/thermoTypeFunctions.H @@ -28,13 +28,11 @@ namespace Foam scalarList W(const fluidMulticomponentThermo& thermo) { - const basicSpecieMixture& composition = thermo.composition(); - - scalarList W(composition.Y().size()); + scalarList W(thermo.Y().size()); forAll(W, i) { - W[i] = composition.Wi(i); + W[i] = thermo.Wi(i); } return W; @@ -49,13 +47,11 @@ scalar h0 const scalar T ) { - const basicSpecieMixture& composition = thermo.composition(); - scalar h0 = 0; forAll(Y, i) { - h0 += Y[i]*composition.Hs(i, p, T); + h0 += Y[i]*thermo.hsi(i, p, T); } return h0; diff --git a/etc/codeTemplates/dynamicCode/fluidMulticomponentThermoTemplate.C b/etc/codeTemplates/dynamicCode/fluidMulticomponentThermoTemplate.C index dbdb739910..d4e35d5e3d 100644 --- a/etc/codeTemplates/dynamicCode/fluidMulticomponentThermoTemplate.C +++ b/etc/codeTemplates/dynamicCode/fluidMulticomponentThermoTemplate.C @@ -23,13 +23,9 @@ License \*---------------------------------------------------------------------------*/ -#include "forThermo.H" -#include "makeMulticomponentThermo.H" - +// Specie #include "${specie}.H" -#include "thermo.H" - // EoS #include "${equationOfState}.H" @@ -47,6 +43,12 @@ License // Mixture #include "${mixture}.H" +#include "thermo.H" +#include "heMulticomponentThermo.H" +#include "heFluidMulticomponentThermo.H" +#include "typedefThermo.H" +#include "makeThermo.H" + // * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * // @@ -75,19 +77,37 @@ extern "C" namespace Foam { - forThermo + typedefThermo ( ${transport}Transport, ${energy}, ${thermo}Thermo, ${equationOfState}, - ${specie}, - makeMulticomponentThermo, + ${specie} + ); + + defineThermo + ( ${typeBase}, - ${type}, - ${mixture} + ${mixture}, + ${transport}Transport${energy}${thermo}Thermo${equationOfState}${specie} + ); + + addThermo + ( + fluidMulticomponentThermo, + ${typeBase}, + ${mixture}, + ${transport}Transport${energy}${thermo}Thermo${equationOfState}${specie} + ); + + addThermo + ( + ${typeBase}, + ${typeBase}, + ${mixture}, + ${transport}Transport${energy}${thermo}Thermo${equationOfState}${specie} ); } - // ************************************************************************* // diff --git a/etc/codeTemplates/dynamicCode/fluidThermoTemplate.C b/etc/codeTemplates/dynamicCode/fluidThermoTemplate.C index be8850ffa4..9aef83243a 100644 --- a/etc/codeTemplates/dynamicCode/fluidThermoTemplate.C +++ b/etc/codeTemplates/dynamicCode/fluidThermoTemplate.C @@ -23,13 +23,9 @@ License \*---------------------------------------------------------------------------*/ -#include "forThermo.H" -#include "makeThermo.H" - +// Specie #include "${specie}.H" -#include "thermo.H" - // EoS #include "${equationOfState}.H" @@ -47,6 +43,10 @@ License // Mixture #include "${mixture}.H" +#include "thermo.H" +#include "typedefThermo.H" +#include "makeThermo.H" + // * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * // @@ -75,17 +75,36 @@ extern "C" namespace Foam { - forThermo + typedefThermo ( ${transport}Transport, ${energy}, ${thermo}Thermo, ${equationOfState}, - ${specie}, - makeThermo, + ${specie} + ); + + defineThermo + ( ${typeBase}, - ${type}, - ${mixture} + ${mixture}, + ${transport}Transport${energy}${thermo}Thermo${equationOfState}${specie} + ); + + addThermo + ( + fluidThermo, + ${typeBase}, + ${mixture}, + ${transport}Transport${energy}${thermo}Thermo${equationOfState}${specie} + ); + + addThermo + ( + ${typeBase}, + ${typeBase}, + ${mixture}, + ${transport}Transport${energy}${thermo}Thermo${equationOfState}${specie} ); } diff --git a/etc/codeTemplates/dynamicCode/psiuMulticomponentThermoTemplate.C b/etc/codeTemplates/dynamicCode/psiuMulticomponentThermoTemplate.C index 054d000867..c7290e69e5 100644 --- a/etc/codeTemplates/dynamicCode/psiuMulticomponentThermoTemplate.C +++ b/etc/codeTemplates/dynamicCode/psiuMulticomponentThermoTemplate.C @@ -23,13 +23,9 @@ License \*---------------------------------------------------------------------------*/ -#include "forThermo.H" -#include "makeMulticomponentThermo.H" - +// Specie #include "${specie}.H" -#include "thermo.H" - // EoS #include "${equationOfState}.H" @@ -47,6 +43,10 @@ License // Mixture #include "${mixture}.H" +#include "thermo.H" +#include "typedefThermo.H" +#include "makeThermo.H" + // * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * // @@ -75,15 +75,28 @@ extern "C" namespace Foam { - forThermo + typedefThermo ( ${transport}Transport, ${energy}, ${thermo}Thermo, ${equationOfState}, - ${specie}, - makePsiuMulticomponentThermo, - ${mixture} + ${specie} + ); + + defineThermo + ( + ${typeBase}, + ${mixture}, + ${transport}Transport${energy}${thermo}Thermo${equationOfState}${specie} + ); + + addThermo + ( + ${typeBase}, + ${typeBase}, + ${mixture}, + ${transport}Transport${energy}${thermo}Thermo${equationOfState}${specie} ); } diff --git a/etc/codeTemplates/dynamicCode/solidThermoTemplate.C b/etc/codeTemplates/dynamicCode/solidThermoTemplate.C index 38780bd82b..c7290e69e5 100644 --- a/etc/codeTemplates/dynamicCode/solidThermoTemplate.C +++ b/etc/codeTemplates/dynamicCode/solidThermoTemplate.C @@ -23,13 +23,9 @@ License \*---------------------------------------------------------------------------*/ -#include "forThermo.H" -#include "makeSolidThermo.H" - +// Specie #include "${specie}.H" -#include "thermo.H" - // EoS #include "${equationOfState}.H" @@ -47,6 +43,10 @@ License // Mixture #include "${mixture}.H" +#include "thermo.H" +#include "typedefThermo.H" +#include "makeThermo.H" + // * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * // @@ -75,17 +75,28 @@ extern "C" namespace Foam { - forThermo + typedefThermo ( ${transport}Transport, ${energy}, ${thermo}Thermo, ${equationOfState}, - ${specie}, - makeSolidThermo, + ${specie} + ); + + defineThermo + ( ${typeBase}, - ${type}, - ${mixture} + ${mixture}, + ${transport}Transport${energy}${thermo}Thermo${equationOfState}${specie} + ); + + addThermo + ( + ${typeBase}, + ${typeBase}, + ${mixture}, + ${transport}Transport${energy}${thermo}Thermo${equationOfState}${specie} ); } diff --git a/src/ThermophysicalTransportModels/fluid/laminar/Fickian/Fickian.C b/src/ThermophysicalTransportModels/fluid/laminar/Fickian/Fickian.C index 3c6452e2d0..cdea48b5b2 100644 --- a/src/ThermophysicalTransportModels/fluid/laminar/Fickian/Fickian.C +++ b/src/ThermophysicalTransportModels/fluid/laminar/Fickian/Fickian.C @@ -41,8 +41,7 @@ namespace Foam template void Fickian::updateDm() const { - const basicSpecieMixture& composition = this->thermo().composition(); - const PtrList& Y = composition.Y(); + const PtrList& Y = this->thermo().Y(); const volScalarField& p = this->thermo().p(); const volScalarField& T = this->thermo().T(); @@ -83,7 +82,7 @@ void Fickian::updateDm() const ( "Wj", Wm.dimensions(), - composition.Wi(j) + this->thermo().Wi(j) ) *( i < j @@ -100,7 +99,12 @@ void Fickian::updateDm() const ( 1/Wm - Y[i] - /dimensionedScalar("Wi", Wm.dimensions(), composition.Wi(i)) + /dimensionedScalar + ( + "Wi", + Wm.dimensions(), + this->thermo().Wi(i) + ) )/max(sumXbyD, dimensionedScalar(sumXbyD.dimensions(), small)) ); } @@ -142,14 +146,14 @@ Fickian::Fickian mixtureDiffusionCoefficients_(true), - DFuncs_(this->thermo().composition().species().size()), + DFuncs_(this->thermo().species().size()), - DmFuncs_(this->thermo().composition().species().size()), + DmFuncs_(this->thermo().species().size()), DTFuncs_ ( this->coeffDict_.found("DT") - ? this->thermo().composition().species().size() + ? this->thermo().species().size() : 0 ) {} @@ -165,8 +169,7 @@ bool Fickian::read() BasicThermophysicalTransportModel::read() ) { - const basicSpecieMixture& composition = this->thermo().composition(); - const speciesTable& species = composition.species(); + const speciesTable& species = this->thermo().species(); this->coeffDict_.lookup("mixtureDiffusionCoefficients") >> mixtureDiffusionCoefficients_; @@ -273,13 +276,11 @@ tmp Fickian::DEff const volScalarField& Yi ) const { - const basicSpecieMixture& composition = this->thermo().composition(); - return volScalarField::New ( "DEff", this->momentumTransport().rho() - *Dm()[composition.index(Yi)] + *Dm()[this->thermo().specieIndex(Yi)] ); } @@ -291,11 +292,9 @@ tmp Fickian::DEff const label patchi ) const { - const basicSpecieMixture& composition = this->thermo().composition(); - return this->momentumTransport().rho().boundaryField()[patchi] - *Dm()[composition.index(Yi)].boundaryField()[patchi]; + *Dm()[this->thermo().specieIndex(Yi)].boundaryField()[patchi]; } @@ -316,8 +315,9 @@ tmp Fickian::q() const ) ); - const basicSpecieMixture& composition = this->thermo().composition(); - const PtrList& Y = composition.Y(); + const PtrList& Y = this->thermo().Y(); + const volScalarField& p = this->thermo().p(); + const volScalarField& T = this->thermo().T(); if (Y.size()) { @@ -343,12 +343,9 @@ tmp Fickian::q() const forAll(Y, i) { - if (i != composition.defaultSpecie()) + if (i != this->thermo().defaultSpecie()) { - const volScalarField hi - ( - composition.Hs(i, this->thermo().p(), this->thermo().T()) - ); + const volScalarField hi(this->thermo().hsi(i, p, T)); const surfaceScalarField ji(this->j(Y[i])); sumJ += ji; @@ -358,12 +355,9 @@ tmp Fickian::q() const } { - const label i = composition.defaultSpecie(); + const label i = this->thermo().defaultSpecie(); - const volScalarField hi - ( - composition.Hs(i, this->thermo().p(), this->thermo().T()) - ); + const volScalarField hi(this->thermo().hsi(i, p, T)); sumJh -= sumJ*fvc::interpolate(hi); } @@ -390,8 +384,9 @@ tmp Fickian::divq ) ); - const basicSpecieMixture& composition = this->thermo().composition(); - const PtrList& Y = composition.Y(); + const PtrList& Y = this->thermo().Y(); + const volScalarField& p = this->thermo().p(); + const volScalarField& T = this->thermo().T(); tmpDivq.ref() -= fvm::laplacianCorrection(this->alpha()*this->alphaEff(), he); @@ -418,12 +413,9 @@ tmp Fickian::divq forAll(Y, i) { - if (i != composition.defaultSpecie()) + if (i != this->thermo().defaultSpecie()) { - const volScalarField hi - ( - composition.Hs(i, this->thermo().p(), this->thermo().T()) - ); + const volScalarField hi(this->thermo().hsi(i, p, T)); const surfaceScalarField ji(this->j(Y[i])); sumJ += ji; @@ -433,12 +425,9 @@ tmp Fickian::divq } { - const label i = composition.defaultSpecie(); + const label i = this->thermo().defaultSpecie(); - const volScalarField hi - ( - composition.Hs(i, this->thermo().p(), this->thermo().T()) - ); + const volScalarField hi(this->thermo().hsi(i, p, T)); sumJh -= sumJ*fvc::interpolate(hi); } @@ -457,7 +446,6 @@ tmp Fickian::j { if (DTFuncs_.size()) { - const basicSpecieMixture& composition = this->thermo().composition(); const volScalarField& p = this->thermo().p(); const volScalarField& T = this->thermo().T(); @@ -467,7 +455,7 @@ tmp Fickian::j ( evaluate ( - DTFuncs_[composition.index(Yi)], + DTFuncs_[this->thermo().specieIndex(Yi)], dimDynamicViscosity, p, T @@ -490,7 +478,6 @@ tmp Fickian::divj { if (DTFuncs_.size()) { - const basicSpecieMixture& composition = this->thermo().composition(); const volScalarField& p = this->thermo().p(); const volScalarField& T = this->thermo().T(); @@ -502,7 +489,7 @@ tmp Fickian::divj ( evaluate ( - DTFuncs_[composition.index(Yi)], + DTFuncs_[this->thermo().specieIndex(Yi)], dimDynamicViscosity, p, T diff --git a/src/ThermophysicalTransportModels/fluid/laminar/MaxwellStefan/MaxwellStefan.C b/src/ThermophysicalTransportModels/fluid/laminar/MaxwellStefan/MaxwellStefan.C index fc93b68354..9ed636501d 100644 --- a/src/ThermophysicalTransportModels/fluid/laminar/MaxwellStefan/MaxwellStefan.C +++ b/src/ThermophysicalTransportModels/fluid/laminar/MaxwellStefan/MaxwellStefan.C @@ -42,8 +42,7 @@ template void MaxwellStefan:: transformDiffusionCoefficient() const { - const basicSpecieMixture& composition = this->thermo().composition(); - const label d = composition.defaultSpecie(); + const label d = this->thermo().defaultSpecie(); // Calculate the molecular weight of the mixture and the mole fractions scalar Wm = 0; @@ -110,8 +109,7 @@ template void MaxwellStefan:: transformDiffusionCoefficientFields() const { - const basicSpecieMixture& composition = this->thermo().composition(); - const label d = composition.defaultSpecie(); + const label d = this->thermo().defaultSpecie(); // For each cell or patch face forAll(*(YPtrs[0]), pi) @@ -166,13 +164,12 @@ void MaxwellStefan::transform List>& Dij ) const { - const basicSpecieMixture& composition = this->thermo().composition(); - const PtrList& Y = composition.Y(); + const PtrList& Y = this->thermo().Y(); const volScalarField& Y0 = Y[0]; forAll(W, i) { - // Map composition.Y() internal fields -> YPtrs + // Map this->thermo().Y() internal fields -> YPtrs YPtrs[i] = &Y[i].primitiveField(); // Map Dii_ internal fields -> DijPtrs @@ -196,7 +193,7 @@ void MaxwellStefan::transform { forAll(W, i) { - // Map composition.Y() patch fields -> YPtrs + // Map this->thermo().Y() patch fields -> YPtrs YPtrs[i] = &Y[i].boundaryField()[patchi]; // Map Dii_ patch fields -> DijPtrs @@ -222,10 +219,9 @@ void MaxwellStefan::transform template void MaxwellStefan::updateDii() const { - const basicSpecieMixture& composition = this->thermo().composition(); - const label d = composition.defaultSpecie(); + const label d = this->thermo().defaultSpecie(); - const PtrList& Y = composition.Y(); + const PtrList& Y = this->thermo().Y(); const volScalarField& p = this->thermo().p(); const volScalarField& T = this->thermo().T(); const volScalarField& rho = this->momentumTransport().rho(); @@ -363,16 +359,16 @@ MaxwellStefan::MaxwellStefan UpdateableMeshObject(*this, thermo.mesh()), - DFuncs_(this->thermo().composition().species().size()), + DFuncs_(this->thermo().species().size()), DTFuncs_ ( this->coeffDict_.found("DT") - ? this->thermo().composition().species().size() + ? this->thermo().species().size() : 0 ), - W(this->thermo().composition().species().size()), + W(this->thermo().species().size()), YPtrs(W.size()), DijPtrs(W.size()), @@ -385,12 +381,10 @@ MaxwellStefan::MaxwellStefan invA(A.m()), D(W.size()) { - const basicSpecieMixture& composition = this->thermo().composition(); - // Set the molecular weights of the species forAll(W, i) { - W[i] = composition.Wi(i); + W[i] = this->thermo().Wi(i); } } @@ -405,8 +399,7 @@ bool MaxwellStefan::read() BasicThermophysicalTransportModel::read() ) { - const basicSpecieMixture& composition = this->thermo().composition(); - const speciesTable& species = composition.species(); + const speciesTable& species = this->thermo().species(); const dictionary& Ddict = this->coeffDict_.subDict("D"); @@ -492,12 +485,10 @@ tmp MaxwellStefan::DEff const volScalarField& Yi ) const { - const basicSpecieMixture& composition = this->thermo().composition(); - return volScalarField::New ( "DEff", - this->momentumTransport().rho()*Dii()[composition.index(Yi)] + this->momentumTransport().rho()*Dii()[this->thermo().specieIndex(Yi)] ); } @@ -509,11 +500,9 @@ tmp MaxwellStefan::DEff const label patchi ) const { - const basicSpecieMixture& composition = this->thermo().composition(); - return this->momentumTransport().rho().boundaryField()[patchi] - *Dii()[composition.index(Yi)].boundaryField()[patchi]; + *Dii()[this->thermo().specieIndex(Yi)].boundaryField()[patchi]; } @@ -535,10 +524,11 @@ MaxwellStefan::q() const ) ); - const basicSpecieMixture& composition = this->thermo().composition(); - const label d = composition.defaultSpecie(); + const label d = this->thermo().defaultSpecie(); - const PtrList& Y = composition.Y(); + const PtrList& Y = this->thermo().Y(); + const volScalarField& p = this->thermo().p(); + const volScalarField& T = this->thermo().T(); if (Y.size()) { @@ -566,10 +556,7 @@ MaxwellStefan::q() const { if (i != d) { - const volScalarField hi - ( - composition.Hs(i, this->thermo().p(), this->thermo().T()) - ); + const volScalarField hi(this->thermo().hsi(i, p, T)); const surfaceScalarField ji(this->j(Y[i])); sumJ += ji; @@ -581,10 +568,7 @@ MaxwellStefan::q() const { const label i = d; - const volScalarField hi - ( - composition.Hs(i, this->thermo().p(), this->thermo().T()) - ); + const volScalarField hi(this->thermo().hsi(i, p, T)); sumJh -= sumJ*fvc::interpolate(hi); } @@ -611,10 +595,11 @@ tmp MaxwellStefan::divq ) ); - const basicSpecieMixture& composition = this->thermo().composition(); - const label d = composition.defaultSpecie(); + const label d = this->thermo().defaultSpecie(); - const PtrList& Y = composition.Y(); + const PtrList& Y = this->thermo().Y(); + const volScalarField& p = this->thermo().p(); + const volScalarField& T = this->thermo().T(); tmpDivq.ref() -= fvm::laplacianCorrection(this->alpha()*this->alphaEff(), he); @@ -643,10 +628,7 @@ tmp MaxwellStefan::divq { if (i != d) { - const volScalarField hi - ( - composition.Hs(i, this->thermo().p(), this->thermo().T()) - ); + const volScalarField hi(this->thermo().hsi(i, p, T)); const surfaceScalarField ji(this->j(Y[i])); sumJ += ji; @@ -658,10 +640,7 @@ tmp MaxwellStefan::divq { const label i = d; - const volScalarField hi - ( - composition.Hs(i, this->thermo().p(), this->thermo().T()) - ); + const volScalarField hi(this->thermo().hsi(i, p, T)); sumJh -= sumJ*fvc::interpolate(hi); } @@ -678,12 +657,11 @@ tmp MaxwellStefan::j const volScalarField& Yi ) const { - const basicSpecieMixture& composition = this->thermo().composition(); - const label d = composition.defaultSpecie(); + const label d = this->thermo().defaultSpecie(); - if (composition.index(Yi) == d) + if (this->thermo().specieIndex(Yi) == d) { - const PtrList& Y = composition.Y(); + const PtrList& Y = this->thermo().Y(); tmp tjd ( @@ -715,7 +693,7 @@ tmp MaxwellStefan::j { return BasicThermophysicalTransportModel::j(Yi) - + jexp()[composition.index(Yi)]; + + jexp()[this->thermo().specieIndex(Yi)]; } } @@ -726,10 +704,9 @@ tmp MaxwellStefan::divj volScalarField& Yi ) const { - const basicSpecieMixture& composition = this->thermo().composition(); return BasicThermophysicalTransportModel::divj(Yi) - + fvc::div(jexp()[composition.index(Yi)]*Yi.mesh().magSf()); + + fvc::div(jexp()[this->thermo().specieIndex(Yi)]*Yi.mesh().magSf()); } diff --git a/src/ThermophysicalTransportModels/fluid/turbulence/nonUnityLewisEddyDiffusivity/nonUnityLewisEddyDiffusivity.C b/src/ThermophysicalTransportModels/fluid/turbulence/nonUnityLewisEddyDiffusivity/nonUnityLewisEddyDiffusivity.C index 491d33da70..a0c1d2ef0f 100644 --- a/src/ThermophysicalTransportModels/fluid/turbulence/nonUnityLewisEddyDiffusivity/nonUnityLewisEddyDiffusivity.C +++ b/src/ThermophysicalTransportModels/fluid/turbulence/nonUnityLewisEddyDiffusivity/nonUnityLewisEddyDiffusivity.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2020-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2020-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -102,8 +102,7 @@ nonUnityLewisEddyDiffusivity::q() const ) ); - const basicSpecieMixture& composition = this->thermo().composition(); - const PtrList& Y = composition.Y(); + const PtrList& Y = this->thermo().Y(); if (Y.size()) { @@ -121,7 +120,7 @@ nonUnityLewisEddyDiffusivity::q() const { const volScalarField hi ( - composition.Hs(i, this->thermo().p(), this->thermo().T()) + this->thermo().hsi(i, this->thermo().p(), this->thermo().T()) ); hGradY += fvc::interpolate(hi)*fvc::snGrad(Y[i]); @@ -158,8 +157,7 @@ nonUnityLewisEddyDiffusivity::divq ) ); - const basicSpecieMixture& composition = this->thermo().composition(); - const PtrList& Y = composition.Y(); + const PtrList& Y = this->thermo().Y(); tmpDivq.ref() -= fvm::laplacianCorrection(this->alpha()*this->alphaEff(), he); @@ -178,7 +176,7 @@ nonUnityLewisEddyDiffusivity::divq { const volScalarField hi ( - composition.Hs(i, this->thermo().p(), this->thermo().T()) + this->thermo().hsi(i, this->thermo().p(), this->thermo().T()) ); hGradY += fvc::interpolate(hi)*fvc::snGrad(Y[i]); diff --git a/src/combustionModels/EDC/EDC.C b/src/combustionModels/EDC/EDC.C index 0dfebaa0bf..fcda0bb62d 100644 --- a/src/combustionModels/EDC/EDC.C +++ b/src/combustionModels/EDC/EDC.C @@ -211,7 +211,7 @@ Foam::combustionModels::EDC::R(volScalarField& Y) const tmp tSu(new fvScalarMatrix(Y, dimMass/dimTime)); fvScalarMatrix& Su = tSu.ref(); - const label speciei = this->thermo().composition().species()[Y.member()]; + const label speciei = this->thermo().species()[Y.member()]; Su += chemistryPtr_->RR()[speciei]; return kappa_*tSu; diff --git a/src/combustionModels/FSD/FSD.C b/src/combustionModels/FSD/FSD.C index 5baa743806..e78fe0d73d 100644 --- a/src/combustionModels/FSD/FSD.C +++ b/src/combustionModels/FSD/FSD.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -107,9 +107,9 @@ void Foam::combustionModels::FSD::calculateSourceNorm() const label fuelI = this->fuelIndex(); - const volScalarField& YFuel = this->thermo().composition().Y()[fuelI]; + const volScalarField& YFuel = this->thermo().Y()[fuelI]; - const volScalarField& YO2 = this->thermo().composition().Y("O2"); + const volScalarField& YO2 = this->thermo().Y("O2"); const dimensionedScalar s = this->s(); @@ -298,7 +298,7 @@ void Foam::combustionModels::FSD::calculateSourceNorm() forAll(productsIndex, j) { label specieI = productsIndex[j]; - const volScalarField& Yp = this->thermo().composition().Y()[specieI]; + const volScalarField& Yp = this->thermo().Y()[specieI]; products += Yp; } diff --git a/src/combustionModels/diffusion/diffusion.C b/src/combustionModels/diffusion/diffusion.C index b837394df4..bb68a2d035 100644 --- a/src/combustionModels/diffusion/diffusion.C +++ b/src/combustionModels/diffusion/diffusion.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2012-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -79,12 +79,11 @@ void Foam::combustionModels::diffusion::correct() const label fuelI = this->fuelIndex(); - const volScalarField& YFuel = this->thermo().composition().Y()[fuelI]; + const volScalarField& YFuel = this->thermo().Y()[fuelI]; - if (this->thermo().composition().contains(oxidantName_)) + if (this->thermo().containsSpecie(oxidantName_)) { - const volScalarField& YO2 = - this->thermo().composition().Y(oxidantName_); + const volScalarField& YO2 = this->thermo().Y(oxidantName_); this->wFuel_ == C_*this->thermo().rho()*this->turbulence().nuEff() diff --git a/src/combustionModels/functionObjects/adjustTimeStepToCombustion/adjustTimeStepToCombustion.C b/src/combustionModels/functionObjects/adjustTimeStepToCombustion/adjustTimeStepToCombustion.C index cc3086cfb9..b2541798a6 100644 --- a/src/combustionModels/functionObjects/adjustTimeStepToCombustion/adjustTimeStepToCombustion.C +++ b/src/combustionModels/functionObjects/adjustTimeStepToCombustion/adjustTimeStepToCombustion.C @@ -176,9 +176,9 @@ Foam::functionObjects::adjustTimeStepToCombustion::maxDeltaT() const dimensionedScalar(dimless/dimTime, 0) ) ); - forAll(thermo.composition().Y(), i) + forAll(thermo.Y(), i) { - if (thermo.composition().solve(i)) + if (thermo.solveSpecie(i)) { rhoDotByRho += mag(combustion.R(i))/2/thermo.rho()(); } diff --git a/src/combustionModels/infinitelyFastChemistry/infinitelyFastChemistry.C b/src/combustionModels/infinitelyFastChemistry/infinitelyFastChemistry.C index d8e2b08ad6..ceb3889e53 100644 --- a/src/combustionModels/infinitelyFastChemistry/infinitelyFastChemistry.C +++ b/src/combustionModels/infinitelyFastChemistry/infinitelyFastChemistry.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -82,13 +82,13 @@ void Foam::combustionModels::infinitelyFastChemistry::correct() const label fuelI = this->fuelIndex(); - const volScalarField& YFuel = this->thermo().composition().Y()[fuelI]; + const volScalarField& YFuel = this->thermo().Y()[fuelI]; const dimensionedScalar s = this->s(); - if (this->thermo().composition().contains("O2")) + if (this->thermo().containsSpecie("O2")) { - const volScalarField& YO2 = this->thermo().composition().Y("O2"); + const volScalarField& YO2 = this->thermo().Y("O2"); this->wFuel_ == this->rho()/(this->mesh().time().deltaT()*C_) diff --git a/src/combustionModels/laminar/laminar.C b/src/combustionModels/laminar/laminar.C index 606535f6da..548da5e84f 100644 --- a/src/combustionModels/laminar/laminar.C +++ b/src/combustionModels/laminar/laminar.C @@ -140,7 +140,7 @@ Foam::combustionModels::laminar::R(volScalarField& Y) const tmp tSu(new fvScalarMatrix(Y, dimMass/dimTime)); fvScalarMatrix& Su = tSu.ref(); - const label specieI = this->thermo().composition().species()[Y.member()]; + const label specieI = this->thermo().species()[Y.member()]; Su += chemistryPtr_->RR()[specieI]; return tSu; diff --git a/src/combustionModels/noCombustion/noCombustion.C b/src/combustionModels/noCombustion/noCombustion.C index cfc9362377..89bfd95a0b 100644 --- a/src/combustionModels/noCombustion/noCombustion.C +++ b/src/combustionModels/noCombustion/noCombustion.C @@ -71,7 +71,7 @@ Foam::combustionModels::noCombustion::R(const label speciei) const return volScalarField::Internal::New ( - typedName("R_" + this->thermo().composition().Y()[speciei].name()), + typedName("R_" + this->thermo().Y()[speciei].name()), this->mesh(), dimensionedScalar(dimDensity/dimTime, 0) ); diff --git a/src/combustionModels/radiationModels/sootModels/mixtureFraction/mixtureFraction.C b/src/combustionModels/radiationModels/sootModels/mixtureFraction/mixtureFraction.C index ccbf291bae..b92f632dfe 100644 --- a/src/combustionModels/radiationModels/sootModels/mixtureFraction/mixtureFraction.C +++ b/src/combustionModels/radiationModels/sootModels/mixtureFraction/mixtureFraction.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2013-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -87,8 +87,6 @@ Foam::radiationModels::sootModels::mixtureFraction::mixtureFraction combustionModel::combustionPropertiesName ); - const basicSpecieMixture& mixture = combustion.mixture(); - const reaction& singleReaction = combustion.singleReaction(); scalar totalMol = 0; @@ -108,15 +106,15 @@ Foam::radiationModels::sootModels::mixtureFraction::mixtureFraction const label speciei = singleReaction.rhs()[i].index; const scalar stoichCoeff = singleReaction.rhs()[i].stoichCoeff; Xi[i] = mag(stoichCoeff)/totalMol; - Wm += Xi[i]*mixture.Wi(speciei); + Wm += Xi[i]*combustion.thermo().Wi(speciei); } - scalarList Yprod0(mixture.species().size(), 0.0); + scalarList Yprod0(combustion.thermo().species().size(), 0.0); forAll(singleReaction.rhs(), i) { const label speciei = singleReaction.rhs()[i].index; - Yprod0[speciei] = mixture.Wi(speciei)/Wm*Xi[i]; + Yprod0[speciei] = combustion.thermo().Wi(speciei)/Wm*Xi[i]; } const scalar XSoot = nuSoot_/totalMol; @@ -129,10 +127,11 @@ Foam::radiationModels::sootModels::mixtureFraction::mixtureFraction if (mappingFieldName_ == "none") { const label index = singleReaction.rhs()[0].index; - mappingFieldName_ = mixture.Y(index).name(); + mappingFieldName_ = combustion.thermo().Y(index).name(); } - const label mapFieldIndex = mixture.species()[mappingFieldName_]; + const label mapFieldIndex = + combustion.thermo().species()[mappingFieldName_]; mapFieldMax_ = Yprod0[mapFieldIndex]; } diff --git a/src/combustionModels/singleStepCombustion/singleStepCombustion.C b/src/combustionModels/singleStepCombustion/singleStepCombustion.C index db0b20458a..2f2975e9d5 100644 --- a/src/combustionModels/singleStepCombustion/singleStepCombustion.C +++ b/src/combustionModels/singleStepCombustion/singleStepCombustion.C @@ -32,7 +32,7 @@ License void Foam::combustionModels::singleStepCombustion::calculateqFuel() { - const scalar Wu = mixture_.Wi(fuelIndex_); + const scalar Wu = thermo_.Wi(fuelIndex_); forAll(reaction_.lhs(), i) { @@ -40,7 +40,7 @@ void Foam::combustionModels::singleStepCombustion::calculateqFuel() const scalar stoichCoeff = reaction_.lhs()[i].stoichCoeff; specieStoichCoeffs_[speciei] = -stoichCoeff; qFuel_.value() += - mixture_.Hf(speciei)*mixture_.Wi(speciei)*stoichCoeff/Wu; + thermo_.hfi(speciei)*thermo_.Wi(speciei)*stoichCoeff/Wu; } forAll(reaction_.rhs(), i) @@ -49,7 +49,7 @@ void Foam::combustionModels::singleStepCombustion::calculateqFuel() const scalar stoichCoeff = reaction_.rhs()[i].stoichCoeff; specieStoichCoeffs_[speciei] = stoichCoeff; qFuel_.value() -= - mixture_.Hf(speciei)*mixture_.Wi(speciei)*stoichCoeff/Wu; + thermo_.hfi(speciei)*thermo_.Wi(speciei)*stoichCoeff/Wu; specieProd_[speciei] = -1; } @@ -59,17 +59,17 @@ void Foam::combustionModels::singleStepCombustion::calculateqFuel() void Foam::combustionModels::singleStepCombustion::massAndAirStoichRatios() { - const label O2Index = mixture_.species()["O2"]; - const scalar Wu = mixture_.Wi(fuelIndex_); + const label O2Index = thermo_.species()["O2"]; + const scalar Wu = thermo_.Wi(fuelIndex_); stoicRatio_ = ( - mixture_.Wi(mixture_.defaultSpecie()) - *specieStoichCoeffs_[mixture_.defaultSpecie()] - + mixture_.Wi(O2Index)*mag(specieStoichCoeffs_[O2Index]) + thermo_.Wi(thermo_.defaultSpecie()) + *specieStoichCoeffs_[thermo_.defaultSpecie()] + + thermo_.Wi(O2Index)*mag(specieStoichCoeffs_[O2Index]) )/(Wu*mag(specieStoichCoeffs_[fuelIndex_])); - s_ = mixture_.Wi(O2Index)*mag(specieStoichCoeffs_[O2Index]) + s_ = thermo_.Wi(O2Index)*mag(specieStoichCoeffs_[O2Index]) /(Wu*mag(specieStoichCoeffs_[fuelIndex_])); Info << "stoichiometric air-fuel ratio: " << stoicRatio_.value() << endl; @@ -93,13 +93,13 @@ void Foam::combustionModels::singleStepCombustion::calculateMaxProducts() { const label speciei = reaction_.rhs()[i].index; Xi[i] = mag(specieStoichCoeffs_[speciei])/totalMol; - Wm += Xi[i]*mixture_.Wi(speciei); + Wm += Xi[i]*thermo_.Wi(speciei); } forAll(reaction_.rhs(), i) { const label speciei = reaction_.rhs()[i].index; - Yprod0_[speciei] = mixture_.Wi(speciei)/Wm*Xi[i]; + Yprod0_[speciei] = thermo_.Wi(speciei)/Wm*Xi[i]; } Info << "Maximum products mass concentrations: " << nl; @@ -107,7 +107,7 @@ void Foam::combustionModels::singleStepCombustion::calculateMaxProducts() { if (Yprod0_[i] > 0) { - Info<< " " << mixture_.species()[i] << ": " << Yprod0_[i] << nl; + Info<< " " << thermo_.species()[i] << ": " << Yprod0_[i] << nl; } } @@ -115,8 +115,8 @@ void Foam::combustionModels::singleStepCombustion::calculateMaxProducts() forAll(specieStoichCoeffs_, i) { specieStoichCoeffs_[i] = - specieStoichCoeffs_[i]*mixture_.Wi(i) - /(mixture_.Wi(fuelIndex_)*mag(specieStoichCoeffs_[fuelIndex_])); + specieStoichCoeffs_[i]*thermo_.Wi(i) + /(thermo_.Wi(fuelIndex_)*mag(specieStoichCoeffs_[fuelIndex_])); } } @@ -132,15 +132,14 @@ Foam::combustionModels::singleStepCombustion::singleStepCombustion ) : combustionModel(modelType, thermo, turb, combustionProperties), - mixture_(dynamic_cast(this->thermo())), - reaction_(mixture_.species(), this->subDict("reaction")), + reaction_(thermo_.species(), this->subDict("reaction")), stoicRatio_(dimensionedScalar("stoicRatio", dimless, 0)), s_(dimensionedScalar("s", dimless, 0)), qFuel_(dimensionedScalar("qFuel", sqr(dimVelocity), 0)), - specieStoichCoeffs_(mixture_.species().size(), 0.0), - Yprod0_(mixture_.species().size(), 0.0), + specieStoichCoeffs_(thermo_.species().size(), 0.0), + Yprod0_(thermo_.species().size(), 0.0), fres_(Yprod0_.size()), - fuelIndex_(mixture_.species()[thermo.properties().lookup("fuel")]), + fuelIndex_(thermo_.species()[thermo.properties().lookup("fuel")]), specieProd_(Yprod0_.size(), 1), wFuel_ ( @@ -161,7 +160,7 @@ Foam::combustionModels::singleStepCombustion::singleStepCombustion { IOobject header ( - "fres_" + mixture_.species()[fresI], + "fres_" + thermo_.species()[fresI], this->mesh().time().name(), this->mesh() ); @@ -213,7 +212,7 @@ Foam::combustionModels::singleStepCombustion::R(const label speciei) const Foam::tmp Foam::combustionModels::singleStepCombustion::R(volScalarField& Y) const { - const label specieI = mixture_.species()[Y.member()]; + const label specieI = thermo_.species()[Y.member()]; volScalarField wSpecie ( @@ -240,7 +239,7 @@ Foam::combustionModels::singleStepCombustion::Qdot() const { const label fuelI = fuelIndex(); volScalarField& YFuel = - const_cast(this->thermo().composition().Y(fuelI)); + const_cast(this->thermo().Y(fuelI)); return -qFuel()*(R(YFuel) & YFuel); } @@ -261,9 +260,9 @@ bool Foam::combustionModels::singleStepCombustion::read() void Foam::combustionModels::singleStepCombustion::fresCorrect() { - const label O2Index = mixture_.species()["O2"]; - const volScalarField& YFuel = mixture_.Y()[fuelIndex_]; - const volScalarField& YO2 = mixture_.Y()[O2Index]; + const label O2Index = thermo_.species()["O2"]; + const volScalarField& YFuel = thermo_.Y()[fuelIndex_]; + const volScalarField& YO2 = thermo_.Y()[O2Index]; // reactants forAll(reaction_.lhs(), i) @@ -283,7 +282,7 @@ void Foam::combustionModels::singleStepCombustion::fresCorrect() forAll(reaction_.rhs(), i) { const label speciei = reaction_.rhs()[i].index; - if (speciei != mixture_.defaultSpecie()) + if (speciei != thermo_.defaultSpecie()) { forAll(fres_[speciei], celli) { diff --git a/src/combustionModels/singleStepCombustion/singleStepCombustion.H b/src/combustionModels/singleStepCombustion/singleStepCombustion.H index 25cf63bb56..e48febbfae 100644 --- a/src/combustionModels/singleStepCombustion/singleStepCombustion.H +++ b/src/combustionModels/singleStepCombustion/singleStepCombustion.H @@ -25,7 +25,7 @@ Class Foam::combustionModels::singleStepCombustion Description - Base class for combustion models using basicSpecieMixture. + Base class for single-step combustion models SourceFiles singleStepCombustion.C @@ -36,7 +36,6 @@ SourceFiles #define singleStepCombustion_H #include "combustionModel.H" -#include "basicSpecieMixture.H" #include "reaction.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -58,9 +57,6 @@ protected: // Protected data - //- Reference to the mixture - const basicSpecieMixture& mixture_; - //- The single-step reaction reaction reaction_; @@ -132,9 +128,6 @@ public: // Access functions - //- Return the mixture - const basicSpecieMixture& mixture() const; - //- Return the single step reaction inline const reaction& singleReaction() const; diff --git a/src/combustionModels/singleStepCombustion/singleStepCombustionI.H b/src/combustionModels/singleStepCombustion/singleStepCombustionI.H index 8499b40f00..2a306ba4c4 100644 --- a/src/combustionModels/singleStepCombustion/singleStepCombustionI.H +++ b/src/combustionModels/singleStepCombustion/singleStepCombustionI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -34,12 +34,6 @@ namespace combustionModels // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -inline const Foam::basicSpecieMixture& singleStepCombustion::mixture() const -{ - return mixture_; -} - - inline const Foam::reaction& singleStepCombustion::singleReaction() const { return reaction_; diff --git a/src/lagrangian/parcel/fvModels/clouds/clouds.C b/src/lagrangian/parcel/fvModels/clouds/clouds.C index c8ca965ef1..7a59fddfca 100644 --- a/src/lagrangian/parcel/fvModels/clouds/clouds.C +++ b/src/lagrangian/parcel/fvModels/clouds/clouds.C @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "clouds.H" -#include "basicSpecieMixture.H" +#include "multicomponentThermo.H" #include "fvMatrix.H" #include "addToRunTimeSelectionTable.H" @@ -167,16 +167,16 @@ Foam::wordList Foam::fv::clouds::addSupFields() const fieldNames.append(carrierThermo.he().name()); - if (isA(carrierThermo)) + if (isA(carrierThermo)) { - const basicSpecieMixture& composition = - refCast(carrierThermo); + const multicomponentThermo& carrierMcThermo = + refCast(carrierThermo); - const PtrList& Y = composition.Y(); + const PtrList& Y = carrierMcThermo.Y(); forAll(Y, i) { - if (composition.solve(i)) + if (carrierMcThermo.solveSpecie(i)) { fieldNames.append(Y[i].name()); } @@ -262,20 +262,20 @@ void Foam::fv::clouds::addSup { eqn += cloudsPtr_().Sh(eqn.psi()); } - else if - ( - isA(carrierThermo) - && refCast(carrierThermo).contains - ( - eqn.psi().name() - ) - ) + else if (isA(carrierThermo)) { - eqn += cloudsPtr_().SYi - ( - refCast(carrierThermo).index(eqn.psi()), - eqn.psi() - ); + const multicomponentThermo& carrierMcThermo = + refCast(carrierThermo); + + if (carrierMcThermo.containsSpecie(eqn.psi().name())) + { + eqn += + cloudsPtr_().SYi + ( + carrierMcThermo.specieIndex(eqn.psi()), + eqn.psi() + ); + } } } diff --git a/src/lagrangian/parcel/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.C b/src/lagrangian/parcel/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.C index 23d8bb664f..6347cfa0ba 100644 --- a/src/lagrangian/parcel/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.C +++ b/src/lagrangian/parcel/parcels/Templates/ReactingMultiphaseParcel/ReactingMultiphaseParcel.C @@ -435,7 +435,7 @@ void Foam::ReactingMultiphaseParcel::calc { scalar dm = np0*dMassGas[i]; label gid = composition.localToCarrierId(GAS, i); - scalar hs = composition.carrier().Hs(gid, pc, T0); + scalar hs = composition.carrier().hsi(gid, pc, T0); cloud.rhoTrans(gid)[this->cell()] += dm; cloud.UTransRef()[this->cell()] += dm*U0; cloud.hsTransRef()[this->cell()] += dm*hs; @@ -444,7 +444,7 @@ void Foam::ReactingMultiphaseParcel::calc { scalar dm = np0*dMassLiquid[i]; label gid = composition.localToCarrierId(LIQ, i); - scalar hs = composition.carrier().Hs(gid, pc, T0); + scalar hs = composition.carrier().hsi(gid, pc, T0); cloud.rhoTrans(gid)[this->cell()] += dm; cloud.UTransRef()[this->cell()] += dm*U0; cloud.hsTransRef()[this->cell()] += dm*hs; @@ -456,7 +456,7 @@ void Foam::ReactingMultiphaseParcel::calc { scalar dm = np0*dMassSolid[i]; label gid = composition.localToCarrierId(SLD, i); - scalar hs = composition.carrier().Hs(gid, pc, T0); + scalar hs = composition.carrier().hsi(gid, pc, T0); cloud.rhoTrans(gid)[this->cell()] += dm; cloud.UTransRef()[this->cell()] += dm*U0; cloud.hsTransRef()[this->cell()] += dm*hs; @@ -466,7 +466,7 @@ void Foam::ReactingMultiphaseParcel::calc forAll(dMassSRCarrier, i) { scalar dm = np0*dMassSRCarrier[i]; - scalar hs = composition.carrier().Hs(i, pc, T0); + scalar hs = composition.carrier().hsi(i, pc, T0); cloud.rhoTrans(i)[this->cell()] += dm; cloud.UTransRef()[this->cell()] += dm*U0; cloud.hsTransRef()[this->cell()] += dm*hs; @@ -598,7 +598,7 @@ void Foam::ReactingMultiphaseParcel::calcDevolatilisation forAll(dMassDV, i) { const label id = composition.localToCarrierId(GAS, i); - const scalar Cp = composition.carrier().Cp(id, td.pc(), Ts); + const scalar Cp = composition.carrier().Cpi(id, td.pc(), Ts); const scalar W = composition.carrier().Wi(id); const scalar Ni = dMassDV[i]/(this->areaS(d)*dt*W); diff --git a/src/lagrangian/parcel/parcels/Templates/ReactingParcel/ReactingParcel.C b/src/lagrangian/parcel/parcels/Templates/ReactingParcel/ReactingParcel.C index cb53759792..3646a477b7 100644 --- a/src/lagrangian/parcel/parcels/Templates/ReactingParcel/ReactingParcel.C +++ b/src/lagrangian/parcel/parcels/Templates/ReactingParcel/ReactingParcel.C @@ -132,7 +132,7 @@ void Foam::ReactingParcel::calcPhaseChange { const label cid = composition.localToCarrierId(idPhase, i); - const scalar Cp = composition.carrier().Cp(cid, td.pc(), Tsdash); + const scalar Cp = composition.carrier().Cpi(cid, td.pc(), Tsdash); const scalar W = composition.carrier().Wi(cid); const scalar Ni = dMassPC[i]/(this->areaS(d)*dt*W); @@ -254,7 +254,7 @@ void Foam::ReactingParcel::cellValueSourceCorrection forAll(cloud.rhoTrans(), i) { scalar Y = cloud.rhoTrans(i)[this->cell()]/addedMass; - CpEff += Y*cloud.composition().carrier().Cp(i, td.pc(), td.Tc()); + CpEff += Y*cloud.composition().carrier().Cpi(i, td.pc(), td.Tc()); } const scalar Cpc = td.CpInterp().psi()[this->cell()]; @@ -296,14 +296,15 @@ void Foam::ReactingParcel::correctSurfaceValues return; } - const basicSpecieMixture& carrier = cloud.composition().carrier(); + const fluidMulticomponentThermo& carrierThermo = + cloud.composition().carrier(); // Far field carrier molar fractions - scalarField Xinf(carrier.species().size()); + scalarField Xinf(carrierThermo.species().size()); forAll(Xinf, i) { - Xinf[i] = carrier.Y(i)[this->cell()]/carrier.Wi(i); + Xinf[i] = carrierThermo.Y(i)[this->cell()]/carrierThermo.Wi(i); } Xinf /= sum(Xinf); @@ -325,7 +326,7 @@ void Foam::ReactingParcel::correctSurfaceValues const scalar Csi = Cs[i] + Xsff*Xinf[i]*CsTot; Xs[i] = (2.0*Csi + Xinf[i]*CsTot)/3.0; - Ys[i] = Xs[i]*carrier.Wi(i); + Ys[i] = Xs[i]*carrierThermo.Wi(i); } Xs /= sum(Xs); Ys /= sum(Ys); @@ -340,14 +341,14 @@ void Foam::ReactingParcel::correctSurfaceValues forAll(Ys, i) { - const scalar W = carrier.Wi(i); + const scalar W = carrierThermo.Wi(i); const scalar sqrtW = sqrt(W); const scalar cbrtW = cbrt(W); rhos += Xs[i]*W; - mus += Ys[i]*sqrtW*carrier.mu(i, td.pc(), T); - kappas += Ys[i]*cbrtW*carrier.kappa(i, td.pc(), T); - Cps += Xs[i]*carrier.Cp(i, td.pc(), T); + mus += Ys[i]*sqrtW*carrierThermo.mui(i, td.pc(), T); + kappas += Ys[i]*cbrtW*carrierThermo.kappai(i, td.pc(), T); + Cps += Xs[i]*carrierThermo.Cpi(i, td.pc(), T); sumYiSqrtW += Ys[i]*sqrtW; sumYiCbrtW += Ys[i]*cbrtW; @@ -494,7 +495,7 @@ void Foam::ReactingParcel::calc { scalar dmi = dm*Y_[i]; label gid = composition.localToCarrierId(0, i); - scalar hs = composition.carrier().Hs(gid, td.pc(), T0); + scalar hs = composition.carrier().hsi(gid, td.pc(), T0); cloud.rhoTrans(gid)[this->cell()] += dmi; cloud.hsTransRef()[this->cell()] += dmi*hs; @@ -555,7 +556,7 @@ void Foam::ReactingParcel::calc { scalar dm = np0*dMass[i]; label gid = composition.localToCarrierId(0, i); - scalar hs = composition.carrier().Hs(gid, td.pc(), T0); + scalar hs = composition.carrier().hsi(gid, td.pc(), T0); cloud.rhoTrans(gid)[this->cell()] += dm; cloud.UTransRef()[this->cell()] += dm*U0; diff --git a/src/lagrangian/parcel/submodels/Reacting/CompositionModel/CompositionModel/CompositionModel.C b/src/lagrangian/parcel/submodels/Reacting/CompositionModel/CompositionModel/CompositionModel.C index 608724c686..86fd65658e 100644 --- a/src/lagrangian/parcel/submodels/Reacting/CompositionModel/CompositionModel/CompositionModel.C +++ b/src/lagrangian/parcel/submodels/Reacting/CompositionModel/CompositionModel/CompositionModel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -24,6 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "CompositionModel.H" +#include "fluidMulticomponentThermo.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -32,10 +33,10 @@ Foam::CompositionModel::CompositionModel(CloudType& owner) : CloudSubModelBase(owner), carrierThermo_(owner.carrierThermo()), - carrierMixture_ + carrierMcThermoPtr_ ( - isA(carrierThermo_) - ? &refCast(carrierThermo_) + isA(carrierThermo_) + ? &refCast(carrierThermo_) : nullptr ), thermo_(owner.thermo()), @@ -53,19 +54,19 @@ Foam::CompositionModel::CompositionModel : CloudSubModelBase(owner, dict, typeName, type), carrierThermo_(owner.carrierThermo()), - carrierMixture_ + carrierMcThermoPtr_ ( - isA(carrierThermo_) - ? &refCast(carrierThermo_) + isA(carrierThermo_) + ? &refCast(carrierThermo_) : nullptr ), thermo_(owner.thermo()), phaseProps_ ( this->coeffDict().lookup("phases"), - carrierMixture_ == nullptr + carrierMcThermoPtr_ == nullptr ? hashedWordList::null() - : carrierMixture_->species(), + : carrierMcThermoPtr_->species(), thermo_.liquids().components(), thermo_.solids().components() ) @@ -80,7 +81,7 @@ Foam::CompositionModel::CompositionModel : CloudSubModelBase(cm), carrierThermo_(cm.carrierThermo_), - carrierMixture_(cm.carrierMixture_), + carrierMcThermoPtr_(cm.carrierMcThermoPtr_), thermo_(cm.thermo_), phaseProps_(cm.phaseProps_) {} @@ -103,17 +104,17 @@ const Foam::parcelThermo& Foam::CompositionModel::thermo() const template -const Foam::basicSpecieMixture& +const Foam::fluidMulticomponentThermo& Foam::CompositionModel::carrier() const { - if (carrierMixture_ == nullptr) + if (carrierMcThermoPtr_ == nullptr) { FatalErrorInFunction << "carrier requested, but object is not allocated" << abort(FatalError); } - return *carrierMixture_; + return *carrierMcThermoPtr_; } @@ -187,9 +188,9 @@ Foam::label Foam::CompositionModel::carrierId { label id = -1; - forAll(carrierMixture_->species(), i) + forAll(carrierMcThermoPtr_->species(), i) { - if (cmptName == carrierMixture_->species()[i]) + if (cmptName == carrierMcThermoPtr_->species()[i]) { id = i; } @@ -200,7 +201,7 @@ Foam::label Foam::CompositionModel::carrierId FatalErrorInFunction << "Unable to determine global id for requested component " << cmptName << ". Available components are " << nl - << carrierMixture_->species() + << carrierMcThermoPtr_->species() << abort(FatalError); } @@ -278,7 +279,7 @@ Foam::scalarField Foam::CompositionModel::X forAll(Y, i) { label cid = props.carrierId(i); - X[i] = Y[i]/carrierMixture_->Wi(cid); + X[i] = Y[i]/carrierMcThermoPtr_->Wi(cid); WInv += X[i]; } break; @@ -324,7 +325,7 @@ Foam::scalar Foam::CompositionModel::H forAll(Y, i) { label cid = props.carrierId(i); - HMixture += Y[i]*carrierMixture_->Ha(cid, p, T); + HMixture += Y[i]*carrierMcThermoPtr_->hai(cid, p, T); } break; } @@ -373,7 +374,7 @@ Foam::scalar Foam::CompositionModel::Hs forAll(Y, i) { label cid = props.carrierId(i); - HsMixture += Y[i]*carrierMixture_->Hs(cid, p, T); + HsMixture += Y[i]*carrierMcThermoPtr_->hsi(cid, p, T); } break; } @@ -424,7 +425,7 @@ Foam::scalar Foam::CompositionModel::Hc forAll(Y, i) { label cid = props.carrierId(i); - HcMixture += Y[i]*carrierMixture_->Hf(cid); + HcMixture += Y[i]*carrierMcThermoPtr_->hfi(cid); } break; } @@ -474,7 +475,7 @@ Foam::scalar Foam::CompositionModel::Cp forAll(Y, i) { label cid = props.carrierId(i); - CpMixture += Y[i]*carrierMixture_->Cp(cid, p, T); + CpMixture += Y[i]*carrierMcThermoPtr_->Cpi(cid, p, T); } break; } diff --git a/src/lagrangian/parcel/submodels/Reacting/CompositionModel/CompositionModel/CompositionModel.H b/src/lagrangian/parcel/submodels/Reacting/CompositionModel/CompositionModel/CompositionModel.H index 4f5cb79d18..20babc9085 100644 --- a/src/lagrangian/parcel/submodels/Reacting/CompositionModel/CompositionModel/CompositionModel.H +++ b/src/lagrangian/parcel/submodels/Reacting/CompositionModel/CompositionModel/CompositionModel.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -40,7 +40,7 @@ SourceFiles #include "CloudSubModelBase.H" #include "parcelThermo.H" -#include "basicSpecieMixture.H" +#include "fluidMulticomponentThermo.H" #include "phasePropertiesList.H" #include "runTimeSelectionTables.H" @@ -60,11 +60,11 @@ class CompositionModel { // Private Data - //- Reference to thermophysical properties of the carrier fluid + //- Reference to thermo properties of the carrier fluid const fluidThermo& carrierThermo_; - //- Pointer to the multi-component carrier composition - const basicSpecieMixture* carrierMixture_; + //- Reference to multicomponent thermo properties of the carrier fluid + const fluidMulticomponentThermo* carrierMcThermoPtr_; //- Reference to the thermo database const parcelThermo& thermo_; @@ -135,7 +135,7 @@ public: // Composition lists //- Return the carrier components (wrapper function) - const basicSpecieMixture& carrier() const; + const fluidMulticomponentThermo& carrier() const; //- Return the global (additional) liquids const liquidMixtureProperties& liquids() const; diff --git a/src/lagrangian/parcel/submodels/Reacting/PhaseChangeModel/LiquidEvaporation/LiquidEvaporation.C b/src/lagrangian/parcel/submodels/Reacting/PhaseChangeModel/LiquidEvaporation/LiquidEvaporation.C index 8858b2ebfe..fbf49e6cff 100644 --- a/src/lagrangian/parcel/submodels/Reacting/PhaseChangeModel/LiquidEvaporation/LiquidEvaporation.C +++ b/src/lagrangian/parcel/submodels/Reacting/PhaseChangeModel/LiquidEvaporation/LiquidEvaporation.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -243,7 +243,7 @@ Foam::scalar Foam::LiquidEvaporation::dh } case (parent::etEnthalpyDifference): { - scalar hc = this->owner().composition().carrier().Ha(idc, p, T); + scalar hc = this->owner().composition().carrier().hai(idc, p, T); scalar hp = liquids_.properties()[idl].Ha(p, T); dh = hc - hp; diff --git a/src/lagrangian/parcel/submodels/Reacting/PhaseChangeModel/LiquidEvaporationBoil/LiquidEvaporationBoil.C b/src/lagrangian/parcel/submodels/Reacting/PhaseChangeModel/LiquidEvaporationBoil/LiquidEvaporationBoil.C index f1eac8efb2..fa7fe75397 100644 --- a/src/lagrangian/parcel/submodels/Reacting/PhaseChangeModel/LiquidEvaporationBoil/LiquidEvaporationBoil.C +++ b/src/lagrangian/parcel/submodels/Reacting/PhaseChangeModel/LiquidEvaporationBoil/LiquidEvaporationBoil.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -182,10 +182,10 @@ void Foam::LiquidEvaporationBoil::calculate forAll(this->owner().composition().carrier().Y(), i) { scalar Yc = this->owner().composition().carrier().Y()[i][p.cell()]; - Hc += Yc*this->owner().composition().carrier().Ha(i, pc, Tc); - Hsc += Yc*this->owner().composition().carrier().Ha(i, ps, Ts); - Cpc += Yc*this->owner().composition().carrier().Cp(i, ps, Ts); - kappac += Yc*this->owner().composition().carrier().kappa(i, ps, Ts); + Hc += Yc*this->owner().composition().carrier().hai(i, pc, Tc); + Hsc += Yc*this->owner().composition().carrier().hai(i, ps, Ts); + Cpc += Yc*this->owner().composition().carrier().Cpi(i, ps, Ts); + kappac += Yc*this->owner().composition().carrier().kappai(i, ps, Ts); } // calculate mass transfer of each specie in liquid @@ -326,7 +326,8 @@ Foam::scalar Foam::LiquidEvaporationBoil::dh } case (parent::etEnthalpyDifference): { - scalar hc = this->owner().composition().carrier().Ha(idc, p, TDash); + scalar hc = + this->owner().composition().carrier().hai(idc, p, TDash); scalar hp = liquids_.properties()[idl].Ha(p, TDash); dh = hc - hp; diff --git a/src/lagrangian/parcel/submodels/ReactingMultiphase/SurfaceReactionModel/COxidationDiffusionLimitedRate/COxidationDiffusionLimitedRate.C b/src/lagrangian/parcel/submodels/ReactingMultiphase/SurfaceReactionModel/COxidationDiffusionLimitedRate/COxidationDiffusionLimitedRate.C index d9e2ff8ec6..74591d242e 100644 --- a/src/lagrangian/parcel/submodels/ReactingMultiphase/SurfaceReactionModel/COxidationDiffusionLimitedRate/COxidationDiffusionLimitedRate.C +++ b/src/lagrangian/parcel/submodels/ReactingMultiphase/SurfaceReactionModel/COxidationDiffusionLimitedRate/COxidationDiffusionLimitedRate.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -56,7 +56,7 @@ Foam::COxidationDiffusionLimitedRate::COxidationDiffusionLimitedRate const scalar WCO2 = owner.composition().carrier().Wi(CO2GlobalId_); WC_ = WCO2 - WO2_; - HcCO2_ = owner.composition().carrier().Hf(CO2GlobalId_); + HcCO2_ = owner.composition().carrier().hfi(CO2GlobalId_); if (Sb_ < 0) { @@ -132,10 +132,11 @@ Foam::scalar Foam::COxidationDiffusionLimitedRate::calculate } const parcelThermo& thermo = this->owner().thermo(); - const basicSpecieMixture& carrier = this->owner().composition().carrier(); + const fluidMulticomponentThermo& carrierThermo = + this->owner().composition().carrier(); // Local mass fraction of O2 in the carrier phase - const scalar YO2 = carrier.Y(O2GlobalId_)[celli]; + const scalar YO2 = carrierThermo.Y(O2GlobalId_)[celli]; // Change in C mass [kg] scalar dmC = 4.0*mathematical::pi*d*D_*YO2*Tc*rhoc/(Sb_*(T + Tc))*dt; diff --git a/src/lagrangian/parcel/submodels/ReactingMultiphase/SurfaceReactionModel/COxidationHurtMitchell/COxidationHurtMitchell.C b/src/lagrangian/parcel/submodels/ReactingMultiphase/SurfaceReactionModel/COxidationHurtMitchell/COxidationHurtMitchell.C index 3ab28866e7..2e16997cb9 100644 --- a/src/lagrangian/parcel/submodels/ReactingMultiphase/SurfaceReactionModel/COxidationHurtMitchell/COxidationHurtMitchell.C +++ b/src/lagrangian/parcel/submodels/ReactingMultiphase/SurfaceReactionModel/COxidationHurtMitchell/COxidationHurtMitchell.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2012-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -56,7 +56,7 @@ Foam::COxidationHurtMitchell::COxidationHurtMitchell const scalar WCO2 = owner.composition().carrier().Wi(CO2GlobalId_); WC_ = WCO2 - WO2_; - HcCO2_ = owner.composition().carrier().Hf(CO2GlobalId_); + HcCO2_ = owner.composition().carrier().hfi(CO2GlobalId_); const scalar YCloc = owner.composition().Y0(idSolid)[CsLocalId_]; const scalar YSolidTot = owner.composition().YMixture0()[idSolid]; @@ -131,10 +131,11 @@ Foam::scalar Foam::COxidationHurtMitchell::calculate } const parcelThermo& thermo = this->owner().thermo(); - const basicSpecieMixture& carrier = this->owner().composition().carrier(); + const fluidMulticomponentThermo& carrierThermo = + this->owner().composition().carrier(); // Local mass fraction of O2 in the carrier phase - const scalar YO2 = carrier.Y(O2GlobalId_)[celli]; + const scalar YO2 = carrierThermo.Y(O2GlobalId_)[celli]; // No combustion if no oxygen present if (YO2 < small) diff --git a/src/lagrangian/parcel/submodels/ReactingMultiphase/SurfaceReactionModel/COxidationIntrinsicRate/COxidationIntrinsicRate.C b/src/lagrangian/parcel/submodels/ReactingMultiphase/SurfaceReactionModel/COxidationIntrinsicRate/COxidationIntrinsicRate.C index 6018ce254b..a03a944e2e 100644 --- a/src/lagrangian/parcel/submodels/ReactingMultiphase/SurfaceReactionModel/COxidationIntrinsicRate/COxidationIntrinsicRate.C +++ b/src/lagrangian/parcel/submodels/ReactingMultiphase/SurfaceReactionModel/COxidationIntrinsicRate/COxidationIntrinsicRate.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2014-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2014-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -62,7 +62,7 @@ Foam::COxidationIntrinsicRate::COxidationIntrinsicRate const scalar WCO2 = owner.composition().carrier().Wi(CO2GlobalId_); WC_ = WCO2 - WO2_; - HcCO2_ = owner.composition().carrier().Hf(CO2GlobalId_); + HcCO2_ = owner.composition().carrier().hfi(CO2GlobalId_); if (Sb_ < 0) { @@ -144,10 +144,11 @@ Foam::scalar Foam::COxidationIntrinsicRate::calculate } const parcelThermo& thermo = this->owner().thermo(); - const basicSpecieMixture& carrier = this->owner().composition().carrier(); + const fluidMulticomponentThermo& carrierThermo = + this->owner().composition().carrier(); // Local mass fraction of O2 in the carrier phase [] - const scalar YO2 = carrier.Y(O2GlobalId_)[celli]; + const scalar YO2 = carrierThermo.Y(O2GlobalId_)[celli]; // Quick exit if oxidant not present if (YO2 < rootVSmall) diff --git a/src/lagrangian/parcel/submodels/ReactingMultiphase/SurfaceReactionModel/COxidationKineticDiffusionLimitedRate/COxidationKineticDiffusionLimitedRate.C b/src/lagrangian/parcel/submodels/ReactingMultiphase/SurfaceReactionModel/COxidationKineticDiffusionLimitedRate/COxidationKineticDiffusionLimitedRate.C index d3584bbd9b..a3029068b6 100644 --- a/src/lagrangian/parcel/submodels/ReactingMultiphase/SurfaceReactionModel/COxidationKineticDiffusionLimitedRate/COxidationKineticDiffusionLimitedRate.C +++ b/src/lagrangian/parcel/submodels/ReactingMultiphase/SurfaceReactionModel/COxidationKineticDiffusionLimitedRate/COxidationKineticDiffusionLimitedRate.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -57,7 +57,7 @@ COxidationKineticDiffusionLimitedRate const scalar WCO2 = owner.composition().carrier().Wi(CO2GlobalId_); WC_ = WCO2 - WO2_; - HcCO2_ = owner.composition().carrier().Hf(CO2GlobalId_); + HcCO2_ = owner.composition().carrier().hfi(CO2GlobalId_); const scalar YCloc = owner.composition().Y0(idSolid)[CsLocalId_]; const scalar YSolidTot = owner.composition().YMixture0()[idSolid]; @@ -129,10 +129,11 @@ Foam::scalar Foam::COxidationKineticDiffusionLimitedRate::calculate } const parcelThermo& thermo = this->owner().thermo(); - const basicSpecieMixture& carrier = this->owner().composition().carrier(); + const fluidMulticomponentThermo& carrierThermo = + this->owner().composition().carrier(); // Local mass fraction of O2 in the carrier phase - const scalar YO2 = carrier.Y(O2GlobalId_)[celli]; + const scalar YO2 = carrierThermo.Y(O2GlobalId_)[celli]; // Diffusion rate coefficient const scalar D0 = C1_/d*pow(0.5*(T + Tc), 0.75); diff --git a/src/lagrangian/parcel/submodels/ReactingMultiphase/SurfaceReactionModel/COxidationMurphyShaddix/COxidationMurphyShaddix.C b/src/lagrangian/parcel/submodels/ReactingMultiphase/SurfaceReactionModel/COxidationMurphyShaddix/COxidationMurphyShaddix.C index c27ff1a83c..dbcbdde5fd 100644 --- a/src/lagrangian/parcel/submodels/ReactingMultiphase/SurfaceReactionModel/COxidationMurphyShaddix/COxidationMurphyShaddix.C +++ b/src/lagrangian/parcel/submodels/ReactingMultiphase/SurfaceReactionModel/COxidationMurphyShaddix/COxidationMurphyShaddix.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -69,7 +69,7 @@ Foam::COxidationMurphyShaddix::COxidationMurphyShaddix const scalar WCO2 = owner.composition().carrier().Wi(CO2GlobalId_); WC_ = WCO2 - WO2_; - HcCO2_ = owner.composition().carrier().Hf(CO2GlobalId_); + HcCO2_ = owner.composition().carrier().hfi(CO2GlobalId_); const scalar YCloc = owner.composition().Y0(idSolid)[CsLocalId_]; const scalar YSolidTot = owner.composition().YMixture0()[idSolid]; @@ -143,10 +143,11 @@ Foam::scalar Foam::COxidationMurphyShaddix::calculate } const parcelThermo& thermo = this->owner().thermo(); - const basicSpecieMixture& carrier = this->owner().composition().carrier(); + const fluidMulticomponentThermo& carrierThermo = + this->owner().composition().carrier(); // Cell carrier phase O2 species density [kg/m^3] - const scalar rhoO2 = rhoc*carrier.Y(O2GlobalId_)[celli]; + const scalar rhoO2 = rhoc*carrierThermo.Y(O2GlobalId_)[celli]; if (rhoO2 < small) { diff --git a/src/radiationModels/absorptionEmissionModels/greyMean/greyMean.C b/src/radiationModels/absorptionEmissionModels/greyMean/greyMean.C index b451226393..11a65e286b 100644 --- a/src/radiationModels/absorptionEmissionModels/greyMean/greyMean.C +++ b/src/radiationModels/absorptionEmissionModels/greyMean/greyMean.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -27,7 +27,7 @@ License #include "addToRunTimeSelectionTable.H" #include "unitConversion.H" #include "extrapolatedCalculatedFvPatchFields.H" -#include "basicSpecieMixture.H" +#include "fluidMulticomponentThermo.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -67,7 +67,7 @@ Foam::radiationModels::absorptionEmissionModels::greyMean::greyMean thermo_(mesh.lookupObject(physicalProperties::typeName)), Yj_(nSpecies_) { - if (!isA(thermo_)) + if (!isA(thermo_)) { FatalErrorInFunction << "Model requires a multi-component thermo package" @@ -180,8 +180,8 @@ Foam::radiationModels::absorptionEmissionModels::greyMean::aCont const label bandI ) const { - const basicSpecieMixture& mixture = - dynamic_cast(thermo_); + const fluidMulticomponentThermo& mcThermo = + dynamic_cast(thermo_); const volScalarField& T = thermo_.T(); const volScalarField& p = thermo_.p(); @@ -219,13 +219,13 @@ Foam::radiationModels::absorptionEmissionModels::greyMean::aCont else { scalar invWt = 0.0; - forAll(mixture.Y(), s) + forAll(mcThermo.Y(), s) { - invWt += mixture.Y(s)[celli]/mixture.Wi(s); + invWt += mcThermo.Y(s)[celli]/mcThermo.Wi(s); } - label index = mixture.species()[iter.key()]; - scalar Xk = mixture.Y(index)[celli]/(mixture.Wi(index)*invWt); + label index = mcThermo.species()[iter.key()]; + scalar Xk = mcThermo.Y(index)[celli]/(mcThermo.Wi(index)*invWt); Xipi = Xk*paToAtm(p[celli]); } diff --git a/src/radiationModels/absorptionEmissionModels/wideBand/wideBand.C b/src/radiationModels/absorptionEmissionModels/wideBand/wideBand.C index 741ca6a650..0b921fbbaf 100644 --- a/src/radiationModels/absorptionEmissionModels/wideBand/wideBand.C +++ b/src/radiationModels/absorptionEmissionModels/wideBand/wideBand.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,7 +25,7 @@ License #include "wideBand.H" #include "addToRunTimeSelectionTable.H" -#include "basicSpecieMixture.H" +#include "fluidMulticomponentThermo.H" #include "unitConversion.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -67,6 +67,13 @@ Foam::radiationModels::absorptionEmissionModels::wideBand::wideBand Yj_(nSpecies_), totalWaveLength_(0) { + if (!isA(thermo_)) + { + FatalErrorInFunction + << "Model requires a multi-component thermo package" + << abort(FatalError); + } + label nBand = 0; forAllConstIter(dictionary, coeffsDict_, iter) { @@ -195,8 +202,8 @@ Foam::radiationModels::absorptionEmissionModels::wideBand::aCont const label bandi ) const { - const basicSpecieMixture& mixture = - dynamic_cast(thermo_); + const fluidMulticomponentThermo& mcThermo = + dynamic_cast(thermo_); const volScalarField& T = thermo_.T(); const volScalarField& p = thermo_.p(); @@ -232,15 +239,15 @@ Foam::radiationModels::absorptionEmissionModels::wideBand::aCont else { scalar invWt = 0; - forAll(mixture.Y(), s) + forAll(mcThermo.Y(), s) { - invWt += mixture.Y(s)[celli]/mixture.Wi(s); + invWt += mcThermo.Y(s)[celli]/mcThermo.Wi(s); } - const label index = mixture.species()[iter.key()]; + const label index = mcThermo.species()[iter.key()]; const scalar Xk = - mixture.Y(index)[celli]/(mixture.Wi(index)*invWt); + mcThermo.Y(index)[celli]/(mcThermo.Wi(index)*invWt); Xipi = Xk*paToAtm(p[celli]); } diff --git a/src/specieTransfer/derivedFvPatchFields/adsorptionMassFraction/adsorptionMassFractionFvPatchScalarField.C b/src/specieTransfer/derivedFvPatchFields/adsorptionMassFraction/adsorptionMassFractionFvPatchScalarField.C index 8485ad4c8d..e3f9037a59 100644 --- a/src/specieTransfer/derivedFvPatchFields/adsorptionMassFraction/adsorptionMassFractionFvPatchScalarField.C +++ b/src/specieTransfer/derivedFvPatchFields/adsorptionMassFraction/adsorptionMassFractionFvPatchScalarField.C @@ -27,7 +27,7 @@ License #include "volFields.H" #include "surfaceFields.H" #include "fluidThermophysicalTransportModel.H" -#include "basicSpecieMixture.H" +#include "fluidMulticomponentThermo.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -100,8 +100,8 @@ Foam::adsorptionMassFractionFvPatchScalarField::calcPhiYp() const scalar Wi = NaN; if (property_ != massFraction) { - const basicSpecieMixture& mixture = composition(db()); - Wi = mixture.Wi(mixture.species()[YName]); + const fluidMulticomponentThermo& thermo = this->thermo(db()); + Wi = thermo.Wi(thermo.species()[YName]); } // Get the mixture molecular weights, if needed diff --git a/src/specieTransfer/derivedFvPatchFields/adsorptionMassFraction/adsorptionMassFractionFvPatchScalarField.H b/src/specieTransfer/derivedFvPatchFields/adsorptionMassFraction/adsorptionMassFractionFvPatchScalarField.H index ba71767c07..be0736df99 100644 --- a/src/specieTransfer/derivedFvPatchFields/adsorptionMassFraction/adsorptionMassFractionFvPatchScalarField.H +++ b/src/specieTransfer/derivedFvPatchFields/adsorptionMassFraction/adsorptionMassFractionFvPatchScalarField.H @@ -91,8 +91,6 @@ SourceFiles namespace Foam { -class basicSpecieMixture; - /*---------------------------------------------------------------------------*\ Class adsorptionMassFractionFvPatchScalarField Declaration \*---------------------------------------------------------------------------*/ diff --git a/src/specieTransfer/derivedFvPatchFields/semiPermeableBaffleMassFraction/semiPermeableBaffleMassFractionFvPatchScalarField.C b/src/specieTransfer/derivedFvPatchFields/semiPermeableBaffleMassFraction/semiPermeableBaffleMassFractionFvPatchScalarField.C index a409844d0c..01c052e2d5 100644 --- a/src/specieTransfer/derivedFvPatchFields/semiPermeableBaffleMassFraction/semiPermeableBaffleMassFractionFvPatchScalarField.C +++ b/src/specieTransfer/derivedFvPatchFields/semiPermeableBaffleMassFraction/semiPermeableBaffleMassFractionFvPatchScalarField.C @@ -28,7 +28,7 @@ License #include "volFields.H" #include "surfaceFields.H" #include "fluidThermophysicalTransportModel.H" -#include "basicSpecieMixture.H" +#include "fluidMulticomponentThermo.H" #include "mappedPatchBase.H" #include "addToRunTimeSelectionTable.H" @@ -134,8 +134,8 @@ Foam::semiPermeableBaffleMassFractionFvPatchScalarField::calcPhiYp() const scalar Wi = NaN; if (property_ != massFraction) { - const basicSpecieMixture& mixture = composition(db()); - Wi = mixture.Wi(mixture.species()[YName]); + const fluidMulticomponentThermo& thermo = this->thermo(db()); + Wi = thermo.Wi(thermo.species()[YName]); } // Get the mixture molecular weights, if needed diff --git a/src/specieTransfer/derivedFvPatchFields/semiPermeableBaffleMassFraction/semiPermeableBaffleMassFractionFvPatchScalarField.H b/src/specieTransfer/derivedFvPatchFields/semiPermeableBaffleMassFraction/semiPermeableBaffleMassFractionFvPatchScalarField.H index d1a8f6ef7c..56f5288e98 100644 --- a/src/specieTransfer/derivedFvPatchFields/semiPermeableBaffleMassFraction/semiPermeableBaffleMassFractionFvPatchScalarField.H +++ b/src/specieTransfer/derivedFvPatchFields/semiPermeableBaffleMassFraction/semiPermeableBaffleMassFractionFvPatchScalarField.H @@ -92,8 +92,6 @@ SourceFiles namespace Foam { -class basicSpecieMixture; - /*---------------------------------------------------------------------------*\ Class semiPermeableBaffleMassFractionFvPatchScalarField Declaration \*---------------------------------------------------------------------------*/ diff --git a/src/specieTransfer/derivedFvPatchFields/specieTransferMassFraction/specieTransferMassFractionFvPatchScalarField.C b/src/specieTransfer/derivedFvPatchFields/specieTransferMassFraction/specieTransferMassFractionFvPatchScalarField.C index a838701e2d..9eec0802c0 100644 --- a/src/specieTransfer/derivedFvPatchFields/specieTransferMassFraction/specieTransferMassFractionFvPatchScalarField.C +++ b/src/specieTransfer/derivedFvPatchFields/specieTransferMassFraction/specieTransferMassFractionFvPatchScalarField.C @@ -57,15 +57,17 @@ const Foam::NamedEnum // * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // -const Foam::basicSpecieMixture& -Foam::specieTransferMassFractionFvPatchScalarField::composition +const Foam::fluidMulticomponentThermo& +Foam::specieTransferMassFractionFvPatchScalarField::thermo ( const objectRegistry& db ) { - const word& name = physicalProperties::typeName; - - return db.lookupObject(name).composition(); + return + db.lookupObject + ( + physicalProperties::typeName + ); } diff --git a/src/specieTransfer/derivedFvPatchFields/specieTransferMassFraction/specieTransferMassFractionFvPatchScalarField.H b/src/specieTransfer/derivedFvPatchFields/specieTransferMassFraction/specieTransferMassFractionFvPatchScalarField.H index a144602adf..c4056196f6 100644 --- a/src/specieTransfer/derivedFvPatchFields/specieTransferMassFraction/specieTransferMassFractionFvPatchScalarField.H +++ b/src/specieTransfer/derivedFvPatchFields/specieTransferMassFraction/specieTransferMassFractionFvPatchScalarField.H @@ -50,7 +50,7 @@ SourceFiles namespace Foam { -class basicSpecieMixture; +class fluidMulticomponentThermo; /*---------------------------------------------------------------------------*\ Class specieTransferMassFractionFvPatchScalarField Declaration @@ -107,8 +107,11 @@ public: // Static member functions - //- Access the composition for the given database - static const basicSpecieMixture& composition(const objectRegistry& db); + //- Get the thermo from the given database + static const fluidMulticomponentThermo& thermo + ( + const objectRegistry& db + ); // Constructors diff --git a/src/specieTransfer/derivedFvPatchFields/specieTransferTemperature/specieTransferTemperatureFvPatchScalarField.C b/src/specieTransfer/derivedFvPatchFields/specieTransferTemperature/specieTransferTemperatureFvPatchScalarField.C index 8a08228996..55f5abee4e 100644 --- a/src/specieTransfer/derivedFvPatchFields/specieTransferTemperature/specieTransferTemperatureFvPatchScalarField.C +++ b/src/specieTransfer/derivedFvPatchFields/specieTransferTemperature/specieTransferTemperatureFvPatchScalarField.C @@ -29,7 +29,7 @@ License #include "volFields.H" #include "surfaceFields.H" #include "fluidThermophysicalTransportModel.H" -#include "basicSpecieMixture.H" +#include "fluidMulticomponentThermo.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -88,12 +88,9 @@ const Foam::tmp Foam::specieTransferTemperatureFvPatchScalarField::phiHep() const { typedef specieTransferMassFractionFvPatchScalarField YBCType; - const basicSpecieMixture& mixture = YBCType::composition(db()); - const PtrList& Y = mixture.Y(); + const fluidMulticomponentThermo& thermo = YBCType::thermo(db()); + const PtrList& Y = thermo.Y(); - // Get thermodynamic properties - const fluidThermo& thermo = - db().lookupObject(physicalProperties::typeName); const fvPatchScalarField& Tp = *this; const fvPatchScalarField& pp = thermo.p().boundaryField()[patch().index()]; @@ -112,7 +109,7 @@ Foam::specieTransferTemperatureFvPatchScalarField::phiHep() const << exit(FatalError); } - phiHep += refCast(Yp).phiYp()*mixture.HE(i, pp, Tp); + phiHep += refCast(Yp).phiYp()*thermo.hei(i, pp, Tp); } return tPhiHep; diff --git a/src/specieTransfer/derivedFvPatchFields/specieTransferVelocity/specieTransferVelocityFvPatchVectorField.C b/src/specieTransfer/derivedFvPatchFields/specieTransferVelocity/specieTransferVelocityFvPatchVectorField.C index e1bd155294..1de09613c7 100644 --- a/src/specieTransfer/derivedFvPatchFields/specieTransferVelocity/specieTransferVelocityFvPatchVectorField.C +++ b/src/specieTransfer/derivedFvPatchFields/specieTransferVelocity/specieTransferVelocityFvPatchVectorField.C @@ -28,7 +28,7 @@ License #include "addToRunTimeSelectionTable.H" #include "volFields.H" #include "surfaceFields.H" -#include "basicSpecieMixture.H" +#include "fluidMulticomponentThermo.H" #include "basicThermo.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -78,7 +78,7 @@ const Foam::tmp Foam::specieTransferVelocityFvPatchVectorField::phip() const { typedef specieTransferMassFractionFvPatchScalarField YBCType; - const PtrList& Y = YBCType::composition(db()).Y(); + const PtrList& Y = YBCType::thermo(db()).Y(); // Sum up the phiYp-s from all the species tmp tPhip(new scalarField(this->size(), 0)); diff --git a/src/thermophysicalModels/basic/Make/files b/src/thermophysicalModels/basic/Make/files index 22ccaef76c..22684aaddc 100644 --- a/src/thermophysicalModels/basic/Make/files +++ b/src/thermophysicalModels/basic/Make/files @@ -1,5 +1,7 @@ basicThermo/basicThermo.C +pureThermo/pureThermo.C + fluidThermo/fluidThermo.C fluidThermo/hydrostaticInitialisation.C @@ -8,7 +10,9 @@ psiThermo/psiThermos.C rhoThermo/rhoThermo.C rhoThermo/rhoThermos.C -rhoThermo/liquidThermo.C + +liquidThermo/liquidThermo.C +liquidThermo/liquidThermos.C derivedFvPatchFields/energyJump/energyJumpFvPatchScalarField.C derivedFvPatchFields/fixedEnergy/fixedEnergyFvPatchScalarField.C @@ -17,4 +21,6 @@ derivedFvPatchFields/gradientEnergy/gradientEnergyCalculatedTemperatureFvPatchSc derivedFvPatchFields/mixedEnergy/mixedEnergyFvPatchScalarField.C derivedFvPatchFields/mixedEnergy/mixedEnergyCalculatedTemperatureFvPatchScalarField.C +heThermo/heThermoName.C + LIB = $(FOAM_LIBBIN)/libfluidThermophysicalModels diff --git a/src/thermophysicalModels/basic/PhysicalPropertiesThermo.C b/src/thermophysicalModels/basic/PhysicalPropertiesThermo.C new file mode 100644 index 0000000000..b0a9ffba7f --- /dev/null +++ b/src/thermophysicalModels/basic/PhysicalPropertiesThermo.C @@ -0,0 +1,82 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2023 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 "PhysicalPropertiesThermo.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::PhysicalPropertiesThermo::PhysicalPropertiesThermo +( + const fvMesh& mesh, + const word& phaseName +) +: + physicalProperties(mesh, phaseName), + BasicThermoType(*this, mesh, phaseName) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template +Foam::PhysicalPropertiesThermo::~PhysicalPropertiesThermo() +{} + + +// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // + +template +const Foam::IOdictionary& +Foam::PhysicalPropertiesThermo::properties() const +{ + return *this; +} + + +template +Foam::IOdictionary& +Foam::PhysicalPropertiesThermo::properties() +{ + return *this; +} + + +template +bool Foam::PhysicalPropertiesThermo::read() +{ + if (physicalProperties::read()) + { + BasicThermoType::read(*this); + return true; + } + else + { + return false; + } +} + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/basic/PhysicalPropertiesThermo.H b/src/thermophysicalModels/basic/PhysicalPropertiesThermo.H new file mode 100644 index 0000000000..45a59f733f --- /dev/null +++ b/src/thermophysicalModels/basic/PhysicalPropertiesThermo.H @@ -0,0 +1,96 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2023 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 . + +Class + Foam::PhysicalPropertiesThermo + +Description + Wrapper around a thermo which also constructs the physical properties + dictionary + +\*---------------------------------------------------------------------------*/ + +#ifndef PhysicalPropertiesThermo_H +#define PhysicalPropertiesThermo_H + +#include "physicalProperties.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class PhysicalPropertiesThermo Declaration +\*---------------------------------------------------------------------------*/ + +template +class PhysicalPropertiesThermo +: + public physicalProperties, + public BasicThermoType +{ +public: + + // Constructors + + //- Construct from mesh and phase name + PhysicalPropertiesThermo + ( + const fvMesh& mesh, + const word& phaseName = word::null + ); + + + //- Destructor + virtual ~PhysicalPropertiesThermo(); + + + // Member Functions + + //- Access the properties dictionary + virtual const IOdictionary& properties() const; + + //- Non-const access the properties dictionary + virtual IOdictionary& properties(); + + //- Read the properties dictionary + virtual bool read(); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository + #include "PhysicalPropertiesThermo.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/basic/basicThermo/basicThermo.C b/src/thermophysicalModels/basic/basicThermo/basicThermo.C index 8a86343ec6..039bdc0352 100644 --- a/src/thermophysicalModels/basic/basicThermo/basicThermo.C +++ b/src/thermophysicalModels/basic/basicThermo/basicThermo.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -262,12 +262,11 @@ Foam::wordList Foam::basicThermo::heBoundaryTypes() Foam::basicThermo::implementation::implementation ( + const dictionary& dict, const fvMesh& mesh, const word& phaseName ) : - physicalProperties(mesh, phaseName), - mesh_(mesh), phaseName_(phaseName), @@ -299,7 +298,7 @@ Foam::basicThermo::implementation::implementation dimensionedScalar(dimEnergy/dimTime/dimLength/dimTemperature, Zero) ), - dpdt_(lookupOrDefault("dpdt", true)) + dpdt_(dict.lookupOrDefault("dpdt", true)) {} @@ -384,10 +383,8 @@ const Foam::volScalarField& Foam::basicThermo::implementation::kappa() const } -bool Foam::basicThermo::implementation::read() -{ - return regIOobject::read(); -} +void Foam::basicThermo::implementation::read(const dictionary&) +{} // ************************************************************************* // diff --git a/src/thermophysicalModels/basic/basicThermo/basicThermo.H b/src/thermophysicalModels/basic/basicThermo/basicThermo.H index 34ae81a08c..aa8f936486 100644 --- a/src/thermophysicalModels/basic/basicThermo/basicThermo.H +++ b/src/thermophysicalModels/basic/basicThermo/basicThermo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -415,8 +415,7 @@ public: class basicThermo::implementation : - virtual public basicThermo, - public physicalProperties + virtual public basicThermo { // Private Member Data @@ -447,16 +446,10 @@ protected: public: - // Static Member data - - //- Name of the thermophysical properties dictionary - using physicalProperties::typeName; - - // Constructors - //- Construct from mesh and phase name - implementation(const fvMesh&, const word& phaseName); + //- Construct from dictionary, mesh and phase name + implementation(const dictionary&, const fvMesh&, const word&); //- Disallow default bitwise copy construction implementation(const implementation&) = delete; @@ -469,18 +462,6 @@ public: // Member Functions - //- Properties dictionary - virtual const IOdictionary& properties() const - { - return *this; - } - - //- Non-const access the properties dictionary - virtual IOdictionary& properties() - { - return *this; - } - //- Return const access to the mesh virtual const fvMesh& mesh() const { @@ -517,7 +498,7 @@ public: //- Read thermophysical properties dictionary - virtual bool read(); + virtual void read(const dictionary&); // Member Operators @@ -526,6 +507,7 @@ public: void operator=(const implementation&) = delete; }; + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/thermophysicalModels/basic/basicThermo/basicThermoTemplates.C b/src/thermophysicalModels/basic/basicThermo/basicThermoTemplates.C index bc8391650b..fa763b250c 100644 --- a/src/thermophysicalModels/basic/basicThermo/basicThermoTemplates.C +++ b/src/thermophysicalModels/basic/basicThermo/basicThermoTemplates.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2012-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -55,7 +55,8 @@ typename Table::iterator Foam::basicThermo::lookupCstrIter { if ( - dynamicCode::allowSystemOperations + nCmpt == 7 + && dynamicCode::allowSystemOperations && !dynamicCode::resolveTemplate(Thermo::typeName).empty() ) { diff --git a/src/thermophysicalModels/basic/fluidThermo/fluidThermo.C b/src/thermophysicalModels/basic/fluidThermo/fluidThermo.C index 7b070f3a49..12519801b4 100644 --- a/src/thermophysicalModels/basic/fluidThermo/fluidThermo.C +++ b/src/thermophysicalModels/basic/fluidThermo/fluidThermo.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2012-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -38,6 +38,7 @@ namespace Foam Foam::fluidThermo::implementation::implementation ( + const dictionary& dict, const fvMesh& mesh, const word& phaseName ) diff --git a/src/thermophysicalModels/basic/fluidThermo/fluidThermo.H b/src/thermophysicalModels/basic/fluidThermo/fluidThermo.H index 1a2dca66dd..5b38276f06 100644 --- a/src/thermophysicalModels/basic/fluidThermo/fluidThermo.H +++ b/src/thermophysicalModels/basic/fluidThermo/fluidThermo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2012-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -180,8 +180,8 @@ public: // Constructors - //- Construct from mesh and phase name - implementation(const fvMesh&, const word& phaseName); + //- Construct from dictionary, mesh and phase name + implementation(const dictionary&, const fvMesh&, const word&); //- Disallow default bitwise copy construction implementation(const implementation&) = delete; diff --git a/src/thermophysicalModels/basic/heThermo/heThermo.C b/src/thermophysicalModels/basic/heThermo/heThermo.C index 0352a73d0d..fbfcd9abc4 100644 --- a/src/thermophysicalModels/basic/heThermo/heThermo.C +++ b/src/thermophysicalModels/basic/heThermo/heThermo.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -29,21 +29,14 @@ License // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // -template -template -< - class CellMixture, - class PatchFaceMixture, - class Method, - class ... Args -> +template +template Foam::tmp -Foam::heThermo::volScalarFieldProperty +Foam::heThermo::volScalarFieldProperty ( const word& psiName, const dimensionSet& psiDim, - CellMixture cellMixture, - PatchFaceMixture patchFaceMixture, + Mixture mixture, Method psiMethod, const Args& ... args ) const @@ -60,23 +53,26 @@ Foam::heThermo::volScalarFieldProperty volScalarField& psi = tPsi.ref(); - forAll(this->T_, celli) + forAll(psi, celli) { - psi[celli] = ((this->*cellMixture)(celli).*psiMethod)(args[celli] ...); + auto composition = this->cellComposition(celli); + + psi[celli] = + ((this->*mixture)(composition).*psiMethod)(args[celli] ...); } volScalarField::Boundary& psiBf = psi.boundaryFieldRef(); forAll(psiBf, patchi) { - fvPatchScalarField& pPsi = psiBf[patchi]; - - forAll(this->T_.boundaryField()[patchi], facei) + forAll(psiBf[patchi], patchFacei) { - pPsi[facei] = - ((this->*patchFaceMixture)(patchi, facei).*psiMethod) + auto composition = this->patchFaceComposition(patchi, patchFacei); + + psiBf[patchi][patchFacei] = + ((this->*mixture)(composition).*psiMethod) ( - args.boundaryField()[patchi][facei] ... + args.boundaryField()[patchi][patchFacei] ... ); } } @@ -85,12 +81,12 @@ Foam::heThermo::volScalarFieldProperty } -template -template +template +template Foam::tmp -Foam::heThermo::cellSetProperty +Foam::heThermo::cellSetProperty ( - CellMixture cellMixture, + Mixture mixture, Method psiMethod, const labelList& cells, const Args& ... args @@ -104,20 +100,22 @@ Foam::heThermo::cellSetProperty forAll(cells, celli) { + auto composition = this->cellComposition(cells[celli]); + psi[celli] = - ((this->*cellMixture)(cells[celli]).*psiMethod)(args[celli] ...); + ((this->*mixture)(composition).*psiMethod)(args[celli] ...); } return tPsi; } -template -template +template +template Foam::tmp -Foam::heThermo::patchFieldProperty +Foam::heThermo::patchFieldProperty ( - PatchFaceMixture patchFaceMixture, + Mixture mixture, Method psiMethod, const label patchi, const Args& ... args @@ -129,22 +127,21 @@ Foam::heThermo::patchFieldProperty ); scalarField& psi = tPsi.ref(); - forAll(this->T_.boundaryField()[patchi], facei) + forAll(psi, patchFacei) { - psi[facei] = - ((this->*patchFaceMixture)(patchi, facei).*psiMethod) - ( - args[facei] ... - ); + auto composition = this->patchFaceComposition(patchi, patchFacei); + + psi[patchFacei] = + ((this->*mixture)(composition).*psiMethod)(args[patchFacei] ...); } return tPsi; } -template +template Foam::UIndirectList -Foam::heThermo::cellSetScalarList +Foam::heThermo::cellSetScalarList ( const volScalarField& psi, const labelList& cells @@ -154,9 +151,9 @@ Foam::heThermo::cellSetScalarList } -template +template Foam::UniformField -Foam::heThermo::cellSetScalarList +Foam::heThermo::cellSetScalarList ( const uniformGeometricScalarField& psi, const labelList& @@ -166,8 +163,8 @@ Foam::heThermo::cellSetScalarList } -template -void Foam::heThermo:: +template +void Foam::heThermo:: heBoundaryCorrection(volScalarField& h) { volScalarField::Boundary& hBf = h.boundaryFieldRef(); @@ -190,21 +187,22 @@ heBoundaryCorrection(volScalarField& h) // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -template -Foam::heThermo::heThermo +template +Foam::heThermo::heThermo ( const fvMesh& mesh, const word& phaseName ) : - BasicThermo(mesh, phaseName), - MixtureType(*this, mesh, phaseName), + physicalProperties(mesh, phaseName), + MixtureType(properties()), + BasicThermoType(properties(), mixture(), mesh, phaseName), he_ ( IOobject ( - BasicThermo::phasePropertyName + BasicThermoType::phasePropertyName ( MixtureType::thermoType::heName(), phaseName @@ -218,8 +216,7 @@ Foam::heThermo::heThermo ( "he", dimEnergy/dimMass, - &MixtureType::cellThermoMixture, - &MixtureType::patchFaceThermoMixture, + &MixtureType::thermoMixture, &MixtureType::thermoMixtureType::HE, this->p_, this->T_ @@ -232,7 +229,7 @@ Foam::heThermo::heThermo ( IOobject ( - BasicThermo::phasePropertyName("Cp", phaseName), + BasicThermoType::phasePropertyName("Cp", phaseName), mesh.time().name(), mesh ), @@ -244,7 +241,7 @@ Foam::heThermo::heThermo ( IOobject ( - BasicThermo::phasePropertyName("Cv", phaseName), + BasicThermoType::phasePropertyName("Cv", phaseName), mesh.time().name(), mesh ), @@ -258,16 +255,21 @@ Foam::heThermo::heThermo // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // -template -Foam::heThermo::~heThermo() +template +Foam::heThermo::~heThermo() +{} + + +template +Foam::namedHeThermo::~namedHeThermo() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -template +template const Foam::volScalarField& -Foam::heThermo::Cpv() const +Foam::heThermo::Cpv() const { if (MixtureType::thermoType::enthalpy()) { @@ -280,8 +282,8 @@ Foam::heThermo::Cpv() const } -template -Foam::tmp Foam::heThermo::he +template +Foam::tmp Foam::heThermo::he ( const volScalarField& p, const volScalarField& T @@ -291,8 +293,7 @@ Foam::tmp Foam::heThermo::he ( "he", dimEnergy/dimMass, - &MixtureType::cellThermoMixture, - &MixtureType::patchFaceThermoMixture, + &MixtureType::thermoMixture, &MixtureType::thermoMixtureType::HE, p, T @@ -300,8 +301,8 @@ Foam::tmp Foam::heThermo::he } -template -Foam::tmp Foam::heThermo::he +template +Foam::tmp Foam::heThermo::he ( const scalarField& T, const labelList& cells @@ -309,7 +310,7 @@ Foam::tmp Foam::heThermo::he { return cellSetProperty ( - &MixtureType::cellThermoMixture, + &MixtureType::thermoMixture, &MixtureType::thermoMixtureType::HE, cells, cellSetScalarList(this->p_, cells), @@ -318,8 +319,8 @@ Foam::tmp Foam::heThermo::he } -template -Foam::tmp Foam::heThermo::he +template +Foam::tmp Foam::heThermo::he ( const scalarField& T, const label patchi @@ -327,7 +328,7 @@ Foam::tmp Foam::heThermo::he { return patchFieldProperty ( - &MixtureType::patchFaceThermoMixture, + &MixtureType::thermoMixture, &MixtureType::thermoMixtureType::HE, patchi, this->p_.boundaryField()[patchi], @@ -336,16 +337,15 @@ Foam::tmp Foam::heThermo::he } -template +template Foam::tmp -Foam::heThermo::hs() const +Foam::heThermo::hs() const { return volScalarFieldProperty ( "hs", dimEnergy/dimMass, - &MixtureType::cellThermoMixture, - &MixtureType::patchFaceThermoMixture, + &MixtureType::thermoMixture, &MixtureType::thermoMixtureType::Hs, this->p_, this->T_ @@ -353,8 +353,8 @@ Foam::heThermo::hs() const } -template -Foam::tmp Foam::heThermo::hs +template +Foam::tmp Foam::heThermo::hs ( const volScalarField& p, const volScalarField& T @@ -364,8 +364,7 @@ Foam::tmp Foam::heThermo::hs ( "hs", dimEnergy/dimMass, - &MixtureType::cellThermoMixture, - &MixtureType::patchFaceThermoMixture, + &MixtureType::thermoMixture, &MixtureType::thermoMixtureType::Hs, p, T @@ -373,8 +372,8 @@ Foam::tmp Foam::heThermo::hs } -template -Foam::tmp Foam::heThermo::hs +template +Foam::tmp Foam::heThermo::hs ( const scalarField& T, const labelList& cells @@ -382,7 +381,7 @@ Foam::tmp Foam::heThermo::hs { return cellSetProperty ( - &MixtureType::cellThermoMixture, + &MixtureType::thermoMixture, &MixtureType::thermoMixtureType::Hs, cells, cellSetScalarList(this->p_, cells), @@ -391,8 +390,8 @@ Foam::tmp Foam::heThermo::hs } -template -Foam::tmp Foam::heThermo::hs +template +Foam::tmp Foam::heThermo::hs ( const scalarField& T, const label patchi @@ -400,7 +399,7 @@ Foam::tmp Foam::heThermo::hs { return patchFieldProperty ( - &MixtureType::patchFaceThermoMixture, + &MixtureType::thermoMixture, &MixtureType::thermoMixtureType::Hs, patchi, this->p_.boundaryField()[patchi], @@ -409,16 +408,15 @@ Foam::tmp Foam::heThermo::hs } -template +template Foam::tmp -Foam::heThermo::ha() const +Foam::heThermo::ha() const { return volScalarFieldProperty ( "ha", dimEnergy/dimMass, - &MixtureType::cellThermoMixture, - &MixtureType::patchFaceThermoMixture, + &MixtureType::thermoMixture, &MixtureType::thermoMixtureType::Ha, this->p_, this->T_ @@ -426,8 +424,8 @@ Foam::heThermo::ha() const } -template -Foam::tmp Foam::heThermo::ha +template +Foam::tmp Foam::heThermo::ha ( const volScalarField& p, const volScalarField& T @@ -437,8 +435,7 @@ Foam::tmp Foam::heThermo::ha ( "ha", dimEnergy/dimMass, - &MixtureType::cellThermoMixture, - &MixtureType::patchFaceThermoMixture, + &MixtureType::thermoMixture, &MixtureType::thermoMixtureType::Ha, p, T @@ -446,8 +443,8 @@ Foam::tmp Foam::heThermo::ha } -template -Foam::tmp Foam::heThermo::ha +template +Foam::tmp Foam::heThermo::ha ( const scalarField& T, const labelList& cells @@ -455,7 +452,7 @@ Foam::tmp Foam::heThermo::ha { return cellSetProperty ( - &MixtureType::cellThermoMixture, + &MixtureType::thermoMixture, &MixtureType::thermoMixtureType::Ha, cells, cellSetScalarList(this->p_, cells), @@ -464,8 +461,8 @@ Foam::tmp Foam::heThermo::ha } -template -Foam::tmp Foam::heThermo::ha +template +Foam::tmp Foam::heThermo::ha ( const scalarField& T, const label patchi @@ -473,7 +470,7 @@ Foam::tmp Foam::heThermo::ha { return patchFieldProperty ( - &MixtureType::patchFaceThermoMixture, + &MixtureType::thermoMixture, &MixtureType::thermoMixtureType::Ha, patchi, this->p_.boundaryField()[patchi], @@ -482,23 +479,22 @@ Foam::tmp Foam::heThermo::ha } -template +template Foam::tmp -Foam::heThermo::hc() const +Foam::heThermo::hc() const { return volScalarFieldProperty ( "hc", dimEnergy/dimMass, - &MixtureType::cellThermoMixture, - &MixtureType::patchFaceThermoMixture, + &MixtureType::thermoMixture, &MixtureType::thermoMixtureType::Hf ); } -template -Foam::tmp Foam::heThermo::Cp +template +Foam::tmp Foam::heThermo::Cp ( const scalarField& T, const label patchi @@ -506,7 +502,7 @@ Foam::tmp Foam::heThermo::Cp { return patchFieldProperty ( - &MixtureType::patchFaceThermoMixture, + &MixtureType::thermoMixture, &MixtureType::thermoMixtureType::Cp, patchi, this->p_.boundaryField()[patchi], @@ -515,9 +511,8 @@ Foam::tmp Foam::heThermo::Cp } -template -Foam::tmp -Foam::heThermo::Cv +template +Foam::tmp Foam::heThermo::Cv ( const scalarField& T, const label patchi @@ -525,7 +520,7 @@ Foam::heThermo::Cv { return patchFieldProperty ( - &MixtureType::patchFaceThermoMixture, + &MixtureType::thermoMixture, &MixtureType::thermoMixtureType::Cv, patchi, this->p_.boundaryField()[patchi], @@ -534,8 +529,8 @@ Foam::heThermo::Cv } -template -Foam::tmp Foam::heThermo::gamma +template +Foam::tmp Foam::heThermo::gamma ( const scalarField& T, const label patchi @@ -543,7 +538,7 @@ Foam::tmp Foam::heThermo::gamma { return patchFieldProperty ( - &MixtureType::patchFaceThermoMixture, + &MixtureType::thermoMixture, &MixtureType::thermoMixtureType::gamma, patchi, this->p_.boundaryField()[patchi], @@ -552,16 +547,16 @@ Foam::tmp Foam::heThermo::gamma } -template +template Foam::tmp -Foam::heThermo::gamma() const +Foam::heThermo::gamma() const { return volScalarField::New("gamma", Cp_/Cv_); } -template -Foam::tmp Foam::heThermo::Cpv +template +Foam::tmp Foam::heThermo::Cpv ( const scalarField& T, const label patchi @@ -578,8 +573,9 @@ Foam::tmp Foam::heThermo::Cpv } -template -Foam::tmp Foam::heThermo::THE +template +Foam::tmp +Foam::heThermo::THE ( const volScalarField& h, const volScalarField& p, @@ -590,8 +586,7 @@ Foam::tmp Foam::heThermo::THE ( "T", dimTemperature, - &MixtureType::cellThermoMixture, - &MixtureType::patchFaceThermoMixture, + &MixtureType::thermoMixture, &MixtureType::thermoMixtureType::THE, h, p, @@ -600,8 +595,8 @@ Foam::tmp Foam::heThermo::THE } -template -Foam::tmp Foam::heThermo::THE +template +Foam::tmp Foam::heThermo::THE ( const scalarField& h, const scalarField& T0, @@ -610,7 +605,7 @@ Foam::tmp Foam::heThermo::THE { return cellSetProperty ( - &MixtureType::cellThermoMixture, + &MixtureType::thermoMixture, &MixtureType::thermoMixtureType::THE, cells, h, @@ -620,8 +615,8 @@ Foam::tmp Foam::heThermo::THE } -template -Foam::tmp Foam::heThermo::THE +template +Foam::tmp Foam::heThermo::THE ( const scalarField& h, const scalarField& T0, @@ -630,7 +625,7 @@ Foam::tmp Foam::heThermo::THE { return patchFieldProperty ( - &MixtureType::patchFaceThermoMixture, + &MixtureType::thermoMixture, &MixtureType::thermoMixtureType::THE, patchi, h, @@ -640,42 +635,42 @@ Foam::tmp Foam::heThermo::THE } -template +template Foam::tmp -Foam::heThermo::W() const +Foam::heThermo::W() const { return volScalarFieldProperty ( "W", dimMass/dimMoles, - &MixtureType::cellThermoMixture, - &MixtureType::patchFaceThermoMixture, + &MixtureType::thermoMixture, &MixtureType::thermoMixtureType::W ); } -template -Foam::tmp Foam::heThermo::W +template +Foam::tmp Foam::heThermo::W ( const label patchi ) const { return patchFieldProperty ( - &MixtureType::patchFaceThermoMixture, + &MixtureType::thermoMixture, &MixtureType::thermoMixtureType::W, patchi ); } -template -bool Foam::heThermo::read() +template +bool Foam::heThermo::read() { - if (BasicThermo::read()) + if (physicalProperties::read()) { MixtureType::read(*this); + BasicThermoType::read(*this); return true; } else diff --git a/src/thermophysicalModels/basic/heThermo/heThermo.H b/src/thermophysicalModels/basic/heThermo/heThermo.H index 0a7f2ba3ec..666ea88d2d 100644 --- a/src/thermophysicalModels/basic/heThermo/heThermo.H +++ b/src/thermophysicalModels/basic/heThermo/heThermo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,7 +25,9 @@ Class Foam::heThermo Description - Enthalpy/Internal energy for a mixture + Thermo implementation and storage of energy and heat capacities. Provides + overloads of the functions defined in the basic thermo type that depend on + the primitive thermo model. SourceFiles heThermo.C @@ -35,8 +37,8 @@ SourceFiles #ifndef heThermo_H #define heThermo_H -#include "basicMixture.H" #include "volFields.H" +#include "physicalProperties.H" #include "uniformGeometricFields.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -44,15 +46,24 @@ SourceFiles namespace Foam { +/*---------------------------------------------------------------------------*\ + Class heThermoName Declaration +\*---------------------------------------------------------------------------*/ + +TemplateName(heThermo); + + /*---------------------------------------------------------------------------*\ Class heThermo Declaration \*---------------------------------------------------------------------------*/ -template +template class heThermo : - public BasicThermo, - public MixtureType + public heThermoName, + public physicalProperties, + public MixtureType, + public BasicThermoType { protected: @@ -71,38 +82,31 @@ protected: // Protected Member Functions //- Return a volScalarField of the given property - template - < - class CellMixture, - class PatchFaceMixture, - class Method, - class ... Args - > + template tmp volScalarFieldProperty ( const word& psiName, const dimensionSet& psiDim, - CellMixture cellMixture, - PatchFaceMixture patchFaceMixture, + Mixture mixture, Method psiMethod, const Args& ... args ) const; //- Return a scalarField of the given property on a cell set - template + template tmp cellSetProperty ( - CellMixture cellMixture, + Mixture mixture, Method psiMethod, const labelList& cells, const Args& ... args ) const; //- Return a scalarField of the given property on a patch - template + template tmp patchFieldProperty ( - PatchFaceMixture patchFaceMixture, + Mixture mixture, Method psiMethod, const label patchi, const Args& ... args @@ -128,17 +132,26 @@ protected: public: + // Typedefs + + //- Mixture type + typedef MixtureType mixtureType; + + //- Basic thermo + typedef BasicThermoType basicThermoType; + + + //- Disambiguate debug switch used by derivations + using heThermoName::debug; + + // Constructors - //- Construct from mesh - heThermo - ( - const fvMesh&, - const word& phaseName - ); + //- Construct from mesh and phase name + heThermo(const fvMesh&, const word& phaseName); //- Disallow default bitwise copy construction - heThermo(const heThermo&) = delete; + heThermo(const heThermo&) = delete; //- Destructor @@ -147,16 +160,20 @@ public: // Member Functions - //- Return the composition of the mixture - virtual typename MixtureType::basicMixtureType& - composition() + //- Return the properties dictionary + virtual IOdictionary& properties() { return *this; } - //- Return the composition of the mixture - virtual const typename MixtureType::basicMixtureType& - composition() const + //- Return the properties dictionary + virtual const IOdictionary& properties() const + { + return *this; + } + + //- Return the mixture + const MixtureType& mixture() const { return *this; } @@ -357,11 +374,37 @@ public: }; +/*---------------------------------------------------------------------------*\ + Class namedHeThermo Declaration +\*---------------------------------------------------------------------------*/ + +template +class namedHeThermo +: + public HeThermo +{ +public: + + //- Runtime type information + TypeName("heThermo"); + + + // Constructors + + //- Inherit constructors + using HeThermo::HeThermo; + + + //- Destructor + virtual ~namedHeThermo(); +}; + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #ifdef NoRepository #include "heThermo.C" diff --git a/src/thermophysicalModels/basic/heThermo/heThermoName.C b/src/thermophysicalModels/basic/heThermo/heThermoName.C new file mode 100644 index 0000000000..51610c7ad2 --- /dev/null +++ b/src/thermophysicalModels/basic/heThermo/heThermoName.C @@ -0,0 +1,36 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2023 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 "heThermo.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(heThermoName, 0); +} + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/multicomponentThermo/mixtures/basicCombustionMixture/basicCombustionMixture.C b/src/thermophysicalModels/basic/liquidThermo/heLiquidThermo.C similarity index 60% rename from src/thermophysicalModels/multicomponentThermo/mixtures/basicCombustionMixture/basicCombustionMixture.C rename to src/thermophysicalModels/basic/liquidThermo/heLiquidThermo.C index 810a56f4bf..8f736be75c 100644 --- a/src/thermophysicalModels/multicomponentThermo/mixtures/basicCombustionMixture/basicCombustionMixture.C +++ b/src/thermophysicalModels/basic/liquidThermo/heLiquidThermo.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2014-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,49 +23,43 @@ License \*---------------------------------------------------------------------------*/ -#include "basicCombustionMixture.H" - -// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // - -namespace Foam -{ - defineTypeNameAndDebug(basicCombustionMixture, 0); -} - +#include "heLiquidThermo.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::basicCombustionMixture::basicCombustionMixture +template +Foam::heLiquidThermo::heLiquidThermo ( - const dictionary& thermoDict, - const wordList& specieNames, const fvMesh& mesh, const word& phaseName ) : - basicMixture(thermoDict, mesh, phaseName), - species_(specieNames), - Y_(species_.size()) + HeThermo(mesh, phaseName) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template +Foam::heLiquidThermo::~heLiquidThermo() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +Foam::tmp +Foam::heLiquidThermo::sigma() const { - forAll(species_, i) - { - Y_.set - ( - i, - new volScalarField - ( - IOobject - ( - IOobject::groupName(species_[i], phaseName), - mesh.time().name(), - mesh, - IOobject::MUST_READ, - IOobject::AUTO_WRITE - ), - mesh - ) - ); - } + return this->volScalarFieldProperty + ( + "sigma", + dimForce/dimLength, + &HeThermo::mixtureType::thermoMixture, + &HeThermo::mixtureType::thermoMixtureType::sigma, + this->p_, + this->T_ + ); } diff --git a/src/thermophysicalModels/basic/rhoThermo/liquidThermo.C b/src/thermophysicalModels/basic/liquidThermo/heLiquidThermo.H similarity index 52% rename from src/thermophysicalModels/basic/rhoThermo/liquidThermo.C rename to src/thermophysicalModels/basic/liquidThermo/heLiquidThermo.H index c5106f1de4..76f67f1b08 100644 --- a/src/thermophysicalModels/basic/rhoThermo/liquidThermo.C +++ b/src/thermophysicalModels/basic/liquidThermo/heLiquidThermo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2017-2018 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -21,78 +21,77 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see . +Class + Foam::heLiquidThermo + +Description + Liquid thermo implementation + +SourceFiles + heLiquidThermo.C + \*---------------------------------------------------------------------------*/ +#ifndef heLiquidThermo_H +#define heLiquidThermo_H + #include "liquidThermo.H" -#include "addToRunTimeSelectionTable.H" +#include "heThermo.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { -/* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */ +/*---------------------------------------------------------------------------*\ + Class heLiquidThermo Declaration +\*---------------------------------------------------------------------------*/ -defineTemplateTypeNameAndDebugWithName -( - heRhoThermopureMixtureliquidProperties, - "heRhoThermo>", - 0 -); +template +class heLiquidThermo +: + public HeThermo +{ +public: -addToRunTimeSelectionTable -( - basicThermo, - heRhoThermopureMixtureliquidProperties, - fvMesh -); + // Constructors -addToRunTimeSelectionTable -( - fluidThermo, - heRhoThermopureMixtureliquidProperties, - fvMesh -); + //- Construct from mesh and phase name + heLiquidThermo(const fvMesh&, const word& phaseName); -addToRunTimeSelectionTable -( - rhoThermo, - heRhoThermopureMixtureliquidProperties, - fvMesh -); + //- Disallow default bitwise copy construction + heLiquidThermo(const heLiquidThermo&) = delete; -defineTemplateTypeNameAndDebugWithName -( - heRhoThermopureMixtureEnthalpyliquidProperties, - "heRhoThermo>", - 0 -); + //- Destructor + virtual ~heLiquidThermo(); -addToRunTimeSelectionTable -( - basicThermo, - heRhoThermopureMixtureEnthalpyliquidProperties, - fvMesh -); -addToRunTimeSelectionTable -( - fluidThermo, - heRhoThermopureMixtureEnthalpyliquidProperties, - fvMesh -); + // Member Functions -addToRunTimeSelectionTable -( - rhoThermo, - heRhoThermopureMixtureEnthalpyliquidProperties, - fvMesh -); + //- Surface tension [N/m] + virtual tmp sigma() const; + + + // Member Operators + + //- Disallow default bitwise assignment + void operator=(const heLiquidThermo&) = delete; +}; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository + #include "heLiquidThermo.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + // ************************************************************************* // diff --git a/src/thermophysicalModels/basic/liquidThermo/liquidThermo.C b/src/thermophysicalModels/basic/liquidThermo/liquidThermo.C new file mode 100644 index 0000000000..8eda0125fe --- /dev/null +++ b/src/thermophysicalModels/basic/liquidThermo/liquidThermo.C @@ -0,0 +1,55 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2023 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 "liquidThermo.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(liquidThermo, 0); + defineRunTimeSelectionTable(liquidThermo, fvMesh); +} + + +// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // + +Foam::autoPtr Foam::liquidThermo::New +( + const fvMesh& mesh, + const word& phaseName +) +{ + return basicThermo::New(mesh, phaseName); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::liquidThermo::~liquidThermo() +{} + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/basic/liquidThermo/liquidThermo.H b/src/thermophysicalModels/basic/liquidThermo/liquidThermo.H new file mode 100644 index 0000000000..6a58121ab9 --- /dev/null +++ b/src/thermophysicalModels/basic/liquidThermo/liquidThermo.H @@ -0,0 +1,153 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2023 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 . + +Class + Foam::liquidThermo + +Description + Base-class for liquid thermodynamic properties. + +See also + Foam::basicThermo + +SourceFiles + liquidThermo.C + +\*---------------------------------------------------------------------------*/ + +#ifndef liquidThermo_H +#define liquidThermo_H + +#include "rhoThermo.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +template class heThermo; +template class heRhoThermo; +template class heLiquidThermo; + +/*---------------------------------------------------------------------------*\ + Class liquidThermo Declaration +\*---------------------------------------------------------------------------*/ + +class liquidThermo +: + virtual public rhoThermo +{ +public: + + // Public Classes + + //- Forward declare the composite class + class composite; + + + // Public Typedefs + + //- The derived type + template + using heThermoType = + heLiquidThermo>>; + + + //- Runtime type information + TypeName("liquidThermo"); + + + //- Declare run-time constructor selection table + declareRunTimeSelectionTable + ( + autoPtr, + liquidThermo, + fvMesh, + (const fvMesh& mesh, const word& phaseName), + (mesh, phaseName) + ); + + + // Selectors + + //- Standard selection based on fvMesh + static autoPtr New + ( + const fvMesh&, + const word& phaseName=word::null + ); + + + //- Destructor + virtual ~liquidThermo(); + + + // Member Functions + + //- Surface tension [N/m] + virtual tmp sigma() const = 0; +}; + + +/*---------------------------------------------------------------------------*\ + Class liquidThermo::composite Declaration +\*---------------------------------------------------------------------------*/ + +class liquidThermo::composite +: + public basicThermo::implementation, + public pureThermo, + public fluidThermo::implementation, + public rhoThermo::implementation, + public liquidThermo +{ +public: + + // Constructors + + //- Construct from dictionary, mesh and phase name + template + composite + ( + const dictionary& dict, + const MixtureType& mixture, + const fvMesh& mesh, + const word& phaseName + ) + : + basicThermo::implementation(dict, mesh, phaseName), + fluidThermo::implementation(dict, mesh, phaseName), + rhoThermo::implementation(dict, mesh, phaseName) + {} +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/basic/liquidThermo/liquidThermos.C b/src/thermophysicalModels/basic/liquidThermo/liquidThermos.C new file mode 100644 index 0000000000..3128940438 --- /dev/null +++ b/src/thermophysicalModels/basic/liquidThermo/liquidThermos.C @@ -0,0 +1,66 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2017-2023 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 "liquidPropertiesSelector.H" + +#include "sensibleInternalEnergy.H" +#include "sensibleEnthalpy.H" + +#include "pureMixture.H" + +#include "thermo.H" + +#include "liquidThermo.H" +#include "heRhoThermo.H" +#include "heLiquidThermo.H" +#include "makeThermo.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define makeLiquidThermo(ThermoPhysics) \ + \ + defineThermo(liquidThermo, pureMixture, ThermoPhysics); \ + \ + addThermo(basicThermo, liquidThermo, pureMixture, ThermoPhysics); \ + addThermo(fluidThermo, liquidThermo, pureMixture, ThermoPhysics); \ + addThermo(rhoThermo, liquidThermo, pureMixture, ThermoPhysics); \ + addThermo(liquidThermo, liquidThermo, pureMixture, ThermoPhysics) + +namespace Foam +{ + typedef + species::thermo + liquidSensibleInternalEnergy; + + makeLiquidThermo(liquidSensibleInternalEnergy); + + typedef + species::thermo + liquidSensibleEnthalpy; + + makeLiquidThermo(liquidSensibleEnthalpy); +} + +// ************************************************************************* // diff --git a/src/thermophysicalModels/basic/rhoThermo/liquidThermo.H b/src/thermophysicalModels/basic/makeFluidThermo.H similarity index 59% rename from src/thermophysicalModels/basic/rhoThermo/liquidThermo.H rename to src/thermophysicalModels/basic/makeFluidThermo.H index 151e9d26c4..6847e5dc52 100644 --- a/src/thermophysicalModels/basic/rhoThermo/liquidThermo.H +++ b/src/thermophysicalModels/basic/makeFluidThermo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2017-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2020-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -21,54 +21,33 @@ License You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see . +InClass + Foam::fluidThermo + +Description + Macros for creating basic fluid thermo packages + \*---------------------------------------------------------------------------*/ -#include "rhoThermo.H" -#include "heRhoThermo.H" -#include "pureMixture.H" -#include "thermo.H" -#include "sensibleInternalEnergy.H" -#include "sensibleEnthalpy.H" -#include "thermophysicalPropertiesSelector.H" -#include "liquidProperties.H" +#ifndef makeFluidThermo_H +#define makeFluidThermo_H + +#include "makeThermo.H" +#include "fluidThermo.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -namespace Foam -{ - -/* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */ - -typedef heRhoThermo -< - rhoThermo::composite, - pureMixture - < - species::thermo - < - thermophysicalPropertiesSelector, - sensibleInternalEnergy - > - > -> heRhoThermopureMixtureliquidProperties; - - -typedef heRhoThermo -< - rhoThermo::composite, - pureMixture - < - species::thermo - < - thermophysicalPropertiesSelector, - sensibleEnthalpy - > - > -> heRhoThermopureMixtureEnthalpyliquidProperties; +#define makeFluidThermo(BaseThermo, Mixture, ThermoPhysics) \ + \ + defineThermo(BaseThermo, Mixture, ThermoPhysics); \ + \ + addThermo(basicThermo, BaseThermo, Mixture, ThermoPhysics); \ + addThermo(fluidThermo, BaseThermo, Mixture, ThermoPhysics); \ + addThermo(BaseThermo, BaseThermo, Mixture, ThermoPhysics) // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -} // End namespace Foam +#endif // ************************************************************************* // diff --git a/src/thermophysicalModels/basic/mixtures/pureMixture/pureMixture.C b/src/thermophysicalModels/basic/mixtures/pureMixture/pureMixture.C index 4f71ca4b46..769ebb78da 100644 --- a/src/thermophysicalModels/basic/mixtures/pureMixture/pureMixture.C +++ b/src/thermophysicalModels/basic/mixtures/pureMixture/pureMixture.C @@ -24,29 +24,22 @@ License \*---------------------------------------------------------------------------*/ #include "pureMixture.H" -#include "fvMesh.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template -Foam::pureMixture::pureMixture -( - const dictionary& thermoDict, - const fvMesh& mesh, - const word& phaseName -) +Foam::pureMixture::pureMixture(const dictionary& dict) : - basicMixture(thermoDict, mesh, phaseName), - mixture_("mixture", thermoDict.subDict("mixture")) + mixture_("mixture", dict.subDict("mixture")) {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template -void Foam::pureMixture::read(const dictionary& thermoDict) +void Foam::pureMixture::read(const dictionary& dict) { - mixture_ = ThermoType("mixture", thermoDict.subDict("mixture")); + mixture_ = ThermoType("mixture", dict.subDict("mixture")); } diff --git a/src/thermophysicalModels/basic/mixtures/pureMixture/pureMixture.H b/src/thermophysicalModels/basic/mixtures/pureMixture/pureMixture.H index 04b6194fbd..d5cbb33b60 100644 --- a/src/thermophysicalModels/basic/mixtures/pureMixture/pureMixture.H +++ b/src/thermophysicalModels/basic/mixtures/pureMixture/pureMixture.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,7 +25,8 @@ Class Foam::pureMixture Description - Foam::pureMixture + Pure mixture model. This does no mixing, it just returns the single + underlying thermo model. SourceFiles pureMixture.C @@ -35,7 +36,7 @@ SourceFiles #ifndef pureMixture_H #define pureMixture_H -#include "basicMixture.H" +#include "dictionary.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -48,26 +49,26 @@ namespace Foam template class pureMixture -: - public basicMixture { - public: - //- The type of thermodynamics this mixture is instantiated for - typedef ThermoType thermoType; + // Public Typedefs - //- Mixing type for thermodynamic properties - typedef ThermoType thermoMixtureType; + //- The type of thermodynamics this mixture is instantiated for + typedef ThermoType thermoType; - //- Mixing type for transport properties - typedef ThermoType transportMixtureType; + //- Mixing type for thermodynamic properties + typedef ThermoType thermoMixtureType; + + //- Mixing type for transport properties + typedef ThermoType transportMixtureType; private: // Private Data + //- Thermo model ThermoType mixture_; @@ -75,8 +76,8 @@ public: // Constructors - //- Construct from dictionary, mesh and phase name - pureMixture(const dictionary&, const fvMesh&, const word&); + //- Construct from a dictionary + pureMixture(const dictionary&); //- Disallow default bitwise copy construction pureMixture(const pureMixture&) = delete; @@ -90,47 +91,22 @@ public: return "pureMixture<" + ThermoType::typeName() + '>'; } - const thermoMixtureType& cellThermoMixture(const label) const + //- Return the mixture for thermodynamic properties + const thermoMixtureType& thermoMixture(const nil) const { return mixture_; } - const thermoMixtureType& patchFaceThermoMixture + //- Return the mixture for transport properties + const transportMixtureType& transportMixture(const nil) const + { + return mixture_; + } + + //- Return the mixture for transport properties + const transportMixtureType& transportMixture ( - const label, - const label - ) const - { - return mixture_; - } - - const transportMixtureType& cellTransportMixture(const label) const - { - return mixture_; - } - - const transportMixtureType& patchFaceTransportMixture - ( - const label, - const label - ) const - { - return mixture_; - } - - const transportMixtureType& cellTransportMixture - ( - const label, - const thermoMixtureType& - ) const - { - return mixture_; - } - - const transportMixtureType& patchFaceTransportMixture - ( - const label, - const label, + const nil, const thermoMixtureType& ) const { diff --git a/src/thermophysicalModels/basic/psiThermo/hePsiThermo.C b/src/thermophysicalModels/basic/psiThermo/hePsiThermo.C index 8777509a4d..08c06d2cbf 100644 --- a/src/thermophysicalModels/basic/psiThermo/hePsiThermo.C +++ b/src/thermophysicalModels/basic/psiThermo/hePsiThermo.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -27,8 +27,8 @@ License // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -template -void Foam::hePsiThermo::calculate() +template +void Foam::hePsiThermo::calculate() { const scalarField& hCells = this->he_; const scalarField& pCells = this->p_; @@ -42,11 +42,14 @@ void Foam::hePsiThermo::calculate() forAll(TCells, celli) { - const typename MixtureType::thermoMixtureType& thermoMixture = - this->cellThermoMixture(celli); + auto composition = this->cellComposition(celli); - const typename MixtureType::transportMixtureType& transportMixture = - this->cellTransportMixture(celli, thermoMixture); + const typename HeThermo::mixtureType::thermoMixtureType& + thermoMixture = this->thermoMixture(composition); + + const typename HeThermo::mixtureType::transportMixtureType& + transportMixture = + this->transportMixture(composition, thermoMixture); TCells[celli] = thermoMixture.THE ( @@ -103,13 +106,14 @@ void Foam::hePsiThermo::calculate() { forAll(pT, facei) { - const typename MixtureType::thermoMixtureType& - thermoMixture = this->patchFaceThermoMixture(patchi, facei); + auto composition = this->patchFaceComposition(patchi, facei); - const typename MixtureType::transportMixtureType& + const typename HeThermo::mixtureType::thermoMixtureType& + thermoMixture = this->thermoMixture(composition); + + const typename HeThermo::mixtureType::transportMixtureType& transportMixture = - this->patchFaceTransportMixture - (patchi, facei, thermoMixture); + this->transportMixture(composition, thermoMixture); phe[facei] = thermoMixture.HE(pp[facei], pT[facei]); @@ -125,13 +129,14 @@ void Foam::hePsiThermo::calculate() { forAll(pT, facei) { - const typename MixtureType::thermoMixtureType& thermoMixture = - this->patchFaceThermoMixture(patchi, facei); + auto composition = this->patchFaceComposition(patchi, facei); - const typename MixtureType::transportMixtureType& + const typename HeThermo::mixtureType::thermoMixtureType& + thermoMixture = this->thermoMixture(composition); + + const typename HeThermo::mixtureType::transportMixtureType& transportMixture = - this->patchFaceTransportMixture - (patchi, facei, thermoMixture); + this->transportMixture(composition, thermoMixture); pT[facei] = thermoMixture.THE(phe[facei], pp[facei], pT[facei]); @@ -149,14 +154,14 @@ void Foam::hePsiThermo::calculate() // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -template -Foam::hePsiThermo::hePsiThermo +template +Foam::hePsiThermo::hePsiThermo ( const fvMesh& mesh, const word& phaseName ) : - heThermo(mesh, phaseName) + HeThermo(mesh, phaseName) { calculate(); @@ -167,17 +172,17 @@ Foam::hePsiThermo::hePsiThermo // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // -template -Foam::hePsiThermo::~hePsiThermo() +template +Foam::hePsiThermo::~hePsiThermo() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -template -void Foam::hePsiThermo::correct() +template +void Foam::hePsiThermo::correct() { - if (debug) + if (HeThermo::debug) { InfoInFunction << endl; } @@ -187,7 +192,7 @@ void Foam::hePsiThermo::correct() calculate(); - if (debug) + if (HeThermo::debug) { Info<< " Finished" << endl; } diff --git a/src/thermophysicalModels/basic/psiThermo/hePsiThermo.H b/src/thermophysicalModels/basic/psiThermo/hePsiThermo.H index 28aa1f1e53..7d61e3841b 100644 --- a/src/thermophysicalModels/basic/psiThermo/hePsiThermo.H +++ b/src/thermophysicalModels/basic/psiThermo/hePsiThermo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,7 +25,7 @@ Class Foam::hePsiThermo Description - Energy for a mixture based on compressibility + Thermo implementation based on compressibility SourceFiles hePsiThermo.C @@ -47,10 +47,10 @@ namespace Foam Class hePsiThermo Declaration \*---------------------------------------------------------------------------*/ -template +template class hePsiThermo : - public heThermo + public HeThermo { // Private Member Functions @@ -59,21 +59,13 @@ class hePsiThermo public: - //- Runtime type information - TypeName("hePsiThermo"); - - // Constructors //- Construct from mesh and phase name - hePsiThermo - ( - const fvMesh&, - const word& phaseName - ); + hePsiThermo(const fvMesh&, const word& phaseName); //- Disallow default bitwise copy construction - hePsiThermo(const hePsiThermo&) = delete; + hePsiThermo(const hePsiThermo&) = delete; //- Destructor @@ -89,10 +81,7 @@ public: // Member Operators //- Disallow default bitwise assignment - void operator= - ( - const hePsiThermo& - ) = delete; + void operator=(const hePsiThermo&) = delete; }; diff --git a/src/thermophysicalModels/basic/psiThermo/psiThermo.C b/src/thermophysicalModels/basic/psiThermo/psiThermo.C index 3833739908..1be1da7f55 100644 --- a/src/thermophysicalModels/basic/psiThermo/psiThermo.C +++ b/src/thermophysicalModels/basic/psiThermo/psiThermo.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -33,11 +33,14 @@ namespace Foam defineRunTimeSelectionTable(psiThermo, fvMesh); } +const Foam::word Foam::psiThermo::heThermoName("hePsiThermo"); + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::psiThermo::implementation::implementation ( + const dictionary& dict, const fvMesh& mesh, const word& phaseName ) diff --git a/src/thermophysicalModels/basic/psiThermo/psiThermo.H b/src/thermophysicalModels/basic/psiThermo/psiThermo.H index e8b801687b..fea7bd4907 100644 --- a/src/thermophysicalModels/basic/psiThermo/psiThermo.H +++ b/src/thermophysicalModels/basic/psiThermo/psiThermo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -39,12 +39,16 @@ SourceFiles #define psiThermo_H #include "fluidThermo.H" +#include "pureThermo.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { +template class heThermo; +template class hePsiThermo; + /*---------------------------------------------------------------------------*\ Class psiThermo Declaration \*---------------------------------------------------------------------------*/ @@ -64,6 +68,16 @@ public: class composite; + // Public Typedefs + + //- The derived type + template + using heThermoType = hePsiThermo>; + + //- The derived name + static const word heThermoName; + + //- Runtime type information TypeName("psiThermo"); @@ -127,8 +141,8 @@ public: // Constructors - //- Construct from mesh and phase name - implementation(const fvMesh&, const word& phaseName); + //- Construct from dictionary, mesh and phase name + implementation(const dictionary&, const fvMesh&, const word&); //- Disallow default bitwise copy construction implementation(const implementation&) = delete; @@ -167,6 +181,7 @@ public: class psiThermo::composite : public basicThermo::implementation, + public pureThermo, public fluidThermo::implementation, public psiThermo::implementation { @@ -174,16 +189,19 @@ public: // Constructors - //- Construct from mesh and phase name + //- Construct from dictionary, mesh and phase name + template composite ( + const dictionary& dict, + const MixtureType& mixture, const fvMesh& mesh, const word& phaseName ) : - basicThermo::implementation(mesh, phaseName), - fluidThermo::implementation(mesh, phaseName), - psiThermo::implementation(mesh, phaseName) + basicThermo::implementation(dict, mesh, phaseName), + fluidThermo::implementation(dict, mesh, phaseName), + psiThermo::implementation(dict, mesh, phaseName) {} }; diff --git a/src/thermophysicalModels/basic/psiThermo/psiThermos.C b/src/thermophysicalModels/basic/psiThermo/psiThermos.C index bde2fd590e..0b396c0847 100644 --- a/src/thermophysicalModels/basic/psiThermo/psiThermos.C +++ b/src/thermophysicalModels/basic/psiThermo/psiThermos.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -28,13 +28,13 @@ License #include "pureMixture.H" #include "forGases.H" -#include "makeThermo.H" +#include "makeFluidThermo.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { - forGases(makeThermo, psiThermo, hePsiThermo, pureMixture); + forGases(makeFluidThermo, psiThermo, pureMixture); } // ************************************************************************* // diff --git a/src/thermophysicalModels/basic/pureThermo/pureThermo.C b/src/thermophysicalModels/basic/pureThermo/pureThermo.C new file mode 100644 index 0000000000..c2f80d08b9 --- /dev/null +++ b/src/thermophysicalModels/basic/pureThermo/pureThermo.C @@ -0,0 +1,34 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2023 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 "pureThermo.H" + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::pureThermo::~pureThermo() +{} + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/basic/mixtures/basicMixture/basicMixture.H b/src/thermophysicalModels/basic/pureThermo/pureThermo.H similarity index 67% rename from src/thermophysicalModels/basic/mixtures/basicMixture/basicMixture.H rename to src/thermophysicalModels/basic/pureThermo/pureThermo.H index cc72a8935a..73afd962a0 100644 --- a/src/thermophysicalModels/basic/mixtures/basicMixture/basicMixture.H +++ b/src/thermophysicalModels/basic/pureThermo/pureThermo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -22,46 +22,54 @@ License along with OpenFOAM. If not, see . Class - Foam::basicMixture + Foam::pureThermo Description - Foam::basicMixture + Base-class for multi-component thermodynamic properties. + +See also + Foam::basicThermo SourceFiles - basicMixture.C + pureThermo.C \*---------------------------------------------------------------------------*/ -#ifndef basicMixture_H -#define basicMixture_H +#ifndef pureThermo_H +#define pureThermo_H + +#include "basicThermo.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { -class fvMesh; -class dictionary; -class word; - /*---------------------------------------------------------------------------*\ - Class basicMixture Declaration + Class pureThermo Declaration \*---------------------------------------------------------------------------*/ -class basicMixture +class pureThermo +: + virtual public basicThermo { - public: - //- The base class of the mixture - typedef basicMixture basicMixtureType; + //- Destructor + virtual ~pureThermo(); - // Constructors + // Member Functions - //- Construct from dictionary, mesh and phase name - basicMixture(const dictionary&, const fvMesh&, const word&) - {} + //- Get the composition of an internal cell + inline nil cellComposition(const label celli) const; + + //- Get the composition of a boundary face + inline nil patchFaceComposition + ( + const label patchi, + const label facei + ) const; }; @@ -71,6 +79,10 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +#include "pureThermoI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + #endif // ************************************************************************* // diff --git a/src/thermophysicalModels/basic/pureThermo/pureThermoI.H b/src/thermophysicalModels/basic/pureThermo/pureThermoI.H new file mode 100644 index 0000000000..170a3f3978 --- /dev/null +++ b/src/thermophysicalModels/basic/pureThermo/pureThermoI.H @@ -0,0 +1,46 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2023 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 "pureThermo.H" + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +inline Foam::nil Foam::pureThermo::cellComposition(const label celli) const +{ + return nil(); +} + + +inline Foam::nil Foam::pureThermo::patchFaceComposition +( + const label patchi, + const label facei +) const +{ + return nil(); +} + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/basic/rhoThermo/heRhoThermo.C b/src/thermophysicalModels/basic/rhoThermo/heRhoThermo.C index 89880f98cf..2908a53ac1 100644 --- a/src/thermophysicalModels/basic/rhoThermo/heRhoThermo.C +++ b/src/thermophysicalModels/basic/rhoThermo/heRhoThermo.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -27,8 +27,8 @@ License // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -template -void Foam::heRhoThermo::calculate() +template +void Foam::heRhoThermo::calculate() { const scalarField& hCells = this->he(); const scalarField& pCells = this->p_; @@ -43,11 +43,14 @@ void Foam::heRhoThermo::calculate() forAll(TCells, celli) { - const typename MixtureType::thermoMixtureType& thermoMixture = - this->cellThermoMixture(celli); + auto composition = this->cellComposition(celli); - const typename MixtureType::transportMixtureType& transportMixture = - this->cellTransportMixture(celli, thermoMixture); + const typename HeThermo::mixtureType::thermoMixtureType& + thermoMixture = this->thermoMixture(composition); + + const typename HeThermo::mixtureType::transportMixtureType& + transportMixture = + this->transportMixture(composition, thermoMixture); TCells[celli] = thermoMixture.THE ( @@ -109,13 +112,14 @@ void Foam::heRhoThermo::calculate() { forAll(pT, facei) { - const typename MixtureType::thermoMixtureType& thermoMixture = - this->patchFaceThermoMixture(patchi, facei); + auto composition = this->patchFaceComposition(patchi, facei); - const typename MixtureType::transportMixtureType& + const typename HeThermo::mixtureType::thermoMixtureType& + thermoMixture = this->thermoMixture(composition); + + const typename HeThermo::mixtureType::transportMixtureType& transportMixture = - this->patchFaceTransportMixture - (patchi, facei, thermoMixture); + this->transportMixture(composition, thermoMixture); phe[facei] = thermoMixture.HE(pp[facei], pT[facei]); @@ -132,13 +136,14 @@ void Foam::heRhoThermo::calculate() { forAll(pT, facei) { - const typename MixtureType::thermoMixtureType& thermoMixture = - this->patchFaceThermoMixture(patchi, facei); + auto composition = this->patchFaceComposition(patchi, facei); - const typename MixtureType::transportMixtureType& + const typename HeThermo::mixtureType::thermoMixtureType& + thermoMixture = this->thermoMixture(composition); + + const typename HeThermo::mixtureType::transportMixtureType& transportMixture = - this->patchFaceTransportMixture - (patchi, facei, thermoMixture); + this->transportMixture(composition, thermoMixture); pT[facei] = thermoMixture.THE(phe[facei], pp[facei], pT[facei]); @@ -157,14 +162,14 @@ void Foam::heRhoThermo::calculate() // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -template -Foam::heRhoThermo::heRhoThermo +template +Foam::heRhoThermo::heRhoThermo ( const fvMesh& mesh, const word& phaseName ) : - heThermo(mesh, phaseName) + HeThermo(mesh, phaseName) { calculate(); } @@ -172,24 +177,24 @@ Foam::heRhoThermo::heRhoThermo // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // -template -Foam::heRhoThermo::~heRhoThermo() +template +Foam::heRhoThermo::~heRhoThermo() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -template -void Foam::heRhoThermo::correct() +template +void Foam::heRhoThermo::correct() { - if (debug) + if (HeThermo::debug) { InfoInFunction << endl; } calculate(); - if (debug) + if (HeThermo::debug) { Info<< " Finished" << endl; } diff --git a/src/thermophysicalModels/basic/rhoThermo/heRhoThermo.H b/src/thermophysicalModels/basic/rhoThermo/heRhoThermo.H index 31369a4575..9cc4b12ea2 100644 --- a/src/thermophysicalModels/basic/rhoThermo/heRhoThermo.H +++ b/src/thermophysicalModels/basic/rhoThermo/heRhoThermo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,7 +25,7 @@ Class Foam::heRhoThermo Description - Energy for a mixture based on density + Thermo implementation based on density SourceFiles heRhoThermo.C @@ -47,10 +47,10 @@ namespace Foam Class heRhoThermo Declaration \*---------------------------------------------------------------------------*/ -template +template class heRhoThermo : - public heThermo + public HeThermo { // Private Member Functions @@ -60,21 +60,13 @@ class heRhoThermo public: - //- Runtime type information - TypeName("heRhoThermo"); - - // Constructors //- Construct from mesh and phase name - heRhoThermo - ( - const fvMesh&, - const word& phaseName - ); + heRhoThermo(const fvMesh&, const word& phaseName); //- Disallow default bitwise copy construction - heRhoThermo(const heRhoThermo&) = delete; + heRhoThermo(const heRhoThermo&) = delete; //- Destructor @@ -90,10 +82,7 @@ public: // Member Operators //- Disallow default bitwise assignment - void operator= - ( - const heRhoThermo& - ) = delete; + void operator=(const heRhoThermo&) = delete; }; diff --git a/src/thermophysicalModels/basic/rhoThermo/rhoThermo.C b/src/thermophysicalModels/basic/rhoThermo/rhoThermo.C index d0e262dd9e..9d1e2e34b1 100644 --- a/src/thermophysicalModels/basic/rhoThermo/rhoThermo.C +++ b/src/thermophysicalModels/basic/rhoThermo/rhoThermo.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -33,11 +33,14 @@ namespace Foam defineRunTimeSelectionTable(rhoThermo, fvMesh); } +const Foam::word Foam::rhoThermo::heThermoName("heRhoThermo"); + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::rhoThermo::implementation::implementation ( + const dictionary& dict, const fvMesh& mesh, const word& phaseName ) diff --git a/src/thermophysicalModels/basic/rhoThermo/rhoThermo.H b/src/thermophysicalModels/basic/rhoThermo/rhoThermo.H index 0d583a9d8f..2fa56bc695 100644 --- a/src/thermophysicalModels/basic/rhoThermo/rhoThermo.H +++ b/src/thermophysicalModels/basic/rhoThermo/rhoThermo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -39,13 +39,16 @@ SourceFiles #define rhoThermo_H #include "fluidThermo.H" -#include "runTimeSelectionTables.H" +#include "pureThermo.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { +template class heThermo; +template class heRhoThermo; + /*---------------------------------------------------------------------------*\ Class rhoThermo Declaration \*---------------------------------------------------------------------------*/ @@ -65,6 +68,16 @@ public: class composite; + // Public Typedefs + + //- The derived type + template + using heThermoType = heRhoThermo>; + + //- The derived name + static const word heThermoName; + + //- Runtime type information TypeName("rhoThermo"); @@ -138,8 +151,8 @@ public: // Constructors - //- Construct from mesh and phase name - implementation(const fvMesh&, const word& phaseName); + //- Construct from dictionary, mesh and phase name + implementation(const dictionary&, const fvMesh&, const word&); //- Disallow default bitwise copy construction implementation(const implementation&) = delete; @@ -185,6 +198,7 @@ public: class rhoThermo::composite : public basicThermo::implementation, + public pureThermo, public fluidThermo::implementation, public rhoThermo::implementation { @@ -192,16 +206,19 @@ public: // Constructors - //- Construct from mesh and phase name + //- Construct from dictionary, mesh and phase name + template composite ( + const dictionary& dict, + const MixtureType& mixture, const fvMesh& mesh, const word& phaseName ) : - basicThermo::implementation(mesh, phaseName), - fluidThermo::implementation(mesh, phaseName), - rhoThermo::implementation(mesh, phaseName) + basicThermo::implementation(dict, mesh, phaseName), + fluidThermo::implementation(dict, mesh, phaseName), + rhoThermo::implementation(dict, mesh, phaseName) {} }; diff --git a/src/thermophysicalModels/basic/rhoThermo/rhoThermos.C b/src/thermophysicalModels/basic/rhoThermo/rhoThermos.C index 17340c5dd0..622c626026 100644 --- a/src/thermophysicalModels/basic/rhoThermo/rhoThermos.C +++ b/src/thermophysicalModels/basic/rhoThermo/rhoThermos.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -30,15 +30,15 @@ License #include "forGases.H" #include "forLiquids.H" #include "forTabulated.H" -#include "makeThermo.H" +#include "makeFluidThermo.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { - forGases(makeThermo, rhoThermo, heRhoThermo, pureMixture); - forLiquids(makeThermo, rhoThermo, heRhoThermo, pureMixture); - forTabulated(makeThermo, rhoThermo, heRhoThermo, pureMixture); + forGases(makeFluidThermo, rhoThermo, pureMixture); + forLiquids(makeFluidThermo, rhoThermo, pureMixture); + forTabulated(makeFluidThermo, rhoThermo, pureMixture); } // ************************************************************************* // diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/chemistryModel.C b/src/thermophysicalModels/chemistryModel/chemistryModel/chemistryModel.C index 5e1787eab1..3349584de7 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/chemistryModel.C +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/chemistryModel.C @@ -45,9 +45,12 @@ Foam::chemistryModel::chemistryModel ? jacobianTypeNames_.read(this->lookup("jacobian")) : jacobianType::fast ), - mixture_(refCast>(this->thermo())), + mixture_ + ( + dynamicCast>(this->thermo()) + ), specieThermos_(mixture_.specieThermos()), - reactions_(mixture_.species(), specieThermos_, this->mesh(), *this), + reactions_(thermo.species(), specieThermos_, this->mesh(), *this), RR_(nSpecie_), Y_(nSpecie_), c_(nSpecie_), @@ -94,8 +97,6 @@ Foam::chemistryModel::chemistryModel // species should be initialised (by default 'active' is true) if (reduction_) { - const basicSpecieMixture& composition = this->thermo().composition(); - forAll(Yvf_, i) { typeIOobject header @@ -110,7 +111,7 @@ Foam::chemistryModel::chemistryModel // and NO_WRITE if (!header.headerOk()) { - composition.setInactive(i); + this->thermo().setSpecieInactive(i); } } } @@ -778,21 +779,9 @@ Foam::scalar Foam::chemistryModel::solve mechRed_.update(); tabulation_.update(); - if (reduction_ && Pstream::parRun()) + if (reduction_) { - const basicSpecieMixture& composition = this->thermo().composition(); - - List active(composition.active()); - Pstream::listCombineGather(active, orEqOp()); - Pstream::listCombineScatter(active); - - forAll(active, i) - { - if (active[i]) - { - composition.setActive(i); - } - } + this->thermo().syncSpeciesActive(); } return deltaTMin; diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/chemistryModel.H b/src/thermophysicalModels/chemistryModel/chemistryModel/chemistryModel.H index 64ba05acde..0094ebd27c 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/chemistryModel.H +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/chemistryModel.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2016-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2016-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -290,15 +290,6 @@ public: ) const = 0; - // Mechanism reduction functions - - //- Return true if specie i is active - inline bool active(const label i) const; - - //- Set specie i active - inline void setActive(const label i); - - // Member Operators //- Disallow default bitwise assignment diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/chemistryModelI.H b/src/thermophysicalModels/chemistryModel/chemistryModel/chemistryModelI.H index 0f2dba0d28..ff4cc4dc2c 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/chemistryModelI.H +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/chemistryModelI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2016-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2016-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -64,18 +64,4 @@ Foam::chemistryModel::RR() const } -template -inline void Foam::chemistryModel::setActive(const label i) -{ - this->thermo().composition().setActive(i); -} - - -template -inline bool Foam::chemistryModel::active(const label i) const -{ - return this->thermo().composition().active(i); -} - - // ************************************************************************* // diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/reduction/DAC/DAC.C b/src/thermophysicalModels/chemistryModel/chemistryModel/reduction/DAC/DAC.C index b35858ad72..d519b17899 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/reduction/DAC/DAC.C +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/reduction/DAC/DAC.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2016-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2016-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -90,7 +90,7 @@ Foam::chemistryReductionMethods::DAC::DAC const wordHashSet initSet(this->coeffsDict_.lookup("initialSet")); forAllConstIter(wordHashSet, initSet, iter) { - searchInitSet_.append(chemistry.mixture().species()[iter.key()]); + searchInitSet_.append(chemistry.thermo().species()[iter.key()]); } if (this->coeffsDict_.found("automaticSIS")) @@ -198,7 +198,7 @@ Foam::chemistryReductionMethods::DAC::DAC fuelSpecies_[i] = fuelSpeciesEntry[i].first(); fuelSpeciesProp_[i] = fuelSpeciesEntry[i].second(); fuelSpeciesID_[i] = - this->chemistry_.mixture().species()[fuelSpecies_[i]]; + this->chemistry_.thermo().species()[fuelSpecies_[i]]; scalar curMm = this->chemistry_.specieThermos()[fuelSpeciesID_[i]].W(); Mmtot += fuelSpeciesProp_[i]/curMm; diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/reduction/DRG/DRG.C b/src/thermophysicalModels/chemistryModel/chemistryModel/reduction/DRG/DRG.C index d6bec8b44d..6fc58c43ed 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/reduction/DRG/DRG.C +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/reduction/DRG/DRG.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2016-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2016-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -40,7 +40,7 @@ Foam::chemistryReductionMethods::DRG::DRG const wordHashSet initSet(this->coeffsDict_.lookup("initialSet")); forAllConstIter(wordHashSet, initSet, iter) { - searchInitSet_.append(chemistry.mixture().species()[iter.key()]); + searchInitSet_.append(chemistry.thermo().species()[iter.key()]); } } diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/reduction/DRGEP/DRGEP.C b/src/thermophysicalModels/chemistryModel/chemistryModel/reduction/DRGEP/DRGEP.C index dbda10a20a..251ca47cad 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/reduction/DRGEP/DRGEP.C +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/reduction/DRGEP/DRGEP.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2016-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2016-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -48,7 +48,7 @@ Foam::chemistryReductionMethods::DRGEP::DRGEP const wordHashSet initSet(this->coeffsDict_.lookup("initialSet")); forAllConstIter(wordHashSet, initSet, iter) { - searchInitSet_.append(chemistry.mixture().species()[iter.key()]); + searchInitSet_.append(chemistry.thermo().species()[iter.key()]); } if (this->coeffsDict_.found("NGroupBased")) diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/reduction/PFA/PFA.C b/src/thermophysicalModels/chemistryModel/chemistryModel/reduction/PFA/PFA.C index 11e60097ba..f9cecaddcc 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/reduction/PFA/PFA.C +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/reduction/PFA/PFA.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2016-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2016-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -40,7 +40,7 @@ Foam::chemistryReductionMethods::PFA::PFA const wordHashSet initSet(this->coeffsDict_.lookup("initialSet")); forAllConstIter(wordHashSet, initSet, iter) { - searchInitSet_.append(chemistry.mixture().species()[iter.key()]); + searchInitSet_.append(chemistry.thermo().species()[iter.key()]); } } diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/reduction/chemistryReductionMethod/chemistryReductionMethod.C b/src/thermophysicalModels/chemistryModel/chemistryModel/reduction/chemistryReductionMethod/chemistryReductionMethod.C index e3345b9b55..b7571c5d62 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/reduction/chemistryReductionMethod/chemistryReductionMethod.C +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/reduction/chemistryReductionMethod/chemistryReductionMethod.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2021-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2021-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -142,9 +142,9 @@ void Foam::chemistryReductionMethod::endReduceMechanism { stoc[j] = i; ctos[i] = j++; - if (!chemistry_.active(i)) + if (!chemistry_.thermo().speciesActive()[i]) { - chemistry_.setActive(i); + chemistry_.thermo().setSpecieActive(i); } } else diff --git a/src/thermophysicalModels/chemistryModel/functionObjects/specieReactionRates/specieReactionRates.C b/src/thermophysicalModels/chemistryModel/functionObjects/specieReactionRates/specieReactionRates.C index a34e83e230..e17c638332 100644 --- a/src/thermophysicalModels/chemistryModel/functionObjects/specieReactionRates/specieReactionRates.C +++ b/src/thermophysicalModels/chemistryModel/functionObjects/specieReactionRates/specieReactionRates.C @@ -58,7 +58,7 @@ void Foam::functionObjects::specieReactionRates::writeFileHeader(const label i) writeTabbed(file(), "Reaction"); const wordList& speciesNames = - chemistryModel_.thermo().composition().species(); + chemistryModel_.thermo().species(); forAll (speciesNames, si) { diff --git a/src/thermophysicalModels/chemistryModel/odeChemistryModel/odeChemistryModel.C b/src/thermophysicalModels/chemistryModel/odeChemistryModel/odeChemistryModel.C index 5dc6150eb6..493a192589 100644 --- a/src/thermophysicalModels/chemistryModel/odeChemistryModel/odeChemistryModel.C +++ b/src/thermophysicalModels/chemistryModel/odeChemistryModel/odeChemistryModel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -43,7 +43,7 @@ Foam::odeChemistryModel::odeChemistryModel : basicChemistryModel(thermo), ODESystem(), - Yvf_(this->thermo().composition().Y()), + Yvf_(this->thermo().Y()), nSpecie_(Yvf_.size()), reduction_(false), cTos_(nSpecie_, -1), diff --git a/src/thermophysicalModels/laminarFlameSpeed/Gulders/Gulders.C b/src/thermophysicalModels/laminarFlameSpeed/Gulders/Gulders.C index b8a4d045c2..0bc9bf7db8 100644 --- a/src/thermophysicalModels/laminarFlameSpeed/Gulders/Gulders.C +++ b/src/thermophysicalModels/laminarFlameSpeed/Gulders/Gulders.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -196,10 +196,9 @@ Foam::tmp Foam::laminarFlameSpeedModels::Gulders::Su0pTphi Foam::tmp Foam::laminarFlameSpeedModels::Gulders::operator()() const { - if (psiuMulticomponentThermo_.composition().contains("ft")) + if (psiuMulticomponentThermo_.containsSpecie("ft")) { - const volScalarField& ft = - psiuMulticomponentThermo_.composition().Y("ft"); + const volScalarField& ft = psiuMulticomponentThermo_.Y("ft"); return Su0pTphi ( diff --git a/src/thermophysicalModels/laminarFlameSpeed/GuldersEGR/GuldersEGR.C b/src/thermophysicalModels/laminarFlameSpeed/GuldersEGR/GuldersEGR.C index d13ebc5cd9..e00dc03834 100644 --- a/src/thermophysicalModels/laminarFlameSpeed/GuldersEGR/GuldersEGR.C +++ b/src/thermophysicalModels/laminarFlameSpeed/GuldersEGR/GuldersEGR.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -200,8 +200,8 @@ Foam::laminarFlameSpeedModels::GuldersEGR::operator()() const { if ( - psiuMulticomponentThermo_.composition().contains("ft") - && psiuMulticomponentThermo_.composition().contains("egr") + psiuMulticomponentThermo_.containsSpecie("ft") + && psiuMulticomponentThermo_.containsSpecie("egr") ) { return Su0pTphi @@ -215,10 +215,10 @@ Foam::laminarFlameSpeedModels::GuldersEGR::operator()() const psiuMulticomponentThermo_.properties() ) /( - scalar(1)/psiuMulticomponentThermo_.composition().Y("ft") + scalar(1)/psiuMulticomponentThermo_.Y("ft") - scalar(1) ), - psiuMulticomponentThermo_.composition().Y("egr") + psiuMulticomponentThermo_.Y("egr") ); } else diff --git a/src/thermophysicalModels/laminarFlameSpeed/RaviPetersen/RaviPetersen.C b/src/thermophysicalModels/laminarFlameSpeed/RaviPetersen/RaviPetersen.C index fe557103b4..865ade0f33 100644 --- a/src/thermophysicalModels/laminarFlameSpeed/RaviPetersen/RaviPetersen.C +++ b/src/thermophysicalModels/laminarFlameSpeed/RaviPetersen/RaviPetersen.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2013-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -310,10 +310,9 @@ Foam::laminarFlameSpeedModels::RaviPetersen::operator()() const dimensionedScalar(dimless, 0) ); - if (psiuMulticomponentThermo_.composition().contains("ft")) + if (psiuMulticomponentThermo_.containsSpecie("ft")) { - const volScalarField& ft = - psiuMulticomponentThermo_.composition().Y("ft"); + const volScalarField& ft = psiuMulticomponentThermo_.Y("ft"); EqR = dimensionedScalar diff --git a/src/thermophysicalModels/laminarFlameSpeed/laminarFlameSpeed/laminarFlameSpeed.C b/src/thermophysicalModels/laminarFlameSpeed/laminarFlameSpeed/laminarFlameSpeed.C index 7e807d7e38..58ac7bccf8 100644 --- a/src/thermophysicalModels/laminarFlameSpeed/laminarFlameSpeed/laminarFlameSpeed.C +++ b/src/thermophysicalModels/laminarFlameSpeed/laminarFlameSpeed/laminarFlameSpeed.C @@ -47,7 +47,7 @@ Foam::laminarFlameSpeed::laminarFlameSpeed fuel_(dict.lookup("fuel")), equivalenceRatio_(0) { - if (!psiuMulticomponentThermo_.composition().contains("ft")) + if (!psiuMulticomponentThermo_.containsSpecie("ft")) { equivalenceRatio_ = dimensionedScalar("equivalenceRatio", dimless, dict).value(); diff --git a/src/thermophysicalModels/multicomponentThermo/Make/files b/src/thermophysicalModels/multicomponentThermo/Make/files index a1ff0a4902..50c5b315b4 100644 --- a/src/thermophysicalModels/multicomponentThermo/Make/files +++ b/src/thermophysicalModels/multicomponentThermo/Make/files @@ -1,5 +1,4 @@ -mixtures/basicSpecieMixture/basicSpecieMixture.C -mixtures/basicCombustionMixture/basicCombustionMixture.C +multicomponentThermo/multicomponentThermo.C fluidMulticomponentThermo/fluidMulticomponentThermo.C diff --git a/src/thermophysicalModels/multicomponentThermo/fluidMulticomponentThermo/fluidMulticomponentThermo.C b/src/thermophysicalModels/multicomponentThermo/fluidMulticomponentThermo/fluidMulticomponentThermo.C index 74792e70d1..381056f84e 100644 --- a/src/thermophysicalModels/multicomponentThermo/fluidMulticomponentThermo/fluidMulticomponentThermo.C +++ b/src/thermophysicalModels/multicomponentThermo/fluidMulticomponentThermo/fluidMulticomponentThermo.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2020-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2020-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -33,15 +33,6 @@ namespace Foam defineRunTimeSelectionTable(fluidMulticomponentThermo, fvMesh); } -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::fluidMulticomponentThermo::implementation::implementation -( - const fvMesh& mesh, - const word& phaseName -) -{} - // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // @@ -62,8 +53,4 @@ Foam::fluidMulticomponentThermo::~fluidMulticomponentThermo() {} -Foam::fluidMulticomponentThermo::implementation::~implementation() -{} - - // ************************************************************************* // diff --git a/src/thermophysicalModels/multicomponentThermo/fluidMulticomponentThermo/fluidMulticomponentThermo.H b/src/thermophysicalModels/multicomponentThermo/fluidMulticomponentThermo/fluidMulticomponentThermo.H index bb81cf96ef..daeb7cf92c 100644 --- a/src/thermophysicalModels/multicomponentThermo/fluidMulticomponentThermo/fluidMulticomponentThermo.H +++ b/src/thermophysicalModels/multicomponentThermo/fluidMulticomponentThermo/fluidMulticomponentThermo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2020-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2020-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -39,7 +39,7 @@ SourceFiles #define fluidMulticomponentThermo_H #include "fluidThermo.H" -#include "basicSpecieMixture.H" +#include "multicomponentThermo.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -52,16 +52,11 @@ namespace Foam class fluidMulticomponentThermo : - virtual public fluidThermo + virtual public fluidThermo, + virtual public multicomponentThermo { public: - // Public Classes - - //- Forward declare the implementation class - class implementation; - - //- Runtime type information TypeName("fluidMulticomponentThermo"); @@ -93,32 +88,23 @@ public: // Member Functions - //- Return the composition of the multi-component mixture - virtual basicSpecieMixture& composition() = 0; + // Specie transport properties - //- Return the composition of the multi-component mixture - virtual const basicSpecieMixture& composition() const = 0; -}; + //- Dynamic viscosity [kg/m/s] + virtual scalar mui + ( + const label speciei, + const scalar p, + const scalar T + ) const = 0; - -/*---------------------------------------------------------------------------*\ - Class fluidMulticomponentThermo Declaration -\*---------------------------------------------------------------------------*/ - -class fluidMulticomponentThermo::implementation -: - virtual public fluidMulticomponentThermo -{ -public: - - // Constructors - - //- Construct from mesh and phase name - implementation(const fvMesh&, const word& phaseName); - - - //- Destructor - virtual ~implementation(); + //- Dynamic viscosity [kg/m/s] + virtual tmp mui + ( + const label speciei, + const volScalarField& p, + const volScalarField& T + ) const = 0; }; diff --git a/src/thermophysicalModels/multicomponentThermo/fluidMulticomponentThermo/heFluidMulticomponentThermo.C b/src/thermophysicalModels/multicomponentThermo/fluidMulticomponentThermo/heFluidMulticomponentThermo.C new file mode 100644 index 0000000000..f18dc9a74e --- /dev/null +++ b/src/thermophysicalModels/multicomponentThermo/fluidMulticomponentThermo/heFluidMulticomponentThermo.C @@ -0,0 +1,84 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2023 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 "heFluidMulticomponentThermo.H" +#include "fvMesh.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::heFluidMulticomponentThermo::heFluidMulticomponentThermo +( + const fvMesh& mesh, + const word& phaseName +) +: + HeThermo(mesh, phaseName) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template +Foam::heFluidMulticomponentThermo::~heFluidMulticomponentThermo() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +Foam::scalar Foam::heFluidMulticomponentThermo::mui +( + const label speciei, + const scalar p, + const scalar T +) const +{ + return this->specieThermo(speciei).mu(p, T); +} + + +template +Foam::tmp +Foam::heFluidMulticomponentThermo::mui +( + const label speciei, + const volScalarField& p, + const volScalarField& T +) const +{ + return this->volScalarFieldPropertyi + ( + "mu", + dimMass/dimLength/dimTime, + &HeThermo::mixtureType::thermoType::mu, + speciei, + p, + T + ); +} + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/multicomponentThermo/fluidMulticomponentThermo/heFluidMulticomponentThermo.H b/src/thermophysicalModels/multicomponentThermo/fluidMulticomponentThermo/heFluidMulticomponentThermo.H new file mode 100644 index 0000000000..e77fc3ba49 --- /dev/null +++ b/src/thermophysicalModels/multicomponentThermo/fluidMulticomponentThermo/heFluidMulticomponentThermo.H @@ -0,0 +1,114 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2023 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 . + +Class + Foam::heFluidMulticomponentThermo + +Description + Fluid multi-component thermo implementation + +SourceFiles + heFluidMulticomponentThermo.C + +\*---------------------------------------------------------------------------*/ + +#ifndef heFluidMulticomponentThermo_H +#define heFluidMulticomponentThermo_H + +#include "heThermo.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class heFluidMulticomponentThermo Declaration +\*---------------------------------------------------------------------------*/ + +template +class heFluidMulticomponentThermo +: + public HeThermo +{ +public: + + // Constructors + + //- Construct from mesh and phase name + heFluidMulticomponentThermo(const fvMesh&, const word& phaseName); + + //- Disallow default bitwise copy construction + heFluidMulticomponentThermo + ( + const heFluidMulticomponentThermo& + ) = delete; + + + //- Destructor + virtual ~heFluidMulticomponentThermo(); + + + // Member Functions + + // Specie transport properties + + //- Dynamic viscosity [kg/m/s] + virtual scalar mui + ( + const label speciei, + const scalar p, + const scalar T + ) const; + + //- Dynamic viscosity [kg/m/s] + virtual tmp mui + ( + const label speciei, + const volScalarField& p, + const volScalarField& T + ) const; + + + // Member Operators + + //- Disallow default bitwise assignment + void operator=(const heFluidMulticomponentThermo&) = delete; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + +#ifdef NoRepository + #include "heFluidMulticomponentThermo.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/multicomponentThermo/fluidMulticomponentThermo/makeFluidMulticomponentThermo.H b/src/thermophysicalModels/multicomponentThermo/fluidMulticomponentThermo/makeFluidMulticomponentThermo.H new file mode 100644 index 0000000000..8a037fe232 --- /dev/null +++ b/src/thermophysicalModels/multicomponentThermo/fluidMulticomponentThermo/makeFluidMulticomponentThermo.H @@ -0,0 +1,58 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2023 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 . + +\*---------------------------------------------------------------------------*/ + +#ifndef makeFluidMulticomponentThermo_H +#define makeFluidMulticomponentThermo_H + +#include "makeThermo.H" +#include "fluidMulticomponentThermo.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define makeFluidMulticomponentThermo(BaseThermo, Mixture, ThermoPhysics) \ + \ + defineThermo(BaseThermo, Mixture, ThermoPhysics); \ + \ + addThermo(fluidMulticomponentThermo, BaseThermo, Mixture, ThermoPhysics); \ + addThermo(BaseThermo, BaseThermo, Mixture, ThermoPhysics) + + +#define makeFluidMulticomponentThermos( \ + BaseBaseThermo, BaseThermo, Mixture, ThermoPhysics) \ + \ + defineThermo(BaseThermo, Mixture, ThermoPhysics); \ + \ + addThermo(basicThermo, BaseThermo, Mixture, ThermoPhysics); \ + addThermo(fluidThermo, BaseThermo, Mixture, ThermoPhysics); \ + addThermo(BaseBaseThermo, BaseThermo, Mixture, ThermoPhysics); \ + addThermo(fluidMulticomponentThermo, BaseThermo, Mixture, ThermoPhysics); \ + addThermo(BaseThermo, BaseThermo, Mixture, ThermoPhysics) + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/multicomponentThermo/functionObjects/massFractions/massFractions.C b/src/thermophysicalModels/multicomponentThermo/functionObjects/massFractions/massFractions.C index 2210913dfa..1dc7d54b85 100644 --- a/src/thermophysicalModels/multicomponentThermo/functionObjects/massFractions/massFractions.C +++ b/src/thermophysicalModels/multicomponentThermo/functionObjects/massFractions/massFractions.C @@ -123,7 +123,7 @@ bool Foam::functionObjects::massFractions::execute() autoPtr thermoPtr = fluidMulticomponentThermo::New(mesh_); fluidMulticomponentThermo& thermo = thermoPtr(); - const PtrList& Y = thermo.composition().Y(); + const PtrList& Y = thermo.Y(); // Restore the original Ydefault if it exists, and create a new Ydefault if // it does not @@ -157,7 +157,7 @@ bool Foam::functionObjects::massFractions::execute() forAll(Y, i) { W[i].dimensions().reset(dimMass/dimMoles); - W[i].value() = thermo.composition().Wi(i); + W[i].value() = thermo.Wi(i); typeIOobject YIo ( @@ -214,7 +214,7 @@ bool Foam::functionObjects::massFractions::execute() } // Steal the thermo's mass fraction fields and delete the thermo - Y_.transfer(thermo.composition().Y()); + Y_.transfer(thermo.Y()); thermoPtr.clear(); // Divide the specie masses by the total mass to get the mass fractions diff --git a/src/thermophysicalModels/multicomponentThermo/functionObjects/moleFractions/moleFractions.C b/src/thermophysicalModels/multicomponentThermo/functionObjects/moleFractions/moleFractions.C index ced413272a..ff6d9b3ddb 100644 --- a/src/thermophysicalModels/multicomponentThermo/functionObjects/moleFractions/moleFractions.C +++ b/src/thermophysicalModels/multicomponentThermo/functionObjects/moleFractions/moleFractions.C @@ -85,7 +85,7 @@ bool Foam::functionObjects::moleFractions::execute() mesh_.lookupObject(thermoName); // Construct mole fraction fields corresponding to the mass fraction fields - const PtrList& Y = thermo.composition().Y(); + const PtrList& Y = thermo.Y(); if (X_.empty()) { X_.setSize(Y.size()); @@ -120,7 +120,7 @@ bool Foam::functionObjects::moleFractions::execute() ( "Wi", dimMass/dimMoles, - thermo.composition().Wi(i) + thermo.Wi(i) ); X_[i] = Y[i]*W/Wi; diff --git a/src/thermophysicalModels/multicomponentThermo/include/FieldListSlice.H b/src/thermophysicalModels/multicomponentThermo/include/FieldListSlice.H new file mode 100644 index 0000000000..2d05120bd9 --- /dev/null +++ b/src/thermophysicalModels/multicomponentThermo/include/FieldListSlice.H @@ -0,0 +1,111 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2023 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 . + +Class + Foam::FieldListSlice + +Description + Class to provide a list-like interface to a slice through a PtrList of + fields + +\*---------------------------------------------------------------------------*/ + +#ifndef FieldListSlice_H +#define FieldListSlice_H + +#include "Field.H" +#include "fieldTypes.H" +#include "PtrList.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class FieldListSlice Declaration +\*---------------------------------------------------------------------------*/ + +template +class FieldListSlice +{ + // Private Data + + //- Reference to the fields + const UPtrList>& fields_; + + //- Element index + const label elementi_; + + +public: + + // Constructors + + //- Construct from a list of fields and an element index + inline FieldListSlice + ( + const UPtrList>& fields, + const label elementi + ) + : + fields_(fields), + elementi_(elementi) + {} + + + // Member Functions + + //- Return the size of the slice + inline label size() const + { + return fields_.size(); + } + + + // Member Operators + + //- Access an element + inline const Type& operator[](const label fieldi) const + { + return fields_[fieldi][elementi_]; + } +}; + + +//- Define scalarFieldListSlice, vectorFieldListSlice, etc... +#define typedefTypeFieldListSlice(Type, nullArg) \ + typedef FieldListSlice Type##FieldListSlice; +FOR_ALL_FIELD_TYPES(typedefTypeFieldListSlice); +#undef typedefTypeFieldListSlice + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/multicomponentThermo/include/GeometricFieldListSlicer.H b/src/thermophysicalModels/multicomponentThermo/include/GeometricFieldListSlicer.H new file mode 100644 index 0000000000..072323c48e --- /dev/null +++ b/src/thermophysicalModels/multicomponentThermo/include/GeometricFieldListSlicer.H @@ -0,0 +1,153 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2023 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 . + +Class + Foam::GeometricFieldListSlicer + +Description + Class to provide list slices to different parts of a geometric field + +See also + Foam::FieldListSlice + +\*---------------------------------------------------------------------------*/ + +#ifndef GeometricFieldListSlicer_H +#define GeometricFieldListSlicer_H + +#include "GeometricField.H" +#include "FieldListSlice.H" +#include "volFieldsFwd.H" +#include "surfaceFieldsFwd.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ +/*---------------------------------------------------------------------------*\ + Class GeometricFieldListSlicer Declaration +\*---------------------------------------------------------------------------*/ + +template class PatchField, class GeoMesh> +class GeometricFieldListSlicer +{ + // Private Typedefs + + // Type of the geometric field + typedef GeometricField geoFieldType; + + // Private Data + + //- Pointers to the internal fields + UPtrList> fields_; + + //- Pointers to the patch fields. Indexed by patch, then by field. + List>> patchFields_; + + +public: + + // Constructors + + //- Construct null. Set later. + inline GeometricFieldListSlicer() + {} + + //- Construct from a list of fields + inline GeometricFieldListSlicer(const PtrList& geoFields) + { + set(geoFields); + } + + + // Member Functions + + //- Set the field pointers + inline void set(const PtrList& geoFields) + { + fields_.resize(geoFields.size()); + + patchFields_.resize(geoFields[0].boundaryField().size(), fields_); + + forAll(geoFields, fieldi) + { + fields_.set + ( + fieldi, + &geoFields[fieldi].primitiveField() + ); + + forAll(geoFields[fieldi].boundaryField(), patchi) + { + patchFields_[patchi].set + ( + fieldi, + &geoFields[fieldi].boundaryField()[patchi] + ); + } + } + } + + //- Return a slice for an internal element + inline FieldListSlice slice(const label elementi) const + { + return FieldListSlice(fields_, elementi); + } + + //- Return a slice for a patch element + inline FieldListSlice patchSlice + ( + const label patchi, + const label patchElementi + ) const + { + return FieldListSlice(patchFields_[patchi], patchElementi); + } +}; + + +//- Define volScalarFieldListSlicer, volVectorFieldListSlicer, etc... +#define typedefVolTypeFieldListSlicer(Type, nullArg) \ + typedef GeometricFieldListSlicer \ + CAT3(vol, CAPITALIZE(Type), FieldListSlicer); +FOR_ALL_FIELD_TYPES(typedefVolTypeFieldListSlicer); +#undef typedefVolTypeFieldListSlicer + + +//- Define surfaceScalarFieldListSlicer, surfaceVectorFieldListSlicer, etc... +#define typedefSurfaceTypeFieldListSlicer(Type, nullArg) \ + typedef GeometricFieldListSlicer \ + CAT3(surface, CAPITALIZE(Type), FieldListSlicer); +FOR_ALL_FIELD_TYPES(typedefSurfaceTypeFieldListSlicer); +#undef typedefSurfaceTypeFieldListSlicer + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/multicomponentThermo/makeMulticomponentThermo.H b/src/thermophysicalModels/multicomponentThermo/makeMulticomponentThermo.H deleted file mode 100644 index fa574edf42..0000000000 --- a/src/thermophysicalModels/multicomponentThermo/makeMulticomponentThermo.H +++ /dev/null @@ -1,129 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 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 . - -\*---------------------------------------------------------------------------*/ - -#ifndef makeMulticomponentThermo_H -#define makeMulticomponentThermo_H - -#include "makeThermo.H" -#include "SpecieMixture.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#define defineMulticomponentThermo( \ - BaseMulticomponentThermo, CThermo, Mixture, ThermoPhys) \ - \ - typedef CThermo \ - < \ - BaseMulticomponentThermo::composite, \ - SpecieMixture \ - < \ - Mixture \ - < \ - ThermoPhys \ - > \ - > \ - > CThermo##Mixture##ThermoPhys; \ - \ - defineTemplateTypeNameAndDebugWithName \ - ( \ - CThermo##Mixture##ThermoPhys, \ - ( \ - word(CThermo##Mixture##ThermoPhys::typeName_()) + "<" \ - + Mixture::typeName() + ">" \ - ).c_str(), \ - 0 \ - ) - - -#define addMulticomponentThermo( \ - BaseMulticomponentThermo, CThermo, Mixture, ThermoPhys) \ - \ - addThermo(BaseMulticomponentThermo, CThermo, Mixture, ThermoPhys) - - -#define makeMulticomponentThermo( \ - BaseMulticomponentThermo, CThermo, Mixture, ThermoPhys) \ - \ - defineMulticomponentThermo \ - (BaseMulticomponentThermo, CThermo, Mixture, ThermoPhys); \ - \ - addMulticomponentThermo \ - (fluidMulticomponentThermo, CThermo, Mixture, ThermoPhys); \ - \ - addMulticomponentThermo \ - (BaseMulticomponentThermo, CThermo, Mixture, ThermoPhys) - - -#define makeMulticomponentThermos( \ - BaseThermo, BaseMulticomponentThermo, CThermo, Mixture, ThermoPhys) \ - \ - defineMulticomponentThermo \ - (BaseMulticomponentThermo, CThermo, Mixture, ThermoPhys); \ - \ - addMulticomponentThermo(basicThermo, CThermo, Mixture, ThermoPhys); \ - addMulticomponentThermo(fluidThermo, CThermo, Mixture, ThermoPhys); \ - addMulticomponentThermo(BaseThermo, CThermo, Mixture, ThermoPhys); \ - \ - addMulticomponentThermo \ - (fluidMulticomponentThermo, CThermo, Mixture, ThermoPhys); \ - \ - addMulticomponentThermo \ - (BaseMulticomponentThermo, CThermo, Mixture, ThermoPhys) - - -#define makePsiuMulticomponentThermo(Mixture, ThermoPhys) \ - \ - defineMulticomponentThermo \ - ( \ - psiuMulticomponentThermo, \ - heheuPsiThermo, \ - Mixture, \ - ThermoPhys \ - ); \ - \ - addThermo(psiuMulticomponentThermo, heheuPsiThermo, Mixture, ThermoPhys) - - -#define makePsiuMulticomponentThermos(Mixture, ThermoPhys) \ - \ - defineMulticomponentThermo \ - ( \ - psiuMulticomponentThermo, \ - heheuPsiThermo, \ - Mixture, \ - ThermoPhys \ - ); \ - \ - addThermo(basicThermo, heheuPsiThermo, Mixture, ThermoPhys); \ - addThermo(fluidThermo, heheuPsiThermo, Mixture, ThermoPhys); \ - addThermo(psiThermo, heheuPsiThermo, Mixture, ThermoPhys); \ - addThermo(psiuMulticomponentThermo, heheuPsiThermo, Mixture, ThermoPhys) - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/thermophysicalModels/multicomponentThermo/mixtures/basicSpecieMixture/basicSpecieMixtureI.H b/src/thermophysicalModels/multicomponentThermo/mixtures/basicSpecieMixture/basicSpecieMixtureI.H deleted file mode 100644 index 58bd99e3d4..0000000000 --- a/src/thermophysicalModels/multicomponentThermo/mixtures/basicSpecieMixture/basicSpecieMixtureI.H +++ /dev/null @@ -1,131 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2023 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 . - -\*---------------------------------------------------------------------------*/ - -inline const Foam::speciesTable& Foam::basicSpecieMixture::species() const -{ - return species_; -} - - -inline bool Foam::basicSpecieMixture::contains(const word& specieName) const -{ - return species_.found(specieName); -} - - -inline Foam::label Foam::basicSpecieMixture::defaultSpecie() const -{ - return defaultSpecieIndex_; -} - - -inline bool Foam::basicSpecieMixture::active(label speciei) const -{ - return active_[speciei]; -} - - -inline const Foam::List& Foam::basicSpecieMixture::active() const -{ - return active_; -} - - -inline void Foam::basicSpecieMixture::setActive(label speciei) const -{ - active_[speciei] = true; - const_cast(Y_[speciei]).writeOpt() = IOobject::AUTO_WRITE; -} - - -inline void Foam::basicSpecieMixture::setInactive(label speciei) const -{ - active_[speciei] = false; - const_cast(Y_[speciei]).writeOpt() = IOobject::NO_WRITE; -} - - -inline bool Foam::basicSpecieMixture::solve(label speciei) const -{ - return speciei != defaultSpecieIndex_ && active_[speciei]; -} - - -inline Foam::PtrList& Foam::basicSpecieMixture::Y() -{ - return Y_; -} - - -inline const Foam::PtrList& -Foam::basicSpecieMixture::Y() const -{ - return Y_; -} - - -inline Foam::volScalarField& Foam::basicSpecieMixture::Y(const label i) -{ - return Y_[i]; -} - - -inline const Foam::volScalarField& Foam::basicSpecieMixture::Y -( - const label i -) const -{ - return Y_[i]; -} - - -inline Foam::volScalarField& Foam::basicSpecieMixture::Y -( - const word& specieName -) -{ - return Y_[species_[specieName]]; -} - - -inline const Foam::volScalarField& Foam::basicSpecieMixture::Y -( - const word& specieName -) const -{ - return Y_[species_[specieName]]; -} - - -inline Foam::label Foam::basicSpecieMixture::index -( - const volScalarField& Yi -) const -{ - return species_[Yi.member()]; -} - - -// ************************************************************************* // diff --git a/src/thermophysicalModels/multicomponentThermo/mixtures/coefficientMulticomponentMixture/coefficientMulticomponentMixture.C b/src/thermophysicalModels/multicomponentThermo/mixtures/coefficientMulticomponentMixture/coefficientMulticomponentMixture.C index 2a33b3f573..a5343a508b 100644 --- a/src/thermophysicalModels/multicomponentThermo/mixtures/coefficientMulticomponentMixture/coefficientMulticomponentMixture.C +++ b/src/thermophysicalModels/multicomponentThermo/mixtures/coefficientMulticomponentMixture/coefficientMulticomponentMixture.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2020-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2020-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -31,17 +31,10 @@ template Foam::coefficientMulticomponentMixture:: coefficientMulticomponentMixture ( - const dictionary& thermoDict, - const fvMesh& mesh, - const word& phaseName + const dictionary& dict ) : - multicomponentMixture - ( - thermoDict, - mesh, - phaseName - ), + multicomponentMixture(dict), mixture_("mixture", this->specieThermos()[0]) {} @@ -51,16 +44,16 @@ coefficientMulticomponentMixture template const typename Foam::coefficientMulticomponentMixture::thermoMixtureType& -Foam::coefficientMulticomponentMixture::cellThermoMixture +Foam::coefficientMulticomponentMixture::thermoMixture ( - const label celli + const scalarFieldListSlice& Y ) const { - mixture_ = this->Y()[0][celli]*this->specieThermos()[0]; + mixture_ = Y[0]*this->specieThermos()[0]; - for (label i=1; iY().size(); i++) + for (label i=1; iY()[i][celli]*this->specieThermos()[i]; + mixture_ += Y[i]*this->specieThermos()[i]; } return mixture_; @@ -69,25 +62,26 @@ Foam::coefficientMulticomponentMixture::cellThermoMixture template const typename -Foam::coefficientMulticomponentMixture::thermoMixtureType& -Foam::coefficientMulticomponentMixture::patchFaceThermoMixture +Foam::coefficientMulticomponentMixture::transportMixtureType& +Foam::coefficientMulticomponentMixture::transportMixture ( - const label patchi, - const label facei + const scalarFieldListSlice& Y ) const { - mixture_ = - this->Y()[0].boundaryField()[patchi][facei] - *this->specieThermos()[0]; + return thermoMixture(Y); +} - for (label i=1; iY().size(); i++) - { - mixture_ += - this->Y()[i].boundaryField()[patchi][facei] - *this->specieThermos()[i]; - } - return mixture_; +template +const typename +Foam::coefficientMulticomponentMixture::transportMixtureType& +Foam::coefficientMulticomponentMixture::transportMixture +( + const scalarFieldListSlice&, + const thermoMixtureType& mixture +) const +{ + return mixture; } diff --git a/src/thermophysicalModels/multicomponentThermo/mixtures/coefficientMulticomponentMixture/coefficientMulticomponentMixture.H b/src/thermophysicalModels/multicomponentThermo/mixtures/coefficientMulticomponentMixture/coefficientMulticomponentMixture.H index 87b3e1bdf2..1b1ba3dcb7 100644 --- a/src/thermophysicalModels/multicomponentThermo/mixtures/coefficientMulticomponentMixture/coefficientMulticomponentMixture.H +++ b/src/thermophysicalModels/multicomponentThermo/mixtures/coefficientMulticomponentMixture/coefficientMulticomponentMixture.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2020-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2020-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -37,6 +37,7 @@ SourceFiles #define coefficientMulticomponentMixture_H #include "multicomponentMixture.H" +#include "FieldListSlice.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -52,14 +53,15 @@ class coefficientMulticomponentMixture : public multicomponentMixture { - public: - //- Mixing type for thermodynamic properties - typedef ThermoType thermoMixtureType; + // Public Typedefs - //- Mixing type for transport properties - typedef ThermoType transportMixtureType; + //- Mixing type for thermodynamic properties + typedef ThermoType thermoMixtureType; + + //- Mixing type for transport properties + typedef ThermoType transportMixtureType; private: @@ -74,13 +76,8 @@ public: // Constructors - //- Construct from dictionary, mesh and phase name - coefficientMulticomponentMixture - ( - const dictionary&, - const fvMesh&, - const word& - ); + //- Construct from a dictionary + coefficientMulticomponentMixture(const dictionary&); //- Disallow default bitwise copy construction coefficientMulticomponentMixture @@ -102,49 +99,24 @@ public: return "multicomponentMixture<" + ThermoType::typeName() + '>'; } - const thermoMixtureType& cellThermoMixture(const label celli) const; - - const thermoMixtureType& patchFaceThermoMixture + //- Return the mixture for thermodynamic properties + const thermoMixtureType& thermoMixture ( - const label patchi, - const label facei + const scalarFieldListSlice& ) const; - const transportMixtureType& cellTransportMixture + //- Return the mixture for transport properties + const transportMixtureType& transportMixture ( - const label celli - ) const - { - return cellThermoMixture(celli); - } + const scalarFieldListSlice& + ) const; - const transportMixtureType& patchFaceTransportMixture + //- Return the mixture for transport properties + const transportMixtureType& transportMixture ( - const label patchi, - const label facei - ) const - { - return patchFaceThermoMixture(patchi, facei); - } - - const transportMixtureType& cellTransportMixture - ( - const label, - const thermoMixtureType& thermoMixture - ) const - { - return thermoMixture; - } - - const transportMixtureType& patchFaceTransportMixture - ( - const label, - const label, - const thermoMixtureType& thermoMixture - ) const - { - return thermoMixture; - } + const scalarFieldListSlice&, + const thermoMixtureType& + ) const; }; diff --git a/src/thermophysicalModels/multicomponentThermo/mixtures/coefficientWilkeMulticomponentMixture/coefficientWilkeMulticomponentMixture.C b/src/thermophysicalModels/multicomponentThermo/mixtures/coefficientWilkeMulticomponentMixture/coefficientWilkeMulticomponentMixture.C index 4d9b7ec7a1..e2040560a4 100644 --- a/src/thermophysicalModels/multicomponentThermo/mixtures/coefficientWilkeMulticomponentMixture/coefficientWilkeMulticomponentMixture.C +++ b/src/thermophysicalModels/multicomponentThermo/mixtures/coefficientWilkeMulticomponentMixture/coefficientWilkeMulticomponentMixture.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2020-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2020-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,67 +25,11 @@ License #include "coefficientWilkeMulticomponentMixture.H" -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // template -Foam::coefficientWilkeMulticomponentMixture:: -coefficientWilkeMulticomponentMixture -( - const dictionary& thermoDict, - const fvMesh& mesh, - const word& phaseName -) -: - multicomponentMixture - ( - thermoDict, - mesh, - phaseName - ), - mixture_("mixture", this->specieThermos()[0]), - transportMixture_(this->specieThermos()) -{} - - -template -Foam::coefficientWilkeMulticomponentMixture::transportMixture:: -transportMixture -( - const PtrList& specieThermos -) -: - specieThermos_(specieThermos), - M_(specieThermos.size()), - A_(specieThermos.size()), - B_(specieThermos.size()), - X_(specieThermos.size()), - mu_(specieThermos.size()), - w_(specieThermos.size()), - muCached_(false) -{ - forAll(specieThermos_, i) - { - M_[i] = specieThermos[i].W(); - } - - forAll(M_, i) - { - forAll(M_, j) - { - if (i != j) - { - A_(i, j) = ((4/sqrt(2.0))*sqrt(1 + M_[i]/M_[j])); - B_(i, j) = sqrt(M_[j]/M_[i]); - } - } - } -} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -template -void Foam::coefficientWilkeMulticomponentMixture::transportMixture:: +void +Foam::coefficientWilkeMulticomponentMixture::transportMixtureType:: WilkeWeights ( scalar p, @@ -121,9 +65,62 @@ WilkeWeights } + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::coefficientWilkeMulticomponentMixture:: +coefficientWilkeMulticomponentMixture +( + const dictionary& dict +) +: + multicomponentMixture(dict), + mixture_("mixture", this->specieThermos()[0]), + transportMixture_(this->specieThermos()) +{} + + +template +Foam::coefficientWilkeMulticomponentMixture::transportMixtureType:: +transportMixtureType +( + const PtrList& specieThermos +) +: + specieThermos_(specieThermos), + M_(specieThermos.size()), + A_(specieThermos.size()), + B_(specieThermos.size()), + X_(specieThermos.size()), + mu_(specieThermos.size()), + w_(specieThermos.size()), + muCached_(false) +{ + forAll(specieThermos_, i) + { + M_[i] = specieThermos[i].W(); + } + + forAll(M_, i) + { + forAll(M_, j) + { + if (i != j) + { + A_(i, j) = ((4/sqrt(2.0))*sqrt(1 + M_[i]/M_[j])); + B_(i, j) = sqrt(M_[j]/M_[i]); + } + } + } +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + template Foam::scalar -Foam::coefficientWilkeMulticomponentMixture::transportMixture:: +Foam::coefficientWilkeMulticomponentMixture::transportMixtureType:: mu ( scalar p, @@ -144,7 +141,7 @@ mu template Foam::scalar -Foam::coefficientWilkeMulticomponentMixture::transportMixture:: +Foam::coefficientWilkeMulticomponentMixture::transportMixtureType:: kappa ( scalar p, @@ -169,40 +166,16 @@ kappa template const typename Foam::coefficientWilkeMulticomponentMixture::thermoMixtureType& -Foam::coefficientWilkeMulticomponentMixture::cellThermoMixture +Foam::coefficientWilkeMulticomponentMixture::thermoMixture ( - const label celli + const scalarFieldListSlice& Y ) const { - mixture_ = this->Y()[0][celli]*this->specieThermos()[0]; + mixture_ = Y[0]*this->specieThermos()[0]; - for (label i=1; iY().size(); i++) + for (label i=1; iY()[i][celli]*this->specieThermos()[i]; - } - - return mixture_; -} - - -template -const typename -Foam::coefficientWilkeMulticomponentMixture::thermoMixtureType& -Foam::coefficientWilkeMulticomponentMixture::patchFaceThermoMixture -( - const label patchi, - const label facei -) const -{ - mixture_ = - this->Y()[0].boundaryField()[patchi][facei] - *this->specieThermos()[0]; - - for (label i=1; iY().size(); i++) - { - mixture_ += - this->Y()[i].boundaryField()[patchi][facei] - *this->specieThermos()[i]; + mixture_ += Y[i]*this->specieThermos()[i]; } return mixture_; @@ -212,26 +185,24 @@ Foam::coefficientWilkeMulticomponentMixture::patchFaceThermoMixture template const typename Foam::coefficientWilkeMulticomponentMixture::transportMixtureType& -Foam::coefficientWilkeMulticomponentMixture::cellTransportMixture +Foam::coefficientWilkeMulticomponentMixture::transportMixture ( - const label celli + const scalarFieldListSlice& Y ) const { transportMixture_.muCached_ = false; - scalarList& X = transportMixture_.X_; - scalar sumX = 0; - forAll(X, i) + forAll(Y, i) { - X[i] = this->Y()[i][celli]/this->specieThermos()[i].W(); - sumX += X[i]; + transportMixture_.X_[i] = Y[i]/this->specieThermos()[i].W(); + sumX += transportMixture_.X_[i]; } - forAll(X, i) + forAll(Y, i) { - X[i] /= sumX; + transportMixture_.X_[i] /= sumX; } return transportMixture_; @@ -241,63 +212,13 @@ Foam::coefficientWilkeMulticomponentMixture::cellTransportMixture template const typename Foam::coefficientWilkeMulticomponentMixture::transportMixtureType& -Foam::coefficientWilkeMulticomponentMixture:: -patchFaceTransportMixture +Foam::coefficientWilkeMulticomponentMixture::transportMixture ( - const label patchi, - const label facei + const scalarFieldListSlice& Y, + const thermoMixtureType& ) const { - transportMixture_.muCached_ = false; - - scalarList& X = transportMixture_.X_; - - scalar sumX = 0; - - forAll(X, i) - { - X[i] = - this->Y()[i].boundaryField()[patchi][facei] - /this->specieThermos()[i].W(); - sumX += X[i]; - } - - forAll(X, i) - { - X[i] /= sumX; - } - - return transportMixture_; -} - -template -const typename -Foam::coefficientWilkeMulticomponentMixture::transportMixtureType& -Foam::coefficientWilkeMulticomponentMixture:: -cellTransportMixture -( - const label celli, - const thermoMixtureType& thermoMixture -) const -{ - cellTransportMixture(celli); - transportMixture_.muCached_ = true; - return transportMixture_; -} - - -template -const typename -Foam::coefficientWilkeMulticomponentMixture::transportMixtureType& -Foam::coefficientWilkeMulticomponentMixture:: -patchFaceTransportMixture -( - const label patchi, - const label facei, - const thermoMixtureType& thermoMixture -) const -{ - patchFaceTransportMixture(patchi, facei); + transportMixture(Y); transportMixture_.muCached_ = true; return transportMixture_; } diff --git a/src/thermophysicalModels/multicomponentThermo/mixtures/coefficientWilkeMulticomponentMixture/coefficientWilkeMulticomponentMixture.H b/src/thermophysicalModels/multicomponentThermo/mixtures/coefficientWilkeMulticomponentMixture/coefficientWilkeMulticomponentMixture.H index dd2cfc3b6d..5fdefa4fff 100644 --- a/src/thermophysicalModels/multicomponentThermo/mixtures/coefficientWilkeMulticomponentMixture/coefficientWilkeMulticomponentMixture.H +++ b/src/thermophysicalModels/multicomponentThermo/mixtures/coefficientWilkeMulticomponentMixture/coefficientWilkeMulticomponentMixture.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2020-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2020-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -45,6 +45,7 @@ SourceFiles #define coefficientWilkeMulticomponentMixture_H #include "multicomponentMixture.H" +#include "FieldListSlice.H" #include "scalarMatrices.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -61,68 +62,66 @@ class coefficientWilkeMulticomponentMixture : public multicomponentMixture { - public: - class transportMixture - { - //- List of specie thermo - const PtrList& specieThermos_; + // Public Classes/Typedefs - //- List of molecular weights - scalarList M_; + //- Mixing type for thermodynamic properties + typedef typename ThermoType::thermoType thermoMixtureType; - //- Matrix of (4/sqrt(2.0))*sqrt(1 + M_[i]/M_[j]) - scalarSquareMatrix A_; + //- Mixing type for transport properties + class transportMixtureType + { + // Private Data - //- Matrix of sqrt(M_[j]/M_[i]) - scalarSquareMatrix B_; + //- List of specie thermo + const PtrList& specieThermos_; - //- List of mole fractions - mutable scalarList X_; + //- List of molecular weights + scalarList M_; - //- List of specie viscosities - mutable scalarList mu_; + //- Matrix of (4/sqrt(2.0))*sqrt(1 + M_[i]/M_[j]) + scalarSquareMatrix A_; - //- List of Wilke weights - mutable scalarList w_; + //- Matrix of sqrt(M_[j]/M_[i]) + scalarSquareMatrix B_; - //- mu cache state to avoid recalculation of the Wilke weight for kappa - mutable bool muCached_; + //- List of mole fractions + mutable scalarList X_; - //- Calculate the Wilke weights and store in w_ - void WilkeWeights(const scalar p, const scalar T) const; + //- List of specie viscosities + mutable scalarList mu_; + + //- List of Wilke weights + mutable scalarList w_; + + //- Viscosity cache state to avoid recalculation of the Wilke + // weight for kappa + mutable bool muCached_; + + //- Calculate the Wilke weights and store in w_ + void WilkeWeights(const scalar p, const scalar T) const; - public: + public: - friend class coefficientWilkeMulticomponentMixture; - - // Constructors - - transportMixture - ( - const PtrList& specieThermos - ); + friend class coefficientWilkeMulticomponentMixture; - // Transport properties + // Constructors - //- Dynamic viscosity [kg/m/s] - scalar mu(const scalar p, const scalar T) const; - - //- Thermal conductivity [W/m/K] - scalar kappa(const scalar p, const scalar T) const; - }; + //- Construct from list of specie thermo + transportMixtureType(const PtrList& specieThermos); -public: + // Transport properties - //- Mixing type for thermodynamic properties - typedef typename ThermoType::thermoType thermoMixtureType; + //- Dynamic viscosity [kg/m/s] + scalar mu(const scalar p, const scalar T) const; - //- Mixing type for transport properties - typedef transportMixture transportMixtureType; + //- Thermal conductivity [W/m/K] + scalar kappa(const scalar p, const scalar T) const; + }; private: @@ -140,13 +139,8 @@ public: // Constructors - //- Construct from dictionary, mesh and phase name - coefficientWilkeMulticomponentMixture - ( - const dictionary&, - const fvMesh&, - const word& - ); + //- Construct from a dictionary + coefficientWilkeMulticomponentMixture(const dictionary&); //- Disallow default bitwise copy construction coefficientWilkeMulticomponentMixture @@ -170,36 +164,23 @@ public: + ThermoType::typeName() + '>'; } - const thermoMixtureType& cellThermoMixture(const label celli) const; - - const thermoMixtureType& patchFaceThermoMixture + //- Return the mixture for thermodynamic properties + const thermoMixtureType& thermoMixture ( - const label patchi, - const label facei + const scalarFieldListSlice& ) const; - const transportMixtureType& cellTransportMixture + //- Return the mixture for transport properties + const transportMixtureType& transportMixture ( - const label celli + const scalarFieldListSlice& ) const; - const transportMixtureType& patchFaceTransportMixture + //- Return the mixture for transport properties + const transportMixtureType& transportMixture ( - const label patchi, - const label facei - ) const; - - const transportMixtureType& cellTransportMixture - ( - const label celli, - const thermoMixtureType& thermoMixture - ) const; - - const transportMixtureType& patchFaceTransportMixture - ( - const label patchi, - const label facei, - const thermoMixtureType& thermoMixture + const scalarFieldListSlice&, + const thermoMixtureType& ) const; }; diff --git a/src/thermophysicalModels/multicomponentThermo/mixtures/egrMixture/egrMixture.C b/src/thermophysicalModels/multicomponentThermo/mixtures/egrMixture/egrMixture.C index 31cdb697dd..891831ad8e 100644 --- a/src/thermophysicalModels/multicomponentThermo/mixtures/egrMixture/egrMixture.C +++ b/src/thermophysicalModels/multicomponentThermo/mixtures/egrMixture/egrMixture.C @@ -25,41 +25,16 @@ License #include "egrMixture.H" -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -template -const char* Foam::egrMixture::specieNames_[3] = {"ft", "b", "egr"}; - - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template -Foam::egrMixture::egrMixture -( - const dictionary& thermoDict, - const fvMesh& mesh, - const word& phaseName -) +Foam::egrMixture::egrMixture(const dictionary& dict) : - basicCombustionMixture - ( - thermoDict, - speciesTable(nSpecies_, specieNames_), - mesh, - phaseName - ), - - stoicRatio_("stoichiometricAirFuelMassRatio", dimless, thermoDict), - - fuel_("fuel", thermoDict.subDict("fuel")), - oxidant_("oxidant", thermoDict.subDict("oxidant")), - products_("burntProducts", thermoDict.subDict("burntProducts")), - - mixture_("mixture", fuel_), - - ft_(Y("ft")), - b_(Y("b")), - egr_(Y("egr")) + stoicRatio_("stoichiometricAirFuelMassRatio", dimless, dict), + fuel_("fuel", dict.subDict("fuel")), + oxidant_("oxidant", dict.subDict("oxidant")), + products_("burntProducts", dict.subDict("burntProducts")), + mixture_("mixture", fuel_) {} @@ -79,12 +54,11 @@ const ThermoType& Foam::egrMixture::mixture } else { + scalar fu = b*ft + (1 - b)*fres(ft); + scalar ox = 1 - ft - (ft - fu)*stoicRatio_.value(); - scalar fu = b*ft + (1.0 - b)*fres(ft, stoicRatio().value()); - scalar ox = 1 - ft - (ft - fu)*stoicRatio().value(); - - fu *= (1.0 - egr); - ox *= (1.0 - egr); + fu *= 1 - egr; + ox *= 1 - egr; const scalar pr = 1 - fu - ox; @@ -98,48 +72,64 @@ const ThermoType& Foam::egrMixture::mixture template -void Foam::egrMixture::read(const dictionary& thermoDict) +const typename Foam::egrMixture::thermoMixtureType& +Foam::egrMixture::thermoMixture +( + const scalarFieldListSlice& Y +) const { - stoicRatio_ = dimensionedScalar - ( - "stoichiometricAirFuelMassRatio", - dimless, - thermoDict - ); - - fuel_ = ThermoType("fuel", thermoDict.subDict("fuel")); - oxidant_ = ThermoType("oxidant", thermoDict.subDict("oxidant")); - products_ = - ThermoType("burntProducts", thermoDict.subDict("burntProducts")); + return mixture(Y[FT], Y[B], Y[EGR]); } template -const ThermoType& Foam::egrMixture::specieThermo +const typename Foam::egrMixture::transportMixtureType& +Foam::egrMixture::transportMixture ( - const label speciei + const scalarFieldListSlice& Y ) const { - if (speciei == 0) - { - return fuel_; - } - else if (speciei == 1) - { - return oxidant_; - } - else if (speciei == 2) - { - return products_; - } - else - { - FatalErrorInFunction - << "Unknown specie index " << speciei << ". Valid indices are 0..2" - << abort(FatalError); + return mixture(Y[FT], Y[B], Y[EGR]); +} - return fuel_; - } + +template +const typename Foam::egrMixture::transportMixtureType& +Foam::egrMixture::transportMixture +( + const scalarFieldListSlice&, + const thermoMixtureType& mixture +) const +{ + return mixture; +} + + +template +const typename Foam::egrMixture::thermoType& +Foam::egrMixture::reactants(const scalarFieldListSlice& Y) const +{ + return mixture(Y[FT], 1, Y[EGR]); +} + + +template +const typename Foam::egrMixture::thermoType& +Foam::egrMixture::products(const scalarFieldListSlice& Y) const +{ + return mixture(Y[FT], 0, 0); +} + + +template +void Foam::egrMixture::read(const dictionary& dict) +{ + stoicRatio_ = + dimensionedScalar("stoichiometricAirFuelMassRatio", dimless, dict); + + fuel_ = ThermoType("fuel", dict.subDict("fuel")); + oxidant_ = ThermoType("oxidant", dict.subDict("oxidant")); + products_ = ThermoType("burntProducts", dict.subDict("burntProducts")); } diff --git a/src/thermophysicalModels/multicomponentThermo/mixtures/egrMixture/egrMixture.H b/src/thermophysicalModels/multicomponentThermo/mixtures/egrMixture/egrMixture.H index dbc417809b..d316d3b423 100644 --- a/src/thermophysicalModels/multicomponentThermo/mixtures/egrMixture/egrMixture.H +++ b/src/thermophysicalModels/multicomponentThermo/mixtures/egrMixture/egrMixture.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -35,7 +35,8 @@ SourceFiles #ifndef egrMixture_H #define egrMixture_H -#include "basicCombustionMixture.H" +#include "dimensionedTypes.H" +#include "FieldListSlice.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -48,53 +49,53 @@ namespace Foam template class egrMixture -: - public basicCombustionMixture { - public: - //- The type of thermodynamics this mixture is instantiated for - typedef ThermoType thermoType; + // Public Typedefs - //- Mixing type for thermodynamic properties - typedef ThermoType thermoMixtureType; + //- The type of thermodynamics this mixture is instantiated for + typedef ThermoType thermoType; - //- Mixing type for transport properties - typedef ThermoType transportMixtureType; + //- Mixing type for thermodynamic properties + typedef ThermoType thermoMixtureType; + + //- Mixing type for transport properties + typedef ThermoType transportMixtureType; private: + // Private Enumerations + + //- Specie indices + enum species { FT, B, EGR }; + + // Private Data - static const int nSpecies_ = 3; - static const char* specieNames_[3]; - + //- Stoichiometric air/fuel ratio dimensionedScalar stoicRatio_; - ThermoType fuel_; - ThermoType oxidant_; - ThermoType products_; + //- Fuel thermodynamic model + thermoType fuel_; + //- Oxidant thermodynamic model + thermoType oxidant_; + + //- Product thermodynamic model + thermoType products_; + + //- Mutable storage for the mixed thermodynamic model mutable thermoType mixture_; - //- Mixture fraction - volScalarField& ft_; - - //- Regress variable - volScalarField& b_; - - //- Residual gases - volScalarField& egr_; - public: // Constructors - //- Construct from dictionary, mesh and phaseName - egrMixture(const dictionary&, const fvMesh&, const word&); + //- Construct from a dictionary + egrMixture(const dictionary&); //- Disallow default bitwise copy construction egrMixture(const egrMixture&) = delete; @@ -113,117 +114,54 @@ public: return "egrMixture<" + ThermoType::typeName() + '>'; } - const dimensionedScalar& stoicRatio() const + //- Return the specie names + static wordList specieNames() { - return stoicRatio_; + return {"ft", "b", "egr"}; } + //- Return the residual fraction of fuel in the burnt mixture + scalar fres(const scalar ft) const + { + return max(ft - (scalar(1) - ft)/stoicRatio_.value(), scalar(0)); + } + + //- Return the mixture for the given composition const thermoType& mixture ( - const scalar, - const scalar, - const scalar + const scalar ft, + const scalar b, + const scalar egr ) const; - const thermoMixtureType& cellThermoMixture(const label celli) const - { - return mixture(ft_[celli], b_[celli], egr_[celli]); - } - - const thermoMixtureType& patchFaceThermoMixture + //- Return the mixture for thermodynamic properties + const thermoMixtureType& thermoMixture ( - const label patchi, - const label facei - ) const - { - return mixture - ( - ft_.boundaryField()[patchi][facei], - b_.boundaryField()[patchi][facei], - egr_.boundaryField()[patchi][facei] - ); - } + const scalarFieldListSlice& + ) const; - const transportMixtureType& cellTransportMixture + //- Return the mixture for transport properties + const transportMixtureType& transportMixture ( - const label celli - ) const - { - return cellThermoMixture(celli); - } + const scalarFieldListSlice& + ) const; - const transportMixtureType& patchFaceTransportMixture + //- Return the mixture for transport properties + const transportMixtureType& transportMixture ( - const label patchi, - const label facei - ) const - { - return patchFaceThermoMixture(patchi, facei); - } + const scalarFieldListSlice&, + const thermoMixtureType& + ) const; - const transportMixtureType& cellTransportMixture - ( - const label, - const thermoMixtureType& thermoMixture - ) const - { - return thermoMixture; - } + //- Return the reactant mixture + const thermoType& reactants(const scalarFieldListSlice&) const; - const transportMixtureType& patchFaceTransportMixture - ( - const label, - const label, - const thermoMixtureType& thermoMixture - ) const - { - return thermoMixture; - } - - const thermoType& cellReactants(const label celli) const - { - return mixture(ft_[celli], 1, egr_[celli]); - } - - const thermoType& patchFaceReactants - ( - const label patchi, - const label facei - ) const - { - return mixture - ( - ft_.boundaryField()[patchi][facei], - 1, - egr_.boundaryField()[patchi][facei] - ); - } - - const thermoType& cellProducts(const label celli) const - { - return mixture(ft_[celli], 0, 0); - } - - const thermoType& patchFaceProducts - ( - const label patchi, - const label facei - ) const - { - return mixture - ( - ft_.boundaryField()[patchi][facei], - 0, - 0 - ); - } + //- Return the product mixture + const thermoType& products(const scalarFieldListSlice&) const; //- Read dictionary void read(const dictionary&); - //- Return thermo based on index - const ThermoType& specieThermo(const label speciei) const; - // Member Operators diff --git a/src/thermophysicalModels/multicomponentThermo/mixtures/homogeneousMixture/homogeneousMixture.C b/src/thermophysicalModels/multicomponentThermo/mixtures/homogeneousMixture/homogeneousMixture.C index c4de45e0c0..f2de02bdf1 100644 --- a/src/thermophysicalModels/multicomponentThermo/mixtures/homogeneousMixture/homogeneousMixture.C +++ b/src/thermophysicalModels/multicomponentThermo/mixtures/homogeneousMixture/homogeneousMixture.C @@ -24,36 +24,18 @@ License \*---------------------------------------------------------------------------*/ #include "homogeneousMixture.H" -#include "fvMesh.H" - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -template -const char* Foam::homogeneousMixture::specieNames_[1] = {"b"}; - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template Foam::homogeneousMixture::homogeneousMixture ( - const dictionary& thermoDict, - const fvMesh& mesh, - const word& phaseName + const dictionary& dict ) : - basicCombustionMixture - ( - thermoDict, - speciesTable(nSpecies_, specieNames_), - mesh, - phaseName - ), - - reactants_("reactants", thermoDict.subDict("reactants")), - products_("products", thermoDict.subDict("products")), - mixture_("mixture", reactants_), - b_(Y("b")) + reactants_("reactants", dict.subDict("reactants")), + products_("products", dict.subDict("products")), + mixture_("mixture", reactants_) {} @@ -84,35 +66,66 @@ const ThermoType& Foam::homogeneousMixture::mixture template -void Foam::homogeneousMixture::read(const dictionary& thermoDict) +const typename Foam::homogeneousMixture::thermoMixtureType& +Foam::homogeneousMixture::thermoMixture +( + const scalarFieldListSlice& Y +) const { - reactants_ = ThermoType("reactants", thermoDict.subDict("reactants")); - products_ = ThermoType("products", thermoDict.subDict("products")); + return mixture(Y[B]); } template -const ThermoType& Foam::homogeneousMixture::specieThermo +const typename Foam::homogeneousMixture::transportMixtureType& +Foam::homogeneousMixture::transportMixture ( - const label speciei + const scalarFieldListSlice& Y ) const { - if (speciei == 0) - { - return reactants_; - } - else if (speciei == 1) - { - return products_; - } - else - { - FatalErrorInFunction - << "Unknown specie index " << speciei << ". Valid indices are 0..1" - << abort(FatalError); + return mixture(Y[B]); +} - return reactants_; - } + +template +const typename Foam::homogeneousMixture::transportMixtureType& +Foam::homogeneousMixture::transportMixture +( + const scalarFieldListSlice&, + const thermoMixtureType& mixture +) const +{ + return mixture; +} + + +template +const typename Foam::homogeneousMixture::thermoType& +Foam::homogeneousMixture::reactants +( + const scalarFieldListSlice& Y +) const +{ + return reactants_; +} + + +template +const typename Foam::homogeneousMixture::thermoType& +Foam::homogeneousMixture::products +( + const scalarFieldListSlice& Y +) const +{ + return products_; +} + + +template +void Foam::homogeneousMixture::read(const dictionary& dict) +{ + reactants_ = ThermoType("reactants", dict.subDict("reactants")); + products_ = ThermoType("products", dict.subDict("products")); } diff --git a/src/thermophysicalModels/multicomponentThermo/mixtures/homogeneousMixture/homogeneousMixture.H b/src/thermophysicalModels/multicomponentThermo/mixtures/homogeneousMixture/homogeneousMixture.H index 2288ca9db4..c4f5dcb054 100644 --- a/src/thermophysicalModels/multicomponentThermo/mixtures/homogeneousMixture/homogeneousMixture.H +++ b/src/thermophysicalModels/multicomponentThermo/mixtures/homogeneousMixture/homogeneousMixture.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -35,7 +35,8 @@ SourceFiles #ifndef homogeneousMixture_H #define homogeneousMixture_H -#include "basicCombustionMixture.H" +#include "dimensionedTypes.H" +#include "FieldListSlice.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -48,44 +49,47 @@ namespace Foam template class homogeneousMixture -: - public basicCombustionMixture { - public: - //- The type of thermodynamics this mixture is instantiated for - typedef ThermoType thermoType; + // Public Typedefs - //- Mixing type for thermodynamic properties - typedef ThermoType thermoMixtureType; + //- The type of thermodynamics this mixture is instantiated for + typedef ThermoType thermoType; - //- Mixing type for transport properties - typedef ThermoType transportMixtureType; + //- Mixing type for thermodynamic properties + typedef ThermoType thermoMixtureType; + + //- Mixing type for transport properties + typedef ThermoType transportMixtureType; private: + // Private Enumerations + + //- Specie indices + enum species { B }; + + // Private Data - static const int nSpecies_ = 1; - static const char* specieNames_[1]; - + //- Reactant thermodynamic model thermoType reactants_; + + //- Product thermodynamic model thermoType products_; + //- Mutable storage for the mixed thermodynamic model mutable thermoType mixture_; - //- Regress variable - volScalarField& b_; - public: // Constructors - //- Construct from dictionary, mesh and phase name - homogeneousMixture(const dictionary&, const fvMesh&, const word&); + //- Construct from a dictionary + homogeneousMixture(const dictionary&); //- Disallow default bitwise copy construction homogeneousMixture(const homogeneousMixture&) = delete; @@ -104,84 +108,43 @@ public: return "homogeneousMixture<" + ThermoType::typeName() + '>'; } + //- Return the specie names + static wordList specieNames() + { + return {"b"}; + } + + //- Return the mixture for the given composition const thermoType& mixture(const scalar) const; - const thermoMixtureType& cellThermoMixture(const label celli) const - { - return mixture(b_[celli]); - } - - const transportMixtureType& patchFaceThermoMixture + //- Return the mixture for thermodynamic properties + const thermoMixtureType& thermoMixture ( - const label patchi, - const label facei - ) const - { - return mixture(b_.boundaryField()[patchi][facei]); - } + const scalarFieldListSlice& + ) const; - const transportMixtureType& cellTransportMixture + //- Return the mixture for transport properties + const transportMixtureType& transportMixture ( - const label celli - ) const - { - return cellThermoMixture(celli); - } + const scalarFieldListSlice& + ) const; - const transportMixtureType& patchFaceTransportMixture + //- Return the mixture for transport properties + const transportMixtureType& transportMixture ( - const label patchi, - const label facei - ) const - { - return patchFaceThermoMixture(patchi, facei); - } + const scalarFieldListSlice&, + const thermoMixtureType& + ) const; - const transportMixtureType& cellTransportMixture - ( - const label, - const thermoMixtureType& thermoMixture - ) const - { - return thermoMixture; - } + //- Return the reactant mixture + const thermoType& reactants(const scalarFieldListSlice&) const; - const transportMixtureType& patchFaceTransportMixture - ( - const label, - const label, - const thermoMixtureType& thermoMixture - ) const - { - return thermoMixture; - } - - const thermoType& cellReactants(const label) const - { - return reactants_; - } - - const thermoType& patchFaceReactants(const label, const label) const - { - return reactants_; - } - - const thermoType& cellProducts(const label) const - { - return products_; - } - - const thermoType& patchFaceProducts(const label, const label) const - { - return products_; - } + //- Return the product mixture + const thermoType& products(const scalarFieldListSlice&) const; //- Read dictionary void read(const dictionary&); - //- Return thermo based on index - const ThermoType& specieThermo(const label speciei) const; - // Member Operators diff --git a/src/thermophysicalModels/multicomponentThermo/mixtures/inhomogeneousMixture/inhomogeneousMixture.C b/src/thermophysicalModels/multicomponentThermo/mixtures/inhomogeneousMixture/inhomogeneousMixture.C index 80ec4c51d0..52899677e5 100644 --- a/src/thermophysicalModels/multicomponentThermo/mixtures/inhomogeneousMixture/inhomogeneousMixture.C +++ b/src/thermophysicalModels/multicomponentThermo/mixtures/inhomogeneousMixture/inhomogeneousMixture.C @@ -24,46 +24,20 @@ License \*---------------------------------------------------------------------------*/ #include "inhomogeneousMixture.H" -#include "fvMesh.H" - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -template -const char* Foam::inhomogeneousMixture::specieNames_[2] = -{ - "ft", - "b" -}; - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template Foam::inhomogeneousMixture::inhomogeneousMixture ( - const dictionary& thermoDict, - const fvMesh& mesh, - const word& phaseName + const dictionary& dict ) : - basicCombustionMixture - ( - thermoDict, - speciesTable(nSpecies_, specieNames_), - mesh, - phaseName - ), - - stoicRatio_("stoichiometricAirFuelMassRatio", dimless, thermoDict), - - fuel_("fuel", thermoDict.subDict("fuel")), - oxidant_("oxidant", thermoDict.subDict("oxidant")), - products_("burntProducts", thermoDict.subDict("burntProducts")), - - mixture_("mixture", fuel_), - - ft_(Y("ft")), - b_(Y("b")) + stoicRatio_("stoichiometricAirFuelMassRatio", dimless, dict), + fuel_("fuel", dict.subDict("fuel")), + oxidant_("oxidant", dict.subDict("oxidant")), + products_("burntProducts", dict.subDict("burntProducts")), + mixture_("mixture", fuel_) {} @@ -82,9 +56,9 @@ const ThermoType& Foam::inhomogeneousMixture::mixture } else { - scalar fu = b*ft + (1.0 - b)*fres(ft, stoicRatio().value()); - scalar ox = 1 - ft - (ft - fu)*stoicRatio().value(); - scalar pr = 1 - fu - ox; + const scalar fu = b*ft + (1 - b)*fres(ft); + const scalar ox = 1 - ft - (ft - fu)*stoicRatio_.value(); + const scalar pr = 1 - fu - ox; mixture_ = fu*fuel_; mixture_ += ox*oxidant_; @@ -96,48 +70,70 @@ const ThermoType& Foam::inhomogeneousMixture::mixture template -void Foam::inhomogeneousMixture::read(const dictionary& thermoDict) +const typename Foam::inhomogeneousMixture::thermoMixtureType& +Foam::inhomogeneousMixture::thermoMixture +( + const scalarFieldListSlice& Y +) const { - stoicRatio_ = dimensionedScalar - ( - "stoichiometricAirFuelMassRatio", - dimless, - thermoDict - ); - - fuel_ = ThermoType("fuel", thermoDict.subDict("fuel")); - oxidant_ = ThermoType("oxidant", thermoDict.subDict("oxidant")); - products_ = - ThermoType("burntProducts", thermoDict.subDict("burntProducts")); + return mixture(Y[FT], Y[B]); } template -const ThermoType& Foam::inhomogeneousMixture::specieThermo +const typename Foam::inhomogeneousMixture::transportMixtureType& +Foam::inhomogeneousMixture::transportMixture ( - const label speciei + const scalarFieldListSlice& Y ) const { - if (speciei == 0) - { - return fuel_; - } - else if (speciei == 1) - { - return oxidant_; - } - else if (speciei == 2) - { - return products_; - } - else - { - FatalErrorInFunction - << "Unknown specie index " << speciei << ". Valid indices are 0..2" - << abort(FatalError); + return mixture(Y[FT], Y[B]); +} - return fuel_; - } + +template +const typename Foam::inhomogeneousMixture::transportMixtureType& +Foam::inhomogeneousMixture::transportMixture +( + const scalarFieldListSlice&, + const thermoMixtureType& mixture +) const +{ + return mixture; +} + + +template +const typename Foam::inhomogeneousMixture::thermoType& +Foam::inhomogeneousMixture::reactants +( + const scalarFieldListSlice& Y +) const +{ + return mixture(Y[FT], 1); +} + + +template +const typename Foam::inhomogeneousMixture::thermoType& +Foam::inhomogeneousMixture::products +( + const scalarFieldListSlice& Y +) const +{ + return mixture(Y[FT], 0); +} + + +template +void Foam::inhomogeneousMixture::read(const dictionary& dict) +{ + stoicRatio_ = + dimensionedScalar("stoichiometricAirFuelMassRatio", dimless, dict); + + fuel_ = ThermoType("fuel", dict.subDict("fuel")); + oxidant_ = ThermoType("oxidant", dict.subDict("oxidant")); + products_ = ThermoType("burntProducts", dict.subDict("burntProducts")); } diff --git a/src/thermophysicalModels/multicomponentThermo/mixtures/inhomogeneousMixture/inhomogeneousMixture.H b/src/thermophysicalModels/multicomponentThermo/mixtures/inhomogeneousMixture/inhomogeneousMixture.H index 137a6eb61e..7e3fff4829 100644 --- a/src/thermophysicalModels/multicomponentThermo/mixtures/inhomogeneousMixture/inhomogeneousMixture.H +++ b/src/thermophysicalModels/multicomponentThermo/mixtures/inhomogeneousMixture/inhomogeneousMixture.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -35,7 +35,8 @@ SourceFiles #ifndef inhomogeneousMixture_H #define inhomogeneousMixture_H -#include "basicCombustionMixture.H" +#include "dimensionedTypes.H" +#include "FieldListSlice.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -48,50 +49,53 @@ namespace Foam template class inhomogeneousMixture -: - public basicCombustionMixture { - public: - //- The type of thermodynamics this mixture is instantiated for - typedef ThermoType thermoType; + // Public Typedefs - //- Mixing type for thermodynamic properties - typedef ThermoType thermoMixtureType; + //- The type of thermodynamics this mixture is instantiated for + typedef ThermoType thermoType; - //- Mixing type for transport properties - typedef ThermoType transportMixtureType; + //- Mixing type for thermodynamic properties + typedef ThermoType thermoMixtureType; + + //- Mixing type for transport properties + typedef ThermoType transportMixtureType; private: + // Private Enumerations + + //- Specie indices + enum species { FT, B }; + + // Private Data - static const int nSpecies_ = 2; - static const char* specieNames_[2]; - + //- Stoichiometric air/fuel ratio dimensionedScalar stoicRatio_; + //- Fuel thermodynamic model thermoType fuel_; + + //- Oxidant thermodynamic model thermoType oxidant_; + + //- Product thermodynamic model thermoType products_; + //- Mutable storage for the mixed thermodynamic model mutable thermoType mixture_; - //- Mixture fraction - volScalarField& ft_; - - //- Regress variable - volScalarField& b_; - public: // Constructors - //- Construct from dictionary, mesh and phase name - inhomogeneousMixture(const dictionary&, const fvMesh&, const word&); + //- Construct from a dictionary + inhomogeneousMixture(const dictionary&); //- Disallow default bitwise copy construction inhomogeneousMixture(const inhomogeneousMixture&) = delete; @@ -110,109 +114,49 @@ public: return "inhomogeneousMixture<" + ThermoType::typeName() + '>'; } - const dimensionedScalar& stoicRatio() const + //- Return the specie names + static wordList specieNames() { - return stoicRatio_; + return {"ft", "b"}; } - const thermoType& mixture(const scalar, const scalar) const; - - const thermoMixtureType& cellThermoMixture(const label celli) const + //- Return the residual fraction of fuel in the burnt mixture + scalar fres(const scalar ft) const { - return mixture(ft_[celli], b_[celli]); + return max(ft - (scalar(1) - ft)/stoicRatio_.value(), scalar(0)); } - const thermoMixtureType& patchFaceThermoMixture + //- Return the mixture for the given composition + const thermoType& mixture(const scalar ft, const scalar b) const; + + //- Return the mixture for thermodynamic properties + const thermoMixtureType& thermoMixture ( - const label patchi, - const label facei - ) const - { - return mixture - ( - ft_.boundaryField()[patchi][facei], - b_.boundaryField()[patchi][facei] - ); - } + const scalarFieldListSlice& + ) const; - const transportMixtureType& cellTransportMixture + //- Return the mixture for transport properties + const transportMixtureType& transportMixture ( - const label celli - ) const - { - return cellThermoMixture(celli); - } + const scalarFieldListSlice& + ) const; - const transportMixtureType& patchFaceTransportMixture + //- Return the mixture for transport properties + const transportMixtureType& transportMixture ( - const label patchi, - const label facei - ) const - { - return patchFaceThermoMixture(patchi, facei); - } + const scalarFieldListSlice&, + const thermoMixtureType& + ) const; - const transportMixtureType& cellTransportMixture - ( - const label, - const thermoMixtureType& thermoMixture - ) const - { - return thermoMixture; - } + //- Return the reactant mixture + const thermoType& reactants(const scalarFieldListSlice&) const; - const transportMixtureType& patchFaceTransportMixture - ( - const label, - const label, - const thermoMixtureType& thermoMixture - ) const - { - return thermoMixture; - } - - const thermoType& cellReactants(const label celli) const - { - return mixture(ft_[celli], 1); - } - - const thermoType& patchFaceReactants - ( - const label patchi, - const label facei - ) const - { - return mixture - ( - ft_.boundaryField()[patchi][facei], - 1 - ); - } - - const thermoType& cellProducts(const label celli) const - { - return mixture(ft_[celli], 0); - } - - const thermoType& patchFaceProducts - ( - const label patchi, - const label facei - ) const - { - return mixture - ( - ft_.boundaryField()[patchi][facei], - 0 - ); - } + //- Return the product mixture + const thermoType& products(const scalarFieldListSlice&) const; //- Read dictionary void read(const dictionary&); - //- Return thermo based on index - const ThermoType& specieThermo(const label speciei) const; - // Member Operators diff --git a/src/thermophysicalModels/multicomponentThermo/mixtures/multicomponentMixture/multicomponentMixture.C b/src/thermophysicalModels/multicomponentThermo/mixtures/multicomponentMixture/multicomponentMixture.C index 1716e98c10..452c8f65f9 100644 --- a/src/thermophysicalModels/multicomponentThermo/mixtures/multicomponentMixture/multicomponentMixture.C +++ b/src/thermophysicalModels/multicomponentThermo/mixtures/multicomponentMixture/multicomponentMixture.C @@ -24,100 +24,77 @@ License \*---------------------------------------------------------------------------*/ #include "multicomponentMixture.H" - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -template -Foam::PtrList -Foam::multicomponentMixture::readSpeciesData -( - const dictionary& thermoDict -) const -{ - PtrList specieThermos(species_.size()); - - forAll(species_, i) - { - specieThermos.set - ( - i, - new ThermoType(species_[i], thermoDict.subDict(species_[i])) - ); - } - - return specieThermos; -} - - -template -Foam::List> -Foam::multicomponentMixture::readSpeciesComposition -( - const dictionary& thermoDict -) const -{ - List> specieCompositions(species_.size()); - - // Loop through all species in thermoDict to retrieve - // the species composition - forAll(species_, i) - { - if (thermoDict.subDict(species_[i]).isDict("elements")) - { - const dictionary& elements = - thermoDict.subDict(species_[i]).subDict("elements"); - - const wordList elementsNames(elements.toc()); - - specieCompositions[i].resize(elementsNames.size()); - - forAll(elementsNames, eni) - { - specieCompositions[i][eni].name() = elementsNames[eni]; - specieCompositions[i][eni].nAtoms() = - elements.lookupOrDefault(elementsNames[eni], 0); - } - } - } - - return specieCompositions; -} - +#include "dictionary.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template Foam::multicomponentMixture::multicomponentMixture ( - const dictionary& thermoDict, - const fvMesh& mesh, - const word& phaseName + const dictionary& dict ) -: - basicSpecieMixture - ( - thermoDict, - thermoDict.lookup("species"), - mesh, - phaseName - ), - specieThermos_(readSpeciesData(thermoDict)), - specieCompositions_(readSpeciesComposition(thermoDict)) { - correctMassFractions(); + read(dict); } // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +template +Foam::wordList Foam::multicomponentMixture::specieNames() const +{ + wordList result(specieThermos_.size()); + + forAll(specieThermos_, speciei) + { + result[speciei] = specieThermos_[speciei].name(); + } + + return result; +} + + template void Foam::multicomponentMixture::read ( - const dictionary& thermoDict + const dictionary& dict ) { - specieThermos_ = readSpeciesData(thermoDict); - specieCompositions_ = readSpeciesComposition(thermoDict); + const wordList specieNames(dict.lookup("species")); + + specieThermos_.setSize(specieNames.size()); + specieCompositions_.setSize(specieNames.size()); + specieDictLocations_.setSize(specieNames.size()); + + forAll(specieNames, speciei) + { + const dictionary& specieDict = dict.subDict(specieNames[speciei]); + + specieThermos_.set + ( + speciei, + new ThermoType(specieNames[speciei], specieDict) + ); + + if (specieDict.isDict("elements")) + { + const dictionary& specieElementsDict = + specieDict.subDict("elements"); + + const wordList elementsNames(specieElementsDict.toc()); + + specieCompositions_[speciei].resize(elementsNames.size()); + + forAll(elementsNames, eni) + { + specieCompositions_[speciei][eni].name() = elementsNames[eni]; + specieCompositions_[speciei][eni].nAtoms() = + specieElementsDict.lookupOrDefault(elementsNames[eni], 0); + } + } + + specieDictLocations_[speciei] = IOerrorLocation(specieDict); + } } @@ -130,10 +107,10 @@ Foam::multicomponentMixture::specieComposition { if (specieCompositions_[speciei].empty()) { - // Spit an error associated with the lookup of this specie's elements - refCast(*this) - .subDict(species_[speciei]) - .subDict("elements"); + FatalIOErrorInFunction(specieDictLocations_[speciei]) + << "Elemental composition not specified for specie " + << specieThermos_[speciei].name() + << exit(FatalIOError); } return specieCompositions_[speciei]; diff --git a/src/thermophysicalModels/multicomponentThermo/mixtures/multicomponentMixture/multicomponentMixture.H b/src/thermophysicalModels/multicomponentThermo/mixtures/multicomponentMixture/multicomponentMixture.H index 065e493eb5..1908a34f96 100644 --- a/src/thermophysicalModels/multicomponentThermo/mixtures/multicomponentMixture/multicomponentMixture.H +++ b/src/thermophysicalModels/multicomponentThermo/mixtures/multicomponentMixture/multicomponentMixture.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -35,8 +35,7 @@ SourceFiles #ifndef multicomponentMixture_H #define multicomponentMixture_H -#include "basicSpecieMixture.H" -#include "HashPtrTable.H" +#include "PtrList.H" #include "specieElement.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -50,14 +49,13 @@ namespace Foam template class multicomponentMixture -: - public basicSpecieMixture { - public: - //- The type of thermodynamics this mixture is instantiated for - typedef ThermoType thermoType; + // Public Typedefs + + //- The type of thermodynamics this mixture is instantiated for + typedef ThermoType thermoType; private: @@ -70,25 +68,16 @@ private: //- Table of species composition List> specieCompositions_; - - // Private Member Functions - - //- Read the species data from the given dictionary and return - PtrList readSpeciesData(const dictionary& thermoDict) const; - - //- Read the species composition from the given dictionary and return - List> readSpeciesComposition - ( - const dictionary& thermoDict - ) const; + //- Cached IO error locations for delayed error messages + List specieDictLocations_; public: // Constructors - //- Construct from dictionary, mesh and phase name - multicomponentMixture(const dictionary&, const fvMesh&, const word&); + //- Construct from a dictionary + multicomponentMixture(const dictionary&); //- Disallow default bitwise copy construction multicomponentMixture @@ -104,15 +93,18 @@ public: // Member Functions + //- Return the specie names + wordList specieNames() const; + + //- Read dictionary + void read(const dictionary&); + //- Return the raw specie thermodynamic data inline const PtrList& specieThermos() const { return specieThermos_; } - //- Read dictionary - void read(const dictionary&); - //- Return thermo based on index inline const ThermoType& specieThermo(const label speciei) const { @@ -120,10 +112,7 @@ public: } //- Return composition based on index - const List& specieComposition - ( - const label speciei - ) const; + const List& specieComposition(const label speciei) const; }; diff --git a/src/thermophysicalModels/multicomponentThermo/mixtures/singleComponentMixture/singleComponentMixture.C b/src/thermophysicalModels/multicomponentThermo/mixtures/singleComponentMixture/singleComponentMixture.C index 90e935bdb5..9b4e6b3e90 100644 --- a/src/thermophysicalModels/multicomponentThermo/mixtures/singleComponentMixture/singleComponentMixture.C +++ b/src/thermophysicalModels/multicomponentThermo/mixtures/singleComponentMixture/singleComponentMixture.C @@ -30,13 +30,10 @@ License template Foam::singleComponentMixture::singleComponentMixture ( - const dictionary& thermoDict, - const fvMesh& mesh, - const word& phaseName + const dictionary& dict ) : - basicSpecieMixture(thermoDict, wordList(), mesh, phaseName), - mixture_("mixture", thermoDict.subDict("mixture")) + mixture_("mixture", dict.subDict("mixture")) {} @@ -52,10 +49,10 @@ Foam::singleComponentMixture::~singleComponentMixture() template void Foam::singleComponentMixture::read ( - const dictionary& thermoDict + const dictionary& dict ) { - mixture_ = ThermoType("mixture", thermoDict.subDict("mixture")); + mixture_ = ThermoType("mixture", dict.subDict("mixture")); } diff --git a/src/thermophysicalModels/multicomponentThermo/mixtures/singleComponentMixture/singleComponentMixture.H b/src/thermophysicalModels/multicomponentThermo/mixtures/singleComponentMixture/singleComponentMixture.H index d24aa0edc7..6b54e9c07a 100644 --- a/src/thermophysicalModels/multicomponentThermo/mixtures/singleComponentMixture/singleComponentMixture.H +++ b/src/thermophysicalModels/multicomponentThermo/mixtures/singleComponentMixture/singleComponentMixture.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2017-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2017-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -35,7 +35,8 @@ SourceFiles #ifndef singleComponentMixture_H #define singleComponentMixture_H -#include "basicSpecieMixture.H" +#include "wordList.H" +#include "FieldListSlice.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -48,20 +49,19 @@ namespace Foam template class singleComponentMixture -: - public basicSpecieMixture { - public: - //- The type of thermodynamics this mixture is instantiated for - typedef ThermoType thermoType; + // Public Typedefs - //- Mixing type for thermodynamic properties - typedef ThermoType thermoMixtureType; + //- The type of thermodynamics this mixture is instantiated for + typedef ThermoType thermoType; - //- Mixing type for transport properties - typedef ThermoType transportMixtureType; + //- Mixing type for thermodynamic properties + typedef ThermoType thermoMixtureType; + + //- Mixing type for transport properties + typedef ThermoType transportMixtureType; private: @@ -76,8 +76,8 @@ public: // Constructors - //- Construct from dictionary, mesh and phase name - singleComponentMixture(const dictionary&, const fvMesh&, const word&); + //- Construct from a dictionary + singleComponentMixture(const dictionary&); //- Destructor @@ -94,47 +94,34 @@ public: return "pureMixture<" + ThermoType::typeName() + '>'; } - const thermoMixtureType& cellThermoMixture(const label) const + //- Return the specie names + wordList specieNames() const { - return mixture_; + return wordList(); } - const thermoMixtureType& patchFaceThermoMixture + //- Return the mixture for thermodynamic properties + const thermoMixtureType& thermoMixture ( - const label, - const label + const scalarFieldListSlice& ) const { return mixture_; } - const transportMixtureType& cellTransportMixture(const label) const - { - return mixture_; - } - - const transportMixtureType& patchFaceTransportMixture + //- Return the mixture for transport properties + const transportMixtureType& transportMixture ( - const label, - const label + const scalarFieldListSlice& ) const { return mixture_; } - const transportMixtureType& cellTransportMixture + //- Return the mixture for transport properties + const transportMixtureType& transportMixture ( - const label, - const thermoMixtureType& - ) const - { - return mixture_; - } - - const transportMixtureType& patchFaceTransportMixture - ( - const label, - const label, + const scalarFieldListSlice&, const thermoMixtureType& ) const { diff --git a/src/thermophysicalModels/multicomponentThermo/mixtures/valueMulticomponentMixture/valueMulticomponentMixture.C b/src/thermophysicalModels/multicomponentThermo/mixtures/valueMulticomponentMixture/valueMulticomponentMixture.C index fd6c555bb5..f8cc22aa68 100644 --- a/src/thermophysicalModels/multicomponentThermo/mixtures/valueMulticomponentMixture/valueMulticomponentMixture.C +++ b/src/thermophysicalModels/multicomponentThermo/mixtures/valueMulticomponentMixture/valueMulticomponentMixture.C @@ -25,44 +25,13 @@ License #include "valueMulticomponentMixture.H" -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -template -Foam::valueMulticomponentMixture::valueMulticomponentMixture -( - const dictionary& thermoDict, - const fvMesh& mesh, - const word& phaseName -) -: - multicomponentMixture - ( - thermoDict, - mesh, - phaseName - ), - thermoMixture_(this->specieThermos()), - transportMixture_(this->specieThermos()) -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -template -Foam::scalar -Foam::valueMulticomponentMixture::thermoMixture::limit -( - const scalar T -) const -{ - return T; -} - +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // template template Foam::scalar -Foam::valueMulticomponentMixture::thermoMixture::massWeighted +Foam::valueMulticomponentMixture::thermoMixtureType:: +massWeighted ( Method psiMethod, const Args& ... args @@ -82,7 +51,7 @@ Foam::valueMulticomponentMixture::thermoMixture::massWeighted template template Foam::scalar -Foam::valueMulticomponentMixture::thermoMixture:: +Foam::valueMulticomponentMixture::thermoMixtureType:: harmonicMassWeighted ( Method psiMethod, @@ -100,10 +69,22 @@ harmonicMassWeighted } +template +Foam::scalar +Foam::valueMulticomponentMixture::thermoMixtureType::limit +( + const scalar T +) const +{ + return T; +} + + template template Foam::scalar -Foam::valueMulticomponentMixture::transportMixture::moleWeighted +Foam::valueMulticomponentMixture::transportMixtureType:: +moleWeighted ( Method psiMethod, const Args& ... args @@ -120,16 +101,33 @@ Foam::valueMulticomponentMixture::transportMixture::moleWeighted } +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + template -Foam::scalar Foam::valueMulticomponentMixture::thermoMixture::W -() const +Foam::valueMulticomponentMixture::valueMulticomponentMixture +( + const dictionary& dict +) +: + multicomponentMixture(dict), + thermoMixture_(this->specieThermos()), + transportMixture_(this->specieThermos()) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +Foam::scalar +Foam::valueMulticomponentMixture::thermoMixtureType::W() const { return harmonicMassWeighted(&ThermoType::W); } template -Foam::scalar Foam::valueMulticomponentMixture::thermoMixture::rho +Foam::scalar +Foam::valueMulticomponentMixture::thermoMixtureType::rho ( scalar p, scalar T @@ -140,7 +138,8 @@ Foam::scalar Foam::valueMulticomponentMixture::thermoMixture::rho template -Foam::scalar Foam::valueMulticomponentMixture::thermoMixture::psi +Foam::scalar +Foam::valueMulticomponentMixture::thermoMixtureType::psi ( scalar p, scalar T @@ -167,24 +166,25 @@ Foam::scalar Foam::valueMulticomponentMixture::thermoMixture::psi template -Foam::scalar Foam::valueMulticomponentMixture::thermoMixture::Hf -() const +Foam::scalar +Foam::valueMulticomponentMixture::thermoMixtureType::Hf() const { return massWeighted(&ThermoType::Hf); } #define thermoMixtureFunction(Func) \ -template \ -Foam::scalar \ -Foam::valueMulticomponentMixture::thermoMixture::Func \ -( \ - scalar p, \ - scalar T \ -) const \ -{ \ - return massWeighted(&ThermoType::Func, p, T); \ -} + \ + template \ + Foam::scalar \ + Foam::valueMulticomponentMixture::thermoMixtureType::Func \ + ( \ + scalar p, \ + scalar T \ + ) const \ + { \ + return massWeighted(&ThermoType::Func, p, T); \ + } thermoMixtureFunction(Cp) thermoMixtureFunction(Cv) @@ -196,7 +196,8 @@ thermoMixtureFunction(HE) template -Foam::scalar Foam::valueMulticomponentMixture::thermoMixture::THE +Foam::scalar +Foam::valueMulticomponentMixture::thermoMixtureType::THE ( const scalar he, scalar p, @@ -209,16 +210,16 @@ Foam::scalar Foam::valueMulticomponentMixture::thermoMixture::THE he, p, T0, - &thermoMixture::HE, - &thermoMixture::Cpv, - &thermoMixture::limit + &thermoMixtureType::HE, + &thermoMixtureType::Cpv, + &thermoMixtureType::limit ); } template Foam::scalar -Foam::valueMulticomponentMixture::transportMixture::mu +Foam::valueMulticomponentMixture::transportMixtureType::mu ( scalar p, scalar T @@ -230,7 +231,7 @@ Foam::valueMulticomponentMixture::transportMixture::mu template Foam::scalar -Foam::valueMulticomponentMixture::transportMixture::kappa +Foam::valueMulticomponentMixture::transportMixtureType::kappa ( scalar p, scalar T @@ -243,36 +244,14 @@ Foam::valueMulticomponentMixture::transportMixture::kappa template const typename Foam::valueMulticomponentMixture::thermoMixtureType& -Foam::valueMulticomponentMixture::cellThermoMixture +Foam::valueMulticomponentMixture::thermoMixture ( - const label celli + const scalarFieldListSlice& Y ) const { - List& Y = thermoMixture_.Y_; - forAll(Y, i) { - Y[i] = this->Y()[i][celli]; - } - - return thermoMixture_; -} - - -template -const typename -Foam::valueMulticomponentMixture::thermoMixtureType& -Foam::valueMulticomponentMixture::patchFaceThermoMixture -( - const label patchi, - const label facei -) const -{ - List& Y = thermoMixture_.Y_; - - forAll(Y, i) - { - Y[i] = this->Y()[i].boundaryField()[patchi][facei]; + thermoMixture_.Y_[i] = Y[i]; } return thermoMixture_; @@ -282,24 +261,22 @@ Foam::valueMulticomponentMixture::patchFaceThermoMixture template const typename Foam::valueMulticomponentMixture::transportMixtureType& -Foam::valueMulticomponentMixture::cellTransportMixture +Foam::valueMulticomponentMixture::transportMixture ( - const label celli + const scalarFieldListSlice& Y ) const { - List& X = transportMixture_.X_; - scalar sumX = 0; - forAll(X, i) + forAll(Y, i) { - X[i] = this->Y()[i][celli]/this->specieThermos()[i].W(); - sumX += X[i]; + transportMixture_.X_[i] = Y[i]/this->specieThermos()[i].W(); + sumX += transportMixture_.X_[i]; } - forAll(X, i) + forAll(Y, i) { - X[i] /= sumX; + transportMixture_.X_[i] /= sumX; } return transportMixture_; @@ -309,30 +286,13 @@ Foam::valueMulticomponentMixture::cellTransportMixture template const typename Foam::valueMulticomponentMixture::transportMixtureType& -Foam::valueMulticomponentMixture::patchFaceTransportMixture +Foam::valueMulticomponentMixture::transportMixture ( - const label patchi, - const label facei + const scalarFieldListSlice& Y, + const thermoMixtureType& ) const { - List& X = transportMixture_.X_; - - scalar sumX = 0; - - forAll(X, i) - { - X[i] = - this->Y()[i].boundaryField()[patchi][facei] - /this->specieThermos()[i].W(); - sumX += X[i]; - } - - forAll(X, i) - { - X[i] /= sumX; - } - - return transportMixture_; + return transportMixture(Y); } diff --git a/src/thermophysicalModels/multicomponentThermo/mixtures/valueMulticomponentMixture/valueMulticomponentMixture.H b/src/thermophysicalModels/multicomponentThermo/mixtures/valueMulticomponentMixture/valueMulticomponentMixture.H index bf43662a3e..085d25dd00 100644 --- a/src/thermophysicalModels/multicomponentThermo/mixtures/valueMulticomponentMixture/valueMulticomponentMixture.H +++ b/src/thermophysicalModels/multicomponentThermo/mixtures/valueMulticomponentMixture/valueMulticomponentMixture.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -38,6 +38,7 @@ SourceFiles #define valueMulticomponentMixture_H #include "multicomponentMixture.H" +#include "FieldListSlice.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -53,139 +54,150 @@ class valueMulticomponentMixture : public multicomponentMixture { - public: - class thermoMixture - { - //- List of specie thermo - const PtrList& specieThermos_; + // Public Classes - //- List of mass fractions - mutable List Y_; + //- Mixing type for thermodynamic properties + class thermoMixtureType + { + // Private Data - template - scalar massWeighted(Method psiMethod, const Args& ... args) const; + //- List of specie thermo + const PtrList& specieThermos_; - template - scalar harmonicMassWeighted - ( - Method psiMethod, - const Args& ... args - ) const; + //- List of mass fractions + mutable List Y_; - scalar limit(const scalar T) const; + //- Calculate a mass-fraction-weighted property + template + scalar massWeighted + ( + Method psiMethod, + const Args& ... args + ) const; + + //- Calculate a harmonic mass-fraction-weighted property + template + scalar harmonicMassWeighted + ( + Method psiMethod, + const Args& ... args + ) const; + + //- Limit the given temperature + scalar limit(const scalar T) const; - public: + public: - friend class valueMulticomponentMixture; - - // Constructors - - thermoMixture - ( - const PtrList& specieThermos - ) - : - specieThermos_(specieThermos), - Y_(specieThermos.size()) - {} + friend class valueMulticomponentMixture; - // Fundamental properties + // Constructors - //- Molecular weight [kg/kmol] - scalar W() const; - - //- Return density [kg/m^3] - scalar rho(scalar p, scalar T) const; - - //- Return compressibility [s^2/m^2] - scalar psi(scalar p, scalar T) const; - - // Heat capacity at constant pressure [J/kg/K] - scalar Cp(const scalar p, const scalar T) const; - - // Heat capacity at constant volume [J/kg/K] - scalar Cv(const scalar p, const scalar T) const; - - // Sensible enthalpy [J/kg] - scalar Hs(const scalar p, const scalar T) const; - - // Absolute enthalpy [J/kg] - scalar Ha(const scalar p, const scalar T) const; - - // Enthalpy of formation [J/kg] - scalar Hf() const; + //- Construct from list of specie thermo + thermoMixtureType(const PtrList& specieThermos) + : + specieThermos_(specieThermos), + Y_(specieThermos.size()) + {} - // Mass specific derived properties + // Fundamental properties - //- Heat capacity at constant pressure/volume [J/kg/K] - scalar Cpv(const scalar p, const scalar T) const; + //- Molecular weight [kg/kmol] + scalar W() const; - //- Gamma = Cp/Cv [] - scalar gamma(const scalar p, const scalar T) const; + //- Return density [kg/m^3] + scalar rho(scalar p, scalar T) const; - //- Enthalpy/Internal energy [J/kg] - scalar HE(const scalar p, const scalar T) const; + //- Return compressibility [s^2/m^2] + scalar psi(scalar p, scalar T) const; + + // Heat capacity at constant pressure [J/kg/K] + scalar Cp(const scalar p, const scalar T) const; + + // Heat capacity at constant volume [J/kg/K] + scalar Cv(const scalar p, const scalar T) const; + + // Sensible enthalpy [J/kg] + scalar Hs(const scalar p, const scalar T) const; + + // Absolute enthalpy [J/kg] + scalar Ha(const scalar p, const scalar T) const; + + // Enthalpy of formation [J/kg] + scalar Hf() const; - // Energy->temperature inversion functions + // Mass specific derived properties - //- Temperature from enthalpy or internal energy - // given an initial temperature T0 - scalar THE - ( - const scalar he, - const scalar p, - const scalar T0 - ) const; - }; + //- Heat capacity at constant pressure/volume [J/kg/K] + scalar Cpv(const scalar p, const scalar T) const; + + //- Gamma = Cp/Cv [] + scalar gamma(const scalar p, const scalar T) const; + + //- Enthalpy/Internal energy [J/kg] + scalar HE(const scalar p, const scalar T) const; - class transportMixture - { - //- List of specie thermo - const PtrList& specieThermos_; + // Energy->temperature inversion functions - //- List of mole fractions - mutable List X_; + //- Temperature from enthalpy or internal energy + // given an initial temperature T0 + scalar THE + ( + const scalar he, + const scalar p, + const scalar T0 + ) const; + }; - template - scalar moleWeighted(Method psiMethod, const Args& ... args) const; + //- Mixing type for transport properties + class transportMixtureType + { + // Private Data + + //- List of specie thermo + const PtrList& specieThermos_; + + //- List of mole fractions + mutable List X_; + + //- Calculate a mole-fraction-weighted property + template + scalar moleWeighted + ( + Method psiMethod, + const Args& ... args + ) const; - public: + public: - friend class valueMulticomponentMixture; - - transportMixture - ( - const PtrList& specieThermos - ) - : - specieThermos_(specieThermos), - X_(specieThermos.size()) - {} + friend class valueMulticomponentMixture; - // Transport properties + // Constructors - //- Dynamic viscosity [kg/m/s] - scalar mu(const scalar p, const scalar T) const; - - //- Thermal conductivity [W/m/K] - scalar kappa(const scalar p, const scalar T) const; - }; + //- Construct from list of specie thermo + transportMixtureType(const PtrList& specieThermos) + : + specieThermos_(specieThermos), + X_(specieThermos.size()) + {} - //- Mixing type for thermodynamic properties - typedef thermoMixture thermoMixtureType; + // Transport properties - //- Mixing type for transport properties - typedef transportMixture transportMixtureType; + //- Dynamic viscosity [kg/m/s] + scalar mu(const scalar p, const scalar T) const; + + //- Thermal conductivity [W/m/K] + scalar kappa(const scalar p, const scalar T) const; + }; private: @@ -203,13 +215,8 @@ public: // Constructors - //- Construct from dictionary, mesh and phase name - valueMulticomponentMixture - ( - const dictionary&, - const fvMesh&, - const word& - ); + //- Construct from a dictionary + valueMulticomponentMixture(const dictionary&); //- Disallow default bitwise copy construction valueMulticomponentMixture @@ -228,47 +235,27 @@ public: //- Return the instantiated type name static word typeName() { - return - "valueMulticomponentMixture<" + ThermoType::typeName() + '>'; + return "valueMulticomponentMixture<" + ThermoType::typeName() + '>'; } - const thermoMixtureType& cellThermoMixture(const label celli) const; - - const thermoMixtureType& patchFaceThermoMixture + //- Return the mixture for thermodynamic properties + const thermoMixtureType& thermoMixture ( - const label patchi, - const label facei + const scalarFieldListSlice& ) const; - const transportMixtureType& cellTransportMixture + //- Return the mixture for transport properties + const transportMixtureType& transportMixture ( - const label celli + const scalarFieldListSlice& ) const; - const transportMixtureType& patchFaceTransportMixture + //- Return the mixture for transport properties + const transportMixtureType& transportMixture ( - const label patchi, - const label facei + const scalarFieldListSlice&, + const thermoMixtureType& ) const; - - const transportMixtureType& cellTransportMixture - ( - const label celli, - const thermoMixtureType& thermoMixture - ) const - { - return cellTransportMixture(celli); - } - - const transportMixtureType& patchFaceTransportMixture - ( - const label patchi, - const label facei, - const thermoMixtureType& thermoMixture - ) const - { - return patchFaceTransportMixture(patchi, facei); - } }; diff --git a/src/thermophysicalModels/multicomponentThermo/mixtures/veryInhomogeneousMixture/veryInhomogeneousMixture.C b/src/thermophysicalModels/multicomponentThermo/mixtures/veryInhomogeneousMixture/veryInhomogeneousMixture.C index 342186c449..0316ecfc71 100644 --- a/src/thermophysicalModels/multicomponentThermo/mixtures/veryInhomogeneousMixture/veryInhomogeneousMixture.C +++ b/src/thermophysicalModels/multicomponentThermo/mixtures/veryInhomogeneousMixture/veryInhomogeneousMixture.C @@ -24,48 +24,20 @@ License \*---------------------------------------------------------------------------*/ #include "veryInhomogeneousMixture.H" -#include "fvMesh.H" - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -template -const char* Foam::veryInhomogeneousMixture::specieNames_[3] = -{ - "ft", - "fu", - "b" -}; - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template Foam::veryInhomogeneousMixture::veryInhomogeneousMixture ( - const dictionary& thermoDict, - const fvMesh& mesh, - const word& phaseName + const dictionary& dict ) : - basicCombustionMixture - ( - thermoDict, - speciesTable(nSpecies_, specieNames_), - mesh, - phaseName - ), - - stoicRatio_("stoichiometricAirFuelMassRatio", dimless, thermoDict), - - fuel_("fuel", thermoDict.subDict("fuel")), - oxidant_("oxidant", thermoDict.subDict("oxidant")), - products_("burntProducts", thermoDict.subDict("burntProducts")), - - mixture_("mixture", fuel_), - - ft_(Y("ft")), - fu_(Y("fu")), - b_(Y("b")) + stoicRatio_("stoichiometricAirFuelMassRatio", dimless, dict), + fuel_("fuel", dict.subDict("fuel")), + oxidant_("oxidant", dict.subDict("oxidant")), + products_("burntProducts", dict.subDict("burntProducts")), + mixture_("mixture", fuel_) {} @@ -84,8 +56,8 @@ const ThermoType& Foam::veryInhomogeneousMixture::mixture } else { - scalar ox = 1 - ft - (ft - fu)*stoicRatio().value(); - scalar pr = 1 - fu - ox; + const scalar ox = 1 - ft - (ft - fu)*stoicRatio_.value(); + const scalar pr = 1 - fu - ox; mixture_ = fu*fuel_; mixture_ += ox*oxidant_; @@ -97,44 +69,73 @@ const ThermoType& Foam::veryInhomogeneousMixture::mixture template -void Foam::veryInhomogeneousMixture::read +const typename Foam::veryInhomogeneousMixture::thermoMixtureType& +Foam::veryInhomogeneousMixture::thermoMixture ( - const dictionary& thermoDict -) + const scalarFieldListSlice& Y +) const { - fuel_ = ThermoType("fuel", thermoDict.subDict("fuel")); - oxidant_ = ThermoType("oxidant", thermoDict.subDict("oxidant")); - products_ = - ThermoType("burntProducts", thermoDict.subDict("burntProducts")); + return mixture(Y[FT], Y[FU]); } template -const ThermoType& Foam::veryInhomogeneousMixture::specieThermo +const typename Foam::veryInhomogeneousMixture::transportMixtureType& +Foam::veryInhomogeneousMixture::transportMixture ( - const label speciei + const scalarFieldListSlice& Y ) const { - if (speciei == 0) - { - return fuel_; - } - else if (speciei == 1) - { - return oxidant_; - } - else if (speciei == 2) - { - return products_; - } - else - { - FatalErrorInFunction - << "Unknown specie index " << speciei << ". Valid indices are 0..2" - << abort(FatalError); + return mixture(Y[FT], Y[FU]); +} - return fuel_; - } + +template +const typename Foam::veryInhomogeneousMixture::transportMixtureType& +Foam::veryInhomogeneousMixture::transportMixture +( + const scalarFieldListSlice&, + const thermoMixtureType& mixture +) const +{ + return mixture; +} + + +template +const typename Foam::veryInhomogeneousMixture::thermoType& +Foam::veryInhomogeneousMixture::reactants +( + const scalarFieldListSlice& Y +) const +{ + return mixture(Y[FT], Y[FT]); +} + + +template +const typename Foam::veryInhomogeneousMixture::thermoType& +Foam::veryInhomogeneousMixture::products +( + const scalarFieldListSlice& Y +) const +{ + return mixture(Y[FT], fres(Y[FT])); +} + + +template +void Foam::veryInhomogeneousMixture::read +( + const dictionary& dict +) +{ + stoicRatio_ = + dimensionedScalar("stoichiometricAirFuelMassRatio", dimless, dict); + + fuel_ = ThermoType("fuel", dict.subDict("fuel")); + oxidant_ = ThermoType("oxidant", dict.subDict("oxidant")); + products_ = ThermoType("burntProducts", dict.subDict("burntProducts")); } diff --git a/src/thermophysicalModels/multicomponentThermo/mixtures/veryInhomogeneousMixture/veryInhomogeneousMixture.H b/src/thermophysicalModels/multicomponentThermo/mixtures/veryInhomogeneousMixture/veryInhomogeneousMixture.H index 7fc5136ebc..0659d11bca 100644 --- a/src/thermophysicalModels/multicomponentThermo/mixtures/veryInhomogeneousMixture/veryInhomogeneousMixture.H +++ b/src/thermophysicalModels/multicomponentThermo/mixtures/veryInhomogeneousMixture/veryInhomogeneousMixture.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -35,7 +35,8 @@ SourceFiles #ifndef veryInhomogeneousMixture_H #define veryInhomogeneousMixture_H -#include "basicCombustionMixture.H" +#include "dimensionedTypes.H" +#include "FieldListSlice.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -48,58 +49,53 @@ namespace Foam template class veryInhomogeneousMixture -: - public basicCombustionMixture { - public: - //- The type of thermodynamics this mixture is instantiated for - typedef ThermoType thermoType; + // Public Typedefs - //- Mixing type for thermodynamic properties - typedef ThermoType thermoMixtureType; + //- The type of thermodynamics this mixture is instantiated for + typedef ThermoType thermoType; - //- Mixing type for transport properties - typedef ThermoType transportMixtureType; + //- Mixing type for thermodynamic properties + typedef ThermoType thermoMixtureType; + + //- Mixing type for transport properties + typedef ThermoType transportMixtureType; private: + // Private Enumerations + + //- Specie indices + enum species { FT, FU, B }; + + // Private Data - static const int nSpecies_ = 3; - static const char* specieNames_[3]; - + //- Stoichiometric air/fuel ratio dimensionedScalar stoicRatio_; + //- Fuel thermodynamic model thermoType fuel_; + + //- Oxidant thermodynamic model thermoType oxidant_; + + //- Product thermodynamic model thermoType products_; + //- Mutable storage for the mixed thermodynamic model mutable thermoType mixture_; - //- Mixture fraction - volScalarField& ft_; - - //- Fuel mass fraction - volScalarField& fu_; - - //- Regress variable - volScalarField& b_; - public: // Constructors - //- Construct from dictionary, mesh and phase name - veryInhomogeneousMixture - ( - const dictionary&, - const fvMesh&, - const word& - ); + //- Construct from a dictionary + veryInhomogeneousMixture(const dictionary&); //- Disallow default bitwise copy construction veryInhomogeneousMixture @@ -107,6 +103,7 @@ public: const veryInhomogeneousMixture& ) = delete; + //- Destructor virtual ~veryInhomogeneousMixture() {} @@ -120,107 +117,49 @@ public: return "veryInhomogeneousMixture<" + ThermoType::typeName() + '>'; } - const dimensionedScalar& stoicRatio() const + //- Return the specie names + static wordList specieNames() { - return stoicRatio_; + return {"ft", "fu", "b"}; } - const thermoType& mixture(const scalar, const scalar) const; - - const thermoMixtureType& cellThermoMixture(const label celli) const + //- Return the residual fraction of fuel in the burnt mixture + scalar fres(const scalar ft) const { - return mixture(ft_[celli], fu_[celli]); + return max(ft - (scalar(1) - ft)/stoicRatio_.value(), scalar(0)); } - const thermoMixtureType& patchFaceThermoMixture + //- Return the mixture for the given composition + const thermoType& mixture(const scalar ft, const scalar fu) const; + + //- Return the mixture for thermodynamic properties + const thermoMixtureType& thermoMixture ( - const label patchi, - const label facei - ) const - { - return mixture - ( - ft_.boundaryField()[patchi][facei], - fu_.boundaryField()[patchi][facei] - ); - } + const scalarFieldListSlice& + ) const; - const transportMixtureType& cellTransportMixture + //- Return the mixture for transport properties + const transportMixtureType& transportMixture ( - const label celli - ) const - { - return cellThermoMixture(celli); - } + const scalarFieldListSlice& + ) const; - const transportMixtureType& patchFaceTransportMixture + //- Return the mixture for transport properties + const transportMixtureType& transportMixture ( - const label patchi, - const label facei - ) const - { - return patchFaceThermoMixture(patchi, facei); - } + const scalarFieldListSlice&, + const thermoMixtureType& + ) const; - const transportMixtureType& cellTransportMixture - ( - const label, - const thermoMixtureType& thermoMixture - ) const - { - return thermoMixture; - } + //- Return the reactant mixture + const thermoType& reactants(const scalarFieldListSlice&) const; - const transportMixtureType& patchFaceTransportMixture - ( - const label, - const label, - const thermoMixtureType& thermoMixture - ) const - { - return thermoMixture; - } - - const thermoType& cellReactants(const label celli) const - { - return mixture(ft_[celli], ft_[celli]); - } - - const thermoType& patchFaceReactants - ( - const label patchi, - const label facei - ) const - { - return mixture - ( - ft_.boundaryField()[patchi][facei], - ft_.boundaryField()[patchi][facei] - ); - } - - const thermoType& cellProducts(const label celli) const - { - scalar ft = ft_[celli]; - return mixture(ft, fres(ft, stoicRatio().value())); - } - - const thermoType& patchFaceProducts - ( - const label patchi, - const label facei - ) const - { - scalar ft = ft_.boundaryField()[patchi][facei]; - return mixture(ft, fres(ft, stoicRatio().value())); - } + //- Return the product mixture + const thermoType& products(const scalarFieldListSlice&) const; //- Read dictionary void read(const dictionary&); - //- Return thermo based on index - const ThermoType& specieThermo(const label speciei) const; - // Member Operators diff --git a/src/thermophysicalModels/multicomponentThermo/mixtures/SpecieMixture/SpecieMixture.C b/src/thermophysicalModels/multicomponentThermo/multicomponentThermo/heMulticomponentThermo.C similarity index 51% rename from src/thermophysicalModels/multicomponentThermo/mixtures/SpecieMixture/SpecieMixture.C rename to src/thermophysicalModels/multicomponentThermo/multicomponentThermo/heMulticomponentThermo.C index 986ce5a437..ee747c9298 100644 --- a/src/thermophysicalModels/multicomponentThermo/mixtures/SpecieMixture/SpecieMixture.C +++ b/src/thermophysicalModels/multicomponentThermo/multicomponentThermo/heMulticomponentThermo.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,58 +23,54 @@ License \*---------------------------------------------------------------------------*/ -#include "SpecieMixture.H" +#include "heMulticomponentThermo.H" #include "fvMesh.H" -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // -template +template +template Foam::tmp -Foam::SpecieMixture::volScalarFieldProperty +Foam::heMulticomponentThermo::volScalarFieldPropertyi ( const word& psiName, const dimensionSet& psiDim, - scalar (MixtureType::thermoType::*psiMethod) - ( - const scalar, - const scalar - ) const, + Method psiMethod, const label speciei, - const volScalarField& p, - const volScalarField& T + const Args& ... args ) const { - const typename MixtureType::thermoType& thermo = + const typename HeThermo::mixtureType::thermoType& thermo = this->specieThermo(speciei); tmp tPsi ( volScalarField::New ( - IOobject::groupName(psiName, T.group()), - T.mesh(), + IOobject::groupName(psiName, this->T_.group()), + this->T_.mesh(), psiDim ) ); volScalarField& psi = tPsi.ref(); - forAll(p, celli) + forAll(psi, celli) { - psi[celli] = (thermo.*psiMethod)(p[celli], T[celli]); + psi[celli] = (thermo.*psiMethod)(args[celli] ...); } volScalarField::Boundary& psiBf = psi.boundaryFieldRef(); forAll(psiBf, patchi) { - const fvPatchScalarField& pp = p.boundaryField()[patchi]; - const fvPatchScalarField& pT = T.boundaryField()[patchi]; - fvPatchScalarField& ppsi = psiBf[patchi]; - - forAll(pp, facei) + forAll(psiBf[patchi], patchFacei) { - ppsi[facei] = (thermo.*psiMethod)(pp[facei], pT[facei]); + psiBf[patchi][patchFacei] = + (thermo.*psiMethod) + ( + args.boundaryField()[patchi][patchFacei] ... + ); } } @@ -82,29 +78,27 @@ Foam::SpecieMixture::volScalarFieldProperty } -template -Foam::tmp Foam::SpecieMixture::fieldProperty +template +template +Foam::tmp +Foam::heMulticomponentThermo::scalarFieldPropertyi ( - scalar (MixtureType::thermoType::*psiMethod) - ( - const scalar, - const scalar - ) const, + Method psiMethod, const label speciei, - const scalarField& p, - const scalarField& T + const Arg& arg, + const Args& ... args ) const { - const typename MixtureType::thermoType& thermo = + const typename HeThermo::mixtureType::thermoType& thermo = this->specieThermo(speciei); - tmp tPsi(new scalarField(p.size())); + tmp tPsi(new scalarField(arg.size())); scalarField& psi = tPsi.ref(); - forAll(p, facei) + forAll(psi, i) { - psi[facei] = (thermo.*psiMethod)(p[facei], T[facei]); + psi[i] = (thermo.*psiMethod)(arg[i], args[i] ...); } return tPsi; @@ -113,36 +107,48 @@ Foam::tmp Foam::SpecieMixture::fieldProperty // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -template -Foam::SpecieMixture::SpecieMixture +template +Foam::heMulticomponentThermo::heMulticomponentThermo ( - const dictionary& thermoDict, const fvMesh& mesh, const word& phaseName ) : - MixtureType(thermoDict, mesh, phaseName) + HeThermo(mesh, phaseName) +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template +Foam::heMulticomponentThermo::~heMulticomponentThermo() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -template -Foam::scalar Foam::SpecieMixture::Wi(const label speciei) const +template +Foam::scalar Foam::heMulticomponentThermo::Wi +( + const label speciei +) const { return this->specieThermo(speciei).W(); } -template -Foam::scalar Foam::SpecieMixture::Hf(const label speciei) const +template +Foam::scalar Foam::heMulticomponentThermo::hfi +( + const label speciei +) const { return this->specieThermo(speciei).Hf(); } -template -Foam::scalar Foam::SpecieMixture::rho +template +Foam::scalar Foam::heMulticomponentThermo::rhoi ( const label speciei, const scalar p, @@ -153,19 +159,20 @@ Foam::scalar Foam::SpecieMixture::rho } -template -Foam::tmp Foam::SpecieMixture::rho +template +Foam::tmp +Foam::heMulticomponentThermo::rhoi ( const label speciei, const volScalarField& p, const volScalarField& T ) const { - return volScalarFieldProperty + return volScalarFieldPropertyi ( "rho", dimDensity, - &MixtureType::thermoType::rho, + &HeThermo::mixtureType::thermoType::rho, speciei, p, T @@ -173,8 +180,8 @@ Foam::tmp Foam::SpecieMixture::rho } -template -Foam::scalar Foam::SpecieMixture::Cp +template +Foam::scalar Foam::heMulticomponentThermo::Cpi ( const label speciei, const scalar p, @@ -185,19 +192,20 @@ Foam::scalar Foam::SpecieMixture::Cp } -template -Foam::tmp Foam::SpecieMixture::Cp +template +Foam::tmp +Foam::heMulticomponentThermo::Cpi ( const label speciei, const volScalarField& p, const volScalarField& T ) const { - return volScalarFieldProperty + return volScalarFieldPropertyi ( "Cp", dimEnergy/dimMass/dimTemperature, - &MixtureType::thermoType::Cp, + &HeThermo::mixtureType::thermoType::Cp, speciei, p, T @@ -205,8 +213,8 @@ Foam::tmp Foam::SpecieMixture::Cp } -template -Foam::scalar Foam::SpecieMixture::HE +template +Foam::scalar Foam::heMulticomponentThermo::hei ( const label speciei, const scalar p, @@ -217,31 +225,17 @@ Foam::scalar Foam::SpecieMixture::HE } -template -Foam::tmp Foam::SpecieMixture::HE +template +Foam::tmp Foam::heMulticomponentThermo::hei ( const label speciei, const scalarField& p, const scalarField& T ) const { - return fieldProperty(&MixtureType::thermoType::HE, speciei, p, T); -} - - -template -Foam::tmp Foam::SpecieMixture::HE -( - const label speciei, - const volScalarField& p, - const volScalarField& T -) const -{ - return volScalarFieldProperty + return scalarFieldPropertyi ( - "HE", - dimEnergy/dimMass, - &MixtureType::thermoType::HE, + &HeThermo::mixtureType::thermoType::HE, speciei, p, T @@ -249,8 +243,29 @@ Foam::tmp Foam::SpecieMixture::HE } -template -Foam::scalar Foam::SpecieMixture::Hs +template +Foam::tmp +Foam::heMulticomponentThermo::hei +( + const label speciei, + const volScalarField& p, + const volScalarField& T +) const +{ + return volScalarFieldPropertyi + ( + "he", + dimEnergy/dimMass, + &HeThermo::mixtureType::thermoType::HE, + speciei, + p, + T + ); +} + + +template +Foam::scalar Foam::heMulticomponentThermo::hsi ( const label speciei, const scalar p, @@ -261,31 +276,17 @@ Foam::scalar Foam::SpecieMixture::Hs } -template -Foam::tmp Foam::SpecieMixture::Hs +template +Foam::tmp Foam::heMulticomponentThermo::hsi ( const label speciei, const scalarField& p, const scalarField& T ) const { - return fieldProperty(&MixtureType::thermoType::Hs, speciei, p, T); -} - - -template -Foam::tmp Foam::SpecieMixture::Hs -( - const label speciei, - const volScalarField& p, - const volScalarField& T -) const -{ - return volScalarFieldProperty + return scalarFieldPropertyi ( - "Hs", - dimEnergy/dimMass, - &MixtureType::thermoType::Hs, + &HeThermo::mixtureType::thermoType::Hs, speciei, p, T @@ -293,8 +294,29 @@ Foam::tmp Foam::SpecieMixture::Hs } -template -Foam::scalar Foam::SpecieMixture::Ha +template +Foam::tmp +Foam::heMulticomponentThermo::hsi +( + const label speciei, + const volScalarField& p, + const volScalarField& T +) const +{ + return volScalarFieldPropertyi + ( + "hs", + dimEnergy/dimMass, + &HeThermo::mixtureType::thermoType::Hs, + speciei, + p, + T + ); +} + + +template +Foam::scalar Foam::heMulticomponentThermo::hai ( const label speciei, const scalar p, @@ -305,31 +327,38 @@ Foam::scalar Foam::SpecieMixture::Ha } -template -Foam::tmp Foam::SpecieMixture::Ha +template +Foam::tmp Foam::heMulticomponentThermo::hai ( const label speciei, const scalarField& p, const scalarField& T ) const { - return fieldProperty(&MixtureType::thermoType::Ha, speciei, p, T); + return scalarFieldPropertyi + ( + &HeThermo::mixtureType::thermoType::Ha, + speciei, + p, + T + ); } -template -Foam::tmp Foam::SpecieMixture::Ha +template +Foam::tmp +Foam::heMulticomponentThermo::hai ( const label speciei, const volScalarField& p, const volScalarField& T ) const { - return volScalarFieldProperty + return volScalarFieldPropertyi ( - "Ha", + "ha", dimEnergy/dimMass, - &MixtureType::thermoType::Ha, + &HeThermo::mixtureType::thermoType::Ha, speciei, p, T @@ -337,40 +366,8 @@ Foam::tmp Foam::SpecieMixture::Ha } -template -Foam::scalar Foam::SpecieMixture::mu -( - const label speciei, - const scalar p, - const scalar T -) const -{ - return this->specieThermo(speciei).mu(p, T); -} - - -template -Foam::tmp Foam::SpecieMixture::mu -( - const label speciei, - const volScalarField& p, - const volScalarField& T -) const -{ - return volScalarFieldProperty - ( - "mu", - dimMass/dimLength/dimTime, - &MixtureType::thermoType::mu, - speciei, - p, - T - ); -} - - -template -Foam::scalar Foam::SpecieMixture::kappa +template +Foam::scalar Foam::heMulticomponentThermo::kappai ( const label speciei, const scalar p, @@ -381,19 +378,20 @@ Foam::scalar Foam::SpecieMixture::kappa } -template -Foam::tmp Foam::SpecieMixture::kappa +template +Foam::tmp +Foam::heMulticomponentThermo::kappai ( const label speciei, const volScalarField& p, const volScalarField& T ) const { - return volScalarFieldProperty + return volScalarFieldPropertyi ( "kappa", dimPower/dimLength/dimTemperature, - &MixtureType::thermoType::kappa, + &HeThermo::mixtureType::thermoType::kappa, speciei, p, T diff --git a/src/thermophysicalModels/multicomponentThermo/mixtures/SpecieMixture/SpecieMixture.H b/src/thermophysicalModels/multicomponentThermo/multicomponentThermo/heMulticomponentThermo.H similarity index 61% rename from src/thermophysicalModels/multicomponentThermo/mixtures/SpecieMixture/SpecieMixture.H rename to src/thermophysicalModels/multicomponentThermo/multicomponentThermo/heMulticomponentThermo.H index d15dc463f4..de073717c1 100644 --- a/src/thermophysicalModels/multicomponentThermo/mixtures/SpecieMixture/SpecieMixture.H +++ b/src/thermophysicalModels/multicomponentThermo/multicomponentThermo/heMulticomponentThermo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -22,70 +22,58 @@ License along with OpenFOAM. If not, see . Class - Foam::SpecieMixture + Foam::heMulticomponentThermo Description - Foam::SpecieMixture + Multi-component thermo implementation SourceFiles - SpecieMixture.C + heMulticomponentThermo.C \*---------------------------------------------------------------------------*/ -#ifndef SpecieMixture_H -#define SpecieMixture_H +#ifndef heMulticomponentThermo_H +#define heMulticomponentThermo_H -#include "scalar.H" -#include "volFields.H" +#include "heThermo.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { -// Forward declaration of classes -class dictionary; -class fvMesh; - - /*---------------------------------------------------------------------------*\ - Class SpecieMixture Declaration + Class heMulticomponentThermo Declaration \*---------------------------------------------------------------------------*/ -template -class SpecieMixture +template +class heMulticomponentThermo : - public MixtureType + public HeThermo { +protected: - // Private Member Functions + // Protected Member Functions //- Return a volScalarField of the given property - tmp volScalarFieldProperty + template + tmp volScalarFieldPropertyi ( const word& psiName, const dimensionSet& psiDim, - scalar (MixtureType::thermoType::*psiMethod) - ( - const scalar, - const scalar - ) const, + Method psiMethod, const label speciei, - const volScalarField& p, - const volScalarField& T + const Args& ... args ) const; - //- Return a field of the given property - tmp fieldProperty + //- Return a scalarField of the given property + template + tmp scalarFieldPropertyi ( - scalar (MixtureType::thermoType::*psiMethod) - ( - const scalar, - const scalar - ) const, + Method psiMethod, const label speciei, - const scalarField& p, - const scalarField& T + const Arg& arg, + const Args& ... args ) const; @@ -93,27 +81,35 @@ public: // Constructors - //- Construct from dictionary, mesh and phase name - SpecieMixture(const dictionary&, const fvMesh&, const word& phaseName); + //- Construct from mesh and phase name + heMulticomponentThermo(const fvMesh&, const word& phaseName); + + //- Disallow default bitwise copy construction + heMulticomponentThermo + ( + const heMulticomponentThermo& + ) = delete; //- Destructor - virtual ~SpecieMixture() - {} + virtual ~heMulticomponentThermo(); // Member Functions // Specie properties - //- Molecular weight of the given specie [kg/kmol] + //- Molecular weight [kg/kmol] virtual scalar Wi(const label speciei) const; //- Enthalpy of formation [J/kg] - virtual scalar Hf(const label speciei) const; + virtual scalar hfi(const label speciei) const; + + + // Specie thermo properties //- Density [kg/m^3] - virtual scalar rho + virtual scalar rhoi ( const label speciei, const scalar p, @@ -121,7 +117,7 @@ public: ) const; //- Density [kg/m^3] - virtual tmp rho + virtual tmp rhoi ( const label speciei, const volScalarField& p, @@ -129,7 +125,7 @@ public: ) const; //- Heat capacity at constant pressure [J/kg/K] - virtual scalar Cp + virtual scalar Cpi ( const label speciei, const scalar p, @@ -137,7 +133,7 @@ public: ) const; //- Heat capacity at constant pressure [J/kg/K] - virtual tmp Cp + virtual tmp Cpi ( const label speciei, const volScalarField& p, @@ -145,7 +141,7 @@ public: ) const; //- Enthalpy/Internal energy [J/kg] - virtual scalar HE + virtual scalar hei ( const label speciei, const scalar p, @@ -153,7 +149,7 @@ public: ) const; //- Enthalpy/Internal energy [J/kg] - virtual tmp HE + virtual tmp hei ( const label speciei, const scalarField& p, @@ -161,7 +157,7 @@ public: ) const; //- Enthalpy/Internal energy [J/kg] - virtual tmp HE + virtual tmp hei ( const label speciei, const volScalarField& p, @@ -169,7 +165,7 @@ public: ) const; //- Sensible enthalpy [J/kg] - virtual scalar Hs + virtual scalar hsi ( const label speciei, const scalar p, @@ -177,7 +173,7 @@ public: ) const; //- Sensible enthalpy [J/kg] - virtual tmp Hs + virtual tmp hsi ( const label speciei, const scalarField& p, @@ -185,7 +181,7 @@ public: ) const; //- Sensible enthalpy [J/kg] - virtual tmp Hs + virtual tmp hsi ( const label speciei, const volScalarField& p, @@ -193,7 +189,7 @@ public: ) const; //- Absolute enthalpy [J/kg] - virtual scalar Ha + virtual scalar hai ( const label speciei, const scalar p, @@ -201,7 +197,7 @@ public: ) const; //- Absolute enthalpy [J/kg] - virtual tmp Ha + virtual tmp hai ( const label speciei, const scalarField& p, @@ -209,7 +205,7 @@ public: ) const; //- Absolute enthalpy [J/kg] - virtual tmp Ha + virtual tmp hai ( const label speciei, const volScalarField& p, @@ -217,26 +213,10 @@ public: ) const; - // Per specie transport properties - - //- Dynamic viscosity [kg/m/s] - virtual scalar mu - ( - const label speciei, - const scalar p, - const scalar T - ) const; - - //- Dynamic viscosity [kg/m/s] - virtual tmp mu - ( - const label speciei, - const volScalarField& p, - const volScalarField& T - ) const; + // Specie transport properties //- Thermal conductivity [W/m/K] - virtual scalar kappa + virtual scalar kappai ( const label speciei, const scalar p, @@ -244,36 +224,12 @@ public: ) const; //- Thermal conductivity [W/m/K] - virtual tmp kappa + virtual tmp kappai ( const label speciei, const volScalarField& p, const volScalarField& T ) const; - - - // Field properties abstract functions provided here to avoid issues - // with inheritance of virtual functions in heThermo - - //- Heat capacity at constant pressure for patch [J/kg/K] - virtual const volScalarField& Cp() const = 0; - - //- Heat capacity at constant pressure for patch [J/kg/K] - virtual tmp Cp - ( - const scalarField& T, - const label patchi - ) const = 0; - - //- Heat capacity at constant volume [J/kg/K] - virtual const volScalarField& Cv() const = 0; - - //- Heat capacity at constant volume for patch [J/kg/K] - virtual tmp Cv - ( - const scalarField& T, - const label patchi - ) const = 0; }; @@ -284,7 +240,7 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * #ifdef NoRepository - #include "SpecieMixture.C" + #include "heMulticomponentThermo.C" #endif // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/thermophysicalModels/multicomponentThermo/mixtures/basicSpecieMixture/basicSpecieMixture.C b/src/thermophysicalModels/multicomponentThermo/multicomponentThermo/multicomponentThermo.C similarity index 65% rename from src/thermophysicalModels/multicomponentThermo/mixtures/basicSpecieMixture/basicSpecieMixture.C rename to src/thermophysicalModels/multicomponentThermo/multicomponentThermo/multicomponentThermo.C index adb8887e18..6ee34b8fb9 100644 --- a/src/thermophysicalModels/multicomponentThermo/mixtures/basicSpecieMixture/basicSpecieMixture.C +++ b/src/thermophysicalModels/multicomponentThermo/multicomponentThermo/multicomponentThermo.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2014-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,59 +23,86 @@ License \*---------------------------------------------------------------------------*/ -#include "basicSpecieMixture.H" +#include "multicomponentThermo.H" -// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // +// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // -namespace Foam +void Foam::multicomponentThermo::implementation::correctMassFractions() { - defineTypeNameAndDebug(basicSpecieMixture, 0); + if (species_.size()) + { + tmp tYt + ( + volScalarField::New + ( + IOobject::groupName("Yt", Y_[0].group()), + Y_[0], + calculatedFvPatchScalarField::typeName + ) + ); + volScalarField& Yt = tYt.ref(); + + for (label i=1; i + ? dict.lookupBackwardsCompatible ( {"defaultSpecie", "inertSpecie"} ) : word("undefined") ), - defaultSpecieIndex_(-1), + defaultSpeciei_ + ( + species_.size() + && species_.found(defaultSpecieName_) + ? species_[defaultSpecieName_] + : -1 + ), active_(species_.size(), true), - Y_(species_.size()) + Y_(species_.size()), + Yslicer_() { - if (species_.size()) + if (species_.size() && defaultSpeciei_ == -1) { - if (species_.found(defaultSpecie_)) - { - defaultSpecieIndex_ = species_[defaultSpecie_]; - } - else - { - FatalIOErrorInFunction(thermoDict) - << "default specie " << defaultSpecie_ - << " not found in available species " << species_ - << exit(FatalIOError); - } + FatalIOErrorInFunction(dict) + << "default specie " << defaultSpecieName_ + << " not found in available species " << species_ + << exit(FatalIOError); } + // Read the species' mass fractions tmp tYdefault; - forAll(species_, i) { typeIOobject header @@ -86,9 +113,9 @@ Foam::basicSpecieMixture::basicSpecieMixture IOobject::NO_READ ); - // check if field exists and can be read if (header.headerOk()) { + // Read the mass fraction field Y_.set ( i, @@ -176,71 +203,108 @@ Foam::basicSpecieMixture::basicSpecieMixture } } + Yslicer_.set(Y_); + correctMassFractions(); } -void Foam::basicSpecieMixture::correctMassFractions() +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::multicomponentThermo::~multicomponentThermo() +{} + + +Foam::multicomponentThermo::implementation::~implementation() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +const Foam::speciesTable& +Foam::multicomponentThermo::implementation::species() const { - if (species_.size()) + return species_; +} + + +Foam::label Foam::multicomponentThermo::implementation::defaultSpecie() const +{ + return defaultSpeciei_; +} + + +const Foam::List& +Foam::multicomponentThermo::implementation::speciesActive() const +{ + return active_; +} + + +void Foam::multicomponentThermo::syncSpeciesActive() const +{ + if (Pstream::parRun()) { - tmp tYt - ( - volScalarField::New - ( - IOobject::groupName("Yt", phaseName_), - Y_[0], - calculatedFvPatchScalarField::typeName - ) - ); - volScalarField& Yt = tYt.ref(); + List& speciesActive = + const_cast&>(this->speciesActive()); - for (label i=1; i()); + Pstream::listCombineScatter(speciesActive); - if (mag(min(Yt).value()) < rootVSmall) - { - FatalErrorInFunction - << "Sum of mass fractions is zero for species " << species() - << exit(FatalError); - } + PtrList& Y = + const_cast&>(this->Y()); - forAll(Y_, i) + forAll(Y, speciei) { - Y_[i] /= Yt; + if (speciesActive[speciei]) + { + Y[speciei].writeOpt() = IOobject::AUTO_WRITE; + } } } } -void Foam::basicSpecieMixture::normalise() +Foam::PtrList& +Foam::multicomponentThermo::implementation::Y() { - if (species_.size()) + return Y_; +} + + +const Foam::PtrList& +Foam::multicomponentThermo::implementation::Y() const +{ + return Y_; +} + + +void Foam::multicomponentThermo::normaliseY() +{ + if (species().size()) { tmp tYt ( volScalarField::New ( - IOobject::groupName("Yt", phaseName_), - Y_[0].mesh(), + IOobject::groupName("Yt", phaseName()), + Y()[0].mesh(), dimensionedScalar(dimless, 0) ) ); volScalarField& Yt = tYt.ref(); - forAll(Y_, i) + forAll(Y(), i) { - if (solve(i)) + if (solveSpecie(i)) { - Y_[i].max(scalar(0)); - Yt += Y_[i]; + Y()[i].max(scalar(0)); + Yt += Y()[i]; } } - Y_[defaultSpecieIndex_] = scalar(1) - Yt; - Y_[defaultSpecieIndex_].max(scalar(0)); + Y()[defaultSpecie()] = scalar(1) - Yt; + Y()[defaultSpecie()].max(scalar(0)); } } diff --git a/src/thermophysicalModels/multicomponentThermo/mixtures/basicSpecieMixture/basicSpecieMixture.H b/src/thermophysicalModels/multicomponentThermo/multicomponentThermo/multicomponentThermo.H similarity index 51% rename from src/thermophysicalModels/multicomponentThermo/mixtures/basicSpecieMixture/basicSpecieMixture.H rename to src/thermophysicalModels/multicomponentThermo/multicomponentThermo/multicomponentThermo.H index 6fafc4768f..ce62636eb5 100644 --- a/src/thermophysicalModels/multicomponentThermo/mixtures/basicSpecieMixture/basicSpecieMixture.H +++ b/src/thermophysicalModels/multicomponentThermo/multicomponentThermo/multicomponentThermo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2014-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -22,24 +22,25 @@ License along with OpenFOAM. If not, see . Class - Foam::basicSpecieMixture + Foam::multicomponentThermo Description - Specialisation of basicMixture for a mixture consisting of a number for - molecular species. + Base-class for multi-component thermodynamic properties. + +See also + Foam::basicThermo SourceFiles - basicSpecieMixture.C + multicomponentThermo.C \*---------------------------------------------------------------------------*/ -#ifndef basicSpecieMixture_H -#define basicSpecieMixture_H +#ifndef multicomponentThermo_H +#define multicomponentThermo_H -#include "volFields.H" -#include "PtrList.H" -#include "basicMixture.H" +#include "basicThermo.H" #include "speciesTable.H" +#include "GeometricFieldListSlicer.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -47,39 +48,254 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class basicSpecieMixture Declaration + Class multicomponentThermo Declaration \*---------------------------------------------------------------------------*/ -class basicSpecieMixture +class multicomponentThermo : - public basicMixture + virtual public basicThermo { +public: + // Public Classes + + //- Forward declare the implementation class + class implementation; + + + //- Destructor + virtual ~multicomponentThermo(); + + + // Member Functions + + // Species set + + //- The table of species + virtual const speciesTable& species() const = 0; + + //- Does the mixture include this specie? + inline bool containsSpecie(const word& specieName) const; + + //- The index of the default specie + virtual label defaultSpecie() const = 0; + + + // Active/Inactive handling + + //- Access the specie active flags + virtual const List& speciesActive() const = 0; + + //- Synchronise the specie active flags + void syncSpeciesActive() const; + + //- Set specie active + inline void setSpecieActive(const label speciei) const; + + //- Set specie inactive + inline void setSpecieInactive(const label speciei) const; + + //- Should the given specie be solved for? I.e., is it active and + // not the default specie? + inline bool solveSpecie(const label speciei) const; + + + // Mass fractions + + //- Access the mass-fraction fields + virtual PtrList& Y() = 0; + + //- Access the mass-fraction fields + virtual const PtrList& Y() const = 0; + + //- Access the mass-fraction field for a specie given by index + inline volScalarField& Y(const label speciei); + + //- Access the mass-fraction field for a specie given by index + inline const volScalarField& Y(const label speciei) const; + + //- Access the mass-fraction field for a specie given by name + inline volScalarField& Y(const word& specieName); + + //- Access the mass-fraction field for a specie given by name + inline const volScalarField& Y(const word& specieName) const; + + //- Access the specie index of the given mass-fraction field + inline label specieIndex(const volScalarField& Yi) const; + + //- Normalise the mass fractions by clipping positive and deriving + // the default specie mass fraction from the other species. + void normaliseY(); + + + // Specie properties + + //- Molecular weight [kg/kmol] + virtual scalar Wi(const label speciei) const = 0; + + //- Enthalpy of formation [J/kg] + virtual scalar hfi(const label speciei) const = 0; + + + // Specie thermo properties + + //- Density [kg/m^3] + virtual scalar rhoi + ( + const label speciei, + const scalar p, + const scalar T + ) const = 0; + + //- Density [kg/m^3] + virtual tmp rhoi + ( + const label speciei, + const volScalarField& p, + const volScalarField& T + ) const = 0; + + //- Heat capacity at constant pressure [J/kg/K] + virtual scalar Cpi + ( + const label speciei, + const scalar p, + const scalar T + ) const = 0; + + //- Heat capacity at constant pressure [J/kg/K] + virtual tmp Cpi + ( + const label speciei, + const volScalarField& p, + const volScalarField& T + ) const = 0; + + //- Enthalpy/Internal energy [J/kg] + virtual scalar hei + ( + const label speciei, + const scalar p, + const scalar T + ) const = 0; + + //- Enthalpy/Internal energy [J/kg] + virtual tmp hei + ( + const label speciei, + const scalarField& p, + const scalarField& T + ) const = 0; + + //- Enthalpy/Internal energy [J/kg] + virtual tmp hei + ( + const label speciei, + const volScalarField& p, + const volScalarField& T + ) const = 0; + + //- Sensible enthalpy [J/kg] + virtual scalar hsi + ( + const label speciei, + const scalar p, + const scalar T + ) const = 0; + + //- Sensible enthalpy [J/kg] + virtual tmp hsi + ( + const label speciei, + const scalarField& p, + const scalarField& T + ) const = 0; + + //- Sensible enthalpy [J/kg] + virtual tmp hsi + ( + const label speciei, + const volScalarField& p, + const volScalarField& T + ) const = 0; + + //- Absolute enthalpy [J/kg] + virtual scalar hai + ( + const label speciei, + const scalar p, + const scalar T + ) const = 0; + + //- Absolute enthalpy [J/kg] + virtual tmp hai + ( + const label speciei, + const scalarField& p, + const scalarField& T + ) const = 0; + + //- Absolute enthalpy [J/kg] + virtual tmp hai + ( + const label speciei, + const volScalarField& p, + const volScalarField& T + ) const = 0; + + + // Specie transport properties + + //- Thermal conductivity [W/m/K] + virtual scalar kappai + ( + const label speciei, + const scalar p, + const scalar T + ) const = 0; + + //- Thermal conductivity [W/m/K] + virtual tmp kappai + ( + const label speciei, + const volScalarField& p, + const volScalarField& T + ) const = 0; +}; + + +/*---------------------------------------------------------------------------*\ + Class multicomponentThermo Declaration +\*---------------------------------------------------------------------------*/ + +class multicomponentThermo::implementation +: + virtual public multicomponentThermo +{ protected: // Protected data - //- Phase-name - const word& phaseName_; - //- Table of specie names speciesTable species_; - //- The name of the default specie - // The mass fraction of which is derived from the other species - // rather than solved. - // Also used as the carrier specie in multicomponent diffusion - word defaultSpecie_; + //- The name of the default specie. The mass fraction of which is + // derived from the other species rather than solved. Also used as the + // carrier specie in multicomponent diffusion. + word defaultSpecieName_; //- The index of the default specie - label defaultSpecieIndex_; + label defaultSpeciei_; //- List of specie active flags - mutable List active_; + List active_; //- Species mass fractions PtrList Y_; + //- Species mass fractions slicing engine + volScalarFieldListSlicer Yslicer_; + // Protected Member Functions @@ -89,233 +305,48 @@ protected: public: - //- Run time type information - TypeName("basicSpecieMixture"); - - //- The base class of the mixture - typedef basicSpecieMixture basicMixtureType; - - // Constructors - //- Construct from dictionary, species names, mesh and phase name - basicSpecieMixture + //- Construct from dictionary, specie names, mesh and phase name + implementation ( const dictionary&, - const wordList& specieNames, + const wordList&, const fvMesh&, const word& ); //- Destructor - virtual ~basicSpecieMixture() - {} + virtual ~implementation(); // Member Functions - //- Return the table of species - inline const speciesTable& species() const; + //- The table of species + virtual const speciesTable& species() const; - //- Does the mixture include this specie? - inline bool contains(const word& specieName) const; + //- The index of the default specie + virtual label defaultSpecie() const; - //- Return the index of the default specie - inline label defaultSpecie() const; + //- Access the specie active flags + virtual const List& speciesActive() const; - //- Return true for active species - inline bool active(label speciei) const; + //- Access the mass-fraction fields + virtual PtrList& Y(); - //- Return the bool list of active species - inline const List& active() const; + //- Access the mass-fraction fields + virtual const PtrList& Y() const; - //- Set speciei active - inline void setActive(label speciei) const; + //- Get the composition of an internal cell + inline scalarFieldListSlice cellComposition(const label celli) const; - //- Set speciei inactive - inline void setInactive(label speciei) const; - - //- Return true if the specie should be solved for - // i.e. active and not the default specie - inline bool solve(label speciei) const; - - //- Return the mass-fraction fields - inline PtrList& Y(); - - //- Return the const mass-fraction fields - inline const PtrList& Y() const; - - //- Return the mass-fraction field for a specie given by index - inline volScalarField& Y(const label i); - - //- Return the const mass-fraction field for a specie given by index - inline const volScalarField& Y(const label i) const; - - //- Return the mass-fraction field for a specie given by name - inline volScalarField& Y(const word& specieName); - - //- Return the const mass-fraction field for a specie given by name - inline const volScalarField& Y(const word& specieName) const; - - //- Return the specie index of the given mass-fraction field - inline label index(const volScalarField& Yi) const; - - //- Normalise the mass fractions - // by clipping positive - // and deriving the default specie mass fraction from the other species - void normalise(); - - - // Specie properties - - //- Molecular weight of the given specie [kg/kmol] - virtual scalar Wi(const label speciei) const = 0; - - //- Enthalpy of formation [J/kg] - virtual scalar Hf(const label speciei) const = 0; - - - // Specie thermo properties - - //- Density [kg/m^3] - virtual scalar rho - ( - const label speciei, - const scalar p, - const scalar T - ) const = 0; - - //- Density [kg/m^3] - virtual tmp rho - ( - const label speciei, - const volScalarField& p, - const volScalarField& T - ) const = 0; - - //- Heat capacity at constant pressure [J/kg/K] - virtual scalar Cp - ( - const label speciei, - const scalar p, - const scalar T - ) const = 0; - - //- Heat capacity at constant pressure [J/kg/K] - virtual tmp Cp - ( - const label speciei, - const volScalarField& p, - const volScalarField& T - ) const = 0; - - //- Enthalpy/Internal energy [J/kg] - virtual scalar HE - ( - const label speciei, - const scalar p, - const scalar T - ) const = 0; - - //- Enthalpy/Internal energy [J/kg] - virtual tmp HE - ( - const label speciei, - const scalarField& p, - const scalarField& T - ) const = 0; - - //- Enthalpy/Internal energy [J/kg] - virtual tmp HE - ( - const label speciei, - const volScalarField& p, - const volScalarField& T - ) const = 0; - - //- Sensible enthalpy [J/kg] - virtual scalar Hs - ( - const label speciei, - const scalar p, - const scalar T - ) const = 0; - - //- Sensible enthalpy [J/kg] - virtual tmp Hs - ( - const label speciei, - const scalarField& p, - const scalarField& T - ) const = 0; - - //- Sensible enthalpy [J/kg] - virtual tmp Hs - ( - const label speciei, - const volScalarField& p, - const volScalarField& T - ) const = 0; - - //- Absolute enthalpy [J/kg] - virtual scalar Ha - ( - const label speciei, - const scalar p, - const scalar T - ) const = 0; - - //- Enthalpy/Internal energy [J/kg] - virtual tmp Ha - ( - const label speciei, - const scalarField& p, - const scalarField& T - ) const = 0; - - //- Absolute enthalpy [J/kg] - virtual tmp Ha - ( - const label speciei, - const volScalarField& p, - const volScalarField& T - ) const = 0; - - - // Specie transport properties - - //- Dynamic viscosity [kg/m/s] - virtual scalar mu - ( - const label speciei, - const scalar p, - const scalar T - ) const = 0; - - //- Dynamic viscosity [kg/m/s] - virtual tmp mu - ( - const label speciei, - const volScalarField& p, - const volScalarField& T - ) const = 0; - - //- Thermal conductivity [W/m/K] - virtual scalar kappa - ( - const label speciei, - const scalar p, - const scalar T - ) const = 0; - - //- Thermal conductivity [W/m/K] - virtual tmp kappa - ( - const label speciei, - const volScalarField& p, - const volScalarField& T - ) const = 0; + //- Get the composition of a boundary face + inline scalarFieldListSlice patchFaceComposition + ( + const label patchi, + const label facei + ) const; }; @@ -325,7 +356,7 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -#include "basicSpecieMixtureI.H" +#include "multicomponentThermoI.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/thermophysicalModels/multicomponentThermo/multicomponentThermo/multicomponentThermoI.H b/src/thermophysicalModels/multicomponentThermo/multicomponentThermo/multicomponentThermoI.H new file mode 100644 index 0000000000..e9a920f52c --- /dev/null +++ b/src/thermophysicalModels/multicomponentThermo/multicomponentThermo/multicomponentThermoI.H @@ -0,0 +1,128 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2023 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 "multicomponentThermo.H" + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +inline bool Foam::multicomponentThermo::containsSpecie +( + const word& specieName +) const +{ + return species().found(specieName); +} + + +inline void Foam::multicomponentThermo::setSpecieActive +( + const label speciei +) const +{ + const_cast&>(speciesActive())[speciei] = true; + const_cast(Y()[speciei]).writeOpt() = IOobject::AUTO_WRITE; +} + + +inline void Foam::multicomponentThermo::setSpecieInactive +( + const label speciei +) const +{ + const_cast&>(speciesActive())[speciei] = false; + const_cast(Y()[speciei]).writeOpt() = IOobject::NO_WRITE; +} + + +inline bool Foam::multicomponentThermo::solveSpecie(const label speciei) const +{ + return speciei != defaultSpecie() && speciesActive()[speciei]; +} + + +inline Foam::volScalarField& Foam::multicomponentThermo::Y(const label speciei) +{ + return Y()[speciei]; +} + + +inline const Foam::volScalarField& Foam::multicomponentThermo::Y +( + const label speciei +) const +{ + return Y()[speciei]; +} + + +inline Foam::volScalarField& Foam::multicomponentThermo::Y +( + const word& specieName +) +{ + return Y()[species()[specieName]]; +} + + +inline const Foam::volScalarField& Foam::multicomponentThermo::Y +( + const word& specieName +) const +{ + return Y()[species()[specieName]]; +} + + +inline Foam::label Foam::multicomponentThermo::specieIndex +( + const volScalarField& Yi +) const +{ + return species()[Yi.member()]; +} + + +inline Foam::scalarFieldListSlice +Foam::multicomponentThermo::implementation::cellComposition +( + const label celli +) const +{ + return Yslicer_.slice(celli); +} + + +inline Foam::scalarFieldListSlice +Foam::multicomponentThermo::implementation::patchFaceComposition +( + const label patchi, + const label facei +) const +{ + return Yslicer_.patchSlice(patchi, facei); +} + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/multicomponentThermo/psiMulticomponentThermo/psiMulticomponentThermo.C b/src/thermophysicalModels/multicomponentThermo/psiMulticomponentThermo/psiMulticomponentThermo.C index 63d5918f5c..3a18927060 100644 --- a/src/thermophysicalModels/multicomponentThermo/psiMulticomponentThermo/psiMulticomponentThermo.C +++ b/src/thermophysicalModels/multicomponentThermo/psiMulticomponentThermo/psiMulticomponentThermo.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -33,15 +33,6 @@ namespace Foam defineRunTimeSelectionTable(psiMulticomponentThermo, fvMesh); } -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::psiMulticomponentThermo::implementation::implementation -( - const fvMesh& mesh, - const word& phaseName -) -{} - // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // @@ -61,8 +52,4 @@ Foam::psiMulticomponentThermo::~psiMulticomponentThermo() {} -Foam::psiMulticomponentThermo::implementation::~implementation() -{} - - // ************************************************************************* // diff --git a/src/thermophysicalModels/multicomponentThermo/psiMulticomponentThermo/psiMulticomponentThermo.H b/src/thermophysicalModels/multicomponentThermo/psiMulticomponentThermo/psiMulticomponentThermo.H index 88dabee0c6..82e85404de 100644 --- a/src/thermophysicalModels/multicomponentThermo/psiMulticomponentThermo/psiMulticomponentThermo.H +++ b/src/thermophysicalModels/multicomponentThermo/psiMulticomponentThermo/psiMulticomponentThermo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -47,6 +47,11 @@ SourceFiles namespace Foam { +template class heThermo; +template class hePsiThermo; +template class heMulticomponentThermo; +template class heFluidMulticomponentThermo; + /*---------------------------------------------------------------------------*\ Class psiMulticomponentThermo Declaration \*---------------------------------------------------------------------------*/ @@ -60,13 +65,27 @@ public: // Public Classes - //- Forward declare the implementation class - class implementation; - //- Forward declare the composite class class composite; + // Public Typedefs + + //- The derived type + template + using heThermoType = + heFluidMulticomponentThermo + < + heMulticomponentThermo + < + hePsiThermo + < + heThermo + > + > + >; + + //- Runtime type information TypeName("psiMulticomponentThermo"); @@ -97,27 +116,6 @@ public: }; -/*---------------------------------------------------------------------------*\ - Class psiMulticomponentThermo::implementation Declaration -\*---------------------------------------------------------------------------*/ - -class psiMulticomponentThermo::implementation -: - virtual public psiMulticomponentThermo -{ -public: - - // Constructors - - //- Construct from mesh and phase name - implementation(const fvMesh&, const word& phaseName); - - - //- Destructor - virtual ~implementation(); -}; - - /*---------------------------------------------------------------------------*\ Class psiMulticomponentThermo::composite Declaration \*---------------------------------------------------------------------------*/ @@ -127,25 +125,33 @@ class psiMulticomponentThermo::composite public basicThermo::implementation, public fluidThermo::implementation, public psiThermo::implementation, - public fluidMulticomponentThermo::implementation, - public psiMulticomponentThermo::implementation + public multicomponentThermo::implementation, + public psiMulticomponentThermo { public: // Constructors - //- Construct from mesh and phase name + //- Construct from dictionary, mesh and phase name + template composite ( + const dictionary& dict, + const MixtureType& mixture, const fvMesh& mesh, const word& phaseName ) : - basicThermo::implementation(mesh, phaseName), - fluidThermo::implementation(mesh, phaseName), - psiThermo::implementation(mesh, phaseName), - fluidMulticomponentThermo::implementation(mesh, phaseName), - psiMulticomponentThermo::implementation(mesh, phaseName) + basicThermo::implementation(dict, mesh, phaseName), + fluidThermo::implementation(dict, mesh, phaseName), + psiThermo::implementation(dict, mesh, phaseName), + multicomponentThermo::implementation + ( + dict, + mixture.specieNames(), + mesh, + phaseName + ) {} }; diff --git a/src/thermophysicalModels/multicomponentThermo/psiMulticomponentThermo/psiMulticomponentThermos.C b/src/thermophysicalModels/multicomponentThermo/psiMulticomponentThermo/psiMulticomponentThermos.C index a881991930..2c5ed92b36 100644 --- a/src/thermophysicalModels/multicomponentThermo/psiMulticomponentThermo/psiMulticomponentThermos.C +++ b/src/thermophysicalModels/multicomponentThermo/psiMulticomponentThermo/psiMulticomponentThermos.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -30,30 +30,11 @@ License #include "psiThermo.H" #include "psiMulticomponentThermo.H" #include "hePsiThermo.H" +#include "heMulticomponentThermo.H" +#include "heFluidMulticomponentThermo.H" #include "forGases.H" -#include "makeMulticomponentThermo.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#define makePsiMulticomponentThermos(Mixture, ThermoPhysics) \ - makeMulticomponentThermos \ - ( \ - psiThermo, \ - psiMulticomponentThermo, \ - hePsiThermo, \ - Mixture, \ - ThermoPhysics \ - ) - -#define makePsiMulticomponentThermo(Mixture, ThermoPhysics) \ - makeMulticomponentThermo \ - ( \ - psiMulticomponentThermo, \ - hePsiThermo, \ - Mixture, \ - ThermoPhysics \ - ) +#include "makeFluidMulticomponentThermo.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -61,17 +42,24 @@ namespace Foam { forCoeffGases ( - makePsiMulticomponentThermos, + makeFluidMulticomponentThermos, + psiThermo, + psiMulticomponentThermo, coefficientMulticomponentMixture ); - forCoeffGases ( - makePsiMulticomponentThermos, + makeFluidMulticomponentThermos, + psiThermo, + psiMulticomponentThermo, coefficientWilkeMulticomponentMixture ); - - forGases(makePsiMulticomponentThermo, singleComponentMixture); + forGases + ( + makeFluidMulticomponentThermo, + psiMulticomponentThermo, + singleComponentMixture + ); } // ************************************************************************* // diff --git a/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/heheuPsiThermo.C b/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/heheuPsiThermo.C index 65782c5a4e..c556af20fa 100644 --- a/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/heheuPsiThermo.C +++ b/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/heheuPsiThermo.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -29,8 +29,8 @@ License // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -template -void Foam::heheuPsiThermo::calculate() +template +void Foam::heheuPsiThermo::calculate() { const scalarField& hCells = this->he_; const scalarField& heuCells = this->heu_; @@ -46,11 +46,14 @@ void Foam::heheuPsiThermo::calculate() forAll(TCells, celli) { - const typename MixtureType::thermoMixtureType& thermoMixture = - this->cellThermoMixture(celli); + auto composition = this->cellComposition(celli); - const typename MixtureType::transportMixtureType& transportMixture = - this->cellTransportMixture(celli, thermoMixture); + const typename HeThermo::mixtureType::thermoMixtureType& + thermoMixture = this->thermoMixture(composition); + + const typename HeThermo::mixtureType::transportMixtureType& + transportMixture = + this->transportMixture(composition, thermoMixture); TCells[celli] = thermoMixture.THE ( @@ -67,7 +70,7 @@ void Foam::heheuPsiThermo::calculate() kappaCells[celli] = transportMixture.kappa(pCells[celli], TCells[celli]); - TuCells[celli] = this->cellReactants(celli).THE + TuCells[celli] = this->reactants(composition).THE ( heuCells[celli], pCells[celli], @@ -122,13 +125,14 @@ void Foam::heheuPsiThermo::calculate() { forAll(pT, facei) { - const typename MixtureType::thermoMixtureType& - thermoMixture = this->patchFaceThermoMixture(patchi, facei); + auto composition = this->patchFaceComposition(patchi, facei); - const typename MixtureType::transportMixtureType& + const typename HeThermo::mixtureType::thermoMixtureType& + thermoMixture = this->thermoMixture(composition); + + const typename HeThermo::mixtureType::transportMixtureType& transportMixture = - this->patchFaceTransportMixture - (patchi, facei, thermoMixture); + this->transportMixture(composition, thermoMixture); phe[facei] = thermoMixture.HE(pp[facei], pT[facei]); @@ -143,13 +147,14 @@ void Foam::heheuPsiThermo::calculate() { forAll(pT, facei) { - const typename MixtureType::thermoMixtureType& - thermoMixture = this->patchFaceThermoMixture(patchi, facei); + auto composition = this->patchFaceComposition(patchi, facei); - const typename MixtureType::transportMixtureType& + const typename HeThermo::mixtureType::thermoMixtureType& + thermoMixture = this->thermoMixture(composition); + + const typename HeThermo::mixtureType::transportMixtureType& transportMixture = - this->patchFaceTransportMixture - (patchi, facei, thermoMixture); + this->transportMixture(composition, thermoMixture); pT[facei] = thermoMixture.THE(phe[facei], pp[facei], pT[facei]); @@ -160,7 +165,7 @@ void Foam::heheuPsiThermo::calculate() pkappa[facei] = transportMixture.kappa(pp[facei], pT[facei]); pTu[facei] = - this->patchFaceReactants(patchi, facei) + this->reactants(composition) .THE(pheu[facei], pp[facei], pTu[facei]); } } @@ -170,14 +175,14 @@ void Foam::heheuPsiThermo::calculate() // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -template -Foam::heheuPsiThermo::heheuPsiThermo +template +Foam::heheuPsiThermo::heheuPsiThermo ( const fvMesh& mesh, const word& phaseName ) : - heThermo(mesh, phaseName), + HeThermo(mesh, phaseName), Tu_ ( IOobject @@ -194,7 +199,7 @@ Foam::heheuPsiThermo::heheuPsiThermo ( IOobject ( - MixtureType::thermoType::heName() + 'u', + HeThermo::mixtureType::thermoType::heName() + 'u', mesh.time().name(), mesh, IOobject::NO_READ, @@ -202,11 +207,10 @@ Foam::heheuPsiThermo::heheuPsiThermo ), this->volScalarFieldProperty ( - MixtureType::thermoType::heName() + 'u', + HeThermo::mixtureType::thermoType::heName() + 'u', dimEnergy/dimMass, - &MixtureType::cellReactants, - &MixtureType::patchFaceReactants, - &MixtureType::thermoMixtureType::HE, + &HeThermo::mixtureType::reactants, + &HeThermo::mixtureType::thermoMixtureType::HE, this->p_, this->Tu_ ), @@ -223,17 +227,17 @@ Foam::heheuPsiThermo::heheuPsiThermo // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // -template -Foam::heheuPsiThermo::~heheuPsiThermo() +template +Foam::heheuPsiThermo::~heheuPsiThermo() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -template -void Foam::heheuPsiThermo::correct() +template +void Foam::heheuPsiThermo::correct() { - if (debug) + if (HeThermo::debug) { InfoInFunction << endl; } @@ -243,16 +247,16 @@ void Foam::heheuPsiThermo::correct() calculate(); - if (debug) + if (HeThermo::debug) { Info<< " Finished" << endl; } } -template +template Foam::tmp -Foam::heheuPsiThermo::heu +Foam::heheuPsiThermo::heu ( const scalarField& Tu, const labelList& cells @@ -260,8 +264,8 @@ Foam::heheuPsiThermo::heu { return this->cellSetProperty ( - &MixtureType::cellReactants, - &MixtureType::thermoMixtureType::HE, + &HeThermo::mixtureType::reactants, + &HeThermo::mixtureType::thermoMixtureType::HE, cells, UIndirectList(this->p_, cells), Tu @@ -269,9 +273,9 @@ Foam::heheuPsiThermo::heu } -template +template Foam::tmp -Foam::heheuPsiThermo::heu +Foam::heheuPsiThermo::heu ( const scalarField& Tu, const label patchi @@ -279,8 +283,8 @@ Foam::heheuPsiThermo::heu { return this->patchFieldProperty ( - &MixtureType::patchFaceReactants, - &MixtureType::thermoMixtureType::HE, + &HeThermo::mixtureType::reactants, + &HeThermo::mixtureType::thermoMixtureType::HE, patchi, this->p_.boundaryField()[patchi], Tu @@ -288,17 +292,16 @@ Foam::heheuPsiThermo::heu } -template +template Foam::tmp -Foam::heheuPsiThermo::Tb() const +Foam::heheuPsiThermo::Tb() const { return this->volScalarFieldProperty ( "Tb", dimTemperature, - &MixtureType::cellProducts, - &MixtureType::patchFaceProducts, - &MixtureType::thermoMixtureType::THE, + &HeThermo::mixtureType::products, + &HeThermo::mixtureType::thermoMixtureType::THE, this->he_, this->p_, this->T_ @@ -306,26 +309,25 @@ Foam::heheuPsiThermo::Tb() const } -template +template Foam::tmp -Foam::heheuPsiThermo::psiu() const +Foam::heheuPsiThermo::psiu() const { return this->volScalarFieldProperty ( "psiu", this->psi_.dimensions(), - &MixtureType::cellReactants, - &MixtureType::patchFaceReactants, - &MixtureType::thermoMixtureType::psi, + &HeThermo::mixtureType::reactants, + &HeThermo::mixtureType::thermoMixtureType::psi, this->p_, this->Tu_ ); } -template +template Foam::tmp -Foam::heheuPsiThermo::psib() const +Foam::heheuPsiThermo::psib() const { const volScalarField Tb(this->Tb()); @@ -333,35 +335,33 @@ Foam::heheuPsiThermo::psib() const ( "psib", this->psi_.dimensions(), - &MixtureType::cellProducts, - &MixtureType::patchFaceProducts, - &MixtureType::thermoMixtureType::psi, + &HeThermo::mixtureType::products, + &HeThermo::mixtureType::thermoMixtureType::psi, this->p_, Tb ); } -template +template Foam::tmp -Foam::heheuPsiThermo::muu() const +Foam::heheuPsiThermo::muu() const { return this->volScalarFieldProperty ( "muu", dimDynamicViscosity, - &MixtureType::cellReactants, - &MixtureType::patchFaceReactants, - &MixtureType::transportMixtureType::mu, + &HeThermo::mixtureType::reactants, + &HeThermo::mixtureType::transportMixtureType::mu, this->p_, this->Tu_ ); } -template +template Foam::tmp -Foam::heheuPsiThermo::mub() const +Foam::heheuPsiThermo::mub() const { const volScalarField Tb(this->Tb()); @@ -369,9 +369,8 @@ Foam::heheuPsiThermo::mub() const ( "mub", dimDynamicViscosity, - &MixtureType::cellProducts, - &MixtureType::patchFaceProducts, - &MixtureType::transportMixtureType::mu, + &HeThermo::mixtureType::products, + &HeThermo::mixtureType::transportMixtureType::mu, this->p_, Tb ); diff --git a/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/heheuPsiThermo.H b/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/heheuPsiThermo.H index 3df5e178fc..e2a6d67f8d 100644 --- a/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/heheuPsiThermo.H +++ b/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/heheuPsiThermo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -22,13 +22,14 @@ License along with OpenFOAM. If not, see . Class - Foam::heheuMulticomponentThermo + Foam::heheuPsiThermo Description - Foam::heheuMulticomponentThermo + Thermo implementation based on compressibility with additional unburnt + thermodynamic state SourceFiles - heheuMulticomponentThermo.C + heheuPsiThermo.C \*---------------------------------------------------------------------------*/ @@ -46,10 +47,10 @@ namespace Foam Class heheuPsiThermo Declaration \*---------------------------------------------------------------------------*/ -template +template class heheuPsiThermo : - public heThermo + public HeThermo { // Private Data @@ -68,24 +69,13 @@ class heheuPsiThermo public: - //- Runtime type information - TypeName("heheuPsiThermo"); - - // Constructors //- Construct from mesh and phase name - heheuPsiThermo - ( - const fvMesh&, - const word& phaseName - ); + heheuPsiThermo(const fvMesh&, const word& phaseName); //- Disallow default bitwise copy construction - heheuPsiThermo - ( - const heheuPsiThermo& - ) = delete; + heheuPsiThermo(const heheuPsiThermo&) = delete; //- Destructor @@ -154,6 +144,12 @@ public: //- Dynamic viscosity of burnt gas [kg/m/s] virtual tmp mub() const; + + + // Member Operators + + //- Disallow default bitwise assignment + void operator=(const heheuPsiThermo&) = delete; }; diff --git a/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/psiuMulticomponentThermo.C b/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/psiuMulticomponentThermo.C index dfa5c91680..5bc0f76fdc 100644 --- a/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/psiuMulticomponentThermo.C +++ b/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/psiuMulticomponentThermo.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -24,7 +24,6 @@ License \*---------------------------------------------------------------------------*/ #include "psiuMulticomponentThermo.H" -#include "fvMesh.H" #include "zeroGradientFvPatchFields.H" #include "fixedUnburntEnthalpyFvPatchScalarField.H" #include "gradientUnburntEnthalpyFvPatchScalarField.H" @@ -38,6 +37,9 @@ namespace Foam defineRunTimeSelectionTable(psiuMulticomponentThermo, fvMesh); } +const Foam::word Foam::psiuMulticomponentThermo::heThermoName("heheuPsiThermo"); + + // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // Foam::wordList Foam::psiuMulticomponentThermo::heuBoundaryTypes() @@ -100,10 +102,38 @@ void Foam::psiuMulticomponentThermo::heuBoundaryCorrection(volScalarField& heu) Foam::psiuMulticomponentThermo::implementation::implementation ( + const dictionary& dict, + const wordList& specieNames, const fvMesh& mesh, const word& phaseName ) -{} +: + species_(specieNames), + Y_(species_.size()), + Yslicer_() +{ + forAll(species_, i) + { + Y_.set + ( + i, + new volScalarField + ( + IOobject + ( + IOobject::groupName(species_[i], phaseName), + mesh.time().name(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh + ) + ); + } + + Yslicer_.set(Y_); +} // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // @@ -129,4 +159,27 @@ Foam::psiuMulticomponentThermo::implementation::~implementation() {} +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +const Foam::speciesTable& +Foam::psiuMulticomponentThermo::implementation::species() const +{ + return species_; +} + + +Foam::PtrList& +Foam::psiuMulticomponentThermo::implementation::Y() +{ + return Y_; +} + + +const Foam::PtrList& +Foam::psiuMulticomponentThermo::implementation::Y() const +{ + return Y_; +} + + // ************************************************************************* // diff --git a/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/psiuMulticomponentThermo.H b/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/psiuMulticomponentThermo.H index 4e494b5d29..eb4c6bcf8b 100644 --- a/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/psiuMulticomponentThermo.H +++ b/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/psiuMulticomponentThermo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -40,13 +40,17 @@ SourceFiles #define psiuMulticomponentThermo_H #include "psiThermo.H" -#include "basicCombustionMixture.H" +#include "speciesTable.H" +#include "GeometricFieldListSlicer.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { +template class heThermo; +template class heheuPsiThermo; + /*---------------------------------------------------------------------------*\ Class psiuMulticomponentThermo Declaration \*---------------------------------------------------------------------------*/ @@ -78,6 +82,16 @@ public: class composite; + // Public Typedefs + + //- The derived type + template + using heThermoType = heheuPsiThermo>; + + //- The derived name + static const word heThermoName; + + //- Runtime type information TypeName("psiuMulticomponentThermo"); @@ -110,14 +124,28 @@ public: // Member Functions - //- Update properties - virtual void correct() = 0; + // Species set - //- Return the composition of the combustion mixture - virtual basicCombustionMixture& composition() = 0; + //- The table of species + virtual const speciesTable& species() const = 0; - //- Return the composition of the combustion mixture - virtual const basicCombustionMixture& composition() const = 0; + //- Does the mixture include this specie? + inline bool containsSpecie(const word& specieName) const; + + + // Mass fractions + + //- Access the mass-fraction fields + virtual PtrList& Y() = 0; + + //- Access the mass-fraction fields + virtual const PtrList& Y() const = 0; + + //- Return the mass-fraction field for a specie given by name + inline volScalarField& Y(const word& specieName); + + //- Return the const mass-fraction field for a specie given by name + inline const volScalarField& Y(const word& specieName) const; // Access to thermodynamic state variables. @@ -179,23 +207,65 @@ public: /*---------------------------------------------------------------------------*\ - Class psiuMulticomponentThermo::implementation Declaration + Class psiuMulticomponentThermo::implementation Declaration \*---------------------------------------------------------------------------*/ class psiuMulticomponentThermo::implementation : virtual public psiuMulticomponentThermo { +protected: + + // Protected data + + //- Table of specie names + speciesTable species_; + + //- Species mass fractions + PtrList Y_; + + //- Species mass fractions slicing engine + volScalarFieldListSlicer Yslicer_; + + public: // Constructors - //- Construct from mesh and phase name - implementation(const fvMesh&, const word& phaseName); + //- Construct from dictionary, specie names, mesh and phase name + implementation + ( + const dictionary&, + const wordList&, + const fvMesh&, + const word& + ); //- Destructor virtual ~implementation(); + + + // Member Functions + + //- The table of species + virtual const speciesTable& species() const; + + //- Access the mass-fraction fields + virtual PtrList& Y(); + + //- Access the mass-fraction fields + virtual const PtrList& Y() const; + + //- Get the composition of an internal cell + inline scalarFieldListSlice cellComposition(const label celli) const; + + //- Get the composition of a boundary face + inline scalarFieldListSlice patchFaceComposition + ( + const label patchi, + const label facei + ) const; }; @@ -214,17 +284,26 @@ public: // Constructors - //- Construct from mesh and phase name + //- Construct from dictionary, mesh and phase name + template composite ( + const dictionary& dict, + const MixtureType& mixture, const fvMesh& mesh, const word& phaseName ) : - basicThermo::implementation(mesh, phaseName), - fluidThermo::implementation(mesh, phaseName), - psiThermo::implementation(mesh, phaseName), - psiuMulticomponentThermo::implementation(mesh, phaseName) + basicThermo::implementation(dict, mesh, phaseName), + fluidThermo::implementation(dict, mesh, phaseName), + psiThermo::implementation(dict, mesh, phaseName), + psiuMulticomponentThermo::implementation + ( + dict, + MixtureType::specieNames(), + mesh, + phaseName + ) {} }; @@ -235,6 +314,10 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +#include "psiuMulticomponentThermoI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + #endif // ************************************************************************* // diff --git a/src/thermophysicalModels/multicomponentThermo/mixtures/basicCombustionMixture/basicCombustionMixtureI.H b/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/psiuMulticomponentThermoI.H similarity index 60% rename from src/thermophysicalModels/multicomponentThermo/mixtures/basicCombustionMixture/basicCombustionMixtureI.H rename to src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/psiuMulticomponentThermoI.H index ed35322d61..f50b315acf 100644 --- a/src/thermophysicalModels/multicomponentThermo/mixtures/basicCombustionMixture/basicCombustionMixtureI.H +++ b/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/psiuMulticomponentThermoI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2014-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,50 +23,56 @@ License \*---------------------------------------------------------------------------*/ -inline bool Foam::basicCombustionMixture::contains +#include "FieldListSlice.H" +#include "psiuMulticomponentThermo.H" + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +inline bool Foam::psiuMulticomponentThermo::containsSpecie ( const word& specieName ) const { - return species_.found(specieName); + return species().found(specieName); } -inline Foam::volScalarField& Foam::basicCombustionMixture::Y +inline Foam::volScalarField& Foam::psiuMulticomponentThermo::Y ( const word& specieName ) { - return Y_[species_[specieName]]; + return Y()[species()[specieName]]; } -inline const Foam::volScalarField& Foam::basicCombustionMixture::Y +inline const Foam::volScalarField& Foam::psiuMulticomponentThermo::Y ( const word& specieName ) const { - return Y_[species_[specieName]]; + return Y()[species()[specieName]]; } -inline Foam::scalar Foam::basicCombustionMixture::fres +inline Foam::scalarFieldListSlice +Foam::psiuMulticomponentThermo::implementation::cellComposition ( - const scalar ft, - const scalar stoicRatio + const label celli ) const { - return max(ft - (scalar(1) - ft)/stoicRatio, scalar(0)); + return Yslicer_.slice(celli); } -inline Foam::tmp Foam::basicCombustionMixture::fres +inline Foam::scalarFieldListSlice +Foam::psiuMulticomponentThermo::implementation::patchFaceComposition ( - const volScalarField& ft, - const dimensionedScalar& stoicRatio + const label patchi, + const label facei ) const { - return max(ft - (scalar(1) - ft)/stoicRatio.value(), scalar(0)); + return Yslicer_.patchSlice(patchi, facei); } diff --git a/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/psiuMulticomponentThermos.C b/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/psiuMulticomponentThermos.C index acaf047fab..08926b1811 100644 --- a/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/psiuMulticomponentThermos.C +++ b/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/psiuMulticomponentThermos.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -33,10 +33,25 @@ License #include "heheuPsiThermo.H" #include "forAbsoluteGases.H" -#include "makeMulticomponentThermo.H" +#include "makeThermo.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +#define makePsiuMulticomponentThermos(Mixture, ThermoPhysics) \ + \ + defineThermo(psiuMulticomponentThermo, Mixture, ThermoPhysics); \ + \ + addThermo(basicThermo, psiuMulticomponentThermo, Mixture, ThermoPhysics); \ + addThermo(fluidThermo, psiuMulticomponentThermo, Mixture, ThermoPhysics); \ + addThermo(psiThermo, psiuMulticomponentThermo, Mixture, ThermoPhysics); \ + addThermo \ + ( \ + psiuMulticomponentThermo, \ + psiuMulticomponentThermo, \ + Mixture, \ + ThermoPhysics \ + ) + namespace Foam { forAbsoluteGases(makePsiuMulticomponentThermos, egrMixture); diff --git a/src/thermophysicalModels/multicomponentThermo/rhoMulticomponentThermo/rhoMulticomponentThermo.C b/src/thermophysicalModels/multicomponentThermo/rhoMulticomponentThermo/rhoMulticomponentThermo.C index fa626469c3..0eaa36d9f8 100644 --- a/src/thermophysicalModels/multicomponentThermo/rhoMulticomponentThermo/rhoMulticomponentThermo.C +++ b/src/thermophysicalModels/multicomponentThermo/rhoMulticomponentThermo/rhoMulticomponentThermo.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -33,15 +33,6 @@ namespace Foam defineRunTimeSelectionTable(rhoMulticomponentThermo, fvMesh); } -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -Foam::rhoMulticomponentThermo::implementation::implementation -( - const fvMesh& mesh, - const word& phaseName -) -{} - // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // @@ -61,8 +52,4 @@ Foam::rhoMulticomponentThermo::~rhoMulticomponentThermo() {} -Foam::rhoMulticomponentThermo::implementation::~implementation() -{} - - // ************************************************************************* // diff --git a/src/thermophysicalModels/multicomponentThermo/rhoMulticomponentThermo/rhoMulticomponentThermo.H b/src/thermophysicalModels/multicomponentThermo/rhoMulticomponentThermo/rhoMulticomponentThermo.H index f43b8c00aa..7931836805 100644 --- a/src/thermophysicalModels/multicomponentThermo/rhoMulticomponentThermo/rhoMulticomponentThermo.H +++ b/src/thermophysicalModels/multicomponentThermo/rhoMulticomponentThermo/rhoMulticomponentThermo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -47,6 +47,11 @@ SourceFiles namespace Foam { +template class heThermo; +template class heRhoThermo; +template class heMulticomponentThermo; +template class heFluidMulticomponentThermo; + /*---------------------------------------------------------------------------*\ Class rhoMulticomponentThermo Declaration \*---------------------------------------------------------------------------*/ @@ -60,13 +65,27 @@ public: // Public Classes - //- Forward declare the implementation class - class implementation; - //- Forward declare the composite class class composite; + // Public Typedefs + + //- The derived type + template + using heThermoType = + heFluidMulticomponentThermo + < + heMulticomponentThermo + < + heRhoThermo + < + heThermo + > + > + >; + + //- Runtime type information TypeName("rhoMulticomponentThermo"); @@ -97,28 +116,6 @@ public: }; -/*---------------------------------------------------------------------------*\ - Class rhoMulticomponentThermo::implementation Declaration -\*---------------------------------------------------------------------------*/ - -class rhoMulticomponentThermo::implementation -: - virtual public rhoMulticomponentThermo -{ - -public: - - // Constructors - - //- Construct from mesh and phase name - implementation(const fvMesh&, const word& phaseName); - - - //- Destructor - virtual ~implementation(); -}; - - /*---------------------------------------------------------------------------*\ Class rhoMulticomponentThermo::composite Declaration \*---------------------------------------------------------------------------*/ @@ -128,25 +125,33 @@ class rhoMulticomponentThermo::composite public basicThermo::implementation, public fluidThermo::implementation, public rhoThermo::implementation, - public fluidMulticomponentThermo::implementation, - public rhoMulticomponentThermo::implementation + public multicomponentThermo::implementation, + public rhoMulticomponentThermo { public: // Constructors - //- Construct from mesh and phase name + //- Construct from dictionary, mesh and phase name + template composite ( + const dictionary& dict, + const MixtureType& mixture, const fvMesh& mesh, const word& phaseName ) : - basicThermo::implementation(mesh, phaseName), - fluidThermo::implementation(mesh, phaseName), - rhoThermo::implementation(mesh, phaseName), - fluidMulticomponentThermo::implementation(mesh, phaseName), - rhoMulticomponentThermo::implementation(mesh, phaseName) + basicThermo::implementation(dict, mesh, phaseName), + fluidThermo::implementation(dict, mesh, phaseName), + rhoThermo::implementation(dict, mesh, phaseName), + multicomponentThermo::implementation + ( + dict, + mixture.specieNames(), + mesh, + phaseName + ) {} }; diff --git a/src/thermophysicalModels/multicomponentThermo/rhoMulticomponentThermo/rhoMulticomponentThermos.C b/src/thermophysicalModels/multicomponentThermo/rhoMulticomponentThermo/rhoMulticomponentThermos.C index 021a452138..296139c516 100644 --- a/src/thermophysicalModels/multicomponentThermo/rhoMulticomponentThermo/rhoMulticomponentThermos.C +++ b/src/thermophysicalModels/multicomponentThermo/rhoMulticomponentThermo/rhoMulticomponentThermos.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2012-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2012-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -31,32 +31,13 @@ License #include "rhoThermo.H" #include "rhoMulticomponentThermo.H" #include "heRhoThermo.H" +#include "heMulticomponentThermo.H" +#include "heFluidMulticomponentThermo.H" #include "forGases.H" #include "forLiquids.H" #include "forTabulated.H" -#include "makeMulticomponentThermo.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#define makeRhoMulticomponentThermos(Mixture, ThermoPhysics) \ - makeMulticomponentThermos \ - ( \ - rhoThermo, \ - rhoMulticomponentThermo, \ - heRhoThermo, \ - Mixture, \ - ThermoPhysics \ - ) - -#define makeRhoMulticomponentThermo(Mixture, ThermoPhysics) \ - makeMulticomponentThermo \ - ( \ - rhoMulticomponentThermo, \ - heRhoThermo, \ - Mixture, \ - ThermoPhysics \ - ) +#include "makeFluidMulticomponentThermo.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -64,28 +45,59 @@ namespace Foam { forCoeffGases ( - makeRhoMulticomponentThermos, + makeFluidMulticomponentThermos, + rhoThermo, + rhoMulticomponentThermo, coefficientMulticomponentMixture ); - forCoeffGases ( - makeRhoMulticomponentThermos, + makeFluidMulticomponentThermos, + rhoThermo, + rhoMulticomponentThermo, coefficientWilkeMulticomponentMixture ); - - forGases(makeRhoMulticomponentThermo, singleComponentMixture); + forGases + ( + makeFluidMulticomponentThermo, + rhoMulticomponentThermo, + singleComponentMixture + ); forCoeffLiquids ( - makeRhoMulticomponentThermos, + makeFluidMulticomponentThermos, + rhoThermo, + rhoMulticomponentThermo, coefficientMulticomponentMixture ); - forLiquids(makeRhoMulticomponentThermos, valueMulticomponentMixture); - forLiquids(makeRhoMulticomponentThermo, singleComponentMixture); + forLiquids + ( + makeFluidMulticomponentThermos, + rhoThermo, + rhoMulticomponentThermo, + valueMulticomponentMixture + ); + forLiquids + ( + makeFluidMulticomponentThermo, + rhoMulticomponentThermo, + singleComponentMixture + ); - forTabulated(makeRhoMulticomponentThermos, valueMulticomponentMixture); - forTabulated(makeRhoMulticomponentThermo, singleComponentMixture); + forTabulated + ( + makeFluidMulticomponentThermos, + rhoThermo, + rhoMulticomponentThermo, + valueMulticomponentMixture + ); + forTabulated + ( + makeFluidMulticomponentThermo, + rhoMulticomponentThermo, + singleComponentMixture + ); } // ************************************************************************* // diff --git a/src/thermophysicalModels/solidThermo/constSolidThermo/constSolidThermo.C b/src/thermophysicalModels/solidThermo/constSolidThermo/constSolidThermo.C index 2c8bf72a17..74638e99cb 100644 --- a/src/thermophysicalModels/solidThermo/constSolidThermo/constSolidThermo.C +++ b/src/thermophysicalModels/solidThermo/constSolidThermo/constSolidThermo.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -45,7 +45,7 @@ Foam::constSolidThermo::constSolidThermo const word& phaseName ) : - solidThermo::composite(mesh, phaseName), + PhysicalPropertiesThermo(mesh, phaseName), Cv_(readProperty("Cv", dimEnergy/dimMass/dimTemperature)), e_ ( @@ -317,10 +317,4 @@ void Foam::constSolidThermo::correct() } -bool Foam::constSolidThermo::read() -{ - return regIOobject::read(); -} - - // ************************************************************************* // diff --git a/src/thermophysicalModels/solidThermo/constSolidThermo/constSolidThermo.H b/src/thermophysicalModels/solidThermo/constSolidThermo/constSolidThermo.H index d8c2445229..1d882e5e69 100644 --- a/src/thermophysicalModels/solidThermo/constSolidThermo/constSolidThermo.H +++ b/src/thermophysicalModels/solidThermo/constSolidThermo/constSolidThermo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -115,6 +115,7 @@ SourceFiles #ifndef constSolidThermo_H #define constSolidThermo_H +#include "PhysicalPropertiesThermo.H" #include "solidThermo.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -128,7 +129,7 @@ namespace Foam class constSolidThermo : - public solidThermo::composite + public PhysicalPropertiesThermo { // Private data @@ -362,12 +363,6 @@ public: //- Update properties virtual void correct(); - - - // I-O - - //- Read thermophysicalProperties dictionary - virtual bool read(); }; diff --git a/src/thermophysicalModels/solidThermo/makeSolidThermo.H b/src/thermophysicalModels/solidThermo/makeSolidThermo.H deleted file mode 100644 index dcd2112741..0000000000 --- a/src/thermophysicalModels/solidThermo/makeSolidThermo.H +++ /dev/null @@ -1,97 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2012-2021 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 . - -InClass - Foam::solidThermo - -Description - Macros for creating solid thermo packages - -\*---------------------------------------------------------------------------*/ - -#ifndef makeSolidThermo_H -#define makeSolidThermo_H - -#include "basicThermo.H" -#include "addToRunTimeSelectionTable.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#define defineSolidThermo(BaseThermo, CThermo, Mixture, ThermoPhys) \ - \ - typedef \ - heThermo \ - < \ - BaseThermo::composite, \ - Mixture \ - > heThermo##Mixture##ThermoPhys; \ - \ - typedef \ - CThermo \ - < \ - BaseThermo::composite, \ - Mixture \ - > CThermo##Mixture##ThermoPhys; \ - \ - defineTemplateTypeNameAndDebugWithName \ - ( \ - CThermo##Mixture##ThermoPhys, \ - ( \ - #CThermo"<"#Mixture"<" \ - + ThermoPhys::typeName() \ - + ">>" \ - ).c_str(), \ - 0 \ - ) - - -#define addSolidThermo(BaseThermo, CThermoMixtureThermoPhys, Table) \ - \ - addToRunTimeSelectionTable \ - ( \ - BaseThermo, \ - CThermoMixtureThermoPhys, \ - Table \ - ) - - -#define makeSolidThermo(BaseThermo, CThermo, Mixture, ThermoPhys) \ - \ - defineSolidThermo(BaseThermo, CThermo, Mixture, ThermoPhys); \ - \ - addSolidThermo(BaseThermo, CThermo##Mixture##ThermoPhys, fvMesh); - - -#define makeSolidThermos(BaseThermo, CThermo, Mixture, ThermoPhys) \ - \ - defineSolidThermo(BaseThermo, CThermo, Mixture, ThermoPhys); \ - \ - addSolidThermo(basicThermo, CThermo##Mixture##ThermoPhys, fvMesh); \ - addSolidThermo(BaseThermo, CThermo##Mixture##ThermoPhys, fvMesh); - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/thermophysicalModels/solidThermo/solidSpecie/include/forSolids.H b/src/thermophysicalModels/solidThermo/solidSpecie/include/forSolids.H index 612a966464..c8bf08199b 100644 --- a/src/thermophysicalModels/solidThermo/solidSpecie/include/forSolids.H +++ b/src/thermophysicalModels/solidThermo/solidSpecie/include/forSolids.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2019-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2019-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -56,7 +56,7 @@ License forSolidEquations(Mu, sensibleInternalEnergy, eConstThermo, Macro, Args); \ forSolidEquations \ (Mu, sensibleInternalEnergy, ePolynomialThermo, Macro, Args); \ - forSolidEquations(Mu, sensibleInternalEnergy, ePowerThermo, Macro, Args) \ + forSolidEquations(Mu, sensibleInternalEnergy, ePowerThermo, Macro, Args); \ forSolidEquations \ (Mu, sensibleInternalEnergy, eIcoTabulatedThermo, Macro, Args) @@ -64,7 +64,7 @@ License forSolidEnergiesAndThermos(constIsoSolidTransport, Macro, Args); \ forSolidEnergiesAndThermos(constAnisoSolidTransport, Macro, Args); \ forSolidEnergiesAndThermos(exponentialSolidTransport, Macro, Args); \ - forSolidEnergiesAndThermos(polynomialSolidTransport, Macro, Args) \ + forSolidEnergiesAndThermos(polynomialSolidTransport, Macro, Args); \ forSolidEnergiesAndThermos(tabulatedSolidTransport, Macro, Args) #define forSolids(Macro, Args...) \ diff --git a/src/thermophysicalModels/solidThermo/solidThermo/heSolidThermo.C b/src/thermophysicalModels/solidThermo/solidThermo/heSolidThermo.C index c8de56cbe3..8603353aea 100644 --- a/src/thermophysicalModels/solidThermo/solidThermo/heSolidThermo.C +++ b/src/thermophysicalModels/solidThermo/solidThermo/heSolidThermo.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -27,8 +27,8 @@ License // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -template -void Foam::heSolidThermo::calculate() +template +void Foam::heSolidThermo::calculate() { const bool isotropic = this->isotropic(); @@ -44,11 +44,14 @@ void Foam::heSolidThermo::calculate() forAll(TCells, celli) { - const typename MixtureType::thermoMixtureType& thermoMixture = - this->cellThermoMixture(celli); + auto composition = this->cellComposition(celli); - const typename MixtureType::transportMixtureType& transportMixture = - this->cellTransportMixture(celli, thermoMixture); + const typename HeThermo::mixtureType::thermoMixtureType& + thermoMixture = this->thermoMixture(composition); + + const typename HeThermo::mixtureType::transportMixtureType& + transportMixture = + this->transportMixture(composition, thermoMixture); TCells[celli] = thermoMixture.THE ( @@ -112,13 +115,14 @@ void Foam::heSolidThermo::calculate() { forAll(pT, facei) { - const typename MixtureType::thermoMixtureType& - thermoMixture = this->patchFaceThermoMixture(patchi, facei); + auto composition = this->patchFaceComposition(patchi, facei); - const typename MixtureType::transportMixtureType& + const typename HeThermo::mixtureType::thermoMixtureType& + thermoMixture = this->thermoMixture(composition); + + const typename HeThermo::mixtureType::transportMixtureType& transportMixture = - this->patchFaceTransportMixture - (patchi, facei, thermoMixture); + this->transportMixture(composition, thermoMixture); phe[facei] = thermoMixture.HE(pp[facei], pT[facei]); @@ -142,13 +146,14 @@ void Foam::heSolidThermo::calculate() { forAll(pT, facei) { - const typename MixtureType::thermoMixtureType& - thermoMixture = this->patchFaceThermoMixture(patchi, facei); + auto composition = this->patchFaceComposition(patchi, facei); - const typename MixtureType::transportMixtureType& + const typename HeThermo::mixtureType::thermoMixtureType& + thermoMixture = this->thermoMixture(composition); + + const typename HeThermo::mixtureType::transportMixtureType& transportMixture = - this->patchFaceTransportMixture - (patchi, facei, thermoMixture); + this->transportMixture(composition, thermoMixture); pT[facei] = thermoMixture.THE(phe[facei], pp[facei] ,pT[facei]); @@ -174,20 +179,19 @@ void Foam::heSolidThermo::calculate() // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -template -Foam::heSolidThermo:: -heSolidThermo +template +Foam::heSolidThermo::heSolidThermo ( const fvMesh& mesh, const word& phaseName ) : - heThermo(mesh, phaseName), + HeThermo(mesh, phaseName), Kappa_ ( IOobject ( - BasicSolidThermo::phasePropertyName("Kappa", phaseName), + HeThermo::phasePropertyName("Kappa", phaseName), mesh.time().name(), mesh, IOobject::NO_READ, @@ -203,33 +207,33 @@ heSolidThermo // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // -template -Foam::heSolidThermo::~heSolidThermo() +template +Foam::heSolidThermo::~heSolidThermo() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -template -void Foam::heSolidThermo::correct() +template +void Foam::heSolidThermo::correct() { - if (debug) + if (HeThermo::debug) { InfoInFunction << endl; } calculate(); - if (debug) + if (HeThermo::debug) { Info<< " Finished" << endl; } } -template +template const Foam::volVectorField& -Foam::heSolidThermo::Kappa() const +Foam::heSolidThermo::Kappa() const { return Kappa_; } diff --git a/src/thermophysicalModels/solidThermo/solidThermo/heSolidThermo.H b/src/thermophysicalModels/solidThermo/solidThermo/heSolidThermo.H index f57c72d46f..c45881a8ee 100644 --- a/src/thermophysicalModels/solidThermo/solidThermo/heSolidThermo.H +++ b/src/thermophysicalModels/solidThermo/solidThermo/heSolidThermo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,7 +25,7 @@ Class Foam::heSolidThermo Description - Energy for a solid mixture + Thermo implementation for a solid SourceFiles heSolidThermo.C @@ -46,10 +46,10 @@ namespace Foam Class heSolidThermo Declaration \*---------------------------------------------------------------------------*/ -template +template class heSolidThermo : - public heThermo + public HeThermo { protected: @@ -67,24 +67,13 @@ protected: public: - //- Runtime type information - TypeName("heSolidThermo"); - - // Constructors //- Construct from mesh and phase name - heSolidThermo - ( - const fvMesh&, - const word& phaseName - ); + heSolidThermo(const fvMesh&, const word& phaseName); //- Disallow default bitwise copy construction - heSolidThermo - ( - const heSolidThermo& - ) = delete; + heSolidThermo(const heSolidThermo&) = delete; //- Destructor @@ -99,7 +88,7 @@ public: //- Return true if thermal conductivity is isotropic virtual bool isotropic() const { - return MixtureType::thermoType::isotropic; + return HeThermo::mixtureType::thermoType::isotropic; } //- Anisotropic thermal conductivity [W/m/K] @@ -109,10 +98,7 @@ public: // Member Operators //- Disallow default bitwise assignment - void operator= - ( - const heSolidThermo& - ) = delete; + void operator=(const heSolidThermo&) = delete; }; diff --git a/src/thermophysicalModels/solidThermo/solidThermo/solidThermo.C b/src/thermophysicalModels/solidThermo/solidThermo/solidThermo.C index 7ddfdbd6b2..4a0c79bb89 100644 --- a/src/thermophysicalModels/solidThermo/solidThermo/solidThermo.C +++ b/src/thermophysicalModels/solidThermo/solidThermo/solidThermo.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -26,7 +26,7 @@ License #include "solidThermo.H" #include "fvMesh.H" -/* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */ +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { @@ -34,11 +34,14 @@ namespace Foam defineRunTimeSelectionTable(solidThermo, fvMesh); } +const Foam::word Foam::solidThermo::heThermoName("heSolidThermo"); + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::solidThermo::implementation::implementation ( + const dictionary& dict, const fvMesh& mesh, const word& phaseName ) @@ -71,17 +74,6 @@ Foam::solidThermo::implementation::implementation {} -Foam::solidThermo::implementation::implementation -( - const fvMesh& mesh, - const dictionary& dict, - const word& phaseName -) -: - solidThermo::implementation::implementation(mesh, phaseName) -{} - - // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // Foam::autoPtr Foam::solidThermo::New diff --git a/src/thermophysicalModels/solidThermo/solidThermo/solidThermo.H b/src/thermophysicalModels/solidThermo/solidThermo/solidThermo.H index 5c7e3e5954..152e55839b 100644 --- a/src/thermophysicalModels/solidThermo/solidThermo/solidThermo.H +++ b/src/thermophysicalModels/solidThermo/solidThermo/solidThermo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -38,7 +38,7 @@ SourceFiles #ifndef solidThermo_H #define solidThermo_H -#include "basicThermo.H" +#include "pureThermo.H" #include "uniformGeometricFields.H" #include "fvScalarMatrix.H" @@ -47,6 +47,9 @@ SourceFiles namespace Foam { +template class heThermo; +template class heSolidThermo; + /*---------------------------------------------------------------------------*\ Class solidThermo Declaration \*---------------------------------------------------------------------------*/ @@ -66,6 +69,16 @@ public: class composite; + // Public Typedefs + + //- The derived type + template + using heThermoType = heSolidThermo>; + + //- The derived name + static const word heThermoName; + + //- Runtime type information TypeName("solidThermo"); @@ -144,16 +157,8 @@ public: // Constructors - //- Construct from mesh and phase name - implementation(const fvMesh&, const word& phaseName); - - //- Construct from mesh, dictionary and phase name - implementation - ( - const fvMesh&, - const dictionary& dict, - const word& phaseName - ); + //- Construct from dictionary, mesh and phase name + implementation(const dictionary&, const fvMesh&, const word&); //- Destructor @@ -180,21 +185,36 @@ public: class solidThermo::composite : public basicThermo::implementation, + public pureThermo, public solidThermo::implementation { public: // Constructors - //- Construct from mesh and phase name + //- Construct from dictionary, mesh and phase name composite ( + const dictionary& dict, const fvMesh& mesh, const word& phaseName ) : - basicThermo::implementation(mesh, phaseName), - solidThermo::implementation(mesh, phaseName) + basicThermo::implementation(dict, mesh, phaseName), + solidThermo::implementation(dict, mesh, phaseName) + {} + + //- Construct from dictionary, mesh and phase name + template + composite + ( + const dictionary& dict, + const MixtureType& mixture, + const fvMesh& mesh, + const word& phaseName + ) + : + composite(dict, mesh, phaseName) {} }; diff --git a/src/thermophysicalModels/solidThermo/solidThermo/solidThermos.C b/src/thermophysicalModels/solidThermo/solidThermo/solidThermos.C index aac7d999fa..389b1f98f8 100644 --- a/src/thermophysicalModels/solidThermo/solidThermo/solidThermos.C +++ b/src/thermophysicalModels/solidThermo/solidThermo/solidThermos.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2020 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -28,13 +28,13 @@ License #include "pureMixture.H" #include "forSolids.H" -#include "makeSolidThermo.H" +#include "makeThermo.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { - forSolids(makeSolidThermos, solidThermo, heSolidThermo, pureMixture); + forSolids(makeThermo, solidThermo, pureMixture); } // ************************************************************************* // diff --git a/src/thermophysicalModels/specie/include/makeThermo.H b/src/thermophysicalModels/specie/include/makeThermo.H index 58b0577c63..3986f3bf5b 100644 --- a/src/thermophysicalModels/specie/include/makeThermo.H +++ b/src/thermophysicalModels/specie/include/makeThermo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2020-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2020-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,56 +25,51 @@ InClass Foam::fluidThermo Description - Macros for creating basic fluid thermo packages + Macros for creating basic thermo packages \*---------------------------------------------------------------------------*/ #ifndef makeThermo_H #define makeThermo_H -#include "fluidThermo.H" +#include "basicThermo.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -#define defineThermo(BaseThermo, CThermo, Mixture, ThermoPhys) \ +#define defineThermo(BaseThermo, Mixture, ThermoPhysics) \ \ typedef \ - CThermo \ - < \ - BaseThermo::composite, \ - Mixture \ - > \ - CThermo##Mixture##ThermoPhys; \ + namedHeThermo>> \ + BaseThermo##HeThermo##Mixture##ThermoPhysics; \ \ defineTemplateTypeNameAndDebugWithName \ ( \ - CThermo##Mixture##ThermoPhys, \ + BaseThermo##HeThermo##Mixture##ThermoPhysics, \ ( \ - word(CThermo##Mixture##ThermoPhys::typeName_()) + "<" \ - + Mixture::typeName() + ">" \ + BaseThermo::heThermoName + "<" \ + + Mixture::typeName() + ">" \ ).c_str(), \ 0 \ - ) + ); -#define addThermo(BaseThermo, CThermo, Mixture, ThermoPhys) \ +#define addThermo(SelectThermo, BaseThermo, Mixture, ThermoPhysics) \ \ addToRunTimeSelectionTable \ ( \ - BaseThermo, \ - CThermo##Mixture##ThermoPhys, \ + SelectThermo, \ + BaseThermo##HeThermo##Mixture##ThermoPhysics, \ fvMesh \ - ) + ); -#define makeThermo(BaseThermo, CThermo, Mixture, ThermoPhys) \ +#define makeThermo(BaseThermo, Mixture, ThermoPhysics) \ \ - defineThermo(BaseThermo, CThermo, Mixture, ThermoPhys); \ + defineThermo(BaseThermo, Mixture, ThermoPhysics); \ \ - addThermo(basicThermo, CThermo, Mixture, ThermoPhys); \ - addThermo(fluidThermo, CThermo, Mixture, ThermoPhys); \ - addThermo(BaseThermo, CThermo, Mixture, ThermoPhys) + addThermo(basicThermo, BaseThermo, Mixture, ThermoPhysics); \ + addThermo(BaseThermo, BaseThermo, Mixture, ThermoPhysics); // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/thermophysicalModels/thermophysicalProperties/Make/files b/src/thermophysicalModels/thermophysicalProperties/Make/files index 0be048910a..b0b13c3393 100644 --- a/src/thermophysicalModels/thermophysicalProperties/Make/files +++ b/src/thermophysicalModels/thermophysicalProperties/Make/files @@ -2,6 +2,7 @@ thermophysicalProperties/thermophysicalProperties.C liquidProperties/liquidProperties/liquidProperties.C +liquidProperties/liquidProperties/liquidPropertiesNew.C liquidProperties/liquidMixtureProperties/liquidMixtureProperties.C liquidProperties/liquid/liquid.C diff --git a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/liquidProperties/liquidProperties.C b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/liquidProperties/liquidProperties.C index e9ec990f20..12505b411a 100644 --- a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/liquidProperties/liquidProperties.C +++ b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/liquidProperties/liquidProperties.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2011-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,7 +25,7 @@ License #include "liquidProperties.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { @@ -84,65 +84,6 @@ Foam::liquidProperties::liquidProperties(const dictionary& dict) {} -// * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * // - -Foam::autoPtr Foam::liquidProperties::New -( - const word& name -) -{ - if (debug) - { - InfoInFunction << "Constructing liquidProperties" << endl; - } - - ConstructorTable::iterator cstrIter = ConstructorTablePtr_->find(name); - - if (cstrIter == ConstructorTablePtr_->end()) - { - FatalErrorInFunction - << "Unknown liquidProperties type " - << name << nl << nl - << "Valid liquidProperties types are:" << nl - << ConstructorTablePtr_->sortedToc() - << exit(FatalError); - } - - return autoPtr(cstrIter()()); -} - - -Foam::autoPtr Foam::liquidProperties::New -( - const dictionary& dict -) -{ - if (debug) - { - InfoInFunction << "Constructing liquidProperties" << endl; - } - - // If the type is not specified use the name as the liquid type name - const word& liquidPropertiesTypeName = - dict.found("type") ? dict.lookup("type") : dict.dictName(); - - dictionaryConstructorTable::iterator cstrIter = - dictionaryConstructorTablePtr_->find(liquidPropertiesTypeName); - - if (cstrIter == dictionaryConstructorTablePtr_->end()) - { - FatalErrorInFunction - << "Unknown liquidProperties type " - << liquidPropertiesTypeName << nl << nl - << "Valid liquidProperties types are:" << nl - << dictionaryConstructorTablePtr_->sortedToc() - << exit(FatalError); - } - - return autoPtr(cstrIter()(dict)); -} - - // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // const Foam::word& Foam::liquidProperties::name() const diff --git a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/liquidProperties/liquidPropertiesNew.C b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/liquidProperties/liquidPropertiesNew.C new file mode 100644 index 0000000000..e7aa700a34 --- /dev/null +++ b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/liquidProperties/liquidPropertiesNew.C @@ -0,0 +1,87 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2023 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 "liquidProperties.H" + +// * * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * // + +Foam::autoPtr Foam::liquidProperties::New +( + const word& name +) +{ + if (debug) + { + InfoInFunction << "Constructing liquidProperties" << endl; + } + + ConstructorTable::iterator cstrIter = ConstructorTablePtr_->find(name); + + if (cstrIter == ConstructorTablePtr_->end()) + { + FatalErrorInFunction + << "Unknown liquidProperties type " + << name << nl << nl + << "Valid liquidProperties types are:" << nl + << ConstructorTablePtr_->sortedToc() + << exit(FatalError); + } + + return autoPtr(cstrIter()()); +} + + +Foam::autoPtr Foam::liquidProperties::New +( + const dictionary& dict +) +{ + if (debug) + { + InfoInFunction << "Constructing liquidProperties" << endl; + } + + // If the type is not specified use the name as the liquid type name + const word& liquidPropertiesTypeName = + dict.found("type") ? dict.lookup("type") : dict.dictName(); + + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(liquidPropertiesTypeName); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalErrorInFunction + << "Unknown liquidProperties type " + << liquidPropertiesTypeName << nl << nl + << "Valid liquidProperties types are:" << nl + << dictionaryConstructorTablePtr_->sortedToc() + << exit(FatalError); + } + + return autoPtr(cstrIter()(dict)); +} + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/multicomponentThermo/mixtures/basicCombustionMixture/basicCombustionMixture.H b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/liquidProperties/liquidPropertiesSelector.H similarity index 51% rename from src/thermophysicalModels/multicomponentThermo/mixtures/basicCombustionMixture/basicCombustionMixture.H rename to src/thermophysicalModels/thermophysicalProperties/liquidProperties/liquidProperties/liquidPropertiesSelector.H index 3f9f12c522..0127e3d9a5 100644 --- a/src/thermophysicalModels/multicomponentThermo/mixtures/basicCombustionMixture/basicCombustionMixture.H +++ b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/liquidProperties/liquidPropertiesSelector.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2014-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2017-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -22,23 +22,23 @@ License along with OpenFOAM. If not, see . Class - Foam::basicCombustionMixture + Foam::liquidPropertiesSelector Description - Specialisation of the basicMixture for combustion. + Wrapper class providing run-time selection of thermophysicalProperties + for the templated thermodynamics packages. SourceFiles - basicCombustionMixture.C + liquidPropertiesSelectorI.H + liquidPropertiesSelector.C \*---------------------------------------------------------------------------*/ -#ifndef basicCombustionMixture_H -#define basicCombustionMixture_H +#ifndef liquidPropertiesSelector_H +#define liquidPropertiesSelector_H -#include "volFields.H" -#include "PtrList.H" -#include "basicMixture.H" -#include "speciesTable.H" +#include "thermophysicalPropertiesSelector.H" +#include "liquidProperties.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -46,70 +46,37 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class basicCombustionMixture Declaration + Class liquidPropertiesSelector Declaration \*---------------------------------------------------------------------------*/ -class basicCombustionMixture +class liquidPropertiesSelector : - public basicMixture + public thermophysicalPropertiesSelector { - -protected: - - // Protected data - - //- Table of specie names - speciesTable species_; - - //- Species mass fractions - PtrList Y_; - - public: - //- Run time type information - TypeName("basicCombustionMixture"); - - - //- The base class of the mixture - typedef basicCombustionMixture basicMixtureType; - - // Constructors - //- Construct from dictionary, specie names, mesh and phase name - basicCombustionMixture - ( - const dictionary&, - const wordList& specieNames, - const fvMesh&, - const word& - ); + //- Inherit constructors + using + thermophysicalPropertiesSelector:: + thermophysicalPropertiesSelector; //- Destructor - virtual ~basicCombustionMixture() + virtual ~liquidPropertiesSelector() {} // Member Functions - //- Does the mixture include this specie? - inline bool contains(const word& specieName) const; + // Physical properties - //- Return the mass-fraction field for a specie given by name - inline volScalarField& Y(const word& specieName); + //- Surface tension [N/m] + virtual scalar sigma(const scalar p, const scalar T) const; - //- Return the const mass-fraction field for a specie given by name - inline const volScalarField& Y(const word& specieName) const; - - inline scalar fres(const scalar ft, const scalar stoicRatio) const; - - inline tmp fres - ( - const volScalarField& ft, - const dimensionedScalar& stoicRatio - ) const; + //- Viscosity [Pa s] + inline scalar mu(const scalar p, const scalar T) const; }; @@ -119,7 +86,7 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -#include "basicCombustionMixtureI.H" +#include "liquidPropertiesSelectorI.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/thermophysicalModels/thermophysicalProperties/liquidProperties/liquidProperties/liquidPropertiesSelectorI.H b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/liquidProperties/liquidPropertiesSelectorI.H new file mode 100644 index 0000000000..a357984f8d --- /dev/null +++ b/src/thermophysicalModels/thermophysicalProperties/liquidProperties/liquidProperties/liquidPropertiesSelectorI.H @@ -0,0 +1,50 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2017-2023 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 "liquidPropertiesSelector.H" + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +inline Foam::scalar Foam::liquidPropertiesSelector::sigma +( + const scalar p, + const scalar T +) const +{ + return properties().sigma(p, T); +} + + +inline Foam::scalar Foam::liquidPropertiesSelector::mu +( + const scalar p, + const scalar T +) const +{ + return properties().mu(p, T); +} + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/thermophysicalProperties/thermophysicalProperties/thermophysicalProperties.H b/src/thermophysicalModels/thermophysicalProperties/thermophysicalProperties/thermophysicalProperties.H index 1cbe06f163..b91fe0cb0b 100644 --- a/src/thermophysicalModels/thermophysicalProperties/thermophysicalProperties/thermophysicalProperties.H +++ b/src/thermophysicalModels/thermophysicalProperties/thermophysicalProperties/thermophysicalProperties.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2017-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2017-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -114,7 +114,7 @@ public: // Member Functions - //- Return the name of the liquid + //- Return the name of the substance virtual const word& name() const = 0; @@ -129,16 +129,13 @@ public: // Fundamental equation of state properties - //- Liquid density [kg/m^3] + //- Density [kg/m^3] virtual scalar rho(scalar p, scalar T) const = 0; - //- Liquid compressibility [s^2/m^2] - // Note: currently it is assumed the liquid is incompressible + //- Compressibility [s^2/m^2] virtual scalar psi(scalar p, scalar T) const = 0; //- Return (Cp - Cv) [J/(kg K] - // Note: currently it is assumed the liquid is incompressible - // so CpMCv 0 virtual scalar CpMCv(scalar p, scalar T) const = 0; @@ -162,10 +159,10 @@ public: // Physical properties - //- Liquid viscosity [Pa s] + //- Viscosity [Pa s] virtual scalar mu(scalar p, scalar T) const = 0; - //- Liquid thermal conductivity [W/m/K] + //- Thermal conductivity [W/m/K] virtual scalar kappa(scalar p, scalar T) const = 0; diff --git a/src/thermophysicalModels/thermophysicalProperties/thermophysicalPropertiesSelector/thermophysicalPropertiesSelector.C b/src/thermophysicalModels/thermophysicalProperties/thermophysicalProperties/thermophysicalPropertiesSelector.C similarity index 100% rename from src/thermophysicalModels/thermophysicalProperties/thermophysicalPropertiesSelector/thermophysicalPropertiesSelector.C rename to src/thermophysicalModels/thermophysicalProperties/thermophysicalProperties/thermophysicalPropertiesSelector.C diff --git a/src/thermophysicalModels/thermophysicalProperties/thermophysicalPropertiesSelector/thermophysicalPropertiesSelector.H b/src/thermophysicalModels/thermophysicalProperties/thermophysicalProperties/thermophysicalPropertiesSelector.H similarity index 90% rename from src/thermophysicalModels/thermophysicalProperties/thermophysicalPropertiesSelector/thermophysicalPropertiesSelector.H rename to src/thermophysicalModels/thermophysicalProperties/thermophysicalProperties/thermophysicalPropertiesSelector.H index 70161e45a9..43e05a99fa 100644 --- a/src/thermophysicalModels/thermophysicalProperties/thermophysicalPropertiesSelector/thermophysicalPropertiesSelector.H +++ b/src/thermophysicalModels/thermophysicalProperties/thermophysicalProperties/thermophysicalPropertiesSelector.H @@ -98,10 +98,7 @@ public: //- Return the instantiated type name static word typeName() { - return - "thermophysicalPropertiesSelector<" - + ThermophysicalProperties::typeName - + '>'; + return ThermophysicalProperties::typeName; } @@ -125,16 +122,13 @@ public: // Fundamental equation of state properties - //- Liquid density [kg/m^3] + //- Density [kg/m^3] inline scalar rho(scalar p, scalar T) const; - //- Liquid compressibility [s^2/m^2] - // Note: currently it is assumed the liquid is incompressible + //- Compressibility [s^2/m^2] inline scalar psi(scalar p, scalar T) const; //- Return (Cp - Cv) [J/kg/K] - // Note: currently it is assumed the liquid is incompressible - // so CpMCv 0 inline scalar CpMCv(scalar p, scalar T) const; @@ -165,19 +159,16 @@ public: inline scalar S(const scalar p, const scalar T) const; + // Physical properties + + //- Thermal conductivity [W/m/K] + inline scalar kappa(scalar p, scalar T) const; + + // I-O //- Write to Ostream void write(Ostream& os) const; - - - // Physical properties - - //- Liquid viscosity [Pa s] - inline scalar mu(scalar p, scalar T) const; - - //- Liquid thermal conductivity [W/m/K] - inline scalar kappa(scalar p, scalar T) const; }; diff --git a/src/thermophysicalModels/thermophysicalProperties/thermophysicalPropertiesSelector/thermophysicalPropertiesSelectorI.H b/src/thermophysicalModels/thermophysicalProperties/thermophysicalProperties/thermophysicalPropertiesSelectorI.H similarity index 94% rename from src/thermophysicalModels/thermophysicalProperties/thermophysicalPropertiesSelector/thermophysicalPropertiesSelectorI.H rename to src/thermophysicalModels/thermophysicalProperties/thermophysicalProperties/thermophysicalPropertiesSelectorI.H index 775d6a77c4..0bba51fb4e 100644 --- a/src/thermophysicalModels/thermophysicalProperties/thermophysicalPropertiesSelector/thermophysicalPropertiesSelectorI.H +++ b/src/thermophysicalModels/thermophysicalProperties/thermophysicalProperties/thermophysicalPropertiesSelectorI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2017-2021 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2017-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -43,6 +43,7 @@ properties() const return propertiesPtr_(); } + template inline Foam::scalar Foam::thermophysicalPropertiesSelector::W() const @@ -190,18 +191,6 @@ Foam::thermophysicalPropertiesSelector::S } -template -inline Foam::scalar -Foam::thermophysicalPropertiesSelector::mu -( - scalar p, - scalar T -) const -{ - return propertiesPtr_->mu(p, T); -} - - template inline Foam::scalar Foam::thermophysicalPropertiesSelector::kappa diff --git a/src/twoPhaseModels/compressibleInterfaceProperties/surfaceTensionModels/liquidProperties/liquidPropertiesSurfaceTension.C b/src/twoPhaseModels/compressibleInterfaceProperties/surfaceTensionModels/liquidProperties/liquidPropertiesSurfaceTension.C index 3a2c6a3344..b850c7e7af 100644 --- a/src/twoPhaseModels/compressibleInterfaceProperties/surfaceTensionModels/liquidProperties/liquidPropertiesSurfaceTension.C +++ b/src/twoPhaseModels/compressibleInterfaceProperties/surfaceTensionModels/liquidProperties/liquidPropertiesSurfaceTension.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2017-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2017-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,6 +25,7 @@ License #include "liquidPropertiesSurfaceTension.H" #include "liquidThermo.H" +#include "volFields.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -68,58 +69,11 @@ Foam::surfaceTensionModels::liquidProperties::~liquidProperties() Foam::tmp Foam::surfaceTensionModels::liquidProperties::sigma() const { - const heRhoThermopureMixtureliquidProperties& thermo = - mesh_.lookupObject + return + mesh_.lookupObject ( IOobject::groupName(physicalProperties::typeName, phaseName_) - ); - - tmp tsigma - ( - volScalarField::New - ( - "sigma", - mesh_, - dimSigma - ) - ); - volScalarField& sigma = tsigma.ref(); - - const volScalarField& T = thermo.T(); - const volScalarField& p = thermo.p(); - - volScalarField::Internal& sigmai = sigma; - const volScalarField::Internal& pi = p; - const volScalarField::Internal& Ti = T; - - forAll(sigmai, celli) - { - const heRhoThermopureMixtureliquidProperties::transportMixtureType& - liquid = thermo.cellTransportMixture(celli); - - sigmai[celli] = liquid.properties().sigma(pi[celli], Ti[celli]); - } - - volScalarField::Boundary& sigmaBf = sigma.boundaryFieldRef(); - const volScalarField::Boundary& pBf = p.boundaryField(); - const volScalarField::Boundary& TBf = T.boundaryField(); - - forAll(sigmaBf, patchi) - { - scalarField& sigmaPf = sigmaBf[patchi]; - const scalarField& pPf = pBf[patchi]; - const scalarField& TPf = TBf[patchi]; - - forAll(sigmaPf, facei) - { - const heRhoThermopureMixtureliquidProperties::transportMixtureType& - liquid = thermo.patchFaceTransportMixture(patchi, facei); - - sigmaPf[facei] = liquid.properties().sigma(pPf[facei], TPf[facei]); - } - } - - return tsigma; + ).sigma(); } diff --git a/tutorials/compressibleVoF/damBreak/constant/physicalProperties.water b/tutorials/compressibleVoF/damBreak/constant/physicalProperties.water index c5ebb75d3b..33ee248244 100644 --- a/tutorials/compressibleVoF/damBreak/constant/physicalProperties.water +++ b/tutorials/compressibleVoF/damBreak/constant/physicalProperties.water @@ -28,40 +28,4 @@ mixture } -/* -thermoType -{ - type heRhoThermo; - mixture pureMixture; - transport const; - thermo eConst; - equationOfState rPolynomial; - specie specie; - energy sensibleInternalEnergy; -} - -mixture -{ - specie - { - molWeight 18.0; - } - equationOfState - { - C (0.001278 -2.1055e-06 3.9689e-09 4.3772e-13 -2.0225e-16); - } - thermodynamics - { - Cv 4195; - Hf 0; - } - transport - { - mu 3.645e-4; - Pr 2.289; - } -} -*/ - - // ************************************************************************* // diff --git a/tutorials/compressibleVoF/depthCharge2D/constant/physicalProperties.water b/tutorials/compressibleVoF/depthCharge2D/constant/physicalProperties.water index c5ebb75d3b..33ee248244 100644 --- a/tutorials/compressibleVoF/depthCharge2D/constant/physicalProperties.water +++ b/tutorials/compressibleVoF/depthCharge2D/constant/physicalProperties.water @@ -28,40 +28,4 @@ mixture } -/* -thermoType -{ - type heRhoThermo; - mixture pureMixture; - transport const; - thermo eConst; - equationOfState rPolynomial; - specie specie; - energy sensibleInternalEnergy; -} - -mixture -{ - specie - { - molWeight 18.0; - } - equationOfState - { - C (0.001278 -2.1055e-06 3.9689e-09 4.3772e-13 -2.0225e-16); - } - thermodynamics - { - Cv 4195; - Hf 0; - } - transport - { - mu 3.645e-4; - Pr 2.289; - } -} -*/ - - // ************************************************************************* // From 65f3050b35bbcc910ecb4c28ed0fa6aabbcef4bd Mon Sep 17 00:00:00 2001 From: Will Bainbridge Date: Tue, 13 Jun 2023 10:00:19 +0100 Subject: [PATCH 3/4] thermophysicalModels: Renamed he*Thermo classes The he*Thermo classes have been renamed to match their corresponding basic thermo classes. E.g., rhoThermo now corresponds to RhoThermo, rather than heRhoThermo. --- .../dynamicCode/fluidMulticomponentThermo | 2 +- .../fluidMulticomponentThermoTemplate.C | 11 +- etc/codeTemplates/dynamicCode/fluidThermo | 2 +- .../dynamicCode/fluidThermoTemplate.C | 9 +- etc/codeTemplates/dynamicCode/psiThermo | 2 +- .../dynamicCode/psiuMulticomponentThermo | 2 +- .../psiuMulticomponentThermoTemplate.C | 7 +- etc/codeTemplates/dynamicCode/solidThermo | 2 +- .../dynamicCode/solidThermoTemplate.C | 7 +- .../compileTemplate/compileTemplate.C | 7 -- src/thermophysicalModels/basic/Make/files | 3 +- .../heThermo.C => basicThermo/BasicThermo.C} | 87 ++++++++------ .../heThermo.H => basicThermo/BasicThermo.H} | 54 +++------ .../BasicThermoName.C} | 4 +- .../basic/basicThermo/NamedThermo.H | 77 ++++++++++++ .../basic/basicThermo/basicThermo.H | 2 +- .../{heLiquidThermo.C => LiquidThermo.C} | 20 ++-- .../{heLiquidThermo.H => LiquidThermo.H} | 29 +++-- .../basic/liquidThermo/liquidThermo.H | 9 +- .../basic/liquidThermo/liquidThermos.C | 11 +- .../psiThermo/{hePsiThermo.C => PsiThermo.C} | 36 +++--- .../psiThermo/{hePsiThermo.H => PsiThermo.H} | 29 +++-- .../basic/psiThermo/psiThermo.C | 2 +- .../basic/psiThermo/psiThermo.H | 9 +- .../basic/psiThermo/psiThermos.C | 3 +- .../rhoThermo/{heRhoThermo.C => RhoThermo.C} | 36 +++--- .../rhoThermo/{heRhoThermo.H => RhoThermo.H} | 29 +++-- .../basic/rhoThermo/rhoThermo.C | 2 +- .../basic/rhoThermo/rhoThermo.H | 9 +- .../basic/rhoThermo/rhoThermos.C | 3 +- ...ntThermo.C => FluidMulticomponentThermo.C} | 22 ++-- ...ntThermo.H => FluidMulticomponentThermo.H} | 30 ++--- .../fluidMulticomponentThermo.H | 1 + ...mponentThermo.C => MulticomponentThermo.C} | 110 +++++++++--------- ...mponentThermo.H => MulticomponentThermo.H} | 29 +++-- .../multicomponentThermo.H | 1 + .../psiMulticomponentThermo.H | 15 +-- .../psiMulticomponentThermos.C | 9 +- ...PsiThermo.C => PsiuMulticomponentThermo.C} | 100 ++++++++-------- ...PsiThermo.H => PsiuMulticomponentThermo.H} | 31 ++--- .../psiuMulticomponentThermo.C | 5 +- .../psiuMulticomponentThermo.H | 9 +- .../psiuMulticomponentThermoI.H | 2 +- .../psiuMulticomponentThermos.C | 7 +- .../rhoMulticomponentThermo.H | 15 +-- .../rhoMulticomponentThermos.C | 9 +- .../{heSolidThermo.C => SolidThermo.C} | 42 +++---- .../{heSolidThermo.H => SolidThermo.H} | 30 ++--- .../solidThermo/solidThermo/solidThermo.C | 13 +-- .../solidThermo/solidThermo/solidThermo.H | 9 +- .../solidThermo/solidThermo/solidThermos.C | 3 +- .../specie/include/makeThermo.H | 11 +- 52 files changed, 512 insertions(+), 496 deletions(-) rename src/thermophysicalModels/basic/{heThermo/heThermo.C => basicThermo/BasicThermo.C} (85%) rename src/thermophysicalModels/basic/{heThermo/heThermo.H => basicThermo/BasicThermo.H} (92%) rename src/thermophysicalModels/basic/{heThermo/heThermoName.C => basicThermo/BasicThermoName.C} (94%) create mode 100644 src/thermophysicalModels/basic/basicThermo/NamedThermo.H rename src/thermophysicalModels/basic/liquidThermo/{heLiquidThermo.C => LiquidThermo.C} (81%) rename src/thermophysicalModels/basic/liquidThermo/{heLiquidThermo.H => LiquidThermo.H} (81%) rename src/thermophysicalModels/basic/psiThermo/{hePsiThermo.C => PsiThermo.C} (87%) rename src/thermophysicalModels/basic/psiThermo/{hePsiThermo.H => PsiThermo.H} (82%) rename src/thermophysicalModels/basic/rhoThermo/{heRhoThermo.C => RhoThermo.C} (88%) rename src/thermophysicalModels/basic/rhoThermo/{heRhoThermo.H => RhoThermo.H} (82%) rename src/thermophysicalModels/multicomponentThermo/fluidMulticomponentThermo/{heFluidMulticomponentThermo.C => FluidMulticomponentThermo.C} (80%) rename src/thermophysicalModels/multicomponentThermo/fluidMulticomponentThermo/{heFluidMulticomponentThermo.H => FluidMulticomponentThermo.H} (80%) rename src/thermophysicalModels/multicomponentThermo/multicomponentThermo/{heMulticomponentThermo.C => MulticomponentThermo.C} (71%) rename src/thermophysicalModels/multicomponentThermo/multicomponentThermo/{heMulticomponentThermo.H => MulticomponentThermo.H} (92%) rename src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/{heheuPsiThermo.C => PsiuMulticomponentThermo.C} (77%) rename src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/{heheuPsiThermo.H => PsiuMulticomponentThermo.H} (86%) rename src/thermophysicalModels/solidThermo/solidThermo/{heSolidThermo.C => SolidThermo.C} (86%) rename src/thermophysicalModels/solidThermo/solidThermo/{heSolidThermo.H => SolidThermo.H} (83%) diff --git a/etc/codeTemplates/dynamicCode/fluidMulticomponentThermo b/etc/codeTemplates/dynamicCode/fluidMulticomponentThermo index e402b49227..7c42883911 100644 --- a/etc/codeTemplates/dynamicCode/fluidMulticomponentThermo +++ b/etc/codeTemplates/dynamicCode/fluidMulticomponentThermo @@ -19,7 +19,7 @@ type heRhoThermo ); -typeBase +typeRenamed ( hePsiThermo psiMulticomponentThermo heRhoThermo rhoMulticomponentThermo diff --git a/etc/codeTemplates/dynamicCode/fluidMulticomponentThermoTemplate.C b/etc/codeTemplates/dynamicCode/fluidMulticomponentThermoTemplate.C index d4e35d5e3d..b05ac2269a 100644 --- a/etc/codeTemplates/dynamicCode/fluidMulticomponentThermoTemplate.C +++ b/etc/codeTemplates/dynamicCode/fluidMulticomponentThermoTemplate.C @@ -37,15 +37,12 @@ License #include "${transport}Transport.H" // psi/rho -#include "${typeBase}.H" #include "${type}.H" // Mixture #include "${mixture}.H" #include "thermo.H" -#include "heMulticomponentThermo.H" -#include "heFluidMulticomponentThermo.H" #include "typedefThermo.H" #include "makeThermo.H" @@ -88,7 +85,7 @@ namespace Foam defineThermo ( - ${typeBase}, + ${type}, ${mixture}, ${transport}Transport${energy}${thermo}Thermo${equationOfState}${specie} ); @@ -96,15 +93,15 @@ namespace Foam addThermo ( fluidMulticomponentThermo, - ${typeBase}, + ${type}, ${mixture}, ${transport}Transport${energy}${thermo}Thermo${equationOfState}${specie} ); addThermo ( - ${typeBase}, - ${typeBase}, + ${type}, + ${type}, ${mixture}, ${transport}Transport${energy}${thermo}Thermo${equationOfState}${specie} ); diff --git a/etc/codeTemplates/dynamicCode/fluidThermo b/etc/codeTemplates/dynamicCode/fluidThermo index 1c540b085e..1e364e0ba0 100644 --- a/etc/codeTemplates/dynamicCode/fluidThermo +++ b/etc/codeTemplates/dynamicCode/fluidThermo @@ -19,7 +19,7 @@ type heRhoThermo ); -typeBase +typeRenamed ( hePsiThermo psiThermo heRhoThermo rhoThermo diff --git a/etc/codeTemplates/dynamicCode/fluidThermoTemplate.C b/etc/codeTemplates/dynamicCode/fluidThermoTemplate.C index 9aef83243a..c34d7b844a 100644 --- a/etc/codeTemplates/dynamicCode/fluidThermoTemplate.C +++ b/etc/codeTemplates/dynamicCode/fluidThermoTemplate.C @@ -37,7 +37,6 @@ License #include "${transport}Transport.H" // psi/rho -#include "${typeBase}.H" #include "${type}.H" // Mixture @@ -86,7 +85,7 @@ namespace Foam defineThermo ( - ${typeBase}, + ${type}, ${mixture}, ${transport}Transport${energy}${thermo}Thermo${equationOfState}${specie} ); @@ -94,15 +93,15 @@ namespace Foam addThermo ( fluidThermo, - ${typeBase}, + ${type}, ${mixture}, ${transport}Transport${energy}${thermo}Thermo${equationOfState}${specie} ); addThermo ( - ${typeBase}, - ${typeBase}, + ${type}, + ${type}, ${mixture}, ${transport}Transport${energy}${thermo}Thermo${equationOfState}${specie} ); diff --git a/etc/codeTemplates/dynamicCode/psiThermo b/etc/codeTemplates/dynamicCode/psiThermo index e8f8f7d982..a886a0a232 100644 --- a/etc/codeTemplates/dynamicCode/psiThermo +++ b/etc/codeTemplates/dynamicCode/psiThermo @@ -18,7 +18,7 @@ type hePsiThermo ); -typeBase +typeRenamed ( hePsiThermo psiThermo ); diff --git a/etc/codeTemplates/dynamicCode/psiuMulticomponentThermo b/etc/codeTemplates/dynamicCode/psiuMulticomponentThermo index cb06aefc92..62720d1ada 100644 --- a/etc/codeTemplates/dynamicCode/psiuMulticomponentThermo +++ b/etc/codeTemplates/dynamicCode/psiuMulticomponentThermo @@ -18,7 +18,7 @@ type heheuPsiThermo ); -typeBase +typeRenamed ( heheuPsiThermo psiuMulticomponentThermo ); diff --git a/etc/codeTemplates/dynamicCode/psiuMulticomponentThermoTemplate.C b/etc/codeTemplates/dynamicCode/psiuMulticomponentThermoTemplate.C index c7290e69e5..7272d99235 100644 --- a/etc/codeTemplates/dynamicCode/psiuMulticomponentThermoTemplate.C +++ b/etc/codeTemplates/dynamicCode/psiuMulticomponentThermoTemplate.C @@ -37,7 +37,6 @@ License #include "${transport}Transport.H" // psi/rho -#include "${typeBase}.H" #include "${type}.H" // Mixture @@ -86,15 +85,15 @@ namespace Foam defineThermo ( - ${typeBase}, + ${type}, ${mixture}, ${transport}Transport${energy}${thermo}Thermo${equationOfState}${specie} ); addThermo ( - ${typeBase}, - ${typeBase}, + ${type}, + ${type}, ${mixture}, ${transport}Transport${energy}${thermo}Thermo${equationOfState}${specie} ); diff --git a/etc/codeTemplates/dynamicCode/solidThermo b/etc/codeTemplates/dynamicCode/solidThermo index ca1ffc4462..ffc3c42b8c 100644 --- a/etc/codeTemplates/dynamicCode/solidThermo +++ b/etc/codeTemplates/dynamicCode/solidThermo @@ -18,7 +18,7 @@ type heSolidThermo ); -typeBase +typeRenamed ( heSolidThermo solidThermo ); diff --git a/etc/codeTemplates/dynamicCode/solidThermoTemplate.C b/etc/codeTemplates/dynamicCode/solidThermoTemplate.C index c7290e69e5..7272d99235 100644 --- a/etc/codeTemplates/dynamicCode/solidThermoTemplate.C +++ b/etc/codeTemplates/dynamicCode/solidThermoTemplate.C @@ -37,7 +37,6 @@ License #include "${transport}Transport.H" // psi/rho -#include "${typeBase}.H" #include "${type}.H" // Mixture @@ -86,15 +85,15 @@ namespace Foam defineThermo ( - ${typeBase}, + ${type}, ${mixture}, ${transport}Transport${energy}${thermo}Thermo${equationOfState}${specie} ); addThermo ( - ${typeBase}, - ${typeBase}, + ${type}, + ${type}, ${mixture}, ${transport}Transport${energy}${thermo}Thermo${equationOfState}${specie} ); diff --git a/src/OpenFOAM/db/dynamicLibrary/compileTemplate/compileTemplate.C b/src/OpenFOAM/db/dynamicLibrary/compileTemplate/compileTemplate.C index cc9832189c..951aba28e4 100644 --- a/src/OpenFOAM/db/dynamicLibrary/compileTemplate/compileTemplate.C +++ b/src/OpenFOAM/db/dynamicLibrary/compileTemplate/compileTemplate.C @@ -99,13 +99,6 @@ void Foam::compileTemplate::setFilterVariable } dynCode.setFilterVariable(name, type); - - const word typeBase(name + "Base"); - if (context.dict().found(typeBase)) - { - const HashTable typeToBaseMap(context.dict().lookup(typeBase)); - dynCode.setFilterVariable(typeBase, typeToBaseMap[type]); - } } diff --git a/src/thermophysicalModels/basic/Make/files b/src/thermophysicalModels/basic/Make/files index 22684aaddc..9edb4bbfa7 100644 --- a/src/thermophysicalModels/basic/Make/files +++ b/src/thermophysicalModels/basic/Make/files @@ -1,4 +1,5 @@ basicThermo/basicThermo.C +basicThermo/BasicThermoName.C pureThermo/pureThermo.C @@ -21,6 +22,4 @@ derivedFvPatchFields/gradientEnergy/gradientEnergyCalculatedTemperatureFvPatchSc derivedFvPatchFields/mixedEnergy/mixedEnergyFvPatchScalarField.C derivedFvPatchFields/mixedEnergy/mixedEnergyCalculatedTemperatureFvPatchScalarField.C -heThermo/heThermoName.C - LIB = $(FOAM_LIBBIN)/libfluidThermophysicalModels diff --git a/src/thermophysicalModels/basic/heThermo/heThermo.C b/src/thermophysicalModels/basic/basicThermo/BasicThermo.C similarity index 85% rename from src/thermophysicalModels/basic/heThermo/heThermo.C rename to src/thermophysicalModels/basic/basicThermo/BasicThermo.C index fbfcd9abc4..135a17ddbc 100644 --- a/src/thermophysicalModels/basic/heThermo/heThermo.C +++ b/src/thermophysicalModels/basic/basicThermo/BasicThermo.C @@ -23,7 +23,7 @@ License \*---------------------------------------------------------------------------*/ -#include "heThermo.H" +#include "BasicThermo.H" #include "gradientEnergyFvPatchScalarField.H" #include "mixedEnergyFvPatchScalarField.H" @@ -32,7 +32,7 @@ License template template Foam::tmp -Foam::heThermo::volScalarFieldProperty +Foam::BasicThermo::volScalarFieldProperty ( const word& psiName, const dimensionSet& psiDim, @@ -84,7 +84,7 @@ Foam::heThermo::volScalarFieldProperty template template Foam::tmp -Foam::heThermo::cellSetProperty +Foam::BasicThermo::cellSetProperty ( Mixture mixture, Method psiMethod, @@ -113,7 +113,7 @@ Foam::heThermo::cellSetProperty template template Foam::tmp -Foam::heThermo::patchFieldProperty +Foam::BasicThermo::patchFieldProperty ( Mixture mixture, Method psiMethod, @@ -141,7 +141,7 @@ Foam::heThermo::patchFieldProperty template Foam::UIndirectList -Foam::heThermo::cellSetScalarList +Foam::BasicThermo::cellSetScalarList ( const volScalarField& psi, const labelList& cells @@ -153,7 +153,7 @@ Foam::heThermo::cellSetScalarList template Foam::UniformField -Foam::heThermo::cellSetScalarList +Foam::BasicThermo::cellSetScalarList ( const uniformGeometricScalarField& psi, const labelList& @@ -164,7 +164,7 @@ Foam::heThermo::cellSetScalarList template -void Foam::heThermo:: +void Foam::BasicThermo:: heBoundaryCorrection(volScalarField& h) { volScalarField::Boundary& hBf = h.boundaryFieldRef(); @@ -188,7 +188,7 @@ heBoundaryCorrection(volScalarField& h) // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template -Foam::heThermo::heThermo +Foam::BasicThermo::BasicThermo ( const fvMesh& mesh, const word& phaseName @@ -256,12 +256,7 @@ Foam::heThermo::heThermo // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // template -Foam::heThermo::~heThermo() -{} - - -template -Foam::namedHeThermo::~namedHeThermo() +Foam::BasicThermo::~BasicThermo() {} @@ -269,7 +264,7 @@ Foam::namedHeThermo::~namedHeThermo() template const Foam::volScalarField& -Foam::heThermo::Cpv() const +Foam::BasicThermo::Cpv() const { if (MixtureType::thermoType::enthalpy()) { @@ -283,7 +278,8 @@ Foam::heThermo::Cpv() const template -Foam::tmp Foam::heThermo::he +Foam::tmp +Foam::BasicThermo::he ( const volScalarField& p, const volScalarField& T @@ -302,7 +298,8 @@ Foam::tmp Foam::heThermo::he template -Foam::tmp Foam::heThermo::he +Foam::tmp +Foam::BasicThermo::he ( const scalarField& T, const labelList& cells @@ -320,7 +317,8 @@ Foam::tmp Foam::heThermo::he template -Foam::tmp Foam::heThermo::he +Foam::tmp +Foam::BasicThermo::he ( const scalarField& T, const label patchi @@ -339,7 +337,7 @@ Foam::tmp Foam::heThermo::he template Foam::tmp -Foam::heThermo::hs() const +Foam::BasicThermo::hs() const { return volScalarFieldProperty ( @@ -354,7 +352,8 @@ Foam::heThermo::hs() const template -Foam::tmp Foam::heThermo::hs +Foam::tmp +Foam::BasicThermo::hs ( const volScalarField& p, const volScalarField& T @@ -373,7 +372,8 @@ Foam::tmp Foam::heThermo::hs template -Foam::tmp Foam::heThermo::hs +Foam::tmp +Foam::BasicThermo::hs ( const scalarField& T, const labelList& cells @@ -391,7 +391,8 @@ Foam::tmp Foam::heThermo::hs template -Foam::tmp Foam::heThermo::hs +Foam::tmp +Foam::BasicThermo::hs ( const scalarField& T, const label patchi @@ -410,7 +411,7 @@ Foam::tmp Foam::heThermo::hs template Foam::tmp -Foam::heThermo::ha() const +Foam::BasicThermo::ha() const { return volScalarFieldProperty ( @@ -425,7 +426,8 @@ Foam::heThermo::ha() const template -Foam::tmp Foam::heThermo::ha +Foam::tmp +Foam::BasicThermo::ha ( const volScalarField& p, const volScalarField& T @@ -444,7 +446,8 @@ Foam::tmp Foam::heThermo::ha template -Foam::tmp Foam::heThermo::ha +Foam::tmp +Foam::BasicThermo::ha ( const scalarField& T, const labelList& cells @@ -462,7 +465,8 @@ Foam::tmp Foam::heThermo::ha template -Foam::tmp Foam::heThermo::ha +Foam::tmp +Foam::BasicThermo::ha ( const scalarField& T, const label patchi @@ -481,7 +485,7 @@ Foam::tmp Foam::heThermo::ha template Foam::tmp -Foam::heThermo::hc() const +Foam::BasicThermo::hc() const { return volScalarFieldProperty ( @@ -494,7 +498,8 @@ Foam::heThermo::hc() const template -Foam::tmp Foam::heThermo::Cp +Foam::tmp +Foam::BasicThermo::Cp ( const scalarField& T, const label patchi @@ -512,7 +517,8 @@ Foam::tmp Foam::heThermo::Cp template -Foam::tmp Foam::heThermo::Cv +Foam::tmp +Foam::BasicThermo::Cv ( const scalarField& T, const label patchi @@ -530,7 +536,8 @@ Foam::tmp Foam::heThermo::Cv template -Foam::tmp Foam::heThermo::gamma +Foam::tmp +Foam::BasicThermo::gamma ( const scalarField& T, const label patchi @@ -549,14 +556,15 @@ Foam::tmp Foam::heThermo::gamma template Foam::tmp -Foam::heThermo::gamma() const +Foam::BasicThermo::gamma() const { return volScalarField::New("gamma", Cp_/Cv_); } template -Foam::tmp Foam::heThermo::Cpv +Foam::tmp +Foam::BasicThermo::Cpv ( const scalarField& T, const label patchi @@ -575,7 +583,7 @@ Foam::tmp Foam::heThermo::Cpv template Foam::tmp -Foam::heThermo::THE +Foam::BasicThermo::THE ( const volScalarField& h, const volScalarField& p, @@ -596,7 +604,8 @@ Foam::heThermo::THE template -Foam::tmp Foam::heThermo::THE +Foam::tmp +Foam::BasicThermo::THE ( const scalarField& h, const scalarField& T0, @@ -616,7 +625,8 @@ Foam::tmp Foam::heThermo::THE template -Foam::tmp Foam::heThermo::THE +Foam::tmp +Foam::BasicThermo::THE ( const scalarField& h, const scalarField& T0, @@ -637,7 +647,7 @@ Foam::tmp Foam::heThermo::THE template Foam::tmp -Foam::heThermo::W() const +Foam::BasicThermo::W() const { return volScalarFieldProperty ( @@ -650,7 +660,8 @@ Foam::heThermo::W() const template -Foam::tmp Foam::heThermo::W +Foam::tmp +Foam::BasicThermo::W ( const label patchi ) const @@ -665,7 +676,7 @@ Foam::tmp Foam::heThermo::W template -bool Foam::heThermo::read() +bool Foam::BasicThermo::read() { if (physicalProperties::read()) { diff --git a/src/thermophysicalModels/basic/heThermo/heThermo.H b/src/thermophysicalModels/basic/basicThermo/BasicThermo.H similarity index 92% rename from src/thermophysicalModels/basic/heThermo/heThermo.H rename to src/thermophysicalModels/basic/basicThermo/BasicThermo.H index 666ea88d2d..89b98426ee 100644 --- a/src/thermophysicalModels/basic/heThermo/heThermo.H +++ b/src/thermophysicalModels/basic/basicThermo/BasicThermo.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see . Class - Foam::heThermo + Foam::BasicThermo Description Thermo implementation and storage of energy and heat capacities. Provides @@ -30,12 +30,12 @@ Description the primitive thermo model. SourceFiles - heThermo.C + BasicThermo.C \*---------------------------------------------------------------------------*/ -#ifndef heThermo_H -#define heThermo_H +#ifndef BasicThermo_H +#define BasicThermo_H #include "volFields.H" #include "physicalProperties.H" @@ -47,20 +47,20 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class heThermoName Declaration + Class BasicThermoName Declaration \*---------------------------------------------------------------------------*/ -TemplateName(heThermo); +TemplateName(BasicThermo); /*---------------------------------------------------------------------------*\ - Class heThermo Declaration + Class BasicThermo Declaration \*---------------------------------------------------------------------------*/ template -class heThermo +class BasicThermo : - public heThermoName, + public BasicThermoName, public physicalProperties, public MixtureType, public BasicThermoType @@ -142,20 +142,20 @@ public: //- Disambiguate debug switch used by derivations - using heThermoName::debug; + using BasicThermoName::debug; // Constructors //- Construct from mesh and phase name - heThermo(const fvMesh&, const word& phaseName); + BasicThermo(const fvMesh&, const word& phaseName); //- Disallow default bitwise copy construction - heThermo(const heThermo&) = delete; + BasicThermo(const BasicThermo&) = delete; //- Destructor - virtual ~heThermo(); + virtual ~BasicThermo(); // Member Functions @@ -374,32 +374,6 @@ public: }; -/*---------------------------------------------------------------------------*\ - Class namedHeThermo Declaration -\*---------------------------------------------------------------------------*/ - -template -class namedHeThermo -: - public HeThermo -{ -public: - - //- Runtime type information - TypeName("heThermo"); - - - // Constructors - - //- Inherit constructors - using HeThermo::HeThermo; - - - //- Destructor - virtual ~namedHeThermo(); -}; - - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam @@ -407,7 +381,7 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #ifdef NoRepository - #include "heThermo.C" + #include "BasicThermo.C" #endif // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/thermophysicalModels/basic/heThermo/heThermoName.C b/src/thermophysicalModels/basic/basicThermo/BasicThermoName.C similarity index 94% rename from src/thermophysicalModels/basic/heThermo/heThermoName.C rename to src/thermophysicalModels/basic/basicThermo/BasicThermoName.C index 51610c7ad2..3149a92e62 100644 --- a/src/thermophysicalModels/basic/heThermo/heThermoName.C +++ b/src/thermophysicalModels/basic/basicThermo/BasicThermoName.C @@ -23,13 +23,13 @@ License \*---------------------------------------------------------------------------*/ -#include "heThermo.H" +#include "BasicThermo.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { - defineTypeNameAndDebug(heThermoName, 0); + defineTypeNameAndDebug(BasicThermoName, 0); } diff --git a/src/thermophysicalModels/basic/basicThermo/NamedThermo.H b/src/thermophysicalModels/basic/basicThermo/NamedThermo.H new file mode 100644 index 0000000000..252a1a671e --- /dev/null +++ b/src/thermophysicalModels/basic/basicThermo/NamedThermo.H @@ -0,0 +1,77 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2023 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 . + +Class + Foam::NamedThermo + +Description + Final wrapper around a derived thermo. Adds type info. + +\*---------------------------------------------------------------------------*/ + +#ifndef NamedThermo_H +#define NamedThermo_H + +#include "typeInfo.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class NamedThermo Declaration +\*---------------------------------------------------------------------------*/ + +template +class NamedThermo +: + public BaseThermo +{ +public: + + //- Runtime type information + TypeName("NamedThermo"); + + + // Constructors + + //- Inherit constructors + using BaseThermo::BaseThermo; + + + //- Destructor + virtual ~NamedThermo() + {} +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/basic/basicThermo/basicThermo.H b/src/thermophysicalModels/basic/basicThermo/basicThermo.H index aa8f936486..2e2954ee99 100644 --- a/src/thermophysicalModels/basic/basicThermo/basicThermo.H +++ b/src/thermophysicalModels/basic/basicThermo/basicThermo.H @@ -49,7 +49,7 @@ Description obtaining a single copy of all the implementation classes it needs to form a complete implementation. The use of virtual inheritance does not result in additional constructor calls propagating further down the hierarchy - (into heThermo and similar) because all virtually inherited interface + (into BasicThermo and similar) because all virtually inherited interface classes are default constructable. SourceFiles diff --git a/src/thermophysicalModels/basic/liquidThermo/heLiquidThermo.C b/src/thermophysicalModels/basic/liquidThermo/LiquidThermo.C similarity index 81% rename from src/thermophysicalModels/basic/liquidThermo/heLiquidThermo.C rename to src/thermophysicalModels/basic/liquidThermo/LiquidThermo.C index 8f736be75c..74dd4e671b 100644 --- a/src/thermophysicalModels/basic/liquidThermo/heLiquidThermo.C +++ b/src/thermophysicalModels/basic/liquidThermo/LiquidThermo.C @@ -23,40 +23,40 @@ License \*---------------------------------------------------------------------------*/ -#include "heLiquidThermo.H" +#include "LiquidThermo.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -template -Foam::heLiquidThermo::heLiquidThermo +template +Foam::LiquidThermo::LiquidThermo ( const fvMesh& mesh, const word& phaseName ) : - HeThermo(mesh, phaseName) + BaseThermo(mesh, phaseName) {} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // -template -Foam::heLiquidThermo::~heLiquidThermo() +template +Foam::LiquidThermo::~LiquidThermo() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -template +template Foam::tmp -Foam::heLiquidThermo::sigma() const +Foam::LiquidThermo::sigma() const { return this->volScalarFieldProperty ( "sigma", dimForce/dimLength, - &HeThermo::mixtureType::thermoMixture, - &HeThermo::mixtureType::thermoMixtureType::sigma, + &BaseThermo::mixtureType::thermoMixture, + &BaseThermo::mixtureType::thermoMixtureType::sigma, this->p_, this->T_ ); diff --git a/src/thermophysicalModels/basic/liquidThermo/heLiquidThermo.H b/src/thermophysicalModels/basic/liquidThermo/LiquidThermo.H similarity index 81% rename from src/thermophysicalModels/basic/liquidThermo/heLiquidThermo.H rename to src/thermophysicalModels/basic/liquidThermo/LiquidThermo.H index 76f67f1b08..8e57439365 100644 --- a/src/thermophysicalModels/basic/liquidThermo/heLiquidThermo.H +++ b/src/thermophysicalModels/basic/liquidThermo/LiquidThermo.H @@ -22,21 +22,20 @@ License along with OpenFOAM. If not, see . Class - Foam::heLiquidThermo + Foam::LiquidThermo Description Liquid thermo implementation SourceFiles - heLiquidThermo.C + LiquidThermo.C \*---------------------------------------------------------------------------*/ -#ifndef heLiquidThermo_H -#define heLiquidThermo_H +#ifndef LiquidThermo_H +#define LiquidThermo_H -#include "liquidThermo.H" -#include "heThermo.H" +#include "BasicThermo.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -44,27 +43,27 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class heLiquidThermo Declaration + Class LiquidThermo Declaration \*---------------------------------------------------------------------------*/ -template -class heLiquidThermo +template +class LiquidThermo : - public HeThermo + public BaseThermo { public: // Constructors //- Construct from mesh and phase name - heLiquidThermo(const fvMesh&, const word& phaseName); + LiquidThermo(const fvMesh&, const word& phaseName); //- Disallow default bitwise copy construction - heLiquidThermo(const heLiquidThermo&) = delete; + LiquidThermo(const LiquidThermo&) = delete; //- Destructor - virtual ~heLiquidThermo(); + virtual ~LiquidThermo(); // Member Functions @@ -76,7 +75,7 @@ public: // Member Operators //- Disallow default bitwise assignment - void operator=(const heLiquidThermo&) = delete; + void operator=(const LiquidThermo&) = delete; }; @@ -87,7 +86,7 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #ifdef NoRepository - #include "heLiquidThermo.C" + #include "LiquidThermo.C" #endif // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/thermophysicalModels/basic/liquidThermo/liquidThermo.H b/src/thermophysicalModels/basic/liquidThermo/liquidThermo.H index 6a58121ab9..50bc067945 100644 --- a/src/thermophysicalModels/basic/liquidThermo/liquidThermo.H +++ b/src/thermophysicalModels/basic/liquidThermo/liquidThermo.H @@ -38,6 +38,7 @@ SourceFiles #ifndef liquidThermo_H #define liquidThermo_H +#include "LiquidThermo.H" #include "rhoThermo.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -45,10 +46,6 @@ SourceFiles namespace Foam { -template class heThermo; -template class heRhoThermo; -template class heLiquidThermo; - /*---------------------------------------------------------------------------*\ Class liquidThermo Declaration \*---------------------------------------------------------------------------*/ @@ -69,8 +66,8 @@ public: //- The derived type template - using heThermoType = - heLiquidThermo>>; + using DerivedThermoType = + LiquidThermo>>; //- Runtime type information diff --git a/src/thermophysicalModels/basic/liquidThermo/liquidThermos.C b/src/thermophysicalModels/basic/liquidThermo/liquidThermos.C index 3128940438..ced93601f1 100644 --- a/src/thermophysicalModels/basic/liquidThermo/liquidThermos.C +++ b/src/thermophysicalModels/basic/liquidThermo/liquidThermos.C @@ -23,18 +23,15 @@ License \*---------------------------------------------------------------------------*/ -#include "liquidPropertiesSelector.H" - -#include "sensibleInternalEnergy.H" -#include "sensibleEnthalpy.H" +#include "liquidThermo.H" #include "pureMixture.H" +#include "liquidPropertiesSelector.H" +#include "sensibleInternalEnergy.H" +#include "sensibleEnthalpy.H" #include "thermo.H" -#include "liquidThermo.H" -#include "heRhoThermo.H" -#include "heLiquidThermo.H" #include "makeThermo.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/thermophysicalModels/basic/psiThermo/hePsiThermo.C b/src/thermophysicalModels/basic/psiThermo/PsiThermo.C similarity index 87% rename from src/thermophysicalModels/basic/psiThermo/hePsiThermo.C rename to src/thermophysicalModels/basic/psiThermo/PsiThermo.C index 08c06d2cbf..01c60c147a 100644 --- a/src/thermophysicalModels/basic/psiThermo/hePsiThermo.C +++ b/src/thermophysicalModels/basic/psiThermo/PsiThermo.C @@ -23,12 +23,12 @@ License \*---------------------------------------------------------------------------*/ -#include "hePsiThermo.H" +#include "PsiThermo.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -template -void Foam::hePsiThermo::calculate() +template +void Foam::PsiThermo::calculate() { const scalarField& hCells = this->he_; const scalarField& pCells = this->p_; @@ -44,10 +44,10 @@ void Foam::hePsiThermo::calculate() { auto composition = this->cellComposition(celli); - const typename HeThermo::mixtureType::thermoMixtureType& + const typename BaseThermo::mixtureType::thermoMixtureType& thermoMixture = this->thermoMixture(composition); - const typename HeThermo::mixtureType::transportMixtureType& + const typename BaseThermo::mixtureType::transportMixtureType& transportMixture = this->transportMixture(composition, thermoMixture); @@ -108,10 +108,10 @@ void Foam::hePsiThermo::calculate() { auto composition = this->patchFaceComposition(patchi, facei); - const typename HeThermo::mixtureType::thermoMixtureType& + const typename BaseThermo::mixtureType::thermoMixtureType& thermoMixture = this->thermoMixture(composition); - const typename HeThermo::mixtureType::transportMixtureType& + const typename BaseThermo::mixtureType::transportMixtureType& transportMixture = this->transportMixture(composition, thermoMixture); @@ -131,10 +131,10 @@ void Foam::hePsiThermo::calculate() { auto composition = this->patchFaceComposition(patchi, facei); - const typename HeThermo::mixtureType::thermoMixtureType& + const typename BaseThermo::mixtureType::thermoMixtureType& thermoMixture = this->thermoMixture(composition); - const typename HeThermo::mixtureType::transportMixtureType& + const typename BaseThermo::mixtureType::transportMixtureType& transportMixture = this->transportMixture(composition, thermoMixture); @@ -154,14 +154,14 @@ void Foam::hePsiThermo::calculate() // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -template -Foam::hePsiThermo::hePsiThermo +template +Foam::PsiThermo::PsiThermo ( const fvMesh& mesh, const word& phaseName ) : - HeThermo(mesh, phaseName) + BaseThermo(mesh, phaseName) { calculate(); @@ -172,17 +172,17 @@ Foam::hePsiThermo::hePsiThermo // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // -template -Foam::hePsiThermo::~hePsiThermo() +template +Foam::PsiThermo::~PsiThermo() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -template -void Foam::hePsiThermo::correct() +template +void Foam::PsiThermo::correct() { - if (HeThermo::debug) + if (BaseThermo::debug) { InfoInFunction << endl; } @@ -192,7 +192,7 @@ void Foam::hePsiThermo::correct() calculate(); - if (HeThermo::debug) + if (BaseThermo::debug) { Info<< " Finished" << endl; } diff --git a/src/thermophysicalModels/basic/psiThermo/hePsiThermo.H b/src/thermophysicalModels/basic/psiThermo/PsiThermo.H similarity index 82% rename from src/thermophysicalModels/basic/psiThermo/hePsiThermo.H rename to src/thermophysicalModels/basic/psiThermo/PsiThermo.H index 7d61e3841b..9747aebef7 100644 --- a/src/thermophysicalModels/basic/psiThermo/hePsiThermo.H +++ b/src/thermophysicalModels/basic/psiThermo/PsiThermo.H @@ -22,21 +22,20 @@ License along with OpenFOAM. If not, see . Class - Foam::hePsiThermo + Foam::PsiThermo Description Thermo implementation based on compressibility SourceFiles - hePsiThermo.C + PsiThermo.C \*---------------------------------------------------------------------------*/ -#ifndef hePsiThermo_H -#define hePsiThermo_H +#ifndef PsiThermo_H +#define PsiThermo_H -#include "psiThermo.H" -#include "heThermo.H" +#include "BasicThermo.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -44,13 +43,13 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class hePsiThermo Declaration + Class PsiThermo Declaration \*---------------------------------------------------------------------------*/ -template -class hePsiThermo +template +class PsiThermo : - public HeThermo + public Thermo { // Private Member Functions @@ -62,14 +61,14 @@ public: // Constructors //- Construct from mesh and phase name - hePsiThermo(const fvMesh&, const word& phaseName); + PsiThermo(const fvMesh&, const word& phaseName); //- Disallow default bitwise copy construction - hePsiThermo(const hePsiThermo&) = delete; + PsiThermo(const PsiThermo&) = delete; //- Destructor - virtual ~hePsiThermo(); + virtual ~PsiThermo(); // Member Functions @@ -81,7 +80,7 @@ public: // Member Operators //- Disallow default bitwise assignment - void operator=(const hePsiThermo&) = delete; + void operator=(const PsiThermo&) = delete; }; @@ -92,7 +91,7 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #ifdef NoRepository - #include "hePsiThermo.C" + #include "PsiThermo.C" #endif // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/thermophysicalModels/basic/psiThermo/psiThermo.C b/src/thermophysicalModels/basic/psiThermo/psiThermo.C index 1be1da7f55..e8c8ebdb69 100644 --- a/src/thermophysicalModels/basic/psiThermo/psiThermo.C +++ b/src/thermophysicalModels/basic/psiThermo/psiThermo.C @@ -33,7 +33,7 @@ namespace Foam defineRunTimeSelectionTable(psiThermo, fvMesh); } -const Foam::word Foam::psiThermo::heThermoName("hePsiThermo"); +const Foam::word Foam::psiThermo::derivedThermoName("hePsiThermo"); // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // diff --git a/src/thermophysicalModels/basic/psiThermo/psiThermo.H b/src/thermophysicalModels/basic/psiThermo/psiThermo.H index fea7bd4907..4c1c631367 100644 --- a/src/thermophysicalModels/basic/psiThermo/psiThermo.H +++ b/src/thermophysicalModels/basic/psiThermo/psiThermo.H @@ -38,6 +38,7 @@ SourceFiles #ifndef psiThermo_H #define psiThermo_H +#include "PsiThermo.H" #include "fluidThermo.H" #include "pureThermo.H" @@ -46,9 +47,6 @@ SourceFiles namespace Foam { -template class heThermo; -template class hePsiThermo; - /*---------------------------------------------------------------------------*\ Class psiThermo Declaration \*---------------------------------------------------------------------------*/ @@ -72,10 +70,11 @@ public: //- The derived type template - using heThermoType = hePsiThermo>; + using DerivedThermoType = + PsiThermo>; //- The derived name - static const word heThermoName; + static const word derivedThermoName; //- Runtime type information diff --git a/src/thermophysicalModels/basic/psiThermo/psiThermos.C b/src/thermophysicalModels/basic/psiThermo/psiThermos.C index 0b396c0847..61e6f3f7d4 100644 --- a/src/thermophysicalModels/basic/psiThermo/psiThermos.C +++ b/src/thermophysicalModels/basic/psiThermo/psiThermos.C @@ -24,10 +24,11 @@ License \*---------------------------------------------------------------------------*/ #include "psiThermo.H" -#include "hePsiThermo.H" + #include "pureMixture.H" #include "forGases.H" + #include "makeFluidThermo.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/thermophysicalModels/basic/rhoThermo/heRhoThermo.C b/src/thermophysicalModels/basic/rhoThermo/RhoThermo.C similarity index 88% rename from src/thermophysicalModels/basic/rhoThermo/heRhoThermo.C rename to src/thermophysicalModels/basic/rhoThermo/RhoThermo.C index 2908a53ac1..c569910bf6 100644 --- a/src/thermophysicalModels/basic/rhoThermo/heRhoThermo.C +++ b/src/thermophysicalModels/basic/rhoThermo/RhoThermo.C @@ -23,12 +23,12 @@ License \*---------------------------------------------------------------------------*/ -#include "heRhoThermo.H" +#include "RhoThermo.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -template -void Foam::heRhoThermo::calculate() +template +void Foam::RhoThermo::calculate() { const scalarField& hCells = this->he(); const scalarField& pCells = this->p_; @@ -45,10 +45,10 @@ void Foam::heRhoThermo::calculate() { auto composition = this->cellComposition(celli); - const typename HeThermo::mixtureType::thermoMixtureType& + const typename BaseThermo::mixtureType::thermoMixtureType& thermoMixture = this->thermoMixture(composition); - const typename HeThermo::mixtureType::transportMixtureType& + const typename BaseThermo::mixtureType::transportMixtureType& transportMixture = this->transportMixture(composition, thermoMixture); @@ -114,10 +114,10 @@ void Foam::heRhoThermo::calculate() { auto composition = this->patchFaceComposition(patchi, facei); - const typename HeThermo::mixtureType::thermoMixtureType& + const typename BaseThermo::mixtureType::thermoMixtureType& thermoMixture = this->thermoMixture(composition); - const typename HeThermo::mixtureType::transportMixtureType& + const typename BaseThermo::mixtureType::transportMixtureType& transportMixture = this->transportMixture(composition, thermoMixture); @@ -138,10 +138,10 @@ void Foam::heRhoThermo::calculate() { auto composition = this->patchFaceComposition(patchi, facei); - const typename HeThermo::mixtureType::thermoMixtureType& + const typename BaseThermo::mixtureType::thermoMixtureType& thermoMixture = this->thermoMixture(composition); - const typename HeThermo::mixtureType::transportMixtureType& + const typename BaseThermo::mixtureType::transportMixtureType& transportMixture = this->transportMixture(composition, thermoMixture); @@ -162,14 +162,14 @@ void Foam::heRhoThermo::calculate() // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -template -Foam::heRhoThermo::heRhoThermo +template +Foam::RhoThermo::RhoThermo ( const fvMesh& mesh, const word& phaseName ) : - HeThermo(mesh, phaseName) + BaseThermo(mesh, phaseName) { calculate(); } @@ -177,24 +177,24 @@ Foam::heRhoThermo::heRhoThermo // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // -template -Foam::heRhoThermo::~heRhoThermo() +template +Foam::RhoThermo::~RhoThermo() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -template -void Foam::heRhoThermo::correct() +template +void Foam::RhoThermo::correct() { - if (HeThermo::debug) + if (BaseThermo::debug) { InfoInFunction << endl; } calculate(); - if (HeThermo::debug) + if (BaseThermo::debug) { Info<< " Finished" << endl; } diff --git a/src/thermophysicalModels/basic/rhoThermo/heRhoThermo.H b/src/thermophysicalModels/basic/rhoThermo/RhoThermo.H similarity index 82% rename from src/thermophysicalModels/basic/rhoThermo/heRhoThermo.H rename to src/thermophysicalModels/basic/rhoThermo/RhoThermo.H index 9cc4b12ea2..e82b57afcf 100644 --- a/src/thermophysicalModels/basic/rhoThermo/heRhoThermo.H +++ b/src/thermophysicalModels/basic/rhoThermo/RhoThermo.H @@ -22,21 +22,20 @@ License along with OpenFOAM. If not, see . Class - Foam::heRhoThermo + Foam::RhoThermo Description Thermo implementation based on density SourceFiles - heRhoThermo.C + RhoThermo.C \*---------------------------------------------------------------------------*/ -#ifndef heRhoThermo_H -#define heRhoThermo_H +#ifndef RhoThermo_H +#define RhoThermo_H -#include "rhoThermo.H" -#include "heThermo.H" +#include "BasicThermo.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -44,13 +43,13 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class heRhoThermo Declaration + Class RhoThermo Declaration \*---------------------------------------------------------------------------*/ -template -class heRhoThermo +template +class RhoThermo : - public HeThermo + public BaseThermo { // Private Member Functions @@ -63,14 +62,14 @@ public: // Constructors //- Construct from mesh and phase name - heRhoThermo(const fvMesh&, const word& phaseName); + RhoThermo(const fvMesh&, const word& phaseName); //- Disallow default bitwise copy construction - heRhoThermo(const heRhoThermo&) = delete; + RhoThermo(const RhoThermo&) = delete; //- Destructor - virtual ~heRhoThermo(); + virtual ~RhoThermo(); // Member Functions @@ -82,7 +81,7 @@ public: // Member Operators //- Disallow default bitwise assignment - void operator=(const heRhoThermo&) = delete; + void operator=(const RhoThermo&) = delete; }; @@ -93,7 +92,7 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #ifdef NoRepository - #include "heRhoThermo.C" + #include "RhoThermo.C" #endif // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/thermophysicalModels/basic/rhoThermo/rhoThermo.C b/src/thermophysicalModels/basic/rhoThermo/rhoThermo.C index 9d1e2e34b1..087aacf294 100644 --- a/src/thermophysicalModels/basic/rhoThermo/rhoThermo.C +++ b/src/thermophysicalModels/basic/rhoThermo/rhoThermo.C @@ -33,7 +33,7 @@ namespace Foam defineRunTimeSelectionTable(rhoThermo, fvMesh); } -const Foam::word Foam::rhoThermo::heThermoName("heRhoThermo"); +const Foam::word Foam::rhoThermo::derivedThermoName("heRhoThermo"); // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // diff --git a/src/thermophysicalModels/basic/rhoThermo/rhoThermo.H b/src/thermophysicalModels/basic/rhoThermo/rhoThermo.H index 2fa56bc695..d7b6491f36 100644 --- a/src/thermophysicalModels/basic/rhoThermo/rhoThermo.H +++ b/src/thermophysicalModels/basic/rhoThermo/rhoThermo.H @@ -38,6 +38,7 @@ SourceFiles #ifndef rhoThermo_H #define rhoThermo_H +#include "RhoThermo.H" #include "fluidThermo.H" #include "pureThermo.H" @@ -46,9 +47,6 @@ SourceFiles namespace Foam { -template class heThermo; -template class heRhoThermo; - /*---------------------------------------------------------------------------*\ Class rhoThermo Declaration \*---------------------------------------------------------------------------*/ @@ -72,10 +70,11 @@ public: //- The derived type template - using heThermoType = heRhoThermo>; + using DerivedThermoType = + RhoThermo>; //- The derived name - static const word heThermoName; + static const word derivedThermoName; //- Runtime type information diff --git a/src/thermophysicalModels/basic/rhoThermo/rhoThermos.C b/src/thermophysicalModels/basic/rhoThermo/rhoThermos.C index 622c626026..0f61bbcd76 100644 --- a/src/thermophysicalModels/basic/rhoThermo/rhoThermos.C +++ b/src/thermophysicalModels/basic/rhoThermo/rhoThermos.C @@ -24,12 +24,13 @@ License \*---------------------------------------------------------------------------*/ #include "rhoThermo.H" -#include "heRhoThermo.H" + #include "pureMixture.H" #include "forGases.H" #include "forLiquids.H" #include "forTabulated.H" + #include "makeFluidThermo.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/thermophysicalModels/multicomponentThermo/fluidMulticomponentThermo/heFluidMulticomponentThermo.C b/src/thermophysicalModels/multicomponentThermo/fluidMulticomponentThermo/FluidMulticomponentThermo.C similarity index 80% rename from src/thermophysicalModels/multicomponentThermo/fluidMulticomponentThermo/heFluidMulticomponentThermo.C rename to src/thermophysicalModels/multicomponentThermo/fluidMulticomponentThermo/FluidMulticomponentThermo.C index f18dc9a74e..2a2d42a093 100644 --- a/src/thermophysicalModels/multicomponentThermo/fluidMulticomponentThermo/heFluidMulticomponentThermo.C +++ b/src/thermophysicalModels/multicomponentThermo/fluidMulticomponentThermo/FluidMulticomponentThermo.C @@ -23,33 +23,33 @@ License \*---------------------------------------------------------------------------*/ -#include "heFluidMulticomponentThermo.H" +#include "FluidMulticomponentThermo.H" #include "fvMesh.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -template -Foam::heFluidMulticomponentThermo::heFluidMulticomponentThermo +template +Foam::FluidMulticomponentThermo::FluidMulticomponentThermo ( const fvMesh& mesh, const word& phaseName ) : - HeThermo(mesh, phaseName) + BaseThermo(mesh, phaseName) {} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // -template -Foam::heFluidMulticomponentThermo::~heFluidMulticomponentThermo() +template +Foam::FluidMulticomponentThermo::~FluidMulticomponentThermo() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -template -Foam::scalar Foam::heFluidMulticomponentThermo::mui +template +Foam::scalar Foam::FluidMulticomponentThermo::mui ( const label speciei, const scalar p, @@ -60,9 +60,9 @@ Foam::scalar Foam::heFluidMulticomponentThermo::mui } -template +template Foam::tmp -Foam::heFluidMulticomponentThermo::mui +Foam::FluidMulticomponentThermo::mui ( const label speciei, const volScalarField& p, @@ -73,7 +73,7 @@ Foam::heFluidMulticomponentThermo::mui ( "mu", dimMass/dimLength/dimTime, - &HeThermo::mixtureType::thermoType::mu, + &BaseThermo::mixtureType::thermoType::mu, speciei, p, T diff --git a/src/thermophysicalModels/multicomponentThermo/fluidMulticomponentThermo/heFluidMulticomponentThermo.H b/src/thermophysicalModels/multicomponentThermo/fluidMulticomponentThermo/FluidMulticomponentThermo.H similarity index 80% rename from src/thermophysicalModels/multicomponentThermo/fluidMulticomponentThermo/heFluidMulticomponentThermo.H rename to src/thermophysicalModels/multicomponentThermo/fluidMulticomponentThermo/FluidMulticomponentThermo.H index e77fc3ba49..daba3c9f91 100644 --- a/src/thermophysicalModels/multicomponentThermo/fluidMulticomponentThermo/heFluidMulticomponentThermo.H +++ b/src/thermophysicalModels/multicomponentThermo/fluidMulticomponentThermo/FluidMulticomponentThermo.H @@ -22,20 +22,20 @@ License along with OpenFOAM. If not, see . Class - Foam::heFluidMulticomponentThermo + Foam::FluidMulticomponentThermo Description Fluid multi-component thermo implementation SourceFiles - heFluidMulticomponentThermo.C + FluidMulticomponentThermo.C \*---------------------------------------------------------------------------*/ -#ifndef heFluidMulticomponentThermo_H -#define heFluidMulticomponentThermo_H +#ifndef FluidMulticomponentThermo_H +#define FluidMulticomponentThermo_H -#include "heThermo.H" +#include "BasicThermo.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -43,30 +43,30 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class heFluidMulticomponentThermo Declaration + Class FluidMulticomponentThermo Declaration \*---------------------------------------------------------------------------*/ -template -class heFluidMulticomponentThermo +template +class FluidMulticomponentThermo : - public HeThermo + public BaseThermo { public: // Constructors //- Construct from mesh and phase name - heFluidMulticomponentThermo(const fvMesh&, const word& phaseName); + FluidMulticomponentThermo(const fvMesh&, const word& phaseName); //- Disallow default bitwise copy construction - heFluidMulticomponentThermo + FluidMulticomponentThermo ( - const heFluidMulticomponentThermo& + const FluidMulticomponentThermo& ) = delete; //- Destructor - virtual ~heFluidMulticomponentThermo(); + virtual ~FluidMulticomponentThermo(); // Member Functions @@ -93,7 +93,7 @@ public: // Member Operators //- Disallow default bitwise assignment - void operator=(const heFluidMulticomponentThermo&) = delete; + void operator=(const FluidMulticomponentThermo&) = delete; }; @@ -104,7 +104,7 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * #ifdef NoRepository - #include "heFluidMulticomponentThermo.C" + #include "FluidMulticomponentThermo.C" #endif // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/thermophysicalModels/multicomponentThermo/fluidMulticomponentThermo/fluidMulticomponentThermo.H b/src/thermophysicalModels/multicomponentThermo/fluidMulticomponentThermo/fluidMulticomponentThermo.H index daeb7cf92c..a82cdcebb3 100644 --- a/src/thermophysicalModels/multicomponentThermo/fluidMulticomponentThermo/fluidMulticomponentThermo.H +++ b/src/thermophysicalModels/multicomponentThermo/fluidMulticomponentThermo/fluidMulticomponentThermo.H @@ -40,6 +40,7 @@ SourceFiles #include "fluidThermo.H" #include "multicomponentThermo.H" +#include "FluidMulticomponentThermo.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/thermophysicalModels/multicomponentThermo/multicomponentThermo/heMulticomponentThermo.C b/src/thermophysicalModels/multicomponentThermo/multicomponentThermo/MulticomponentThermo.C similarity index 71% rename from src/thermophysicalModels/multicomponentThermo/multicomponentThermo/heMulticomponentThermo.C rename to src/thermophysicalModels/multicomponentThermo/multicomponentThermo/MulticomponentThermo.C index ee747c9298..1e0afda134 100644 --- a/src/thermophysicalModels/multicomponentThermo/multicomponentThermo/heMulticomponentThermo.C +++ b/src/thermophysicalModels/multicomponentThermo/multicomponentThermo/MulticomponentThermo.C @@ -23,15 +23,15 @@ License \*---------------------------------------------------------------------------*/ -#include "heMulticomponentThermo.H" +#include "MulticomponentThermo.H" #include "fvMesh.H" // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // -template +template template Foam::tmp -Foam::heMulticomponentThermo::volScalarFieldPropertyi +Foam::MulticomponentThermo::volScalarFieldPropertyi ( const word& psiName, const dimensionSet& psiDim, @@ -40,7 +40,7 @@ Foam::heMulticomponentThermo::volScalarFieldPropertyi const Args& ... args ) const { - const typename HeThermo::mixtureType::thermoType& thermo = + const typename BaseThermo::mixtureType::thermoType& thermo = this->specieThermo(speciei); tmp tPsi @@ -78,10 +78,10 @@ Foam::heMulticomponentThermo::volScalarFieldPropertyi } -template +template template Foam::tmp -Foam::heMulticomponentThermo::scalarFieldPropertyi +Foam::MulticomponentThermo::scalarFieldPropertyi ( Method psiMethod, const label speciei, @@ -89,7 +89,7 @@ Foam::heMulticomponentThermo::scalarFieldPropertyi const Args& ... args ) const { - const typename HeThermo::mixtureType::thermoType& thermo = + const typename BaseThermo::mixtureType::thermoType& thermo = this->specieThermo(speciei); tmp tPsi(new scalarField(arg.size())); @@ -107,28 +107,28 @@ Foam::heMulticomponentThermo::scalarFieldPropertyi // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -template -Foam::heMulticomponentThermo::heMulticomponentThermo +template +Foam::MulticomponentThermo::MulticomponentThermo ( const fvMesh& mesh, const word& phaseName ) : - HeThermo(mesh, phaseName) + BaseThermo(mesh, phaseName) {} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // -template -Foam::heMulticomponentThermo::~heMulticomponentThermo() +template +Foam::MulticomponentThermo::~MulticomponentThermo() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -template -Foam::scalar Foam::heMulticomponentThermo::Wi +template +Foam::scalar Foam::MulticomponentThermo::Wi ( const label speciei ) const @@ -137,8 +137,8 @@ Foam::scalar Foam::heMulticomponentThermo::Wi } -template -Foam::scalar Foam::heMulticomponentThermo::hfi +template +Foam::scalar Foam::MulticomponentThermo::hfi ( const label speciei ) const @@ -147,8 +147,8 @@ Foam::scalar Foam::heMulticomponentThermo::hfi } -template -Foam::scalar Foam::heMulticomponentThermo::rhoi +template +Foam::scalar Foam::MulticomponentThermo::rhoi ( const label speciei, const scalar p, @@ -159,9 +159,9 @@ Foam::scalar Foam::heMulticomponentThermo::rhoi } -template +template Foam::tmp -Foam::heMulticomponentThermo::rhoi +Foam::MulticomponentThermo::rhoi ( const label speciei, const volScalarField& p, @@ -172,7 +172,7 @@ Foam::heMulticomponentThermo::rhoi ( "rho", dimDensity, - &HeThermo::mixtureType::thermoType::rho, + &BaseThermo::mixtureType::thermoType::rho, speciei, p, T @@ -180,8 +180,8 @@ Foam::heMulticomponentThermo::rhoi } -template -Foam::scalar Foam::heMulticomponentThermo::Cpi +template +Foam::scalar Foam::MulticomponentThermo::Cpi ( const label speciei, const scalar p, @@ -192,9 +192,9 @@ Foam::scalar Foam::heMulticomponentThermo::Cpi } -template +template Foam::tmp -Foam::heMulticomponentThermo::Cpi +Foam::MulticomponentThermo::Cpi ( const label speciei, const volScalarField& p, @@ -205,7 +205,7 @@ Foam::heMulticomponentThermo::Cpi ( "Cp", dimEnergy/dimMass/dimTemperature, - &HeThermo::mixtureType::thermoType::Cp, + &BaseThermo::mixtureType::thermoType::Cp, speciei, p, T @@ -213,8 +213,8 @@ Foam::heMulticomponentThermo::Cpi } -template -Foam::scalar Foam::heMulticomponentThermo::hei +template +Foam::scalar Foam::MulticomponentThermo::hei ( const label speciei, const scalar p, @@ -225,8 +225,8 @@ Foam::scalar Foam::heMulticomponentThermo::hei } -template -Foam::tmp Foam::heMulticomponentThermo::hei +template +Foam::tmp Foam::MulticomponentThermo::hei ( const label speciei, const scalarField& p, @@ -235,7 +235,7 @@ Foam::tmp Foam::heMulticomponentThermo::hei { return scalarFieldPropertyi ( - &HeThermo::mixtureType::thermoType::HE, + &BaseThermo::mixtureType::thermoType::HE, speciei, p, T @@ -243,9 +243,9 @@ Foam::tmp Foam::heMulticomponentThermo::hei } -template +template Foam::tmp -Foam::heMulticomponentThermo::hei +Foam::MulticomponentThermo::hei ( const label speciei, const volScalarField& p, @@ -256,7 +256,7 @@ Foam::heMulticomponentThermo::hei ( "he", dimEnergy/dimMass, - &HeThermo::mixtureType::thermoType::HE, + &BaseThermo::mixtureType::thermoType::HE, speciei, p, T @@ -264,8 +264,8 @@ Foam::heMulticomponentThermo::hei } -template -Foam::scalar Foam::heMulticomponentThermo::hsi +template +Foam::scalar Foam::MulticomponentThermo::hsi ( const label speciei, const scalar p, @@ -276,8 +276,8 @@ Foam::scalar Foam::heMulticomponentThermo::hsi } -template -Foam::tmp Foam::heMulticomponentThermo::hsi +template +Foam::tmp Foam::MulticomponentThermo::hsi ( const label speciei, const scalarField& p, @@ -286,7 +286,7 @@ Foam::tmp Foam::heMulticomponentThermo::hsi { return scalarFieldPropertyi ( - &HeThermo::mixtureType::thermoType::Hs, + &BaseThermo::mixtureType::thermoType::Hs, speciei, p, T @@ -294,9 +294,9 @@ Foam::tmp Foam::heMulticomponentThermo::hsi } -template +template Foam::tmp -Foam::heMulticomponentThermo::hsi +Foam::MulticomponentThermo::hsi ( const label speciei, const volScalarField& p, @@ -307,7 +307,7 @@ Foam::heMulticomponentThermo::hsi ( "hs", dimEnergy/dimMass, - &HeThermo::mixtureType::thermoType::Hs, + &BaseThermo::mixtureType::thermoType::Hs, speciei, p, T @@ -315,8 +315,8 @@ Foam::heMulticomponentThermo::hsi } -template -Foam::scalar Foam::heMulticomponentThermo::hai +template +Foam::scalar Foam::MulticomponentThermo::hai ( const label speciei, const scalar p, @@ -327,8 +327,8 @@ Foam::scalar Foam::heMulticomponentThermo::hai } -template -Foam::tmp Foam::heMulticomponentThermo::hai +template +Foam::tmp Foam::MulticomponentThermo::hai ( const label speciei, const scalarField& p, @@ -337,7 +337,7 @@ Foam::tmp Foam::heMulticomponentThermo::hai { return scalarFieldPropertyi ( - &HeThermo::mixtureType::thermoType::Ha, + &BaseThermo::mixtureType::thermoType::Ha, speciei, p, T @@ -345,9 +345,9 @@ Foam::tmp Foam::heMulticomponentThermo::hai } -template +template Foam::tmp -Foam::heMulticomponentThermo::hai +Foam::MulticomponentThermo::hai ( const label speciei, const volScalarField& p, @@ -358,7 +358,7 @@ Foam::heMulticomponentThermo::hai ( "ha", dimEnergy/dimMass, - &HeThermo::mixtureType::thermoType::Ha, + &BaseThermo::mixtureType::thermoType::Ha, speciei, p, T @@ -366,8 +366,8 @@ Foam::heMulticomponentThermo::hai } -template -Foam::scalar Foam::heMulticomponentThermo::kappai +template +Foam::scalar Foam::MulticomponentThermo::kappai ( const label speciei, const scalar p, @@ -378,9 +378,9 @@ Foam::scalar Foam::heMulticomponentThermo::kappai } -template +template Foam::tmp -Foam::heMulticomponentThermo::kappai +Foam::MulticomponentThermo::kappai ( const label speciei, const volScalarField& p, @@ -391,7 +391,7 @@ Foam::heMulticomponentThermo::kappai ( "kappa", dimPower/dimLength/dimTemperature, - &HeThermo::mixtureType::thermoType::kappa, + &BaseThermo::mixtureType::thermoType::kappa, speciei, p, T diff --git a/src/thermophysicalModels/multicomponentThermo/multicomponentThermo/heMulticomponentThermo.H b/src/thermophysicalModels/multicomponentThermo/multicomponentThermo/MulticomponentThermo.H similarity index 92% rename from src/thermophysicalModels/multicomponentThermo/multicomponentThermo/heMulticomponentThermo.H rename to src/thermophysicalModels/multicomponentThermo/multicomponentThermo/MulticomponentThermo.H index de073717c1..33cbad4eda 100644 --- a/src/thermophysicalModels/multicomponentThermo/multicomponentThermo/heMulticomponentThermo.H +++ b/src/thermophysicalModels/multicomponentThermo/multicomponentThermo/MulticomponentThermo.H @@ -22,20 +22,20 @@ License along with OpenFOAM. If not, see . Class - Foam::heMulticomponentThermo + Foam::MulticomponentThermo Description Multi-component thermo implementation SourceFiles - heMulticomponentThermo.C + MulticomponentThermo.C \*---------------------------------------------------------------------------*/ -#ifndef heMulticomponentThermo_H -#define heMulticomponentThermo_H +#ifndef MulticomponentThermo_H +#define MulticomponentThermo_H -#include "heThermo.H" +#include "BasicThermo.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -43,13 +43,13 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class heMulticomponentThermo Declaration + Class MulticomponentThermo Declaration \*---------------------------------------------------------------------------*/ -template -class heMulticomponentThermo +template +class MulticomponentThermo : - public HeThermo + public BaseThermo { protected: @@ -82,17 +82,14 @@ public: // Constructors //- Construct from mesh and phase name - heMulticomponentThermo(const fvMesh&, const word& phaseName); + MulticomponentThermo(const fvMesh&, const word& phaseName); //- Disallow default bitwise copy construction - heMulticomponentThermo - ( - const heMulticomponentThermo& - ) = delete; + MulticomponentThermo(const MulticomponentThermo&) = delete; //- Destructor - virtual ~heMulticomponentThermo(); + virtual ~MulticomponentThermo(); // Member Functions @@ -240,7 +237,7 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * #ifdef NoRepository - #include "heMulticomponentThermo.C" + #include "MulticomponentThermo.C" #endif // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/thermophysicalModels/multicomponentThermo/multicomponentThermo/multicomponentThermo.H b/src/thermophysicalModels/multicomponentThermo/multicomponentThermo/multicomponentThermo.H index ce62636eb5..c5dcf132b9 100644 --- a/src/thermophysicalModels/multicomponentThermo/multicomponentThermo/multicomponentThermo.H +++ b/src/thermophysicalModels/multicomponentThermo/multicomponentThermo/multicomponentThermo.H @@ -39,6 +39,7 @@ SourceFiles #define multicomponentThermo_H #include "basicThermo.H" +#include "MulticomponentThermo.H" #include "speciesTable.H" #include "GeometricFieldListSlicer.H" diff --git a/src/thermophysicalModels/multicomponentThermo/psiMulticomponentThermo/psiMulticomponentThermo.H b/src/thermophysicalModels/multicomponentThermo/psiMulticomponentThermo/psiMulticomponentThermo.H index 82e85404de..a0c15ed1a9 100644 --- a/src/thermophysicalModels/multicomponentThermo/psiMulticomponentThermo/psiMulticomponentThermo.H +++ b/src/thermophysicalModels/multicomponentThermo/psiMulticomponentThermo/psiMulticomponentThermo.H @@ -47,11 +47,6 @@ SourceFiles namespace Foam { -template class heThermo; -template class hePsiThermo; -template class heMulticomponentThermo; -template class heFluidMulticomponentThermo; - /*---------------------------------------------------------------------------*\ Class psiMulticomponentThermo Declaration \*---------------------------------------------------------------------------*/ @@ -73,14 +68,14 @@ public: //- The derived type template - using heThermoType = - heFluidMulticomponentThermo + using DerivedThermoType = + FluidMulticomponentThermo < - heMulticomponentThermo + MulticomponentThermo < - hePsiThermo + PsiThermo < - heThermo + BasicThermo > > >; diff --git a/src/thermophysicalModels/multicomponentThermo/psiMulticomponentThermo/psiMulticomponentThermos.C b/src/thermophysicalModels/multicomponentThermo/psiMulticomponentThermo/psiMulticomponentThermos.C index 2c5ed92b36..5ebbeec4d8 100644 --- a/src/thermophysicalModels/multicomponentThermo/psiMulticomponentThermo/psiMulticomponentThermos.C +++ b/src/thermophysicalModels/multicomponentThermo/psiMulticomponentThermo/psiMulticomponentThermos.C @@ -23,17 +23,14 @@ License \*---------------------------------------------------------------------------*/ +#include "psiMulticomponentThermo.H" + #include "coefficientMulticomponentMixture.H" #include "coefficientWilkeMulticomponentMixture.H" #include "singleComponentMixture.H" -#include "psiThermo.H" -#include "psiMulticomponentThermo.H" -#include "hePsiThermo.H" -#include "heMulticomponentThermo.H" -#include "heFluidMulticomponentThermo.H" - #include "forGases.H" + #include "makeFluidMulticomponentThermo.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/heheuPsiThermo.C b/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/PsiuMulticomponentThermo.C similarity index 77% rename from src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/heheuPsiThermo.C rename to src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/PsiuMulticomponentThermo.C index c556af20fa..6fca2dd026 100644 --- a/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/heheuPsiThermo.C +++ b/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/PsiuMulticomponentThermo.C @@ -23,14 +23,14 @@ License \*---------------------------------------------------------------------------*/ -#include "heheuPsiThermo.H" +#include "PsiuMulticomponentThermo.H" #include "fvMesh.H" #include "fixedValueFvPatchFields.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -template -void Foam::heheuPsiThermo::calculate() +template +void Foam::PsiuMulticomponentThermo::calculate() { const scalarField& hCells = this->he_; const scalarField& heuCells = this->heu_; @@ -48,10 +48,10 @@ void Foam::heheuPsiThermo::calculate() { auto composition = this->cellComposition(celli); - const typename HeThermo::mixtureType::thermoMixtureType& + const typename BaseThermo::mixtureType::thermoMixtureType& thermoMixture = this->thermoMixture(composition); - const typename HeThermo::mixtureType::transportMixtureType& + const typename BaseThermo::mixtureType::transportMixtureType& transportMixture = this->transportMixture(composition, thermoMixture); @@ -127,10 +127,10 @@ void Foam::heheuPsiThermo::calculate() { auto composition = this->patchFaceComposition(patchi, facei); - const typename HeThermo::mixtureType::thermoMixtureType& + const typename BaseThermo::mixtureType::thermoMixtureType& thermoMixture = this->thermoMixture(composition); - const typename HeThermo::mixtureType::transportMixtureType& + const typename BaseThermo::mixtureType::transportMixtureType& transportMixture = this->transportMixture(composition, thermoMixture); @@ -149,10 +149,10 @@ void Foam::heheuPsiThermo::calculate() { auto composition = this->patchFaceComposition(patchi, facei); - const typename HeThermo::mixtureType::thermoMixtureType& + const typename BaseThermo::mixtureType::thermoMixtureType& thermoMixture = this->thermoMixture(composition); - const typename HeThermo::mixtureType::transportMixtureType& + const typename BaseThermo::mixtureType::transportMixtureType& transportMixture = this->transportMixture(composition, thermoMixture); @@ -175,14 +175,14 @@ void Foam::heheuPsiThermo::calculate() // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -template -Foam::heheuPsiThermo::heheuPsiThermo +template +Foam::PsiuMulticomponentThermo::PsiuMulticomponentThermo ( const fvMesh& mesh, const word& phaseName ) : - HeThermo(mesh, phaseName), + BaseThermo(mesh, phaseName), Tu_ ( IOobject @@ -199,7 +199,7 @@ Foam::heheuPsiThermo::heheuPsiThermo ( IOobject ( - HeThermo::mixtureType::thermoType::heName() + 'u', + BaseThermo::mixtureType::thermoType::heName() + 'u', mesh.time().name(), mesh, IOobject::NO_READ, @@ -207,10 +207,10 @@ Foam::heheuPsiThermo::heheuPsiThermo ), this->volScalarFieldProperty ( - HeThermo::mixtureType::thermoType::heName() + 'u', + BaseThermo::mixtureType::thermoType::heName() + 'u', dimEnergy/dimMass, - &HeThermo::mixtureType::reactants, - &HeThermo::mixtureType::thermoMixtureType::HE, + &BaseThermo::mixtureType::reactants, + &BaseThermo::mixtureType::thermoMixtureType::HE, this->p_, this->Tu_ ), @@ -227,17 +227,17 @@ Foam::heheuPsiThermo::heheuPsiThermo // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // -template -Foam::heheuPsiThermo::~heheuPsiThermo() +template +Foam::PsiuMulticomponentThermo::~PsiuMulticomponentThermo() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -template -void Foam::heheuPsiThermo::correct() +template +void Foam::PsiuMulticomponentThermo::correct() { - if (HeThermo::debug) + if (BaseThermo::debug) { InfoInFunction << endl; } @@ -247,16 +247,16 @@ void Foam::heheuPsiThermo::correct() calculate(); - if (HeThermo::debug) + if (BaseThermo::debug) { Info<< " Finished" << endl; } } -template +template Foam::tmp -Foam::heheuPsiThermo::heu +Foam::PsiuMulticomponentThermo::heu ( const scalarField& Tu, const labelList& cells @@ -264,8 +264,8 @@ Foam::heheuPsiThermo::heu { return this->cellSetProperty ( - &HeThermo::mixtureType::reactants, - &HeThermo::mixtureType::thermoMixtureType::HE, + &BaseThermo::mixtureType::reactants, + &BaseThermo::mixtureType::thermoMixtureType::HE, cells, UIndirectList(this->p_, cells), Tu @@ -273,9 +273,9 @@ Foam::heheuPsiThermo::heu } -template +template Foam::tmp -Foam::heheuPsiThermo::heu +Foam::PsiuMulticomponentThermo::heu ( const scalarField& Tu, const label patchi @@ -283,8 +283,8 @@ Foam::heheuPsiThermo::heu { return this->patchFieldProperty ( - &HeThermo::mixtureType::reactants, - &HeThermo::mixtureType::thermoMixtureType::HE, + &BaseThermo::mixtureType::reactants, + &BaseThermo::mixtureType::thermoMixtureType::HE, patchi, this->p_.boundaryField()[patchi], Tu @@ -292,16 +292,16 @@ Foam::heheuPsiThermo::heu } -template +template Foam::tmp -Foam::heheuPsiThermo::Tb() const +Foam::PsiuMulticomponentThermo::Tb() const { return this->volScalarFieldProperty ( "Tb", dimTemperature, - &HeThermo::mixtureType::products, - &HeThermo::mixtureType::thermoMixtureType::THE, + &BaseThermo::mixtureType::products, + &BaseThermo::mixtureType::thermoMixtureType::THE, this->he_, this->p_, this->T_ @@ -309,25 +309,25 @@ Foam::heheuPsiThermo::Tb() const } -template +template Foam::tmp -Foam::heheuPsiThermo::psiu() const +Foam::PsiuMulticomponentThermo::psiu() const { return this->volScalarFieldProperty ( "psiu", this->psi_.dimensions(), - &HeThermo::mixtureType::reactants, - &HeThermo::mixtureType::thermoMixtureType::psi, + &BaseThermo::mixtureType::reactants, + &BaseThermo::mixtureType::thermoMixtureType::psi, this->p_, this->Tu_ ); } -template +template Foam::tmp -Foam::heheuPsiThermo::psib() const +Foam::PsiuMulticomponentThermo::psib() const { const volScalarField Tb(this->Tb()); @@ -335,33 +335,33 @@ Foam::heheuPsiThermo::psib() const ( "psib", this->psi_.dimensions(), - &HeThermo::mixtureType::products, - &HeThermo::mixtureType::thermoMixtureType::psi, + &BaseThermo::mixtureType::products, + &BaseThermo::mixtureType::thermoMixtureType::psi, this->p_, Tb ); } -template +template Foam::tmp -Foam::heheuPsiThermo::muu() const +Foam::PsiuMulticomponentThermo::muu() const { return this->volScalarFieldProperty ( "muu", dimDynamicViscosity, - &HeThermo::mixtureType::reactants, - &HeThermo::mixtureType::transportMixtureType::mu, + &BaseThermo::mixtureType::reactants, + &BaseThermo::mixtureType::transportMixtureType::mu, this->p_, this->Tu_ ); } -template +template Foam::tmp -Foam::heheuPsiThermo::mub() const +Foam::PsiuMulticomponentThermo::mub() const { const volScalarField Tb(this->Tb()); @@ -369,8 +369,8 @@ Foam::heheuPsiThermo::mub() const ( "mub", dimDynamicViscosity, - &HeThermo::mixtureType::products, - &HeThermo::mixtureType::transportMixtureType::mu, + &BaseThermo::mixtureType::products, + &BaseThermo::mixtureType::transportMixtureType::mu, this->p_, Tb ); diff --git a/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/heheuPsiThermo.H b/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/PsiuMulticomponentThermo.H similarity index 86% rename from src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/heheuPsiThermo.H rename to src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/PsiuMulticomponentThermo.H index e2a6d67f8d..1790667160 100644 --- a/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/heheuPsiThermo.H +++ b/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/PsiuMulticomponentThermo.H @@ -22,21 +22,21 @@ License along with OpenFOAM. If not, see . Class - Foam::heheuPsiThermo + Foam::PsiuMulticomponentThermo Description Thermo implementation based on compressibility with additional unburnt thermodynamic state SourceFiles - heheuPsiThermo.C + PsiuMulticomponentThermo.C \*---------------------------------------------------------------------------*/ -#ifndef heheuPsiThermo_H -#define heheuPsiThermo_H +#ifndef PsiuMulticomponentThermo_H +#define PsiuMulticomponentThermo_H -#include "heThermo.H" +#include "BasicThermo.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -44,13 +44,13 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class heheuPsiThermo Declaration + Class PsiuMulticomponentThermo Declaration \*---------------------------------------------------------------------------*/ -template -class heheuPsiThermo +template +class PsiuMulticomponentThermo : - public HeThermo + public BaseThermo { // Private Data @@ -72,14 +72,17 @@ public: // Constructors //- Construct from mesh and phase name - heheuPsiThermo(const fvMesh&, const word& phaseName); + PsiuMulticomponentThermo(const fvMesh&, const word& phaseName); //- Disallow default bitwise copy construction - heheuPsiThermo(const heheuPsiThermo&) = delete; + PsiuMulticomponentThermo + ( + const PsiuMulticomponentThermo& + ) = delete; //- Destructor - virtual ~heheuPsiThermo(); + virtual ~PsiuMulticomponentThermo(); // Member Functions @@ -149,7 +152,7 @@ public: // Member Operators //- Disallow default bitwise assignment - void operator=(const heheuPsiThermo&) = delete; + void operator=(const PsiuMulticomponentThermo&) = delete; }; @@ -160,7 +163,7 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * #ifdef NoRepository - #include "heheuPsiThermo.C" + #include "PsiuMulticomponentThermo.C" #endif // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/psiuMulticomponentThermo.C b/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/psiuMulticomponentThermo.C index 5bc0f76fdc..0056dccbe0 100644 --- a/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/psiuMulticomponentThermo.C +++ b/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/psiuMulticomponentThermo.C @@ -37,7 +37,10 @@ namespace Foam defineRunTimeSelectionTable(psiuMulticomponentThermo, fvMesh); } -const Foam::word Foam::psiuMulticomponentThermo::heThermoName("heheuPsiThermo"); +const Foam::word Foam::psiuMulticomponentThermo::derivedThermoName +( + "heheuPsiThermo" +); // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // diff --git a/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/psiuMulticomponentThermo.H b/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/psiuMulticomponentThermo.H index eb4c6bcf8b..4cbfc94bdb 100644 --- a/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/psiuMulticomponentThermo.H +++ b/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/psiuMulticomponentThermo.H @@ -40,6 +40,7 @@ SourceFiles #define psiuMulticomponentThermo_H #include "psiThermo.H" +#include "PsiuMulticomponentThermo.H" #include "speciesTable.H" #include "GeometricFieldListSlicer.H" @@ -48,9 +49,6 @@ SourceFiles namespace Foam { -template class heThermo; -template class heheuPsiThermo; - /*---------------------------------------------------------------------------*\ Class psiuMulticomponentThermo Declaration \*---------------------------------------------------------------------------*/ @@ -86,10 +84,11 @@ public: //- The derived type template - using heThermoType = heheuPsiThermo>; + using DerivedThermoType = + PsiuMulticomponentThermo>; //- The derived name - static const word heThermoName; + static const word derivedThermoName; //- Runtime type information diff --git a/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/psiuMulticomponentThermoI.H b/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/psiuMulticomponentThermoI.H index f50b315acf..09760d4a10 100644 --- a/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/psiuMulticomponentThermoI.H +++ b/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/psiuMulticomponentThermoI.H @@ -23,8 +23,8 @@ License \*---------------------------------------------------------------------------*/ -#include "FieldListSlice.H" #include "psiuMulticomponentThermo.H" +#include "FieldListSlice.H" // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // diff --git a/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/psiuMulticomponentThermos.C b/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/psiuMulticomponentThermos.C index 08926b1811..dedea9383e 100644 --- a/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/psiuMulticomponentThermos.C +++ b/src/thermophysicalModels/multicomponentThermo/psiuMulticomponentThermo/psiuMulticomponentThermos.C @@ -23,16 +23,15 @@ License \*---------------------------------------------------------------------------*/ +#include "psiuMulticomponentThermo.H" + #include "egrMixture.H" #include "homogeneousMixture.H" #include "inhomogeneousMixture.H" #include "veryInhomogeneousMixture.H" -#include "psiThermo.H" -#include "psiuMulticomponentThermo.H" -#include "heheuPsiThermo.H" - #include "forAbsoluteGases.H" + #include "makeThermo.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/thermophysicalModels/multicomponentThermo/rhoMulticomponentThermo/rhoMulticomponentThermo.H b/src/thermophysicalModels/multicomponentThermo/rhoMulticomponentThermo/rhoMulticomponentThermo.H index 7931836805..7afa64f81b 100644 --- a/src/thermophysicalModels/multicomponentThermo/rhoMulticomponentThermo/rhoMulticomponentThermo.H +++ b/src/thermophysicalModels/multicomponentThermo/rhoMulticomponentThermo/rhoMulticomponentThermo.H @@ -47,11 +47,6 @@ SourceFiles namespace Foam { -template class heThermo; -template class heRhoThermo; -template class heMulticomponentThermo; -template class heFluidMulticomponentThermo; - /*---------------------------------------------------------------------------*\ Class rhoMulticomponentThermo Declaration \*---------------------------------------------------------------------------*/ @@ -73,14 +68,14 @@ public: //- The derived type template - using heThermoType = - heFluidMulticomponentThermo + using DerivedThermoType = + FluidMulticomponentThermo < - heMulticomponentThermo + MulticomponentThermo < - heRhoThermo + RhoThermo < - heThermo + BasicThermo > > >; diff --git a/src/thermophysicalModels/multicomponentThermo/rhoMulticomponentThermo/rhoMulticomponentThermos.C b/src/thermophysicalModels/multicomponentThermo/rhoMulticomponentThermo/rhoMulticomponentThermos.C index 296139c516..62deb11d03 100644 --- a/src/thermophysicalModels/multicomponentThermo/rhoMulticomponentThermo/rhoMulticomponentThermos.C +++ b/src/thermophysicalModels/multicomponentThermo/rhoMulticomponentThermo/rhoMulticomponentThermos.C @@ -23,20 +23,17 @@ License \*---------------------------------------------------------------------------*/ +#include "rhoMulticomponentThermo.H" + #include "coefficientMulticomponentMixture.H" #include "coefficientWilkeMulticomponentMixture.H" #include "valueMulticomponentMixture.H" #include "singleComponentMixture.H" -#include "rhoThermo.H" -#include "rhoMulticomponentThermo.H" -#include "heRhoThermo.H" -#include "heMulticomponentThermo.H" -#include "heFluidMulticomponentThermo.H" - #include "forGases.H" #include "forLiquids.H" #include "forTabulated.H" + #include "makeFluidMulticomponentThermo.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/thermophysicalModels/solidThermo/solidThermo/heSolidThermo.C b/src/thermophysicalModels/solidThermo/solidThermo/SolidThermo.C similarity index 86% rename from src/thermophysicalModels/solidThermo/solidThermo/heSolidThermo.C rename to src/thermophysicalModels/solidThermo/solidThermo/SolidThermo.C index 8603353aea..a715c64a6b 100644 --- a/src/thermophysicalModels/solidThermo/solidThermo/heSolidThermo.C +++ b/src/thermophysicalModels/solidThermo/solidThermo/SolidThermo.C @@ -23,12 +23,12 @@ License \*---------------------------------------------------------------------------*/ -#include "heSolidThermo.H" +#include "SolidThermo.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -template -void Foam::heSolidThermo::calculate() +template +void Foam::SolidThermo::calculate() { const bool isotropic = this->isotropic(); @@ -46,10 +46,10 @@ void Foam::heSolidThermo::calculate() { auto composition = this->cellComposition(celli); - const typename HeThermo::mixtureType::thermoMixtureType& + const typename BaseThermo::mixtureType::thermoMixtureType& thermoMixture = this->thermoMixture(composition); - const typename HeThermo::mixtureType::transportMixtureType& + const typename BaseThermo::mixtureType::transportMixtureType& transportMixture = this->transportMixture(composition, thermoMixture); @@ -117,10 +117,10 @@ void Foam::heSolidThermo::calculate() { auto composition = this->patchFaceComposition(patchi, facei); - const typename HeThermo::mixtureType::thermoMixtureType& + const typename BaseThermo::mixtureType::thermoMixtureType& thermoMixture = this->thermoMixture(composition); - const typename HeThermo::mixtureType::transportMixtureType& + const typename BaseThermo::mixtureType::transportMixtureType& transportMixture = this->transportMixture(composition, thermoMixture); @@ -148,10 +148,10 @@ void Foam::heSolidThermo::calculate() { auto composition = this->patchFaceComposition(patchi, facei); - const typename HeThermo::mixtureType::thermoMixtureType& + const typename BaseThermo::mixtureType::thermoMixtureType& thermoMixture = this->thermoMixture(composition); - const typename HeThermo::mixtureType::transportMixtureType& + const typename BaseThermo::mixtureType::transportMixtureType& transportMixture = this->transportMixture(composition, thermoMixture); @@ -179,19 +179,19 @@ void Foam::heSolidThermo::calculate() // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -template -Foam::heSolidThermo::heSolidThermo +template +Foam::SolidThermo::SolidThermo ( const fvMesh& mesh, const word& phaseName ) : - HeThermo(mesh, phaseName), + BaseThermo(mesh, phaseName), Kappa_ ( IOobject ( - HeThermo::phasePropertyName("Kappa", phaseName), + BaseThermo::phasePropertyName("Kappa", phaseName), mesh.time().name(), mesh, IOobject::NO_READ, @@ -207,33 +207,33 @@ Foam::heSolidThermo::heSolidThermo // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // -template -Foam::heSolidThermo::~heSolidThermo() +template +Foam::SolidThermo::~SolidThermo() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -template -void Foam::heSolidThermo::correct() +template +void Foam::SolidThermo::correct() { - if (HeThermo::debug) + if (BaseThermo::debug) { InfoInFunction << endl; } calculate(); - if (HeThermo::debug) + if (BaseThermo::debug) { Info<< " Finished" << endl; } } -template +template const Foam::volVectorField& -Foam::heSolidThermo::Kappa() const +Foam::SolidThermo::Kappa() const { return Kappa_; } diff --git a/src/thermophysicalModels/solidThermo/solidThermo/heSolidThermo.H b/src/thermophysicalModels/solidThermo/solidThermo/SolidThermo.H similarity index 83% rename from src/thermophysicalModels/solidThermo/solidThermo/heSolidThermo.H rename to src/thermophysicalModels/solidThermo/solidThermo/SolidThermo.H index c45881a8ee..e9fe4e99c8 100644 --- a/src/thermophysicalModels/solidThermo/solidThermo/heSolidThermo.H +++ b/src/thermophysicalModels/solidThermo/solidThermo/SolidThermo.H @@ -22,20 +22,20 @@ License along with OpenFOAM. If not, see . Class - Foam::heSolidThermo + Foam::SolidThermo Description Thermo implementation for a solid SourceFiles - heSolidThermo.C + SolidThermo.C \*---------------------------------------------------------------------------*/ -#ifndef heSolidThermo_H -#define heSolidThermo_H +#ifndef SolidThermo_H +#define SolidThermo_H -#include "heThermo.H" +#include "BasicThermo.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -43,13 +43,13 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class heSolidThermo Declaration + Class SolidThermo Declaration \*---------------------------------------------------------------------------*/ -template -class heSolidThermo +template +class SolidThermo : - public HeThermo + public BaseThermo { protected: @@ -70,14 +70,14 @@ public: // Constructors //- Construct from mesh and phase name - heSolidThermo(const fvMesh&, const word& phaseName); + SolidThermo(const fvMesh&, const word& phaseName); //- Disallow default bitwise copy construction - heSolidThermo(const heSolidThermo&) = delete; + SolidThermo(const SolidThermo&) = delete; //- Destructor - virtual ~heSolidThermo(); + virtual ~SolidThermo(); // Member Functions @@ -88,7 +88,7 @@ public: //- Return true if thermal conductivity is isotropic virtual bool isotropic() const { - return HeThermo::mixtureType::thermoType::isotropic; + return BaseThermo::mixtureType::thermoType::isotropic; } //- Anisotropic thermal conductivity [W/m/K] @@ -98,7 +98,7 @@ public: // Member Operators //- Disallow default bitwise assignment - void operator=(const heSolidThermo&) = delete; + void operator=(const SolidThermo&) = delete; }; @@ -109,7 +109,7 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #ifdef NoRepository - #include "heSolidThermo.C" + #include "SolidThermo.C" #endif // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/thermophysicalModels/solidThermo/solidThermo/solidThermo.C b/src/thermophysicalModels/solidThermo/solidThermo/solidThermo.C index 4a0c79bb89..0aa347aff0 100644 --- a/src/thermophysicalModels/solidThermo/solidThermo/solidThermo.C +++ b/src/thermophysicalModels/solidThermo/solidThermo/solidThermo.C @@ -34,7 +34,7 @@ namespace Foam defineRunTimeSelectionTable(solidThermo, fvMesh); } -const Foam::word Foam::solidThermo::heThermoName("heSolidThermo"); +const Foam::word Foam::solidThermo::derivedThermoName("heSolidThermo"); // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -86,17 +86,6 @@ Foam::autoPtr Foam::solidThermo::New } -// Foam::autoPtr Foam::solidThermo::New -// ( -// const fvMesh& mesh, -// const dictionary& dict, -// const word& phaseName -// ) -// { -// return basicThermo::New(mesh, dict, phaseName); -// } - - // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // Foam::solidThermo::~solidThermo() diff --git a/src/thermophysicalModels/solidThermo/solidThermo/solidThermo.H b/src/thermophysicalModels/solidThermo/solidThermo/solidThermo.H index 152e55839b..919f02bfc3 100644 --- a/src/thermophysicalModels/solidThermo/solidThermo/solidThermo.H +++ b/src/thermophysicalModels/solidThermo/solidThermo/solidThermo.H @@ -39,6 +39,7 @@ SourceFiles #define solidThermo_H #include "pureThermo.H" +#include "SolidThermo.H" #include "uniformGeometricFields.H" #include "fvScalarMatrix.H" @@ -47,9 +48,6 @@ SourceFiles namespace Foam { -template class heThermo; -template class heSolidThermo; - /*---------------------------------------------------------------------------*\ Class solidThermo Declaration \*---------------------------------------------------------------------------*/ @@ -73,10 +71,11 @@ public: //- The derived type template - using heThermoType = heSolidThermo>; + using DerivedThermoType = + SolidThermo>; //- The derived name - static const word heThermoName; + static const word derivedThermoName; //- Runtime type information diff --git a/src/thermophysicalModels/solidThermo/solidThermo/solidThermos.C b/src/thermophysicalModels/solidThermo/solidThermo/solidThermos.C index 389b1f98f8..ac03ecd6ba 100644 --- a/src/thermophysicalModels/solidThermo/solidThermo/solidThermos.C +++ b/src/thermophysicalModels/solidThermo/solidThermo/solidThermos.C @@ -24,10 +24,11 @@ License \*---------------------------------------------------------------------------*/ #include "solidThermo.H" -#include "heSolidThermo.H" + #include "pureMixture.H" #include "forSolids.H" + #include "makeThermo.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/thermophysicalModels/specie/include/makeThermo.H b/src/thermophysicalModels/specie/include/makeThermo.H index 3986f3bf5b..d009a36399 100644 --- a/src/thermophysicalModels/specie/include/makeThermo.H +++ b/src/thermophysicalModels/specie/include/makeThermo.H @@ -33,6 +33,7 @@ Description #define makeThermo_H #include "basicThermo.H" +#include "NamedThermo.H" #include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -40,14 +41,14 @@ Description #define defineThermo(BaseThermo, Mixture, ThermoPhysics) \ \ typedef \ - namedHeThermo>> \ - BaseThermo##HeThermo##Mixture##ThermoPhysics; \ + NamedThermo>> \ + BaseThermo##Mixture##ThermoPhysics; \ \ defineTemplateTypeNameAndDebugWithName \ ( \ - BaseThermo##HeThermo##Mixture##ThermoPhysics, \ + BaseThermo##Mixture##ThermoPhysics, \ ( \ - BaseThermo::heThermoName + "<" \ + BaseThermo::derivedThermoName + "<" \ + Mixture::typeName() + ">" \ ).c_str(), \ 0 \ @@ -59,7 +60,7 @@ Description addToRunTimeSelectionTable \ ( \ SelectThermo, \ - BaseThermo##HeThermo##Mixture##ThermoPhysics, \ + BaseThermo##Mixture##ThermoPhysics, \ fvMesh \ ); From 4acddc6ab036b9d54e860237a520b7e38ef2ef0f Mon Sep 17 00:00:00 2001 From: Will Bainbridge Date: Wed, 26 Jul 2023 15:42:16 +0100 Subject: [PATCH 4/4] solidThermo: Add rhoThermo interface The old fluid-specific rhoThermo has been split into a non-fluid specific part which is still called rhoThermo, and a fluid-specific part called rhoFluidThermo. The rhoThermo interface has been added to the solidThermo model. This permits models and solvers that access the density to operate on both solid and fluid thermophysical models. --- .../compressibleVoFphase.C | 2 +- .../compressibleVoFphase.H | 12 +- .../pressureCorrector.C | 2 +- .../compressibleTwoPhaseVoFMixture.C | 4 +- .../compressibleTwoPhaseVoFMixture.H | 16 +- .../filmVoFTransfer/VoFFilmTransfer.H | 2 +- .../modules/isothermalFilm/isothermalFilm.C | 4 +- .../modules/isothermalFilm/isothermalFilm.H | 10 +- .../interfaceCompositionModel.C | 4 +- .../interfaceCompositionModel.H | 12 +- .../interfaceCompositionModelI.H | 10 +- .../HeatTransferPhaseSystem.C | 98 +++++------ .../TwoResistanceHeatTransferPhaseSystem.C | 10 +- ...allBoilingWallFunctionFvPatchScalarField.C | 2 +- .../wallBoiling/wallBoilingHeatTransfer.C | 6 +- .../ThermalPhaseChangePhaseSystem.C | 6 +- .../phaseInterface/phaseInterface.H | 4 +- .../phaseInterface/phaseInterfaceI.H | 4 +- .../MovingPhaseModel/MovingPhaseModel.H | 4 +- .../ThermoPhaseModel/ThermoPhaseModel.C | 4 +- .../ThermoPhaseModel/ThermoPhaseModel.H | 6 +- .../phaseModel/phaseModel/phaseModel.H | 6 +- .../phaseModel/phaseModel/phaseModels.C | 46 ++++- .../dynamicCode/fluidMulticomponentThermo | 2 +- etc/codeTemplates/dynamicCode/fluidThermo | 2 +- ...entThermo => rhoFluidMulticomponentThermo} | 0 ...=> rhoFluidMulticomponentThermoTemplate.C} | 0 .../dynamicCode/{rhoThermo => rhoFluidThermo} | 0 ...rmoTemplate.C => rhoFluidThermoTemplate.C} | 0 src/thermophysicalModels/basic/Make/files | 6 +- .../basic/liquidThermo/liquidThermo.H | 12 +- .../basic/liquidThermo/liquidThermos.C | 2 +- .../basic/psiThermo/psiThermo.C | 12 +- .../basic/psiThermo/psiThermo.H | 19 +- .../RhoFluidThermo.C} | 10 +- .../RhoFluidThermo.H} | 22 +-- .../basic/rhoFluidThermo/rhoFluidThermo.C | 73 ++++++++ .../basic/rhoFluidThermo/rhoFluidThermo.H | 163 ++++++++++++++++++ .../rhoFluidThermos.C} | 8 +- .../basic/rhoThermo/rhoThermo.C | 39 +---- .../basic/rhoThermo/rhoThermo.H | 96 +---------- .../multicomponentThermo/Make/files | 4 +- .../rhoFluidMulticomponentThermo.C} | 13 +- .../rhoFluidMulticomponentThermo.H} | 36 ++-- .../rhoFluidMulticomponentThermos.C} | 28 +-- .../solidThermo/solidThermo/solidThermo.C | 36 ---- .../solidThermo/solidThermo/solidThermo.H | 32 +--- .../compressibleCavitation/Saito/Saito.C | 5 +- .../compressibleCavitation/Saito/Saito.H | 2 +- .../cavitationModel/cavitationModel.H | 6 +- .../compressibleTwoPhases.H | 10 +- .../system/continuity | 20 +-- .../waterEvaporation/system/continuity | 20 +-- .../waterEvaporation/system/continuity | 20 +-- 54 files changed, 528 insertions(+), 444 deletions(-) rename etc/codeTemplates/dynamicCode/{rhoMulticomponentThermo => rhoFluidMulticomponentThermo} (100%) rename etc/codeTemplates/dynamicCode/{rhoMulticomponentThermoTemplate.C => rhoFluidMulticomponentThermoTemplate.C} (100%) rename etc/codeTemplates/dynamicCode/{rhoThermo => rhoFluidThermo} (100%) rename etc/codeTemplates/dynamicCode/{rhoThermoTemplate.C => rhoFluidThermoTemplate.C} (100%) rename src/thermophysicalModels/basic/{rhoThermo/RhoThermo.C => rhoFluidThermo/RhoFluidThermo.C} (96%) rename src/thermophysicalModels/basic/{rhoThermo/RhoThermo.H => rhoFluidThermo/RhoFluidThermo.H} (84%) create mode 100644 src/thermophysicalModels/basic/rhoFluidThermo/rhoFluidThermo.C create mode 100644 src/thermophysicalModels/basic/rhoFluidThermo/rhoFluidThermo.H rename src/thermophysicalModels/basic/{rhoThermo/rhoThermos.C => rhoFluidThermo/rhoFluidThermos.C} (87%) rename src/thermophysicalModels/multicomponentThermo/{rhoMulticomponentThermo/rhoMulticomponentThermo.C => rhoFluidMulticomponentThermo/rhoFluidMulticomponentThermo.C} (79%) rename src/thermophysicalModels/multicomponentThermo/{rhoMulticomponentThermo/rhoMulticomponentThermo.H => rhoFluidMulticomponentThermo/rhoFluidMulticomponentThermo.H} (84%) rename src/thermophysicalModels/multicomponentThermo/{rhoMulticomponentThermo/rhoMulticomponentThermos.C => rhoFluidMulticomponentThermo/rhoFluidMulticomponentThermos.C} (84%) diff --git a/applications/modules/compressibleMultiphaseVoF/compressibleMultiphaseVoFMixture/compressibleVoFphase/compressibleVoFphase.C b/applications/modules/compressibleMultiphaseVoF/compressibleMultiphaseVoFMixture/compressibleVoFphase/compressibleVoFphase.C index 0d3cf2721b..87b34de719 100644 --- a/applications/modules/compressibleMultiphaseVoF/compressibleMultiphaseVoFMixture/compressibleVoFphase/compressibleVoFphase.C +++ b/applications/modules/compressibleMultiphaseVoF/compressibleMultiphaseVoFMixture/compressibleVoFphase/compressibleVoFphase.C @@ -66,7 +66,7 @@ Foam::compressibleVoFphase::compressibleVoFphase Tp.write(); } - thermo_ = rhoThermo::New(mesh, name); + thermo_ = rhoFluidThermo::New(mesh, name); thermo_->validate(name, "e"); } diff --git a/applications/modules/compressibleMultiphaseVoF/compressibleMultiphaseVoFMixture/compressibleVoFphase/compressibleVoFphase.H b/applications/modules/compressibleMultiphaseVoF/compressibleMultiphaseVoFMixture/compressibleVoFphase/compressibleVoFphase.H index bbc8fe982f..bcf22b5aa9 100644 --- a/applications/modules/compressibleMultiphaseVoF/compressibleMultiphaseVoFMixture/compressibleVoFphase/compressibleVoFphase.H +++ b/applications/modules/compressibleMultiphaseVoF/compressibleMultiphaseVoFMixture/compressibleVoFphase/compressibleVoFphase.H @@ -43,7 +43,7 @@ See also #define compressibleVoFphase_H #include "VoFphase.H" -#include "rhoThermo.H" +#include "rhoFluidThermo.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -61,7 +61,7 @@ class compressibleVoFphase // Private Data //- Phase thermo - autoPtr thermo_; + autoPtr thermo_; //- Phase mass-fraction volScalarField Alpha_; @@ -115,14 +115,14 @@ public: // Member Functions - //- Return const-access to phase rhoThermo - const rhoThermo& thermo() const + //- Return const-access to phase rhoFluidThermo + const rhoFluidThermo& thermo() const { return thermo_(); } - //- Return access to phase rhoThermo - rhoThermo& thermo() + //- Return access to phase rhoFluidThermo + rhoFluidThermo& thermo() { return thermo_(); } diff --git a/applications/modules/compressibleMultiphaseVoF/pressureCorrector.C b/applications/modules/compressibleMultiphaseVoF/pressureCorrector.C index 5cbaccba86..1247a8815c 100644 --- a/applications/modules/compressibleMultiphaseVoF/pressureCorrector.C +++ b/applications/modules/compressibleMultiphaseVoF/pressureCorrector.C @@ -79,7 +79,7 @@ void Foam::solvers::compressibleMultiphaseVoF::pressureCorrector() forAll(phases, phasei) { const compressibleVoFphase& phase = phases[phasei]; - const rhoThermo& thermo = phase.thermo(); + const rhoFluidThermo& thermo = phase.thermo(); const volScalarField& rho = phases[phasei].thermo().rho(); p_rghEqnComps.set diff --git a/applications/modules/compressibleVoF/compressibleTwoPhaseVoFMixture/compressibleTwoPhaseVoFMixture.C b/applications/modules/compressibleVoF/compressibleTwoPhaseVoFMixture/compressibleTwoPhaseVoFMixture.C index 2b0198bddc..1b01d29094 100644 --- a/applications/modules/compressibleVoF/compressibleTwoPhaseVoFMixture/compressibleTwoPhaseVoFMixture.C +++ b/applications/modules/compressibleVoF/compressibleTwoPhaseVoFMixture/compressibleTwoPhaseVoFMixture.C @@ -143,8 +143,8 @@ Foam::compressibleTwoPhaseVoFMixture::compressibleTwoPhaseVoFMixture // Avoid any thread-writing problems. // fileHandler().flush(); - thermo1_ = rhoThermo::New(mesh, phase1Name()); - thermo2_ = rhoThermo::New(mesh, phase2Name()); + thermo1_ = rhoFluidThermo::New(mesh, phase1Name()); + thermo2_ = rhoFluidThermo::New(mesh, phase2Name()); // thermo1_->validate(phase1Name(), "e"); // thermo2_->validate(phase2Name(), "e"); diff --git a/applications/modules/compressibleVoF/compressibleTwoPhaseVoFMixture/compressibleTwoPhaseVoFMixture.H b/applications/modules/compressibleVoF/compressibleTwoPhaseVoFMixture/compressibleTwoPhaseVoFMixture.H index 84078cd0a0..2a3775a2e3 100644 --- a/applications/modules/compressibleVoF/compressibleTwoPhaseVoFMixture/compressibleTwoPhaseVoFMixture.H +++ b/applications/modules/compressibleVoF/compressibleTwoPhaseVoFMixture/compressibleTwoPhaseVoFMixture.H @@ -25,7 +25,7 @@ Class Foam::compressibleTwoPhaseVoFMixture Description - Class to represent a mixture of two rhoThermo-based phases + Class to represent a mixture of two rhoFluidThermo-based phases SourceFiles compressibleTwoPhaseVoFMixture.C @@ -37,7 +37,7 @@ SourceFiles #include "twoPhaseVoFMixture.H" #include "compressibleTwoPhases.H" -#include "rhoThermo.H" +#include "rhoFluidThermo.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -67,10 +67,10 @@ class compressibleTwoPhaseVoFMixture volScalarField T_; //- Thermo-package of phase 1 - autoPtr thermo1_; + autoPtr thermo1_; //- Thermo-package of phase 2 - autoPtr thermo2_; + autoPtr thermo2_; //- Mixture density volScalarField rho_; @@ -126,25 +126,25 @@ public: } //- Return the thermo for phase 1 - const rhoThermo& thermo1() const + const rhoFluidThermo& thermo1() const { return thermo1_(); } //- Return the thermo for phase 2 - const rhoThermo& thermo2() const + const rhoFluidThermo& thermo2() const { return thermo2_(); } //- Return the thermo for phase 1 - rhoThermo& thermo1() + rhoFluidThermo& thermo1() { return thermo1_(); } //- Return the thermo for phase 2 - rhoThermo& thermo2() + rhoFluidThermo& thermo2() { return thermo2_(); } diff --git a/applications/modules/isothermalFilm/fvModels/filmVoFTransfer/VoFFilmTransfer.H b/applications/modules/isothermalFilm/fvModels/filmVoFTransfer/VoFFilmTransfer.H index 2d32385f23..d985161881 100644 --- a/applications/modules/isothermalFilm/fvModels/filmVoFTransfer/VoFFilmTransfer.H +++ b/applications/modules/isothermalFilm/fvModels/filmVoFTransfer/VoFFilmTransfer.H @@ -86,7 +86,7 @@ class VoFFilmTransfer word phaseName_; //- Reference to the transferred phase thermo - const rhoThermo& thermo_; + const rhoFluidThermo& thermo_; //- Reference to the transferred phase volume fraction const volScalarField& alpha_; diff --git a/applications/modules/isothermalFilm/isothermalFilm.C b/applications/modules/isothermalFilm/isothermalFilm.C index 03773fd0ae..27ad68ef0b 100644 --- a/applications/modules/isothermalFilm/isothermalFilm.C +++ b/applications/modules/isothermalFilm/isothermalFilm.C @@ -241,7 +241,7 @@ Foam::wordList Foam::solvers::isothermalFilm::alphaTypes() const Foam::solvers::isothermalFilm::isothermalFilm ( fvMesh& mesh, - autoPtr thermoPtr + autoPtr thermoPtr ) : solver(mesh), @@ -411,7 +411,7 @@ Foam::solvers::isothermalFilm::isothermalFilm Foam::solvers::isothermalFilm::isothermalFilm(fvMesh& mesh) : - isothermalFilm(mesh, rhoThermo::New(mesh)) + isothermalFilm(mesh, rhoFluidThermo::New(mesh)) {} diff --git a/applications/modules/isothermalFilm/isothermalFilm.H b/applications/modules/isothermalFilm/isothermalFilm.H index 30720e96d9..a79d9c24ea 100644 --- a/applications/modules/isothermalFilm/isothermalFilm.H +++ b/applications/modules/isothermalFilm/isothermalFilm.H @@ -46,7 +46,7 @@ See also #define isothermalFilm_H #include "solver.H" -#include "rhoThermo.H" +#include "rhoFluidThermo.H" #include "filmCompressibleMomentumTransportModel.H" #include "uniformDimensionedFields.H" @@ -93,10 +93,10 @@ protected: // Thermophysical properties //- Pointer to the fluid thermophysical properties - autoPtr thermoPtr_; + autoPtr thermoPtr_; //- Reference to the fluid thermophysical properties - rhoThermo& thermo_; + rhoFluidThermo& thermo_; //- The thermodynamic pressure field volScalarField& p; @@ -270,7 +270,7 @@ public: const volScalarField& alpha; //- Reference to the fluid thermophysical properties - const rhoThermo& thermo; + const rhoFluidThermo& thermo; //- Reference to the thermodynamic density field const volScalarField& rho; @@ -302,7 +302,7 @@ public: // Constructors //- Construct from region mesh and thermophysical properties - isothermalFilm(fvMesh& mesh, autoPtr); + isothermalFilm(fvMesh& mesh, autoPtr); //- Construct from region mesh isothermalFilm(fvMesh& mesh); diff --git a/applications/modules/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/interfaceCompositionModel/interfaceCompositionModel.C b/applications/modules/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/interfaceCompositionModel/interfaceCompositionModel.C index d35df1cdc6..bc7f86b9b5 100644 --- a/applications/modules/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/interfaceCompositionModel/interfaceCompositionModel.C +++ b/applications/modules/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/interfaceCompositionModel/interfaceCompositionModel.C @@ -26,7 +26,7 @@ License #include "interfaceCompositionModel.H" #include "phaseModel.H" #include "phaseSystem.H" -#include "rhoMulticomponentThermo.H" +#include "rhoFluidMulticomponentThermo.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -54,7 +54,7 @@ Foam::interfaceCompositionModel::interfaceCompositionModel Le_("Le", dimless, dict), thermo_ ( - refCast(interface_.phase().thermo()) + refCast(interface_.phase().thermo()) ), otherThermo_(interface_.otherPhase().thermo()) {} diff --git a/applications/modules/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/interfaceCompositionModel/interfaceCompositionModel.H b/applications/modules/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/interfaceCompositionModel/interfaceCompositionModel.H index c0e53f757e..656981c476 100644 --- a/applications/modules/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/interfaceCompositionModel/interfaceCompositionModel.H +++ b/applications/modules/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/interfaceCompositionModel/interfaceCompositionModel.H @@ -42,7 +42,7 @@ SourceFiles #include "volFields.H" #include "dictionary.H" #include "hashedWordList.H" -#include "rhoMulticomponentThermo.H" +#include "rhoFluidMulticomponentThermo.H" #include "runTimeSelectionTables.H" #include "sidedPhaseInterface.H" #include "SidedInterfacialModel.H" @@ -68,10 +68,10 @@ class interfaceCompositionModel const dimensionedScalar Le_; //- Multi-component thermo model for this side of the interface - const rhoMulticomponentThermo& thermo_; + const rhoFluidMulticomponentThermo& thermo_; //- General thermo model for the other side of the interface - const rhoThermo& otherThermo_; + const rhoFluidThermo& otherThermo_; public: @@ -130,13 +130,13 @@ public: inline const hashedWordList& species() const; //- Return the thermo - inline const rhoMulticomponentThermo& thermo() const; + inline const rhoFluidMulticomponentThermo& thermo() const; //- Return the other thermo - inline const rhoThermo& otherThermo() const; + inline const rhoFluidThermo& otherThermo() const; //- Return the other multicomponent thermo - inline const rhoMulticomponentThermo& + inline const rhoFluidMulticomponentThermo& otherMulticomponentThermo() const; diff --git a/applications/modules/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/interfaceCompositionModel/interfaceCompositionModelI.H b/applications/modules/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/interfaceCompositionModel/interfaceCompositionModelI.H index c329d1dabe..03fd9995e7 100644 --- a/applications/modules/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/interfaceCompositionModel/interfaceCompositionModelI.H +++ b/applications/modules/multiphaseEuler/interfacialCompositionModels/interfaceCompositionModels/interfaceCompositionModel/interfaceCompositionModelI.H @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "interfaceCompositionModel.H" -#include "rhoMulticomponentThermo.H" +#include "rhoFluidMulticomponentThermo.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -41,23 +41,23 @@ const Foam::hashedWordList& Foam::interfaceCompositionModel::species() const } -const Foam::rhoMulticomponentThermo& +const Foam::rhoFluidMulticomponentThermo& Foam::interfaceCompositionModel::thermo() const { return thermo_; } -const Foam::rhoThermo& Foam::interfaceCompositionModel::otherThermo() const +const Foam::rhoFluidThermo& Foam::interfaceCompositionModel::otherThermo() const { return otherThermo_; } -const Foam::rhoMulticomponentThermo& +const Foam::rhoFluidMulticomponentThermo& Foam::interfaceCompositionModel::otherMulticomponentThermo() const { - return refCast(otherThermo_); + return refCast(otherThermo_); } diff --git a/applications/modules/multiphaseEuler/multiphaseThermophysicalTransportModels/HeatTransferPhaseSystem/HeatTransferPhaseSystem.C b/applications/modules/multiphaseEuler/multiphaseThermophysicalTransportModels/HeatTransferPhaseSystem/HeatTransferPhaseSystem.C index 45b00fa966..bcfc43b62d 100644 --- a/applications/modules/multiphaseEuler/multiphaseThermophysicalTransportModels/HeatTransferPhaseSystem/HeatTransferPhaseSystem.C +++ b/applications/modules/multiphaseEuler/multiphaseThermophysicalTransportModels/HeatTransferPhaseSystem/HeatTransferPhaseSystem.C @@ -25,7 +25,7 @@ License #include "HeatTransferPhaseSystem.H" #include "fvmSup.H" -#include "rhoMulticomponentThermo.H" +#include "rhoFluidMulticomponentThermo.H" // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // @@ -47,8 +47,8 @@ void Foam::HeatTransferPhaseSystem::addDmdtHefs const phaseModel& phase1 = interface.phase1(); const phaseModel& phase2 = interface.phase2(); - const rhoThermo& thermo1 = phase1.thermo(); - const rhoThermo& thermo2 = phase2.thermo(); + const rhoFluidThermo& thermo1 = phase1.thermo(); + const rhoFluidThermo& thermo2 = phase2.thermo(); const volScalarField& he1 = thermo1.he(); const volScalarField& he2 = thermo2.he(); const volScalarField hs1(thermo1.hs()); @@ -89,16 +89,16 @@ void Foam::HeatTransferPhaseSystem::addDmidtHefs const phaseModel& phase1 = interface.phase1(); const phaseModel& phase2 = interface.phase2(); - const rhoThermo& thermo1 = phase1.thermo(); - const rhoThermo& thermo2 = phase2.thermo(); - const rhoMulticomponentThermo* mcThermoPtr1 = - isA(thermo1) - ? &refCast(thermo1) - : static_cast(nullptr); - const rhoMulticomponentThermo* mcThermoPtr2 = - isA(thermo2) - ? &refCast(thermo2) - : static_cast(nullptr); + const rhoFluidThermo& thermo1 = phase1.thermo(); + const rhoFluidThermo& thermo2 = phase2.thermo(); + const rhoFluidMulticomponentThermo* mcThermoPtr1 = + isA(thermo1) + ? &refCast(thermo1) + : static_cast(nullptr); + const rhoFluidMulticomponentThermo* mcThermoPtr2 = + isA(thermo2) + ? &refCast(thermo2) + : static_cast(nullptr); const volScalarField& he1 = thermo1.he(); const volScalarField& he2 = thermo2.he(); const volScalarField hs1(thermo1.hs()); @@ -195,8 +195,8 @@ void Foam::HeatTransferPhaseSystem::addDmdtHefsWithoutL const phaseModel& phase1 = interface.phase1(); const phaseModel& phase2 = interface.phase2(); - const rhoThermo& thermo1 = phase1.thermo(); - const rhoThermo& thermo2 = phase2.thermo(); + const rhoFluidThermo& thermo1 = phase1.thermo(); + const rhoFluidThermo& thermo2 = phase2.thermo(); const volScalarField& he1 = thermo1.he(); const volScalarField& he2 = thermo2.he(); const volScalarField K1(phase1.K()); @@ -305,16 +305,16 @@ void Foam::HeatTransferPhaseSystem::addDmidtHefsWithoutL const phaseModel& phase1 = interface.phase1(); const phaseModel& phase2 = interface.phase2(); - const rhoThermo& thermo1 = phase1.thermo(); - const rhoThermo& thermo2 = phase2.thermo(); - const rhoMulticomponentThermo* mcThermoPtr1 = - isA(thermo1) - ? &refCast(thermo1) - : static_cast(nullptr); - const rhoMulticomponentThermo* mcThermoPtr2 = - isA(thermo2) - ? &refCast(thermo2) - : static_cast(nullptr); + const rhoFluidThermo& thermo1 = phase1.thermo(); + const rhoFluidThermo& thermo2 = phase2.thermo(); + const rhoFluidMulticomponentThermo* mcThermoPtr1 = + isA(thermo1) + ? &refCast(thermo1) + : static_cast(nullptr); + const rhoFluidMulticomponentThermo* mcThermoPtr2 = + isA(thermo2) + ? &refCast(thermo2) + : static_cast(nullptr); const volScalarField& he1 = thermo1.he(); const volScalarField& he2 = thermo2.he(); const volScalarField K1(phase1.K()); @@ -512,8 +512,8 @@ Foam::HeatTransferPhaseSystem::L const latentHeatScheme scheme ) const { - const rhoThermo& thermo1 = interface.phase1().thermo(); - const rhoThermo& thermo2 = interface.phase2().thermo(); + const rhoFluidThermo& thermo1 = interface.phase1().thermo(); + const rhoFluidThermo& thermo2 = interface.phase2().thermo(); // Interface enthalpies const volScalarField haf1(thermo1.ha(thermo1.p(), Tf)); @@ -552,8 +552,8 @@ Foam::HeatTransferPhaseSystem::L const latentHeatScheme scheme ) const { - const rhoThermo& thermo1 = interface.phase1().thermo(); - const rhoThermo& thermo2 = interface.phase2().thermo(); + const rhoFluidThermo& thermo1 = interface.phase1().thermo(); + const rhoFluidThermo& thermo2 = interface.phase2().thermo(); // Interface enthalpies const scalarField haf1(thermo1.ha(Tf, cells)); @@ -595,16 +595,16 @@ Foam::HeatTransferPhaseSystem::Li const latentHeatScheme scheme ) const { - const rhoThermo& thermo1 = interface.phase1().thermo(); - const rhoThermo& thermo2 = interface.phase2().thermo(); - const rhoMulticomponentThermo* mcThermoPtr1 = - isA(thermo1) - ? &refCast(thermo1) - : static_cast(nullptr); - const rhoMulticomponentThermo* mcThermoPtr2 = - isA(thermo2) - ? &refCast(thermo2) - : static_cast(nullptr); + const rhoFluidThermo& thermo1 = interface.phase1().thermo(); + const rhoFluidThermo& thermo2 = interface.phase2().thermo(); + const rhoFluidMulticomponentThermo* mcThermoPtr1 = + isA(thermo1) + ? &refCast(thermo1) + : static_cast(nullptr); + const rhoFluidMulticomponentThermo* mcThermoPtr2 = + isA(thermo2) + ? &refCast(thermo2) + : static_cast(nullptr); const label speciei1 = mcThermoPtr1 ? mcThermoPtr1->species()[specie] : -1; const label speciei2 = @@ -668,16 +668,16 @@ Foam::HeatTransferPhaseSystem::Li const latentHeatScheme scheme ) const { - const rhoThermo& thermo1 = interface.phase1().thermo(); - const rhoThermo& thermo2 = interface.phase2().thermo(); - const rhoMulticomponentThermo* mcThermoPtr1 = - isA(thermo1) - ? &refCast(thermo1) - : static_cast(nullptr); - const rhoMulticomponentThermo* mcThermoPtr2 = - isA(thermo2) - ? &refCast(thermo2) - : static_cast(nullptr); + const rhoFluidThermo& thermo1 = interface.phase1().thermo(); + const rhoFluidThermo& thermo2 = interface.phase2().thermo(); + const rhoFluidMulticomponentThermo* mcThermoPtr1 = + isA(thermo1) + ? &refCast(thermo1) + : static_cast(nullptr); + const rhoFluidMulticomponentThermo* mcThermoPtr2 = + isA(thermo2) + ? &refCast(thermo2) + : static_cast(nullptr); const label speciei1 = mcThermoPtr1 ? mcThermoPtr1->species()[specie] : -1; const label speciei2 = diff --git a/applications/modules/multiphaseEuler/multiphaseThermophysicalTransportModels/TwoResistanceHeatTransferPhaseSystem/TwoResistanceHeatTransferPhaseSystem.C b/applications/modules/multiphaseEuler/multiphaseThermophysicalTransportModels/TwoResistanceHeatTransferPhaseSystem/TwoResistanceHeatTransferPhaseSystem.C index 8a82551384..2856f34445 100644 --- a/applications/modules/multiphaseEuler/multiphaseThermophysicalTransportModels/TwoResistanceHeatTransferPhaseSystem/TwoResistanceHeatTransferPhaseSystem.C +++ b/applications/modules/multiphaseEuler/multiphaseThermophysicalTransportModels/TwoResistanceHeatTransferPhaseSystem/TwoResistanceHeatTransferPhaseSystem.C @@ -26,7 +26,7 @@ License #include "TwoResistanceHeatTransferPhaseSystem.H" #include "heatTransferModel.H" #include "fvmSup.H" -#include "rhoMulticomponentThermo.H" +#include "rhoFluidMulticomponentThermo.H" // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // @@ -59,8 +59,8 @@ void Foam::TwoResistanceHeatTransferPhaseSystem::addDmdtHefs const phaseModel& phase1 = interface.phase1(); const phaseModel& phase2 = interface.phase2(); - const rhoThermo& thermo1 = phase1.thermo(); - const rhoThermo& thermo2 = phase2.thermo(); + const rhoFluidThermo& thermo1 = phase1.thermo(); + const rhoFluidThermo& thermo2 = phase2.thermo(); // Transfer coefficients const sidedBlendedHeatTransferModel& heatTransferModel = @@ -124,8 +124,8 @@ void Foam::TwoResistanceHeatTransferPhaseSystem::addDmidtHefs const phaseModel& phase1 = interface.phase1(); const phaseModel& phase2 = interface.phase2(); - const rhoThermo& thermo1 = phase1.thermo(); - const rhoThermo& thermo2 = phase2.thermo(); + const rhoFluidThermo& thermo1 = phase1.thermo(); + const rhoFluidThermo& thermo2 = phase2.thermo(); // Transfer coefficients const sidedBlendedHeatTransferModel& heatTransferModel = diff --git a/applications/modules/multiphaseEuler/multiphaseThermophysicalTransportModels/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.C b/applications/modules/multiphaseEuler/multiphaseThermophysicalTransportModels/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.C index 772415ac98..bf1c034841 100644 --- a/applications/modules/multiphaseEuler/multiphaseThermophysicalTransportModels/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.C +++ b/applications/modules/multiphaseEuler/multiphaseThermophysicalTransportModels/derivedFvPatchFields/alphatWallBoilingWallFunction/alphatWallBoilingWallFunctionFvPatchScalarField.C @@ -31,7 +31,7 @@ License #include "compressibleMomentumTransportModel.H" #include "phaseCompressibleMomentumTransportModel.H" #include "interfaceSaturationTemperatureModel.H" -#include "rhoMulticomponentThermo.H" +#include "rhoFluidMulticomponentThermo.H" #include "fixedValueFvPatchFields.H" #include "zeroGradientFvPatchFields.H" diff --git a/applications/modules/multiphaseEuler/multiphaseThermophysicalTransportModels/heatTransferModels/wallBoiling/wallBoilingHeatTransfer.C b/applications/modules/multiphaseEuler/multiphaseThermophysicalTransportModels/heatTransferModels/wallBoiling/wallBoilingHeatTransfer.C index e8444c6755..5b670de314 100644 --- a/applications/modules/multiphaseEuler/multiphaseThermophysicalTransportModels/heatTransferModels/wallBoiling/wallBoilingHeatTransfer.C +++ b/applications/modules/multiphaseEuler/multiphaseThermophysicalTransportModels/heatTransferModels/wallBoiling/wallBoilingHeatTransfer.C @@ -237,9 +237,9 @@ Foam::heatTransferModels::wallBoilingHeatTransfer::K const phaseModel& vapour = fluid.phases()[vapourPhaseName_]; const phaseModel& solid = interface_.dispersed(); - const rhoThermo& lThermo = liquid.thermo(); - const rhoThermo& vThermo = vapour.thermo(); - const rhoThermo& sThermo = solid.thermo(); + const rhoFluidThermo& lThermo = liquid.thermo(); + const rhoFluidThermo& vThermo = vapour.thermo(); + const rhoFluidThermo& sThermo = solid.thermo(); // Estimate the surface temperature from the surrounding temperature and // heat transfer coefficients. Note that a lagged value of K is used in diff --git a/applications/modules/multiphaseEuler/phaseSystems/PhaseSystems/ThermalPhaseChangePhaseSystem/ThermalPhaseChangePhaseSystem.C b/applications/modules/multiphaseEuler/phaseSystems/PhaseSystems/ThermalPhaseChangePhaseSystem/ThermalPhaseChangePhaseSystem.C index 7669f74d89..6782e3b414 100644 --- a/applications/modules/multiphaseEuler/phaseSystems/PhaseSystems/ThermalPhaseChangePhaseSystem/ThermalPhaseChangePhaseSystem.C +++ b/applications/modules/multiphaseEuler/phaseSystems/PhaseSystems/ThermalPhaseChangePhaseSystem/ThermalPhaseChangePhaseSystem.C @@ -28,7 +28,7 @@ License #include "alphatPhaseChangeWallFunctionBase.H" #include "fvcVolumeIntegrate.H" #include "fvmSup.H" -#include "rhoMulticomponentThermo.H" +#include "rhoFluidMulticomponentThermo.H" #include "wallBoilingHeatTransfer.H" // * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * // @@ -562,8 +562,8 @@ Foam::ThermalPhaseChangePhaseSystem::correctInterfaceThermo() const phaseInterface& interface = saturationModelIter()->interface(); const phaseModel& phase1 = interface.phase1(); const phaseModel& phase2 = interface.phase2(); - const rhoThermo& thermo1 = phase1.thermo(); - const rhoThermo& thermo2 = phase2.thermo(); + const rhoFluidThermo& thermo1 = phase1.thermo(); + const rhoFluidThermo& thermo2 = phase2.thermo(); const volScalarField& T1(thermo1.T()); const volScalarField& T2(thermo2.T()); diff --git a/applications/modules/multiphaseEuler/phaseSystems/phaseInterface/phaseInterface/phaseInterface.H b/applications/modules/multiphaseEuler/phaseSystems/phaseInterface/phaseInterface/phaseInterface.H index e2ca9d6ae9..5ba4da35ec 100644 --- a/applications/modules/multiphaseEuler/phaseSystems/phaseInterface/phaseInterface/phaseInterface.H +++ b/applications/modules/multiphaseEuler/phaseSystems/phaseInterface/phaseInterface/phaseInterface.H @@ -300,10 +300,10 @@ public: virtual inline const volScalarField& alpha2() const; //- Return the thermo for phase 1 - virtual inline const rhoThermo& thermo1() const; + virtual inline const rhoFluidThermo& thermo1() const; //- Return the thermo for phase 2 - virtual inline const rhoThermo& thermo2() const; + virtual inline const rhoFluidThermo& thermo2() const; //- Return the density of phase 1 virtual inline const volScalarField& rho1() const; diff --git a/applications/modules/multiphaseEuler/phaseSystems/phaseInterface/phaseInterface/phaseInterfaceI.H b/applications/modules/multiphaseEuler/phaseSystems/phaseInterface/phaseInterface/phaseInterfaceI.H index 382c90452c..663bdffc5b 100644 --- a/applications/modules/multiphaseEuler/phaseSystems/phaseInterface/phaseInterface/phaseInterfaceI.H +++ b/applications/modules/multiphaseEuler/phaseSystems/phaseInterface/phaseInterface/phaseInterfaceI.H @@ -39,13 +39,13 @@ inline const Foam::volScalarField& Foam::phaseInterface::alpha2() const } -inline const Foam::rhoThermo& Foam::phaseInterface::thermo1() const +inline const Foam::rhoFluidThermo& Foam::phaseInterface::thermo1() const { return phase1().thermo(); } -inline const Foam::rhoThermo& Foam::phaseInterface::thermo2() const +inline const Foam::rhoFluidThermo& Foam::phaseInterface::thermo2() const { return phase2().thermo(); } diff --git a/applications/modules/multiphaseEuler/phaseSystems/phaseModel/MovingPhaseModel/MovingPhaseModel.H b/applications/modules/multiphaseEuler/phaseSystems/phaseModel/MovingPhaseModel/MovingPhaseModel.H index 80480c16e3..29431aceb6 100644 --- a/applications/modules/multiphaseEuler/phaseSystems/phaseModel/MovingPhaseModel/MovingPhaseModel.H +++ b/applications/modules/multiphaseEuler/phaseSystems/phaseModel/MovingPhaseModel/MovingPhaseModel.H @@ -62,13 +62,13 @@ template struct MovingPhaseModelTransportThermoModel; template<> -struct MovingPhaseModelTransportThermoModel +struct MovingPhaseModelTransportThermoModel { typedef fluidThermo type; }; template<> -struct MovingPhaseModelTransportThermoModel +struct MovingPhaseModelTransportThermoModel { typedef fluidMulticomponentThermo type; }; diff --git a/applications/modules/multiphaseEuler/phaseSystems/phaseModel/ThermoPhaseModel/ThermoPhaseModel.C b/applications/modules/multiphaseEuler/phaseSystems/phaseModel/ThermoPhaseModel/ThermoPhaseModel.C index ec6c346e3a..ea87eece78 100644 --- a/applications/modules/multiphaseEuler/phaseSystems/phaseModel/ThermoPhaseModel/ThermoPhaseModel.C +++ b/applications/modules/multiphaseEuler/phaseSystems/phaseModel/ThermoPhaseModel/ThermoPhaseModel.C @@ -74,7 +74,7 @@ bool Foam::ThermoPhaseModel::isochoric() const template -const Foam::rhoThermo& +const Foam::rhoFluidThermo& Foam::ThermoPhaseModel::thermo() const { return thermo_(); @@ -82,7 +82,7 @@ Foam::ThermoPhaseModel::thermo() const template -Foam::rhoThermo& +Foam::rhoFluidThermo& Foam::ThermoPhaseModel::thermo() { return thermo_(); diff --git a/applications/modules/multiphaseEuler/phaseSystems/phaseModel/ThermoPhaseModel/ThermoPhaseModel.H b/applications/modules/multiphaseEuler/phaseSystems/phaseModel/ThermoPhaseModel/ThermoPhaseModel.H index daae144e62..367e6a7b3c 100644 --- a/applications/modules/multiphaseEuler/phaseSystems/phaseModel/ThermoPhaseModel/ThermoPhaseModel.H +++ b/applications/modules/multiphaseEuler/phaseSystems/phaseModel/ThermoPhaseModel/ThermoPhaseModel.H @@ -46,7 +46,7 @@ SourceFiles namespace Foam { -class rhoThermo; +class rhoFluidThermo; /*---------------------------------------------------------------------------*\ Class ThermoPhaseModel Declaration @@ -97,10 +97,10 @@ public: virtual bool isochoric() const; //- Return the thermophysical model - virtual const rhoThermo& thermo() const; + virtual const rhoFluidThermo& thermo() const; //- Access the thermophysical model - virtual rhoThermo& thermo(); + virtual rhoFluidThermo& thermo(); //- Return the density field virtual const volScalarField& rho() const; diff --git a/applications/modules/multiphaseEuler/phaseSystems/phaseModel/phaseModel/phaseModel.H b/applications/modules/multiphaseEuler/phaseSystems/phaseModel/phaseModel/phaseModel.H index 8d1265a6fd..f42991ab34 100644 --- a/applications/modules/multiphaseEuler/phaseSystems/phaseModel/phaseModel/phaseModel.H +++ b/applications/modules/multiphaseEuler/phaseSystems/phaseModel/phaseModel/phaseModel.H @@ -37,7 +37,7 @@ SourceFiles #include "volFields.H" #include "surfaceFields.H" #include "fvMatricesFwd.H" -#include "rhoThermo.H" +#include "rhoFluidThermo.H" #include "runTimeSelectionTables.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -255,10 +255,10 @@ public: // Thermo //- Return the thermophysical model - virtual const rhoThermo& thermo() const = 0; + virtual const rhoFluidThermo& thermo() const = 0; //- Access the thermophysical model - virtual rhoThermo& thermo() = 0; + virtual rhoFluidThermo& thermo() = 0; //- Return the density field virtual const volScalarField& rho() const = 0; diff --git a/applications/modules/multiphaseEuler/phaseSystems/phaseModel/phaseModel/phaseModels.C b/applications/modules/multiphaseEuler/phaseSystems/phaseModel/phaseModel/phaseModels.C index 06f1a87b13..3e41fb4352 100644 --- a/applications/modules/multiphaseEuler/phaseSystems/phaseModel/phaseModel/phaseModels.C +++ b/applications/modules/multiphaseEuler/phaseSystems/phaseModel/phaseModel/phaseModels.C @@ -25,8 +25,8 @@ License #include "addToRunTimeSelectionTable.H" -#include "rhoThermo.H" -#include "rhoMulticomponentThermo.H" +#include "rhoFluidThermo.H" +#include "rhoFluidMulticomponentThermo.H" #include "combustionModel.H" @@ -54,7 +54,11 @@ namespace Foam < MovingPhaseModel < - ThermoPhaseModel + ThermoPhaseModel + < + phaseModel, + rhoFluidThermo + > > > > @@ -78,7 +82,11 @@ namespace Foam < StationaryPhaseModel < - ThermoPhaseModel + ThermoPhaseModel + < + phaseModel, + rhoFluidThermo + > > > > @@ -102,7 +110,11 @@ namespace Foam < MovingPhaseModel < - ThermoPhaseModel + ThermoPhaseModel + < + phaseModel, + rhoFluidThermo + > > > > @@ -126,7 +138,11 @@ namespace Foam < StationaryPhaseModel < - ThermoPhaseModel + ThermoPhaseModel + < + phaseModel, + rhoFluidThermo + > > > > @@ -150,7 +166,11 @@ namespace Foam < MovingPhaseModel < - ThermoPhaseModel + ThermoPhaseModel + < + phaseModel, + rhoFluidMulticomponentThermo + > > > > @@ -184,7 +204,11 @@ namespace Foam < MovingPhaseModel < - ThermoPhaseModel + ThermoPhaseModel + < + phaseModel, + rhoFluidMulticomponentThermo + > > > > @@ -208,7 +232,11 @@ namespace Foam < MovingPhaseModel < - ThermoPhaseModel + ThermoPhaseModel + < + phaseModel, + rhoFluidMulticomponentThermo + > > > > diff --git a/etc/codeTemplates/dynamicCode/fluidMulticomponentThermo b/etc/codeTemplates/dynamicCode/fluidMulticomponentThermo index 7c42883911..fdcacde026 100644 --- a/etc/codeTemplates/dynamicCode/fluidMulticomponentThermo +++ b/etc/codeTemplates/dynamicCode/fluidMulticomponentThermo @@ -22,7 +22,7 @@ type typeRenamed ( hePsiThermo psiMulticomponentThermo - heRhoThermo rhoMulticomponentThermo + heRhoThermo rhoFluidMulticomponentThermo ); energy diff --git a/etc/codeTemplates/dynamicCode/fluidThermo b/etc/codeTemplates/dynamicCode/fluidThermo index 1e364e0ba0..2aa506c1c2 100644 --- a/etc/codeTemplates/dynamicCode/fluidThermo +++ b/etc/codeTemplates/dynamicCode/fluidThermo @@ -22,7 +22,7 @@ type typeRenamed ( hePsiThermo psiThermo - heRhoThermo rhoThermo + heRhoThermo rhoFluidThermo ); energy diff --git a/etc/codeTemplates/dynamicCode/rhoMulticomponentThermo b/etc/codeTemplates/dynamicCode/rhoFluidMulticomponentThermo similarity index 100% rename from etc/codeTemplates/dynamicCode/rhoMulticomponentThermo rename to etc/codeTemplates/dynamicCode/rhoFluidMulticomponentThermo diff --git a/etc/codeTemplates/dynamicCode/rhoMulticomponentThermoTemplate.C b/etc/codeTemplates/dynamicCode/rhoFluidMulticomponentThermoTemplate.C similarity index 100% rename from etc/codeTemplates/dynamicCode/rhoMulticomponentThermoTemplate.C rename to etc/codeTemplates/dynamicCode/rhoFluidMulticomponentThermoTemplate.C diff --git a/etc/codeTemplates/dynamicCode/rhoThermo b/etc/codeTemplates/dynamicCode/rhoFluidThermo similarity index 100% rename from etc/codeTemplates/dynamicCode/rhoThermo rename to etc/codeTemplates/dynamicCode/rhoFluidThermo diff --git a/etc/codeTemplates/dynamicCode/rhoThermoTemplate.C b/etc/codeTemplates/dynamicCode/rhoFluidThermoTemplate.C similarity index 100% rename from etc/codeTemplates/dynamicCode/rhoThermoTemplate.C rename to etc/codeTemplates/dynamicCode/rhoFluidThermoTemplate.C diff --git a/src/thermophysicalModels/basic/Make/files b/src/thermophysicalModels/basic/Make/files index 9edb4bbfa7..f5edef8978 100644 --- a/src/thermophysicalModels/basic/Make/files +++ b/src/thermophysicalModels/basic/Make/files @@ -3,14 +3,16 @@ basicThermo/BasicThermoName.C pureThermo/pureThermo.C +rhoThermo/rhoThermo.C + fluidThermo/fluidThermo.C fluidThermo/hydrostaticInitialisation.C psiThermo/psiThermo.C psiThermo/psiThermos.C -rhoThermo/rhoThermo.C -rhoThermo/rhoThermos.C +rhoFluidThermo/rhoFluidThermo.C +rhoFluidThermo/rhoFluidThermos.C liquidThermo/liquidThermo.C liquidThermo/liquidThermos.C diff --git a/src/thermophysicalModels/basic/liquidThermo/liquidThermo.H b/src/thermophysicalModels/basic/liquidThermo/liquidThermo.H index 50bc067945..2227a8299d 100644 --- a/src/thermophysicalModels/basic/liquidThermo/liquidThermo.H +++ b/src/thermophysicalModels/basic/liquidThermo/liquidThermo.H @@ -39,7 +39,7 @@ SourceFiles #define liquidThermo_H #include "LiquidThermo.H" -#include "rhoThermo.H" +#include "rhoFluidThermo.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -52,7 +52,7 @@ namespace Foam class liquidThermo : - virtual public rhoThermo + virtual public rhoFluidThermo { public: @@ -67,7 +67,7 @@ public: //- The derived type template using DerivedThermoType = - LiquidThermo>>; + LiquidThermo>>; //- Runtime type information @@ -114,8 +114,8 @@ class liquidThermo::composite : public basicThermo::implementation, public pureThermo, - public fluidThermo::implementation, public rhoThermo::implementation, + public fluidThermo::implementation, public liquidThermo { public: @@ -133,8 +133,8 @@ public: ) : basicThermo::implementation(dict, mesh, phaseName), - fluidThermo::implementation(dict, mesh, phaseName), - rhoThermo::implementation(dict, mesh, phaseName) + rhoThermo::implementation(dict, mesh, phaseName), + fluidThermo::implementation(dict, mesh, phaseName) {} }; diff --git a/src/thermophysicalModels/basic/liquidThermo/liquidThermos.C b/src/thermophysicalModels/basic/liquidThermo/liquidThermos.C index ced93601f1..698b3d7765 100644 --- a/src/thermophysicalModels/basic/liquidThermo/liquidThermos.C +++ b/src/thermophysicalModels/basic/liquidThermo/liquidThermos.C @@ -42,7 +42,7 @@ License \ addThermo(basicThermo, liquidThermo, pureMixture, ThermoPhysics); \ addThermo(fluidThermo, liquidThermo, pureMixture, ThermoPhysics); \ - addThermo(rhoThermo, liquidThermo, pureMixture, ThermoPhysics); \ + addThermo(rhoFluidThermo, liquidThermo, pureMixture, ThermoPhysics); \ addThermo(liquidThermo, liquidThermo, pureMixture, ThermoPhysics) namespace Foam diff --git a/src/thermophysicalModels/basic/psiThermo/psiThermo.C b/src/thermophysicalModels/basic/psiThermo/psiThermo.C index e8c8ebdb69..b627380d02 100644 --- a/src/thermophysicalModels/basic/psiThermo/psiThermo.C +++ b/src/thermophysicalModels/basic/psiThermo/psiThermo.C @@ -75,6 +75,12 @@ void Foam::psiThermo::correctRho(const Foam::volScalarField& deltaRho) {} +Foam::tmp Foam::psiThermo::renameRho() +{ + return rho(); +} + + Foam::tmp Foam::psiThermo::implementation::rho() const { return p()*psi(); @@ -90,10 +96,4 @@ Foam::tmp Foam::psiThermo::implementation::rho } -Foam::tmp Foam::psiThermo::implementation::renameRho() -{ - return rho(); -} - - // ************************************************************************* // diff --git a/src/thermophysicalModels/basic/psiThermo/psiThermo.H b/src/thermophysicalModels/basic/psiThermo/psiThermo.H index 4c1c631367..9331bed254 100644 --- a/src/thermophysicalModels/basic/psiThermo/psiThermo.H +++ b/src/thermophysicalModels/basic/psiThermo/psiThermo.H @@ -39,8 +39,8 @@ SourceFiles #define psiThermo_H #include "PsiThermo.H" -#include "fluidThermo.H" #include "pureThermo.H" +#include "fluidThermo.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -110,11 +110,6 @@ public: // Fields derived from thermodynamic state variables - //- Add the given density correction to the density field. - // Used to update the density field following pressure solution. - // For psiThermo does nothing. - virtual void correctRho(const volScalarField& deltaRho); - //- Density [kg/m^3] - uses current value of pressure virtual tmp rho() const = 0; @@ -123,7 +118,12 @@ public: //- Return the thermodynamic density field [kg/m^3] // This is used by solvers which create a separate continuity rho - virtual tmp renameRho() = 0; + virtual tmp renameRho(); + + //- Add the given density correction to the density field. + // Used to update the density field following pressure solution. + // For psiThermo does nothing. + virtual void correctRho(const volScalarField& deltaRho); }; @@ -135,7 +135,6 @@ class psiThermo::implementation : virtual public psiThermo { - public: // Constructors @@ -161,10 +160,6 @@ public: //- Density for patch [kg/m^3] virtual tmp rho(const label patchi) const; - //- Return the thermodynamic density field [kg/m^3] - // This is used by solvers which create a separate continuity rho - virtual tmp renameRho(); - // Member Operators diff --git a/src/thermophysicalModels/basic/rhoThermo/RhoThermo.C b/src/thermophysicalModels/basic/rhoFluidThermo/RhoFluidThermo.C similarity index 96% rename from src/thermophysicalModels/basic/rhoThermo/RhoThermo.C rename to src/thermophysicalModels/basic/rhoFluidThermo/RhoFluidThermo.C index c569910bf6..4c5e7410b3 100644 --- a/src/thermophysicalModels/basic/rhoThermo/RhoThermo.C +++ b/src/thermophysicalModels/basic/rhoFluidThermo/RhoFluidThermo.C @@ -23,12 +23,12 @@ License \*---------------------------------------------------------------------------*/ -#include "RhoThermo.H" +#include "RhoFluidThermo.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // template -void Foam::RhoThermo::calculate() +void Foam::RhoFluidThermo::calculate() { const scalarField& hCells = this->he(); const scalarField& pCells = this->p_; @@ -163,7 +163,7 @@ void Foam::RhoThermo::calculate() // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template -Foam::RhoThermo::RhoThermo +Foam::RhoFluidThermo::RhoFluidThermo ( const fvMesh& mesh, const word& phaseName @@ -178,14 +178,14 @@ Foam::RhoThermo::RhoThermo // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // template -Foam::RhoThermo::~RhoThermo() +Foam::RhoFluidThermo::~RhoFluidThermo() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template -void Foam::RhoThermo::correct() +void Foam::RhoFluidThermo::correct() { if (BaseThermo::debug) { diff --git a/src/thermophysicalModels/basic/rhoThermo/RhoThermo.H b/src/thermophysicalModels/basic/rhoFluidThermo/RhoFluidThermo.H similarity index 84% rename from src/thermophysicalModels/basic/rhoThermo/RhoThermo.H rename to src/thermophysicalModels/basic/rhoFluidThermo/RhoFluidThermo.H index e82b57afcf..30b79175d5 100644 --- a/src/thermophysicalModels/basic/rhoThermo/RhoThermo.H +++ b/src/thermophysicalModels/basic/rhoFluidThermo/RhoFluidThermo.H @@ -22,18 +22,18 @@ License along with OpenFOAM. If not, see . Class - Foam::RhoThermo + Foam::RhoFluidThermo Description Thermo implementation based on density SourceFiles - RhoThermo.C + RhoFluidThermo.C \*---------------------------------------------------------------------------*/ -#ifndef RhoThermo_H -#define RhoThermo_H +#ifndef RhoFluidThermo_H +#define RhoFluidThermo_H #include "BasicThermo.H" @@ -43,11 +43,11 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class RhoThermo Declaration + Class RhoFluidThermo Declaration \*---------------------------------------------------------------------------*/ template -class RhoThermo +class RhoFluidThermo : public BaseThermo { @@ -62,14 +62,14 @@ public: // Constructors //- Construct from mesh and phase name - RhoThermo(const fvMesh&, const word& phaseName); + RhoFluidThermo(const fvMesh&, const word& phaseName); //- Disallow default bitwise copy construction - RhoThermo(const RhoThermo&) = delete; + RhoFluidThermo(const RhoFluidThermo&) = delete; //- Destructor - virtual ~RhoThermo(); + virtual ~RhoFluidThermo(); // Member Functions @@ -81,7 +81,7 @@ public: // Member Operators //- Disallow default bitwise assignment - void operator=(const RhoThermo&) = delete; + void operator=(const RhoFluidThermo&) = delete; }; @@ -92,7 +92,7 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #ifdef NoRepository - #include "RhoThermo.C" + #include "RhoFluidThermo.C" #endif // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/thermophysicalModels/basic/rhoFluidThermo/rhoFluidThermo.C b/src/thermophysicalModels/basic/rhoFluidThermo/rhoFluidThermo.C new file mode 100644 index 0000000000..63a5f15c55 --- /dev/null +++ b/src/thermophysicalModels/basic/rhoFluidThermo/rhoFluidThermo.C @@ -0,0 +1,73 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2023 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 "rhoFluidThermo.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(rhoFluidThermo, 0); + defineRunTimeSelectionTable(rhoFluidThermo, fvMesh); +} + +const Foam::word Foam::rhoFluidThermo::derivedThermoName("heRhoThermo"); + + +// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // + +Foam::autoPtr Foam::rhoFluidThermo::New +( + const fvMesh& mesh, + const word& phaseName +) +{ + return basicThermo::New(mesh, phaseName); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::rhoFluidThermo::~rhoFluidThermo() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::tmp +Foam::rhoFluidThermo::renameRho() +{ + rho().rename(phasePropertyName(Foam::typedName("rho"))); + return rho(); +} + + +void Foam::rhoFluidThermo::correctRho(const volScalarField& deltaRho) +{ + rho() += deltaRho; +} + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/basic/rhoFluidThermo/rhoFluidThermo.H b/src/thermophysicalModels/basic/rhoFluidThermo/rhoFluidThermo.H new file mode 100644 index 0000000000..37c2683ef5 --- /dev/null +++ b/src/thermophysicalModels/basic/rhoFluidThermo/rhoFluidThermo.H @@ -0,0 +1,163 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | Website: https://openfoam.org + \\ / A nd | Copyright (C) 2011-2023 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 . + +Class + Foam::rhoFluidThermo + +Description + Base-class for fluid thermodynamic properties based on density. + +See also + Foam::basicThermo + +SourceFiles + rhoFluidThermo.C + +\*---------------------------------------------------------------------------*/ + +#ifndef rhoFluidThermo_H +#define rhoFluidThermo_H + +#include "RhoFluidThermo.H" +#include "pureThermo.H" +#include "rhoThermo.H" +#include "fluidThermo.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class rhoFluidThermo Declaration +\*---------------------------------------------------------------------------*/ + +class rhoFluidThermo +: + virtual public rhoThermo, + virtual public fluidThermo +{ +public: + + // Public Classes + + //- Forward declare the composite class + class composite; + + + // Public Typedefs + + //- The derived type + template + using DerivedThermoType = + RhoFluidThermo>; + + //- The derived name + static const word derivedThermoName; + + + //- Runtime type information + TypeName("rhoFluidThermo"); + + + //- Declare run-time constructor selection table + declareRunTimeSelectionTable + ( + autoPtr, + rhoFluidThermo, + fvMesh, + (const fvMesh& mesh, const word& phaseName), + (mesh, phaseName) + ); + + + // Selectors + + //- Standard selection based on fvMesh + static autoPtr New + ( + const fvMesh&, + const word& phaseName=word::null + ); + + + //- Destructor + virtual ~rhoFluidThermo(); + + + // Member Functions + + // Fields derived from thermodynamic state variables + + //- Rename and return the thermodynamic density field [kg/m^3] + // This is used by solvers which create a separate continuity rho + virtual tmp renameRho(); + + //- Add the given density correction to the density field. + // Used to update the density field following pressure solution + virtual void correctRho(const volScalarField& deltaRho); +}; + + +/*---------------------------------------------------------------------------*\ + Class rhoFluidThermo::composite Declaration +\*---------------------------------------------------------------------------*/ + +class rhoFluidThermo::composite +: + public basicThermo::implementation, + public pureThermo, + public rhoThermo::implementation, + public fluidThermo::implementation, + public rhoFluidThermo +{ +public: + + // Constructors + + //- Construct from dictionary, mesh and phase name + template + composite + ( + const dictionary& dict, + const MixtureType& mixture, + const fvMesh& mesh, + const word& phaseName + ) + : + basicThermo::implementation(dict, mesh, phaseName), + rhoThermo::implementation(dict, mesh, phaseName), + fluidThermo::implementation(dict, mesh, phaseName) + {} +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/basic/rhoThermo/rhoThermos.C b/src/thermophysicalModels/basic/rhoFluidThermo/rhoFluidThermos.C similarity index 87% rename from src/thermophysicalModels/basic/rhoThermo/rhoThermos.C rename to src/thermophysicalModels/basic/rhoFluidThermo/rhoFluidThermos.C index 0f61bbcd76..2413d820f5 100644 --- a/src/thermophysicalModels/basic/rhoThermo/rhoThermos.C +++ b/src/thermophysicalModels/basic/rhoFluidThermo/rhoFluidThermos.C @@ -23,7 +23,7 @@ License \*---------------------------------------------------------------------------*/ -#include "rhoThermo.H" +#include "rhoFluidThermo.H" #include "pureMixture.H" @@ -37,9 +37,9 @@ License namespace Foam { - forGases(makeFluidThermo, rhoThermo, pureMixture); - forLiquids(makeFluidThermo, rhoThermo, pureMixture); - forTabulated(makeFluidThermo, rhoThermo, pureMixture); + forGases(makeFluidThermo, rhoFluidThermo, pureMixture); + forLiquids(makeFluidThermo, rhoFluidThermo, pureMixture); + forTabulated(makeFluidThermo, rhoFluidThermo, pureMixture); } // ************************************************************************* // diff --git a/src/thermophysicalModels/basic/rhoThermo/rhoThermo.C b/src/thermophysicalModels/basic/rhoThermo/rhoThermo.C index 087aacf294..2403b915ce 100644 --- a/src/thermophysicalModels/basic/rhoThermo/rhoThermo.C +++ b/src/thermophysicalModels/basic/rhoThermo/rhoThermo.C @@ -25,17 +25,6 @@ License #include "rhoThermo.H" -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -namespace Foam -{ - defineTypeNameAndDebug(rhoThermo, 0); - defineRunTimeSelectionTable(rhoThermo, fvMesh); -} - -const Foam::word Foam::rhoThermo::derivedThermoName("heRhoThermo"); - - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::rhoThermo::implementation::implementation @@ -61,18 +50,6 @@ Foam::rhoThermo::implementation::implementation {} -// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // - -Foam::autoPtr Foam::rhoThermo::New -( - const fvMesh& mesh, - const word& phaseName -) -{ - return basicThermo::New(mesh, phaseName); -} - - // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // Foam::rhoThermo::~rhoThermo() @@ -85,7 +62,8 @@ Foam::rhoThermo::implementation::~implementation() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -Foam::tmp Foam::rhoThermo::implementation::rho() const +Foam::tmp +Foam::rhoThermo::implementation::rho() const { return rho_; } @@ -100,23 +78,10 @@ Foam::tmp Foam::rhoThermo::implementation::rho } -Foam::tmp Foam::rhoThermo::implementation::renameRho() -{ - rho_.rename(phasePropertyName(Foam::typedName("rho"))); - return rho_; -} - - Foam::volScalarField& Foam::rhoThermo::implementation::rho() { return rho_; } -void Foam::rhoThermo::implementation::correctRho(const volScalarField& deltaRho) -{ - rho_ += deltaRho; -} - - // ************************************************************************* // diff --git a/src/thermophysicalModels/basic/rhoThermo/rhoThermo.H b/src/thermophysicalModels/basic/rhoThermo/rhoThermo.H index d7b6491f36..19daff8606 100644 --- a/src/thermophysicalModels/basic/rhoThermo/rhoThermo.H +++ b/src/thermophysicalModels/basic/rhoThermo/rhoThermo.H @@ -25,7 +25,7 @@ Class Foam::rhoThermo Description - Base-class for fluid thermodynamic properties based on density. + Base-class for thermodynamic properties based on density. See also Foam::basicThermo @@ -38,9 +38,7 @@ SourceFiles #ifndef rhoThermo_H #define rhoThermo_H -#include "RhoThermo.H" -#include "fluidThermo.H" -#include "pureThermo.H" +#include "basicThermo.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -53,7 +51,7 @@ namespace Foam class rhoThermo : - virtual public fluidThermo + virtual public basicThermo { public: @@ -62,45 +60,6 @@ public: //- Forward declare the implementation class class implementation; - //- Forward declare the composite class - class composite; - - - // Public Typedefs - - //- The derived type - template - using DerivedThermoType = - RhoThermo>; - - //- The derived name - static const word derivedThermoName; - - - //- Runtime type information - TypeName("rhoThermo"); - - - //- Declare run-time constructor selection table - declareRunTimeSelectionTable - ( - autoPtr, - rhoThermo, - fvMesh, - (const fvMesh& mesh, const word& phaseName), - (mesh, phaseName) - ); - - - // Selectors - - //- Standard selection based on fvMesh - static autoPtr New - ( - const fvMesh&, - const word& phaseName=word::null - ); - //- Destructor virtual ~rhoThermo(); @@ -116,16 +75,8 @@ public: //- Density for patch [kg/m^3] virtual tmp rho(const label patchi) const = 0; - //- Rename and return the thermodynamic density field [kg/m^3] - // This is used by solvers which create a separate continuity rho - virtual tmp renameRho() = 0; - //- Return non-const access to the local density field [kg/m^3] virtual volScalarField& rho() = 0; - - //- Add the given density correction to the density field. - // Used to update the density field following pressure solution - virtual void correctRho(const volScalarField& deltaRho) = 0; }; @@ -142,7 +93,6 @@ protected: // Protected data //- Density field [kg/m^3] - // Named 'rho' to avoid (potential) conflict with solver density volScalarField rho_; @@ -171,17 +121,9 @@ public: //- Density for patch [kg/m^3] virtual tmp rho(const label patchi) const; - //- Rename and return the thermodynamic density field [kg/m^3] - // This is used by solvers which create a separate continuity rho - virtual tmp renameRho(); - //- Return non-const access to the local density field [kg/m^3] virtual volScalarField& rho(); - //- Add the given density correction to the density field. - // Used to update the density field following pressure solution - virtual void correctRho(const volScalarField& deltaRho); - // Member Operators @@ -190,38 +132,6 @@ public: }; -/*---------------------------------------------------------------------------*\ - Class rhoThermo::composite Declaration -\*---------------------------------------------------------------------------*/ - -class rhoThermo::composite -: - public basicThermo::implementation, - public pureThermo, - public fluidThermo::implementation, - public rhoThermo::implementation -{ -public: - - // Constructors - - //- Construct from dictionary, mesh and phase name - template - composite - ( - const dictionary& dict, - const MixtureType& mixture, - const fvMesh& mesh, - const word& phaseName - ) - : - basicThermo::implementation(dict, mesh, phaseName), - fluidThermo::implementation(dict, mesh, phaseName), - rhoThermo::implementation(dict, mesh, phaseName) - {} -}; - - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/thermophysicalModels/multicomponentThermo/Make/files b/src/thermophysicalModels/multicomponentThermo/Make/files index 50c5b315b4..f636ada488 100644 --- a/src/thermophysicalModels/multicomponentThermo/Make/files +++ b/src/thermophysicalModels/multicomponentThermo/Make/files @@ -8,8 +8,8 @@ psiMulticomponentThermo/psiMulticomponentThermos.C psiuMulticomponentThermo/psiuMulticomponentThermo.C psiuMulticomponentThermo/psiuMulticomponentThermos.C -rhoMulticomponentThermo/rhoMulticomponentThermo.C -rhoMulticomponentThermo/rhoMulticomponentThermos.C +rhoFluidMulticomponentThermo/rhoFluidMulticomponentThermo.C +rhoFluidMulticomponentThermo/rhoFluidMulticomponentThermos.C derivedFvPatchFields/fixedUnburntEnthalpy/fixedUnburntEnthalpyFvPatchScalarField.C derivedFvPatchFields/gradientUnburntEnthalpy/gradientUnburntEnthalpyFvPatchScalarField.C diff --git a/src/thermophysicalModels/multicomponentThermo/rhoMulticomponentThermo/rhoMulticomponentThermo.C b/src/thermophysicalModels/multicomponentThermo/rhoFluidMulticomponentThermo/rhoFluidMulticomponentThermo.C similarity index 79% rename from src/thermophysicalModels/multicomponentThermo/rhoMulticomponentThermo/rhoMulticomponentThermo.C rename to src/thermophysicalModels/multicomponentThermo/rhoFluidMulticomponentThermo/rhoFluidMulticomponentThermo.C index 0eaa36d9f8..9f3ffaf027 100644 --- a/src/thermophysicalModels/multicomponentThermo/rhoMulticomponentThermo/rhoMulticomponentThermo.C +++ b/src/thermophysicalModels/multicomponentThermo/rhoFluidMulticomponentThermo/rhoFluidMulticomponentThermo.C @@ -23,32 +23,33 @@ License \*---------------------------------------------------------------------------*/ -#include "rhoMulticomponentThermo.H" +#include "rhoFluidMulticomponentThermo.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { - defineTypeNameAndDebug(rhoMulticomponentThermo, 0); - defineRunTimeSelectionTable(rhoMulticomponentThermo, fvMesh); + defineTypeNameAndDebug(rhoFluidMulticomponentThermo, 0); + defineRunTimeSelectionTable(rhoFluidMulticomponentThermo, fvMesh); } // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // -Foam::autoPtr Foam::rhoMulticomponentThermo::New +Foam::autoPtr +Foam::rhoFluidMulticomponentThermo::New ( const fvMesh& mesh, const word& phaseName ) { - return basicThermo::New(mesh, phaseName); + return basicThermo::New(mesh, phaseName); } // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // -Foam::rhoMulticomponentThermo::~rhoMulticomponentThermo() +Foam::rhoFluidMulticomponentThermo::~rhoFluidMulticomponentThermo() {} diff --git a/src/thermophysicalModels/multicomponentThermo/rhoMulticomponentThermo/rhoMulticomponentThermo.H b/src/thermophysicalModels/multicomponentThermo/rhoFluidMulticomponentThermo/rhoFluidMulticomponentThermo.H similarity index 84% rename from src/thermophysicalModels/multicomponentThermo/rhoMulticomponentThermo/rhoMulticomponentThermo.H rename to src/thermophysicalModels/multicomponentThermo/rhoFluidMulticomponentThermo/rhoFluidMulticomponentThermo.H index 7afa64f81b..9106a72dcb 100644 --- a/src/thermophysicalModels/multicomponentThermo/rhoMulticomponentThermo/rhoMulticomponentThermo.H +++ b/src/thermophysicalModels/multicomponentThermo/rhoFluidMulticomponentThermo/rhoFluidMulticomponentThermo.H @@ -22,7 +22,7 @@ License along with OpenFOAM. If not, see . Class - Foam::rhoMulticomponentThermo + Foam::rhoFluidMulticomponentThermo Description Base-class for multi-component fluid thermodynamic properties based on @@ -32,14 +32,14 @@ See also Foam::basicThermo SourceFiles - rhoMulticomponentThermo.C + rhoFluidMulticomponentThermo.C \*---------------------------------------------------------------------------*/ -#ifndef rhoMulticomponentThermo_H -#define rhoMulticomponentThermo_H +#ifndef rhoFluidMulticomponentThermo_H +#define rhoFluidMulticomponentThermo_H -#include "rhoThermo.H" +#include "rhoFluidThermo.H" #include "fluidMulticomponentThermo.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -48,12 +48,12 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class rhoMulticomponentThermo Declaration + Class rhoFluidMulticomponentThermo Declaration \*---------------------------------------------------------------------------*/ -class rhoMulticomponentThermo +class rhoFluidMulticomponentThermo : - virtual public rhoThermo, + virtual public rhoFluidThermo, virtual public fluidMulticomponentThermo { public: @@ -73,7 +73,7 @@ public: < MulticomponentThermo < - RhoThermo + RhoFluidThermo < BasicThermo > @@ -82,14 +82,14 @@ public: //- Runtime type information - TypeName("rhoMulticomponentThermo"); + TypeName("rhoFluidMulticomponentThermo"); //- Declare run-time constructor selection tables declareRunTimeSelectionTable ( autoPtr, - rhoMulticomponentThermo, + rhoFluidMulticomponentThermo, fvMesh, (const fvMesh& mesh, const word& phaseName), (mesh, phaseName) @@ -99,7 +99,7 @@ public: // Selectors //- Standard selection based on fvMesh - static autoPtr New + static autoPtr New ( const fvMesh&, const word& phaseName=word::null @@ -107,21 +107,21 @@ public: //- Destructor - virtual ~rhoMulticomponentThermo(); + virtual ~rhoFluidMulticomponentThermo(); }; /*---------------------------------------------------------------------------*\ - Class rhoMulticomponentThermo::composite Declaration + Class rhoFluidMulticomponentThermo::composite Declaration \*---------------------------------------------------------------------------*/ -class rhoMulticomponentThermo::composite +class rhoFluidMulticomponentThermo::composite : public basicThermo::implementation, - public fluidThermo::implementation, public rhoThermo::implementation, + public fluidThermo::implementation, public multicomponentThermo::implementation, - public rhoMulticomponentThermo + public rhoFluidMulticomponentThermo { public: @@ -138,8 +138,8 @@ public: ) : basicThermo::implementation(dict, mesh, phaseName), - fluidThermo::implementation(dict, mesh, phaseName), rhoThermo::implementation(dict, mesh, phaseName), + fluidThermo::implementation(dict, mesh, phaseName), multicomponentThermo::implementation ( dict, diff --git a/src/thermophysicalModels/multicomponentThermo/rhoMulticomponentThermo/rhoMulticomponentThermos.C b/src/thermophysicalModels/multicomponentThermo/rhoFluidMulticomponentThermo/rhoFluidMulticomponentThermos.C similarity index 84% rename from src/thermophysicalModels/multicomponentThermo/rhoMulticomponentThermo/rhoMulticomponentThermos.C rename to src/thermophysicalModels/multicomponentThermo/rhoFluidMulticomponentThermo/rhoFluidMulticomponentThermos.C index 62deb11d03..4337ff58f3 100644 --- a/src/thermophysicalModels/multicomponentThermo/rhoMulticomponentThermo/rhoMulticomponentThermos.C +++ b/src/thermophysicalModels/multicomponentThermo/rhoFluidMulticomponentThermo/rhoFluidMulticomponentThermos.C @@ -23,7 +23,7 @@ License \*---------------------------------------------------------------------------*/ -#include "rhoMulticomponentThermo.H" +#include "rhoFluidMulticomponentThermo.H" #include "coefficientMulticomponentMixture.H" #include "coefficientWilkeMulticomponentMixture.H" @@ -43,56 +43,56 @@ namespace Foam forCoeffGases ( makeFluidMulticomponentThermos, - rhoThermo, - rhoMulticomponentThermo, + rhoFluidThermo, + rhoFluidMulticomponentThermo, coefficientMulticomponentMixture ); forCoeffGases ( makeFluidMulticomponentThermos, - rhoThermo, - rhoMulticomponentThermo, + rhoFluidThermo, + rhoFluidMulticomponentThermo, coefficientWilkeMulticomponentMixture ); forGases ( makeFluidMulticomponentThermo, - rhoMulticomponentThermo, + rhoFluidMulticomponentThermo, singleComponentMixture ); forCoeffLiquids ( makeFluidMulticomponentThermos, - rhoThermo, - rhoMulticomponentThermo, + rhoFluidThermo, + rhoFluidMulticomponentThermo, coefficientMulticomponentMixture ); forLiquids ( makeFluidMulticomponentThermos, - rhoThermo, - rhoMulticomponentThermo, + rhoFluidThermo, + rhoFluidMulticomponentThermo, valueMulticomponentMixture ); forLiquids ( makeFluidMulticomponentThermo, - rhoMulticomponentThermo, + rhoFluidMulticomponentThermo, singleComponentMixture ); forTabulated ( makeFluidMulticomponentThermos, - rhoThermo, - rhoMulticomponentThermo, + rhoFluidThermo, + rhoFluidMulticomponentThermo, valueMulticomponentMixture ); forTabulated ( makeFluidMulticomponentThermo, - rhoMulticomponentThermo, + rhoFluidMulticomponentThermo, singleComponentMixture ); } diff --git a/src/thermophysicalModels/solidThermo/solidThermo/solidThermo.C b/src/thermophysicalModels/solidThermo/solidThermo/solidThermo.C index 0aa347aff0..c4d5e022c6 100644 --- a/src/thermophysicalModels/solidThermo/solidThermo/solidThermo.C +++ b/src/thermophysicalModels/solidThermo/solidThermo/solidThermo.C @@ -57,19 +57,6 @@ Foam::solidThermo::implementation::implementation IOobject::NO_WRITE ), dimensionedScalar(phasePropertyName("p", phaseName), dimPressure, NaN) - ), - rho_ - ( - IOobject - ( - phasePropertyName("rho", phaseName), - mesh.time().name(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - mesh, - dimDensity ) {} @@ -96,27 +83,4 @@ Foam::solidThermo::implementation::~implementation() {} -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -Foam::tmp Foam::solidThermo::implementation::rho() const -{ - return rho_; -} - - -Foam::tmp Foam::solidThermo::implementation::rho -( - const label patchi -) const -{ - return rho_.boundaryField()[patchi]; -} - - -Foam::volScalarField& Foam::solidThermo::implementation::rho() -{ - return rho_; -} - - // ************************************************************************* // diff --git a/src/thermophysicalModels/solidThermo/solidThermo/solidThermo.H b/src/thermophysicalModels/solidThermo/solidThermo/solidThermo.H index 919f02bfc3..0ff3bdf647 100644 --- a/src/thermophysicalModels/solidThermo/solidThermo/solidThermo.H +++ b/src/thermophysicalModels/solidThermo/solidThermo/solidThermo.H @@ -38,8 +38,9 @@ SourceFiles #ifndef solidThermo_H #define solidThermo_H -#include "pureThermo.H" #include "SolidThermo.H" +#include "pureThermo.H" +#include "rhoThermo.H" #include "uniformGeometricFields.H" #include "fvScalarMatrix.H" @@ -54,7 +55,8 @@ namespace Foam class solidThermo : - virtual public basicThermo + virtual public basicThermo, + virtual public rhoThermo { public: @@ -109,15 +111,6 @@ public: // Member Functions - //- Density [kg/m^3] - virtual tmp rho() const = 0; - - //- Density for patch [kg/m^3] - virtual tmp rho(const label patchi) const = 0; - - //- Return non-const access to the local density field [kg/m^3] - virtual volScalarField& rho() = 0; - //- Return true if thermal conductivity is isotropic virtual bool isotropic() const = 0; @@ -148,9 +141,6 @@ protected: // code will exit. uniformGeometricScalarField p_; - //- Density field [kg/m^3] - volScalarField rho_; - public: @@ -162,18 +152,6 @@ public: //- Destructor virtual ~implementation(); - - - // Member Functions - - //- Density [kg/m^3] - virtual tmp rho() const; - - //- Density for patch [kg/m^3] - virtual tmp rho(const label patchi) const; - - //- Return non-const access to the local density field [kg/m^3] - virtual volScalarField& rho(); }; @@ -185,6 +163,7 @@ class solidThermo::composite : public basicThermo::implementation, public pureThermo, + public rhoThermo::implementation, public solidThermo::implementation { public: @@ -200,6 +179,7 @@ public: ) : basicThermo::implementation(dict, mesh, phaseName), + rhoThermo::implementation(dict, mesh, phaseName), solidThermo::implementation(dict, mesh, phaseName) {} diff --git a/src/twoPhaseModels/compressibleCavitation/Saito/Saito.C b/src/twoPhaseModels/compressibleCavitation/Saito/Saito.C index ed5fc31ee0..1bd68e67ee 100644 --- a/src/twoPhaseModels/compressibleCavitation/Saito/Saito.C +++ b/src/twoPhaseModels/compressibleCavitation/Saito/Saito.C @@ -71,7 +71,10 @@ Foam::compressible::cavitationModels::Saito::Saito // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // Foam::tmp -Foam::compressible::cavitationModels::Saito::fT(const rhoThermo& thermo) const +Foam::compressible::cavitationModels::Saito::fT +( + const rhoFluidThermo& thermo +) const { return sqrt(2*pi*(RR/thermo.W()()())*thermo.T()()); } diff --git a/src/twoPhaseModels/compressibleCavitation/Saito/Saito.H b/src/twoPhaseModels/compressibleCavitation/Saito/Saito.H index 40219b82bf..d6f128bf4b 100644 --- a/src/twoPhaseModels/compressibleCavitation/Saito/Saito.H +++ b/src/twoPhaseModels/compressibleCavitation/Saito/Saito.H @@ -107,7 +107,7 @@ class Saito // Private Member functions //- Return the function of temperature - tmp fT(const rhoThermo& thermo) const; + tmp fT(const rhoFluidThermo& thermo) const; public: diff --git a/src/twoPhaseModels/compressibleCavitation/cavitationModel/cavitationModel.H b/src/twoPhaseModels/compressibleCavitation/cavitationModel/cavitationModel.H index d5f809d896..3ec8169c0f 100644 --- a/src/twoPhaseModels/compressibleCavitation/cavitationModel/cavitationModel.H +++ b/src/twoPhaseModels/compressibleCavitation/cavitationModel/cavitationModel.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2021-2022 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2021-2023 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -94,13 +94,13 @@ protected: } //- Return the liquid thermo - inline const rhoThermo& thermol() const + inline const rhoFluidThermo& thermol() const { return phases_.thermo(liquidIndex_); } //- Return the vapour thermo - inline const rhoThermo& thermov() const + inline const rhoFluidThermo& thermov() const { return phases_.thermo(!liquidIndex_); } diff --git a/src/twoPhaseModels/compressibleTwoPhases/compressibleTwoPhases.H b/src/twoPhaseModels/compressibleTwoPhases/compressibleTwoPhases.H index 0282530db1..c688537977 100644 --- a/src/twoPhaseModels/compressibleTwoPhases/compressibleTwoPhases.H +++ b/src/twoPhaseModels/compressibleTwoPhases/compressibleTwoPhases.H @@ -25,7 +25,7 @@ Class Foam::compressibleTwoPhaseMixture Description - Interface to two rhoThermo-based phases + Interface to two rhoFluidThermo-based phases SourceFiles compressibleTwoPhases.C @@ -36,7 +36,7 @@ SourceFiles #define compressibleTwoPhases_H #include "twoPhases.H" -#include "rhoThermo.H" +#include "rhoFluidThermo.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -72,13 +72,13 @@ public: // Member Functions //- Return the thermo for phase 1 - virtual const rhoThermo& thermo1() const = 0; + virtual const rhoFluidThermo& thermo1() const = 0; //- Return the thermo for phase 2 - virtual const rhoThermo& thermo2() const = 0; + virtual const rhoFluidThermo& thermo2() const = 0; //- Return the density of a given phase - inline const rhoThermo& thermo(const bool index) const + inline const rhoFluidThermo& thermo(const bool index) const { return index ? thermo2() : thermo1(); } diff --git a/test/multiphaseEuler/interfaceComposition/waterAndIsopropanolEvaporation/system/continuity b/test/multiphaseEuler/interfaceComposition/waterAndIsopropanolEvaporation/system/continuity index 41687f051b..89f647fd2d 100644 --- a/test/multiphaseEuler/interfaceComposition/waterAndIsopropanolEvaporation/system/continuity +++ b/test/multiphaseEuler/interfaceComposition/waterAndIsopropanolEvaporation/system/continuity @@ -23,11 +23,11 @@ codeOptions codeInclude #{ - #include "rhoThermo.H" + #include "rhoFluidThermo.H" namespace Foam { - tmp ea(const rhoThermo& thermo) + tmp ea(const rhoFluidThermo& thermo) { tmp tEa = thermo.he() + thermo.hc(); @@ -70,10 +70,10 @@ codeRead mesh().lookupObject("alpha.gas"); const volScalarField& alphaLiq = mesh().lookupObject("alpha.liquid"); - const rhoThermo& thermoGas = - mesh().lookupObject("physicalProperties.gas"); - const rhoThermo& thermoLiq = - mesh().lookupObject("physicalProperties.liquid"); + const rhoFluidThermo& thermoGas = + mesh().lookupObject("physicalProperties.gas"); + const rhoFluidThermo& thermoLiq = + mesh().lookupObject("physicalProperties.liquid"); *mass0Gas = alphaGas*thermoGas.rho(); *mass0Liq = alphaLiq*thermoLiq.rho(); @@ -124,10 +124,10 @@ codeExecute mesh().lookupObject("alpha.gas"); const volScalarField& alphaLiq = mesh().lookupObject("alpha.liquid"); - const rhoThermo& thermoGas = - mesh().lookupObject("physicalProperties.gas"); - const rhoThermo& thermoLiq = - mesh().lookupObject("physicalProperties.liquid"); + const rhoFluidThermo& thermoGas = + mesh().lookupObject("physicalProperties.gas"); + const rhoFluidThermo& thermoLiq = + mesh().lookupObject("physicalProperties.liquid"); dMassGas = alphaGas*thermoGas.rho() - mass0Gas; dMassLiq = alphaLiq*thermoLiq.rho() - mass0Liq; diff --git a/test/multiphaseEuler/interfaceComposition/waterEvaporation/system/continuity b/test/multiphaseEuler/interfaceComposition/waterEvaporation/system/continuity index 41687f051b..89f647fd2d 100644 --- a/test/multiphaseEuler/interfaceComposition/waterEvaporation/system/continuity +++ b/test/multiphaseEuler/interfaceComposition/waterEvaporation/system/continuity @@ -23,11 +23,11 @@ codeOptions codeInclude #{ - #include "rhoThermo.H" + #include "rhoFluidThermo.H" namespace Foam { - tmp ea(const rhoThermo& thermo) + tmp ea(const rhoFluidThermo& thermo) { tmp tEa = thermo.he() + thermo.hc(); @@ -70,10 +70,10 @@ codeRead mesh().lookupObject("alpha.gas"); const volScalarField& alphaLiq = mesh().lookupObject("alpha.liquid"); - const rhoThermo& thermoGas = - mesh().lookupObject("physicalProperties.gas"); - const rhoThermo& thermoLiq = - mesh().lookupObject("physicalProperties.liquid"); + const rhoFluidThermo& thermoGas = + mesh().lookupObject("physicalProperties.gas"); + const rhoFluidThermo& thermoLiq = + mesh().lookupObject("physicalProperties.liquid"); *mass0Gas = alphaGas*thermoGas.rho(); *mass0Liq = alphaLiq*thermoLiq.rho(); @@ -124,10 +124,10 @@ codeExecute mesh().lookupObject("alpha.gas"); const volScalarField& alphaLiq = mesh().lookupObject("alpha.liquid"); - const rhoThermo& thermoGas = - mesh().lookupObject("physicalProperties.gas"); - const rhoThermo& thermoLiq = - mesh().lookupObject("physicalProperties.liquid"); + const rhoFluidThermo& thermoGas = + mesh().lookupObject("physicalProperties.gas"); + const rhoFluidThermo& thermoLiq = + mesh().lookupObject("physicalProperties.liquid"); dMassGas = alphaGas*thermoGas.rho() - mass0Gas; dMassLiq = alphaLiq*thermoLiq.rho() - mass0Liq; diff --git a/test/multiphaseEuler/thermal/waterEvaporation/system/continuity b/test/multiphaseEuler/thermal/waterEvaporation/system/continuity index c02430165f..7c2dd583e9 100644 --- a/test/multiphaseEuler/thermal/waterEvaporation/system/continuity +++ b/test/multiphaseEuler/thermal/waterEvaporation/system/continuity @@ -23,11 +23,11 @@ codeOptions codeInclude #{ - #include "rhoThermo.H" + #include "rhoFluidThermo.H" namespace Foam { - tmp ea(const rhoThermo& thermo) + tmp ea(const rhoFluidThermo& thermo) { tmp tEa = thermo.he() + thermo.hc(); @@ -70,10 +70,10 @@ codeRead mesh().lookupObject("alpha.steam"); const volScalarField& alphaLiq = mesh().lookupObject("alpha.water"); - const rhoThermo& thermoGas = - mesh().lookupObject("physicalProperties.steam"); - const rhoThermo& thermoLiq = - mesh().lookupObject("physicalProperties.water"); + const rhoFluidThermo& thermoGas = + mesh().lookupObject("physicalProperties.steam"); + const rhoFluidThermo& thermoLiq = + mesh().lookupObject("physicalProperties.water"); *mass0Gas = alphaGas*thermoGas.rho(); *mass0Liq = alphaLiq*thermoLiq.rho(); @@ -124,10 +124,10 @@ codeExecute mesh().lookupObject("alpha.steam"); const volScalarField& alphaLiq = mesh().lookupObject("alpha.water"); - const rhoThermo& thermoGas = - mesh().lookupObject("physicalProperties.steam"); - const rhoThermo& thermoLiq = - mesh().lookupObject("physicalProperties.water"); + const rhoFluidThermo& thermoGas = + mesh().lookupObject("physicalProperties.steam"); + const rhoFluidThermo& thermoLiq = + mesh().lookupObject("physicalProperties.water"); dMassGas = alphaGas*thermoGas.rho() - mass0Gas; dMassLiq = alphaLiq*thermoLiq.rho() - mass0Liq;