ENH: centralize more libraries in src/phaseSystemModels

- prelude to code refactoring

NOTE
    no source code change in this commit, only relocation,
    renaming and adjustment of Make/{files,options}
This commit is contained in:
Mark Olesen
2020-07-31 13:27:55 +02:00
committed by Sergio Ferraris
parent 42ce617b43
commit 03526e2097
877 changed files with 720 additions and 668 deletions

View File

@ -2,7 +2,6 @@
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/wmake/scripts/AllwmakeParseArguments
. ${WM_PROJECT_DIR:?}/wmake/scripts/have_fftw
#------------------------------------------------------------------------------
if have_fftw

View File

@ -1,5 +1,6 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
#------------------------------------------------------------------------------
wclean libso BCs
wclean

View File

@ -1,7 +1,12 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/wmake/scripts/AllwmakeParseArguments
#------------------------------------------------------------------------------
(wmake $targetType BCs && wmake $targetType && wmake $targetType rhoCentralDyMFoam)
(
wmake $targetType BCs \
&& wmake $targetType \
&& wmake $targetType rhoCentralDyMFoam \
)
#------------------------------------------------------------------------------

View File

@ -1,11 +1,13 @@
phaseSystem = $(LIB_SRC)/phaseSystemModels/reactingEuler
EXE_INC = \
-I.. \
-I$(FOAM_SOLVERS)/multiphase/reactingEulerFoam/reactingTwoPhaseEulerFoam \
-I$(LIB_SRC)/phaseSystemModels/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseSystem/lnInclude \
-I$(LIB_SRC)/phaseSystemModels/reactingEulerFoam/reactingTwoPhaseEulerFoam/twoPhaseCompressibleTurbulenceModels/lnInclude \
-I$(LIB_SRC)/phaseSystemModels/reactingEulerFoam/phaseSystems/lnInclude \
-I$(LIB_SRC)/phaseSystemModels/reactingEulerFoam/interfacialModels/lnInclude \
-I$(LIB_SRC)/phaseSystemModels/reactingEulerFoam/interfacialCompositionModels/lnInclude \
-I$(FOAM_SOLVERS)/multiphase/reactingTwoPhaseEulerFoam \
-I${phaseSystem}/twoPhaseSystem/lnInclude \
-I${phaseSystem}/twoPhaseCompressibleTurbulenceModels/lnInclude \
-I${phaseSystem}/phaseSystems/lnInclude \
-I${phaseSystem}/interfacialModels/lnInclude \
-I${phaseSystem}/interfacialCompositionModels/lnInclude \
-I./fluid \
-I../solid \
-I../fluid \
@ -23,18 +25,17 @@ EXE_INC = \
-I$(LIB_SRC)/TurbulenceModels/phaseCompressible/lnInclude \
-I$(LIB_SRC)/regionModels/regionModel/lnInclude
EXE_LIBS = \
-lfiniteVolume \
-lfvOptions \
-lmeshTools \
-lsampling \
-lcompressibleTransportModels \
-lfluidThermophysicalModels \
-lspecie \
-lsolidThermo \
-ltwoPhaseReactingTurbulenceModels \
-lmeshTools \
-lfiniteVolume \
-lfvOptions \
-lradiationModels \
-lregionModels \
-lsampling \
-lreactingTwoPhaseSystem \
-ltwoPhaseReactingTurbulenceModels \
-lreactingPhaseSystem

View File

@ -1,5 +1,6 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
#------------------------------------------------------------------------------
wclean libso DPMTurbulenceModels

View File

@ -1,7 +1,6 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/wmake/scripts/AllwmakeParseArguments
#------------------------------------------------------------------------------
wmake $targetType DPMTurbulenceModels

View File

@ -1,7 +1,8 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
#------------------------------------------------------------------------------
wclean libso CompressibleTwoPhaseMixtureTurbulenceModels
wclean libso compressibleTwoPhaseMixtureTurbulenceModels
wclean
#------------------------------------------------------------------------------

View File

@ -1,10 +1,9 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/wmake/scripts/AllwmakeParseArguments
#------------------------------------------------------------------------------
wmake $targetType CompressibleTwoPhaseMixtureTurbulenceModels
wmake $targetType compressibleTwoPhaseMixtureTurbulenceModels
wmake $targetType
#------------------------------------------------------------------------------

View File

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

View File

@ -1,9 +1,6 @@
interFoamPath = $(FOAM_SOLVERS)/multiphase/interFoam
EXE_INC = \
-I../VoF \
-I./IncompressibleTwoPhaseMixtureTurbulenceModels/lnInclude \
-I$(interFoamPath) \
-I$(FOAM_SOLVERS)/multiphase/interFoam \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/fvOptions/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
@ -40,4 +37,4 @@ EXE_LIBS = \
-lsampling \
-lregionModels \
-lsurfaceFilmModels \
-lCompressibleTwoPhaseMixtureTurbulenceModels
-lcompressibleTwoPhaseMixtureTurbulenceModels

View File

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

View File

@ -1,5 +1,6 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
#------------------------------------------------------------------------------
wclean libso twoPhaseMixtureThermo
wclean libso surfaceTensionModels

View File

@ -1,7 +1,6 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/wmake/scripts/AllwmakeParseArguments
#------------------------------------------------------------------------------
wmake $targetType twoPhaseMixtureThermo

View File

@ -1,5 +1,6 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
#------------------------------------------------------------------------------
wclean libso multiphaseMixtureThermo
wclean

View File

@ -1,7 +1,6 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/wmake/scripts/AllwmakeParseArguments
#------------------------------------------------------------------------------
wmake $targetType multiphaseMixtureThermo

View File

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

View File

@ -1,7 +1,6 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/wmake/scripts/AllwmakeParseArguments
#------------------------------------------------------------------------------
wmake $targetType mixtureViscosityModels

View File

@ -1,9 +1,7 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
#------------------------------------------------------------------------------
wclean libso phasesSystem
wclean libso massTransferModels
wclean libso CompressibleMultiPhaseTurbulenceModels
wclean libso laserDTRM
wclean

View File

@ -1,13 +1,8 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/wmake/scripts/AllwmakeParseArguments
#------------------------------------------------------------------------------
wmakeLnInclude massTransferModels
wmake $targetType phasesSystem
wmake $targetType massTransferModels
wmake $targetType CompressibleMultiPhaseTurbulenceModels
wmake $targetType laserDTRM
wmake $targetType

View File

@ -1,102 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017 OpenCFD Ltd
-------------------------------------------------------------------------------
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 "CompressibleTurbulenceModel.H"
#include "compressibleTurbulenceModel.H"
#include "multiphaseSystem.H"
#include "addToRunTimeSelectionTable.H"
#include "makeTurbulenceModel.H"
#include "ThermalDiffusivity.H"
#include "laminarModel.H"
#include "RASModel.H"
#include "LESModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
defineTurbulenceModelTypes
(
geometricOneField,
volScalarField,
compressibleTurbulenceModel,
CompressibleTurbulenceModel,
ThermalDiffusivity,
multiphaseSystem
);
makeBaseTurbulenceModel
(
geometricOneField,
volScalarField,
compressibleTurbulenceModel,
CompressibleTurbulenceModel,
ThermalDiffusivity,
multiphaseSystem
);
#define makeLaminarModel(Type) \
makeTemplatedLaminarModel \
(multiphaseSystemCompressibleTurbulenceModel, laminar, Type)
#define makeRASModel(Type) \
makeTemplatedTurbulenceModel \
(multiphaseSystemCompressibleTurbulenceModel, RAS, Type)
#define makeLESModel(Type) \
makeTemplatedTurbulenceModel \
(multiphaseSystemCompressibleTurbulenceModel, LES, Type)
// -------------------------------------------------------------------------- //
// Laminar models
// -------------------------------------------------------------------------- //
#include "Stokes.H"
makeLaminarModel(Stokes);
// -------------------------------------------------------------------------- //
// RAS models
// -------------------------------------------------------------------------- //
#include "kEpsilon.H"
makeRASModel(kEpsilon);
// -------------------------------------------------------------------------- //
// LES models
// -------------------------------------------------------------------------- //
#include "Smagorinsky.H"
makeLESModel(Smagorinsky);
#include "kEqn.H"
makeLESModel(kEqn);
// ************************************************************************* //

View File

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

View File

@ -1,21 +0,0 @@
EXE_INC = \
-I../phasesSystem/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/phaseCompressible/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/phaseIncompressible/lnInclude
LIB_LIBS = \
-lfiniteVolume \
-lmeshTools \
-lfluidThermophysicalModels \
-lspecie \
-lincompressibleTransportModels \
-lcompressibleTransportModels \
-lturbulenceModels \
-lcompressibleTurbulenceModels

View File

@ -1,6 +1,8 @@
phaseSystem = $(LIB_SRC)/phaseSystemModels/multiphaseInter
EXE_INC = \
-I./phasesSystem/lnInclude \
-I./CompressibleMultiPhaseTurbulenceModels/lnInclude \
-I${phaseSystem}/phasesSystem/lnInclude \
-I${phaseSystem}/compressibleMultiPhaseTurbulenceModels/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/fvOptions/lnInclude\
-I$(LIB_SRC)/meshTools/lnInclude \
@ -24,10 +26,10 @@ EXE_LIBS = \
-lcompressibleTransportModels \
-lradiationModels \
-lfluidThermophysicalModels \
-lIncompressibleMultiphaseSystems \
-lCompressibleMultiPhaseTurbulenceModels \
-lmassTransferModels \
-lsolidThermo \
-lsolidSpecie \
-ltwoPhaseProperties \
-llaserDTRM
-llaserDTRM \
-lincompressibleMultiphaseSystems \
-lcompressibleMultiPhaseTurbulenceModels

View File

@ -1,5 +1,7 @@
phaseSystem = $(LIB_SRC)/phaseSystemModels/multiphaseInter
EXE_INC = \
-I../phasesSystem/lnInclude \
-I${phaseSystem}/phasesSystem/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/lagrangian/basic/lnInclude \
@ -9,4 +11,5 @@ LIB_LIBS = \
-lfiniteVolume \
-lmeshTools \
-llagrangian \
-lradiationModels
-lradiationModels \
-lincompressibleMultiphaseSystems

View File

@ -1,329 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
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 "InterfaceCompositionModel.H"
#include "phaseModel.H"
#include "phasePair.H"
#include "pureMixture.H"
#include "multiComponentMixture.H"
#include "rhoThermo.H"
#include "zeroGradientFvPatchFields.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class Thermo, class OtherThermo>
template<class ThermoType>
const typename Foam::multiComponentMixture<ThermoType>::thermoType&
Foam::InterfaceCompositionModel<Thermo, OtherThermo>::getLocalThermo
(
const word& speciesName,
const multiComponentMixture<ThermoType>& globalThermo
) const
{
return
globalThermo.getLocalThermo
(
globalThermo.species()
[
speciesName
]
);
}
template<class Thermo, class OtherThermo>
template<class ThermoType>
const typename Foam::pureMixture<ThermoType>::thermoType&
Foam::InterfaceCompositionModel<Thermo, OtherThermo>::getLocalThermo
(
const word& speciesName,
const pureMixture<ThermoType>& globalThermo
) const
{
return globalThermo.cellMixture(0);
}
template<class Thermo, class OtherThermo>
template<class ThermoType>
Foam::tmp<Foam::volScalarField>
Foam::InterfaceCompositionModel<Thermo, OtherThermo>::getSpecieMassFraction
(
const word& speciesName,
const multiComponentMixture<ThermoType>& mixture
) const
{
const fvMesh& mesh = fromThermo_.p().mesh();
auto tY = tmp<volScalarField>::New
(
IOobject
(
"tY",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionedScalar(dimless, Zero),
zeroGradientFvPatchScalarField::typeName
);
auto& Ys = tY.ref();
Ys = mixture.Y(speciesName);
return tY;
}
template<class Thermo, class OtherThermo>
template<class ThermoType>
Foam::tmp<Foam::volScalarField>
Foam::InterfaceCompositionModel<Thermo, OtherThermo>::getSpecieMassFraction
(
const word& speciesName,
const pureMixture<ThermoType>& mixture
) const
{
const fvMesh& mesh = fromThermo_.p().mesh();
return tmp<volScalarField>::New
(
IOobject
(
"tY",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionedScalar("one", dimless, scalar(1)),
zeroGradientFvPatchScalarField::typeName
);
}
template<class Thermo, class OtherThermo>
template<class ThermoType>
Foam::tmp<Foam::volScalarField>
Foam::InterfaceCompositionModel<Thermo, OtherThermo>::MwMixture
(
const pureMixture<ThermoType>& mixture
) const
{
const fvMesh& mesh = fromThermo_.p().mesh();
return tmp<volScalarField>::New
(
IOobject
(
"tM",
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionedScalar
(
"Mw",
dimMass/dimMoles,
1e-3*mixture.cellMixture(0).W()
),
zeroGradientFvPatchScalarField::typeName
);
}
template<class Thermo, class OtherThermo>
template<class ThermoType>
Foam::tmp<Foam::volScalarField>
Foam::InterfaceCompositionModel<Thermo, OtherThermo>::MwMixture
(
const multiComponentMixture<ThermoType>& mixture
) const
{
return refCast<const basicSpecieMixture>(mixture).W();
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Thermo, class OtherThermo>
Foam::InterfaceCompositionModel<Thermo, OtherThermo>::InterfaceCompositionModel
(
const dictionary& dict,
const phasePair& pair
)
:
interfaceCompositionModel(dict, pair),
fromThermo_
(
pair.from().mesh().lookupObject<Thermo>
(
IOobject::groupName
(
basicThermo::dictName,
pair.from().name()
)
)
),
toThermo_
(
pair.to().mesh().lookupObject<OtherThermo>
(
IOobject::groupName
(
basicThermo::dictName,
pair.to().name()
)
)
),
Le_("Le", dimless, 1.0, dict)
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
template<class Thermo, class OtherThermo>
Foam::tmp<Foam::volScalarField>
Foam::InterfaceCompositionModel<Thermo, OtherThermo>::D
(
const word& speciesName
) const
{
const typename Thermo::thermoType& fromThermo =
getLocalThermo
(
speciesName,
fromThermo_
);
const volScalarField& p(fromThermo_.p());
const volScalarField& T(fromThermo_.T());
auto tmpD = tmp<volScalarField>::New
(
IOobject
(
IOobject::groupName("D", pair_.name()),
p.time().timeName(),
p.mesh()
),
p.mesh(),
dimensionedScalar(dimArea/dimTime, Zero)
);
auto& D = tmpD.ref();
forAll(p, cellI)
{
D[cellI] =
fromThermo.alphah(p[cellI], T[cellI])
/fromThermo.rho(p[cellI], T[cellI]);
}
D /= Le_;
D.correctBoundaryConditions();
return tmpD;
}
template<class Thermo, class OtherThermo>
Foam::tmp<Foam::volScalarField>
Foam::InterfaceCompositionModel<Thermo, OtherThermo>::L
(
const word& speciesName,
const volScalarField& Tf
) const
{
const typename Thermo::thermoType& fromThermo =
getLocalThermo(speciesName, fromThermo_);
const typename OtherThermo::thermoType& toThermo =
getLocalThermo(speciesName, toThermo_);
const volScalarField& p(fromThermo_.p());
auto tmpL = tmp<volScalarField>::New
(
IOobject
(
IOobject::groupName("L", pair_.name()),
p.time().timeName(),
p.mesh()
),
p.mesh(),
dimensionedScalar(dimEnergy/dimMass, Zero),
zeroGradientFvPatchScalarField::typeName
);
auto& L = tmpL.ref();
// from Thermo (from) to Thermo (to)
forAll(p, cellI)
{
L[cellI] = fromThermo.Hc() - toThermo.Hc();
}
L.correctBoundaryConditions();
return tmpL;
}
template<class Thermo, class OtherThermo>
Foam::tmp<Foam::volScalarField>
Foam::InterfaceCompositionModel<Thermo, OtherThermo>::dY
(
const word& speciesName,
const volScalarField& Tf
) const
{
NotImplemented;
return nullptr;
}
template<class Thermo, class OtherThermo>
Foam::tmp<Foam::volScalarField>
Foam::InterfaceCompositionModel<Thermo, OtherThermo>::Yf
(
const word& speciesName,
const volScalarField& Tf
) const
{
NotImplemented;
return nullptr;
}
// ************************************************************************* //

View File

@ -1,276 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
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::InterfaceCompositionModel
Description
Base class for interface composition models, templated on the two
thermodynamic models either side of the interface.
SourceFiles
InterfaceCompositionModel.C
\*---------------------------------------------------------------------------*/
#ifndef InterfaceCompositionModel_H
#define InterfaceCompositionModel_H
#include "interfaceCompositionModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class phaseModel;
class phasePair;
template <class ThermoType> class pureMixture;
template <class ThermoType> class multiComponentMixture;
/*---------------------------------------------------------------------------*\
Class InterfaceCompositionModel Declaration
\*---------------------------------------------------------------------------*/
template<class Thermo, class OtherThermo>
class InterfaceCompositionModel
:
public interfaceCompositionModel
{
protected:
// Private data
//- Thermo (from)
const Thermo& fromThermo_;
//- Other Thermo (to)
const OtherThermo& toThermo_;
//- Lewis number
const dimensionedScalar Le_;
// Private member functions
//- Get a reference to the local thermo for a pure mixture
template<class ThermoType>
const typename pureMixture<ThermoType>::thermoType&
getLocalThermo
(
const word& speciesName,
const pureMixture<ThermoType>& globalThermo
) const;
//- Get a reference to the local thermo for a multi component mixture
template<class ThermoType>
const typename multiComponentMixture<ThermoType>::thermoType&
getLocalThermo
(
const word& speciesName,
const multiComponentMixture<ThermoType>& globalThermo
) const;
//- Return mass fraction for a pureMixture equal to one
template<class ThermoType>
tmp<volScalarField> getSpecieMassFraction
(
const word& speciesName,
const pureMixture<ThermoType>& thermo
) const;
//- Return mass fraction for speciesName
template<class ThermoType>
tmp<volScalarField> getSpecieMassFraction
(
const word& speciesName,
const multiComponentMixture<ThermoType>& thermo
) const;
//- Return moleculas weight of the mixture for pureMixture [Kg/mol]
template<class ThermoType>
tmp<volScalarField> MwMixture
(
const pureMixture<ThermoType>& thermo
) const;
//- Return moleculas weight of the mixture for multiComponentMixture
// [Kg/mol]
template<class ThermoType>
tmp<volScalarField> MwMixture
(
const multiComponentMixture<ThermoType>&
) const;
public:
//- Construct from components
InterfaceCompositionModel(const dictionary& dict, const phasePair& pair);
//- Destructor
~InterfaceCompositionModel() = default;
// Member Functions
//- Mass fraction difference between the interface and the field
virtual tmp<volScalarField> dY
(
const word& speciesName,
const volScalarField& Tf
) const;
//- Reference mass fraction for species based models
virtual tmp<volScalarField> Yf
(
const word& speciesName,
const volScalarField& Tf
) const;
//- Mass diffusivity of the local thermo
virtual tmp<volScalarField> D
(
const word& speciesName
) const;
//- Latent heat (to - from)(thermo - otherThermo)
virtual tmp<volScalarField> L
(
const word& speciesName,
const volScalarField& Tf
) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Instantiation for multi-component (from) to single-component (to)
#define makeInterfaceDispSpecieMixtureType(Type, Thermo, Comp, Mix, Phys, OtherThermo, OtherComp, OtherMix, OtherPhys)\
\
typedef Thermo<Comp, SpecieMixture<Mix<Phys>>> \
Type##Thermo##Comp##Mix##Phys; \
\
typedef OtherThermo<OtherComp, OtherMix<OtherPhys>> \
Type##Other##OtherThermo##OtherComp##OtherMix##OtherPhys; \
\
addInterfaceCompositionToRunTimeSelectionTable \
( \
Type, \
Type##Thermo##Comp##Mix##Phys, \
Type##Other##OtherThermo##OtherComp##OtherMix##OtherPhys \
)
// Instantiation for single-component (from) to multi-component (to)
#define makeInterfaceContSpecieMixtureType(Type, Thermo, Comp, Mix, Phys, OtherThermo, OtherComp, OtherMix, OtherPhys)\
\
typedef Thermo<Comp, Mix<Phys>> \
Type##Thermo##Comp##Mix##Phys; \
\
typedef OtherThermo<OtherComp, SpecieMixture<OtherMix<OtherPhys>>> \
Type##Other##OtherThermo##OtherComp##OtherMix##OtherPhys; \
\
addInterfaceCompositionToRunTimeSelectionTable \
( \
Type, \
Type##Thermo##Comp##Mix##Phys, \
Type##Other##OtherThermo##OtherComp##OtherMix##OtherPhys \
)
// Instantiation for single-component-single-component pairs
#define makeInterfacePureType(Type, Thermo, Comp, Mix, Phys, OtherThermo, OtherComp, OtherMix, OtherPhys)\
\
typedef Thermo<Comp, Mix<Phys>> \
Type##Thermo##Comp##Mix##Phys; \
\
typedef OtherThermo<OtherComp, OtherMix<OtherPhys>> \
Type##Other##OtherThermo##OtherComp##OtherMix##OtherPhys; \
\
addInterfaceCompositionToRunTimeSelectionTable \
( \
Type, \
Type##Thermo##Comp##Mix##Phys, \
Type##Other##OtherThermo##OtherComp##OtherMix##OtherPhys \
)
// Instantiation for multi-component-multi-component pairs
#define makeSpecieInterfaceSpecieMixtures(Type, Thermo, Comp, Mix, Phys, OtherThermo, OtherComp, OtherMix, OtherPhys)\
\
typedef Thermo<Comp, SpecieMixture<Mix<Phys>>> \
Type##Thermo##Comp##Mix##Phys; \
\
typedef OtherThermo<OtherComp, SpecieMixture<OtherMix<OtherPhys>>> \
Type##Other##OtherThermo##OtherComp##OtherMix##OtherPhys; \
\
addInterfaceCompositionToRunTimeSelectionTable \
( \
Type, \
Type##Thermo##Comp##Mix##Phys, \
Type##Other##OtherThermo##OtherComp##OtherMix##OtherPhys \
)
// Addition to the run-time selection table
#define addInterfaceCompositionToRunTimeSelectionTable(Type, Thermo, OtherThermo)\
\
typedef Type<Thermo, OtherThermo> \
Type##Thermo##OtherThermo; \
\
defineTemplateTypeNameAndDebugWithName \
( \
Type##Thermo##OtherThermo, \
( \
word(Type##Thermo##OtherThermo::typeName_()) + "<" \
+ word(Thermo::typeName) + "," \
+ word(OtherThermo::typeName) + ">" \
).c_str(), \
0 \
); \
\
addToRunTimeSelectionTable \
( \
interfaceCompositionModel, \
Type##Thermo##OtherThermo, \
dictionary \
)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "InterfaceCompositionModel.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,481 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
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 "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "thermoPhysicsTypes.H"
#include "rhoConst.H"
#include "perfectFluid.H"
#include "Boussinesq.H"
#include "pureMixture.H"
#include "multiComponentMixture.H"
#include "reactingMixture.H"
#include "SpecieMixture.H"
#include "rhoThermo.H"
#include "rhoReactionThermo.H"
#include "heRhoThermo.H"
#include "solidThermo.H"
#include "heSolidThermo.H"
#include "solidThermoPhysicsTypes.H"
#include "kineticGasEvaporation.H"
#include "Lee.H"
#include "interfaceHeatResistance.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef
constTransport
<
species::thermo
<
hConstThermo
<
rhoConst<specie>
>,
sensibleEnthalpy
>
> constRhoHThermoPhysics;
typedef
constTransport
<
species::thermo
<
hConstThermo
<
Boussinesq<specie>
>,
sensibleEnthalpy
>
> BoussinesqFluidEThermoPhysics;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
using namespace meltingEvaporationModels;
//NOTE: First thermo (from) and second otherThermo (to)
// kineticGasEvaporation model definitions
// From pure liquid (rhoConst) to a multi-component gas incomp phase
makeInterfaceContSpecieMixtureType
(
kineticGasEvaporation,
heRhoThermo,
rhoThermo,
pureMixture,
constRhoHThermoPhysics,
heRhoThermo,
rhoReactionThermo,
multiComponentMixture,
constIncompressibleGasHThermoPhysics
);
// From pure liquid (BoussinesqFluid) to a multi-component gas incomp
// phase
makeInterfaceContSpecieMixtureType
(
kineticGasEvaporation,
heRhoThermo,
rhoThermo,
pureMixture,
BoussinesqFluidEThermoPhysics,
heRhoThermo,
rhoReactionThermo,
multiComponentMixture,
constIncompressibleGasHThermoPhysics
);
// From pure liquid (rhoConst) to pure gas (incompressible ideal gas)
makeInterfacePureType
(
kineticGasEvaporation,
heRhoThermo,
rhoThermo,
pureMixture,
constRhoHThermoPhysics,
heRhoThermo,
rhoThermo,
pureMixture,
constIncompressibleGasHThermoPhysics
);
// From pure liquid (const rho) to pure gas (rhoConst) gas
makeInterfacePureType
(
kineticGasEvaporation,
heRhoThermo,
rhoThermo,
pureMixture,
constRhoHThermoPhysics,
heRhoThermo,
rhoThermo,
pureMixture,
constRhoHThermoPhysics
);
// From pure liquid (Boussinesq) to pure gas (incompressible ideal gas)
makeInterfacePureType
(
kineticGasEvaporation,
heRhoThermo,
rhoThermo,
pureMixture,
BoussinesqFluidEThermoPhysics,
heRhoThermo,
rhoThermo,
pureMixture,
constIncompressibleGasHThermoPhysics
);
// From pure liquid (Boussinesq) to pure gas (rho const)
makeInterfacePureType
(
kineticGasEvaporation,
heRhoThermo,
rhoThermo,
pureMixture,
BoussinesqFluidEThermoPhysics,
heRhoThermo,
rhoThermo,
pureMixture,
constRhoHThermoPhysics
);
// Lee model definitions
// From pure phase (rho const) to phase (rho const)
makeInterfacePureType
(
Lee,
heRhoThermo,
rhoThermo,
pureMixture,
constRhoHThermoPhysics,
heRhoThermo,
rhoThermo,
pureMixture,
constRhoHThermoPhysics
);
// From pure phase (rho const) to phase (Boussinesq)
makeInterfacePureType
(
Lee,
heRhoThermo,
rhoThermo,
pureMixture,
constRhoHThermoPhysics,
heRhoThermo,
rhoThermo,
pureMixture,
BoussinesqFluidEThermoPhysics
);
// From pure phase (solidThermo) to phase (Boussinesq)
makeInterfacePureType
(
Lee,
heSolidThermo,
solidThermo,
pureMixture,
hConstSolidThermoPhysics,
heRhoThermo,
rhoThermo,
pureMixture,
BoussinesqFluidEThermoPhysics
);
// From pure phase (solidThermo) to phase (rho const)
makeInterfacePureType
(
Lee,
heSolidThermo,
solidThermo,
pureMixture,
hConstSolidThermoPhysics,
heRhoThermo,
rhoThermo,
pureMixture,
constRhoHThermoPhysics
);
// From pure phase (all-poly solidThermo) to phase (ico-rho)
makeInterfacePureType
(
Lee,
heSolidThermo,
solidThermo,
pureMixture,
hPolyTranspPolyIcoSolidThermoPhysics,
heRhoThermo,
rhoThermo,
pureMixture,
icoPoly8HThermoPhysics
);
// From pure phase (exp-Transp, hPower solidThermo) to phase (ico-rho)
makeInterfacePureType
(
Lee,
heSolidThermo,
solidThermo,
pureMixture,
hPowerSolidThermoPhysics,
heRhoThermo,
rhoThermo,
pureMixture,
icoPoly8HThermoPhysics
);
// From pure phase (const rho) to multi phase (incomp ideal gas)
makeInterfaceContSpecieMixtureType
(
Lee,
heRhoThermo,
rhoThermo,
pureMixture,
constRhoHThermoPhysics,
heRhoThermo,
rhoReactionThermo,
multiComponentMixture,
constIncompressibleGasHThermoPhysics
);
// From pure phase (Boussinesq) to phase (solidThermo)
makeInterfacePureType
(
Lee,
heRhoThermo,
rhoThermo,
pureMixture,
BoussinesqFluidEThermoPhysics,
heSolidThermo,
solidThermo,
pureMixture,
hConstSolidThermoPhysics
);
// From pure phase (rho const) to phase (solidThermo)
makeInterfacePureType
(
Lee,
heRhoThermo,
rhoThermo,
pureMixture,
constRhoHThermoPhysics,
heSolidThermo,
solidThermo,
pureMixture,
hConstSolidThermoPhysics
);
//From pure liquid phase (ico-rho) to pure phase (exp-Transp, hPower solidThermo)
makeInterfacePureType
(
Lee,
heRhoThermo,
rhoThermo,
pureMixture,
icoPoly8HThermoPhysics,
heSolidThermo,
solidThermo,
pureMixture,
hPowerSolidThermoPhysics
);
// interfaceHeatResistance model definitions
// From pure phase (rho const) to phase (rho const)
makeInterfacePureType
(
interfaceHeatResistance,
heRhoThermo,
rhoThermo,
pureMixture,
constRhoHThermoPhysics,
heRhoThermo,
rhoThermo,
pureMixture,
constRhoHThermoPhysics
);
// From pure phase (rho const) to phase (Boussinesq)
makeInterfacePureType
(
interfaceHeatResistance,
heRhoThermo,
rhoThermo,
pureMixture,
constRhoHThermoPhysics,
heRhoThermo,
rhoThermo,
pureMixture,
BoussinesqFluidEThermoPhysics
);
// From pure phase (solidThermo) to phase (Boussinesq)
makeInterfacePureType
(
interfaceHeatResistance,
heSolidThermo,
solidThermo,
pureMixture,
hConstSolidThermoPhysics,
heRhoThermo,
rhoThermo,
pureMixture,
BoussinesqFluidEThermoPhysics
);
// From pure phase (solidThermo) to phase (rho const)
makeInterfacePureType
(
interfaceHeatResistance,
heSolidThermo,
solidThermo,
pureMixture,
hConstSolidThermoPhysics,
heRhoThermo,
rhoThermo,
pureMixture,
constRhoHThermoPhysics
);
// From pure phase (all-poly solidThermo) to phase (ico-rho)
makeInterfacePureType
(
interfaceHeatResistance,
heSolidThermo,
solidThermo,
pureMixture,
hPolyTranspPolyIcoSolidThermoPhysics,
heRhoThermo,
rhoThermo,
pureMixture,
icoPoly8HThermoPhysics
);
// From pure phase (exp-Transp, hPower solidThermo) to phase (ico-rho)
makeInterfacePureType
(
interfaceHeatResistance,
heSolidThermo,
solidThermo,
pureMixture,
hPowerSolidThermoPhysics,
heRhoThermo,
rhoThermo,
pureMixture,
icoPoly8HThermoPhysics
);
// From pure phase (const rho) to multi phase (incomp ideal gas)
makeInterfaceContSpecieMixtureType
(
interfaceHeatResistance,
heRhoThermo,
rhoThermo,
pureMixture,
constRhoHThermoPhysics,
heRhoThermo,
rhoReactionThermo,
multiComponentMixture,
constIncompressibleGasHThermoPhysics
);
// From pure phase (Boussinesq) to phase (solidThermo)
makeInterfacePureType
(
interfaceHeatResistance,
heRhoThermo,
rhoThermo,
pureMixture,
BoussinesqFluidEThermoPhysics,
heSolidThermo,
solidThermo,
pureMixture,
hConstSolidThermoPhysics
);
// From pure phase (rho const) to phase (solidThermo)
makeInterfacePureType
(
interfaceHeatResistance,
heRhoThermo,
rhoThermo,
pureMixture,
constRhoHThermoPhysics,
heSolidThermo,
solidThermo,
pureMixture,
hConstSolidThermoPhysics
);
//From pure liquid phase (ico-rho) to pure phase (exp-Transp, hPower solidThermo)
makeInterfacePureType
(
interfaceHeatResistance,
heRhoThermo,
rhoThermo,
pureMixture,
icoPoly8HThermoPhysics,
heSolidThermo,
solidThermo,
pureMixture,
hPowerSolidThermoPhysics
);
}
// ************************************************************************* //

View File

@ -1,189 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
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 "Lee.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Thermo, class OtherThermo>
Foam::meltingEvaporationModels::Lee<Thermo, OtherThermo>::Lee
(
const dictionary& dict,
const phasePair& pair
)
:
InterfaceCompositionModel<Thermo, OtherThermo>(dict, pair),
C_("C", inv(dimTime), dict),
Tactivate_("Tactivate", dimTemperature, dict),
alphaMin_(dict.getOrDefault<scalar>("alphaMin", 0))
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
template<class Thermo, class OtherThermo>
Foam::tmp<Foam::volScalarField>
Foam::meltingEvaporationModels::Lee<Thermo, OtherThermo>::Kexp
(
const volScalarField& refValue
)
{
{
const volScalarField from
(
min(max(this->pair().from(), scalar(0)), scalar(1))
);
const volScalarField coeff
(
C_*from*this->pair().from().rho()*pos(from - alphaMin_)
*(refValue - Tactivate_)
/Tactivate_
);
if (sign(C_.value()) > 0)
{
return
(
coeff*pos(refValue - Tactivate_)
);
}
else
{
return
(
coeff*pos(Tactivate_ - refValue)
);
}
}
}
template<class Thermo, class OtherThermo>
Foam::tmp<Foam::volScalarField>
Foam::meltingEvaporationModels::Lee<Thermo, OtherThermo>::KSp
(
label variable,
const volScalarField& refValue
)
{
if (this->modelVariable_ == variable)
{
volScalarField from
(
min(max(this->pair().from(), scalar(0)), scalar(1))
);
const volScalarField coeff
(
C_*from*this->pair().from().rho()*pos(from - alphaMin_)
/Tactivate_
);
if (sign(C_.value()) > 0)
{
return
(
coeff*pos(refValue - Tactivate_)
);
}
else
{
return
(
coeff*pos(Tactivate_ - refValue)
);
}
}
else
{
return tmp<volScalarField> ();
}
}
template<class Thermo, class OtherThermo>
Foam::tmp<Foam::volScalarField>
Foam::meltingEvaporationModels::Lee<Thermo, OtherThermo>::KSu
(
label variable,
const volScalarField& refValue
)
{
if (this->modelVariable_ == variable)
{
volScalarField from
(
min(max(this->pair().from(), scalar(0)), scalar(1))
);
const volScalarField coeff
(
C_*from*this->pair().from().rho()*pos(from - alphaMin_)
);
if (sign(C_.value()) > 0)
{
return
(
-coeff*pos(refValue - Tactivate_)
);
}
else
{
return
(
coeff*pos(Tactivate_ - refValue)
);
}
}
else
{
return tmp<volScalarField> ();
}
}
template<class Thermo, class OtherThermo>
const Foam::dimensionedScalar&
Foam::meltingEvaporationModels::Lee<Thermo, OtherThermo>::Tactivate() const
{
return Tactivate_;
}
template<class Thermo, class OtherThermo>
bool
Foam::meltingEvaporationModels::Lee<Thermo, OtherThermo>::includeDivU()
{
return true;
}
// ************************************************************************* //

View File

@ -1,191 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
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::meltingEvaporationModels::Lee
Description
Mass transfer Lee model. Simple model driven by field value difference as:
\f[
\dot{m} = C \rho \alpha (T - T_{activate})/T_{activate}
\f]
where C is a model constant.
if C > 0:
\f[
\dot{m} = C \rho \alpha (T - T_{activate})/T_{activate}
\f]
for \f[ T > T_{activate} \f]
and
\f[ mDot = 0.0 \f] for \f[ T < T_{activate} \f]
if C < 0:
\f[
\dot{m} = -C \rho \alpha (T_{activate} - T)/T_{activate}
\f]
for \f[ T < T_{activate} \f]
and
\f[ \dot{m} = 0.0 \f] for \f[ T > T_{activate} \f]
Based on the reference:
-# W. H. Lee. "A Pressure Iteration Scheme for Two-Phase Modeling".
Technical Report LA-UR 79-975. Los Alamos Scientific Laboratory,
Los Alamos, New Mexico. 1979.
Usage
Example usage:
\verbatim
massTransferModel
(
(solid to liquid)
{
type Lee;
C 40;
Tactivate 302.78;
}
);
\endverbatim
Where:
\table
Property | Description | Required | Default value
Tactivate | Activation temperature | yes
C | Model constant | yes
includeVolChange | Volumen change | no | yes
species | Specie name on the other phase | no | none
\endtable
SourceFiles
Lee.C
\*---------------------------------------------------------------------------*/
#ifndef meltingEvaporationModels_Lee_H
#define meltingEvaporationModels_Lee_H
#include "InterfaceCompositionModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *//
namespace Foam
{
namespace meltingEvaporationModels
{
/*---------------------------------------------------------------------------*\
Class Lee Declaration
\*---------------------------------------------------------------------------*/
template<class Thermo, class OtherThermo>
class Lee
:
public InterfaceCompositionModel<Thermo, OtherThermo>
{
// Private Data
//- Condensation coefficient [1/s]
dimensionedScalar C_;
//- Phase transition temperature
const dimensionedScalar Tactivate_;
//- Phase minimum value for activation
scalar alphaMin_;
public:
//- Runtime type information
TypeName("Lee");
// Constructors
//- Construct from components
Lee
(
const dictionary& dict,
const phasePair& pair
);
//- Destructor
virtual ~Lee() = default;
// Member Functions
//- Explicit total mass transfer coefficient
virtual tmp<volScalarField> Kexp
(
const volScalarField& field
);
//- Implicit mass transfer coefficient
virtual tmp<volScalarField> KSp
(
label modelVariable,
const volScalarField& field
);
//- Explicit mass transfer coefficient
virtual tmp<volScalarField> KSu
(
label modelVariable,
const volScalarField& field
);
//- Return T transition between phases
virtual const dimensionedScalar& Tactivate() const;
//- Add/subtract alpha*div(U) as a source term
//- for alpha, substituting div(U) = mDot(1/rho1 - 1/rho2)
virtual bool includeDivU();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace meltingEvaporationModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "Lee.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,5 +0,0 @@
interfaceCompositionModel/interfaceCompositionModel.C
interfaceCompositionModel/interfaceCompositionModelNew.C
InterfaceCompositionModel/InterfaceCompositionModels.C
LIB = $(FOAM_LIBBIN)/libmassTransferModels

View File

@ -1,20 +0,0 @@
EXE_INC = \
-I../phasesSystem/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/solidThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/solidSpecie/lnInclude \
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
-I$(LIB_SRC)/transportModels/geometricVoF/lnInclude
LIB_LIBS = \
-lfiniteVolume \
-lmeshTools \
-lfluidThermophysicalModels \
-lreactionThermophysicalModels \
-lsolidThermo \
-lsolidSpecie \
-lgeometricVoF

View File

@ -1,106 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
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 "interfaceCompositionModel.H"
#include "phaseModel.H"
#include "phasePair.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(interfaceCompositionModel, 0);
defineRunTimeSelectionTable(interfaceCompositionModel, dictionary);
}
const Foam::Enum<Foam::interfaceCompositionModel::modelVariable>
Foam::interfaceCompositionModel::modelVariableNames
{
{ modelVariable::T, "temperature" },
{ modelVariable::P, "pressure" },
{ modelVariable::Y, "massFraction" },
{ modelVariable::alpha, "alphaVolumeFraction" },
};
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::interfaceCompositionModel::interfaceCompositionModel
(
const dictionary& dict,
const phasePair& pair
)
:
modelVariable_
(
modelVariableNames.getOrDefault
(
"variable",
dict,
modelVariable::T
)
),
includeVolChange_(dict.getOrDefault("includeVolChange", true)),
pair_(pair),
speciesName_(dict.getOrDefault<word>("species", "none")),
mesh_(pair_.from().mesh())
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const Foam::word Foam::interfaceCompositionModel::transferSpecie() const
{
return speciesName_;
}
const Foam::phasePair& Foam::interfaceCompositionModel::pair() const
{
return pair_;
}
const Foam::word Foam::interfaceCompositionModel::variable() const
{
return modelVariableNames[modelVariable_];
}
bool Foam::interfaceCompositionModel::includeDivU()
{
return true;
}
bool Foam::interfaceCompositionModel::includeVolChange()
{
return includeVolChange_;
}
// ************************************************************************* //

View File

@ -1,221 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
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::interfaceCompositionModel
Description
Generic base class for interface models. Mass transfer models are
interface models between two thermos.
Abstract class for mass transfer functions
SourceFiles
interfaceCompositionModel.C
\*---------------------------------------------------------------------------*/
#ifndef interfaceCompositionModel_H
#define interfaceCompositionModel_H
#include "volFields.H"
#include "dictionary.H"
#include "runTimeSelectionTables.H"
#include "Enum.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward Declarations
class phaseModel;
class phasePair;
/*---------------------------------------------------------------------------*\
Class interfaceCompositionModel Declaration
\*---------------------------------------------------------------------------*/
class interfaceCompositionModel
{
public:
// Public type
//- Enumeration for variable based mass transfer models
enum modelVariable
{
T, /* temperature based */
P, /* pressure based */
Y, /* mass fraction based */
alpha /* alpha source */
};
static const Enum<modelVariable> modelVariableNames;
//- Enumeration for model variables
modelVariable modelVariable_;
//- Add volume change in pEq
bool includeVolChange_;
protected:
// Protected Data
//- Phase pair
const phasePair& pair_;
//- Names of the transferring specie
word speciesName_;
//- Reference to mesh
const fvMesh& mesh_;
public:
//- Runtime type information
TypeName("interfaceCompositionModel");
// Declare runtime construction
declareRunTimeSelectionTable
(
autoPtr,
interfaceCompositionModel,
dictionary,
(
const dictionary& dict,
const phasePair& pair
),
(dict, pair)
);
// Constructors
//- Construct from a dictionary and a phase pair
interfaceCompositionModel
(
const dictionary& dict,
const phasePair& pair
);
//- Destructor
virtual ~interfaceCompositionModel() = default;
// Selectors
static autoPtr<interfaceCompositionModel> New
(
const dictionary& dict,
const phasePair& pair
);
// Member Functions
//- Return the transferring species name
const word transferSpecie() const;
//- Return pair
const phasePair& pair() const;
//- Interface mass fraction
virtual tmp<volScalarField> Yf
(
const word& speciesName,
const volScalarField& Tf
) const = 0;
//- Mass fraction difference between the interface and the field
virtual tmp<volScalarField> dY
(
const word& speciesName,
const volScalarField& Tf
) const = 0;
//- Mass diffusivity
virtual tmp<volScalarField> D
(
const word& speciesName
) const = 0;
//- Latent heat (delta Hc)
virtual tmp<volScalarField> L
(
const word& speciesName,
const volScalarField& Tf
) const = 0;
//- Explicit full mass transfer
virtual tmp<volScalarField> Kexp
(
const volScalarField& field
) = 0;
//- Implicit mass transfer
virtual tmp<volScalarField> KSp
(
label modelVariable,
const volScalarField& field
) = 0;
//- Explicit mass transfer
virtual tmp<volScalarField> KSu
(
label modelVariable,
const volScalarField& field
) = 0;
//- Reference value
virtual const dimensionedScalar& Tactivate() const = 0;
//- Add/subtract alpha*div(U) as a source term
//- for alpha, substituting div(U) = mDot(1/rho1 - 1/rho2)
virtual bool includeDivU();
//- Add volume change in pEq
bool includeVolChange();
//- Returns the variable on which the model is based
const word variable() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,72 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
-------------------------------------------------------------------------------
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 "interfaceCompositionModel.H"
#include "phasePair.H"
#include "rhoThermo.H"
// * * * * * * * * * * * * * * * * Selector * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::interfaceCompositionModel>
Foam::interfaceCompositionModel::New
(
const dictionary& dict,
const phasePair& pair
)
{
const word modelType
(
dict.get<word>("type")
+ "<"
+ pair.phase1().thermo().type()
+ ","
+ pair.phase2().thermo().type()
+ ">"
);
Info<< "Selecting interfaceCompositionModel for "
<< pair << ": " << modelType << endl;
const auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
if (!cstrIter.found())
{
FatalIOErrorInLookup
(
dict,
"interfaceCompositionModel",
modelType,
*dictionaryConstructorTablePtr_
) << exit(FatalIOError);
}
return cstrIter()(dict, pair);
}
// ************************************************************************* //

View File

@ -1,337 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2020 OpenCFD Ltd.
Copyright (C) 2020 Henning Scheufler
-------------------------------------------------------------------------------
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 "interfaceHeatResistance.H"
#include "constants.H"
#include "cutCellIso.H"
#include "volPointInterpolation.H"
#include "wallPolyPatch.H"
#include "fvcSmooth.H"
using namespace Foam::constant;
// * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * * //
template<class Thermo, class OtherThermo>
void Foam::meltingEvaporationModels::
interfaceHeatResistance<Thermo, OtherThermo>
::updateInterface(const volScalarField& T)
{
const fvMesh& mesh = this->mesh_;
const volScalarField& alpha = this->pair().from();
scalarField ap
(
volPointInterpolation::New(mesh).interpolate(alpha)
);
cutCellIso cutCell(mesh, ap);
forAll(interfaceArea_, celli)
{
label status = cutCell.calcSubCell(celli, isoAlpha_);
interfaceArea_[celli] = 0;
if (status == 0) // cell is cut
{
interfaceArea_[celli] =
mag(cutCell.faceArea())/mesh.V()[celli];
}
}
const polyBoundaryMesh& pbm = mesh.boundaryMesh();
forAll(pbm, patchi)
{
if (isA<wallPolyPatch>(pbm[patchi]))
{
const polyPatch& pp = pbm[patchi];
forAll(pp.faceCells(), faceI)
{
const label pCelli = pp.faceCells()[faceI];
bool interface(false);
if
(
sign(R_.value()) > 0
&& (T[pCelli] - Tactivate_.value()) > 0
)
{
interface = true;
}
if
(
sign(R_.value()) < 0
&& (T[pCelli] - Tactivate_.value()) < 0
)
{
interface = true;
}
if
(
interface
&&
(
alpha[pCelli] < 2*isoAlpha_
&& alpha[pCelli] > 0.5*isoAlpha_
)
)
{
interfaceArea_[pCelli] =
mag(pp.faceAreas()[faceI])/mesh.V()[pCelli];
}
}
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Thermo, class OtherThermo>
Foam::meltingEvaporationModels::interfaceHeatResistance<Thermo, OtherThermo>
::interfaceHeatResistance
(
const dictionary& dict,
const phasePair& pair
)
:
InterfaceCompositionModel<Thermo, OtherThermo>(dict, pair),
R_("R", dimPower/dimArea/dimTemperature, dict),
Tactivate_("Tactivate", dimTemperature, dict),
interfaceArea_
(
IOobject
(
"interfaceArea",
this->mesh_.time().timeName(),
this->mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
this->mesh_,
dimensionedScalar(dimless/dimLength, Zero)
),
mDotc_
(
IOobject
(
"mDotc",
this->mesh_.time().timeName(),
this->mesh_,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
this->mesh_,
dimensionedScalar(dimDensity/dimTime, Zero)
),
mDotcSpread_
(
IOobject
(
"mDotcSpread",
this->mesh_.time().timeName(),
this->mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
this->mesh_,
dimensionedScalar(dimDensity/dimTime, Zero)
),
htc_
(
IOobject
(
"htc",
this->mesh_.time().timeName(),
this->mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
this->mesh_,
dimensionedScalar(dimMass/dimArea/dimTemperature/dimTime, Zero)
),
isoAlpha_(dict.getOrDefault<scalar>("isoAlpha", 0.5)),
spread_(dict.getOrDefault<scalar>("spread", 3))
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
template<class Thermo, class OtherThermo>
Foam::tmp<Foam::volScalarField>
Foam::meltingEvaporationModels::interfaceHeatResistance<Thermo, OtherThermo>
::Kexp(const volScalarField& T)
{
const fvMesh& mesh = this->mesh_;
updateInterface(T);
auto tdeltaT = tmp<volScalarField>::New
(
IOobject
(
"tdeltaT",
mesh.time().timeName(),
mesh
),
mesh,
dimensionedScalar(dimTemperature, Zero)
);
auto& deltaT = tdeltaT.ref();
const dimensionedScalar T0(dimTemperature, Zero);
if (sign(R_.value()) > 0)
{
deltaT = max(T - Tactivate_, T0);
}
else
{
deltaT = max(Tactivate_ - T, T0);
}
word fullSpeciesName = this->transferSpecie();
auto tempOpen = fullSpeciesName.find('.');
const word speciesName(fullSpeciesName.substr(0, tempOpen));
tmp<volScalarField> L = this->L(speciesName, T);
htc_ = R_/L();
const volScalarField& to = this->pair().to();
const volScalarField& from = this->pair().from();
dimensionedScalar D
(
"D",
dimArea,
spread_/sqr(gAverage(this->mesh_.nonOrthDeltaCoeffs()))
);
const dimensionedScalar MdotMin("MdotMin", mDotc_.dimensions(), 1e-3);
if (max(mDotc_) > MdotMin)
{
fvc::spreadSource
(
mDotcSpread_,
mDotc_,
from,
to,
D,
1e-3
);
}
mDotc_ = interfaceArea_*htc_*deltaT;
return tmp<volScalarField>::New(mDotc_);
}
template<class Thermo, class OtherThermo>
Foam::tmp<Foam::volScalarField>
Foam::meltingEvaporationModels::interfaceHeatResistance<Thermo, OtherThermo>
::KSp
(
label variable,
const volScalarField& refValue
)
{
if (this->modelVariable_ == variable)
{
const volScalarField coeff(htc_*interfaceArea_);
if (sign(R_.value()) > 0)
{
return(coeff*pos(refValue - Tactivate_));
}
else
{
return(coeff*pos(Tactivate_ - refValue));
}
}
return nullptr;
}
template<class Thermo, class OtherThermo>
Foam::tmp<Foam::volScalarField>
Foam::meltingEvaporationModels::interfaceHeatResistance<Thermo, OtherThermo>
::KSu
(
label variable,
const volScalarField& refValue
)
{
if (this->modelVariable_ == variable)
{
const volScalarField coeff(htc_*interfaceArea_*Tactivate_);
if (sign(R_.value()) > 0)
{
return(-coeff*pos(refValue - Tactivate_));
}
else
{
return(coeff*pos(Tactivate_ - refValue));
}
}
else if (interfaceCompositionModel::P == variable)
{
return tmp<volScalarField>::New(mDotcSpread_);
}
return nullptr;
}
template<class Thermo, class OtherThermo>
const Foam::dimensionedScalar&
Foam::meltingEvaporationModels::interfaceHeatResistance<Thermo, OtherThermo>
::Tactivate() const
{
return Tactivate_;
}
template<class Thermo, class OtherThermo>
bool
Foam::meltingEvaporationModels::
interfaceHeatResistance<Thermo, OtherThermo>::includeDivU()
{
return true;
}
// ************************************************************************* //

View File

@ -1,196 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2020 OpenCFD Ltd.
Copyright (C) 2020 Henning Scheufler
-------------------------------------------------------------------------------
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::meltingEvaporationModels::interfaceHeatResistance
Description
Interface Heat Resistance type of condensation/saturation model using
spread source distribution following:
References:
\verbatim
Hardt, S., Wondra, F. (2008).
Evaporation model for interfacial flows based on a continuum-
field representation of the source term
Journal of Computational Physics 227 (2008), 5871-5895
\endverbatim
Usage
Example usage:
\verbatim
massTransferModel
(
(liquid to gas)
{
type interfaceHeatResistance;
R 2e6;
Tactivate 373;
}
);
\endverbatim
where:
\table
Property | Description | Required | Default value
R | Heat transfer coefficient | yes
includeVolChange | Volumen change | no | yes
isoAlpha | iso-alpha for interface | no | 0.5
Tactivate | Saturation temperature | yes
species | Specie name on the other phase | no | none
spread | Cells to spread the source for pEq | no | 3
\endtable
SourceFiles
interfaceHeatResistance.C
\*---------------------------------------------------------------------------*/
#ifndef meltingEvaporationModels_interfaceHeatResistance_H
#define meltingEvaporationModels_interfaceHeatResistance_H
#include "InterfaceCompositionModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *//
namespace Foam
{
// Forward Declarations
class phasePair;
namespace meltingEvaporationModels
{
/*---------------------------------------------------------------------------*\
Class interfaceHeatResistance Declaration
\*---------------------------------------------------------------------------*/
template<class Thermo, class OtherThermo>
class interfaceHeatResistance
:
public InterfaceCompositionModel<Thermo, OtherThermo>
{
// Private Data
//- Heat transfer coefficient [1/s/K]
dimensionedScalar R_;
//- Activation temperature
const dimensionedScalar Tactivate_;
//- Interface area
volScalarField interfaceArea_;
//- Mass source
volScalarField mDotc_;
//- Spread mass source
volScalarField mDotcSpread_;
//- Heat transfer coefficient
volScalarField htc_;
//- Interface Iso-value
scalar isoAlpha_;
//- Spread for mass source
scalar spread_;
// Private Member Functions
//- Update interface
void updateInterface(const volScalarField& T);
public:
//- Runtime type information
TypeName("interfaceHeatResistance");
// Constructors
//- Construct from components
interfaceHeatResistance
(
const dictionary& dict,
const phasePair& pair
);
//- Destructor
virtual ~interfaceHeatResistance() = default;
// Member Functions
//- Explicit total mass transfer coefficient
virtual tmp<volScalarField> Kexp
(
const volScalarField& field
);
//- Implicit mass transfer coefficient
virtual tmp<volScalarField> KSp
(
label modelVariable,
const volScalarField& field
);
//- Explicit mass transfer coefficient
virtual tmp<volScalarField> KSu
(
label modelVariable,
const volScalarField& field
);
//- Return Tactivate
virtual const dimensionedScalar& Tactivate() const;
//- Add/subtract alpha*div(U) as a source term
//- for alpha, substituting div(U) = mDot(1/rho1 - 1/rho2)
virtual bool includeDivU();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace meltingEvaporationModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "interfaceHeatResistance.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,339 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
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 "kineticGasEvaporation.H"
#include "constants.H"
#include "cutCellIso.H"
#include "volPointInterpolation.H"
#include "wallPolyPatch.H"
#include "fvcSmooth.H"
using namespace Foam::constant;
// * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * * //
template<class Thermo, class OtherThermo>
void Foam::meltingEvaporationModels::kineticGasEvaporation<Thermo, OtherThermo>
::updateInterface(const volScalarField& T)
{
const fvMesh& mesh = this->mesh_;
const volScalarField& alpha = this->pair().from();
scalarField ap
(
volPointInterpolation::New(mesh).interpolate(alpha)
);
cutCellIso cutCell(mesh, ap);
forAll(interfaceArea_, celli)
{
label status = cutCell.calcSubCell(celli, isoAlpha_);
interfaceArea_[celli] = 0;
if (status == 0) // cell is cut
{
interfaceArea_[celli] =
mag(cutCell.faceArea())/mesh.V()[celli];
}
}
for (const polyPatch& pp : mesh.boundaryMesh())
{
if (isA<wallPolyPatch>(pp))
{
forAll(pp.faceCells(), faceI)
{
const label pCelli = pp.faceCells()[faceI];
bool interface(false);
if
(
sign(C_.value()) > 0
&& (T[pCelli] - Tactivate_.value()) > 0
)
{
interface = true;
}
if
(
sign(C_.value()) < 0
&& (T[pCelli] - Tactivate_.value()) < 0
)
{
interface = true;
}
if
(
interface
&&
(
alpha[pCelli] < 2*isoAlpha_
&& alpha[pCelli] > 0.5*isoAlpha_
)
)
{
interfaceArea_[pCelli] =
mag(pp.faceAreas()[faceI])/mesh.V()[pCelli];
}
}
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Thermo, class OtherThermo>
Foam::meltingEvaporationModels::kineticGasEvaporation<Thermo, OtherThermo>
::kineticGasEvaporation
(
const dictionary& dict,
const phasePair& pair
)
:
InterfaceCompositionModel<Thermo, OtherThermo>(dict, pair),
C_("C", dimless, dict),
Tactivate_("Tactivate", dimTemperature, dict),
Mv_("Mv", dimMass/dimMoles, -1, dict),
interfaceArea_
(
IOobject
(
"interfaceArea",
this->mesh_.time().timeName(),
this->mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
this->mesh_,
dimensionedScalar(dimless/dimLength, Zero)
),
htc_
(
IOobject
(
"htc",
this->mesh_.time().timeName(),
this->mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
this->mesh_,
dimensionedScalar(dimMass/dimArea/dimTemperature/dimTime, Zero)
),
mDotc_
(
IOobject
(
"mDotc",
this->mesh_.time().timeName(),
this->mesh_,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
this->mesh_,
dimensionedScalar(dimDensity/dimTime, Zero)
),
isoAlpha_(dict.getOrDefault<scalar>("isoAlpha", 0.5))
{
word speciesName = IOobject::member(this->transferSpecie());
// Get the "to" thermo
const typename OtherThermo::thermoType& toThermo =
this->getLocalThermo
(
speciesName,
this->toThermo_
);
// Convert from g/mol to Kg/mol
Mv_.value() = toThermo.W()*1e-3;
if (Mv_.value() == -1)
{
FatalErrorInFunction
<< " Please provide the molar weight (Mv) of vapour [g/mol] "
<< abort(FatalError);
}
}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
template<class Thermo, class OtherThermo>
Foam::tmp<Foam::volScalarField>
Foam::meltingEvaporationModels::kineticGasEvaporation<Thermo, OtherThermo>
::Kexp(const volScalarField& T)
{
const fvMesh& mesh = this->mesh_;
const dimensionedScalar HerztKnudsConst
(
sqrt
(
2.0*mathematical::pi
* pow3(Tactivate_)
* constant::physicoChemical::R/Mv_
)
);
word speciesName = IOobject::member(this->transferSpecie());
tmp<volScalarField> L = this->L(speciesName, T);
updateInterface(T);
tmp<volScalarField> tRhov
(
new volScalarField
(
IOobject
(
"tRhov",
mesh.time().timeName(),
mesh
),
mesh,
dimensionedScalar(dimDensity, Zero)
)
);
volScalarField& rhov = tRhov.ref();
tmp<volScalarField> tdeltaT
(
new volScalarField
(
IOobject
(
"tdeltaT",
mesh.time().timeName(),
mesh
),
mesh,
dimensionedScalar(dimTemperature, Zero)
)
);
volScalarField& deltaT = tdeltaT.ref();
dimensionedScalar T0("T0", dimTemperature, Zero);
if (sign(C_.value()) > 0)
{
rhov = this->pair().to().rho();
deltaT = max(T - Tactivate_, T0);
}
else
{
rhov = this->pair().from().rho();
deltaT = max(Tactivate_ - T, T0);
}
htc_ = 2*mag(C_)/(2-mag(C_))*(L()*rhov/HerztKnudsConst);
mDotc_ = htc_*deltaT*interfaceArea_;
return tmp<volScalarField>(new volScalarField(mDotc_));
}
template<class Thermo, class OtherThermo>
Foam::tmp<Foam::volScalarField>
Foam::meltingEvaporationModels::kineticGasEvaporation<Thermo, OtherThermo>::KSp
(
label variable,
const volScalarField& refValue
)
{
if (this->modelVariable_ == variable)
{
const volScalarField coeff(htc_*interfaceArea_);
if (sign(C_.value()) > 0)
{
return(coeff*pos(refValue - Tactivate_));
}
else
{
return(coeff*pos(Tactivate_ - refValue));
}
}
else
{
return tmp<volScalarField> ();
}
}
template<class Thermo, class OtherThermo>
Foam::tmp<Foam::volScalarField>
Foam::meltingEvaporationModels::kineticGasEvaporation<Thermo, OtherThermo>::KSu
(
label variable,
const volScalarField& refValue
)
{
if (this->modelVariable_ == variable)
{
const volScalarField coeff(htc_*interfaceArea_*Tactivate_);
if (sign(C_.value()) > 0)
{
return(-coeff*pos(refValue - Tactivate_));
}
else
{
return(coeff*pos(Tactivate_ - refValue));
}
}
else
{
return tmp<volScalarField> ();
}
}
template<class Thermo, class OtherThermo>
const Foam::dimensionedScalar&
Foam::meltingEvaporationModels::kineticGasEvaporation<Thermo, OtherThermo>
::Tactivate() const
{
return Tactivate_;
}
template<class Thermo, class OtherThermo>
bool
Foam::meltingEvaporationModels::
kineticGasEvaporation<Thermo, OtherThermo>::includeDivU()
{
return true;
}
// ************************************************************************* //

View File

@ -1,235 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
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::meltingEvaporationModels::kineticGasEvaporation
Description
Considering the Hertz Knudsen formula, which gives the
evaporation-condensation flux based on the kinetic theory for flat
interface:
\f[
Flux = C \sqrt{\frac{M}{2 \pi R T_{activate}}}(p - p_{sat})
\f]
where:
\vartable
Flux | mass flux rate [kg/s/m2]
M | molecular weight
T_{activate} | saturation temperature
C | accommodation coefficient
R | universal gas constant
p_{sat} | saturation pressure
p | vapor partial pressure
\endvartable
The Clapeyron-Clausius equation relates the pressure to the temperature
for the saturation condition:
\f[
\frac{dp}{dT} = - \frac{L}{T (\nu_v - \nu_l)}
\f]
where:
\vartable
L | latent heat
\nu_v | inverse of the vapor density
\nu_l | inverse of the liquid density
\endvartable
Using the above relations:
\f[
Flux =
2 \frac{C}{2 - C}
\sqrt{\frac{M}{2 \pi R {T_activate}^3}} L (\rho_{v})
(T - T_{activate})
\f]
This assumes liquid and vapour are in equilibrium, then the accommodation
coefficient are equivalent for the interface. This relation is known as the
Hertz-Knudsen-Schrage.
Based on the reference:
- Van P. Carey, Liquid-Vapor Phase Change Phenomena, ISBN 0-89116836,
1992, pp. 112-121.
Usage
Example usage:
\verbatim
massTransferModel
(
(liquid to gas)
{
type kineticGasEvaporation;
species vapour.gas;
C 0.1;
isoAlpha 0.1;
Tactivate 373;
}
);
\endverbatim
where:
\table
Property | Description | Required | Default value
C | Coefficient (C > 0 for evaporation, C < 0 for
condensation) | yes
includeVolChange | Volumen change | no | yes
isoAlpha | iso-alpha for interface | no | 0.5
Tactivate | Saturation temperature | yes
species | Specie name on the other phase | no | none
\endtable
SourceFiles
kineticGasEvaporation.C
\*---------------------------------------------------------------------------*/
#ifndef meltingEvaporationModels_kineticGasEvaporation_H
#define meltingEvaporationModels_kineticGasEvaporation_H
#include "InterfaceCompositionModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *//
namespace Foam
{
// Forward Declarations
class phasePair;
namespace meltingEvaporationModels
{
/*---------------------------------------------------------------------------*\
Class kineticGasEvaporation Declaration
\*---------------------------------------------------------------------------*/
template<class Thermo, class OtherThermo>
class kineticGasEvaporation
:
public InterfaceCompositionModel<Thermo, OtherThermo>
{
// Private Data
//- Evaporation coefficient
dimensionedScalar C_;
//- Activation temperature
const dimensionedScalar Tactivate_;
//- Molar weight of the vapour in the continuous phase
dimensionedScalar Mv_;
//- Interface area
volScalarField interfaceArea_;
//- Heat transfer coefficient
volScalarField htc_;
//- Mass source
volScalarField mDotc_;
//- Interface Iso-value
scalar isoAlpha_;
// Private Member Functions
//- Update interface
void updateInterface(const volScalarField& T);
public:
//- Runtime type information
TypeName("kineticGasEvaporation");
// Constructors
//- Construct from components
kineticGasEvaporation
(
const dictionary& dict,
const phasePair& pair
);
//- Destructor
virtual ~kineticGasEvaporation() = default;
// Member Functions
//- Explicit total mass transfer coefficient
virtual tmp<volScalarField> Kexp
(
const volScalarField& field
);
//- Implicit mass transfer coefficient
virtual tmp<volScalarField> KSp
(
label modelVariable,
const volScalarField& field
);
//- Explicit mass transfer coefficient
virtual tmp<volScalarField> KSu
(
label modelVariable,
const volScalarField& field
);
//- Return Tactivate
virtual const dimensionedScalar& Tactivate() const;
//- Add/subtract alpha*div(U) as a source term
//- for alpha, substituting div(U) = mDot(1/rho1 - 1/rho2)
virtual bool includeDivU();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace meltingEvaporationModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "kineticGasEvaporation.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,19 +0,0 @@
interfaceModels/porousModels/porousModel/porousModel.C
interfaceModels/porousModels/porousModel/porousModelNew.C
interfaceModels/porousModels/VollerPrakash/VollerPrakash.C
phasePair/phasePairKey/phasePairKey.C
phasePair/phasePair/phasePair.C
phasePair/orderedPhasePair/orderedPhasePair.C
phaseModel/phaseModel/phaseModel.C
phaseModel/phaseModel/phaseModelNew.C
phaseModel/phaseModel/phaseModels.C
phaseSystem/phaseSystem.C
phaseSystem/multiphaseSystem/multiphaseSystem.C
phaseSystem/multiphaseSystem/multiphaseSystemNew.C
phaseSystem/multiphaseSystem/multiphaseSystems.C
LIB = $(FOAM_LIBBIN)/libIncompressibleMultiphaseSystems

View File

@ -1,32 +0,0 @@
EXE_INC = \
-I../massTransferModels/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/fvOptions/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/solidThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/solidSpecie/lnInclude \
-I$(LIB_SRC)/transportModels \
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
-I$(LIB_SRC)/transportModels/incompressible/lnInclude \
-I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/phaseCompressible/lnInclude \
-I$(LIB_SRC)/combustionModels/lnInclude
LIB_LIBS = \
-lfiniteVolume \
-lmeshTools \
-lfluidThermophysicalModels \
-lreactionThermophysicalModels \
-lsolidThermo \
-lcompressibleTransportModels \
-lincompressibleTransportModels \
-linterfaceProperties \
-lturbulenceModels \
-lcompressibleTurbulenceModels \
-lcombustionModels

View File

@ -1,744 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
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 "MassTransferPhaseSystem.H"
#include "HashPtrTable.H"
#include "fvcDiv.H"
#include "fvmSup.H"
#include "fvMatrix.H"
#include "volFields.H"
#include "fundamentalConstants.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class BasePhaseSystem>
Foam::MassTransferPhaseSystem<BasePhaseSystem>::MassTransferPhaseSystem
(
const fvMesh& mesh
)
:
BasePhaseSystem(mesh)
{
this->generatePairsAndSubModels("massTransferModel", massTransferModels_);
forAllConstIters(massTransferModels_, iterModel)
{
if (!dmdt_.found(iterModel()->pair()))
{
dmdt_.set
(
iterModel()->pair(),
new volScalarField
(
IOobject
(
IOobject::groupName("dmdt",iterModel()->pair().name()),
this->mesh().time().timeName(),
this->mesh(),
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
this->mesh(),
dimensionedScalar(dimDensity/dimTime, Zero)
)
);
}
}
}
// * * * * * * * * * * * * * * Protected Member Functions * * * * * * * * * //
template<class BasePhaseSystem>
Foam::tmp<Foam::volScalarField>
Foam::MassTransferPhaseSystem<BasePhaseSystem>::calculateL
(
const volScalarField& dmdtNetki,
const phasePairKey& keyik,
const phasePairKey& keyki,
const volScalarField& T
) const
{
auto tL = tmp<volScalarField>::New
(
IOobject
(
"tL",
this->mesh().time().timeName(),
this->mesh(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
this->mesh(),
dimensionedScalar(dimEnergy/dimMass, Zero)
);
auto& L = tL.ref();
if (massTransferModels_.found(keyik))
{
const autoPtr<interfaceCompositionModel>& interfacePtr =
massTransferModels_[keyik];
word speciesName = interfacePtr->transferSpecie();
const word species(speciesName.substr(0, speciesName.find('.')));
L -= neg(dmdtNetki)*interfacePtr->L(species, T);
}
if (massTransferModels_.found(keyki))
{
const autoPtr<interfaceCompositionModel>& interfacePtr =
massTransferModels_[keyki];
word speciesName = interfacePtr->transferSpecie();
const word species(speciesName.substr(0, speciesName.find('.')));
L += pos(dmdtNetki)*interfacePtr->L(species, T);
}
return tL;
}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
template<class BasePhaseSystem>
Foam::tmp<Foam::volScalarField>
Foam::MassTransferPhaseSystem<BasePhaseSystem>::dmdt
(
const phasePairKey& key
) const
{
auto tdmdt = tmp<volScalarField>::New
(
IOobject
(
"dmdt",
this->mesh().time().timeName(),
this->mesh()
),
this->mesh(),
dimensionedScalar(dimDensity/dimTime, Zero)
);
auto& dmdt = tdmdt.ref();
if (dmdt_.found(key))
{
dmdt = *dmdt_[key];
}
return tdmdt;
}
template<class BasePhaseSystem>
Foam::tmp<Foam::fvScalarMatrix>
Foam::MassTransferPhaseSystem<BasePhaseSystem>::heatTransfer
(
const volScalarField& T
)
{
auto teqn = tmp<fvScalarMatrix>::New(T, dimEnergy/dimTime);
auto& eqn = teqn.ref();
forAllConstIters(this->phaseModels_, iteri)
{
const phaseModel& phasei = iteri()();
auto iterk = iteri;
for (++iterk; iterk != this->phaseModels_.end(); ++iterk)
{
if (iteri()().name() != iterk()().name())
{
const phaseModel& phasek = iterk()();
// Phase i to phase k
const phasePairKey keyik(phasei.name(), phasek.name(), true);
// Phase k to phase i
const phasePairKey keyki(phasek.name(), phasei.name(), true);
// Net mass transfer from k to i phase
auto tdmdtNetki = tmp<volScalarField>::New
(
IOobject
(
"tdmdtYki",
this->mesh().time().timeName(),
this->mesh()
),
this->mesh(),
dimensionedScalar(dimDensity/dimTime, Zero)
);
auto& dmdtNetki = tdmdtNetki.ref();
auto tSp = tmp<volScalarField>::New
(
IOobject
(
"Sp",
this->mesh().time().timeName(),
this->mesh()
),
this->mesh(),
dimensionedScalar(dimDensity/dimTime/dimTemperature, Zero)
);
auto& Sp = tSp.ref();
auto tSu = tmp<volScalarField>::New
(
IOobject
(
"Su",
this->mesh().time().timeName(),
this->mesh()
),
this->mesh(),
dimensionedScalar(dimDensity/dimTime, Zero)
);
auto& Su = tSu.ref();
if (massTransferModels_.found(keyik))
{
autoPtr<interfaceCompositionModel>& interfacePtr =
massTransferModels_[keyik];
dmdtNetki -= *dmdt_[keyik];
tmp<volScalarField> KSp =
interfacePtr->KSp(interfaceCompositionModel::T, T);
if (KSp.valid())
{
Sp -= KSp.ref();
}
tmp<volScalarField> KSu =
interfacePtr->KSu(interfaceCompositionModel::T, T);
if (KSu.valid())
{
Su -= KSu.ref();
}
// If linearization is not provided used full explicit
if (!KSp.valid() && !KSu.valid())
{
Su -= *dmdt_[keyik];
}
}
// Looking for mass transfer in the other direction (k to i)
if (massTransferModels_.found(keyki))
{
autoPtr<interfaceCompositionModel>& interfacePtr =
massTransferModels_[keyki];
dmdtNetki += *dmdt_[keyki];
tmp<volScalarField> KSp =
interfacePtr->KSp(interfaceCompositionModel::T, T);
if (KSp.valid())
{
Sp += KSp.ref();
}
tmp<volScalarField> KSu =
interfacePtr->KSu(interfaceCompositionModel::T, T);
if (KSu.valid())
{
Su += KSu.ref();
}
// If linearization is not provided used full explicit
if (!KSp.valid() && !KSu.valid())
{
Su += *dmdt_[keyki];
}
}
tmp<volScalarField> L = calculateL(dmdtNetki, keyik, keyki, T);
//eqn -= dmdtNetki*L;
eqn -= fvm::Sp(Sp*L.ref(), T) + Su*L.ref();
}
}
}
return teqn;
}
template<class BasePhaseSystem>
Foam::tmp<Foam::fvScalarMatrix>
Foam::MassTransferPhaseSystem<BasePhaseSystem>::volTransfer
(
const volScalarField& p
)
{
auto teqn = tmp<fvScalarMatrix>::New(p, dimVolume/dimTime);
auto& eqn = teqn.ref();
auto tSp = tmp<volScalarField>::New
(
IOobject
(
"Sp",
this->mesh().time().timeName(),
this->mesh()
),
this->mesh(),
dimensionedScalar(dimless/dimTime/dimPressure, Zero)
);
auto& Sp = tSp.ref();
auto tSu = tmp<volScalarField>::New
(
IOobject
(
"Su",
this->mesh().time().timeName(),
this->mesh()
),
this->mesh(),
dimensionedScalar(dimless/dimTime, Zero)
);
auto& Su = tSu.ref();
forAllConstIters(this->totalPhasePairs(), iter)
{
const phasePair& pair = iter()();
const phaseModel& phase1 = pair.phase1();
const phaseModel& phase2 = pair.phase2();
const phasePairKey key12
(
phase1.name(),
phase2.name(),
true
);
if (massTransferModels_.found(key12))
{
autoPtr<interfaceCompositionModel>& interfacePtr =
massTransferModels_[key12];
tmp<volScalarField> KSp =
interfacePtr->KSp(interfaceCompositionModel::P, p);
if (KSp.valid())
{
Sp -=
KSp.ref()
*(
- this->coeffs(phase1.name())
+ this->coeffs(phase2.name())
);
}
tmp<volScalarField> KSu =
interfacePtr->KSu(interfaceCompositionModel::P, p);
if (KSu.valid())
{
Su -=
KSu.ref()
*(
- this->coeffs(phase1.name())
+ this->coeffs(phase2.name())
);
}
// If linearization is not provided used full explicit
if (!KSp.valid() && !KSu.valid())
{
Su -=
*dmdt_[key12]
*(
- this->coeffs(phase1.name())
+ this->coeffs(phase2.name())
);
}
}
const phasePairKey key21
(
phase2.name(),
phase1.name(),
true
);
if (massTransferModels_.found(key21))
{
autoPtr<interfaceCompositionModel>& interfacePtr =
massTransferModels_[key21];
tmp<volScalarField> KSp =
interfacePtr->KSp(interfaceCompositionModel::P, p);
if (KSp.valid())
{
Sp +=
KSp.ref()
*(
- this->coeffs(phase1.name())
+ this->coeffs(phase2.name())
);
}
tmp<volScalarField> KSu =
interfacePtr->KSu(interfaceCompositionModel::P, p);
if (KSu.valid())
{
Su +=
KSu.ref()
*(
- this->coeffs(phase1.name())
+ this->coeffs(phase2.name())
);
}
// If linearization is not provided used full explicit
if (!KSp.valid() && !KSu.valid())
{
Su +=
*dmdt_[key21]
*(
- this->coeffs(phase1.name())
+ this->coeffs(phase2.name())
);
}
}
}
eqn += fvm::Sp(Sp, p) + Su;
return teqn;
}
template<class BasePhaseSystem>
void Foam::MassTransferPhaseSystem<BasePhaseSystem>::correctMassSources
(
const volScalarField& T
)
{
forAllConstIters(this->phaseModels_, iteri)
{
const phaseModel& phasei = iteri()();
auto iterk = iteri;
for (++iterk; iterk != this->phaseModels_.end(); ++iterk)
{
if (iteri()().name() != iterk()().name())
{
const phaseModel& phasek = iterk()();
// Phase i to phase k
const phasePairKey keyik(phasei.name(), phasek.name(), true);
// Phase k to phase i
const phasePairKey keyki(phasek.name(), phasei.name(), true);
if (massTransferModels_.found(keyik))
{
autoPtr<interfaceCompositionModel>& interfacePtr =
massTransferModels_[keyik];
tmp<volScalarField> Kexp = interfacePtr->Kexp(T);
*dmdt_[keyik] = Kexp.ref();
}
if (massTransferModels_.found(keyki))
{
autoPtr<interfaceCompositionModel>& interfacePtr =
massTransferModels_[keyki];
// Explicit temperature mass transfer rate
const tmp<volScalarField> Kexp = interfacePtr->Kexp(T);
*dmdt_[keyki] = Kexp.ref();
}
}
}
}
}
template<class BasePhaseSystem>
void Foam::MassTransferPhaseSystem<BasePhaseSystem>::alphaTransfer
(
SuSpTable& Su,
SuSpTable& Sp
)
{
// This term adds/subtracts alpha*div(U) as a source term
// for alpha, substituting div(U) = mDot(1/rho1 - 1/rho2)
bool includeDivU(true);
forAllConstIters(this->totalPhasePairs(), iter)
{
const phasePair& pair = iter()();
const phaseModel& phase1 = pair.phase1();
const phaseModel& phase2 = pair.phase2();
const volScalarField& alpha1 = pair.phase1();
const volScalarField& alpha2 = pair.phase2();
tmp<volScalarField> tCoeffs1 = this->coeffs(phase1.name());
const volScalarField& coeffs1 = tCoeffs1();
tmp<volScalarField> tCoeffs2 = this->coeffs(phase2.name());
const volScalarField& coeffs2 = tCoeffs2();
// Phase 1 to phase 2
const phasePairKey key12
(
phase1.name(),
phase2.name(),
true
);
tmp<volScalarField> tdmdt12(this->dmdt(key12));
volScalarField& dmdt12 = tdmdt12.ref();
if (massTransferModels_.found(key12))
{
autoPtr<interfaceCompositionModel>& interfacePtr =
massTransferModels_[key12];
tmp<volScalarField> KSu =
interfacePtr->KSu(interfaceCompositionModel::alpha, phase1);
if (KSu.valid())
{
dmdt12 = KSu.ref();
}
includeDivU = interfacePtr->includeDivU();
}
// Phase 2 to phase 1
const phasePairKey key21
(
phase2.name(),
phase1.name(),
true
);
tmp<volScalarField> tdmdt21(this->dmdt(key21));
volScalarField& dmdt21 = tdmdt21.ref();
if (massTransferModels_.found(key21))
{
autoPtr<interfaceCompositionModel>& interfacePtr =
massTransferModels_[key21];
tmp<volScalarField> KSu =
interfacePtr->KSu(interfaceCompositionModel::alpha, phase2);
if (KSu.valid())
{
dmdt21 = KSu.ref();
}
includeDivU = interfacePtr->includeDivU();
}
volScalarField::Internal& SpPhase1 = Sp[phase1.name()];
volScalarField::Internal& SuPhase1 = Su[phase1.name()];
volScalarField::Internal& SpPhase2 = Sp[phase2.name()];
volScalarField::Internal& SuPhase2 = Su[phase2.name()];
const volScalarField dmdtNet(dmdt21 - dmdt12);
const volScalarField coeffs12(coeffs1 - coeffs2);
const surfaceScalarField& phi = this->phi();
if (includeDivU)
{
SuPhase1 +=
fvc::div(phi)*min(max(alpha1, scalar(0)), scalar(1));
SuPhase2 +=
fvc::div(phi)*min(max(alpha2, scalar(0)), scalar(1));
}
// NOTE: dmdtNet is distributed in terms =
// Source for phase 1 =
// dmdtNet/rho1
// - alpha1*dmdtNet(1/rho1 - 1/rho2)
forAll(dmdtNet, celli)
{
scalar dmdt21 = dmdtNet[celli];
scalar coeffs12Cell = coeffs12[celli];
scalar alpha1Limited = max(min(alpha1[celli], 1.0), 0.0);
// exp.
SuPhase1[celli] += coeffs1[celli]*dmdt21;
if (includeDivU)
{
if (dmdt21 > 0)
{
if (coeffs12Cell > 0)
{
// imp
SpPhase1[celli] -= dmdt21*coeffs12Cell;
}
else if (coeffs12Cell < 0)
{
// exp
SuPhase1[celli] -=
dmdt21*coeffs12Cell*alpha1Limited;
}
}
else if (dmdt21 < 0)
{
if (coeffs12Cell > 0)
{
// exp
SuPhase1[celli] -=
dmdt21*coeffs12Cell*alpha1Limited;
}
else if (coeffs12Cell < 0)
{
// imp
SpPhase1[celli] -= dmdt21*coeffs12Cell;
}
}
}
}
forAll(dmdtNet, celli)
{
scalar dmdt12 = -dmdtNet[celli];
scalar coeffs21Cell = -coeffs12[celli];
scalar alpha2Limited = max(min(alpha2[celli], 1.0), 0.0);
// exp
SuPhase2[celli] += coeffs2[celli]*dmdt12;
if (includeDivU)
{
if (dmdt12 > 0)
{
if (coeffs21Cell > 0)
{
// imp
SpPhase2[celli] -= dmdt12*coeffs21Cell;
}
else if (coeffs21Cell < 0)
{
// exp
SuPhase2[celli] -=
dmdt12*coeffs21Cell*alpha2Limited;
}
}
else if (dmdt12 < 0)
{
if (coeffs21Cell > 0)
{
// exp
SuPhase2[celli] -=
coeffs21Cell*dmdt12*alpha2Limited;
}
else if (coeffs21Cell < 0)
{
// imp
SpPhase2[celli] -= dmdt12*coeffs21Cell;
}
}
}
}
// Update ddtAlphaMax
this->ddtAlphaMax_ =
max(gMax((dmdt21*coeffs1)()), gMax((dmdt12*coeffs2)()));
}
}
template<class BasePhaseSystem>
void Foam::MassTransferPhaseSystem<BasePhaseSystem>::massSpeciesTransfer
(
const phaseModel& phase,
volScalarField::Internal& Su,
volScalarField::Internal& Sp,
const word speciesName
)
{
// Fill the volumetric mass transfer for species
forAllConstIters(massTransferModels_, iter)
{
if (iter()->transferSpecie() == speciesName)
{
// Explicit source
Su +=
this->Su()[phase.name()]
+ this->Sp()[phase.name()]*phase.oldTime();
}
}
}
template<class BasePhaseSystem>
bool Foam::MassTransferPhaseSystem<BasePhaseSystem>::includeVolChange()
{
bool includeVolChange(true);
forAllIters(massTransferModels_, iter)
{
if (!iter()->includeVolChange())
{
includeVolChange = false;
}
}
return includeVolChange;
}
// ************************************************************************* //

View File

@ -1,172 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
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::MassTransferPhaseSystem
Description
Class for mass transfer between phases
SourceFiles
MassTransferPhaseSystem.C
\*---------------------------------------------------------------------------*/
#ifndef MassTransferPhaseSystem_H
#define MassTransferPhaseSystem_H
#include "phaseSystem.H"
#include "HashPtrTable.H"
#include "interfaceCompositionModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class MassTransferPhaseSystem Declaration
\*---------------------------------------------------------------------------*/
template<class BasePhaseSystem>
class MassTransferPhaseSystem
:
public BasePhaseSystem
{
public:
// Public typedefs
typedef
HashTable
<
autoPtr<interfaceCompositionModel>,
phasePairKey,
phasePairKey::hash
>
massTransferModelTable;
typedef HashTable<volScalarField::Internal> SuSpTable;
protected:
// Protected typedefs
typedef
HashPtrTable
<
volScalarField,
phasePairKey,
phasePairKey::hash
>
dmdtTable;
// Protected Data
//- Overall inter-phase mass transfer rates [Kg/s]
dmdtTable dmdt_;
//- Mass transfer models
massTransferModelTable massTransferModels_;
// Protected Member Functions
//- Calculate L between phases
tmp<volScalarField> calculateL
(
const volScalarField& dmdtNetki,
const phasePairKey& keyik,
const phasePairKey& keyki,
const volScalarField& T
) const;
public:
// Constructors
//- Construct from fvMesh
explicit MassTransferPhaseSystem(const fvMesh&);
//- Destructor
virtual ~MassTransferPhaseSystem() = default;
// Member Functions
//- Return total interfacial mass flow rate
tmp<volScalarField> dmdt(const phasePairKey& key) const;
// Mass transfer functions
//- Return the heat transfer matrix
// NOTE: Call KSu and KSp with T as variable,if not provided uses dmdt.
virtual tmp<fvScalarMatrix> heatTransfer(const volScalarField& T);
//- Return the volumetric rate transfer matrix
// NOTE: Call KSu and KSp with p as variable,if not provided uses dmdt.
virtual tmp<fvScalarMatrix> volTransfer(const volScalarField& p);
//- Correct/calculates mass sources dmdt for phases
// NOTE: Call the kexp() for all the mass transfer models.
virtual void correctMassSources(const volScalarField& T);
//- Calculate mass transfer for alpha's
virtual void alphaTransfer(SuSpTable& Su, SuSpTable& Sp);
//- Calculate mass transfer for species
virtual void massSpeciesTransfer
(
const phaseModel& phase,
volScalarField::Internal& Su,
volScalarField::Internal& Sp,
const word speciesName
);
//- Add volume change in pEq
virtual bool includeVolChange();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "MassTransferPhaseSystem.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,75 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
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 "VollerPrakash.H"
#include "phasePair.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace porousModels
{
defineTypeNameAndDebug(VollerPrakash, 0);
addToRunTimeSelectionTable
(
porousModel,
VollerPrakash,
dictionary
);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::porousModels::VollerPrakash::VollerPrakash
(
const dictionary& dict,
const fvMesh& mesh
)
:
porousModel(dict, mesh),
Cu_(dict.get<scalar>("Cu")),
solidPhase_(dict.get<word>("solidPhase"))
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
Foam::tmp<Foam::volScalarField>
Foam::porousModels::VollerPrakash::S() const
{
const volScalarField& solidAlpha =
mesh_.lookupObject<volScalarField>(solidPhase_);
return Cu_*sqr(solidAlpha)/(pow3(1.0 - solidAlpha) + 1e-3);
}
// ************************************************************************* //

View File

@ -1,131 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
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::porousModels::VollerPrakash
Description
Porous model to apply a porous media on a solid phase.
Based on the references:
-# V.R. Voller and C. Prakash, A fixed grid numerical modelling
methodology for convection-diffusion mushy phase-change problems,
Int. J. Heat Mass Transfer 30(8):17091719, 1987.
-# C.R. Swaminathan. and V.R. Voller, A general enthalpy model for
modeling solidification processes, Metallurgical Transactions
23B:651664, 1992.
Usage
Example usage:
\verbatim
interfacePorous
(
(solid and liquid)
{
type VollerPrakash;
solidPhase alpha.solid;
Cu 1e7;
}
);
\endverbatim
Where:
\table
Property | Description | Required | Default value
solidPhase | Solid phase name | yes
Cu | Model constant | yes
\endtable
SourceFiles
VollerPrakash.C
\*---------------------------------------------------------------------------*/
#ifndef porousModels_VollerPrakash_H
#define porousModels_VollerPrakash_H
#include "porousModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace porousModels
{
/*---------------------------------------------------------------------------*\
Class VollerPrakash Declaration
\*---------------------------------------------------------------------------*/
class VollerPrakash
:
public porousModel
{
// Private data
//- Constant surface tension value
const scalar Cu_;
//- Solid phase name
word solidPhase_;
public:
//- Runtime type information
TypeName("VollerPrakash");
// Constructors
//- Construct from a dictionary and a phase pair
VollerPrakash
(
const dictionary& dict,
const fvMesh& mesh
);
//- Destructor
virtual ~VollerPrakash() = default;
// Member Functions
//- Aspect ratio
virtual tmp<volScalarField> S() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace porousModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,71 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
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 "porousModel.H"
#include "phasePair.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(porousModel, 0);
defineRunTimeSelectionTable(porousModel, dictionary);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::porousModel::porousModel
(
const dictionary& dict,
const fvMesh& mesh
)
:
regIOobject
(
IOobject
(
IOobject::groupName(typeName, dict.name()),
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
)
),
mesh_(mesh)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::porousModel::writeData(Ostream& os) const
{
return os.good();
}
// ************************************************************************* //

View File

@ -1,127 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
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::porousModel
Description
SourceFiles
porousModel.C
\*---------------------------------------------------------------------------*/
#ifndef porousModel_H
#define porousModel_H
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "volFields.H"
#include "dictionary.H"
#include "runTimeSelectionTables.H"
namespace Foam
{
class fvMesh;
/*---------------------------------------------------------------------------*\
Class porousModel Declaration
\*---------------------------------------------------------------------------*/
class porousModel
:
public regIOobject
{
protected:
// Protected data
//- Reference to mesh
const fvMesh& mesh_;
public:
//- Runtime type information
TypeName("porousModel");
// Declare runtime construction
declareRunTimeSelectionTable
(
autoPtr,
porousModel,
dictionary,
(
const dictionary& dict,
const fvMesh& mesh
),
(dict, mesh)
);
// Constructors
//- Construct from a dictionary and a phase pair
porousModel
(
const dictionary& dict,
const fvMesh& mesh
);
//- Destructor
virtual ~porousModel() = default;
// Selectors
static autoPtr<porousModel> New
(
const dictionary& dict,
const fvMesh& mesh
);
// Member Functions
//- Momemtum source
virtual tmp<volScalarField> S() const = 0;
//- Dummy write for regIOobject
bool writeData(Ostream& os) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,61 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017-2019 OpenCFD Ltd.
-------------------------------------------------------------------------------
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 "porousModel.H"
#include "phasePair.H"
// * * * * * * * * * * * * * * * * Selector * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::porousModel> Foam::porousModel::New
(
const dictionary& dict,
const fvMesh& mesh
)
{
const word modelType(dict.get<word>("type"));
Info<< "Selecting porousModel for "
<< ": " << modelType << endl;
const auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
if (!cstrIter.found())
{
FatalIOErrorInLookup
(
dict,
"porousModel",
modelType,
*dictionaryConstructorTablePtr_
) << exit(FatalIOError);
}
return cstrIter()(dict, mesh);
}
// ************************************************************************* //

View File

@ -1,86 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
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 "constantSurfaceTensionCoefficient.H"
#include "phasePair.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace surfaceTensionModels
{
defineTypeNameAndDebug(constantSurfaceTensionCoefficient, 0);
addToRunTimeSelectionTable
(
surfaceTensionModel,
constantSurfaceTensionCoefficient,
dictionary
);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::surfaceTensionModels::constantSurfaceTensionCoefficient::
constantSurfaceTensionCoefficient
(
const dictionary& dict,
const phasePair& pair,
const bool registerObject
)
:
surfaceTensionModel(dict, pair, registerObject),
sigma_("sigma", dimMass/sqr(dimTime), dict)
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
Foam::tmp<Foam::volScalarField>
Foam::surfaceTensionModels::constantSurfaceTensionCoefficient::sigma() const
{
const fvMesh& mesh(this->pair_.phase1().mesh());
return
tmp<volScalarField>::New
(
IOobject
(
"zero",
mesh.time().timeName(),
mesh
),
mesh,
sigma_
);
}
// ************************************************************************* //

View File

@ -1,100 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
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::surfaceTensionModels::constantSurfaceTensionCoefficient
Description
Constant value surface tension model.
SourceFiles
constantSurfaceTensionCoefficient.C
\*---------------------------------------------------------------------------*/
#ifndef surfaceTensionModels_constantSurfaceTensionCoefficient_H
#define surfaceTensionModels_constantSurfaceTensionCoefficient_H
#include "surfaceTensionModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace surfaceTensionModels
{
/*---------------------------------------------------------------------------*\
Class constantSurfaceTensionCoefficient Declaration
\*---------------------------------------------------------------------------*/
class constantSurfaceTensionCoefficient
:
public surfaceTensionModel
{
// Private data
//- Constant surface tension value
const dimensionedScalar sigma_;
public:
//- Runtime type information
TypeName("constant");
// Constructors
//- Construct from a dictionary and a phase pair
constantSurfaceTensionCoefficient
(
const dictionary& dict,
const phasePair& pair,
const bool registerObject
);
//- Destructor
virtual ~constantSurfaceTensionCoefficient() = default;
// Member Functions
//- Aspect ratio
virtual tmp<volScalarField> sigma() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace surfaceTensionModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,73 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
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 "surfaceTensionModel.H"
#include "phasePair.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(surfaceTensionModel, 0);
defineRunTimeSelectionTable(surfaceTensionModel, dictionary);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::surfaceTensionModel::surfaceTensionModel
(
const dictionary& dict,
const phasePair& pair,
const bool registerObject
)
:
regIOobject
(
IOobject
(
IOobject::groupName(typeName, pair.name()),
pair.phase1().mesh().time().timeName(),
pair.phase1().mesh(),
IOobject::NO_READ,
IOobject::NO_WRITE,
registerObject
)
),
pair_(pair)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
bool Foam::surfaceTensionModel::writeData(Ostream& os) const
{
return os.good();
}
// ************************************************************************* //

View File

@ -1,130 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
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::surfaceTensionModel
Description
SourceFiles
surfaceTensionModel.C
surfaceTensionModelNew.C
\*---------------------------------------------------------------------------*/
#ifndef surfaceTensionModel_H
#define surfaceTensionModel_H
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "volFields.H"
#include "dictionary.H"
#include "runTimeSelectionTables.H"
namespace Foam
{
class phasePair;
/*---------------------------------------------------------------------------*\
Class surfaceTensionModel Declaration
\*---------------------------------------------------------------------------*/
class surfaceTensionModel
:
public regIOobject
{
protected:
// Protected data
//- Phase pair
const phasePair& pair_;
public:
//- Runtime type information
TypeName("surfaceTensionModel");
// Declare runtime construction
declareRunTimeSelectionTable
(
autoPtr,
surfaceTensionModel,
dictionary,
(
const dictionary& dict,
const phasePair& pair,
const bool registerObject
),
(dict, pair, registerObject)
);
// Constructors
//- Construct from a dictionary and a phase pair
surfaceTensionModel
(
const dictionary& dict,
const phasePair& pair,
const bool registerObject
);
//- Destructor
virtual ~surfaceTensionModel() = default;
// Selectors
static autoPtr<surfaceTensionModel> New
(
const dictionary& dict,
const phasePair& pair
);
// Member Functions
//- Aspect ratio
virtual tmp<volScalarField> sigma() const = 0;
//- Dummy write for regIOobject
bool writeData(Ostream& os) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,61 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017-2019 OpenCFD Ltd.
-------------------------------------------------------------------------------
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 "surfaceTensionModel.H"
#include "phasePair.H"
// * * * * * * * * * * * * * * * * Selector * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::surfaceTensionModel> Foam::surfaceTensionModel::New
(
const dictionary& dict,
const phasePair& pair
)
{
const word modelType(dict.get<word>("type"));
Info<< "Selecting surfaceTensionModel for "
<< pair << ": " << modelType << endl;
const auto cstrIter = dictionaryConstructorTablePtr_->cfind(modelType);
if (!cstrIter.found())
{
FatalIOErrorInLookup
(
dict,
"surfaceTensionModel",
modelType,
*dictionaryConstructorTablePtr_
) << exit(FatalIOError);
}
return cstrIter()(dict, pair, true);
}
// ************************************************************************* //

View File

@ -1,137 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
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 "MovingPhaseModel.H"
#include "phaseSystem.H"
#include "fixedValueFvPatchFields.H"
#include "slipFvPatchFields.H"
#include "partialSlipFvPatchFields.H"
#include "fvmDdt.H"
#include "fvmDiv.H"
#include "fvmSup.H"
#include "fvcDdt.H"
#include "fvcDiv.H"
#include "surfaceInterpolate.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class BasePhaseModel>
Foam::MovingPhaseModel<BasePhaseModel>::MovingPhaseModel
(
const phaseSystem& fluid,
const word& phaseName
)
:
BasePhaseModel(fluid, phaseName),
U_(fluid.mesh().lookupObject<volVectorField>("U")),
phi_(fluid.mesh().lookupObject<surfaceScalarField>("phi")),
alphaPhi_
(
IOobject
(
IOobject::groupName("alphaPhi", phaseModel::name()),
fluid.mesh().time().timeName(),
fluid.mesh()
),
fluid.mesh(),
dimensionedScalar(dimensionSet(0, 3, -1, 0, 0), Zero)
)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class BasePhaseModel>
void Foam::MovingPhaseModel<BasePhaseModel>::correct()
{
BasePhaseModel::correct();
}
template<class BasePhaseModel>
Foam::tmp<Foam::surfaceScalarField>
Foam::MovingPhaseModel<BasePhaseModel>::phi() const
{
return tmp<surfaceScalarField>(phi_);
}
template<class BasePhaseModel>
const Foam::surfaceScalarField&
Foam::MovingPhaseModel<BasePhaseModel>::phi()
{
return phi_;
}
template<class BasePhaseModel>
Foam::tmp<Foam::surfaceScalarField>
Foam::MovingPhaseModel<BasePhaseModel>::alphaPhi() const
{
return tmp<surfaceScalarField>(alphaPhi_);
}
template<class BasePhaseModel>
Foam::surfaceScalarField&
Foam::MovingPhaseModel<BasePhaseModel>::alphaPhi()
{
return alphaPhi_;
}
template<class BasePhaseModel>
Foam::tmp<Foam::volVectorField>
Foam::MovingPhaseModel<BasePhaseModel>::U() const
{
return tmp<volVectorField>(U_);
}
template<class BasePhaseModel>
Foam::tmp<Foam::surfaceScalarField> Foam::MovingPhaseModel<BasePhaseModel>::
diffNo() const
{
return tmp<surfaceScalarField>::New
(
IOobject
(
IOobject::groupName("diffNo", phaseModel::name()),
U_.mesh().time().timeName(),
U_.mesh()
),
U_.mesh(),
dimensionedScalar(dimless, Zero)
);
}
// ************************************************************************* //

View File

@ -1,129 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
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::MovingPhaseModel
Description
Class which represents a moving fluid phase. Holds the velocity, fluxes and
turbulence model. Provides access to the turbulent quantities.
Possible future extensions include separating the turbulent fuctionality
into another layer.
SourceFiles
MovingPhaseModel.C
\*---------------------------------------------------------------------------*/
#ifndef MovingPhaseModel_H
#define MovingPhaseModel_H
#include "phaseModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class phaseModel Declaration
\*---------------------------------------------------------------------------*/
template<class BasePhaseModel>
class MovingPhaseModel
:
public BasePhaseModel
{
// Private data
//- Reference to U
const volVectorField& U_;
//- Reference to phi
const surfaceScalarField& phi_;
//- Volumetric flux
surfaceScalarField alphaPhi_;
public:
// Constructors
MovingPhaseModel
(
const phaseSystem& fluid,
const word& phaseName
);
//- Destructor
virtual ~MovingPhaseModel() = default;
// Member Functions
//- Correct the phase properties other than the thermo and turbulence
virtual void correct();
// Momentum
//- Constant access the volumetric flux
virtual tmp<surfaceScalarField> phi() const;
//- Access the volumetric flux
virtual const surfaceScalarField& phi();
//- Constant access the volumetric flux of the phase
virtual tmp<surfaceScalarField> alphaPhi() const;
//- Access the volumetric flux of the phase
virtual surfaceScalarField& alphaPhi();
//- Access const reference to U
virtual tmp<volVectorField> U() const;
//- Diffusion number
virtual tmp<surfaceScalarField> diffNo() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "MovingPhaseModel.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,415 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
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 "MultiComponentPhaseModel.H"
#include "phaseSystem.H"
#include "multiphaseSystem.H"
#include "fvmDdt.H"
#include "fvmDiv.H"
#include "fvmSup.H"
#include "fvmLaplacian.H"
#include "fvcDdt.H"
#include "fvcDiv.H"
#include "fvcDDt.H"
#include "fvMatrix.H"
#include "fvcFlux.H"
#include "CMULES.H"
#include "subCycle.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class BasePhaseModel, class phaseThermo>
Foam::MultiComponentPhaseModel<BasePhaseModel, phaseThermo>::
MultiComponentPhaseModel
(
const phaseSystem& fluid,
const word& phaseName
)
:
BasePhaseModel(fluid, phaseName),
species_(),
inertIndex_(-1)
{
thermoPtr_.set
(
phaseThermo::New
(
fluid.mesh(),
phaseName,
basicThermo::phasePropertyName(basicThermo::dictName, phaseName)
).ptr()
);
if (thermoPtr_->composition().species().empty())
{
FatalErrorInFunction
<< " The selected thermo is pure. Use a multicomponent thermo."
<< exit(FatalError);
}
species_ = thermoPtr_->composition().species();
inertIndex_ = species_[thermoPtr_().template get<word>("inertSpecie")];
X_.setSize(thermoPtr_->composition().species().size());
// Initiate X's using Y's to set BC's
forAll(species_, i)
{
X_.set
(
i,
new volScalarField
(
IOobject
(
IOobject::groupName("X" + species_[i], phaseName),
fluid.mesh().time().timeName(),
fluid.mesh()
),
Y()[i]
)
);
}
// Init vol fractions from mass fractions
calculateVolumeFractions();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class BasePhaseModel, class phaseThermo>
void Foam::MultiComponentPhaseModel<BasePhaseModel, phaseThermo>
::calculateVolumeFractions()
{
volScalarField Xtotal(0.0*X_[0]);
const volScalarField W(thermo().W());
forAll(X_, i)
{
const dimensionedScalar Wi
(
"W",
dimMass/dimMoles,
thermo().composition().W(i)
);
if (i != inertIndex_)
{
X_[i] = W*Y()[i]/Wi;
Xtotal += X_[i];
X_[i].correctBoundaryConditions();
}
}
X_[inertIndex_] = 1.0 - Xtotal;
X_[inertIndex_].correctBoundaryConditions();
}
template<class BasePhaseModel, class phaseThermo>
void Foam::MultiComponentPhaseModel<BasePhaseModel, phaseThermo>::
calculateMassFractions()
{
volScalarField W(X_[0]*thermo().composition().W(0));
for(label i=1; i< species_.size(); i++)
{
W += X_[i]*thermo().composition().W(i);
}
forAll(Y(), i)
{
Y()[i] = X_[i]*thermo().composition().W(i)/W;
Info<< Y()[i].name() << " mass fraction = "
<< " Min(Y) = " << min(Y()[i]).value()
<< " Max(Y) = " << max(Y()[i]).value()
<< endl;
}
}
template<class BasePhaseModel, class phaseThermo>
const phaseThermo&
Foam::MultiComponentPhaseModel<BasePhaseModel, phaseThermo>::thermo() const
{
return thermoPtr_();
}
template<class BasePhaseModel, class phaseThermo>
phaseThermo&
Foam::MultiComponentPhaseModel<BasePhaseModel, phaseThermo>::thermo()
{
return thermoPtr_();
}
template<class BasePhaseModel, class phaseThermo>
void Foam::MultiComponentPhaseModel<BasePhaseModel, phaseThermo>::correct()
{
return thermo().correct();
}
template<class BasePhaseModel, class phaseThermo>
void Foam::MultiComponentPhaseModel<BasePhaseModel, phaseThermo>::solveYi
(
PtrList<volScalarField::Internal>& Su,
PtrList<volScalarField::Internal>& Sp
)
{
const volScalarField& alpha1 = *this;
const fvMesh& mesh = alpha1.mesh();
const dictionary& MULEScontrols = mesh.solverDict(alpha1.name());
scalar cAlpha(MULEScontrols.get<scalar>("cYi"));
PtrList<surfaceScalarField> phiYiCorrs(species_.size());
const surfaceScalarField& phi = this->fluid().phi();
surfaceScalarField phic(mag((phi)/mesh.magSf()));
phic = min(cAlpha*phic, max(phic));
surfaceScalarField phir(0.0*phi);
forAllConstIter(phaseSystem::phaseModelTable,this->fluid().phases(),iter2)
{
const volScalarField& alpha2 = iter2()();
if (&alpha2 == &alpha1)
{
continue;
}
phir += phic*this->fluid().nHatf(alpha1, alpha2);
}
// Do not compress interface at non-coupled boundary faces
// (inlets, outlets etc.)
surfaceScalarField::Boundary& phirBf = phir.boundaryFieldRef();
forAll(phir.boundaryField(), patchi)
{
fvsPatchScalarField& phirp = phirBf[patchi];
if (!phirp.coupled())
{
phirp == 0;
}
}
word phirScheme("div(Yiphir," + alpha1.name() + ')');
forAll(X_, i)
{
if (inertIndex_ != i)
{
volScalarField& Yi = X_[i];
phiYiCorrs.set
(
i,
new surfaceScalarField
(
"phi" + Yi.name() + "Corr",
fvc::flux
(
phi,
Yi,
"div(phi," + Yi.name() + ')'
)
)
);
surfaceScalarField& phiYiCorr = phiYiCorrs[i];
forAllConstIter
(
phaseSystem::phaseModelTable, this->fluid().phases(), iter2
)
{
//const volScalarField& alpha2 = iter2()().oldTime();
const volScalarField& alpha2 = iter2()();
if (&alpha2 == &alpha1)
{
continue;
}
phiYiCorr += fvc::flux
(
-fvc::flux(-phir, alpha2, phirScheme),
Yi,
phirScheme
);
}
// Ensure that the flux at inflow BCs is preserved
forAll(phiYiCorr.boundaryField(), patchi)
{
fvsPatchScalarField& phiYiCorrp =
phiYiCorr.boundaryFieldRef()[patchi];
if (!phiYiCorrp.coupled())
{
const scalarField& phi1p = phi.boundaryField()[patchi];
const scalarField& Yip = Yi.boundaryField()[patchi];
forAll(phiYiCorrp, facei)
{
if (phi1p[facei] < 0)
{
phiYiCorrp[facei] = Yip[facei]*phi1p[facei];
}
}
}
}
MULES::limit
(
1.0/mesh.time().deltaT().value(),
geometricOneField(),
Yi,
phi,
phiYiCorr,
Sp[i],
Su[i],
oneField(),
zeroField(),
true
);
}
}
volScalarField Yt(0.0*X_[0]);
scalar nYiSubCycles
(
MULEScontrols.getOrDefault<scalar>("nYiSubCycles", 1)
);
forAll(X_, i)
{
if (inertIndex_ != i)
{
volScalarField& Yi = X_[i];
fvScalarMatrix YiEqn
(
fv::EulerDdtScheme<scalar>(mesh).fvmDdt(Yi)
+ fv::gaussConvectionScheme<scalar>
(
mesh,
phi,
upwind<scalar>(mesh, phi)
).fvmDiv(phi, Yi)
==
Su[i] + fvm::Sp(Sp[i], Yi)
);
YiEqn.solve();
surfaceScalarField& phiYiCorr = phiYiCorrs[i];
// Add a bounded upwind U-mean flux
phiYiCorr += YiEqn.flux();
if (nYiSubCycles > 1)
{
for
(
subCycle<volScalarField> YiSubCycle(Yi, nYiSubCycles);
!(++YiSubCycle).end();
)
{
MULES::explicitSolve
(
geometricOneField(),
Yi,
phi,
phiYiCorr,
Sp[i],
Su[i],
oneField(),
zeroField()
);
}
}
else
{
MULES::explicitSolve
(
geometricOneField(),
Yi,
phi,
phiYiCorr,
Sp[i],
Su[i],
oneField(),
zeroField()
);
}
Yt += Yi;
}
}
X_[inertIndex_] = scalar(1) - Yt;
X_[inertIndex_].max(0.0);
calculateMassFractions();
}
template<class BasePhaseModel, class phaseThermo>
const Foam::PtrList<Foam::volScalarField>&
Foam::MultiComponentPhaseModel<BasePhaseModel, phaseThermo>::Y() const
{
return thermoPtr_->composition().Y();
}
template<class BasePhaseModel, class phaseThermo>
Foam::PtrList<Foam::volScalarField>&
Foam::MultiComponentPhaseModel<BasePhaseModel, phaseThermo>::Y()
{
return thermoPtr_->composition().Y();
}
template<class BasePhaseModel, class phaseThermo>
Foam::label
Foam::MultiComponentPhaseModel<BasePhaseModel, phaseThermo>::inertIndex() const
{
return inertIndex_;
}
// ************************************************************************* //

View File

@ -1,155 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
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::MultiComponentPhaseModel
Description
Class which represents a phase with multiple species. Returns the species'
mass fractions, and their governing equations.
SourceFiles
MultiComponentPhaseModel.C
\*---------------------------------------------------------------------------*/
#ifndef MultiComponentPhaseModel_H
#define MultiComponentPhaseModel_H
#include "phaseModel.H"
#include "hashedWordList.H"
#include "rhoReactionThermo.H"
#include "basicThermo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class phaseModel Declaration
\*---------------------------------------------------------------------------*/
template<class BasePhaseModel, class phaseThermo>
class MultiComponentPhaseModel
:
public BasePhaseModel
{
protected:
// Protected data
//- Species table
hashedWordList species_;
//- Inert species index
label inertIndex_;
//- Thermophysical model
autoPtr<phaseThermo> thermoPtr_;
//- Ptr list of volumetric fractions for species
PtrList<volScalarField> X_;
// Protected functions
//- Transfor volume fraction into mass fractions
void calculateMassFractions();
//- Transfor mass fraction into volume fractions
void calculateVolumeFractions();
public:
// Constructors
MultiComponentPhaseModel
(
const phaseSystem& fluid,
const word& phaseName
);
//- Destructor
virtual ~MultiComponentPhaseModel() = default;
// Member Functions
// Access
//- Species table
const hashedWordList& species() const
{
return species_;
}
// Thermo
//- Access to thermo
virtual const phaseThermo& thermo() const;
//- Access non-const thermo
virtual phaseThermo& thermo();
//- Correct phase thermo
virtual void correct();
//- Solve species fraction equation
virtual void solveYi
(
PtrList<volScalarField::Internal>&,
PtrList<volScalarField::Internal>&
);
//- Constant access the species mass fractions
virtual const PtrList<volScalarField>& Y() const;
//- Access the species mass fractions
virtual PtrList<volScalarField>& Y();
//- Return inert species index
label inertIndex() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "MultiComponentPhaseModel.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,99 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
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 "PurePhaseModel.H"
#include "phaseSystem.H"
#include "basicThermo.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class BasePhaseModel, class phaseThermo>
Foam::PurePhaseModel<BasePhaseModel, phaseThermo>::PurePhaseModel
(
const phaseSystem& fluid,
const word& phaseName
)
:
BasePhaseModel(fluid, phaseName)
{
thermoPtr_.set
(
phaseThermo::New
(
fluid.mesh(),
phaseName,
basicThermo::phasePropertyName(basicThermo::dictName, phaseName)
).ptr()
);
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class BasePhaseModel, class phaseThermo>
void Foam::PurePhaseModel<BasePhaseModel, phaseThermo>::solveYi
(
PtrList<Foam::volScalarField::Internal>&,
PtrList<Foam::volScalarField::Internal>&
)
{
NotImplemented;
}
template<class BasePhaseModel, class phaseThermo>
const Foam::PtrList<Foam::volScalarField>&
Foam::PurePhaseModel<BasePhaseModel, phaseThermo>::Y() const
{
return Y_;
}
template<class BasePhaseModel, class phaseThermo>
Foam::PtrList<Foam::volScalarField>&
Foam::PurePhaseModel<BasePhaseModel, phaseThermo>::Y()
{
return Y_;
}
template<class BasePhaseModel, class phaseThermo>
const phaseThermo& Foam::PurePhaseModel<BasePhaseModel, phaseThermo>::
thermo() const
{
return thermoPtr_();
}
template<class BasePhaseModel, class phaseThermo>
phaseThermo& Foam::PurePhaseModel<BasePhaseModel, phaseThermo>::thermo()
{
return thermoPtr_();
}
// ************************************************************************* //

View File

@ -1,126 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
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::PurePhaseModel
Description
Class which represents pure phases, i.e. without any species. Returns an
empty list of mass fractions.
SourceFiles
PurePhaseModel.C
\*---------------------------------------------------------------------------*/
#ifndef PurePhaseModel_H
#define PurePhaseModel_H
#include "PtrList.H"
#include "volFields.H"
#include "fvMatricesFwd.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class phaseSystem;
/*---------------------------------------------------------------------------*\
Class PurePhaseModel Declaration
\*---------------------------------------------------------------------------*/
template<class BasePhaseModel, class phaseThermo>
class PurePhaseModel
:
public BasePhaseModel
{
protected:
// Protected data
//- Empty mass fraction field list
PtrList<volScalarField> Y_;
//- Empty thermophysical model Ptr
autoPtr<phaseThermo> thermoPtr_;
public:
// Constructors
PurePhaseModel
(
const phaseSystem& fluid,
const word& phaseName
);
//- Destructor
virtual ~PurePhaseModel() = default;
// Member Functions
// Thermo
//- Return the species mass fractions
virtual const PtrList<volScalarField>& Y() const;
//- Access the species mass fractions
virtual PtrList<volScalarField>& Y();
//- Solve species fraction equation
virtual void solveYi
(
PtrList<volScalarField::Internal>&,
PtrList<volScalarField::Internal>&
);
//- Access to const thermo
virtual const phaseThermo& thermo() const;
//- Access non-const thermo
virtual phaseThermo& thermo();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "PurePhaseModel.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,175 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
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 "StaticPhaseModel.H"
#include "phaseSystem.H"
#include "fvcDdt.H"
#include "fvcDiv.H"
#include "surfaceInterpolate.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class BasePhaseModel>
Foam::StaticPhaseModel<BasePhaseModel>::StaticPhaseModel
(
const phaseSystem& fluid,
const word& phaseName
)
:
BasePhaseModel(fluid, phaseName),
U_(fluid.mesh().lookupObject<volVectorField>("U")),
phi_
(
IOobject
(
IOobject::groupName("phi", phaseModel::name()),
fluid.mesh().time().timeName(),
fluid.mesh()
),
fluid.mesh(),
dimensionedScalar(dimensionSet(0, 3, -1, 0, 0), Zero)
),
alphaPhi_
(
IOobject
(
IOobject::groupName("alphaPhi", phaseModel::name()),
fluid.mesh().time().timeName(),
fluid.mesh()
),
fluid.mesh(),
dimensionedScalar(dimensionSet(0, 3, -1, 0, 0), Zero)
)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class BasePhaseModel>
void Foam::StaticPhaseModel<BasePhaseModel>::correct()
{
BasePhaseModel::correct();
}
template<class BasePhaseModel>
Foam::tmp<Foam::surfaceScalarField>
Foam::StaticPhaseModel<BasePhaseModel>::phi() const
{
return tmp<surfaceScalarField>::New
(
IOobject
(
IOobject::groupName("phi", phaseModel::name()),
U_.mesh().time().timeName(),
U_.mesh()
),
U_.mesh(),
dimensionedScalar(dimensionSet(0, 3, -1, 0, 0), Zero)
);
}
template<class BasePhaseModel>
const Foam::surfaceScalarField&
Foam::StaticPhaseModel<BasePhaseModel>::phi()
{
phi_ = dimensionedScalar(dimensionSet(0, 3, -1, 0, 0), Zero);
return phi_;
}
template<class BasePhaseModel>
Foam::tmp<Foam::surfaceScalarField>
Foam::StaticPhaseModel<BasePhaseModel>::alphaPhi() const
{
return tmp<surfaceScalarField>
(
new surfaceScalarField
(
IOobject
(
IOobject::groupName("alphaPhi", phaseModel::name()),
U_.mesh().time().timeName(),
U_.mesh()
),
U_.mesh(),
dimensionedScalar(dimensionSet(0, 3, -1, 0, 0), Zero)
)
);
}
template<class BasePhaseModel>
Foam::surfaceScalarField&
Foam::StaticPhaseModel<BasePhaseModel>::alphaPhi()
{
alphaPhi_ = dimensionedScalar(dimensionSet(0, 3, -1, 0, 0), Zero);
return alphaPhi_;
}
template<class BasePhaseModel>
Foam::tmp<Foam::volVectorField>
Foam::StaticPhaseModel<BasePhaseModel>::U() const
{
return tmp<volVectorField>
(
new volVectorField
(
IOobject
(
IOobject::groupName("U", phaseModel::name()),
U_.mesh().time().timeName(),
U_.mesh()
),
U_.mesh(),
dimensionedVector(dimVelocity, Zero)
)
);
}
template<class BasePhaseModel>
Foam::tmp<Foam::surfaceScalarField> Foam::StaticPhaseModel<BasePhaseModel>
::diffNo() const
{
tmp<surfaceScalarField> tkapparhoCpbyDelta
(
sqr(U_.mesh().surfaceInterpolation::deltaCoeffs())
*fvc::interpolate(this->kappa().ref())
/fvc::interpolate((this->Cp()*this->rho())())
);
return tkapparhoCpbyDelta;
}
// ************************************************************************* //

View File

@ -1,125 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
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::StaticPhaseModel
Description
Class which represents a static fluid phase.
SourceFiles
StaticPhaseModel.C
\*---------------------------------------------------------------------------*/
#ifndef StaticPhaseModel_H
#define StaticPhaseModel_H
#include "phaseModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class phaseModel Declaration
\*---------------------------------------------------------------------------*/
template<class BasePhaseModel>
class StaticPhaseModel
:
public BasePhaseModel
{
// Private data
//- Reference to U
const volVectorField& U_;
//- Flux
surfaceScalarField phi_;
//- Volumetric flux
surfaceScalarField alphaPhi_;
public:
// Constructors
StaticPhaseModel
(
const phaseSystem& fluid,
const word& phaseName
);
//- Destructor
virtual ~StaticPhaseModel() = default;
// Member Functions
//- Correct the phase properties other than the thermo and turbulence
virtual void correct();
// Momentum
//- Constant access the volumetric flux. Return zero field
virtual tmp<surfaceScalarField> phi() const;
//- Access the volumetric flux
virtual const surfaceScalarField& phi();
//- Constant access the volumetric flux of the phase.
virtual tmp<surfaceScalarField> alphaPhi() const;
//- Access the volumetric flux of the phase
virtual surfaceScalarField& alphaPhi();
//- Access const reference to U
virtual tmp<volVectorField> U() const;
//- Maximum diffusion number
virtual tmp<surfaceScalarField> diffNo() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "StaticPhaseModel.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,64 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
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/>.
\*---------------------------------------------------------------------------*/
#ifndef makePhaseTypes_H
#define makePhaseTypes_H
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#define makePhaseTypes(MomemtumType, CompType, Phase, Thermo, Name) \
\
namespace Foam \
{ \
typedef Foam::MomemtumType \
< \
Foam::CompType \
< \
Foam::Phase, \
Foam::Thermo \
> \
> \
Name; \
\
addNamedToRunTimeSelectionTable \
( \
phaseModel, \
Name, \
phaseSystem, \
Name \
); \
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,300 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
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 "phaseModel.H"
#include "phaseSystem.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(phaseModel, 0);
defineRunTimeSelectionTable(phaseModel, phaseSystem);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::phaseModel::phaseModel
(
const phaseSystem& fluid,
const word& phaseName
)
:
volScalarField
(
IOobject
(
IOobject::groupName("alpha", phaseName),
fluid.mesh().time().timeName(),
fluid.mesh(),
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
fluid.mesh(),
dimensionedScalar(dimless, Zero)
),
fluid_(fluid),
name_(phaseName)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const Foam::word& Foam::phaseModel::name() const
{
return name_;
}
const Foam::phaseSystem& Foam::phaseModel::fluid() const
{
return fluid_;
}
void Foam::phaseModel::correct()
{
thermo().correct();
}
void Foam::phaseModel::correctTurbulence()
{
// do nothing
}
Foam::tmp<Foam::volScalarField> Foam::phaseModel::rho() const
{
return thermo().rho();
}
Foam::tmp<Foam::scalarField> Foam::phaseModel::rho(const label patchI) const
{
return thermo().rho(patchI);
}
Foam::tmp<Foam::volScalarField> Foam::phaseModel::hc() const
{
return thermo().hc();
}
Foam::tmp<Foam::volScalarField> Foam::phaseModel::Cp() const
{
return thermo().Cp();
}
Foam::tmp<Foam::scalarField> Foam::phaseModel::Cp
(
const scalarField& p,
const scalarField& T,
const label patchI
) const
{
return (thermo().Cp(p, T, patchI));
}
Foam::tmp<Foam::volScalarField> Foam::phaseModel::Cv() const
{
return thermo().Cv();
}
Foam::tmp<Foam::scalarField> Foam::phaseModel::Cv
(
const scalarField& p,
const scalarField& T,
const label patchI
) const
{
return thermo().Cv(p, T, patchI);
}
Foam::tmp<Foam::volScalarField> Foam::phaseModel::gamma() const
{
return thermo().gamma();
}
Foam::tmp<Foam::scalarField> Foam::phaseModel::gamma
(
const scalarField& p,
const scalarField& T,
const label patchI
) const
{
return thermo().gamma(p, T, patchI);
}
Foam::tmp<Foam::volScalarField> Foam::phaseModel::Cpv() const
{
return thermo().Cpv();
}
Foam::tmp<Foam::scalarField> Foam::phaseModel::Cpv
(
const scalarField& p,
const scalarField& T,
const label patchI
) const
{
return thermo().Cpv(p, T, patchI);
}
Foam::tmp<Foam::volScalarField> Foam::phaseModel::CpByCpv() const
{
return thermo().CpByCpv();
}
Foam::tmp<Foam::scalarField> Foam::phaseModel::CpByCpv
(
const scalarField& p,
const scalarField& T,
const label patchI
) const
{
return thermo().CpByCpv(p, T, patchI);
}
const Foam::volScalarField& Foam::phaseModel::alpha() const
{
return thermo().alpha();
}
const Foam::scalarField& Foam::phaseModel::alpha(const label patchI) const
{
return thermo().alpha(patchI);
}
Foam::tmp<Foam::volScalarField> Foam::phaseModel::kappa() const
{
return thermo().kappa();
}
Foam::tmp<Foam::scalarField> Foam::phaseModel::kappa(const label patchI) const
{
return thermo().kappa(patchI);
}
Foam::tmp<Foam::volScalarField> Foam::phaseModel::alphahe() const
{
return thermo().alphahe();
}
Foam::tmp<Foam::scalarField> Foam::phaseModel::alphahe(const label patchI) const
{
return thermo().alphahe(patchI);
}
Foam::tmp<Foam::volScalarField>Foam::phaseModel::kappaEff
(
const volScalarField& kappat
) const
{
tmp<volScalarField> kappaEff(kappa() + kappat);
kappaEff.ref().rename("kappaEff" + name_);
return kappaEff;
}
Foam::tmp<Foam::scalarField> Foam::phaseModel::kappaEff
(
const scalarField& kappat,
const label patchI
) const
{
return (kappa(patchI) + kappat);
}
Foam::tmp<Foam::volScalarField> Foam::phaseModel::alphaEff
(
const volScalarField& alphat
) const
{
return (thermo().alpha() + alphat);
}
Foam::tmp<Foam::scalarField> Foam::phaseModel::alphaEff
(
const scalarField& alphat,
const label patchI
) const
{
return (thermo().alpha(patchI) + alphat);
}
Foam::tmp<Foam::volScalarField> Foam::phaseModel::mu() const
{
return thermo().mu();
}
Foam::tmp<Foam::scalarField> Foam::phaseModel::mu(const label patchi) const
{
return thermo().mu(patchi);
}
Foam::tmp<Foam::volScalarField> Foam::phaseModel::nu() const
{
return thermo().nu();
}
Foam::tmp<Foam::scalarField> Foam::phaseModel::nu(const label patchi) const
{
return thermo().nu(patchi);
}
bool Foam::phaseModel::read()
{
return true;
}
// ************************************************************************* //

View File

@ -1,333 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
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::phaseModel
Description
SourceFiles
phaseModel.C
newphaseModel.C
\*---------------------------------------------------------------------------*/
#ifndef phaseModel_H
#define phaseModel_H
#include "dictionary.H"
#include "dimensionedScalar.H"
#include "volFields.H"
#include "surfaceFields.H"
#include "fvMatricesFwd.H"
#include "runTimeSelectionTables.H"
#include "rhoThermo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
class phaseSystem;
/*---------------------------------------------------------------------------*\
Class phaseModel Declaration
\*---------------------------------------------------------------------------*/
class phaseModel
:
public volScalarField
{
// Private data
//- Reference to the phaseSystem to which this phase belongs
const phaseSystem& fluid_;
//- Name of phase
word name_;
public:
//- Runtime type information
ClassName("phaseModel");
// Declare runtime construction
declareRunTimeSelectionTable
(
autoPtr,
phaseModel,
phaseSystem,
(
const phaseSystem& fluid,
const word& phaseName
),
(fluid, phaseName)
);
// Constructors
//- Construct from phaseSystem and phaseName
phaseModel(const phaseSystem& fluid, const word& phaseName);
//- Destructor
virtual ~phaseModel() = default;
// Selectors
static autoPtr<phaseModel> New
(
const phaseSystem& fluid,
const word& phaseName
);
// Member Functions
//- Return the name of this phase
const word& name() const;
//- Return the system to which this phase belongs
const phaseSystem& fluid() const;
//- Correct phase thermo
virtual void correct();
//- Correct the turbulence
virtual void correctTurbulence();
//- Solve species fraction equation
virtual void solveYi
(
PtrList<volScalarField::Internal>& Su,
PtrList<volScalarField::Internal>& Sp
) = 0;
//- Read phase properties dictionary
virtual bool read();
// Thermo
//- Access const to phase thermo
virtual const rhoThermo& thermo() const = 0;
//- Access to phase thermo
virtual rhoThermo& thermo() = 0;
//- Return the phase density
tmp<volScalarField> rho() const;
//- Return phase density on a patch
tmp<scalarField> rho(const label patchi) const;
//- Chemical enthalpy for phase [J/kg]
tmp<volScalarField> hc() const;
//- Return phase Cp
tmp<volScalarField> Cp() const;
//- Heat capacity of the phase at constant pressure for patch
// [J/kg/K]
tmp<scalarField> Cp
(
const scalarField& p,
const scalarField& T,
const label patchi
) const;
//- Return Cv of the phase
tmp<volScalarField> Cv() const;
//- Heat capacity at constant volume for phase for a patch [J/kg/K]
tmp<scalarField> Cv
(
const scalarField& p,
const scalarField& T,
const label patchI
) const;
//- Gamma = Cp/Cv of phase[]
tmp<volScalarField> gamma() const;
//- Gamma = Cp/Cv for phase on patch []
tmp<scalarField> gamma
(
const scalarField& p,
const scalarField& T,
const label patchi
) const;
//- Heat capacity at constant pressure/volume for phase [J/kg/K]
tmp<volScalarField> Cpv() const;
//- Heat capacity at constant pressure/volume for phase at patch
// [J/kg/K]
tmp<scalarField> Cpv
(
const scalarField& p,
const scalarField& T,
const label patchi
) const;
//- Heat capacity ratio for phase []
tmp<volScalarField> CpByCpv() const;
//- Heat capacity ratio for phase at patch []
tmp<scalarField> CpByCpv
(
const scalarField& p,
const scalarField& T,
const label patchi
) const;
//- Query each thermo for dpdt
Switch dpdt() const
{
return thermo().dpdt();
}
// Transport
//- Thermal diffusivity for enthalpy of mixture [kg/m/s]
const volScalarField& alpha() const;
//- Thermal diffusivity for enthalpy of mixture for patch [kg/m/s]
const scalarField& alpha(const label patchi) const;
//- Thermal diffusivity for temperature of phase [J/m/s/K]
tmp<volScalarField> kappa() const;
//- Thermal diffusivity for temperature of phase for patch [J/m/s/K]
tmp<scalarField> kappa(const label patchi) const;
//- Thermal diffusivity for energy of mixture [kg/m/s]
tmp<volScalarField> alphahe() const;
//- Thermal diffusivity for energy of mixture for patch [kg/m/s]
tmp<scalarField> alphahe(const label patchi) const;
//- Effective thermal diffusivity for temperature of phase [J/m/s/K]
tmp<volScalarField> kappaEff(const volScalarField&) const;
//- Effective thermal diffusivity for temperature
// of phase for patch [J/m/s/K]
tmp<scalarField> kappaEff
(
const scalarField& alphat,
const label patchi
) const;
//- Effective thermal diffusivity of phase [kg/m/s]
tmp<volScalarField> alphaEff(const volScalarField& alphat) const;
//- Effective thermal diffusivity of phase for patch [kg/m/s]
tmp<scalarField> alphaEff
(
const scalarField& alphat,
const label patchi
) const;
//- Return the mixture kinematic viscosity
virtual tmp<volScalarField> nu() const;
//- Return the mixture kinematic viscosity on patchi
virtual tmp<scalarField> nu(const label patchi) const;
//- Return the mixture dymanic viscosity
virtual tmp<volScalarField> mu() const;
//- Return the mixture dymanic viscosity on patchi
virtual tmp<scalarField> mu(const label patchi) const;
//- Diffusion number
virtual tmp<surfaceScalarField> diffNo() const = 0;
// Species
//- Constant access the species mass fractions
virtual const PtrList<volScalarField>& Y() const = 0;
//- Access the species mass fractions
virtual PtrList<volScalarField>& Y() = 0;
// Momentum
//- Constant access the volumetric flux
virtual tmp<surfaceScalarField> phi() const = 0;
//- Access the volumetric flux
virtual const surfaceScalarField& phi() = 0;
//- Constant access the volumetric flux of the phase
virtual tmp<surfaceScalarField> alphaPhi() const = 0;
//- Access the volumetric flux of the phase
virtual surfaceScalarField& alphaPhi() = 0;
//- Access const reference to U
virtual tmp<volVectorField> U() const = 0;
// Turbulence (WIP: possible to add turbulence on each phase)
/*
//- Return the turbulent dynamic viscosity
virtual tmp<volScalarField> mut() const = 0;
//- Return the turbulent dynamic viscosity on a patch
virtual tmp<scalarField> mut(const label patchI) const = 0;
//- Return the turbulent kinematic viscosity
virtual tmp<volScalarField> nut() const = 0;
//- Return the turbulent kinematic viscosity on a patch
virtual tmp<scalarField> nut(const label patchI) const = 0;
//- Return the kinetic pressure derivative w.r.t. volume fraction
virtual tmp<volScalarField> pPrime() const = 0;
//- Return the turbulent kinetic energy
virtual tmp<volScalarField> k() const = 0;
*/
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,63 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017-2019 OpenCFD Ltd.
-------------------------------------------------------------------------------
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 "phaseModel.H"
#include "phaseSystem.H"
// * * * * * * * * * * * * * * * * Selector * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::phaseModel> Foam::phaseModel::New
(
const phaseSystem& fluid,
const word& phaseName
)
{
const dictionary& dict = fluid.subDict(phaseName);
const word modelType(dict.get<word>("type"));
Info<< "Selecting phaseModel for "
<< phaseName << ": " << modelType << endl;
const auto cstrIter = phaseSystemConstructorTablePtr_->cfind(modelType);
if (!cstrIter.found())
{
FatalIOErrorInLookup
(
dict,
"phaseModel",
modelType,
*phaseSystemConstructorTablePtr_
) << exit(FatalIOError);
}
return cstrIter()(fluid, phaseName);
}
// ************************************************************************* //

View File

@ -1,78 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
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 "makePhaseTypes.H"
#include "PurePhaseModel.H"
#include "MultiComponentPhaseModel.H"
#include "MovingPhaseModel.H"
#include "StaticPhaseModel.H"
#include "rhoThermo.H"
#include "solidThermo.H"
#include "rhoReactionThermo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePhaseTypes
(
MovingPhaseModel,
PurePhaseModel,
phaseModel,
rhoThermo,
pureMovingPhaseModel // Name of the phase type
);
makePhaseTypes
(
StaticPhaseModel,
PurePhaseModel,
phaseModel,
rhoThermo,
pureStaticPhaseModel
);
makePhaseTypes
(
StaticPhaseModel,
PurePhaseModel,
phaseModel,
solidThermo,
pureStaticSolidPhaseModel
);
makePhaseTypes
(
MovingPhaseModel,
MultiComponentPhaseModel,
phaseModel,
rhoReactionThermo,
multiComponentMovingPhaseModel
);
// ************************************************************************* //

View File

@ -1,64 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
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 "orderedPhasePair.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::orderedPhasePair::orderedPhasePair
(
const phaseModel& from,
const phaseModel& to
)
:
phasePair(from, to, true)
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
const Foam::phaseModel& Foam::orderedPhasePair::from() const
{
return phase1();
}
const Foam::phaseModel& Foam::orderedPhasePair::to() const
{
return phase2();
}
Foam::word Foam::orderedPhasePair::name() const
{
word namec(second());
namec[0] = toupper(namec[0]);
return first() + "To" + namec;
}
// ************************************************************************* //

View File

@ -1,91 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
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::orderedPhasePair
Description
SourceFiles
orderedPhasePair.C
\*---------------------------------------------------------------------------*/
#ifndef orderedPhasePair_H
#define orderedPhasePair_H
#include "phasePair.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class orderedPhasePair Declaration
\*---------------------------------------------------------------------------*/
class orderedPhasePair
:
public phasePair
{
public:
// Constructors
//- Construct from two phases and gravity
orderedPhasePair
(
const phaseModel& from,
const phaseModel& to
);
//- Destructor
virtual ~orderedPhasePair() = default;
// Member Functions
//- Dispersed phase
virtual const phaseModel& from() const;
//- Continuous phase
virtual const phaseModel& to() const;
//- Pair name
virtual word name() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,77 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
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 "phasePair.H"
#include "surfaceTensionModel.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::phasePair::phasePair
(
const phaseModel& phase1,
const phaseModel& phase2,
const bool ordered
)
:
phasePairKey(phase1.name(), phase2.name(), ordered),
phase1_(phase1),
phase2_(phase2)
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
const Foam::phaseModel& Foam::phasePair::from() const
{
FatalErrorInFunction
<< "Requested from phase from an unordered pair."
<< exit(FatalError);
return phase1_;
}
const Foam::phaseModel& Foam::phasePair::to() const
{
FatalErrorInFunction
<< "Requested to phase from an unordered pair."
<< exit(FatalError);
return phase1_;
}
Foam::word Foam::phasePair::name() const
{
word name2(second());
name2[0] = toupper(name2[0]);
return first() + "And" + name2;
}
// ************************************************************************* //

View File

@ -1,118 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
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::phasePair
Description
Description for mass transfer between a pair of phases. The direction of
the mass transfer is from the phase 'from' to the phasse 'to'.
SourceFiles
phasePair.C
\*---------------------------------------------------------------------------*/
#ifndef phasePair_H
#define phasePair_H
#include "phaseModel.H"
#include "phasePairKey.H"
#include "uniformDimensionedFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class phasePair Declaration
\*---------------------------------------------------------------------------*/
class phasePair
:
public phasePairKey
{
// Private data
//- Phase 1
const phaseModel& phase1_;
//- Phase 2
const phaseModel& phase2_;
public:
// Constructors
//- Construct from two phases
phasePair
(
const phaseModel& phase1,
const phaseModel& phase2,
const bool ordered = false
);
//- Destructor
virtual ~phasePair() = default;
// Member Functions
//- From phase
virtual const phaseModel& from() const;
//- To phase
virtual const phaseModel& to() const;
//- Pair name
virtual word name() const;
// Access
// Phase 1
inline const phaseModel& phase1() const;
// Phase 2
inline const phaseModel& phase2() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "phasePairI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,42 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
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/>.
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
inline const Foam::phaseModel& Foam::phasePair::phase1() const
{
return phase1_;
}
inline const Foam::phaseModel& Foam::phasePair::phase2() const
{
return phase2_;
}
// ************************************************************************* //

View File

@ -1,149 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
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 "phasePairKey.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::phasePairKey::phasePairKey
(
const word& name1,
const word& name2,
const bool ordered
)
:
Pair<word>(name1, name2),
ordered_(ordered)
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
bool Foam::phasePairKey::ordered() const
{
return ordered_;
}
// * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * //
Foam::label Foam::phasePairKey::hash::operator()
(
const phasePairKey& key
) const
{
if (key.ordered_)
{
return
word::hash()
(
key.first(),
word::hash()(key.second())
);
}
return word::hash()(key.first()) + word::hash()(key.second());
}
// * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * * //
bool Foam::operator==
(
const phasePairKey& a,
const phasePairKey& b
)
{
const auto cmp = Pair<word>::compare(a,b);
return
(
(a.ordered_ == b.ordered_)
&& (a.ordered_ ? (cmp == 1) : cmp)
);
}
bool Foam::operator!=
(
const phasePairKey& a,
const phasePairKey& b
)
{
return !(a == b);
}
// * * * * * * * * * * * * * * Istream Operator * * * * * * * * * * * * * * //
Foam::Istream& Foam::operator>>(Istream& is, phasePairKey& key)
{
const FixedList<word, 3> temp(is);
key.first() = temp[0];
if (temp[1] == "and")
{
key.ordered_ = false;
}
else if (temp[1] == "to")
{
key.ordered_ = true;
}
else
{
FatalErrorInFunction
<< "Phase pair type is not recognised. "
<< temp
<< "Use (phaseDispersed to phaseContinuous) for an ordered pair, "
<< "or (phase1 and phase2) for an unordered pair."
<< exit(FatalError);
}
key.second() = temp[2];
return is;
}
// * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<(Ostream& os, const phasePairKey& key)
{
os << token::BEGIN_LIST
<< key.first()
<< token::SPACE
<< (key.ordered_ ? "to" : "and")
<< token::SPACE
<< key.second()
<< token::END_LIST;
return os;
}
// ************************************************************************* //

View File

@ -1,126 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
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::phasePairKey
Description
SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef phasePairKey_H
#define phasePairKey_H
#include "Pair.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declarations
class phasePairKey;
bool operator==(const phasePairKey& a, const phasePairKey& b);
bool operator!=(const phasePairKey& a, const phasePairKey& b);
Istream& operator>>(Istream& is, phasePairKey& key);
Ostream& operator<<(Ostream& os, const phasePairKey& key);
/*---------------------------------------------------------------------------*\
Class phasePairKey Declaration
\*---------------------------------------------------------------------------*/
class phasePairKey
:
public Pair<word>
{
// Private data
//- Flag to indicate whether ordering is important
bool ordered_;
public:
//- Ordered or unordered hashing of word pair
struct hash
{
//- Generate a hash from a phase pair key
label operator()(const phasePairKey& key) const;
};
// Constructors
//- Construct null
phasePairKey() {} // = default
//- Construct from names and optional ordering flag
phasePairKey
(
const word& name1,
const word& name2,
const bool ordered = false
);
//- Destructor
virtual ~phasePairKey() = default;
// Access
//- Return the ordered flag
bool ordered() const;
// Friend Operators
//- Test for equality
friend bool operator==(const phasePairKey& a, const phasePairKey& b);
//- Test for inequality
friend bool operator!=(const phasePairKey& a, const phasePairKey& b);
//- Read from Istream
friend Istream& operator>>(Istream& is, phasePairKey& key);
//- Write to Ostream
friend Ostream& operator<<(Ostream& os, const phasePairKey& key);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,502 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
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 "multiphaseSystem.H"
#include "fixedValueFvsPatchFields.H"
#include "Time.H"
#include "subCycle.H"
#include "fvcMeshPhi.H"
#include "surfaceInterpolate.H"
#include "fvcGrad.H"
#include "fvcSnGrad.H"
#include "fvcDiv.H"
#include "fvcDdt.H"
#include "fvcFlux.H"
#include "fvmDdt.H"
#include "fvcAverage.H"
#include "fvMatrix.H"
#include "fvmSup.H"
#include "CMULES.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(multiphaseSystem, 0);
defineRunTimeSelectionTable(multiphaseSystem, dictionary);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::multiphaseSystem::multiphaseSystem
(
const fvMesh& mesh
)
:
phaseSystem(mesh),
cAlphas_(),
ddtAlphaMax_(0.0),
limitedPhiAlphas_(phaseModels_.size()),
Su_(phaseModels_.size()),
Sp_(phaseModels_.size())
{
label phasei = 0;
phases_.setSize(phaseModels_.size());
forAllIters(phaseModels_, iter)
{
phaseModel& pm = iter()();
phases_.set(phasei++, &pm);
}
mesh.solverDict("alpha").readEntry("cAlphas", cAlphas_);
// Initiate Su and Sp
forAllConstIters(phaseModels_, iter)
{
const phaseModel& pm = iter()();
Su_.insert
(
pm.name(),
volScalarField::Internal
(
IOobject
(
"Su" + pm.name(),
mesh_.time().timeName(),
mesh_
),
mesh_,
dimensionedScalar(dimless/dimTime, Zero)
)
);
Sp_.insert
(
pm.name(),
volScalarField::Internal
(
IOobject
(
"Sp" + pm.name(),
mesh_.time().timeName(),
mesh_
),
mesh_,
dimensionedScalar(dimless/dimTime, Zero)
)
);
}
}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
void Foam::multiphaseSystem::calculateSuSp()
{
this->alphaTransfer(Su_, Sp_);
}
void Foam::multiphaseSystem::solve()
{
const dictionary& alphaControls = mesh_.solverDict("alpha");
label nAlphaSubCycles(alphaControls.get<label>("nAlphaSubCycles"));
volScalarField& alpha = phases_.first();
if (nAlphaSubCycles > 1)
{
surfaceScalarField rhoPhiSum
(
IOobject
(
"rhoPhiSum",
mesh_.time().timeName(),
mesh_
),
mesh_,
dimensionedScalar(rhoPhi_.dimensions(), Zero)
);
dimensionedScalar totalDeltaT = mesh_.time().deltaT();
for
(
subCycle<volScalarField> alphaSubCycle(alpha, nAlphaSubCycles);
!(++alphaSubCycle).end();
)
{
solveAlphas();
rhoPhiSum += (mesh_.time().deltaT()/totalDeltaT)*rhoPhi_;
}
rhoPhi_ = rhoPhiSum;
}
else
{
solveAlphas();
}
}
void Foam::multiphaseSystem::solveAlphas()
{
const dictionary& alphaControls = mesh_.solverDict("alpha");
alphaControls.readEntry("cAlphas", cAlphas_);
label nAlphaCorr(alphaControls.get<label>("nAlphaCorr"));
PtrList<surfaceScalarField> phiAlphaCorrs(phases_.size());
const surfaceScalarField& phi = this->phi();
surfaceScalarField phic(mag((phi)/mesh_.magSf()));
// Do not compress interface at non-coupled boundary faces
// (inlets, outlets etc.)
surfaceScalarField::Boundary& phicBf = phic.boundaryFieldRef();
forAll(phic.boundaryField(), patchi)
{
fvsPatchScalarField& phicp = phicBf[patchi];
if (!phicp.coupled())
{
phicp == 0;
}
}
for (int acorr=0; acorr<nAlphaCorr; acorr++)
{
label phasei = 0;
for (phaseModel& phase1 : phases_)
{
const volScalarField& alpha1 = phase1;
phiAlphaCorrs.set
(
phasei,
new surfaceScalarField
(
"phi" + alpha1.name() + "Corr",
fvc::flux
(
phi,
alpha1,
"div(phi," + alpha1.name() + ')'
)
)
);
surfaceScalarField& phiAlphaCorr = phiAlphaCorrs[phasei];
for (phaseModel& phase2 : phases_)
{
const volScalarField& alpha2 = phase2;
if (&phase2 == &phase1) continue;
const phasePairKey key12(phase1.name(), phase2.name());
if (!cAlphas_.found(key12))
{
FatalErrorInFunction
<< "Phase compression factor (cAlpha) not found for : "
<< key12
<< exit(FatalError);
}
scalar cAlpha = cAlphas_.find(key12)();
phic = min(cAlpha*phic, max(phic));
surfaceScalarField phir(phic*nHatf(alpha1, alpha2));
word phirScheme
(
"div(phir," + alpha2.name() + ',' + alpha1.name() + ')'
);
phiAlphaCorr += fvc::flux
(
-fvc::flux(-phir, alpha2, phirScheme),
alpha1,
phirScheme
);
}
// Ensure that the flux at inflow BCs is preserved
forAll(phiAlphaCorr.boundaryField(), patchi)
{
fvsPatchScalarField& phiAlphaCorrp =
phiAlphaCorr.boundaryFieldRef()[patchi];
if (!phiAlphaCorrp.coupled())
{
const scalarField& phi1p = phi.boundaryField()[patchi];
const scalarField& alpha1p =
alpha1.boundaryField()[patchi];
forAll(phiAlphaCorrp, facei)
{
if (phi1p[facei] < 0)
{
phiAlphaCorrp[facei] = alpha1p[facei]*phi1p[facei];
}
}
}
}
++phasei;
}
// Set Su and Sp to zero
for (const phaseModel& phase : phases_)
{
Su_[phase.name()] = dimensionedScalar("Su", dimless/dimTime, Zero);
Sp_[phase.name()] = dimensionedScalar("Sp", dimless/dimTime, Zero);
// Add alpha*div(U)
//const volScalarField& alpha = phase;
//Su_[phase.name()] +=
// fvc::div(phi)*min(max(alpha, scalar(0)), scalar(1));
}
// Fill Su and Sp
calculateSuSp();
// Limit phiAlphaCorr on each phase
phasei = 0;
for (phaseModel& phase : phases_)
{
volScalarField& alpha1 = phase;
surfaceScalarField& phiAlphaCorr = phiAlphaCorrs[phasei];
volScalarField::Internal& Su = Su_[phase.name()];
volScalarField::Internal& Sp = Sp_[phase.name()];
MULES::limit
(
1.0/mesh_.time().deltaT().value(),
geometricOneField(),
alpha1,
phi,
phiAlphaCorr,
Sp,
Su,
oneField(),
zeroField(),
true
);
++phasei;
}
MULES::limitSum(phiAlphaCorrs);
volScalarField sumAlpha
(
IOobject
(
"sumAlpha",
mesh_.time().timeName(),
mesh_
),
mesh_,
dimensionedScalar(dimless, Zero)
);
phasei = 0;
for (phaseModel& phase : phases_)
{
volScalarField& alpha1 = phase;
const volScalarField::Internal& Su = Su_[phase.name()];
const volScalarField::Internal& Sp = Sp_[phase.name()];
surfaceScalarField& phiAlpha = phiAlphaCorrs[phasei];
// Add a bounded upwind U-mean flux
//phiAlpha += upwind<scalar>(mesh_, phi).flux(alpha1);
fvScalarMatrix alpha1Eqn
(
fv::EulerDdtScheme<scalar>(mesh_).fvmDdt(alpha1)
+ fv::gaussConvectionScheme<scalar>
(
mesh_,
phi,
upwind<scalar>(mesh_, phi)
).fvmDiv(phi, alpha1)
==
Su + fvm::Sp(Sp, alpha1)
);
alpha1Eqn.solve();
phiAlpha += alpha1Eqn.flux();
MULES::explicitSolve
(
geometricOneField(),
alpha1,
phi,
phiAlpha,
Sp,
Su,
oneField(),
zeroField()
);
phase.alphaPhi() = phiAlpha;
++phasei;
}
if (acorr == nAlphaCorr - 1)
{
volScalarField sumAlpha
(
IOobject
(
"sumAlpha",
mesh_.time().timeName(),
mesh_
),
mesh_,
dimensionedScalar(dimless, Zero)
);
// Reset rhoPhi
rhoPhi_ = dimensionedScalar("rhoPhi", dimMass/dimTime, Zero);
for (phaseModel& phase : phases_)
{
volScalarField& alpha1 = phase;
sumAlpha += alpha1;
// Update rhoPhi
rhoPhi_ += fvc::interpolate(phase.rho()) * phase.alphaPhi();
}
Info<< "Phase-sum volume fraction, min, max = "
<< sumAlpha.weightedAverage(mesh_.V()).value()
<< ' ' << min(sumAlpha).value()
<< ' ' << max(sumAlpha).value()
<< endl;
volScalarField sumCorr(1.0 - sumAlpha);
for (phaseModel& phase : phases_)
{
volScalarField& alpha = phase;
alpha += alpha*sumCorr;
Info<< alpha.name() << " volume fraction = "
<< alpha.weightedAverage(mesh_.V()).value()
<< " Min(alpha) = " << min(alpha).value()
<< " Max(alpha) = " << max(alpha).value()
<< endl;
}
}
}
}
const Foam::UPtrList<Foam::phaseModel>& Foam::multiphaseSystem::phases() const
{
return phases_;
}
Foam::UPtrList<Foam::phaseModel>& Foam::multiphaseSystem::phases()
{
return phases_;
}
const Foam::phaseModel& Foam::multiphaseSystem::phase(const label i) const
{
return phases_[i];
}
Foam::phaseModel& Foam::multiphaseSystem::phase(const label i)
{
return phases_[i];
}
Foam::dimensionedScalar Foam::multiphaseSystem::ddtAlphaMax() const
{
return ddtAlphaMax_;
}
Foam::scalar Foam::multiphaseSystem::maxDiffNo() const
{
auto iter = phaseModels_.cbegin();
scalar maxVal = max(iter()->diffNo()).value();
for (++iter; iter != phaseModels_.cend(); ++iter)
{
maxVal = max(maxVal, max(iter()->diffNo()).value());
}
return maxVal * mesh_.time().deltaT().value();
}
const Foam::multiphaseSystem::compressionFluxTable&
Foam::multiphaseSystem::limitedPhiAlphas() const
{
return limitedPhiAlphas_;
}
Foam::multiphaseSystem::SuSpTable& Foam::multiphaseSystem::Su()
{
return Su_;
}
Foam::multiphaseSystem::SuSpTable& Foam::multiphaseSystem::Sp()
{
return Sp_;
}
bool Foam::multiphaseSystem::read()
{
return true;
}
// ************************************************************************* //

View File

@ -1,178 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
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::multiphaseSystem
Description
Class which solves the volume fraction equations for multiple phases
SourceFiles
multiphaseSystem.C
\*---------------------------------------------------------------------------*/
#ifndef multiphaseSystem_H
#define multiphaseSystem_H
#include "phaseSystem.H"
#include "UPtrList.H"
#include "phasePairKey.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class multiphaseSystem Declaration
\*---------------------------------------------------------------------------*/
class multiphaseSystem
:
public phaseSystem
{
protected:
typedef HashTable<volScalarField::Internal> SuSpTable;
typedef HashTable<scalar, phasePairKey, phasePairKey::hash>
scalarTable;
typedef HashTable<surfaceScalarField> compressionFluxTable;
// Protected data
//- Unallocated phase list
UPtrList<phaseModel> phases_;
//- Table for compression factors between phases
scalarTable cAlphas_;
//- Maximum volumen rate change
dimensionedScalar ddtAlphaMax_;
//- Compression fluxed for phases
compressionFluxTable limitedPhiAlphas_;
//- Su phase source terms
SuSpTable Su_;
//- Sp phase source terms
SuSpTable Sp_;
// Protected members
//- Calculate Sp and Su
void calculateSuSp();
//- Solve alphas
void solveAlphas();
public:
//- Runtime type information
TypeName("multiphaseSystem");
// Declare runtime construction
declareRunTimeSelectionTable
(
autoPtr,
multiphaseSystem,
dictionary,
(
const fvMesh& mesh
),
(mesh)
);
// Constructors
//- Construct from fvMesh
multiphaseSystem(const fvMesh&);
//- Destructor
virtual ~multiphaseSystem() = default;
// Selectors
static autoPtr<multiphaseSystem> New(const fvMesh& mesh);
// Member Functions
//- Solve for the phase fractions
virtual void solve();
// Access
//- Return phases
const UPtrList<phaseModel>& phases() const;
//- Return phases
UPtrList<phaseModel>& phases();
//- Constant access phase model i
const phaseModel& phase(const label i) const;
//- Access phase model i
phaseModel& phase(const label i);
//- Access to ddtAlphaMax
dimensionedScalar ddtAlphaMax() const;
//- Maximum diffusion number
scalar maxDiffNo() const;
//- Access to compression fluxes for phaes
const compressionFluxTable& limitedPhiAlphas() const;
//- Access Su
SuSpTable& Su();
//- Access Sp
SuSpTable& Sp();
//- Read thermophysical properties dictionary
virtual bool read();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,71 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017-2019 OpenCFD Ltd.
-------------------------------------------------------------------------------
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 "multiphaseSystem.H"
// * * * * * * * * * * * * * * * * Selector * * * * * * * * * * * * * * * * //
Foam::autoPtr<Foam::multiphaseSystem> Foam::multiphaseSystem::New
(
const fvMesh& mesh
)
{
const IOdictionary dict
(
IOobject
(
phasePropertiesName,
mesh.time().constant(),
mesh,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false // Do not register
)
);
const word systemType(dict.get<word>("type"));
Info<< "Selecting multiphaseSystem " << systemType << endl;
const auto cstrIter = dictionaryConstructorTablePtr_->cfind(systemType);
if (!cstrIter.found())
{
FatalIOErrorInLookup
(
dict,
"multiphaseSystem",
systemType,
*dictionaryConstructorTablePtr_
) << exit(FatalIOError);
}
return autoPtr<multiphaseSystem>(cstrIter()(mesh));
}
// ************************************************************************* //

View File

@ -1,51 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
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 "addToRunTimeSelectionTable.H"
#include "phaseSystem.H"
#include "multiphaseSystem.H"
#include "MassTransferPhaseSystem.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef
MassTransferPhaseSystem<multiphaseSystem> massTransferMultiphaseSystem;
addNamedToRunTimeSelectionTable
(
multiphaseSystem,
massTransferMultiphaseSystem,
dictionary,
massTransferMultiphaseSystem
);
}
// ************************************************************************* //

View File

@ -1,659 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017-2020 OpenCFD Ltd.
-------------------------------------------------------------------------------
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::phaseSystem
Description
SourceFiles
phaseSystem.C
\*---------------------------------------------------------------------------*/
#ifndef phaseSystem_H
#define phaseSystem_H
#include "basicThermo.H"
#include "phaseModel.H"
#include "phasePair.H"
#include "orderedPhasePair.H"
#include "volFields.H"
#include "surfaceFields.H"
#include "fvMatricesFwd.H"
#include "compressibleTransportModel.H"
#include "localMin.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward Declarations
class surfaceTensionModel;
class porousModel;
/*---------------------------------------------------------------------------*\
Class phaseSystem Declaration
\*---------------------------------------------------------------------------*/
class phaseSystem
:
public basicThermo,
public compressibleTransportModel
{
public:
// Public typedefs
typedef
HashTable
<
autoPtr<phasePair>, phasePairKey, phasePairKey::hash
>
phasePairTable;
typedef HashTable<autoPtr<phaseModel>> phaseModelTable;
typedef HashTable<volScalarField::Internal> SuSpTable;
protected:
// Protected typedefs
typedef
HashTable<dictionary, phasePairKey, phasePairKey::hash> dictTable;
typedef
HashTable
<
autoPtr<surfaceTensionModel>,
phasePairKey,
phasePairKey::hash
>
surfaceTensionModelTable;
typedef
HashTable
<
autoPtr<porousModel>,
phasePairKey,
phasePairKey::hash
>
interfacePorousModelTable;
// Protected data
//- Reference to the mesh
const fvMesh& mesh_;
//- Dynamic viscocity
volScalarField mu_;
//- Phase names
wordList phaseNames_;
//- Mixture total volumetric flux
surfaceScalarField phi_;
//- Mixture total mass flux
surfaceScalarField rhoPhi_;
//- Phase models
phaseModelTable phaseModels_;
//- Phase pairs
phasePairTable phasePairs_;
//- Total ordered phase pairs in the system
phasePairTable totalPhasePairs_;
//- Turbulent Prandt number
dimensionedScalar Prt_;
// Sub Models
//- Surface tension models
surfaceTensionModelTable surfaceTensionModels_;
//- Interface porous models
interfacePorousModelTable interfacePorousModelTable_;
// Protected member functions
//- Calculate and return the laminar viscosity
void calcMu();
//- Generate the phases
HashTable<autoPtr<phaseModel>> generatePhaseModels
(
const wordList& names
) const;
//- Generate the mixture flux
tmp<surfaceScalarField> generatePhi
(
const HashTable<autoPtr<phaseModel>>& phaseModels
) const;
//- Generate pairs
void generatePairs(const dictTable& modelDicts);
//- Generate pair table
void generatePairsTable();
//- Generate pairs and sub-model tables using pair keys
template<class modelType>
void createSubModels
(
const dictTable& modelDicts,
HashTable
<
autoPtr<modelType>,
phasePairKey,
phasePairKey::hash
>& models
);
//- Generate pairs and sub-model tables using mesh
template<class modelType>
void createSubModels
(
const dictTable& modelDicts,
const fvMesh& mesh,
HashTable
<
autoPtr<modelType>,
phasePairKey,
phasePairKey::hash
>& models
);
//- Generate pairs and sub-model tables
template<class modelType>
void generatePairsAndSubModels
(
const word& modelName,
HashTable
<
autoPtr<modelType>,
phasePairKey,
phasePairKey::hash
>& models
);
//- Generate pairs and per-phase sub-model tables with mesh ref
template<class modelType>
void generatePairsAndSubModels
(
const word& modelName,
const fvMesh& mesh,
HashTable
<
autoPtr<modelType>,
phasePairKey,
phasePairKey::hash
>& models
);
//- Generate pairs and per-phase sub-model tables
template<class modelType>
void generatePairsAndSubModels
(
const word& modelName,
HashTable
<
HashTable<autoPtr<modelType>>,
phasePairKey,
phasePairKey::hash
>& models
);
public:
//- Runtime type information
TypeName("phaseSystem");
//- Default name of the phase properties dictionary
static const word phasePropertiesName;
// Constructors
//- Construct from fvMesh
phaseSystem(const fvMesh& mesh);
//- Destructor
virtual ~phaseSystem();
// Energy related thermo functionaliy functions
//- Return access to the internal energy field [J/Kg]
// \note this mixture thermo is prepared to work with T
virtual volScalarField& he()
{
NotImplemented;
return const_cast<volScalarField&>(volScalarField::null());
}
//- Return access to the internal energy field [J/Kg]
// \note this mixture thermo is prepared to work with T
virtual const volScalarField& he() const
{
NotImplemented;
return volScalarField::null();
}
//- Enthalpy/Internal energy
// for given pressure and temperature [J/kg]
virtual tmp<volScalarField> he
(
const volScalarField& p,
const volScalarField& T
) const;
//- Enthalpy/Internal energy for cell-set [J/kg]
virtual tmp<scalarField> he
(
const scalarField& p,
const scalarField& T,
const labelList& cells
) const;
//- Enthalpy/Internal energy for patch [J/kg]
virtual tmp<scalarField> he
(
const scalarField& p,
const scalarField& T,
const label patchi
) const;
//- Chemical enthalpy of the mixture [J/kg]
virtual tmp<volScalarField> hc() const;
//- Temperature from enthalpy/internal energy for cell-set
virtual tmp<scalarField> THE
(
const scalarField& h,
const scalarField& p,
const scalarField& T0,
const labelList& cells
) const;
//- Temperature from enthalpy/internal energy for patch
virtual tmp<scalarField> THE
(
const scalarField& h,
const scalarField& p,
const scalarField& T0,
const label patchi
) const;
// Thermo
//- Return the mixture density
virtual tmp<volScalarField> rho() const;
//- Return the mixture density on a patch
virtual tmp<scalarField> rho(const label patchi) const;
//- Return Cp of the mixture
virtual tmp<volScalarField> Cp() const;
//- Heat capacity at constant pressure for patch [J/kg/K]
virtual tmp<scalarField> Cp
(
const scalarField& p,
const scalarField& T,
const label patchi
) const;
//- Return Cv of the mixture
virtual tmp<volScalarField> Cv() const;
//- Heat capacity at constant volume for patch [J/kg/K]
virtual tmp<scalarField> Cv
(
const scalarField& p,
const scalarField& T,
const label patchI
) const;
//- Gamma = Cp/Cv []
virtual tmp<volScalarField> gamma() const;
//- Gamma = Cp/Cv for patch []
virtual tmp<scalarField> gamma
(
const scalarField& p,
const scalarField& T,
const label patchi
) const;
//- Heat capacity at constant pressure/volume [J/kg/K]
virtual tmp<volScalarField> Cpv() const;
//- Heat capacity at constant pressure/volume for patch [J/kg/K]
virtual tmp<scalarField> Cpv
(
const scalarField& p,
const scalarField& T,
const label patchi
) const;
//- Heat capacity ratio []
virtual tmp<volScalarField> CpByCpv() const;
//- Heat capacity ratio for patch []
virtual tmp<scalarField> CpByCpv
(
const scalarField& p,
const scalarField& T,
const label patchi
) const;
//- Molecular weight [kg/kmol] of the mixture
virtual tmp<volScalarField> W() const;
// Transport
//- Thermal diffusivity for temperature of mixture [J/m/s/K]
virtual tmp<volScalarField> kappa() const;
//- Thermal diffusivity for temperature
// of mixture for patch [J/m/s/K]
virtual tmp<scalarField> kappa
(
const label patchi
) const;
//- Thermal diffusivity for energy of mixture [kg/m/s]
virtual tmp<volScalarField> alphahe() const;
//- Thermal diffusivity for energy of mixture for patch [kg/m/s]
virtual tmp<scalarField> alphahe(const label patchi) const;
//- Effective thermal diffusivity for temperature
// of mixture [J/m/s/K]
virtual tmp<volScalarField> kappaEff
(
const volScalarField& kappat
) const;
//- Effective thermal diffusivity for temperature
// of mixture for patch [J/m/s/K]
virtual tmp<scalarField> kappaEff
(
const scalarField& alphat,
const label patchi
) const;
//- Effective thermal diffusivity of mixture [kg/m/s]
virtual tmp<volScalarField> alphaEff
(
const volScalarField& alphat
) const;
//- Effective thermal diffusivity of mixture for patch [kg/m/s]
virtual tmp<scalarField> alphaEff
(
const scalarField& alphat,
const label patchi
) const;
//- Return Prandt number
const dimensionedScalar& Prt() const;
// Access to transport state variables
//- Dynamic viscosity of mixture [kg/m/s]
virtual tmp<volScalarField> mu() const;
//- Dynamic viscosity of mixture for patch [kg/m/s]
virtual tmp<scalarField> mu(const label patchi) const;
//- Kinematic viscosity of mixture [m^2/s]
virtual tmp<volScalarField> nu() const;
//- Kinematic viscosity of mixture for patch [m^2/s]
virtual tmp<scalarField> nu(const label patchi) const;
// Phase fluxes
//- Constant access to the total flux
const surfaceScalarField& phi() const;
//- Access to the total mixture flux
surfaceScalarField& phi();
//- Constant access to the mixture mass flux
const surfaceScalarField& rhoPhi() const;
//- Access to the total mixture mass flux
surfaceScalarField& rhoPhi();
//- Mixture U
tmp<volVectorField> U() const;
// Surface tension
//- Calculate surface tension of the mixture
tmp<surfaceScalarField> surfaceTensionForce() const;
//- Return the surface tension coefficient
virtual tmp<volScalarField> surfaceTensionCoeff
(
const phasePairKey& key
) const;
//- Return coefficients (1/rho)
virtual tmp<volScalarField> coeffs(const word& key) const;
// Interface porous between solid/fluid phases
//- Add interface porosity on phasePair
void addInterfacePorosity(fvVectorMatrix& UEqn);
// Inter-Phase mass and heat transfe
//- Return interfacial source mass rate per phase pair
virtual tmp<volScalarField> dmdt(const phasePairKey& key) const = 0;
//- Return the heat transfer matrices
virtual tmp<fvScalarMatrix> heatTransfer
(
const volScalarField& T
) = 0;
//- Return the volumetric rate transfer matrix
virtual tmp<fvScalarMatrix> volTransfer
(
const volScalarField& p
) = 0;
//- Calculate mass transfer for alpha's
virtual void alphaTransfer(SuSpTable& Su, SuSpTable& Sp) = 0;
//- Calculate mass transfer for species
virtual void massSpeciesTransfer
(
const phaseModel& phase,
volScalarField::Internal& Su,
volScalarField::Internal& Sp,
const word speciesName
) = 0;
//- Add volume change in pEq
virtual bool includeVolChange() = 0;
// Solve phases and correct models
//- Solve for the phase transport equations
virtual void solve() = 0;
//- Correct the mixture thermos
virtual void correct();
//- Correct mass sources
virtual void correctMassSources(const volScalarField& T) = 0;
//- Return the name of the thermo physics
virtual word thermoName() const
{
NotImplemented;
return word();
}
//- Correct the turbulence
// \note Each phase could have its own turbulence
virtual void correctTurbulence();
//- Read base phaseProperties dictionary
virtual bool read();
// Access to phases models
//- Constant access the total phase pairs
const phasePairTable& totalPhasePairs() const;
//- Non-constant access the total phase pairs
phasePairTable& totalPhasePairs();
//- Constant access the phases
const phaseModelTable& phases() const;
//- Access the phases
phaseModelTable& phases();
//- Access a sub model between a phase pair
template <class modelType>
const modelType& lookupSubModel(const phasePair& key) const;
//- Access a sub model between two phases
template <class modelType>
const modelType& lookupSubModel
(
const phaseModel& from,
const phaseModel& to
) const;
// Query phase thermo information
//- Return true if the equation of state is incompressible for all
// phases
virtual bool incompressible() const;
//- Return true if a phase is incompressible
virtual bool incompressible(const word) const;
//- Return true if the equation of state is isochoric for all phasses
// i.e. rho = const
virtual bool isochoric() const;
//- Return mesh
const fvMesh& mesh() const;
// Help functions for the interfaces
//- Interface normal surface vector
tmp<surfaceVectorField> nHatfv
(
const volScalarField& alpha1,
const volScalarField& alpha2
) const;
//- Interface normal volume vector
tmp<surfaceScalarField> nHatf
(
const volScalarField& alpha1,
const volScalarField& alpha2
) const;
//- Interface curvature
tmp<volScalarField> K
(
const volScalarField& alpha1,
const volScalarField& alpha2
) const;
//- Near Interface of alpha1 and alpha2
tmp<volScalarField> nearInterface
(
const volScalarField& alpha1,
const volScalarField& alpha2
) const;
//- Near Interface of alpha'n
tmp<volScalarField> nearInterface() const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "phaseSystemTemplates.H"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,200 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017 OpenCFD Ltd.
-------------------------------------------------------------------------------
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/>.
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
template<class modelType>
void Foam::phaseSystem::createSubModels
(
const dictTable& modelDicts,
HashTable
<
autoPtr<modelType>,
phasePairKey,
phasePairKey::hash
>& models
)
{
forAllConstIters(modelDicts, iter)
{
const phasePairKey& key = iter.key();
models.insert
(
key,
modelType::New
(
iter.val(),
phasePairs_[key]
)
);
}
}
template<class modelType>
void Foam::phaseSystem::createSubModels
(
const dictTable& modelDicts,
const fvMesh& mesh,
HashTable
<
autoPtr<modelType>,
phasePairKey,
phasePairKey::hash
>& models
)
{
forAllConstIters(modelDicts, iter)
{
const phasePairKey& key = iter.key();
models.insert
(
key,
modelType::New
(
iter.val(),
mesh
)
);
}
}
template<class modelType>
void Foam::phaseSystem::generatePairsAndSubModels
(
const word& modelName,
HashTable
<
autoPtr<modelType>,
phasePairKey,
phasePairKey::hash
>& models
)
{
dictTable modelDicts(lookup(modelName));
generatePairs(modelDicts);
createSubModels(modelDicts, models);
}
template<class modelType>
void Foam::phaseSystem::generatePairsAndSubModels
(
const word& modelName,
const fvMesh& mesh,
HashTable
<
autoPtr<modelType>,
phasePairKey,
phasePairKey::hash
>& models
)
{
dictTable modelDicts(lookup(modelName));
generatePairs(modelDicts);
createSubModels(modelDicts, mesh, models);
}
template<class modelType>
void Foam::phaseSystem::generatePairsAndSubModels
(
const word& modelName,
HashTable
<
HashTable<autoPtr<modelType>>,
phasePairKey,
phasePairKey::hash
>& models
)
{
typedef
HashTable<autoPtr<modelType>, phasePairKey, phasePairKey::hash>
modelTypeTable;
for (const word& phaseName : phaseNames_)
{
modelTypeTable tempModels;
generatePairsAndSubModels
(
IOobject::groupName(modelName, phaseName),
tempModels
);
forAllConstIters(tempModels, tempModelIter)
{
const phasePairKey& key = tempModelIter.key();
if (!models.found(key))
{
models.insert
(
key,
HashTable<autoPtr<modelType>>()
);
}
models[key].insert
(
phaseName,
*tempModelIter
);
}
}
}
template <class modelType>
const modelType& Foam::phaseSystem::lookupSubModel(const phasePair& key) const
{
return
mesh().lookupObject<modelType>
(
IOobject::groupName(modelType::typeName, key.name())
);
}
template <class modelType>
const modelType& Foam::phaseSystem::lookupSubModel
(
const phaseModel& from,
const phaseModel& to
) const
{
return lookupSubModel<modelType>(orderedPhasePair(from, to));
}
// ************************************************************************* //

View File

@ -1,5 +1,6 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
#------------------------------------------------------------------------------
wclean libso temperaturePhaseChangeTwoPhaseMixtures
wclean

View File

@ -1,7 +1,6 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/wmake/scripts/AllwmakeParseArguments
#------------------------------------------------------------------------------
wmake $targetType temperaturePhaseChangeTwoPhaseMixtures

View File

@ -1,5 +1,5 @@
temperaturePhaseChangeTwoPhaseMixtures/newtemperaturePhaseChangeTwoPhaseMixture.C
temperaturePhaseChangeTwoPhaseMixtures/temperaturePhaseChangeTwoPhaseMixture.C
temperaturePhaseChangeTwoPhaseMixtures/temperaturePhaseChangeTwoPhaseMixtureNew.C
thermoIncompressibleTwoPhaseMixture/thermoIncompressibleTwoPhaseMixture.C
twoPhaseMixtureEThermo/twoPhaseMixtureEThermo.C
constant/constant.C

View File

@ -1,5 +1,6 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
#------------------------------------------------------------------------------
wclean libso phaseChangeTwoPhaseMixtures
wclean

View File

@ -1,7 +1,6 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/wmake/scripts/AllwmakeParseArguments
#------------------------------------------------------------------------------
wmake $targetType phaseChangeTwoPhaseMixtures

View File

@ -1,5 +1,5 @@
phaseChangeTwoPhaseMixture/phaseChangeTwoPhaseMixture.C
phaseChangeTwoPhaseMixture/newPhaseChangeTwoPhaseMixture.C
phaseChangeTwoPhaseMixture/phaseChangeTwoPhaseMixtureNew.C
Kunz/Kunz.C
Merkle/Merkle.C
SchnerrSauer/SchnerrSauer.C

View File

@ -1,8 +0,0 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
wclean libso multiphaseSystem
wclean libso interfacialModels
wclean
#------------------------------------------------------------------------------

View File

@ -1,12 +0,0 @@
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/wmake/scripts/AllwmakeParseArguments
#------------------------------------------------------------------------------
wmakeLnInclude interfacialModels
wmake $targetType multiphaseSystem
wmake $targetType interfacialModels
wmake $targetType
#------------------------------------------------------------------------------

View File

@ -1,7 +1,8 @@
phaseSystem = $(LIB_SRC)/phaseSystemModels/multiphaseEuler
EXE_INC = \
-ImultiphaseSystem/lnInclude \
-ImultiphaseFixedFluxPressure \
-IinterfacialModels/lnInclude \
-I${phaseSystem}/multiphaseSystem/lnInclude \
-I${phaseSystem}/interfacialModels/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/transportModels \
@ -16,9 +17,9 @@ EXE_LIBS = \
-lfiniteVolume \
-lfvOptions \
-lmeshTools \
-lmultiphaseSystem \
-linterfaceProperties \
-lincompressibleTransportModels \
-lcompressibleMultiphaseEulerianInterfacialModels \
-lturbulenceModels \
-lincompressibleTurbulenceModels
-lincompressibleTurbulenceModels \
-lmultiphaseSystem \
-lcompressibleMultiphaseEulerianInterfacialModels

View File

@ -1,17 +0,0 @@
dragModels/dragModel/dragModel.C
dragModels/dragModel/newDragModel.C
dragModels/Ergun/Ergun.C
dragModels/GidaspowErgunWenYu/GidaspowErgunWenYu.C
dragModels/GidaspowSchillerNaumann/GidaspowSchillerNaumann.C
dragModels/SchillerNaumann/SchillerNaumann.C
dragModels/Gibilaro/Gibilaro.C
dragModels/WenYu/WenYu.C
dragModels/SyamlalOBrien/SyamlalOBrien.C
dragModels/blended/blended.C
dragModels/interface/interface.C
heatTransferModels/heatTransferModel/heatTransferModel.C
heatTransferModels/heatTransferModel/newHeatTransferModel.C
heatTransferModels/RanzMarshall/RanzMarshall.C
LIB = $(FOAM_LIBBIN)/libcompressibleMultiphaseEulerianInterfacialModels

View File

@ -1,7 +0,0 @@
EXE_INC = \
-I../multiphaseSystem/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude
LIB_LIBS = \
-lfiniteVolume \
-lmultiphaseSystem

View File

@ -1,84 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2012 OpenFOAM Foundation
-------------------------------------------------------------------------------
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 "Ergun.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace dragModels
{
defineTypeNameAndDebug(Ergun, 0);
addToRunTimeSelectionTable
(
dragModel,
Ergun,
dictionary
);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::dragModels::Ergun::Ergun
(
const dictionary& interfaceDict,
const phaseModel& phase1,
const phaseModel& phase2
)
:
dragModel(interfaceDict, phase1, phase2)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::dragModels::Ergun::~Ergun()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::tmp<Foam::volScalarField> Foam::dragModels::Ergun::K
(
const volScalarField& Ur
) const
{
volScalarField alpha2(max(phase2_, scalar(1.0e-6)));
return
150.0*phase1_*phase2_.nu()*phase2_.rho()
/sqr(alpha2*phase1_.d())
+ 1.75*phase2_.rho()*Ur/(alpha2*phase1_.d());
}
// ************************************************************************* //

View File

@ -1,97 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
-------------------------------------------------------------------------------
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::dragModels::Ergun
Description
H, Enwald, E. Peirano, A-E Almstedt
'Eulerian Two-Phase Flow Theory Applied to Fluidization'
Int. J. Multiphase Flow, Vol. 22, Suppl, pp. 21-66 (1996)
Eq. 104, p. 42
SourceFiles
Ergun.C
\*---------------------------------------------------------------------------*/
#ifndef Ergun_H
#define Ergun_H
#include "dragModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace dragModels
{
/*---------------------------------------------------------------------------*\
Class Ergun Declaration
\*---------------------------------------------------------------------------*/
class Ergun
:
public dragModel
{
public:
//- Runtime type information
TypeName("Ergun");
// Constructors
//- Construct from components
Ergun
(
const dictionary& interfaceDict,
const phaseModel& phase1,
const phaseModel& phase2
);
//- Destructor
virtual ~Ergun();
// Member Functions
tmp<volScalarField> K(const volScalarField& Ur) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace dragModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,83 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2012 OpenFOAM Foundation
-------------------------------------------------------------------------------
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 "Gibilaro.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace dragModels
{
defineTypeNameAndDebug(Gibilaro, 0);
addToRunTimeSelectionTable
(
dragModel,
Gibilaro,
dictionary
);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::dragModels::Gibilaro::Gibilaro
(
const dictionary& interfaceDict,
const phaseModel& phase1,
const phaseModel& phase2
)
:
dragModel(interfaceDict, phase1, phase2)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::dragModels::Gibilaro::~Gibilaro()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::tmp<Foam::volScalarField> Foam::dragModels::Gibilaro::K
(
const volScalarField& Ur
) const
{
volScalarField alpha2(max(phase2_, scalar(1.0e-6)));
volScalarField bp(pow(alpha2, -2.8));
volScalarField Re(max(alpha2*Ur*phase1_.d()/phase2_.nu(), scalar(1.0e-3)));
return (17.3/Re + scalar(0.336))*phase2_.rho()*Ur*bp/phase1_.d();
}
// ************************************************************************* //

View File

@ -1,97 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
-------------------------------------------------------------------------------
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::dragModels::Gibilaro
Description
H, Enwald, E. Peirano, A-E Almstedt
'Eulerian Two-Phase Flow Theory Applied to Fluidization'
Int. J. Multiphase Flow, Vol. 22, Suppl, pp. 21-66 (1996)
Eq. 106, p. 43
SourceFiles
Gibilaro.C
\*---------------------------------------------------------------------------*/
#ifndef Gibilaro_H
#define Gibilaro_H
#include "dragModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace dragModels
{
/*---------------------------------------------------------------------------*\
Class Gibilaro Declaration
\*---------------------------------------------------------------------------*/
class Gibilaro
:
public dragModel
{
public:
//- Runtime type information
TypeName("Gibilaro");
// Constructors
//- Construct from components
Gibilaro
(
const dictionary& interfaceDict,
const phaseModel& phase1,
const phaseModel& phase2
);
//- Destructor
virtual ~Gibilaro();
// Member Functions
tmp<volScalarField> K(const volScalarField& Ur) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace dragModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,100 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
-------------------------------------------------------------------------------
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 "GidaspowErgunWenYu.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace dragModels
{
defineTypeNameAndDebug(GidaspowErgunWenYu, 0);
addToRunTimeSelectionTable
(
dragModel,
GidaspowErgunWenYu,
dictionary
);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::dragModels::GidaspowErgunWenYu::GidaspowErgunWenYu
(
const dictionary& interfaceDict,
const phaseModel& phase1,
const phaseModel& phase2
)
:
dragModel(interfaceDict, phase1, phase2)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::dragModels::GidaspowErgunWenYu::~GidaspowErgunWenYu()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::tmp<Foam::volScalarField> Foam::dragModels::GidaspowErgunWenYu::K
(
const volScalarField& Ur
) const
{
volScalarField alpha2(max(phase2_, scalar(1.0e-6)));
volScalarField d(phase1_.d());
volScalarField bp(pow(alpha2, -2.65));
volScalarField Re(max(Ur*d/phase2_.nu(), scalar(1.0e-3)));
volScalarField Cds
(
neg(Re - 1000)*(24.0*(1.0 + 0.15*pow(Re, 0.687))/Re)
+ pos0(Re - 1000)*0.44
);
// Wen and Yu (1966)
return
(
pos0(alpha2 - 0.8)
*(0.75*Cds*phase2_.rho()*Ur*bp/d)
+ neg(alpha2 - 0.8)
*(
150.0*phase1_*phase2_.nu()*phase2_.rho()/(sqr(alpha2*d))
+ 1.75*phase2_.rho()*Ur/(alpha2*d)
)
);
}
// ************************************************************************* //

View File

@ -1,95 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011 OpenFOAM Foundation
-------------------------------------------------------------------------------
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::dragModels::GidaspowErgunWenYu
Description
D. Gidaspow, Multiphase flow and fluidization,
Academic Press, New York, 1994.
SourceFiles
GidaspowErgunWenYu.C
\*---------------------------------------------------------------------------*/
#ifndef GidaspowErgunWenYu_H
#define GidaspowErgunWenYu_H
#include "dragModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace dragModels
{
/*---------------------------------------------------------------------------*\
Class GidaspowErgunWenYu Declaration
\*---------------------------------------------------------------------------*/
class GidaspowErgunWenYu
:
public dragModel
{
public:
//- Runtime type information
TypeName("GidaspowErgunWenYu");
// Constructors
//- Construct from components
GidaspowErgunWenYu
(
const dictionary& interfaceDict,
const phaseModel& phase1,
const phaseModel& phase2
);
//- Destructor
virtual ~GidaspowErgunWenYu();
// Member Functions
tmp<volScalarField> K(const volScalarField& Ur) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace dragModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

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