VoFSolver: New base-class for twoPhaseVoFSolver and multiphaseVoFSolver
Much of the VoF functionality, particularly relating to momentum solution, is independent of the number of phases and it is useful to hold this generic VoF data and functionality in an abstract base-class and derive twoPhaseVoFSolver and multiphaseVoFSolver from it, adding two-phase and multiphase functionality respectively.
This commit is contained in:
5
.gitignore
vendored
5
.gitignore
vendored
@ -82,5 +82,8 @@ doc/Doxygen/DTAGS
|
||||
/.dir-locals.el
|
||||
/.ycm*
|
||||
|
||||
# Ignore the test directory
|
||||
# Ignore the tutorials/log file
|
||||
/tutorials/log
|
||||
|
||||
# Ignore the tutorialsTest directory
|
||||
/tutorialsTest
|
||||
|
||||
@ -11,6 +11,7 @@ wmake $targetType fluid
|
||||
wmake $targetType multicomponentFluid
|
||||
wmake $targetType XiFluid
|
||||
wmake $targetType VoFSolver
|
||||
wmake $targetType twoPhaseVoFSolver
|
||||
incompressibleVoF/Allwmake $targetType $*
|
||||
compressibleVoF/Allwmake $targetType $*
|
||||
multiphaseEuler/Allwmake $targetType $*
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
VoFMixture/VoFMixture.C
|
||||
setRDeltaT.C
|
||||
moveMesh.C
|
||||
alphaPredictor.C
|
||||
momentumPredictor.C
|
||||
VoFSolver.C
|
||||
|
||||
|
||||
@ -0,0 +1,41 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "VoFMixture.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(VoFMixture, 0);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::VoFMixture::VoFMixture(const fvMesh& mesh)
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,92 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::VoFMixture
|
||||
|
||||
Description
|
||||
Class to represent a VoF mixture
|
||||
|
||||
SourceFiles
|
||||
VoFMixture.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef VoFMixture_H
|
||||
#define VoFMixture_H
|
||||
|
||||
#include "volFieldsFwd.H"
|
||||
#include "surfaceFieldsFwd.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
class fvMesh;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class VoFMixture Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class VoFMixture
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
TypeName("VoFMixture");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
VoFMixture(const fvMesh& mesh);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~VoFMixture()
|
||||
{}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return the mixture density
|
||||
virtual const volScalarField& rho() const = 0;
|
||||
|
||||
//- Correct the mixture properties
|
||||
virtual void correct() = 0;
|
||||
|
||||
//- Read base phaseProperties dictionary
|
||||
virtual bool read() = 0;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2022 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -41,38 +41,26 @@ namespace solvers
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::solvers::VoFSolver::correctCoNum()
|
||||
{
|
||||
fluidSolver::correctCoNum(phi);
|
||||
|
||||
const scalarField sumPhi
|
||||
(
|
||||
interface.nearInterface()().primitiveField()
|
||||
*fvc::surfaceSum(mag(phi))().primitiveField()
|
||||
);
|
||||
|
||||
alphaCoNum = 0.5*gMax(sumPhi/mesh.V().field())*runTime.deltaTValue();
|
||||
|
||||
const scalar meanAlphaCoNum =
|
||||
0.5*(gSum(sumPhi)/gSum(mesh.V().field()))*runTime.deltaTValue();
|
||||
|
||||
Info<< "Interface Courant Number mean: " << meanAlphaCoNum
|
||||
<< " max: " << alphaCoNum << endl;
|
||||
}
|
||||
|
||||
|
||||
void Foam::solvers::VoFSolver::continuityErrors()
|
||||
{
|
||||
fluidSolver::continuityErrors(phi);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
|
||||
|
||||
void Foam::solvers::VoFSolver::correctCoNum()
|
||||
{
|
||||
fluidSolver::correctCoNum(phi);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::solvers::VoFSolver::VoFSolver
|
||||
(
|
||||
fvMesh& mesh,
|
||||
autoPtr<twoPhaseMixture> mixturePtr
|
||||
autoPtr<VoFMixture> mixturePtr
|
||||
)
|
||||
:
|
||||
fluidSolver(mesh),
|
||||
@ -80,21 +68,6 @@ Foam::solvers::VoFSolver::VoFSolver
|
||||
mixture_(mixturePtr),
|
||||
mixture(mixture_()),
|
||||
|
||||
alpha1(mixture.alpha1()),
|
||||
alpha2(mixture.alpha2()),
|
||||
|
||||
alphaRestart
|
||||
(
|
||||
typeIOobject<surfaceScalarField>
|
||||
(
|
||||
IOobject::groupName("alphaPhi", alpha1.group()),
|
||||
runTime.name(),
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::AUTO_WRITE
|
||||
).headerOk()
|
||||
),
|
||||
|
||||
divAlphaName("div(phi,alpha)"),
|
||||
|
||||
U
|
||||
@ -123,8 +96,6 @@ Foam::solvers::VoFSolver::VoFSolver
|
||||
linearInterpolate(U) & mesh.Sf()
|
||||
),
|
||||
|
||||
interface(mixture, alpha1, alpha2, U),
|
||||
|
||||
buoyancy(mesh),
|
||||
|
||||
p_rgh(buoyancy.p_rgh),
|
||||
@ -144,31 +115,9 @@ Foam::solvers::VoFSolver::VoFSolver
|
||||
fvc::interpolate(rho)*phi
|
||||
),
|
||||
|
||||
alphaPhi1
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
IOobject::groupName("alphaPhi", alpha1.group()),
|
||||
runTime.name(),
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
phi*fvc::interpolate(alpha1)
|
||||
),
|
||||
|
||||
MRF(mesh)
|
||||
{
|
||||
// Read the controls
|
||||
read();
|
||||
|
||||
mesh.schemes().setFluxRequired(p_rgh.name());
|
||||
mesh.schemes().setFluxRequired(alpha1.name());
|
||||
|
||||
if (alphaRestart)
|
||||
{
|
||||
Info << "Restarting alpha" << endl;
|
||||
}
|
||||
|
||||
if (mesh.dynamic())
|
||||
{
|
||||
@ -188,11 +137,7 @@ Foam::solvers::VoFSolver::VoFSolver
|
||||
);
|
||||
}
|
||||
|
||||
if (transient())
|
||||
{
|
||||
correctCoNum();
|
||||
}
|
||||
else if (LTS)
|
||||
if (LTS)
|
||||
{
|
||||
Info<< "Using LTS" << endl;
|
||||
|
||||
@ -268,11 +213,7 @@ void Foam::solvers::VoFSolver::preSolve()
|
||||
// Store divU from the previous mesh so that it can be mapped
|
||||
// and used in correctPhi to ensure the corrected phi has the
|
||||
// same divergence
|
||||
if
|
||||
(
|
||||
correctPhi
|
||||
&& divergent()
|
||||
&& mesh.topoChanged())
|
||||
if (correctPhi && divergent())
|
||||
{
|
||||
// Construct and register divU for mapping
|
||||
divU = new volScalarField
|
||||
@ -283,21 +224,13 @@ void Foam::solvers::VoFSolver::preSolve()
|
||||
}
|
||||
|
||||
// Update the mesh for topology change, mesh to mesh mapping
|
||||
const bool topoChanged = mesh.update();
|
||||
|
||||
// Do not apply previous time-step mesh compression flux
|
||||
// if the mesh topology changed
|
||||
if (topoChanged)
|
||||
{
|
||||
talphaPhi1Corr0.clear();
|
||||
}
|
||||
mesh.update();
|
||||
}
|
||||
|
||||
|
||||
void Foam::solvers::VoFSolver::prePredictor()
|
||||
{
|
||||
fvModels().correct();
|
||||
alphaPredictor();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2022 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -56,7 +56,7 @@ See also
|
||||
#define VoFSolver_H
|
||||
|
||||
#include "fluidSolver.H"
|
||||
#include "twoPhaseMixture.H"
|
||||
#include "VoFMixture.H"
|
||||
#include "interfaceProperties.H"
|
||||
#include "buoyancy.H"
|
||||
#include "pressureReference.H"
|
||||
@ -83,18 +83,9 @@ protected:
|
||||
// Phase properties
|
||||
|
||||
//- The compressible two-phase mixture
|
||||
autoPtr<twoPhaseMixture> mixture_;
|
||||
autoPtr<VoFMixture> mixture_;
|
||||
|
||||
twoPhaseMixture& mixture;
|
||||
|
||||
//- Reference to the phase1-fraction
|
||||
volScalarField& alpha1;
|
||||
|
||||
//- Reference to the phase2-fraction
|
||||
volScalarField& alpha2;
|
||||
|
||||
//- Switch indicating if this is a restart
|
||||
bool alphaRestart;
|
||||
VoFMixture& mixture;
|
||||
|
||||
//- Name of the alpha convection scheme
|
||||
const word divAlphaName;
|
||||
@ -112,11 +103,6 @@ protected:
|
||||
surfaceScalarField phi;
|
||||
|
||||
|
||||
// Interface properties
|
||||
|
||||
interfaceProperties interface;
|
||||
|
||||
|
||||
// Thermophysical properties
|
||||
|
||||
//- Buoyancy force
|
||||
@ -135,9 +121,6 @@ protected:
|
||||
//- Mass flux field
|
||||
surfaceScalarField rhoPhi;
|
||||
|
||||
// Phase-1 volumetric flux
|
||||
surfaceScalarField alphaPhi1;
|
||||
|
||||
|
||||
// Optional models
|
||||
|
||||
@ -149,9 +132,6 @@ protected:
|
||||
|
||||
tmp<volScalarField> rAU;
|
||||
|
||||
//- MULES Correction
|
||||
tmp<surfaceScalarField> talphaPhi1Corr0;
|
||||
|
||||
//- Pointer to the surface momentum field
|
||||
// used to recreate the flux after mesh-change
|
||||
autoPtr<surfaceVectorField> Uf;
|
||||
@ -175,22 +155,19 @@ private:
|
||||
// Private Member Functions
|
||||
|
||||
//- Set rDeltaT for LTS
|
||||
virtual void setRDeltaT();
|
||||
|
||||
//- Correct the cached Courant numbers
|
||||
void correctCoNum();
|
||||
|
||||
//- Solve for the phase-fractions
|
||||
void alphaSolve(const dictionary& alphaControls);
|
||||
|
||||
//- Solve for the phase-fractions
|
||||
void alphaPredictor();
|
||||
void setRDeltaT();
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- Correct the cached Courant numbers
|
||||
virtual void correctCoNum() = 0;
|
||||
|
||||
//- Adjust the rDeltaT in the vicinity of the interface
|
||||
virtual void setInterfaceRDeltaT(volScalarField& rDeltaT) = 0;
|
||||
|
||||
//- Calculate and print the continuity errors
|
||||
void continuityErrors();
|
||||
|
||||
@ -201,16 +178,16 @@ protected:
|
||||
// i.e. compressible or include phase-fraction sources
|
||||
virtual bool divergent() = 0;
|
||||
|
||||
//- Calculate the alpha equation sources
|
||||
virtual void alphaSuSp
|
||||
(
|
||||
tmp<volScalarField::Internal>& Su,
|
||||
tmp<volScalarField::Internal>& Sp
|
||||
) = 0;
|
||||
|
||||
//- Return the momentum equation stress term
|
||||
virtual tmp<fvVectorMatrix> divDevTau(volVectorField& U) = 0;
|
||||
|
||||
//- Correct the interface properties following mesh-change
|
||||
// and phase-fraction update
|
||||
virtual void correctInterface() = 0;
|
||||
|
||||
//- Return the interface surface tension force for the momentum equation
|
||||
virtual tmp<surfaceScalarField> surfaceTensionForce() const = 0;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -221,7 +198,7 @@ public:
|
||||
// Constructors
|
||||
|
||||
//- Construct from region mesh
|
||||
VoFSolver(fvMesh& mesh, autoPtr<twoPhaseMixture>);
|
||||
VoFSolver(fvMesh& mesh, autoPtr<VoFMixture>);
|
||||
|
||||
//- Disallow default bitwise copy construction
|
||||
VoFSolver(const VoFSolver&) = delete;
|
||||
|
||||
@ -1,19 +0,0 @@
|
||||
tmp<volScalarField> divU;
|
||||
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();
|
||||
|
||||
divU =
|
||||
(
|
||||
mesh.moving()
|
||||
? fvc::div(phiCN() + mesh.phi())
|
||||
: fvc::div(phiCN())
|
||||
);
|
||||
}
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2022 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -55,7 +55,7 @@ void Foam::solvers::VoFSolver::momentumPredictor()
|
||||
fvc::reconstruct
|
||||
(
|
||||
(
|
||||
interface.surfaceTensionForce()
|
||||
surfaceTensionForce()
|
||||
- buoyancy.ghf*fvc::snGrad(rho)
|
||||
- fvc::snGrad(p_rgh)
|
||||
) * mesh.magSf()
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2022 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -101,7 +101,7 @@ bool Foam::solvers::VoFSolver::moveMesh()
|
||||
|
||||
meshCourantNo();
|
||||
|
||||
interface.correct();
|
||||
correctInterface();
|
||||
|
||||
divU.clear();
|
||||
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2022 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -24,9 +24,7 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "VoFSolver.H"
|
||||
#include "fvcSmooth.H"
|
||||
#include "fvcSurfaceIntegrate.H"
|
||||
#include "fvcAverage.H"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
@ -41,41 +39,6 @@ void Foam::solvers::VoFSolver::setRDeltaT()
|
||||
pimpleDict.lookupOrDefault<scalar>("maxCo", 0.9)
|
||||
);
|
||||
|
||||
const scalar maxAlphaCo
|
||||
(
|
||||
pimpleDict.lookupOrDefault<scalar>("maxAlphaCo", 0.2)
|
||||
);
|
||||
|
||||
const scalar rDeltaTSmoothingCoeff
|
||||
(
|
||||
pimpleDict.lookupOrDefault<scalar>("rDeltaTSmoothingCoeff", 0.1)
|
||||
);
|
||||
|
||||
const label nAlphaSpreadIter
|
||||
(
|
||||
pimpleDict.lookupOrDefault<label>("nAlphaSpreadIter", 1)
|
||||
);
|
||||
|
||||
const scalar alphaSpreadDiff
|
||||
(
|
||||
pimpleDict.lookupOrDefault<scalar>("alphaSpreadDiff", 0.2)
|
||||
);
|
||||
|
||||
const scalar alphaSpreadMax
|
||||
(
|
||||
pimpleDict.lookupOrDefault<scalar>("alphaSpreadMax", 0.99)
|
||||
);
|
||||
|
||||
const scalar alphaSpreadMin
|
||||
(
|
||||
pimpleDict.lookupOrDefault<scalar>("alphaSpreadMin", 0.01)
|
||||
);
|
||||
|
||||
const label nAlphaSweepIter
|
||||
(
|
||||
pimpleDict.lookupOrDefault<label>("nAlphaSweepIter", 5)
|
||||
);
|
||||
|
||||
const scalar maxDeltaT
|
||||
(
|
||||
pimpleDict.lookupOrDefault<scalar>("maxDeltaT", great)
|
||||
@ -101,56 +64,11 @@ void Foam::solvers::VoFSolver::setRDeltaT()
|
||||
)
|
||||
);
|
||||
|
||||
if (maxAlphaCo < maxCo)
|
||||
{
|
||||
// Further limit the reciprocal time-step
|
||||
// in the vicinity of the interface
|
||||
|
||||
volScalarField alpha1Bar(fvc::average(alpha1));
|
||||
|
||||
rDeltaT.ref() = max
|
||||
(
|
||||
rDeltaT(),
|
||||
pos0(alpha1Bar() - alphaSpreadMin)
|
||||
*pos0(alphaSpreadMax - alpha1Bar())
|
||||
*fvc::surfaceSum(mag(phi))()()
|
||||
/((2*maxAlphaCo)*mesh.V())
|
||||
);
|
||||
}
|
||||
|
||||
// Update the boundary values of the reciprocal time-step
|
||||
rDeltaT.correctBoundaryConditions();
|
||||
|
||||
Info<< "Flow time scale min/max = "
|
||||
<< gMin(1/rDeltaT.primitiveField())
|
||||
<< ", " << gMax(1/rDeltaT.primitiveField()) << endl;
|
||||
|
||||
if (rDeltaTSmoothingCoeff < 1.0)
|
||||
{
|
||||
fvc::smooth(rDeltaT, rDeltaTSmoothingCoeff);
|
||||
}
|
||||
|
||||
if (nAlphaSpreadIter > 0)
|
||||
{
|
||||
fvc::spread
|
||||
(
|
||||
rDeltaT,
|
||||
alpha1,
|
||||
nAlphaSpreadIter,
|
||||
alphaSpreadDiff,
|
||||
alphaSpreadMax,
|
||||
alphaSpreadMin
|
||||
);
|
||||
}
|
||||
|
||||
if (nAlphaSweepIter > 0)
|
||||
{
|
||||
fvc::sweep(rDeltaT, alpha1, nAlphaSweepIter, alphaSpreadDiff);
|
||||
}
|
||||
|
||||
Info<< "Smoothed flow time scale min/max = "
|
||||
<< gMin(1/rDeltaT.primitiveField())
|
||||
<< ", " << gMax(1/rDeltaT.primitiveField()) << endl;
|
||||
setInterfaceRDeltaT(rDeltaT);
|
||||
|
||||
// Limit rate of change of time scale
|
||||
// - reduce as much as required
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
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 \
|
||||
@ -16,7 +17,7 @@ EXE_INC = \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude
|
||||
|
||||
LIB_LIBS = \
|
||||
-lVoFSolver \
|
||||
-ltwoPhaseVoFSolver \
|
||||
-lphysicalProperties \
|
||||
-lfluidThermophysicalModels \
|
||||
-linterfaceCompression \
|
||||
|
||||
@ -40,7 +40,7 @@ Foam::compressibleTwoPhaseMixture::compressibleTwoPhaseMixture
|
||||
const fvMesh& mesh
|
||||
)
|
||||
:
|
||||
twoPhaseMixture(mesh),
|
||||
twoPhaseVoFMixture(mesh),
|
||||
|
||||
totalInternalEnergy_
|
||||
(
|
||||
@ -205,7 +205,7 @@ Foam::tmp<Foam::scalarField> Foam::compressibleTwoPhaseMixture::nu
|
||||
|
||||
bool Foam::compressibleTwoPhaseMixture::read()
|
||||
{
|
||||
if (twoPhaseMixture::read())
|
||||
if (twoPhaseVoFMixture::read())
|
||||
{
|
||||
totalInternalEnergy_ =
|
||||
lookupOrDefault<Switch>("totalInternalEnergy", true);
|
||||
|
||||
@ -35,7 +35,7 @@ SourceFiles
|
||||
#ifndef compressibleTwoPhaseMixture_H
|
||||
#define compressibleTwoPhaseMixture_H
|
||||
|
||||
#include "twoPhaseMixture.H"
|
||||
#include "twoPhaseVoFMixture.H"
|
||||
#include "compressibleTwoPhases.H"
|
||||
#include "rhoThermo.H"
|
||||
|
||||
@ -50,7 +50,7 @@ namespace Foam
|
||||
|
||||
class compressibleTwoPhaseMixture
|
||||
:
|
||||
public twoPhaseMixture,
|
||||
public twoPhaseVoFMixture,
|
||||
virtual public compressibleTwoPhases,
|
||||
public viscosity
|
||||
{
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2022 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -44,13 +44,13 @@ namespace solvers
|
||||
|
||||
Foam::solvers::compressibleVoF::compressibleVoF(fvMesh& mesh)
|
||||
:
|
||||
VoFSolver
|
||||
twoPhaseVoFSolver
|
||||
(
|
||||
mesh,
|
||||
autoPtr<twoPhaseMixture>(new compressibleTwoPhaseMixture(mesh))
|
||||
autoPtr<twoPhaseVoFMixture>(new compressibleTwoPhaseMixture(mesh))
|
||||
),
|
||||
|
||||
mixture(refCast<compressibleTwoPhaseMixture>(VoFSolver::mixture)),
|
||||
mixture(refCast<compressibleTwoPhaseMixture>(twoPhaseVoFSolver::mixture)),
|
||||
|
||||
p(mixture.p()),
|
||||
|
||||
@ -142,7 +142,7 @@ Foam::solvers::compressibleVoF::~compressibleVoF()
|
||||
|
||||
void Foam::solvers::compressibleVoF::prePredictor()
|
||||
{
|
||||
VoFSolver::prePredictor();
|
||||
twoPhaseVoFSolver::prePredictor();
|
||||
|
||||
const volScalarField& rho1 = mixture.thermo1().rho();
|
||||
const volScalarField& rho2 = mixture.thermo2().rho();
|
||||
@ -178,7 +178,7 @@ void Foam::solvers::compressibleVoF::prePredictor()
|
||||
|
||||
void Foam::solvers::compressibleVoF::momentumPredictor()
|
||||
{
|
||||
VoFSolver::momentumPredictor();
|
||||
twoPhaseVoFSolver::momentumPredictor();
|
||||
|
||||
if (pimple.momentumPredictor())
|
||||
{
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2022 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -50,6 +50,7 @@ SourceFiles
|
||||
|
||||
See also
|
||||
Foam::solvers::VoFSolver
|
||||
Foam::solvers::twoPhaseVoFSolver
|
||||
Foam::solvers::incompressibleVoF
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
@ -57,7 +58,7 @@ See also
|
||||
#ifndef compressibleVoF_H
|
||||
#define compressibleVoF_H
|
||||
|
||||
#include "VoFSolver.H"
|
||||
#include "twoPhaseVoFSolver.H"
|
||||
#include "compressibleTwoPhaseMixture.H"
|
||||
#include "compressibleInterPhaseTransportModel.H"
|
||||
#include "compressibleInterPhaseThermophysicalTransportModel.H"
|
||||
@ -78,7 +79,7 @@ namespace solvers
|
||||
|
||||
class compressibleVoF
|
||||
:
|
||||
public VoFSolver
|
||||
public twoPhaseVoFSolver
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
EXE_INC = \
|
||||
-I$(FOAM_SOLVERS)/modules/twoPhaseVoFSolver/lnInclude \
|
||||
-I$(FOAM_SOLVERS)/modules/VoFSolver/lnInclude \
|
||||
-I$(FOAM_SOLVERS)/modules/compressibleVoF/lnInclude \
|
||||
-I$(LIB_SRC)/physicalProperties/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
EXE_INC = \
|
||||
-I$(FOAM_SOLVERS)/modules/twoPhaseVoFSolver/lnInclude \
|
||||
-I$(FOAM_SOLVERS)/modules/VoFSolver/lnInclude \
|
||||
-I$(FOAM_SOLVERS)/modules/compressibleVoF/lnInclude \
|
||||
-I$(LIB_SRC)/physicalProperties/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
EXE_INC = \
|
||||
-I$(FOAM_SOLVERS)/modules/twoPhaseVoFSolver/lnInclude \
|
||||
-I$(FOAM_SOLVERS)/modules/VoFSolver/lnInclude \
|
||||
-I$(FOAM_SOLVERS)/modules/compressibleVoF/lnInclude \
|
||||
-I$(LIB_SRC)/physicalProperties/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
EXE_INC = \
|
||||
-I$(FOAM_SOLVERS)/modules/twoPhaseVoFSolver/lnInclude \
|
||||
-I$(FOAM_SOLVERS)/modules/VoFSolver/lnInclude \
|
||||
-I$(FOAM_SOLVERS)/modules/compressibleVoF/lnInclude \
|
||||
-I$(LIB_SRC)/physicalProperties/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
EXE_INC = \
|
||||
-I$(FOAM_SOLVERS)/modules/twoPhaseVoFSolver/lnInclude \
|
||||
-I$(FOAM_SOLVERS)/modules/VoFSolver/lnInclude \
|
||||
-I$(FOAM_SOLVERS)/modules/compressibleVoF/lnInclude \
|
||||
-I$(LIB_SRC)/physicalProperties/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
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 \
|
||||
@ -15,7 +16,7 @@ EXE_INC = \
|
||||
-I$(LIB_SRC)/sampling/lnInclude
|
||||
|
||||
LIB_LIBS = \
|
||||
-lVoFSolver \
|
||||
-ltwoPhaseVoFSolver \
|
||||
-lphysicalProperties \
|
||||
-linterfaceCompression \
|
||||
-lincompressibleTwoPhases \
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
EXE_INC = \
|
||||
-I$(FOAM_SOLVERS)/modules/twoPhaseVoFSolver/lnInclude \
|
||||
-I$(FOAM_SOLVERS)/modules/VoFSolver/lnInclude \
|
||||
-I$(FOAM_SOLVERS)/modules/incompressibleVoF/lnInclude \
|
||||
-I$(LIB_SRC)/physicalProperties/lnInclude \
|
||||
-I$(LIB_SRC)/twoPhaseModels/twoPhaseMixture/lnInclude \
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
EXE_INC = \
|
||||
-I$(FOAM_SOLVERS)/modules/twoPhaseVoFSolver/lnInclude \
|
||||
-I$(FOAM_SOLVERS)/modules/VoFSolver/lnInclude \
|
||||
-I$(FOAM_SOLVERS)/modules/incompressibleVoF/lnInclude \
|
||||
-I$(LIB_SRC)/physicalProperties/lnInclude \
|
||||
-I$(LIB_SRC)/twoPhaseModels/twoPhaseMixture/lnInclude \
|
||||
|
||||
@ -42,7 +42,7 @@ Foam::incompressibleTwoPhaseMixture::incompressibleTwoPhaseMixture
|
||||
const fvMesh& mesh
|
||||
)
|
||||
:
|
||||
twoPhaseMixture(mesh),
|
||||
twoPhaseVoFMixture(mesh),
|
||||
|
||||
nuModel1_(viscosityModel::New(mesh, phase1Name())),
|
||||
nuModel2_(viscosityModel::New(mesh, phase2Name())),
|
||||
@ -138,7 +138,7 @@ Foam::incompressibleTwoPhaseMixture::nuf() const
|
||||
|
||||
bool Foam::incompressibleTwoPhaseMixture::read()
|
||||
{
|
||||
if (twoPhaseMixture::read())
|
||||
if (twoPhaseVoFMixture::read())
|
||||
{
|
||||
nuModel1_->lookup("rho") >> rho1_;
|
||||
nuModel2_->lookup("rho") >> rho2_;
|
||||
|
||||
@ -35,7 +35,7 @@ SourceFiles
|
||||
#ifndef incompressibleTwoPhaseMixture_H
|
||||
#define incompressibleTwoPhaseMixture_H
|
||||
|
||||
#include "twoPhaseMixture.H"
|
||||
#include "twoPhaseVoFMixture.H"
|
||||
#include "incompressibleTwoPhases.H"
|
||||
#include "viscosityModel.H"
|
||||
|
||||
@ -50,7 +50,7 @@ namespace Foam
|
||||
|
||||
class incompressibleTwoPhaseMixture
|
||||
:
|
||||
public twoPhaseMixture,
|
||||
public twoPhaseVoFMixture,
|
||||
virtual public incompressibleTwoPhases,
|
||||
public viscosity
|
||||
{
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2022 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -45,13 +45,13 @@ namespace solvers
|
||||
|
||||
Foam::solvers::incompressibleVoF::incompressibleVoF(fvMesh& mesh)
|
||||
:
|
||||
VoFSolver
|
||||
twoPhaseVoFSolver
|
||||
(
|
||||
mesh,
|
||||
autoPtr<twoPhaseMixture>(new incompressibleTwoPhaseMixture(mesh))
|
||||
autoPtr<twoPhaseVoFMixture>(new incompressibleTwoPhaseMixture(mesh))
|
||||
),
|
||||
|
||||
mixture(refCast<incompressibleTwoPhaseMixture>(VoFSolver::mixture)),
|
||||
mixture(refCast<incompressibleTwoPhaseMixture>(twoPhaseVoFSolver::mixture)),
|
||||
|
||||
p
|
||||
(
|
||||
@ -145,7 +145,7 @@ Foam::solvers::incompressibleVoF::~incompressibleVoF()
|
||||
|
||||
void Foam::solvers::incompressibleVoF::prePredictor()
|
||||
{
|
||||
VoFSolver::prePredictor();
|
||||
twoPhaseVoFSolver::prePredictor();
|
||||
|
||||
const dimensionedScalar& rho1 = mixture.rho1();
|
||||
const dimensionedScalar& rho2 = mixture.rho2();
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2022 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2022-2023 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -50,6 +50,7 @@ SourceFiles
|
||||
|
||||
See also
|
||||
Foam::solvers::VoFSolver
|
||||
Foam::solvers::twoPhaseVoFSolver
|
||||
Foam::solvers::compressibleVoF
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
@ -57,7 +58,7 @@ See also
|
||||
#ifndef incompressibleVoF_H
|
||||
#define incompressibleVoF_H
|
||||
|
||||
#include "VoFSolver.H"
|
||||
#include "twoPhaseVoFSolver.H"
|
||||
#include "incompressibleTwoPhaseMixture.H"
|
||||
#include "incompressibleInterPhaseTransportModel.H"
|
||||
|
||||
@ -74,7 +75,7 @@ namespace solvers
|
||||
|
||||
class incompressibleVoF
|
||||
:
|
||||
public VoFSolver
|
||||
public twoPhaseVoFSolver
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
@ -0,0 +1,6 @@
|
||||
twoPhaseVoFMixture/twoPhaseVoFMixture.C
|
||||
setInterfaceRDeltaT.C
|
||||
alphaPredictor.C
|
||||
twoPhaseVoFSolver.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libtwoPhaseVoFSolver
|
||||
24
applications/solvers/modules/twoPhaseVoFSolver/Make/options
Normal file
24
applications/solvers/modules/twoPhaseVoFSolver/Make/options
Normal file
@ -0,0 +1,24 @@
|
||||
EXE_INC = \
|
||||
-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)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/sampling/lnInclude
|
||||
|
||||
LIB_LIBS = \
|
||||
-lVoFSolver \
|
||||
-lfluidSolver \
|
||||
-lphysicalProperties \
|
||||
-linterfaceCompression \
|
||||
-linterfaceProperties \
|
||||
-ltwoPhaseMixture \
|
||||
-lfiniteVolume \
|
||||
-lmeshTools \
|
||||
-lfvModels \
|
||||
-lfvConstraints \
|
||||
-lsampling
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration | Website: https://openfoam.org
|
||||
\\ / A nd | Copyright (C) 2022 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2023 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -23,7 +23,7 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "VoFSolver.H"
|
||||
#include "twoPhaseVoFSolver.H"
|
||||
#include "subCycle.H"
|
||||
#include "interfaceCompression.H"
|
||||
#include "CMULES.H"
|
||||
@ -33,7 +33,10 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::solvers::VoFSolver::alphaSolve(const dictionary& alphaControls)
|
||||
void Foam::solvers::twoPhaseVoFSolver::alphaSolve
|
||||
(
|
||||
const dictionary& alphaControls
|
||||
)
|
||||
{
|
||||
const label nAlphaSubCycles(alphaControls.lookup<label>("nAlphaSubCycles"));
|
||||
|
||||
@ -339,7 +342,7 @@ void Foam::solvers::VoFSolver::alphaSolve(const dictionary& alphaControls)
|
||||
}
|
||||
|
||||
|
||||
void Foam::solvers::VoFSolver::alphaPredictor()
|
||||
void Foam::solvers::twoPhaseVoFSolver::alphaPredictor()
|
||||
{
|
||||
const dictionary& alphaControls = mesh.solution().solverDict(alpha1.name());
|
||||
|
||||
@ -0,0 +1,133 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "twoPhaseVoFSolver.H"
|
||||
#include "fvcSmooth.H"
|
||||
#include "fvcSurfaceIntegrate.H"
|
||||
#include "fvcAverage.H"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::solvers::twoPhaseVoFSolver::setInterfaceRDeltaT
|
||||
(
|
||||
volScalarField& rDeltaT
|
||||
)
|
||||
{
|
||||
const dictionary& pimpleDict = pimple.dict();
|
||||
|
||||
const scalar maxCo
|
||||
(
|
||||
pimpleDict.lookupOrDefault<scalar>("maxCo", 0.9)
|
||||
);
|
||||
|
||||
const scalar maxAlphaCo
|
||||
(
|
||||
pimpleDict.lookupOrDefault<scalar>("maxAlphaCo", 0.2)
|
||||
);
|
||||
|
||||
const scalar rDeltaTSmoothingCoeff
|
||||
(
|
||||
pimpleDict.lookupOrDefault<scalar>("rDeltaTSmoothingCoeff", 0.1)
|
||||
);
|
||||
|
||||
const label nAlphaSpreadIter
|
||||
(
|
||||
pimpleDict.lookupOrDefault<label>("nAlphaSpreadIter", 1)
|
||||
);
|
||||
|
||||
const scalar alphaSpreadDiff
|
||||
(
|
||||
pimpleDict.lookupOrDefault<scalar>("alphaSpreadDiff", 0.2)
|
||||
);
|
||||
|
||||
const scalar alphaSpreadMax
|
||||
(
|
||||
pimpleDict.lookupOrDefault<scalar>("alphaSpreadMax", 0.99)
|
||||
);
|
||||
|
||||
const scalar alphaSpreadMin
|
||||
(
|
||||
pimpleDict.lookupOrDefault<scalar>("alphaSpreadMin", 0.01)
|
||||
);
|
||||
|
||||
const label nAlphaSweepIter
|
||||
(
|
||||
pimpleDict.lookupOrDefault<label>("nAlphaSweepIter", 5)
|
||||
);
|
||||
|
||||
if (maxAlphaCo < maxCo)
|
||||
{
|
||||
// Further limit the reciprocal time-step
|
||||
// in the vicinity of the interface
|
||||
|
||||
volScalarField alpha1Bar(fvc::average(alpha1));
|
||||
|
||||
rDeltaT.ref() = max
|
||||
(
|
||||
rDeltaT(),
|
||||
pos0(alpha1Bar() - alphaSpreadMin)
|
||||
*pos0(alphaSpreadMax - alpha1Bar())
|
||||
*fvc::surfaceSum(mag(phi))()()
|
||||
/((2*maxAlphaCo)*mesh.V())
|
||||
);
|
||||
}
|
||||
|
||||
// Update the boundary values of the reciprocal time-step
|
||||
rDeltaT.correctBoundaryConditions();
|
||||
|
||||
Info<< "Flow and interface time scale min/max = "
|
||||
<< gMin(1/rDeltaT.primitiveField())
|
||||
<< ", " << gMax(1/rDeltaT.primitiveField()) << endl;
|
||||
|
||||
if (rDeltaTSmoothingCoeff < 1.0)
|
||||
{
|
||||
fvc::smooth(rDeltaT, rDeltaTSmoothingCoeff);
|
||||
}
|
||||
|
||||
if (nAlphaSpreadIter > 0)
|
||||
{
|
||||
fvc::spread
|
||||
(
|
||||
rDeltaT,
|
||||
alpha1,
|
||||
nAlphaSpreadIter,
|
||||
alphaSpreadDiff,
|
||||
alphaSpreadMax,
|
||||
alphaSpreadMin
|
||||
);
|
||||
}
|
||||
|
||||
if (nAlphaSweepIter > 0)
|
||||
{
|
||||
fvc::sweep(rDeltaT, alpha1, nAlphaSweepIter, alphaSpreadDiff);
|
||||
}
|
||||
|
||||
Info<< "Smoothed flow time scale min/max = "
|
||||
<< gMin(1/rDeltaT.primitiveField())
|
||||
<< ", " << gMax(1/rDeltaT.primitiveField()) << endl;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,44 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "twoPhaseVoFMixture.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(twoPhaseVoFMixture, 0);
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::twoPhaseVoFMixture::twoPhaseVoFMixture(const fvMesh& mesh)
|
||||
:
|
||||
VoFMixture(mesh),
|
||||
twoPhaseMixture(mesh)
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,93 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::twoPhaseVoFMixture
|
||||
|
||||
Description
|
||||
Class to represent a VoF mixture
|
||||
|
||||
SourceFiles
|
||||
twoPhaseVoFMixture.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef twoPhaseVoFMixture_H
|
||||
#define twoPhaseVoFMixture_H
|
||||
|
||||
#include "VoFMixture.H"
|
||||
#include "twoPhaseMixture.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class twoPhaseVoFMixture Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class twoPhaseVoFMixture
|
||||
:
|
||||
public VoFMixture,
|
||||
public twoPhaseMixture
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
TypeName("twoPhaseVoFMixture");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
twoPhaseVoFMixture(const fvMesh& mesh);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~twoPhaseVoFMixture()
|
||||
{}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return the mixture density
|
||||
using twoPhaseMixture::rho;
|
||||
|
||||
//- Correct the mixture properties
|
||||
using twoPhaseMixture::correct;
|
||||
|
||||
//- Read base phaseProperties dictionary
|
||||
using twoPhaseMixture::read;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,164 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "twoPhaseVoFSolver.H"
|
||||
#include "localEulerDdtScheme.H"
|
||||
#include "CorrectPhi.H"
|
||||
#include "geometricZeroField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace solvers
|
||||
{
|
||||
defineTypeNameAndDebug(twoPhaseVoFSolver, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void Foam::solvers::twoPhaseVoFSolver::correctCoNum()
|
||||
{
|
||||
VoFSolver::correctCoNum();
|
||||
|
||||
const scalarField sumPhi
|
||||
(
|
||||
interface.nearInterface()().primitiveField()
|
||||
*fvc::surfaceSum(mag(phi))().primitiveField()
|
||||
);
|
||||
|
||||
alphaCoNum = 0.5*gMax(sumPhi/mesh.V().field())*runTime.deltaTValue();
|
||||
|
||||
const scalar meanAlphaCoNum =
|
||||
0.5*(gSum(sumPhi)/gSum(mesh.V().field()))*runTime.deltaTValue();
|
||||
|
||||
Info<< "Interface Courant Number mean: " << meanAlphaCoNum
|
||||
<< " max: " << alphaCoNum << endl;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * //
|
||||
|
||||
void Foam::solvers::twoPhaseVoFSolver::correctInterface()
|
||||
{
|
||||
return interface.correct();
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::surfaceScalarField>
|
||||
Foam::solvers::twoPhaseVoFSolver::surfaceTensionForce() const
|
||||
{
|
||||
return interface.surfaceTensionForce();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::solvers::twoPhaseVoFSolver::twoPhaseVoFSolver
|
||||
(
|
||||
fvMesh& mesh,
|
||||
autoPtr<twoPhaseVoFMixture> mixturePtr
|
||||
)
|
||||
:
|
||||
VoFSolver(mesh, autoPtr<VoFMixture>(mixturePtr.ptr())),
|
||||
|
||||
mixture(refCast<twoPhaseVoFMixture>(VoFSolver::mixture)),
|
||||
|
||||
alpha1(mixture.alpha1()),
|
||||
alpha2(mixture.alpha2()),
|
||||
|
||||
alphaRestart
|
||||
(
|
||||
typeIOobject<surfaceScalarField>
|
||||
(
|
||||
IOobject::groupName("alphaPhi", alpha1.group()),
|
||||
runTime.name(),
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::AUTO_WRITE
|
||||
).headerOk()
|
||||
),
|
||||
|
||||
interface(mixture, alpha1, alpha2, U),
|
||||
|
||||
alphaPhi1
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
IOobject::groupName("alphaPhi", alpha1.group()),
|
||||
runTime.name(),
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
phi*fvc::interpolate(alpha1)
|
||||
)
|
||||
{
|
||||
mesh.schemes().setFluxRequired(alpha1.name());
|
||||
|
||||
if (alphaRestart)
|
||||
{
|
||||
Info << "Restarting alpha" << endl;
|
||||
}
|
||||
|
||||
if (transient())
|
||||
{
|
||||
correctCoNum();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::solvers::twoPhaseVoFSolver::~twoPhaseVoFSolver()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::solvers::twoPhaseVoFSolver::preSolve()
|
||||
{
|
||||
VoFSolver::preSolve();
|
||||
|
||||
// Do not apply previous time-step mesh compression flux
|
||||
// if the mesh topology changed
|
||||
if (mesh().topoChanged())
|
||||
{
|
||||
talphaPhi1Corr0.clear();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void Foam::solvers::twoPhaseVoFSolver::prePredictor()
|
||||
{
|
||||
VoFSolver::prePredictor();
|
||||
|
||||
alphaPredictor();
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,195 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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::twoPhaseVoFSolver
|
||||
|
||||
Description
|
||||
Solver module base-class for for 2 immiscible fluids using a VOF (volume
|
||||
of fluid) phase-fraction based interface capturing approach, 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.
|
||||
|
||||
Either mixture or two-phase transport modelling may be selected. In the
|
||||
mixture approach a single laminar, RAS or LES model is selected to model the
|
||||
momentum stress. In the Euler-Euler two-phase approach separate laminar,
|
||||
RAS or LES selected models are selected for each of the phases.
|
||||
|
||||
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
|
||||
twoPhaseVoFSolver.C
|
||||
|
||||
See also
|
||||
Foam::solvers::fluidSolver
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef twoPhaseVoFSolver_H
|
||||
#define twoPhaseVoFSolver_H
|
||||
|
||||
#include "VoFSolver.H"
|
||||
#include "twoPhaseVoFMixture.H"
|
||||
#include "interfaceProperties.H"
|
||||
#include "buoyancy.H"
|
||||
#include "pressureReference.H"
|
||||
#include "IOMRFZoneList.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace solvers
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class twoPhaseVoFSolver Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class twoPhaseVoFSolver
|
||||
:
|
||||
public VoFSolver
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
// Phase properties
|
||||
|
||||
//- Reference to the twoPhaseVoFMixture
|
||||
twoPhaseVoFMixture& mixture;
|
||||
|
||||
//- Reference to the phase1-fraction
|
||||
volScalarField& alpha1;
|
||||
|
||||
//- Reference to the phase2-fraction
|
||||
volScalarField& alpha2;
|
||||
|
||||
//- Switch indicating if this is a restart
|
||||
bool alphaRestart;
|
||||
|
||||
|
||||
// Interface properties
|
||||
|
||||
interfaceProperties interface;
|
||||
|
||||
|
||||
// Kinematic properties
|
||||
|
||||
// Phase-1 volumetric flux
|
||||
surfaceScalarField alphaPhi1;
|
||||
|
||||
|
||||
// Cached temporary fields
|
||||
|
||||
//- MULES Correction
|
||||
tmp<surfaceScalarField> talphaPhi1Corr0;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Correct the cached Courant numbers
|
||||
void correctCoNum();
|
||||
|
||||
//- Solve for the phase-fractions
|
||||
void alphaSolve(const dictionary& alphaControls);
|
||||
|
||||
//- Solve for the phase-fractions
|
||||
void alphaPredictor();
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- Adjust the rDeltaT in the vicinity of the interface
|
||||
virtual void setInterfaceRDeltaT(volScalarField& rDeltaT);
|
||||
|
||||
//- Calculate the alpha equation sources
|
||||
virtual void alphaSuSp
|
||||
(
|
||||
tmp<volScalarField::Internal>& Su,
|
||||
tmp<volScalarField::Internal>& Sp
|
||||
) = 0;
|
||||
|
||||
//- Correct the interface properties following mesh-change
|
||||
// and phase-fraction update
|
||||
virtual void correctInterface();
|
||||
|
||||
//- Return the interface surface tension force for the momentum equation
|
||||
virtual tmp<surfaceScalarField> surfaceTensionForce() const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("twoPhaseVoFSolver");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from region mesh
|
||||
twoPhaseVoFSolver(fvMesh& mesh, autoPtr<twoPhaseVoFMixture>);
|
||||
|
||||
//- Disallow default bitwise copy construction
|
||||
twoPhaseVoFSolver(const twoPhaseVoFSolver&) = delete;
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~twoPhaseVoFSolver();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Called at the start of the time-step, before the PIMPLE loop
|
||||
virtual void preSolve();
|
||||
|
||||
//- Called at the start of the PIMPLE loop
|
||||
virtual void prePredictor();
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const twoPhaseVoFSolver&) = delete;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace solvers
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
Reference in New Issue
Block a user