Skip to content

Commit 2dd8277

Browse files
author
Will Bainbridge
committed
multiphaseEuler: phaseTransferModels::reactionDriven: Permit transfers in both directions
The syntax of this model has changed to permit transfers of species in either direction. A list of transferring species is now given for each phase, rather than identifying a single reacting phase. For example: phaseTransfer ( vapour_particles { type reactionDriven; // TiO2 and TiO2_s are created by reactions in the vapour // and are then transferred to the particles species.vapour (TiO2 TiO2_s); // H2O is created by reactions in the particles and is then // transferred to the vapour species.particles (H2O); } );
1 parent 0840ae5 commit 2dd8277

File tree

5 files changed

+62
-43
lines changed

5 files changed

+62
-43
lines changed

applications/modules/multiphaseEuler/interfacialModels/phaseTransferModels/phaseTransferModel/phaseTransferModel.C

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
========= |
33
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
44
\\ / O peration | Website: https://openfoam.org
5-
\\ / A nd | Copyright (C) 2018-2023 OpenFOAM Foundation
5+
\\ / A nd | Copyright (C) 2018-2024 OpenFOAM Foundation
66
\\/ M anipulation |
77
-------------------------------------------------------------------------------
88
License
@@ -123,7 +123,7 @@ Foam::blendedPhaseTransferModel::dmdtf() const
123123
&phaseTransferModel::dmdtf,
124124
"dmdtf",
125125
phaseTransferModel::dimDmdt,
126-
true
126+
false
127127
);
128128
}
129129

@@ -137,7 +137,7 @@ Foam::blendedPhaseTransferModel::d2mdtdpf() const
137137
&phaseTransferModel::d2mdtdpf,
138138
"d2mdtdpf",
139139
phaseTransferModel::dimD2mdtdp,
140-
true
140+
false
141141
);
142142
}
143143

@@ -157,7 +157,7 @@ Foam::blendedPhaseTransferModel::dmidtf() const
157157
&phaseTransferModel::dmidtf,
158158
"dmidtf",
159159
phaseTransferModel::dimDmdt,
160-
true
160+
false
161161
);
162162
}
163163

applications/modules/multiphaseEuler/interfacialModels/phaseTransferModels/reactionDriven/reactionDriven.C

Lines changed: 44 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
========= |
33
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
44
\\ / O peration | Website: https://openfoam.org
5-
\\ / A nd | Copyright (C) 2019-2023 OpenFOAM Foundation
5+
\\ / A nd | Copyright (C) 2019-2024 OpenFOAM Foundation
66
\\/ M anipulation |
77
-------------------------------------------------------------------------------
88
License
@@ -39,6 +39,20 @@ namespace phaseTransferModels
3939
}
4040

4141

42+
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
43+
44+
template<bool Index>
45+
Foam::word Foam::phaseTransferModels::reactionDriven::speciesKey() const
46+
{
47+
return
48+
IOobject::groupName
49+
(
50+
"species",
51+
(!Index ? interface_.phase1() : interface_.phase2()).name()
52+
);
53+
}
54+
55+
4256
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
4357

4458
Foam::phaseTransferModels::reactionDriven::reactionDriven
@@ -49,17 +63,22 @@ Foam::phaseTransferModels::reactionDriven::reactionDriven
4963
:
5064
phaseTransferModel(dict, interface),
5165
interface_(interface),
52-
reactingName_(dict.lookup("reactingPhase")),
53-
reactingPhase_
54-
(
55-
reactingName_ == interface_.phase1().name()
56-
? interface_.phase1()
57-
: interface_.phase2()
58-
),
59-
otherPhase_(interface.otherPhase(reactingPhase_)),
60-
sign_(reactingName_ == interface_.phase1().name() ? -1 : 1),
61-
species_(dict.lookup("species"))
62-
{}
66+
species1_(dict.lookupOrDefault<wordList>(speciesKey<0>(), wordList())),
67+
species2_(dict.lookupOrDefault<wordList>(speciesKey<1>(), wordList())),
68+
species_()
69+
{
70+
if (!dict.found(speciesKey<0>()) && !dict.found(speciesKey<1>()))
71+
{
72+
FatalIOErrorInFunction(dict)
73+
<< "No transferring species specified. Specify either "
74+
<< speciesKey<0>() << " or " << speciesKey<1>() << " or both."
75+
<< exit(FatalIOError);
76+
}
77+
78+
wordList species(species1_);
79+
species.append(species2_);
80+
species_.transfer(species);
81+
}
6382

6483

6584
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
@@ -82,18 +101,21 @@ Foam::phaseTransferModels::reactionDriven::dmidtf() const
82101
{
83102
HashPtrTable<volScalarField> result;
84103

85-
forAll(species_, i)
86-
{
87-
const word name = species_[i];
104+
const phaseModel& phase1 = interface_.phase1();
105+
const phaseModel& phase2 = interface_.phase2();
88106

89-
volScalarField& Y =
90-
const_cast<volScalarField&>(reactingPhase_.Y(name));
107+
forAll(species1_, i)
108+
{
109+
volScalarField& Y1 =
110+
const_cast<volScalarField&>(phase1.Y(species1_[i]));
111+
result.set(species_[i], (- phase1*phase1.R(Y1) & Y1).ptr());
112+
}
91113

92-
result.set
93-
(
94-
species_[i],
95-
(sign_*reactingPhase_*reactingPhase_.R(Y) & Y).ptr()
96-
);
114+
forAll(species2_, i)
115+
{
116+
volScalarField& Y2 =
117+
const_cast<volScalarField&>(phase2.Y(species2_[i]));
118+
result.set(species_[i], (phase2*phase2.R(Y2) & Y2).ptr());
97119
}
98120

99121
return result;

applications/modules/multiphaseEuler/interfacialModels/phaseTransferModels/reactionDriven/reactionDriven.H

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
========= |
33
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
44
\\ / O peration | Website: https://openfoam.org
5-
\\ / A nd | Copyright (C) 2019-2023 OpenFOAM Foundation
5+
\\ / A nd | Copyright (C) 2019-2024 OpenFOAM Foundation
66
\\/ M anipulation |
77
-------------------------------------------------------------------------------
88
License
@@ -60,20 +60,21 @@ private:
6060
//- Interface
6161
const phaseInterface interface_;
6262

63-
//- The name of the phase where the reactions occur
64-
const word reactingName_;
63+
//- List of species transferring out of phase 1
64+
const hashedWordList species1_;
6565

66-
//- Const reference to the reacting phase
67-
const phaseModel& reactingPhase_;
66+
//- List of species transferring out of phase 2
67+
const hashedWordList species2_;
6868

69-
//- Const reference to the other phase
70-
const phaseModel& otherPhase_;
69+
//- List of all transferring species
70+
hashedWordList species_;
7171

72-
//- Sign used to multiply the source terms
73-
const scalar sign_;
7472

75-
//- List of species changing phase
76-
const hashedWordList species_;
73+
// Private Member Functions
74+
75+
//- Keyword for the list of species
76+
template<bool Index>
77+
word speciesKey() const;
7778

7879

7980
public:

tutorials/multiphaseEuler/titaniaSynthesis/constant/phaseProperties

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,7 @@ phaseTransfer
180180
particles_dispersedIn_vapour
181181
{
182182
type reactionDriven;
183-
reactingPhase vapour;
184-
targetPhase particles;
185-
species (TiO2);
183+
species.vapour (TiO2);
186184
}
187185
}
188186

tutorials/multiphaseEuler/titaniaSynthesisSurface/constant/phaseProperties

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,9 +192,7 @@ phaseTransfer
192192
particles_dispersedIn_vapour
193193
{
194194
type reactionDriven;
195-
reactingPhase vapour;
196-
targetPhase particles;
197-
species (TiO2 TiO2_s);
195+
species.vapour (TiO2 TiO2_s);
198196
}
199197
}
200198

0 commit comments

Comments
 (0)