multiphaseEulerFoam/.../populationBalance: Added fvOption source terms
Patch contributed by Institute of Fluid Dynamics, Helmholtz-Zentrum Dresden - Rossendorf (HZDR)
This commit is contained in:
@ -77,7 +77,6 @@ $(driftModels)/phaseChange/phaseChange.C
|
||||
|
||||
nucleationModels = populationBalanceModel/nucleationModels
|
||||
$(nucleationModels)/nucleationModel/nucleationModel.C
|
||||
$(nucleationModels)/constantNucleation/constantNucleation.C
|
||||
$(nucleationModels)/reactionDriven/reactionDriven.C
|
||||
$(nucleationModels)/wallBoiling/wallBoiling.C
|
||||
|
||||
|
||||
@ -51,46 +51,19 @@ Foam::diameterModels::driftModels::constantDrift::constantDrift
|
||||
)
|
||||
:
|
||||
driftModel(popBal, dict),
|
||||
N_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"N",
|
||||
popBal.mesh().time().timeName(),
|
||||
popBal.mesh()
|
||||
),
|
||||
popBal.mesh(),
|
||||
dimensionedScalar(inv(dimVolume), Zero)
|
||||
)
|
||||
rate_("rate", dimVolume/dimTime, dict)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::diameterModels::driftModels::constantDrift::precompute()
|
||||
{
|
||||
N_ = Zero;
|
||||
|
||||
forAll(popBal_.sizeGroups(), i)
|
||||
{
|
||||
const sizeGroup& fi = popBal_.sizeGroups()[i];
|
||||
|
||||
N_ += fi*fi.phase()/fi.x();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::diameterModels::driftModels::constantDrift::addToDriftRate
|
||||
(
|
||||
volScalarField& driftRate,
|
||||
const label i
|
||||
)
|
||||
{
|
||||
const sizeGroup& fi = popBal_.sizeGroups()[i];
|
||||
phaseModel& phase = const_cast<phaseModel&>(fi.phase());
|
||||
volScalarField& rho = phase.thermoRef().rho();
|
||||
|
||||
driftRate += (popBal_.fluid().fvOptions()(phase, rho)&rho)/(N_*rho);
|
||||
driftRate += rate_;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -24,9 +24,6 @@ License
|
||||
Class
|
||||
Foam::diameterModels::driftModels::constantDrift
|
||||
|
||||
Description
|
||||
Constant drift rate within all classes computed from fvOptions mass source.
|
||||
|
||||
SourceFiles
|
||||
constant.C
|
||||
|
||||
@ -56,8 +53,8 @@ class constantDrift
|
||||
{
|
||||
// Private Data
|
||||
|
||||
//- Total number concentration
|
||||
volScalarField N_;
|
||||
//- Drift rate
|
||||
dimensionedScalar rate_;
|
||||
|
||||
|
||||
public:
|
||||
@ -81,9 +78,6 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Precompute diameter independent expressions
|
||||
virtual void precompute();
|
||||
|
||||
//- Add to driftRate
|
||||
virtual void addToDriftRate
|
||||
(
|
||||
|
||||
@ -1,113 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018-2020 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "constantNucleation.H"
|
||||
#include "phaseSystem.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "mathematicalConstants.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace diameterModels
|
||||
{
|
||||
namespace nucleationModels
|
||||
{
|
||||
defineTypeNameAndDebug(constantNucleation, 0);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
nucleationModel,
|
||||
constantNucleation,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
using Foam::constant::mathematical::pi;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::diameterModels::nucleationModels::constantNucleation::
|
||||
constantNucleation
|
||||
(
|
||||
const populationBalanceModel& popBal,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
nucleationModel(popBal, dict),
|
||||
dNuc_("nucleationDiameter", dimLength, dict),
|
||||
velGroup_
|
||||
(
|
||||
refCast<const velocityGroup>
|
||||
(
|
||||
popBal.mesh().lookupObject<phaseModel>
|
||||
(
|
||||
IOobject::groupName
|
||||
(
|
||||
"alpha",
|
||||
dict.lookup("velocityGroup")
|
||||
)
|
||||
).dPtr()()
|
||||
)
|
||||
)
|
||||
{
|
||||
if
|
||||
(
|
||||
dNuc_.value() < velGroup_.sizeGroups().first().dSph().value()
|
||||
|| dNuc_.value() > velGroup_.sizeGroups().last().dSph().value()
|
||||
)
|
||||
{
|
||||
FatalIOErrorInFunction(dict)
|
||||
<< "Nucleation diameter " << dNuc_.value() << "m outside of range ["
|
||||
<< velGroup_.sizeGroups().first().dSph().value() << ", "
|
||||
<< velGroup_.sizeGroups().last().dSph().value() << "]." << nl
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void
|
||||
Foam::diameterModels::nucleationModels::constantNucleation::addToNucleationRate
|
||||
(
|
||||
volScalarField& nucleationRate,
|
||||
const label i
|
||||
)
|
||||
{
|
||||
const sizeGroup& fi = popBal_.sizeGroups()[i];
|
||||
phaseModel& phase = const_cast<phaseModel&>(fi.phase());
|
||||
volScalarField& rho = phase.thermoRef().rho();
|
||||
|
||||
nucleationRate +=
|
||||
popBal_.eta(i, pi/6.0*pow3(dNuc_))
|
||||
*(popBal_.fluid().fvOptions()(phase, rho)&rho)/rho/fi.x();
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,107 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2018-2020 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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::diameterModels::nucleationModels::constantNucleation
|
||||
|
||||
Description
|
||||
Constant nucleation rate within all classes computed from fvOptions mass
|
||||
source.
|
||||
|
||||
SourceFiles
|
||||
constant.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef constantNucleation_H
|
||||
#define constantNucleation_H
|
||||
|
||||
#include "nucleationModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace diameterModels
|
||||
{
|
||||
namespace nucleationModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class constantNucleation Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class constantNucleation
|
||||
:
|
||||
public nucleationModel
|
||||
{
|
||||
// Private Data
|
||||
|
||||
//- Nucleation diameter
|
||||
dimensionedScalar dNuc_;
|
||||
|
||||
//- Velocity group in which the nucleation occurs
|
||||
const velocityGroup& velGroup_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("constant");
|
||||
|
||||
// Constructor
|
||||
|
||||
constantNucleation
|
||||
(
|
||||
const populationBalanceModel& popBal,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~constantNucleation()
|
||||
{}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Add to nucleationRate
|
||||
virtual void addToNucleationRate
|
||||
(
|
||||
volScalarField& nucleationRate,
|
||||
const label i
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace nucleationModels
|
||||
} // End namespace diameterModels
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1261,6 +1261,7 @@ void Foam::diameterModels::populationBalanceModel::solve()
|
||||
const phaseModel& phase = fi.phase();
|
||||
const volScalarField& alpha = phase;
|
||||
const dimensionedScalar& residualAlpha = phase.residualAlpha();
|
||||
const volScalarField& rho = phase.thermo().rho();
|
||||
|
||||
fvScalarMatrix sizeGroupEqn
|
||||
(
|
||||
@ -1269,17 +1270,21 @@ void Foam::diameterModels::populationBalanceModel::solve()
|
||||
==
|
||||
Su_[i]
|
||||
- fvm::SuSp(SuSp_[i], fi)
|
||||
+ fluid_.fvOptions()(alpha, rho, fi)/rho
|
||||
+ fvc::ddt(residualAlpha, fi)
|
||||
- fvm::ddt(residualAlpha, fi)
|
||||
);
|
||||
|
||||
sizeGroupEqn.relax();
|
||||
fluid_.fvOptions().constrain(sizeGroupEqn);
|
||||
|
||||
maxInitialResidual = max
|
||||
(
|
||||
sizeGroupEqn.solve().initialResidual(),
|
||||
maxInitialResidual
|
||||
);
|
||||
|
||||
fluid_.fvOptions().correct(fi);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -101,7 +101,10 @@ populationBalanceCoeffs
|
||||
|
||||
driftModels
|
||||
(
|
||||
constant{}
|
||||
constant
|
||||
{
|
||||
rate 1;
|
||||
}
|
||||
);
|
||||
|
||||
nucleationModels
|
||||
|
||||
@ -95,7 +95,10 @@ populationBalanceCoeffs
|
||||
|
||||
driftModels
|
||||
(
|
||||
constant{}
|
||||
constant
|
||||
{
|
||||
rate -1;
|
||||
}
|
||||
);
|
||||
|
||||
nucleationModels
|
||||
|
||||
Reference in New Issue
Block a user