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);
}
);
This commit is contained in:
@ -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
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@ -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<bool Index>
|
||||
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<wordList>(speciesKey<0>(), wordList())),
|
||||
species2_(dict.lookupOrDefault<wordList>(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<volScalarField> 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<volScalarField&>(phase1.Y(species1_[i]));
|
||||
result.set(species_[i], (- phase1*phase1.R(Y1) & Y1).ptr());
|
||||
}
|
||||
|
||||
volScalarField& Y =
|
||||
const_cast<volScalarField&>(reactingPhase_.Y(name));
|
||||
|
||||
result.set
|
||||
(
|
||||
species_[i],
|
||||
(sign_*reactingPhase_*reactingPhase_.R(Y) & Y).ptr()
|
||||
);
|
||||
forAll(species2_, i)
|
||||
{
|
||||
volScalarField& Y2 =
|
||||
const_cast<volScalarField&>(phase2.Y(species2_[i]));
|
||||
result.set(species_[i], (phase2*phase2.R(Y2) & Y2).ptr());
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
@ -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<bool Index>
|
||||
word speciesKey() const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -180,9 +180,7 @@ phaseTransfer
|
||||
particles_dispersedIn_vapour
|
||||
{
|
||||
type reactionDriven;
|
||||
reactingPhase vapour;
|
||||
targetPhase particles;
|
||||
species (TiO2);
|
||||
species.vapour (TiO2);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -192,9 +192,7 @@ phaseTransfer
|
||||
particles_dispersedIn_vapour
|
||||
{
|
||||
type reactionDriven;
|
||||
reactingPhase vapour;
|
||||
targetPhase particles;
|
||||
species (TiO2 TiO2_s);
|
||||
species.vapour (TiO2 TiO2_s);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user