compressibleVoF: Replaced twoPhaseChangeModel with the VoFCavitation fvModel

Replacing the specific twoPhaseChangeModel with a consistent and general fvModel
interface will support not just cavitation using the new compressible
VoFCavitation fvModel but also other phase-change and interface manipulation
models in the future and is easier to use for case-specific and other user
customisation.

Class
    Foam::fv::compressible::VoFCavitation

Description
    Cavitation fvModel

Usage
    Example usage:
    \verbatim
    VoFCavitation
    {
        type    VoFCavitation;

        libs    ("libcompressibleVoFCavitation.so");

        model   SchnerrSauer;

        KunzCoeffs
        {
            pSat    2300;   // Saturation pressure

            UInf    20.0;
            tInf    0.005; // L = 0.1 m
            Cc      1000;
            Cv      1000;
        }

        MerkleCoeffs
        {
            pSat    2300;   // Saturation pressure

            UInf    20.0;
            tInf    0.005;  // L = 0.1 m
            Cc      80;
            Cv      1e-03;
        }

        SchnerrSauerCoeffs
        {
            pSat    2300;   // Saturation pressure

            n       1.6e+13;
            dNuc    2.0e-06;
            Cc      1;
            Cv      1;
        }
    }
    \endverbatim

The cavitating ballValve tutorial has been updated to use the new VoFCavitation
fvModel.
This commit is contained in:
Henry Weller
2022-09-28 13:02:47 +01:00
parent d3df91a5eb
commit 9dc91eb479
58 changed files with 667 additions and 888 deletions

View File

@ -3,11 +3,13 @@ cd ${0%/*} || exit 1 # Run from this directory
wclean libso compressibleTwoPhaseMixture
wclean libso surfaceTensionModels
wclean libso twoPhaseChange
wclean libso compressibleInterPhaseTransportModel
wclean libso VoFTurbulenceDamping
wclean libso VoFClouds
wclean libso VoFSurfaceFilm
wclean libso fvModels/VoFTurbulenceDamping
wclean libso fvModels/VoFClouds
wclean libso fvModels/VoFSurfaceFilm
wclean libso fvModels/VoFCavitation
wclean libso fvModels/VoFSolidificationMeltingSource
wclean

View File

@ -6,11 +6,13 @@ cd ${0%/*} || exit 1 # Run from this directory
wmake $targetType compressibleTwoPhaseMixture
wmake $targetType surfaceTensionModels
wmake $targetType twoPhaseChange
wmake $targetType compressibleInterPhaseTransportModel
wmake $targetType VoFTurbulenceDamping
wmake $targetType VoFClouds
wmake $targetType VoFSurfaceFilm
wmake $targetType fvModels/VoFTurbulenceDamping
wmake $targetType fvModels/VoFClouds
wmake $targetType fvModels/VoFSurfaceFilm
wmake $targetType fvModels/VoFCavitation
wmake $targetType fvModels/VoFSolidificationMeltingSource
wmake $targetType

View File

@ -2,7 +2,6 @@ EXE_INC = \
-I$(FOAM_SOLVERS)/modules/fluid/fluidSolver/lnInclude \
-IcompressibleTwoPhaseMixture \
-IcompressibleInterPhaseTransportModel/lnInclude \
-ItwoPhaseChange/lnInclude \
-I$(LIB_SRC)/physicalProperties/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/twoPhaseModels/twoPhaseMixture/lnInclude \
@ -21,7 +20,6 @@ LIB_LIBS = \
-ltwoPhaseMixture \
-ltwoPhaseProperties \
-linterfaceProperties \
-lcompressibleTwoPhaseChangeModels \
-lcompressibleInterPhaseTransportModel \
-lfiniteVolume \
-lfvModels \

View File

@ -18,16 +18,13 @@ tmp<volScalarField::Internal> Su
)
);
// Phase change alpha1 source
Pair<tmp<volScalarField::Internal>> phaseChangeS
(
phaseChange.Salpha(alpha1)
);
if (phaseChangeS[0].valid())
if (fvModels().addsSupToField(alpha1.name()))
{
Su = phaseChangeS[0];
Sp = phaseChangeS[1];
// Phase change alpha1 source
const fvScalarMatrix alphaSup(fvModels().source(alpha1));
Su = alphaSup.Su();
Sp = alphaSup.Sp();
}
volScalarField::Internal& SpRef = Sp.ref();

View File

@ -188,13 +188,6 @@ Foam::solvers::compressibleVoF::compressibleVoF(fvMesh& mesh)
mixture
),
phaseChangePtr
(
compressible::twoPhaseChangeModel::New(mixture)
),
phaseChange(*phaseChangePtr),
MRF(mesh)
{
// Read the controls

View File

@ -59,7 +59,6 @@ See also
#include "fluidSolver.H"
#include "compressibleInterPhaseTransportModel.H"
#include "twoPhaseChangeModel.H"
#include "buoyancy.H"
#include "pressureReference.H"
@ -147,10 +146,6 @@ protected:
//- Momentum transport model
compressibleInterPhaseTransportModel turbulence;
autoPtr<compressible::twoPhaseChangeModel> phaseChangePtr;
compressible::twoPhaseChangeModel& phaseChange;
// Optional models

View File

@ -0,0 +1,9 @@
cavitation/cavitationModel/cavitationModel.C
cavitation/cavitationModel/cavitationModelNew.C
cavitation/Kunz/Kunz.C
cavitation/Merkle/Merkle.C
cavitation/SchnerrSauer/SchnerrSauer.C
VoFCavitation.C
LIB = $(FOAM_LIBBIN)/libcompressibleVoFCavitation

View File

@ -1,17 +1,19 @@
EXE_INC = \
-I../compressibleTwoPhaseMixture/lnInclude \
-I../../compressibleTwoPhaseMixture \
-I$(LIB_SRC)/physicalProperties/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/twoPhaseModels/twoPhaseMixture/lnInclude \
-I$(LIB_SRC)/twoPhaseModels/interfaceProperties/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
LIB_LIBS = \
-lcompressibleTwoPhaseMixture \
-lfluidThermophysicalModels \
-lspecie \
-lphysicalProperties \
-ltwoPhaseMixture \
-ltwoPhaseProperties \
-linterfaceProperties \
-lcompressibleTwoPhaseMixture \
-lmeshTools \
-lfiniteVolume
-lfiniteVolume \
-lmeshTools

View File

@ -0,0 +1,185 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2022 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 "VoFCavitation.H"
#include "compressibleTwoPhaseMixture.H"
#include "fvmSup.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * //
namespace Foam
{
namespace fv
{
namespace compressible
{
defineTypeNameAndDebug(VoFCavitation, 0);
addToRunTimeSelectionTable
(
fvModel,
VoFCavitation,
dictionary
);
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::fv::compressible::VoFCavitation::VoFCavitation
(
const word& sourceName,
const word& modelType,
const dictionary& dict,
const fvMesh& mesh
)
:
fvModel(sourceName, modelType, dict, mesh),
mixture_
(
mesh.lookupObjectRef<compressibleTwoPhaseMixture>
(
"phaseProperties"
)
),
cavitation_(Foam::compressible::cavitationModel::New(dict, mixture_)),
alphaName_(mixture_.alpha1().name())
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::wordList Foam::fv::compressible::VoFCavitation::addSupFields() const
{
return {alphaName_, "p_rgh"};
}
void Foam::fv::compressible::VoFCavitation::addSup
(
fvMatrix<scalar>& eqn,
const word& fieldName
) const
{
if (debug)
{
Info<< type() << ": applying source to " << eqn.psi().name() << endl;
}
if (fieldName == alphaName_)
{
volScalarField::Internal alphalCoeff
(
1.0/mixture_.rho1()()
- mixture_.alpha1()()*(1.0/mixture_.rho1()() - 1.0/mixture_.rho2()())
);
const Pair<tmp<volScalarField::Internal>> mDotAlphal
(
cavitation_->mDotAlphal()
);
const volScalarField::Internal vDotcAlphal(alphalCoeff*mDotAlphal[0]());
const volScalarField::Internal vDotvAlphal(alphalCoeff*mDotAlphal[1]());
eqn += fvm::Sp(vDotvAlphal - vDotcAlphal, eqn.psi()) + vDotcAlphal;
}
}
void Foam::fv::compressible::VoFCavitation::addSup
(
const volScalarField&,
fvMatrix<scalar>& eqn,
const word& fieldName
) const
{
if (debug)
{
Info<< type() << ": applying source to " << eqn.psi().name() << endl;
}
if (fieldName == "p_rgh")
{
const volScalarField::Internal& rho =
mesh().lookupObject<volScalarField>("thermo:rho");
const volScalarField::Internal& gh =
mesh().lookupObject<volScalarField>("gh");
const volScalarField::Internal pCoeff
(
1.0/mixture_.rho1()() - 1.0/mixture_.rho2()()
);
const Pair<tmp<volScalarField::Internal>> mDotP
(
cavitation_->mDotP()
);
const volScalarField::Internal vDotcP(pCoeff*mDotP[0]);
const volScalarField::Internal vDotvP(pCoeff*mDotP[1]);
eqn +=
(vDotvP - vDotcP)*(cavitation_->pSat() - rho*gh)
- fvm::Sp(vDotvP - vDotcP, eqn.psi());
}
}
void Foam::fv::compressible::VoFCavitation::topoChange(const polyTopoChangeMap&)
{}
void Foam::fv::compressible::VoFCavitation::mapMesh(const polyMeshMap& map)
{}
void Foam::fv::compressible::VoFCavitation::distribute
(
const polyDistributionMap&
)
{}
bool Foam::fv::compressible::VoFCavitation::movePoints()
{
return true;
}
void Foam::fv::compressible::VoFCavitation::correct()
{
cavitation_->correct();
}
// ************************************************************************* //

View File

@ -0,0 +1,197 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2022 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::fv::compressible::VoFCavitation
Description
Cavitation fvModel
Usage
Example usage:
\verbatim
VoFCavitation
{
type VoFCavitation;
libs ("libcompressibleVoFCavitation.so");
model SchnerrSauer;
KunzCoeffs
{
pSat 2300; // Saturation pressure
UInf 20.0;
tInf 0.005; // L = 0.1 m
Cc 1000;
Cv 1000;
}
MerkleCoeffs
{
pSat 2300; // Saturation pressure
UInf 20.0;
tInf 0.005; // L = 0.1 m
Cc 80;
Cv 1e-03;
}
SchnerrSauerCoeffs
{
pSat 2300; // Saturation pressure
n 1.6e+13;
dNuc 2.0e-06;
Cc 1;
Cv 1;
}
}
\endverbatim
SourceFiles
VoFCavitation.C
\*---------------------------------------------------------------------------*/
#ifndef VoFCavitation_H
#define VoFCavitation_H
#include "fvModel.H"
#include "cavitationModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class compressibleTwoPhaseMixture;
namespace fv
{
namespace compressible
{
/*---------------------------------------------------------------------------*\
Class VoFCavitation Declaration
\*---------------------------------------------------------------------------*/
class VoFCavitation
:
public fvModel
{
// Private Data
//- Reference to the mixture properties
const compressibleTwoPhaseMixture& mixture_;
autoPtr<Foam::compressible::cavitationModel> cavitation_;
//- The name of the VoF phase-fraction
word alphaName_;
public:
//- Runtime type information
TypeName("VoFCavitation");
// Constructors
//- Construct from explicit source name and mesh
VoFCavitation
(
const word& sourceName,
const word& modelType,
const dictionary& dict,
const fvMesh& mesh
);
//- Disallow default bitwise copy construction
VoFCavitation
(
const VoFCavitation&
) = delete;
// Member Functions
//- Return the list of fields for which the option adds source term
// to the transport equation
virtual wordList addSupFields() const;
//- Add implicit/explicit contributions to VoF phase-fraction equation
virtual void addSup
(
fvMatrix<scalar>& eqn,
const word& fieldName
) const;
//- Add implicit/explicit contributions to p_rgh equation
virtual void addSup
(
const volScalarField& psi,
fvMatrix<scalar>& eqn,
const word& fieldName
) const;
// Mesh changes
//- Update topology using the given map
virtual void topoChange(const polyTopoChangeMap&);
//- Update from another mesh using the given map
virtual void mapMesh(const polyMeshMap&);
//- Redistribute or update using the given distribution map
virtual void distribute(const polyDistributionMap&);
//- Update for mesh motion
virtual bool movePoints();
//- Correct the cavitation model
virtual void correct();
// Member Operators
//- Disallow default bitwise assignment
void operator=(const VoFCavitation&) = delete;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace compressible
} // End namespace fv
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -32,7 +32,7 @@ namespace Foam
{
namespace compressible
{
namespace twoPhaseChangeModels
namespace cavitationModels
{
defineTypeNameAndDebug(Kunz, 0);
addToRunTimeSelectionTable(cavitationModel, Kunz, dictionary);
@ -43,17 +43,18 @@ namespace twoPhaseChangeModels
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::compressible::twoPhaseChangeModels::Kunz::Kunz
Foam::compressible::cavitationModels::Kunz::Kunz
(
const dictionary& dict,
const compressibleTwoPhaseMixture& mixture
)
:
cavitationModel(typeName, mixture),
cavitationModel(dict, mixture),
UInf_("UInf", dimVelocity, twoPhaseChangeModelCoeffs_),
tInf_("tInf", dimTime, twoPhaseChangeModelCoeffs_),
Cc_("Cc", dimless, twoPhaseChangeModelCoeffs_),
Cv_("Cv", dimless, twoPhaseChangeModelCoeffs_),
UInf_("UInf", dimVelocity, dict),
tInf_("tInf", dimTime, dict),
Cc_("Cc", dimless, dict),
Cv_("Cv", dimless, dict),
p0_("0", pSat().dimensions(), 0.0)
{
@ -64,15 +65,15 @@ Foam::compressible::twoPhaseChangeModels::Kunz::Kunz
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
Foam::Pair<Foam::tmp<Foam::volScalarField::Internal>>
Foam::compressible::twoPhaseChangeModels::Kunz::mDotAlphal() const
Foam::compressible::cavitationModels::Kunz::mDotAlphal() const
{
const volScalarField::Internal& p =
mixture_.alpha1().db().lookupObject<volScalarField>("p");
const volScalarField::Internal mcCoeff_(Cc_*rho2()/tInf_);
const volScalarField::Internal mcCoeff_(Cc_*mixture_.rho2()()/tInf_);
const volScalarField::Internal mvCoeff_
(
Cv_*rho2()/(0.5*rho1()*sqr(UInf_)*tInf_)
Cv_*mixture_.rho2()()/(0.5*mixture_.rho1()()*sqr(UInf_)*tInf_)
);
const volScalarField::Internal limitedAlpha1
@ -91,15 +92,15 @@ Foam::compressible::twoPhaseChangeModels::Kunz::mDotAlphal() const
Foam::Pair<Foam::tmp<Foam::volScalarField::Internal>>
Foam::compressible::twoPhaseChangeModels::Kunz::mDotP() const
Foam::compressible::cavitationModels::Kunz::mDotP() const
{
const volScalarField::Internal& p =
mixture_.alpha1().db().lookupObject<volScalarField>("p");
const volScalarField::Internal mcCoeff_(Cc_*rho2()/tInf_);
const volScalarField::Internal mcCoeff_(Cc_*mixture_.rho2()()/tInf_);
const volScalarField::Internal mvCoeff_
(
Cv_*rho2()/(0.5*rho1()*sqr(UInf_)*tInf_)
Cv_*mixture_.rho2()()/(0.5*mixture_.rho1()()*sqr(UInf_)*tInf_)
);
const volScalarField::Internal limitedAlpha1
@ -117,22 +118,21 @@ Foam::compressible::twoPhaseChangeModels::Kunz::mDotP() const
}
void Foam::compressible::twoPhaseChangeModels::Kunz::correct()
{
cavitationModel::correct();
}
void Foam::compressible::cavitationModels::Kunz::correct()
{}
bool Foam::compressible::twoPhaseChangeModels::Kunz::read()
bool Foam::compressible::cavitationModels::Kunz::read
(
const dictionary& dict
)
{
if (cavitationModel::read())
if (cavitationModel::read(dict))
{
twoPhaseChangeModelCoeffs_ = optionalSubDict(type() + "Coeffs");
twoPhaseChangeModelCoeffs_.lookup("UInf") >> UInf_;
twoPhaseChangeModelCoeffs_.lookup("tInf") >> tInf_;
twoPhaseChangeModelCoeffs_.lookup("Cc") >> Cc_;
twoPhaseChangeModelCoeffs_.lookup("Cv") >> Cv_;
dict.lookup("UInf") >> UInf_;
dict.lookup("tInf") >> tInf_;
dict.lookup("Cc") >> Cc_;
dict.lookup("Cv") >> Cv_;
return true;
}

View File

@ -22,7 +22,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::twoPhaseChangeModels::Kunz
Foam::compressible::cavitationModels::Kunz
Description
Kunz cavitation model slightly modified so that the condensation term
@ -57,7 +57,7 @@ namespace Foam
{
namespace compressible
{
namespace twoPhaseChangeModels
namespace cavitationModels
{
/*---------------------------------------------------------------------------*\
@ -89,6 +89,7 @@ public:
//- Construct for mixture
Kunz
(
const dictionary& dict,
const compressibleTwoPhaseMixture& mixture
);
@ -112,14 +113,14 @@ public:
//- Correct the Kunz phaseChange model
virtual void correct();
//- Read the phaseProperties dictionary and update
virtual bool read();
//- Read the dictionary and update
virtual bool read(const dictionary& dict);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace twoPhaseChangeModels
} // End namespace cavitationModels
} // End namespace compressible
} // End namespace Foam

View File

@ -32,7 +32,7 @@ namespace Foam
{
namespace compressible
{
namespace twoPhaseChangeModels
namespace cavitationModels
{
defineTypeNameAndDebug(Merkle, 0);
addToRunTimeSelectionTable(cavitationModel, Merkle, dictionary);
@ -43,17 +43,18 @@ namespace twoPhaseChangeModels
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::compressible::twoPhaseChangeModels::Merkle::Merkle
Foam::compressible::cavitationModels::Merkle::Merkle
(
const dictionary& dict,
const compressibleTwoPhaseMixture& mixture
)
:
cavitationModel(typeName, mixture),
cavitationModel(dict, mixture),
UInf_("UInf", dimVelocity, twoPhaseChangeModelCoeffs_),
tInf_("tInf", dimTime, twoPhaseChangeModelCoeffs_),
Cc_("Cc", dimless, twoPhaseChangeModelCoeffs_),
Cv_("Cv", dimless, twoPhaseChangeModelCoeffs_),
UInf_("UInf", dimVelocity, dict),
tInf_("tInf", dimTime, dict),
Cc_("Cc", dimless, dict),
Cv_("Cv", dimless, dict),
p0_("0", pSat().dimensions(), 0.0),
@ -66,14 +67,14 @@ Foam::compressible::twoPhaseChangeModels::Merkle::Merkle
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
Foam::Pair<Foam::tmp<Foam::volScalarField::Internal>>
Foam::compressible::twoPhaseChangeModels::Merkle::mDotAlphal() const
Foam::compressible::cavitationModels::Merkle::mDotAlphal() const
{
const volScalarField::Internal& p =
mixture_.alpha1().db().lookupObject<volScalarField>("p");
const volScalarField::Internal mvCoeff_
(
Cv_*rho1()/(0.5*sqr(UInf_)*tInf_*rho2())
Cv_*mixture_.rho1()()/(0.5*sqr(UInf_)*tInf_*mixture_.rho2()())
);
return Pair<tmp<volScalarField::Internal>>
@ -85,7 +86,7 @@ Foam::compressible::twoPhaseChangeModels::Merkle::mDotAlphal() const
Foam::Pair<Foam::tmp<Foam::volScalarField::Internal>>
Foam::compressible::twoPhaseChangeModels::Merkle::mDotP() const
Foam::compressible::cavitationModels::Merkle::mDotP() const
{
const volScalarField::Internal& p =
mixture_.alpha1().db().lookupObject<volScalarField>("p");
@ -97,7 +98,7 @@ Foam::compressible::twoPhaseChangeModels::Merkle::mDotP() const
const volScalarField::Internal mvCoeff_
(
Cv_*rho1()/(0.5*sqr(UInf_)*tInf_*rho2())
Cv_*mixture_.rho1()()/(0.5*sqr(UInf_)*tInf_*mixture_.rho2()())
);
return Pair<tmp<volScalarField::Internal>>
@ -109,22 +110,21 @@ Foam::compressible::twoPhaseChangeModels::Merkle::mDotP() const
}
void Foam::compressible::twoPhaseChangeModels::Merkle::correct()
{
cavitationModel::correct();
}
void Foam::compressible::cavitationModels::Merkle::correct()
{}
bool Foam::compressible::twoPhaseChangeModels::Merkle::read()
bool Foam::compressible::cavitationModels::Merkle::read
(
const dictionary& dict
)
{
if (cavitationModel::read())
if (cavitationModel::read(dict))
{
twoPhaseChangeModelCoeffs_ = optionalSubDict(type() + "Coeffs");
twoPhaseChangeModelCoeffs_.lookup("UInf") >> UInf_;
twoPhaseChangeModelCoeffs_.lookup("tInf") >> tInf_;
twoPhaseChangeModelCoeffs_.lookup("Cc") >> Cc_;
twoPhaseChangeModelCoeffs_.lookup("Cv") >> Cv_;
dict.lookup("UInf") >> UInf_;
dict.lookup("tInf") >> tInf_;
dict.lookup("Cc") >> Cc_;
dict.lookup("Cv") >> Cv_;
return true;
}

View File

@ -22,7 +22,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::twoPhaseChangeModels::Merkle
Foam::compressible::cavitationModels::Merkle
Description
Merkle cavitation model.
@ -51,7 +51,7 @@ namespace Foam
{
namespace compressible
{
namespace twoPhaseChangeModels
namespace cavitationModels
{
/*---------------------------------------------------------------------------*\
@ -85,6 +85,7 @@ public:
//- Construct for mixture
Merkle
(
const dictionary& dict,
const compressibleTwoPhaseMixture& mixture
);
@ -108,14 +109,14 @@ public:
//- Correct the Merkle phaseChange model
virtual void correct();
//- Read the phaseProperties dictionary and update
virtual bool read();
//- Read the dictionary and update
virtual bool read(const dictionary& dict);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace twoPhaseChangeModels
} // End namespace cavitationModels
} // End namespace compressible
} // End namespace Foam

View File

@ -33,7 +33,7 @@ namespace Foam
{
namespace compressible
{
namespace twoPhaseChangeModels
namespace cavitationModels
{
defineTypeNameAndDebug(SchnerrSauer, 0);
addToRunTimeSelectionTable
@ -49,17 +49,18 @@ namespace twoPhaseChangeModels
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::compressible::twoPhaseChangeModels::SchnerrSauer::SchnerrSauer
Foam::compressible::cavitationModels::SchnerrSauer::SchnerrSauer
(
const dictionary& dict,
const compressibleTwoPhaseMixture& mixture
)
:
cavitationModel(typeName, mixture),
cavitationModel(dict, mixture),
n_("n", dimless/dimVolume, twoPhaseChangeModelCoeffs_),
dNuc_("dNuc", dimLength, twoPhaseChangeModelCoeffs_),
Cc_("Cc", dimless, twoPhaseChangeModelCoeffs_),
Cv_("Cv", dimless, twoPhaseChangeModelCoeffs_),
n_("n", dimless/dimVolume, dict),
dNuc_("dNuc", dimLength, dict),
Cc_("Cc", dimless, dict),
Cv_("Cv", dimless, dict),
p0_("0", pSat().dimensions(), 0.0)
{
@ -70,7 +71,7 @@ Foam::compressible::twoPhaseChangeModels::SchnerrSauer::SchnerrSauer
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
Foam::tmp<Foam::volScalarField::Internal>
Foam::compressible::twoPhaseChangeModels::SchnerrSauer::rRb
Foam::compressible::cavitationModels::SchnerrSauer::rRb
(
const volScalarField::Internal& limitedAlpha1
) const
@ -85,7 +86,7 @@ Foam::compressible::twoPhaseChangeModels::SchnerrSauer::rRb
Foam::dimensionedScalar
Foam::compressible::twoPhaseChangeModels::SchnerrSauer::alphaNuc() const
Foam::compressible::cavitationModels::SchnerrSauer::alphaNuc() const
{
dimensionedScalar Vnuc = n_*constant::mathematical::pi*pow3(dNuc_)/6;
return Vnuc/(1 + Vnuc);
@ -93,7 +94,7 @@ Foam::compressible::twoPhaseChangeModels::SchnerrSauer::alphaNuc() const
Foam::tmp<Foam::volScalarField::Internal>
Foam::compressible::twoPhaseChangeModels::SchnerrSauer::pCoeff
Foam::compressible::cavitationModels::SchnerrSauer::pCoeff
(
const volScalarField::Internal& p
) const
@ -105,18 +106,18 @@ Foam::compressible::twoPhaseChangeModels::SchnerrSauer::pCoeff
const volScalarField::Internal rho
(
limitedAlpha1*rho1()
+ (scalar(1) - limitedAlpha1)*rho2()
limitedAlpha1*mixture_.rho1()()
+ (scalar(1) - limitedAlpha1)*mixture_.rho2()()
);
return
(3*rho1()*rho2())*sqrt(2/(3*rho1()))
(3*mixture_.rho1()()*mixture_.rho2()())*sqrt(2/(3*mixture_.rho1()()))
*rRb(limitedAlpha1)/(rho*sqrt(mag(p - pSat()) + 0.01*pSat()));
}
Foam::Pair<Foam::tmp<Foam::volScalarField::Internal>>
Foam::compressible::twoPhaseChangeModels::SchnerrSauer::mDotAlphal() const
Foam::compressible::cavitationModels::SchnerrSauer::mDotAlphal() const
{
const volScalarField::Internal& p =
mixture_.alpha1().db().lookupObject<volScalarField>("p");
@ -138,7 +139,7 @@ Foam::compressible::twoPhaseChangeModels::SchnerrSauer::mDotAlphal() const
Foam::Pair<Foam::tmp<Foam::volScalarField::Internal>>
Foam::compressible::twoPhaseChangeModels::SchnerrSauer::mDotP() const
Foam::compressible::cavitationModels::SchnerrSauer::mDotP() const
{
const volScalarField::Internal& p =
mixture_.alpha1().db().lookupObject<volScalarField>("p");
@ -161,22 +162,21 @@ Foam::compressible::twoPhaseChangeModels::SchnerrSauer::mDotP() const
}
void Foam::compressible::twoPhaseChangeModels::SchnerrSauer::correct()
{
cavitationModel::correct();
}
void Foam::compressible::cavitationModels::SchnerrSauer::correct()
{}
bool Foam::compressible::twoPhaseChangeModels::SchnerrSauer::read()
bool Foam::compressible::cavitationModels::SchnerrSauer::read
(
const dictionary& dict
)
{
if (cavitationModel::read())
if (cavitationModel::read(dict))
{
twoPhaseChangeModelCoeffs_ = optionalSubDict(type() + "Coeffs");
twoPhaseChangeModelCoeffs_.lookup("n") >> n_;
twoPhaseChangeModelCoeffs_.lookup("dNuc") >> dNuc_;
twoPhaseChangeModelCoeffs_.lookup("Cc") >> Cc_;
twoPhaseChangeModelCoeffs_.lookup("Cv") >> Cv_;
dict.lookup("n") >> n_;
dict.lookup("dNuc") >> dNuc_;
dict.lookup("Cc") >> Cc_;
dict.lookup("Cv") >> Cv_;
return true;
}

View File

@ -22,7 +22,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::twoPhaseChangeModels::SchnerrSauer
Foam::compressible::cavitationModels::SchnerrSauer
Description
SchnerrSauer cavitation model.
@ -51,7 +51,7 @@ namespace Foam
{
namespace compressible
{
namespace twoPhaseChangeModels
namespace cavitationModels
{
/*---------------------------------------------------------------------------*\
@ -105,6 +105,7 @@ public:
//- Construct for mixture
SchnerrSauer
(
const dictionary& dict,
const compressibleTwoPhaseMixture& mixture
);
@ -128,14 +129,14 @@ public:
//- Correct the SchnerrSauer phaseChange model
virtual void correct();
//- Read the phaseProperties dictionary and update
virtual bool read();
//- Read the dictionary and update
virtual bool read(const dictionary& dict);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace twoPhaseChangeModels
} // End namespace cavitationModels
} // End namespace compressible
} // End namespace Foam

View File

@ -23,7 +23,8 @@ License
\*---------------------------------------------------------------------------*/
#include "twoPhaseChangeModel.H"
#include "cavitationModel.H"
#include "fvmSup.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
@ -31,79 +32,30 @@ namespace Foam
{
namespace compressible
{
defineTypeNameAndDebug(twoPhaseChangeModel, 0);
defineRunTimeSelectionTable(twoPhaseChangeModel, dictionary);
defineTypeNameAndDebug(cavitationModel, 0);
defineRunTimeSelectionTable(cavitationModel, dictionary);
}
}
const Foam::word
Foam::compressible::twoPhaseChangeModel::phaseChangePropertiesName
(
"phaseChangeProperties"
);
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
Foam::IOobject Foam::compressible::twoPhaseChangeModel::createIOobject
(
const compressibleTwoPhaseMixture& mixture
) const
{
typeIOobject<IOdictionary> io
(
phaseChangePropertiesName,
mixture.alpha1().mesh().time().constant(),
mixture.alpha1().mesh(),
IOobject::MUST_READ,
IOobject::NO_WRITE
);
if (io.headerOk())
{
io.readOpt() = IOobject::MUST_READ_IF_MODIFIED;
return io;
}
else
{
io.readOpt() = IOobject::NO_READ;
return io;
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::compressible::twoPhaseChangeModel::twoPhaseChangeModel
Foam::compressible::cavitationModel::cavitationModel
(
const word& type,
const dictionary& dict,
const compressibleTwoPhaseMixture& mixture
)
:
IOdictionary(createIOobject(mixture)),
mixture_(mixture),
twoPhaseChangeModelCoeffs_(optionalSubDict(type + "Coeffs"))
pSat_("pSat", dimPressure, dict.lookup("pSat"))
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
void Foam::compressible::twoPhaseChangeModel::correct()
{}
bool Foam::compressible::twoPhaseChangeModel::read()
bool Foam::compressible::cavitationModel::read(const dictionary& dict)
{
if (regIOobject::read())
{
twoPhaseChangeModelCoeffs_ = optionalSubDict(type() + "Coeffs");
dict.lookup("pSat") >> pSat_;
return true;
}
else
{
return false;
}
return true;
}

View File

@ -35,7 +35,9 @@ SourceFiles
#ifndef cavitationModel_H
#define cavitationModel_H
#include "twoPhaseChangeModel.H"
#include "compressibleTwoPhaseMixture.H"
#include "fvMatricesFwd.H"
#include "Pair.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -43,18 +45,19 @@ namespace Foam
{
namespace compressible
{
namespace twoPhaseChangeModels
{
/*---------------------------------------------------------------------------*\
Class cavitationModel
Class cavitationModel
\*---------------------------------------------------------------------------*/
class cavitationModel
:
public twoPhaseChangeModel
{
// Private data
protected:
// Protected data
//- Mixture properties
const compressibleTwoPhaseMixture& mixture_;
//- Saturation vapour pressure
dimensionedScalar pSat_;
@ -66,16 +69,39 @@ public:
TypeName("cavitation");
// Declare run-time constructor selection table
declareRunTimeSelectionTable
(
autoPtr,
cavitationModel,
dictionary,
(
const dictionary& dict,
const compressibleTwoPhaseMixture& mixture
),
(dict, mixture)
);
// Constructors
//- Construct for mixture
cavitationModel
(
const word& type,
const dictionary& dict,
const compressibleTwoPhaseMixture& mixture
);
// Selector
static autoPtr<cavitationModel> New
(
const dictionary& dict,
const compressibleTwoPhaseMixture& mixture
);
//- Destructor
virtual ~cavitationModel()
{}
@ -98,38 +124,16 @@ public:
// to multiply (p - pSat)
virtual Pair<tmp<volScalarField::Internal>> mDotP() const = 0;
//- Return the cavitation explicit and implicit sources
// for the phase-fraction equation
virtual Pair<tmp<volScalarField::Internal>> Salpha
(
volScalarField& alpha
) const;
//- Correct the cavitation model
virtual void correct() = 0;
//- Return the cavitation source matrix
// for the p_rgh pressure equation
virtual tmp<fvScalarMatrix> Sp_rgh
(
const volScalarField& rho,
const volScalarField& gh,
volScalarField& p_rgh
) const;
//- Return the cavitation source matrix for the momentum equation
virtual tmp<fvVectorMatrix> SU
(
const volScalarField& rho,
const surfaceScalarField& rhoPhi,
volVectorField& U
) const;
//- Read the phaseProperties dictionary and update
virtual bool read();
//- Read the dictionary and update
virtual bool read(const dictionary& dict) = 0;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace twoPhaseChangeModels
} // End namespace compressible
} // End namespace Foam

View File

@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2021-2022 OpenFOAM Foundation
\\ / A nd | Copyright (C) 2022 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@ -23,46 +23,20 @@ License
\*---------------------------------------------------------------------------*/
#include "noPhaseChange.H"
#include "cavitationModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::compressible::twoPhaseChangeModel>
Foam::compressible::twoPhaseChangeModel::New
Foam::autoPtr<Foam::compressible::cavitationModel>
Foam::compressible::cavitationModel::New
(
const dictionary& dict,
const compressibleTwoPhaseMixture& mixture
)
{
typeIOobject<IOdictionary> twoPhaseChangeModelIO
(
IOobject
(
phaseChangePropertiesName,
mixture.alpha1().time().constant(),
mixture.alpha1().db(),
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
)
);
const word modelType(dict.lookup("model"));
word modelType(twoPhaseChangeModels::noPhaseChange::typeName);
if (twoPhaseChangeModelIO.headerOk())
{
IOdictionary(twoPhaseChangeModelIO).lookup
(
twoPhaseChangeModel::typeName
) >> modelType;
}
else
{
Info<< "No phase change: "
<< twoPhaseChangeModelIO.name()
<< " not found" << endl;
}
Info<< "Selecting phaseChange model " << modelType << endl;
Info<< "Selecting cavitation model " << modelType << endl;
dictionaryConstructorTable::iterator cstrIter =
dictionaryConstructorTablePtr_->find(modelType);
@ -70,14 +44,17 @@ Foam::compressible::twoPhaseChangeModel::New
if (cstrIter == dictionaryConstructorTablePtr_->end())
{
FatalErrorInFunction
<< "Unknown " << twoPhaseChangeModel::typeName<< " type "
<< "Unknown cavitation model "
<< modelType << nl << nl
<< "Valid twoPhaseChangeModels are : " << endl
<< "Valid cavitationModels are : " << endl
<< dictionaryConstructorTablePtr_->sortedToc()
<< exit(FatalError);
}
return autoPtr<twoPhaseChangeModel>(cstrIter()(mixture));
return autoPtr<cavitationModel>
(
cstrIter()(dict.optionalSubDict(modelType + "Coeffs"), mixture)
);
}

View File

@ -1,5 +1,5 @@
EXE_INC = \
-I../compressibleTwoPhaseMixture \
-I../../compressibleTwoPhaseMixture \
-I$(LIB_SRC)/physicalProperties/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/twoPhaseModels/twoPhaseMixture/lnInclude \

View File

@ -0,0 +1,3 @@
VoFSolidificationMeltingSource.C
LIB = $(FOAM_LIBBIN)/libVoFSolidificationMeltingSource

View File

@ -0,0 +1,19 @@
EXE_INC = \
-I../../compressibleTwoPhaseMixture \
-I$(LIB_SRC)/physicalProperties/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/twoPhaseModels/twoPhaseMixture/lnInclude \
-I$(LIB_SRC)/twoPhaseModels/interfaceProperties/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
LIB_LIBS = \
-lcompressibleTwoPhaseMixture \
-lfluidThermophysicalModels \
-lspecie \
-lphysicalProperties \
-ltwoPhaseMixture \
-ltwoPhaseProperties \
-linterfaceProperties \
-lfiniteVolume \
-lmeshTools

View File

@ -1,5 +1,5 @@
EXE_INC = \
-I../compressibleTwoPhaseMixture \
-I../../compressibleTwoPhaseMixture \
-I$(LIB_SRC)/physicalProperties/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/twoPhaseModels/twoPhaseMixture/lnInclude \

View File

@ -1,5 +1,5 @@
EXE_INC = \
-I../compressibleTwoPhaseMixture \
-I../../compressibleTwoPhaseMixture \
-I$(LIB_SRC)/physicalProperties/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/twoPhaseModels/twoPhaseMixture/lnInclude \

View File

@ -36,21 +36,24 @@ namespace Foam
{
namespace fv
{
defineTypeNameAndDebug(VoFTurbulenceDamping, 0);
namespace compressible
{
defineTypeNameAndDebug(VoFTurbulenceDamping, 0);
addToRunTimeSelectionTable
(
fvModel,
VoFTurbulenceDamping,
dictionary
);
addToRunTimeSelectionTable
(
fvModel,
VoFTurbulenceDamping,
dictionary
);
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::fv::VoFTurbulenceDamping::VoFTurbulenceDamping
Foam::fv::compressible::VoFTurbulenceDamping::VoFTurbulenceDamping
(
const word& sourceName,
const word& modelType,
@ -113,13 +116,14 @@ Foam::fv::VoFTurbulenceDamping::VoFTurbulenceDamping
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::wordList Foam::fv::VoFTurbulenceDamping::addSupFields() const
Foam::wordList
Foam::fv::compressible::VoFTurbulenceDamping::addSupFields() const
{
return wordList(1, fieldName_);
}
void Foam::fv::VoFTurbulenceDamping::addSup
void Foam::fv::compressible::VoFTurbulenceDamping::addSup
(
const volScalarField& rho,
fvMatrix<scalar>& eqn,
@ -156,7 +160,7 @@ void Foam::fv::VoFTurbulenceDamping::addSup
}
void Foam::fv::VoFTurbulenceDamping::addSup
void Foam::fv::compressible::VoFTurbulenceDamping::addSup
(
const volScalarField& alpha,
const volScalarField&,
@ -207,19 +211,28 @@ void Foam::fv::VoFTurbulenceDamping::addSup
}
void Foam::fv::VoFTurbulenceDamping::topoChange(const polyTopoChangeMap&)
void Foam::fv::compressible::VoFTurbulenceDamping::topoChange
(
const polyTopoChangeMap&
)
{}
void Foam::fv::VoFTurbulenceDamping::mapMesh(const polyMeshMap& map)
void Foam::fv::compressible::VoFTurbulenceDamping::mapMesh
(
const polyMeshMap& map
)
{}
void Foam::fv::VoFTurbulenceDamping::distribute(const polyDistributionMap&)
void Foam::fv::compressible::VoFTurbulenceDamping::distribute
(
const polyDistributionMap&
)
{}
bool Foam::fv::VoFTurbulenceDamping::movePoints()
bool Foam::fv::compressible::VoFTurbulenceDamping::movePoints()
{
return true;
}

View File

@ -22,7 +22,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::fv::VoFTurbulenceDamping
Foam::fv::compressible::VoFTurbulenceDamping
Description
Free-surface turbulence damping function
@ -87,6 +87,8 @@ class compressibleMomentumTransportModel;
namespace fv
{
namespace compressible
{
/*---------------------------------------------------------------------------*\
Class VoFTurbulenceDamping Declaration
@ -196,6 +198,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace compressible
} // End namespace fv
} // End namespace Foam

View File

@ -83,7 +83,19 @@ void Foam::solvers::compressibleVoF::pressureCorrector()
constrainPressure(p_rgh, U, phiHbyA, rAUf, MRF);
// Cache the phase change pressure source
fvScalarMatrix Sp_rgh(phaseChange.Sp_rgh(rho, buoyancy.gh, p_rgh));
fvScalarMatrix Sp_rgh
(
fvModels().source
(
volScalarField::New
(
"1",
mesh,
dimensionedScalar(dimless/dimPressure, 1)
),
p_rgh
)
);
// Make the fluxes relative to the mesh motion
fvc::makeRelative(phiHbyA, U);

View File

@ -1,9 +0,0 @@
twoPhaseChangeModel/twoPhaseChangeModel.C
twoPhaseChangeModel/twoPhaseChangeModelNew.C
noPhaseChange/noPhaseChange.C
cavitation/cavitationModel/cavitationModel.C
cavitation/Kunz/Kunz.C
cavitation/Merkle/Merkle.C
cavitation/SchnerrSauer/SchnerrSauer.C
LIB = $(FOAM_LIBBIN)/libcompressibleTwoPhaseChangeModels

View File

@ -1,131 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2021-2022 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 "cavitationModel.H"
#include "fvcDdt.H"
#include "fvcDiv.H"
#include "fvmSup.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
namespace twoPhaseChangeModels
{
defineTypeNameAndDebug(cavitationModel, 0);
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::compressible::twoPhaseChangeModels::cavitationModel::cavitationModel
(
const word& type,
const compressibleTwoPhaseMixture& mixture
)
:
twoPhaseChangeModel(type, mixture),
pSat_("pSat", dimPressure, lookup("pSat"))
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
Foam::Pair<Foam::tmp<Foam::volScalarField::Internal>>
Foam::compressible::twoPhaseChangeModels::cavitationModel::Salpha
(
volScalarField& alpha
) const
{
const volScalarField::Internal alphalCoeff
(
1.0/rho1()
- mixture_.alpha1()()*(1.0/rho1() - 1.0/rho2())
);
const Pair<tmp<volScalarField::Internal>> mDotAlphal = this->mDotAlphal();
const volScalarField::Internal vDotcAlphal(alphalCoeff*mDotAlphal[0]());
const volScalarField::Internal vDotvAlphal(alphalCoeff*mDotAlphal[1]());
return Pair<tmp<volScalarField::Internal>>
(
1.0*vDotcAlphal,
vDotvAlphal - vDotcAlphal
);
}
Foam::tmp<Foam::fvScalarMatrix>
Foam::compressible::twoPhaseChangeModels::cavitationModel::Sp_rgh
(
const volScalarField& rho,
const volScalarField& gh,
volScalarField& p_rgh
) const
{
const volScalarField::Internal pCoeff(1.0/rho1() - 1.0/rho2());
const Pair<tmp<volScalarField::Internal>> mDotP = this->mDotP();
const volScalarField::Internal vDotcP(pCoeff*mDotP[0]);
const volScalarField::Internal vDotvP(pCoeff*mDotP[1]);
return
(vDotvP - vDotcP)*(pSat() - rho()*gh())
- fvm::Sp(vDotvP - vDotcP, p_rgh);
}
Foam::tmp<Foam::fvVectorMatrix>
Foam::compressible::twoPhaseChangeModels::cavitationModel::SU
(
const volScalarField& rho,
const surfaceScalarField& rhoPhi,
volVectorField& U
) const
{
return fvm::Sp(fvc::ddt(rho) + fvc::div(rhoPhi), U);
}
bool Foam::compressible::twoPhaseChangeModels::cavitationModel::read()
{
if (twoPhaseChangeModel::read())
{
lookup("pSat") >> pSat_;
return true;
}
else
{
return false;
}
}
// ************************************************************************* //

View File

@ -1,133 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2021-2022 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 "noPhaseChange.H"
#include "fvScalarMatrix.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
namespace twoPhaseChangeModels
{
defineTypeNameAndDebug(noPhaseChange, 0);
addToRunTimeSelectionTable(twoPhaseChangeModel, noPhaseChange, dictionary);
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::compressible::twoPhaseChangeModels::noPhaseChange::noPhaseChange
(
const compressibleTwoPhaseMixture& mixture
)
:
twoPhaseChangeModel(typeName, mixture)
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
Foam::Pair<Foam::tmp<Foam::volScalarField>>
Foam::compressible::twoPhaseChangeModels::noPhaseChange::mDotAlphal() const
{
return Pair<tmp<volScalarField>>
(
volScalarField::null(),
volScalarField::null()
);
}
Foam::Pair<Foam::tmp<Foam::volScalarField>>
Foam::compressible::twoPhaseChangeModels::noPhaseChange::mDotP() const
{
return Pair<tmp<volScalarField>>
(
volScalarField::null(),
volScalarField::null()
);
}
Foam::Pair<Foam::tmp<Foam::volScalarField::Internal>>
Foam::compressible::twoPhaseChangeModels::noPhaseChange::Salpha
(
volScalarField& alpha
) const
{
return Pair<tmp<volScalarField::Internal>>
(
tmp<volScalarField::Internal>(nullptr),
tmp<volScalarField::Internal>(nullptr)
);
}
Foam::tmp<Foam::fvScalarMatrix>
Foam::compressible::twoPhaseChangeModels::noPhaseChange::Sp_rgh
(
const volScalarField& rho,
const volScalarField& gh,
volScalarField& p_rgh
) const
{
return tmp<fvScalarMatrix>(new fvScalarMatrix(p_rgh, dimVolume/dimTime));
}
Foam::tmp<Foam::fvVectorMatrix>
Foam::compressible::twoPhaseChangeModels::noPhaseChange::SU
(
const volScalarField& rho,
const surfaceScalarField& rhoPhi,
volVectorField& U
) const
{
return tmp<fvVectorMatrix>
(
new fvVectorMatrix(U, dimMass*dimVelocity/dimTime)
);
}
void Foam::compressible::twoPhaseChangeModels::noPhaseChange::correct()
{
twoPhaseChangeModel::correct();
}
bool Foam::compressible::twoPhaseChangeModels::noPhaseChange::read()
{
return twoPhaseChangeModel::read();
}
// ************************************************************************* //

View File

@ -1,131 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2021-2022 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::twoPhaseChangeModels::noPhaseChange
Description
Dummy phase change model for 'no phase change'
SourceFiles
noPhaseChange.C
\*---------------------------------------------------------------------------*/
#ifndef noPhaseChange_H
#define noPhaseChange_H
#include "twoPhaseChangeModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
namespace twoPhaseChangeModels
{
/*---------------------------------------------------------------------------*\
Class noPhaseChange
\*---------------------------------------------------------------------------*/
class noPhaseChange
:
public twoPhaseChangeModel
{
public:
//- Runtime type information
TypeName("none");
// Constructors
//- Construct for mixture
noPhaseChange
(
const compressibleTwoPhaseMixture& mixture
);
//- Destructor
virtual ~noPhaseChange()
{}
// Member Functions
//- Return the mass condensation and vaporisation rates as a
// coefficient to multiply (1 - alphal) for the condensation rate
// and a coefficient to multiply alphal for the vaporisation rate
virtual Pair<tmp<volScalarField>> mDotAlphal() const;
//- Return the mass condensation and vaporisation rates as coefficients
// to multiply (p - pSat)
virtual Pair<tmp<volScalarField>> mDotP() const;
//- Return unallocated explicit and implicit sources
// for the phase-fraction equation
virtual Pair<tmp<volScalarField::Internal>> Salpha
(
volScalarField&
) const;
//- Return the zero source matrix
// for the p_rgh pressure equation
virtual tmp<fvScalarMatrix> Sp_rgh
(
const volScalarField& rho,
const volScalarField& gh,
volScalarField& p_rgh
) const;
//- Return the zero source matrix for the momentum equation
virtual tmp<fvVectorMatrix> SU
(
const volScalarField& rho,
const surfaceScalarField& rhoPhi,
volVectorField& U
) const;
//- Correct the noPhaseChange phaseChange model
virtual void correct();
//- Read the phaseProperties dictionary and update
virtual bool read();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace twoPhaseChangeModels
} // End namespace compressible
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,188 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Copyright (C) 2021-2022 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::twoPhaseChangeModel
Description
SourceFiles
twoPhaseChangeModel.C
phaseChangeModelNew.C
\*---------------------------------------------------------------------------*/
#ifndef twoPhaseChangeModel_H
#define twoPhaseChangeModel_H
#include "compressibleTwoPhaseMixture.H"
#include "fvMatricesFwd.H"
#include "Pair.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
/*---------------------------------------------------------------------------*\
Class twoPhaseChangeModel Declaration
\*---------------------------------------------------------------------------*/
class twoPhaseChangeModel
:
public IOdictionary
{
// Private Member Functions
//- Construct the base IO object
IOobject createIOobject
(
const compressibleTwoPhaseMixture& mixture
) const;
protected:
// Protected data
//- Reference to the two-phase mixture
const compressibleTwoPhaseMixture& mixture_;
//- Model coefficient dictionary
dictionary twoPhaseChangeModelCoeffs_;
public:
//- Runtime type information
TypeName("phaseChangeModel");
//- Default phaseChangeProperties dictionary name
static const word phaseChangePropertiesName;
// Declare run-time constructor selection table
declareRunTimeSelectionTable
(
autoPtr,
twoPhaseChangeModel,
dictionary,
(
const compressibleTwoPhaseMixture& mixture
),
(mixture)
);
// Constructors
//- Construct from dictionary
twoPhaseChangeModel
(
const word& type,
const compressibleTwoPhaseMixture& mixture
);
//- Disallow default bitwise copy construction
twoPhaseChangeModel(const twoPhaseChangeModel&);
// Selectors
//- Return a reference to the selected phaseChange model
static autoPtr<twoPhaseChangeModel> New
(
const compressibleTwoPhaseMixture& mixture
);
//- Destructor
virtual ~twoPhaseChangeModel()
{}
// Member Functions
//- Return the internal field of the density of phase 1
const volScalarField::Internal& rho1() const
{
return mixture_.rho1();
}
//- Return the internal field of the density of phase 2
const volScalarField::Internal& rho2() const
{
return mixture_.rho2();
}
//- Return the phase-change explicit and implicit sources
// for the phase-fraction equation
virtual Pair<tmp<volScalarField::Internal>> Salpha
(
volScalarField& alpha
) const = 0;
//- Return the phase-change source matrix
// for the p_rgh pressure equation
virtual tmp<fvScalarMatrix> Sp_rgh
(
const volScalarField& rho,
const volScalarField& gh,
volScalarField& p_rgh
) const = 0;
//- Return the phase-change source matrix for the momentum equation
virtual tmp<fvVectorMatrix> SU
(
const volScalarField& rho,
const surfaceScalarField& rhoPhi,
volVectorField& U
) const = 0;
//- Correct the phaseChange model
virtual void correct() = 0;
//- Read the phaseProperties dictionary and update
virtual bool read() = 0;
// Member Operators
//- Disallow default bitwise assignment
void operator=(const twoPhaseChangeModel&) = delete;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace compressible
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -2,8 +2,9 @@
cd ${0%/*} || exit 1 # Run from this directory
wclean libso incompressibleInterPhaseTransportModel
wclean libso VoFTurbulenceDamping
wclean libso VoFCavitation
wclean libso fvModels/VoFTurbulenceDamping
wclean libso fvModels/VoFCavitation
wclean
wclean interMixingFoam

View File

@ -5,8 +5,9 @@ cd ${0%/*} || exit 1 # Run from this directory
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
wmake $targetType incompressibleInterPhaseTransportModel
wmake $targetType VoFTurbulenceDamping
wmake $targetType VoFCavitation
wmake $targetType fvModels/VoFTurbulenceDamping
wmake $targetType fvModels/VoFCavitation
wmake $targetType
wmake $targetType interMixingFoam

View File

@ -87,8 +87,6 @@ namespace Foam
{
class immiscibleIncompressibleTwoPhaseMixture;
class interfaceProperties;
class incompressibleMomentumTransportModel;
namespace fv
{

View File

@ -114,7 +114,7 @@ public:
//- Correct the Kunz phaseChange model
virtual void correct();
//- Read the phaseProperties dictionary and update
//- Read the dictionary and update
virtual bool read(const dictionary& dict);
};

View File

@ -108,7 +108,7 @@ public:
//- Correct the Merkle phaseChange model
virtual void correct();
//- Read the phaseProperties dictionary and update
//- Read the dictionary and update
virtual bool read(const dictionary& dict);
};

View File

@ -127,7 +127,7 @@ public:
//- Correct the SchnerrSauer phaseChange model
virtual void correct();
//- Read the phaseProperties dictionary and update
//- Read the dictionary and update
virtual bool read(const dictionary& dict);
};

View File

@ -125,7 +125,7 @@ public:
//- Correct the cavitation model
virtual void correct() = 0;
//- Read the phaseProperties dictionary and update
//- Read the dictionary and update
virtual bool read(const dictionary& dict) = 0;
};

View File

@ -9,21 +9,26 @@ FoamFile
{
format ascii;
class dictionary;
object phaseChangeProperties;
location "constant";
object fvModels;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
phaseChangeModel SchnerrSauer;
pSat 2364;
SchnerrSauerCoeffs
VoFCavitation
{
n 1.6E+13;
dNuc 2.0E-06;
Cc 1.0;
Cv 1.0;
type VoFCavitation;
libs ("libcompressibleVoFCavitation.so");
model SchnerrSauer;
pSat 2300;
n 1.6e+13;
dNuc 2.0e-06;
Cc 1;
Cv 1;
}
// ************************************************************************* //
//************************************************************************* //