diff --git a/applications/modules/multiphaseEuler/interfacialModels/phaseTransferModels/phaseTransferModel/phaseTransferModel.C b/applications/modules/multiphaseEuler/interfacialModels/phaseTransferModels/phaseTransferModel/phaseTransferModel.C index b009320021..d4f31d9beb 100644 --- a/applications/modules/multiphaseEuler/interfacialModels/phaseTransferModels/phaseTransferModel/phaseTransferModel.C +++ b/applications/modules/multiphaseEuler/interfacialModels/phaseTransferModels/phaseTransferModel/phaseTransferModel.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2018-2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2018-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -123,7 +123,7 @@ Foam::blendedPhaseTransferModel::dmdtf() const &phaseTransferModel::dmdtf, "dmdtf", phaseTransferModel::dimDmdt, - true + false ); } @@ -137,7 +137,7 @@ Foam::blendedPhaseTransferModel::d2mdtdpf() const &phaseTransferModel::d2mdtdpf, "d2mdtdpf", phaseTransferModel::dimD2mdtdp, - true + false ); } @@ -157,7 +157,7 @@ Foam::blendedPhaseTransferModel::dmidtf() const &phaseTransferModel::dmidtf, "dmidtf", phaseTransferModel::dimDmdt, - true + false ); } diff --git a/applications/modules/multiphaseEuler/interfacialModels/phaseTransferModels/reactionDriven/reactionDriven.C b/applications/modules/multiphaseEuler/interfacialModels/phaseTransferModels/reactionDriven/reactionDriven.C index 1d0ceef5fc..137f2ab6d2 100644 --- a/applications/modules/multiphaseEuler/interfacialModels/phaseTransferModels/reactionDriven/reactionDriven.C +++ b/applications/modules/multiphaseEuler/interfacialModels/phaseTransferModels/reactionDriven/reactionDriven.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2019-2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2019-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -39,6 +39,20 @@ namespace phaseTransferModels } +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +template +Foam::word Foam::phaseTransferModels::reactionDriven::speciesKey() const +{ + return + IOobject::groupName + ( + "species", + (!Index ? interface_.phase1() : interface_.phase2()).name() + ); +} + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::phaseTransferModels::reactionDriven::reactionDriven @@ -49,17 +63,22 @@ Foam::phaseTransferModels::reactionDriven::reactionDriven : phaseTransferModel(dict, interface), interface_(interface), - reactingName_(dict.lookup("reactingPhase")), - reactingPhase_ - ( - reactingName_ == interface_.phase1().name() - ? interface_.phase1() - : interface_.phase2() - ), - otherPhase_(interface.otherPhase(reactingPhase_)), - sign_(reactingName_ == interface_.phase1().name() ? -1 : 1), - species_(dict.lookup("species")) -{} + species1_(dict.lookupOrDefault(speciesKey<0>(), wordList())), + species2_(dict.lookupOrDefault(speciesKey<1>(), wordList())), + species_() +{ + if (!dict.found(speciesKey<0>()) && !dict.found(speciesKey<1>())) + { + FatalIOErrorInFunction(dict) + << "No transferring species specified. Specify either " + << speciesKey<0>() << " or " << speciesKey<1>() << " or both." + << exit(FatalIOError); + } + + wordList species(species1_); + species.append(species2_); + species_.transfer(species); +} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // @@ -82,18 +101,21 @@ Foam::phaseTransferModels::reactionDriven::dmidtf() const { HashPtrTable result; - forAll(species_, i) + const phaseModel& phase1 = interface_.phase1(); + const phaseModel& phase2 = interface_.phase2(); + + forAll(species1_, i) { - const word name = species_[i]; + volScalarField& Y1 = + const_cast(phase1.Y(species1_[i])); + result.set(species_[i], (- phase1*phase1.R(Y1) & Y1).ptr()); + } - volScalarField& Y = - const_cast(reactingPhase_.Y(name)); - - result.set - ( - species_[i], - (sign_*reactingPhase_*reactingPhase_.R(Y) & Y).ptr() - ); + forAll(species2_, i) + { + volScalarField& Y2 = + const_cast(phase2.Y(species2_[i])); + result.set(species_[i], (phase2*phase2.R(Y2) & Y2).ptr()); } return result; diff --git a/applications/modules/multiphaseEuler/interfacialModels/phaseTransferModels/reactionDriven/reactionDriven.H b/applications/modules/multiphaseEuler/interfacialModels/phaseTransferModels/reactionDriven/reactionDriven.H index 21ca51b316..50bf02b48b 100644 --- a/applications/modules/multiphaseEuler/interfacialModels/phaseTransferModels/reactionDriven/reactionDriven.H +++ b/applications/modules/multiphaseEuler/interfacialModels/phaseTransferModels/reactionDriven/reactionDriven.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org - \\ / A nd | Copyright (C) 2019-2023 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2019-2024 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -60,20 +60,21 @@ private: //- Interface const phaseInterface interface_; - //- The name of the phase where the reactions occur - const word reactingName_; + //- List of species transferring out of phase 1 + const hashedWordList species1_; - //- Const reference to the reacting phase - const phaseModel& reactingPhase_; + //- List of species transferring out of phase 2 + const hashedWordList species2_; - //- Const reference to the other phase - const phaseModel& otherPhase_; + //- List of all transferring species + hashedWordList species_; - //- Sign used to multiply the source terms - const scalar sign_; - //- List of species changing phase - const hashedWordList species_; + // Private Member Functions + + //- Keyword for the list of species + template + word speciesKey() const; public: diff --git a/tutorials/multiphaseEuler/titaniaSynthesis/constant/phaseProperties b/tutorials/multiphaseEuler/titaniaSynthesis/constant/phaseProperties index c3ff9a9f5c..efaa4b071f 100644 --- a/tutorials/multiphaseEuler/titaniaSynthesis/constant/phaseProperties +++ b/tutorials/multiphaseEuler/titaniaSynthesis/constant/phaseProperties @@ -180,9 +180,7 @@ phaseTransfer particles_dispersedIn_vapour { type reactionDriven; - reactingPhase vapour; - targetPhase particles; - species (TiO2); + species.vapour (TiO2); } } diff --git a/tutorials/multiphaseEuler/titaniaSynthesisSurface/constant/phaseProperties b/tutorials/multiphaseEuler/titaniaSynthesisSurface/constant/phaseProperties index 1e6ccf64ea..2c7df0abf7 100644 --- a/tutorials/multiphaseEuler/titaniaSynthesisSurface/constant/phaseProperties +++ b/tutorials/multiphaseEuler/titaniaSynthesisSurface/constant/phaseProperties @@ -192,9 +192,7 @@ phaseTransfer particles_dispersedIn_vapour { type reactionDriven; - reactingPhase vapour; - targetPhase particles; - species (TiO2 TiO2_s); + species.vapour (TiO2 TiO2_s); } }