solvers::incompressibleDriftFlux: New solver module for two-phase flow with drift-flux

executed with foamRun for single region simulations of foamMultiRun for
multi-region simulations.  Replaces driftFluxFoam and all the corresponding
tutorials have been updated and moved to
tutorials/modules/incompressibleDriftFlux.

Class
    Foam::solvers::incompressibleDriftFlux

Description
    Solver module for 2 incompressible fluids using the mixture approach with
    the drift-flux approximation for relative motion of the phases, with
    optional mesh motion and mesh topology changes including adaptive
    re-meshing.

    The momentum and other fluid properties are of the "mixture" and a single
    momentum equation is solved with mixture transport modelling in which a
    single laminar, RAS or LES model is selected to model the momentum stress.

    Uses the flexible PIMPLE (PISO-SIMPLE) solution for time-resolved and
    pseudo-transient and steady simulations.

    Optional fvModels and fvConstraints are provided to enhance the simulation
    in many ways including adding various sources, Lagrangian
    particles, surface film etc. and constraining or limiting the solution.

SourceFiles
    incompressibleDriftFlux.C

See also
    Foam::solvers::VoFSolver
    Foam::solvers::twoPhaseVoFSolver
    Foam::solvers::compressibleVoF
This commit is contained in:
Henry Weller
2023-04-22 09:00:41 +01:00
parent 4ec52a5d41
commit b949c295ba
102 changed files with 978 additions and 910 deletions

View File

@ -20,6 +20,7 @@ compressibleVoF/Allwmake $targetType $*
wmake $targetType multiphaseVoFSolver wmake $targetType multiphaseVoFSolver
wmake $targetType incompressibleMultiphaseVoF wmake $targetType incompressibleMultiphaseVoF
wmake $targetType compressibleMultiphaseVoF wmake $targetType compressibleMultiphaseVoF
wmake $targetType incompressibleDriftFlux
multiphaseEuler/Allwmake $targetType $* multiphaseEuler/Allwmake $targetType $*
wmake $targetType incompressibleDenseParticleFluid wmake $targetType incompressibleDenseParticleFluid
isothermalFilm/Allwmake $targetType $* isothermalFilm/Allwmake $targetType $*

View File

@ -1,8 +1,9 @@
#!/bin/sh #!/bin/sh
cd ${0%/*} || exit 1 # Run from this directory cd ${0%/*} || exit 1 # Run from this directory
wclean libso mixtureViscosityModels wclean mixtureViscosityModels
wclean libso relativeVelocityModels wclean $targetType relativeVelocityModels
wclean wclean
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -6,6 +6,7 @@ cd ${0%/*} || exit 1 # Run from this directory
wmake $targetType mixtureViscosityModels wmake $targetType mixtureViscosityModels
wmake $targetType relativeVelocityModels wmake $targetType relativeVelocityModels
wmake $targetType wmake $targetType
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------

View File

@ -0,0 +1,6 @@
incompressibleDriftFluxMixture/incompressibleDriftFluxMixture.C
alphaSuSp.C
pressureCorrector.C
incompressibleDriftFlux.C
LIB = $(FOAM_LIBBIN)/libincompressibleDriftFlux

View File

@ -0,0 +1,32 @@
EXE_INC = \
-I$(FOAM_SOLVERS)/modules/twoPhaseVoFSolver/lnInclude \
-I$(FOAM_SOLVERS)/modules/VoFSolver/lnInclude \
-I$(FOAM_SOLVERS)/modules/fluidSolver/lnInclude \
-I$(LIB_SRC)/physicalProperties/lnInclude \
-I$(LIB_SRC)/twoPhaseModels/VoF \
-I$(LIB_SRC)/twoPhaseModels/interfaceCompression/lnInclude \
-I$(LIB_SRC)/twoPhaseModels/interfaceProperties/lnInclude \
-I$(LIB_SRC)/twoPhaseModels/twoPhaseMixture/lnInclude \
-I$(LIB_SRC)/twoPhaseModels/incompressibleTwoPhases/lnInclude \
-I$(LIB_SRC)/MomentumTransportModels/momentumTransportModels/lnInclude \
-I$(LIB_SRC)/MomentumTransportModels/compressible/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude
LIB_LIBS = \
-lincompressibleDriftFluxViscosityModel \
-lincompressibleDriftFluxRelativeVelocityModels \
-ltwoPhaseVoFSolver \
-lphysicalProperties \
-linterfaceCompression \
-lincompressibleTwoPhases \
-ltwoPhaseProperties \
-linterfaceProperties \
-lmomentumTransportModels \
-lcompressibleMomentumTransportModels \
-lfiniteVolume \
-lmeshTools \
-lfvModels \
-lfvConstraints \
-lsampling

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation \\ / A nd | Copyright (C) 2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -21,33 +21,45 @@ License
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Global
CourantNo
Description
Calculates and outputs the mean and maximum Courant Numbers.
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
scalar CoNum = 0.0; #include "incompressibleDriftFlux.H"
scalar meanCoNum = 0.0; #include "fvcFlux.H"
#include "fvcDiv.H"
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
Foam::tmp<Foam::surfaceScalarField>
Foam::solvers::incompressibleDriftFlux::alphaPhi
(
const surfaceScalarField& phi,
const volScalarField& alpha,
const dictionary& alphaControls
)
{ {
const scalarField sumPhi return fvc::flux
( (
fvc::surfaceSum phi + fvc::flux(relativeVelocity->Udm()),
( alpha,
mag(phi) + mag(fvc::flux(relativeVelocity->Udm())) divAlphaName
)().primitiveField()
); );
CoNum = 0.5*gMax(sumPhi/mesh.V().field())*runTime.deltaTValue();
meanCoNum =
0.5*(gSum(sumPhi)/gSum(mesh.V().field()))*runTime.deltaTValue();
} }
Info<< "Courant Number mean: " << meanCoNum void Foam::solvers::incompressibleDriftFlux::alphaSuSp
<< " max: " << CoNum << endl; (
tmp<volScalarField::Internal>& Su,
tmp<volScalarField::Internal>& Sp
)
{
if (divergent())
{
// Phase change alpha1 source
const fvScalarMatrix alphaSup(fvModels().source(alpha1));
Su = alphaSup.Su();
Sp = alphaSup.Sp();
}
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -0,0 +1,196 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2022-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 <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "incompressibleDriftFlux.H"
#include "localEulerDdtScheme.H"
#include "fvCorrectPhi.H"
#include "geometricZeroField.H"
#include "addToRunTimeSelectionTable.H"
#include "fvmDdt.H"
#include "fvcDdt.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace solvers
{
defineTypeNameAndDebug(incompressibleDriftFlux, 0);
addToRunTimeSelectionTable(solver, incompressibleDriftFlux, fvMesh);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::solvers::incompressibleDriftFlux::incompressibleDriftFlux(fvMesh& mesh)
:
twoPhaseVoFSolver
(
mesh,
autoPtr<twoPhaseVoFMixture>(new incompressibleDriftFluxMixture(mesh))
),
mixture
(
refCast<incompressibleDriftFluxMixture>(twoPhaseVoFSolver::mixture)
.initialise(U)
),
p
(
IOobject
(
"p",
runTime.name(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
p_rgh + rho*buoyancy.gh
),
pressureReference_
(
p,
p_rgh,
pimple.dict()
),
relativeVelocity
(
relativeVelocityModel::New(mixture, mixture, buoyancy.g)
),
momentumTransport
(
compressible::momentumTransportModel::New(rho, U, rhoPhi, mixture)
)
{
// Read the controls
readControls();
if (correctPhi || mesh.topoChanging())
{
rAU = new volScalarField
(
IOobject
(
"rAU",
runTime.name(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar(dimTime/dimDensity, 1)
);
}
if (!runTime.restart() || !divergent())
{
correctUphiBCs(U_, phi_, true);
fv::correctPhi
(
phi_,
U,
p_rgh,
rAU,
autoPtr<volScalarField>(),
pressureReference(),
pimple
);
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::solvers::incompressibleDriftFlux::~incompressibleDriftFlux()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
void Foam::solvers::incompressibleDriftFlux::prePredictor()
{
VoFSolver::prePredictor();
alphaPredictor();
// Apply the diffusion term separately to allow implicit solution
// and boundedness of the explicit advection
{
fvScalarMatrix alpha1Eqn
(
fvm::ddt(alpha1) - fvc::ddt(alpha1)
- fvm::laplacian(momentumTransport->nut(), alpha1)
);
alpha1Eqn.solve(alpha1.name() + "Diffusion");
alphaPhi1 += alpha1Eqn.flux();
alpha2 = 1.0 - alpha1;
Info<< "Phase-1 volume fraction = "
<< alpha1.weightedAverage(mesh.Vsc()).value()
<< " Min(" << alpha1.name() << ") = " << min(alpha1).value()
<< " Max(" << alpha1.name() << ") = " << max(alpha1).value()
<< endl;
}
mixture.correct();
const dimensionedScalar& rho1 = mixture.rho1();
const dimensionedScalar& rho2 = mixture.rho2();
// Calculate the mass-flux from the accumulated alphaPhi1
rhoPhi = (alphaPhi1*(rho1 - rho2) + phi*rho2);
relativeVelocity->correct();
if (pimple.predictTransport())
{
momentumTransport->predict();
}
}
void Foam::solvers::incompressibleDriftFlux::thermophysicalPredictor()
{}
void Foam::solvers::incompressibleDriftFlux::postCorrector()
{
if (pimple.correctTransport())
{
momentumTransport->correct();
}
}
// ************************************************************************* //

View File

@ -0,0 +1,211 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 <http://www.gnu.org/licenses/>.
Class
Foam::solvers::incompressibleDriftFlux
Description
Solver module for 2 incompressible fluids using the mixture approach with
the drift-flux approximation for relative motion of the phases, with
optional mesh motion and mesh topology changes including adaptive
re-meshing.
The momentum and other fluid properties are of the "mixture" and a single
momentum equation is solved with mixture transport modelling in which a
single laminar, RAS or LES model is selected to model the momentum stress.
Uses the flexible PIMPLE (PISO-SIMPLE) solution for time-resolved and
pseudo-transient and steady simulations.
Optional fvModels and fvConstraints are provided to enhance the simulation
in many ways including adding various sources, Lagrangian
particles, surface film etc. and constraining or limiting the solution.
SourceFiles
incompressibleDriftFlux.C
See also
Foam::solvers::VoFSolver
Foam::solvers::twoPhaseVoFSolver
Foam::solvers::compressibleVoF
\*---------------------------------------------------------------------------*/
#ifndef incompressibleDriftFlux_H
#define incompressibleDriftFlux_H
#include "twoPhaseVoFSolver.H"
#include "incompressibleDriftFluxMixture.H"
#include "relativeVelocityModel.H"
#include "momentumTransportModel.H"
#include "compressibleMomentumTransportModels.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace solvers
{
/*---------------------------------------------------------------------------*\
Class incompressibleDriftFlux Declaration
\*---------------------------------------------------------------------------*/
class incompressibleDriftFlux
:
public twoPhaseVoFSolver
{
protected:
// Phase properties
//- The compressible two-phase mixture
incompressibleDriftFluxMixture& mixture;
// Thermophysical properties
//- Static pressure field
volScalarField p;
// Pressure reference
//- Pressure reference
Foam::pressureReference pressureReference_;
// Momentum transport
//- Pointer to the dispersed phase relative velocity model
autoPtr<relativeVelocityModel> relativeVelocity;
//- Pointer to the momentum transport model
autoPtr<compressible::momentumTransportModel> momentumTransport;
// Protected Member Functions
//- Return the pressure reference
virtual const Foam::pressureReference& pressureReference() const
{
return pressureReference_;
}
//- The flow is incompressible
virtual bool incompressible() const
{
return true;
}
//- Is the flow divergent?
// i.e. includes phase-fraction sources
virtual bool divergent() const
{
return fvModels().addsSupToField(alpha1.name());
}
//- Return the mixture compressibility/density
// Not required for incompressible fluids
virtual tmp<volScalarField> psiByRho() const
{
return tmp<volScalarField>(nullptr);
}
virtual tmp<surfaceScalarField> alphaPhi
(
const surfaceScalarField& phi,
const volScalarField& alpha,
const dictionary& alphaControls
);
//- Calculate the alpha equation sources
virtual void alphaSuSp
(
tmp<volScalarField::Internal>& Su,
tmp<volScalarField::Internal>& Sp
);
//- Return the momentum equation stress term
virtual tmp<fvVectorMatrix> divDevTau(volVectorField& U)
{
return
relativeVelocity->divDevTau()
+ momentumTransport->divDevTau(U);
}
public:
//- Runtime type information
TypeName("incompressibleDriftFlux");
// Constructors
//- Construct from region mesh
incompressibleDriftFlux(fvMesh& mesh);
//- Disallow default bitwise copy construction
incompressibleDriftFlux(const incompressibleDriftFlux&) = delete;
//- Destructor
virtual ~incompressibleDriftFlux();
// Member Functions
//- Called at the start of the PIMPLE loop
virtual void prePredictor();
//- Construct and solve the energy equation,
// convert to temperature
// and update thermophysical and transport properties
virtual void thermophysicalPredictor();
//- Construct and solve the pressure equation in the PISO loop
virtual void pressureCorrector();
//- Correct the momentum and thermophysical transport modelling
virtual void postCorrector();
// Member Operators
//- Disallow default bitwise assignment
void operator=(const incompressibleDriftFlux&) = delete;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace solvers
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -23,36 +23,31 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "incompressibleTwoPhaseInteractingMixture.H" #include "incompressibleDriftFluxMixture.H"
#include "mixtureViscosityModel.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
defineTypeNameAndDebug(incompressibleTwoPhaseInteractingMixture, 0); defineTypeNameAndDebug(incompressibleDriftFluxMixture, 0);
} }
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::incompressibleTwoPhaseInteractingMixture:: Foam::incompressibleDriftFluxMixture::incompressibleDriftFluxMixture
incompressibleTwoPhaseInteractingMixture
( (
volVectorField& U, const fvMesh& mesh
const surfaceScalarField& phi
) )
: :
twoPhaseMixture(U.mesh()), twoPhaseVoFMixture(mesh),
U_(U), nucModel_(viscosityModel::New(mesh, phase2Name())),
nucModel_(viscosityModel::New(U.mesh(), phase2Name())),
muModel_(mixtureViscosityModel::New(*this)), muModel_(mixtureViscosityModel::New(*this)),
rhoc_("rho", dimDensity, nucModel_()),
rhod_("rho", dimDensity, muModel_()), rhod_("rho", dimDensity, muModel_()),
rhoc_("rho", dimDensity, nucModel_()),
alphaMax_(lookupOrDefault("alphaMax", 1.0)), alphaMax_(lookupOrDefault("alphaMax", 1.0)),
@ -61,12 +56,12 @@ incompressibleTwoPhaseInteractingMixture
IOobject IOobject
( (
"rho", "rho",
U_.time().name(), mesh.time().name(),
U_.mesh(), mesh,
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE IOobject::NO_WRITE
), ),
U_.mesh(), mesh,
dimensionedScalar("rho", dimDensity, 0) dimensionedScalar("rho", dimDensity, 0)
), ),
@ -75,97 +70,37 @@ incompressibleTwoPhaseInteractingMixture
IOobject IOobject
( (
"nu", "nu",
U_.time().name(), mesh.time().name(),
U_.db() mesh
), ),
U_.mesh(), mesh,
dimensionedScalar(dimViscosity, 0), dimensionedScalar(dimViscosity, 0),
calculatedFvPatchScalarField::typeName calculatedFvPatchScalarField::typeName
) ),
{
correct();
}
Uptr_(nullptr)
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::incompressibleTwoPhaseInteractingMixture::
~incompressibleTwoPhaseInteractingMixture()
{} {}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
const Foam::volScalarField& void Foam::incompressibleDriftFluxMixture::correct()
Foam::incompressibleTwoPhaseInteractingMixture::alphac() const
{
return alpha2();
}
const Foam::volScalarField&
Foam::incompressibleTwoPhaseInteractingMixture::alphad() const
{
return alpha1();
}
const Foam::dimensionedScalar&
Foam::incompressibleTwoPhaseInteractingMixture::rhoc() const
{
return rhoc_;
};
const Foam::dimensionedScalar&
Foam::incompressibleTwoPhaseInteractingMixture::rhod() const
{
return rhod_;
}
Foam::scalar
Foam::incompressibleTwoPhaseInteractingMixture::alphaMax() const
{
return alphaMax_;
}
const Foam::volVectorField&
Foam::incompressibleTwoPhaseInteractingMixture::U() const
{
return U_;
}
const Foam::volScalarField&
Foam::incompressibleTwoPhaseInteractingMixture::rho() const
{
return rho_;
}
Foam::tmp<Foam::volScalarField>
Foam::incompressibleTwoPhaseInteractingMixture::nu() const
{
return nu_;
}
Foam::tmp<Foam::scalarField>
Foam::incompressibleTwoPhaseInteractingMixture::nu(const label patchi) const
{
return nu_.boundaryField()[patchi];
}
void Foam::incompressibleTwoPhaseInteractingMixture::correct()
{ {
rho_ = alpha1()*rhod_ + alpha2()*rhoc_; rho_ = alpha1()*rhod_ + alpha2()*rhoc_;
nu_ = muModel_->mu(rhoc_*nucModel_->nu(), U_)/rho_; nu_ = muModel_->mu(rhoc_*nucModel_->nu(), *Uptr_)/rho_;
} }
bool Foam::incompressibleTwoPhaseInteractingMixture::read() Foam::incompressibleDriftFluxMixture&
Foam::incompressibleDriftFluxMixture::initialise(const volVectorField& U)
{
Uptr_ = &U;
correct();
return *this;
}
bool Foam::incompressibleDriftFluxMixture::read()
{ {
if (twoPhaseMixture::read()) if (twoPhaseMixture::read())
{ {

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2014-2023 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -22,43 +22,40 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>. along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class Class
Foam::incompressibleTwoPhaseInteractingMixture Foam::incompressibleDriftFluxMixture
Description Description
A two-phase incompressible transportModel for interacting phases Class to represent a mixture of two constant density phases
requiring the direct evaluation of the mixture viscosity,
e.g. activated sludge or slurry.
SourceFiles SourceFiles
incompressibleTwoPhaseInteractingMixture.C incompressibleDriftFluxMixture.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef incompressibleTwoPhaseInteractingMixture_H #ifndef incompressibleDriftFluxMixture_H
#define incompressibleTwoPhaseInteractingMixture_H #define incompressibleDriftFluxMixture_H
#include "twoPhaseMixture.H" #include "twoPhaseVoFMixture.H"
#include "incompressibleTwoPhases.H"
#include "viscosityModel.H" #include "viscosityModel.H"
#include "mixtureViscosityModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
class mixtureViscosityModel;
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class incompressibleTwoPhaseInteractingMixture Declaration Class incompressibleDriftFluxMixture Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
class incompressibleTwoPhaseInteractingMixture class incompressibleDriftFluxMixture
: :
public twoPhaseMixture, public twoPhaseVoFMixture,
virtual public incompressibleTwoPhases,
public viscosity public viscosity
{ {
// Private data // Private Data
volVectorField& U_;
//- Continuous phase viscosity model //- Continuous phase viscosity model
autoPtr<viscosityModel> nucModel_; autoPtr<viscosityModel> nucModel_;
@ -66,12 +63,12 @@ class incompressibleTwoPhaseInteractingMixture
//- Mixture viscosity model //- Mixture viscosity model
autoPtr<mixtureViscosityModel> muModel_; autoPtr<mixtureViscosityModel> muModel_;
//- Continuous phase density
dimensionedScalar rhoc_;
//- Dispersed phase density //- Dispersed phase density
dimensionedScalar rhod_; dimensionedScalar rhod_;
//- Continuous phase density
dimensionedScalar rhoc_;
//- Optional maximum dispersed phase-fraction (e.g. packing limit) //- Optional maximum dispersed phase-fraction (e.g. packing limit)
scalar alphaMax_; scalar alphaMax_;
@ -81,57 +78,100 @@ class incompressibleTwoPhaseInteractingMixture
//- Mixture kinematic viscosity //- Mixture kinematic viscosity
volScalarField nu_; volScalarField nu_;
//- Pointer to the mixture velocity field
// Set by the initialise(U) function
const volVectorField* Uptr_;
public: public:
TypeName("incompressibleTwoPhaseInteractingMixture"); TypeName("incompressibleDriftFluxMixture");
// Constructors // Constructors
//- Construct from components //- Construct from a mesh
incompressibleTwoPhaseInteractingMixture incompressibleDriftFluxMixture(const fvMesh& mesh);
(
volVectorField& U,
const surfaceScalarField& phi
);
//- Destructor //- Destructor
virtual ~incompressibleTwoPhaseInteractingMixture(); virtual ~incompressibleDriftFluxMixture()
{}
// Member Functions // Member Functions
//- Return const-access to the continuous phase-fraction
const volScalarField& alphac() const;
//- Return const-access to the dispersed phase-fraction //- Return const-access to the dispersed phase-fraction
const volScalarField& alphad() const; const volScalarField& alphad() const
{
return alpha1();
}
//- Return const-access to continuous-phase density //- Return const-access to the continuous phase-fraction
const dimensionedScalar& rhoc() const; const volScalarField& alphac() const
{
return alpha2();
}
//- Return const-access to the dispersed-phase density //- Return const-access to the dispersed-phase density
const dimensionedScalar& rhod() const; const dimensionedScalar& rhod() const
{
return rhod_;
}
//- Return const-access to continuous-phase density
const dimensionedScalar& rhoc() const
{
return rhoc_;
}
//- Return const-access to the dispersed-phase density
const dimensionedScalar& rho1() const
{
return rhod_;
}
//- Return const-access to continuous-phase density
const dimensionedScalar& rho2() const
{
return rhoc_;
}
//- Optional maximum phase-fraction (e.g. packing limit) //- Optional maximum phase-fraction (e.g. packing limit)
// Defaults to 1 // Defaults to 1
scalar alphaMax() const; scalar alphaMax() const
{
//- Return const-access to the mixture velocity return alphaMax_;
const volVectorField& U() const; }
//- Return the mixture density //- Return the mixture density
virtual const volScalarField& rho() const; virtual const volScalarField& rho() const
{
return rho_;
}
//- Return the mixture viscosity //- Return the mixture viscosity
virtual tmp<volScalarField> nu() const; virtual tmp<volScalarField> nu() const
{
return nu_;
}
//- Return the mixture viscosity for patch //- Return the mixture viscosity for patch
virtual tmp<scalarField> nu(const label patchi) const; virtual tmp<scalarField> nu(const label patchi) const
{
return nu_.boundaryField()[patchi];
}
//- Return the mixture velocity field
const volVectorField& U() const
{
return *Uptr_;
}
//- Correct the laminar viscosity //- Correct the laminar viscosity
incompressibleDriftFluxMixture& initialise(const volVectorField& U);
//- Correct the density and mixture viscosity
virtual void correct(); virtual void correct();
//- Read base phaseProperties dictionary //- Read base phaseProperties dictionary

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2014-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2014-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -24,8 +24,9 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "BinghamPlastic.H" #include "BinghamPlastic.H"
#include "addToRunTimeSelectionTable.H" #include "incompressibleDriftFluxMixture.H"
#include "fvcGrad.H" #include "fvcGrad.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -49,7 +50,7 @@ namespace mixtureViscosityModels
Foam::mixtureViscosityModels::BinghamPlastic::BinghamPlastic Foam::mixtureViscosityModels::BinghamPlastic::BinghamPlastic
( (
const incompressibleTwoPhaseInteractingMixture& mixture const incompressibleDriftFluxMixture& mixture
) )
: :
plastic(mixture), plastic(mixture),

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2014-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2014-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -77,7 +77,7 @@ public:
//- Construct from mixture //- Construct from mixture
BinghamPlastic BinghamPlastic
( (
const incompressibleTwoPhaseInteractingMixture& mixture const incompressibleDriftFluxMixture& mixture
); );

View File

@ -5,4 +5,4 @@ BinghamPlastic/BinghamPlastic.C
slurry/slurry.C slurry/slurry.C
Quemada/Quemada.C Quemada/Quemada.C
LIB = $(FOAM_LIBBIN)/libdriftFluxTransportModels LIB = $(FOAM_LIBBIN)/libincompressibleDriftFluxViscosityModel

View File

@ -1,12 +1,16 @@
EXE_INC = \ EXE_INC = \
-I../incompressibleTwoPhaseInteractingMixture \ -I../incompressibleDriftFluxMixture \
-I$(FOAM_SOLVERS)/modules/twoPhaseVoFSolver/lnInclude \
-I$(FOAM_SOLVERS)/modules/VoFSolver/lnInclude \
-I$(LIB_SRC)/physicalProperties/lnInclude \ -I$(LIB_SRC)/physicalProperties/lnInclude \
-I$(LIB_SRC)/twoPhaseModels/twoPhaseMixture/lnInclude \ -I$(LIB_SRC)/twoPhaseModels/twoPhaseMixture/lnInclude \
-I$(LIB_SRC)/twoPhaseModels/incompressibleTwoPhases/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude -I$(LIB_SRC)/meshTools/lnInclude
LIB_LIBS = \ LIB_LIBS = \
-lphysicalProperties \ -lphysicalProperties \
-ltwoPhaseMixture \ -ltwoPhaseMixture \
-lincompressibleTwoPhases \
-lfiniteVolume \ -lfiniteVolume \
-lmeshTools -lmeshTools

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -24,7 +24,7 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "Quemada.H" #include "Quemada.H"
#include "volFields.H" #include "incompressibleDriftFluxMixture.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -49,7 +49,7 @@ namespace mixtureViscosityModels
Foam::mixtureViscosityModels::Quemada::Quemada Foam::mixtureViscosityModels::Quemada::Quemada
( (
const incompressibleTwoPhaseInteractingMixture& mixture const incompressibleDriftFluxMixture& mixture
) )
: :
mixtureViscosityModel(mixture), mixtureViscosityModel(mixture),

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -92,7 +92,7 @@ public:
// Constructors // Constructors
//- Construct from mixture //- Construct from mixture
Quemada(const incompressibleTwoPhaseInteractingMixture& mixture); Quemada(const incompressibleDriftFluxMixture& mixture);
//- Destructor //- Destructor

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2014-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2014-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -24,6 +24,7 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "mixtureViscosityModel.H" #include "mixtureViscosityModel.H"
#include "incompressibleDriftFluxMixture.H"
#include "volFields.H" #include "volFields.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -39,10 +40,10 @@ namespace Foam
Foam::mixtureViscosityModel::mixtureViscosityModel Foam::mixtureViscosityModel::mixtureViscosityModel
( (
const incompressibleTwoPhaseInteractingMixture& mixture const incompressibleDriftFluxMixture& mixture
) )
: :
viscosityModel(mixture.U().mesh(), mixture.phase1Name()), viscosityModel(mixture.mesh(), mixture.phase1Name()),
mixture_(mixture) mixture_(mixture)
{} {}

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2014-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2014-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -42,7 +42,6 @@ SourceFiles
#ifndef mixtureViscosityModel_H #ifndef mixtureViscosityModel_H
#define mixtureViscosityModel_H #define mixtureViscosityModel_H
#include "incompressibleTwoPhaseInteractingMixture.H"
#include "viscosityModel.H" #include "viscosityModel.H"
#include "runTimeSelectionTables.H" #include "runTimeSelectionTables.H"
@ -51,6 +50,8 @@ SourceFiles
namespace Foam namespace Foam
{ {
class incompressibleDriftFluxMixture;
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class mixtureViscosityModel Declaration Class mixtureViscosityModel Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -65,7 +66,7 @@ protected:
// Protected data // Protected data
//- Mixture properties //- Mixture properties
const incompressibleTwoPhaseInteractingMixture& mixture_; const incompressibleDriftFluxMixture& mixture_;
public: public:
@ -82,7 +83,7 @@ public:
mixtureViscosityModel, mixtureViscosityModel,
dictionary, dictionary,
( (
const incompressibleTwoPhaseInteractingMixture& mixture const incompressibleDriftFluxMixture& mixture
), ),
(mixture) (mixture)
); );
@ -93,7 +94,7 @@ public:
//- Construct from mixture //- Construct from mixture
mixtureViscosityModel mixtureViscosityModel
( (
const incompressibleTwoPhaseInteractingMixture& mixture const incompressibleDriftFluxMixture& mixture
); );
//- Disallow default bitwise copy construction //- Disallow default bitwise copy construction
@ -105,7 +106,7 @@ public:
//- Return a reference to the selected viscosity model //- Return a reference to the selected viscosity model
static autoPtr<mixtureViscosityModel> New static autoPtr<mixtureViscosityModel> New
( (
const incompressibleTwoPhaseInteractingMixture& mixture const incompressibleDriftFluxMixture& mixture
); );

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2014-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2014-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -24,14 +24,13 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "mixtureViscosityModel.H" #include "mixtureViscosityModel.H"
#include "volFields.H" #include "incompressibleDriftFluxMixture.H"
#include "surfaceFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::mixtureViscosityModel> Foam::mixtureViscosityModel::New Foam::autoPtr<Foam::mixtureViscosityModel> Foam::mixtureViscosityModel::New
( (
const incompressibleTwoPhaseInteractingMixture& mixture const incompressibleDriftFluxMixture& mixture
) )
{ {
const word modelType const word modelType
@ -40,7 +39,7 @@ Foam::autoPtr<Foam::mixtureViscosityModel> Foam::mixtureViscosityModel::New
( (
viscosityModel::findModelDict viscosityModel::findModelDict
( (
mixture.U().mesh(), mixture.mesh(),
mixture.phase1Name() mixture.phase1Name()
) )
).lookup("viscosityModel") ).lookup("viscosityModel")

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2014-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2014-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -24,6 +24,7 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "plastic.H" #include "plastic.H"
#include "incompressibleDriftFluxMixture.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -48,7 +49,7 @@ namespace mixtureViscosityModels
Foam::mixtureViscosityModels::plastic::plastic Foam::mixtureViscosityModels::plastic::plastic
( (
const incompressibleTwoPhaseInteractingMixture& mixture const incompressibleDriftFluxMixture& mixture
) )
: :
mixtureViscosityModel(mixture), mixtureViscosityModel(mixture),

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2014-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2014-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -44,7 +44,7 @@ SourceFiles
namespace Foam namespace Foam
{ {
class incompressibleTwoPhaseInteractingMixture; class incompressibleDriftFluxMixture;
namespace mixtureViscosityModels namespace mixtureViscosityModels
{ {
@ -83,7 +83,7 @@ public:
// Constructors // Constructors
//- Construct from mixture //- Construct from mixture
plastic(const incompressibleTwoPhaseInteractingMixture& mixture); plastic(const incompressibleDriftFluxMixture& mixture);
//- Destructor //- Destructor

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2014-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2014-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -24,6 +24,7 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "slurry.H" #include "slurry.H"
#include "incompressibleDriftFluxMixture.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -48,7 +49,7 @@ namespace mixtureViscosityModels
Foam::mixtureViscosityModels::slurry::slurry Foam::mixtureViscosityModels::slurry::slurry
( (
const incompressibleTwoPhaseInteractingMixture& mixture const incompressibleDriftFluxMixture& mixture
) )
: :
mixtureViscosityModel(mixture) mixtureViscosityModel(mixture)

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2014-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2014-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -53,7 +53,7 @@ SourceFiles
namespace Foam namespace Foam
{ {
class incompressibleTwoPhaseInteractingMixture; class incompressibleDriftFluxMixture;
namespace mixtureViscosityModels namespace mixtureViscosityModels
{ {
@ -76,7 +76,7 @@ public:
// Constructors // Constructors
//- Construct from mixture //- Construct from mixture
slurry(const incompressibleTwoPhaseInteractingMixture& mixture); slurry(const incompressibleDriftFluxMixture& mixture);
//- Destructor //- Destructor

View File

@ -0,0 +1,155 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "incompressibleDriftFlux.H"
#include "constrainHbyA.H"
#include "constrainPressure.H"
#include "adjustPhi.H"
#include "findRefCell.H"
#include "fvcMeshPhi.H"
#include "fvcFlux.H"
#include "fvcDdt.H"
#include "fvcDiv.H"
#include "fvcSnGrad.H"
#include "fvcReconstruct.H"
#include "fvmLaplacian.H"
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
void Foam::solvers::incompressibleDriftFlux::pressureCorrector()
{
volVectorField& U = U_;
surfaceScalarField& phi(phi_);
fvVectorMatrix& UEqn = tUEqn.ref();
setrAU(UEqn);
const surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU()));
while (pimple.correct())
{
volVectorField HbyA(constrainHbyA(rAU()*UEqn.H(), U, p_rgh));
surfaceScalarField phiHbyA
(
"phiHbyA",
fvc::flux(HbyA)
+ fvc::interpolate(rho*rAU())*fvc::ddtCorr(U, phi, Uf)
);
MRF.makeRelative(phiHbyA);
if (p_rgh.needReference())
{
fvc::makeRelative(phiHbyA, U);
adjustPhi(phiHbyA, U, p_rgh);
fvc::makeAbsolute(phiHbyA, U);
}
surfaceScalarField phig
(
(
interface.surfaceTensionForce()
- buoyancy.ghf*fvc::snGrad(rho)
)*rAUf*mesh.magSf()
);
phiHbyA += phig;
// Update the pressure BCs to ensure flux consistency
constrainPressure(p_rgh, U, phiHbyA, rAUf, MRF);
// Cache the phase change pressure source
fvScalarMatrix Sp_rgh
(
fvModels().source
(
volScalarField::New
(
"1",
mesh,
dimensionedScalar(dimless/dimPressure, 1)
),
p_rgh
)
);
while (pimple.correctNonOrthogonal())
{
fvScalarMatrix p_rghEqn
(
fvc::div(phiHbyA) - fvm::laplacian(rAUf, p_rgh)
== Sp_rgh
);
p_rghEqn.setReference
(
pressureReference().refCell(),
getRefCellValue(p_rgh, pressureReference().refCell())
);
p_rghEqn.solve();
if (pimple.finalNonOrthogonalIter())
{
phi = phiHbyA + p_rghEqn.flux();
p_rgh.relax();
U = HbyA
+ rAU()*fvc::reconstruct((phig + p_rghEqn.flux())/rAUf);
U.correctBoundaryConditions();
fvConstraints().constrain(U);
}
}
continuityErrors();
// Correct Uf if the mesh is moving
fvc::correctUf(Uf, U, phi, MRF);
// Make the fluxes relative to the mesh motion
fvc::makeRelative(phi, U);
p == p_rgh + rho*buoyancy.gh;
if (p_rgh.needReference())
{
p += dimensionedScalar
(
"p",
p.dimensions(),
pressureReference().refValue()
- getRefCellValue(p, pressureReference().refCell())
);
p_rgh = p - rho*buoyancy.gh;
}
}
clearrAU();
tUEqn.clear();
}
// ************************************************************************* //

View File

@ -3,4 +3,4 @@ simple/simple.C
general/general.C general/general.C
MichaelsBolger/MichaelsBolger.C MichaelsBolger/MichaelsBolger.C
LIB = $(FOAM_LIBBIN)/libdriftFluxRelativeVelocityModels LIB = $(FOAM_LIBBIN)/libincompressibleDriftFluxRelativeVelocityModels

View File

@ -1,13 +1,17 @@
EXE_INC = \ EXE_INC = \
-I../incompressibleTwoPhaseInteractingMixture \ -I../incompressibleDriftFluxMixture \
-I../mixtureViscosityModels/lnInclude \ -I../mixtureViscosityModels/lnInclude \
-I$(FOAM_SOLVERS)/modules/twoPhaseVoFSolver/lnInclude \
-I$(FOAM_SOLVERS)/modules/VoFSolver/lnInclude \
-I$(LIB_SRC)/physicalProperties/lnInclude \ -I$(LIB_SRC)/physicalProperties/lnInclude \
-I$(LIB_SRC)/twoPhaseModels/twoPhaseMixture/lnInclude \ -I$(LIB_SRC)/twoPhaseModels/twoPhaseMixture/lnInclude \
-I$(LIB_SRC)/twoPhaseModels/incompressibleTwoPhases/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude -I$(LIB_SRC)/meshTools/lnInclude
LIB_LIBS = \ LIB_LIBS = \
-lphysicalProperties \ -lphysicalProperties \
-ltwoPhaseMixture \ -ltwoPhaseMixture \
-lincompressibleTwoPhases \
-lfiniteVolume \ -lfiniteVolume \
-lmeshTools -lmeshTools

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -48,7 +48,7 @@ namespace relativeVelocityModels
Foam::relativeVelocityModels::MichaelsBolger::MichaelsBolger Foam::relativeVelocityModels::MichaelsBolger::MichaelsBolger
( (
const dictionary& dict, const dictionary& dict,
const incompressibleTwoPhaseInteractingMixture& mixture, const incompressibleDriftFluxMixture& mixture,
const uniformDimensionedVectorField& g const uniformDimensionedVectorField& g
) )
: :

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -96,7 +96,7 @@ public:
MichaelsBolger MichaelsBolger
( (
const dictionary& dict, const dictionary& dict,
const incompressibleTwoPhaseInteractingMixture& mixture, const incompressibleDriftFluxMixture& mixture,
const uniformDimensionedVectorField& g const uniformDimensionedVectorField& g
); );

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2014-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2014-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -43,7 +43,7 @@ namespace relativeVelocityModels
Foam::relativeVelocityModels::general::general Foam::relativeVelocityModels::general::general
( (
const dictionary& dict, const dictionary& dict,
const incompressibleTwoPhaseInteractingMixture& mixture, const incompressibleDriftFluxMixture& mixture,
const uniformDimensionedVectorField& g const uniformDimensionedVectorField& g
) )
: :

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2014-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2014-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -79,7 +79,7 @@ public:
general general
( (
const dictionary& dict, const dictionary& dict,
const incompressibleTwoPhaseInteractingMixture& mixture, const incompressibleDriftFluxMixture& mixture,
const uniformDimensionedVectorField& g const uniformDimensionedVectorField& g
); );

View File

@ -72,7 +72,7 @@ Foam::wordList Foam::relativeVelocityModel::UdmPatchFieldTypes() const
Foam::relativeVelocityModel::relativeVelocityModel Foam::relativeVelocityModel::relativeVelocityModel
( (
const dictionary& dict, const dictionary& dict,
const incompressibleTwoPhaseInteractingMixture& mixture, const incompressibleDriftFluxMixture& mixture,
const uniformDimensionedVectorField& g const uniformDimensionedVectorField& g
) )
: :
@ -83,12 +83,12 @@ Foam::relativeVelocityModel::relativeVelocityModel
IOobject IOobject
( (
"Udm", "Udm",
mixture.U().time().name(), mixture_.time().name(),
mixture.U().mesh(), mixture_.mesh(),
IOobject::READ_IF_PRESENT, IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE IOobject::AUTO_WRITE
), ),
mixture_.U().mesh(), mixture_.mesh(),
dimensionedVector(dimVelocity, Zero), dimensionedVector(dimVelocity, Zero),
UdmPatchFieldTypes() UdmPatchFieldTypes()
) )
@ -100,7 +100,7 @@ Foam::relativeVelocityModel::relativeVelocityModel
Foam::autoPtr<Foam::relativeVelocityModel> Foam::relativeVelocityModel::New Foam::autoPtr<Foam::relativeVelocityModel> Foam::relativeVelocityModel::New
( (
const dictionary& dict, const dictionary& dict,
const incompressibleTwoPhaseInteractingMixture& mixture, const incompressibleDriftFluxMixture& mixture,
const uniformDimensionedVectorField& g const uniformDimensionedVectorField& g
) )
{ {

View File

@ -34,7 +34,7 @@ SourceFiles
#ifndef relativeVelocityModel_H #ifndef relativeVelocityModel_H
#define relativeVelocityModel_H #define relativeVelocityModel_H
#include "incompressibleTwoPhaseInteractingMixture.H" #include "incompressibleDriftFluxMixture.H"
#include "uniformDimensionedFields.H" #include "uniformDimensionedFields.H"
#include "runTimeSelectionTables.H" #include "runTimeSelectionTables.H"
@ -60,7 +60,7 @@ protected:
// Protected data // Protected data
//- Mixture properties //- Mixture properties
const incompressibleTwoPhaseInteractingMixture& mixture_; const incompressibleDriftFluxMixture& mixture_;
//- Acceleration due to gravity //- Acceleration due to gravity
const uniformDimensionedVectorField& g_; const uniformDimensionedVectorField& g_;
@ -82,7 +82,7 @@ public:
dictionary, dictionary,
( (
const dictionary& dict, const dictionary& dict,
const incompressibleTwoPhaseInteractingMixture& mixture, const incompressibleDriftFluxMixture& mixture,
const uniformDimensionedVectorField& g const uniformDimensionedVectorField& g
), ),
(dict, mixture, g) (dict, mixture, g)
@ -95,7 +95,7 @@ public:
relativeVelocityModel relativeVelocityModel
( (
const dictionary& dict, const dictionary& dict,
const incompressibleTwoPhaseInteractingMixture& mixture, const incompressibleDriftFluxMixture& mixture,
const uniformDimensionedVectorField& g const uniformDimensionedVectorField& g
); );
@ -107,7 +107,7 @@ public:
static autoPtr<relativeVelocityModel> New static autoPtr<relativeVelocityModel> New
( (
const dictionary& dict, const dictionary& dict,
const incompressibleTwoPhaseInteractingMixture& mixture, const incompressibleDriftFluxMixture& mixture,
const uniformDimensionedVectorField& g const uniformDimensionedVectorField& g
); );
@ -119,7 +119,7 @@ public:
// Member Functions // Member Functions
//- Mixture properties //- Mixture properties
const incompressibleTwoPhaseInteractingMixture& mixture() const const incompressibleDriftFluxMixture& mixture() const
{ {
return mixture_; return mixture_;
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2014-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2014-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -43,7 +43,7 @@ namespace relativeVelocityModels
Foam::relativeVelocityModels::simple::simple Foam::relativeVelocityModels::simple::simple
( (
const dictionary& dict, const dictionary& dict,
const incompressibleTwoPhaseInteractingMixture& mixture, const incompressibleDriftFluxMixture& mixture,
const uniformDimensionedVectorField& g const uniformDimensionedVectorField& g
) )
: :

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org \\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2014-2022 OpenFOAM Foundation \\ / A nd | Copyright (C) 2014-2023 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -73,7 +73,7 @@ public:
simple simple
( (
const dictionary& dict, const dictionary& dict,
const incompressibleTwoPhaseInteractingMixture& mixture, const incompressibleDriftFluxMixture& mixture,
const uniformDimensionedVectorField& g const uniformDimensionedVectorField& g
); );

View File

@ -33,6 +33,41 @@ License
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
Foam::tmp<Foam::surfaceScalarField> Foam::solvers::twoPhaseVoFSolver::alphaPhi
(
const surfaceScalarField& phi,
const volScalarField& alpha,
const dictionary& alphaControls
)
{
const word alphaScheme(mesh.schemes().div(divAlphaName)[1].wordToken());
ITstream compressionScheme
(
compressionSchemes.found(alphaScheme)
? mesh.schemes().div(divAlphaName)
: ITstream
(
divAlphaName,
tokenList
{
word("Gauss"),
word("interfaceCompression"),
alphaScheme,
alphaControls.lookup<scalar>("cAlpha")
}
)
);
return fvc::flux
(
phi,
alpha,
compressionScheme
);
}
void Foam::solvers::twoPhaseVoFSolver::alphaSolve void Foam::solvers::twoPhaseVoFSolver::alphaSolve
( (
const dictionary& alphaControls const dictionary& alphaControls
@ -55,25 +90,6 @@ void Foam::solvers::twoPhaseVoFSolver::alphaSolve
alphaControls.lookupOrDefault<Switch>("alphaApplyPrevCorr", false) alphaControls.lookupOrDefault<Switch>("alphaApplyPrevCorr", false)
); );
const word alphaScheme(mesh.schemes().div(divAlphaName)[1].wordToken());
ITstream compressionScheme
(
compressionSchemes.found(alphaScheme)
? mesh.schemes().div(divAlphaName)
: ITstream
(
divAlphaName,
tokenList
{
word("Gauss"),
word("interfaceCompression"),
alphaScheme,
alphaControls.lookup<scalar>("cAlpha")
}
)
);
// Set the off-centering coefficient according to ddt scheme // Set the off-centering coefficient according to ddt scheme
scalar ocCoeff = 0; scalar ocCoeff = 0;
@ -219,11 +235,11 @@ void Foam::solvers::twoPhaseVoFSolver::alphaSolve
// Split operator // Split operator
tmp<surfaceScalarField> talphaPhi1Un tmp<surfaceScalarField> talphaPhi1Un
( (
fvc::flux alphaPhi
( (
phiCN(), phiCN(),
(cnCoeff*alpha1 + (1.0 - cnCoeff)*alpha1.oldTime())(), (cnCoeff*alpha1 + (1.0 - cnCoeff)*alpha1.oldTime())(),
compressionScheme.rewind() alphaControls
) )
); );
@ -399,8 +415,6 @@ void Foam::solvers::twoPhaseVoFSolver::alphaPredictor()
{ {
alphaSolve(alphaControls); alphaSolve(alphaControls);
} }
mixture.correct();
} }

View File

@ -155,8 +155,8 @@ void Foam::solvers::twoPhaseVoFSolver::preSolve()
void Foam::solvers::twoPhaseVoFSolver::prePredictor() void Foam::solvers::twoPhaseVoFSolver::prePredictor()
{ {
VoFSolver::prePredictor(); VoFSolver::prePredictor();
alphaPredictor(); alphaPredictor();
mixture.correct();
} }

View File

@ -119,14 +119,21 @@ private:
//- Solve for the phase-fractions //- Solve for the phase-fractions
void alphaSolve(const dictionary& alphaControls); void alphaSolve(const dictionary& alphaControls);
//- Solve for the phase-fractions
void alphaPredictor();
protected: protected:
// Protected Member Functions // Protected Member Functions
virtual tmp<surfaceScalarField> alphaPhi
(
const surfaceScalarField& phi,
const volScalarField& alpha,
const dictionary& alphaControls
);
//- Solve for the phase-fractions
void alphaPredictor();
//- Adjust the rDeltaT in the vicinity of the interface //- Adjust the rDeltaT in the vicinity of the interface
virtual void setInterfaceRDeltaT(volScalarField& rDeltaT); virtual void setInterfaceRDeltaT(volScalarField& rDeltaT);

View File

@ -1,4 +0,0 @@
incompressibleTwoPhaseInteractingMixture/incompressibleTwoPhaseInteractingMixture.C
driftFluxFoam.C
EXE = $(FOAM_APPBIN)/driftFluxFoam

View File

@ -1,27 +0,0 @@
EXE_INC = \
-IincompressibleTwoPhaseInteractingMixture \
-ImixtureViscosityModels/lnInclude \
-I./relativeVelocityModels/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/physicalProperties/lnInclude \
-I$(LIB_SRC)/twoPhaseModels/VoF \
-I$(LIB_SRC)/twoPhaseModels/interfaceCompression/lnInclude \
-I$(LIB_SRC)/twoPhaseModels/twoPhaseMixture/lnInclude \
-I$(LIB_SRC)/MomentumTransportModels/momentumTransportModels/lnInclude \
-I$(LIB_SRC)/MomentumTransportModels/compressible/lnInclude
EXE_LIBS = \
-ldriftFluxTransportModels \
-ldriftFluxRelativeVelocityModels \
-lphysicalProperties \
-linterfaceCompression \
-ltwoPhaseMixture \
-lmomentumTransportModels \
-lcompressibleMomentumTransportModels \
-lfiniteVolume \
-lmeshTools \
-lsampling \
-lfvModels \
-lfvConstraints

View File

@ -1,33 +0,0 @@
// Solve the Momentum equation
fvVectorMatrix UEqn
(
fvm::ddt(rho, U) + fvm::div(rhoPhi, U)
+ MRF.DDt(rho, U)
+ relativeVelocity->divDevTau()
+ turbulence->divDevTau(U)
==
fvModels.source(rho, U)
);
UEqn.relax();
fvConstraints.constrain(UEqn);
if (pimple.momentumPredictor())
{
solve
(
UEqn
==
fvc::reconstruct
(
(
- ghf*fvc::snGrad(rho)
- fvc::snGrad(p_rgh)
)*mesh.magSf()
)
);
fvConstraints.constrain(U);
}

View File

@ -1,15 +0,0 @@
const dictionary& alphaControls = mesh.solution().solverDict(alpha1.name());
label nAlphaCorr(alphaControls.lookup<label>("nAlphaCorr"));
label nAlphaSubCycles(alphaControls.lookup<label>("nAlphaSubCycles"));
bool MULESCorr(alphaControls.lookupOrDefault<Switch>("MULESCorr", false));
// Apply the compression correction from the previous iteration
// Improves efficiency for steady-simulations but can only be applied
// once the alpha field is reasonably steady, i.e. fully developed
bool alphaApplyPrevCorr
(
alphaControls.lookupOrDefault<Switch>("alphaApplyPrevCorr", false)
);

View File

@ -1,122 +0,0 @@
{
word alphaScheme("div(phi,alpha)");
word alpharScheme("div(phirb,alpha)");
if (MULESCorr)
{
fvScalarMatrix alpha1Eqn
(
fv::EulerDdtScheme<scalar>(mesh).fvmDdt(alpha1)
+ fv::gaussConvectionScheme<scalar>
(
mesh,
phi,
upwind<scalar>(mesh, phi)
).fvmDiv(phi, alpha1)
);
solve(alpha1Eqn);
Info<< "Phase-1 volume fraction = "
<< alpha1.weightedAverage(mesh.Vsc()).value()
<< " Min(" << alpha1.name() << ") = " << min(alpha1).value()
<< " Max(" << alpha1.name() << ") = " << max(alpha1).value()
<< endl;
tmp<surfaceScalarField> talphaPhiUD(alpha1Eqn.flux());
alphaPhi = talphaPhiUD();
if (alphaApplyPrevCorr && talphaPhiCorr0.valid())
{
Info<< "Applying the previous iteration correction flux" << endl;
MULES::correct
(
geometricOneField(),
alpha1,
alphaPhi,
talphaPhiCorr0.ref(),
UniformField<scalar>(mixture.alphaMax()),
zeroField()
);
alphaPhi += talphaPhiCorr0();
}
// Cache the upwind-flux
talphaPhiCorr0 = talphaPhiUD;
}
for (int aCorr=0; aCorr<nAlphaCorr; aCorr++)
{
tmp<surfaceScalarField> talphaPhiUn
(
fvc::flux
(
phi,
alpha1,
alphaScheme
)
+ fvc::flux
(
phir,
alpha1,
alpharScheme
)
);
if (MULESCorr)
{
tmp<surfaceScalarField> talphaPhiCorr(talphaPhiUn() - alphaPhi);
volScalarField alpha10("alpha10", alpha1);
MULES::correct
(
geometricOneField(),
alpha1,
talphaPhiUn(),
talphaPhiCorr.ref(),
UniformField<scalar>(mixture.alphaMax()),
zeroField()
);
// Under-relax the correction for all but the 1st corrector
if (aCorr == 0)
{
alphaPhi += talphaPhiCorr();
}
else
{
alpha1 = 0.5*alpha1 + 0.5*alpha10;
alphaPhi += 0.5*talphaPhiCorr();
}
}
else
{
alphaPhi = talphaPhiUn;
MULES::explicitSolve
(
geometricOneField(),
alpha1,
phi,
alphaPhi,
UniformField<scalar>(mixture.alphaMax()),
zeroField()
);
}
}
if (alphaApplyPrevCorr && MULESCorr)
{
talphaPhiCorr0 = alphaPhi - talphaPhiCorr0;
}
alpha2 = 1.0 - alpha1;
Info<< "Phase-1 volume fraction = "
<< alpha1.weightedAverage(mesh.Vsc()).value()
<< " Min(" << alpha1.name() << ") = " << min(alpha1).value()
<< " Max(" << alpha1.name() << ") = " << max(alpha1).value()
<< endl;
}

View File

@ -1,74 +0,0 @@
#include "alphaControls.H"
{
surfaceScalarField alphaPhi
(
IOobject
(
"alphaPhi",
runTime.name(),
mesh
),
mesh,
dimensionedScalar(phi.dimensions(), 0)
);
surfaceScalarField phir(fvc::flux(relativeVelocity->Udm()));
if (nAlphaSubCycles > 1)
{
dimensionedScalar totalDeltaT = runTime.deltaT();
surfaceScalarField alphaPhiSum
(
IOobject
(
"alphaPhiSum",
runTime.name(),
mesh
),
mesh,
dimensionedScalar(phi.dimensions(), 0)
);
for
(
subCycle<volScalarField> alphaSubCycle(alpha1, nAlphaSubCycles);
!(++alphaSubCycle).end();
)
{
#include "alphaEqn.H"
alphaPhiSum += (runTime.deltaT()/totalDeltaT)*alphaPhi;
}
alphaPhi = alphaPhiSum;
}
else
{
#include "alphaEqn.H"
}
// Apply the diffusion term separately to allow implicit solution
// and boundedness of the explicit advection
{
fvScalarMatrix alpha1Eqn
(
fvm::ddt(alpha1) - fvc::ddt(alpha1)
- fvm::laplacian(turbulence->nut(), alpha1)
);
alpha1Eqn.solve("alpha1Diffusion");
alphaPhi += alpha1Eqn.flux();
alpha2 = 1.0 - alpha1;
Info<< "Phase-1 volume fraction = "
<< alpha1.weightedAverage(mesh.Vsc()).value()
<< " Min(" << alpha1.name() << ") = " << min(alpha1).value()
<< " Max(" << alpha1.name() << ") = " << max(alpha1).value()
<< endl;
}
mixture.correct();
rhoPhi = alphaPhi*(rho1 - rho2) + phi*rho2;
}

View File

@ -1,132 +0,0 @@
Info<< "Reading field p_rgh\n" << endl;
volScalarField p_rgh
(
IOobject
(
"p_rgh",
runTime.name(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
Info<< "Reading field U\n" << endl;
volVectorField U
(
IOobject
(
"U",
runTime.name(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
#include "createPhi.H"
#include "readGravitationalAcceleration.H"
#include "readhRef.H"
#include "gh.H"
Info<< "Reading incompressibleTwoPhaseInteractingMixture\n" << endl;
incompressibleTwoPhaseInteractingMixture mixture(U, phi);
volScalarField& alpha1(mixture.alpha1());
const volScalarField& rho(mixture.rho());
// Mass flux
surfaceScalarField rhoPhi
(
IOobject
(
"rhoPhi",
runTime.name(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
fvc::interpolate(rho)*phi
);
// Dispersed phase relative velocity model
autoPtr<relativeVelocityModel> relativeVelocity
(
relativeVelocityModel::New(mixture, mixture, g)
);
// Construct compressible turbulence model
autoPtr<compressible::momentumTransportModel> turbulence
(
compressible::momentumTransportModel::New(rho, U, rhoPhi, mixture)
);
volScalarField p
(
IOobject
(
"p",
runTime.name(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
p_rgh + rho*gh
);
pressureReference pressureReference(p, p_rgh, pimple.dict());
if (p_rgh.needReference())
{
p += dimensionedScalar
(
"p",
p.dimensions(),
pressureReference.refValue()
- getRefCellValue(p, pressureReference.refCell())
);
p_rgh = p - rho*gh;
}
mesh.schemes().setFluxRequired(p_rgh.name());
mesh.schemes().setFluxRequired(alpha1.name());
// MULES Correction
tmp<surfaceScalarField> talphaPhiCorr0;
#include "createMRF.H"
#include "createFvModels.H"
#include "createFvConstraints.H"
//- Pointer to the surface momentum field
// used for ddtCorr with MRF
autoPtr<surfaceVectorField> Uf;
if (MRF.size())
{
Info<< "Constructing face momentum Uf" << endl;
// Ensure the U BCs are up-to-date before constructing Uf
U.correctBoundaryConditions();
Uf = new surfaceVectorField
(
IOobject
(
"Uf",
runTime.name(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
fvc::interpolate(U)
);
}

View File

@ -1,143 +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 <http://www.gnu.org/licenses/>.
Application
driftFluxFoam
Description
Solver for 2 incompressible fluids using the mixture approach with the
drift-flux approximation for relative motion of the phases.
Used for simulating the settling of the dispersed phase and other similar
separation problems.
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "timeSelector.H"
#include "CMULES.H"
#include "subCycle.H"
#include "incompressibleTwoPhaseInteractingMixture.H"
#include "relativeVelocityModel.H"
#include "momentumTransportModel.H"
#include "compressibleMomentumTransportModels.H"
#include "pimpleControl.H"
#include "findRefCell.H"
#include "pressureReference.H"
#include "fvModels.H"
#include "fvConstraints.H"
#include "constrainHbyA.H"
#include "constrainPressure.H"
#include "adjustPhi.H"
#include "fvcDdt.H"
#include "fvcSnGrad.H"
#include "fvcFlux.H"
#include "fvcMeshPhi.H"
#include "fvcReconstruct.H"
#include "fvmDdt.H"
#include "fvmDiv.H"
#include "fvmLaplacian.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
#include "postProcess.H"
#include "setRootCaseLists.H"
#include "createTime.H"
#include "createMesh.H"
#include "createControl.H"
#include "createTimeControls.H"
#include "createFields.H"
#include "initContinuityErrs.H"
volScalarField& alpha2(mixture.alpha2());
const dimensionedScalar& rho1 = mixture.rhod();
const dimensionedScalar& rho2 = mixture.rhoc();
turbulence->validate();
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nStarting time loop\n" << endl;
while (pimple.run(runTime))
{
#include "readTimeControls.H"
#include "CourantNo.H"
#include "setDeltaT.H"
runTime++;
Info<< "Time = " << runTime.userTimeName() << nl << endl;
// --- Pressure-velocity PIMPLE corrector loop
while (pimple.loop())
{
mixture.correct();
fvModels.correct();
#include "alphaEqnSubCycle.H"
relativeVelocity->correct();
if (pimple.predictTransport())
{
turbulence->predict();
}
#include "UEqn.H"
// --- Pressure corrector loop
while (pimple.correct())
{
#include "pEqn.H"
}
if (pimple.correctTransport())
{
turbulence->correct();
}
}
runTime.write();
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;
}
Info<< "End\n" << endl;
return 0;
}
// ************************************************************************* //

View File

@ -1,4 +0,0 @@
Info<< "Calculating field g.h\n" << endl;
dimensionedScalar ghRef(- mag(g)*hRef);
volScalarField gh("gh", (g & mesh.C()) - ghRef);
surfaceScalarField ghf("ghf", (g & mesh.Cf()) - ghRef);

View File

@ -1,71 +0,0 @@
{
volScalarField rAU("rAU", 1.0/UEqn.A());
surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU));
volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p_rgh));
surfaceScalarField phiHbyA
(
"phiHbyA",
fvc::flux(HbyA)
+ fvc::interpolate(rho*rAU)*fvc::ddtCorr(U, phi, Uf)
);
MRF.makeRelative(phiHbyA);
adjustPhi(phiHbyA, U, p_rgh);
surfaceScalarField phig
(
(
- ghf*fvc::snGrad(rho)
)*rAUf*mesh.magSf()
);
phiHbyA += phig;
// Update the pressure BCs to ensure flux consistency
constrainPressure(p_rgh, U, phiHbyA, rAUf, MRF);
while (pimple.correctNonOrthogonal())
{
fvScalarMatrix p_rghEqn
(
fvm::laplacian(rAUf, p_rgh) == fvc::div(phiHbyA)
);
p_rghEqn.setReference
(
pressureReference.refCell(),
getRefCellValue(p_rgh, pressureReference.refCell())
);
p_rghEqn.solve();
if (pimple.finalNonOrthogonalIter())
{
phi = phiHbyA - p_rghEqn.flux();
p_rgh.relax();
U = HbyA + rAU*fvc::reconstruct((phig - p_rghEqn.flux())/rAUf);
U.correctBoundaryConditions();
fvConstraints.constrain(U);
}
}
#include "continuityErrs.H"
p == p_rgh + rho*gh;
if (p_rgh.needReference())
{
p += dimensionedScalar
(
"p",
p.dimensions(),
pressureReference.refValue()
- getRefCellValue(p, pressureReference.refCell())
);
p_rgh = p - rho*gh;
}
// Correct Uf for MRF
fvc::correctUf(Uf, U, phi, MRF);
}

View File

@ -1,13 +0,0 @@
Info<< "\nReading hRef" << endl;
uniformDimensionedScalarField hRef
(
IOobject
(
"hRef",
runTime.constant(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE
),
dimensionedScalar(dimLength, 0)
);

46
bin/driftFluxFoam Executable file
View File

@ -0,0 +1,46 @@
#!/bin/sh
#------------------------------------------------------------------------------
# ========= |
# \\ / 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 <http://www.gnu.org/licenses/>.
#
# Script
# driftFluxFoam
#
# Description
# Script to inform the user that driftFluxFoam has been superseded and replaced
# by the more general incompressibleDriftFlux solver module executed by the
# foamRun application.
#
#------------------------------------------------------------------------------
cat <<EOF
driftFluxFoam has been superseded and replaced by the more general
incompressibleDriftFlux solver module executed by the foamRun application:
foamRun -solver incompressibleDriftFlux
EOF
exec env foamRun -solver incompressibleDriftFlux "$@"
#------------------------------------------------------------------------------

View File

@ -26,5 +26,6 @@ relativeVelocityModel simple;
residualAlpha 0; residualAlpha 0;
} }
sigma 0;
// ************************************************************************* // // ************************************************************************* //

View File

@ -14,7 +14,9 @@ FoamFile
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application driftFluxFoam; application foamRun;
solver incompressibleDriftFlux;
startFrom startTime; startFrom startTime;
@ -48,6 +50,8 @@ adjustTimeStep on;
maxCo 5; maxCo 5;
maxAlphaCo 1;
maxDeltaT 1; maxDeltaT 1;
// ************************************************************************* // // ************************************************************************* //

View File

@ -30,8 +30,9 @@ divSchemes
div(rhoPhi,U) Gauss linearUpwind grad(U); div(rhoPhi,U) Gauss linearUpwind grad(U);
div(tauDm) Gauss linear; div(tauDm) Gauss linear;
div(phi,alpha) Gauss vanLeer;
div(phirb,alpha) Gauss linear; div(phi,alpha) Gauss vanLeer;
div(rhoPhi,k) Gauss limitedLinear 1; div(rhoPhi,k) Gauss limitedLinear 1;
div(rhoPhi,epsilon) Gauss limitedLinear 1; div(rhoPhi,epsilon) Gauss limitedLinear 1;

View File

@ -36,6 +36,7 @@ solvers
{ {
solver PCG; solver PCG;
preconditioner DIC; preconditioner DIC;
tolerance 1e-6; tolerance 1e-6;
relTol 0; relTol 0;
minIter 1; minIter 1;
@ -44,10 +45,10 @@ solvers
p_rgh p_rgh
{ {
solver GAMG; solver GAMG;
smoother GaussSeidel;
tolerance 1e-7; tolerance 1e-7;
relTol 0.01; relTol 0.01;
smoother GaussSeidel;
nCellsInCoarsestLevel 20;
} }
p_rghFinal p_rghFinal
@ -56,10 +57,17 @@ solvers
relTol 0; relTol 0;
} }
pcorr
{
$p_rghFinal;
tolerance 1e-3;
}
"(U|k|epsilon)" "(U|k|epsilon)"
{ {
solver PBiCGStab; solver PBiCGStab;
preconditioner DILU; preconditioner DILU;
tolerance 1e-7; tolerance 1e-7;
relTol 0.1; relTol 0.1;
minIter 1; minIter 1;

View File

@ -26,5 +26,6 @@ relativeVelocityModel simple;
residualAlpha 0; residualAlpha 0;
} }
sigma 0;
// ************************************************************************* // // ************************************************************************* //

View File

@ -14,7 +14,9 @@ FoamFile
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application driftFluxFoam; application foamRun;
solver incompressibleDriftFlux;
startFrom startTime; startFrom startTime;
@ -48,7 +50,8 @@ adjustTimeStep yes;
maxCo 1; maxCo 1;
maxAlphaCo 1;
maxDeltaT 0.05; maxDeltaT 0.05;
// ************************************************************************* // // ************************************************************************* //

View File

@ -26,12 +26,13 @@ gradSchemes
divSchemes divSchemes
{ {
default none; default none;
div(rhoPhi,U) Gauss linearUpwind grad(U); div(rhoPhi,U) Gauss linearUpwind grad(U);
div(tauDm) Gauss linear; div(tauDm) Gauss linear;
div(phi,alpha) Gauss vanLeer;
div(phirb,alpha) Gauss linear; div(phi,alpha) Gauss vanLeer;
div(rhoPhi,k) Gauss limitedLinear 1; div(rhoPhi,k) Gauss limitedLinear 1;
div(rhoPhi,epsilon) Gauss limitedLinear 1; div(rhoPhi,epsilon) Gauss limitedLinear 1;

View File

@ -38,26 +38,19 @@ solvers
{ {
solver PCG; solver PCG;
preconditioner DIC; preconditioner DIC;
tolerance 1e-6; tolerance 1e-6;
relTol 0; relTol 0;
minIter 1; minIter 1;
} }
"rho.*"
{
solver PCG;
preconditioner DIC;
tolerance 1e-8;
relTol 0;
}
p_rgh p_rgh
{ {
solver GAMG; solver GAMG;
smoother GaussSeidel;
tolerance 1e-6; tolerance 1e-6;
relTol 0.05; relTol 0.05;
smoother GaussSeidel;
nCellsInCoarsestLevel 20;
} }
p_rghFinal p_rghFinal
@ -66,6 +59,12 @@ solvers
relTol 0; relTol 0;
} }
pcorr
{
$p_rghFinal;
tolerance 1e-3;
}
"(U|k|epsilon)" "(U|k|epsilon)"
{ {
solver PBiCGStab; solver PBiCGStab;
@ -91,5 +90,13 @@ PIMPLE
pRefValue 0; pRefValue 0;
} }
relaxationFactors
{
equations
{
".*" 1;
}
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -26,4 +26,6 @@ relativeVelocityModel simple;
residualAlpha 0; residualAlpha 0;
} }
sigma 0;
// ************************************************************************* // // ************************************************************************* //

View File

@ -14,7 +14,9 @@ FoamFile
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
application driftFluxFoam; application foamRun;
solver incompressibleDriftFlux;
startFrom startTime; startFrom startTime;

Some files were not shown because too many files have changed in this diff Show More