Commit ea17556c authored by shunbo's avatar shunbo
Browse files

Initial commit

parents
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 "liquidPropertiesSurfaceTension.H"
#include "liquidThermo.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace surfaceTensionModels
{
defineTypeNameAndDebug(liquidProperties, 0);
addToRunTimeSelectionTable
(
surfaceTensionModel,
liquidProperties,
dictionary
);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::surfaceTensionModels::liquidProperties::liquidProperties
(
const dictionary& dict,
const fvMesh& mesh
)
:
surfaceTensionModel(mesh),
phaseName_(dict.get<word>("phase"))
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::tmp<Foam::volScalarField>
Foam::surfaceTensionModels::liquidProperties::sigma() const
{
const heRhoThermopureMixtureliquidProperties& thermo =
mesh_.lookupObject<heRhoThermopureMixtureliquidProperties>
(
IOobject::groupName(basicThermo::dictName, phaseName_)
);
const Foam::liquidProperties& liquid = thermo.mixture().properties();
tmp<volScalarField> tsigma
(
new volScalarField
(
IOobject
(
"sigma",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE,
false
),
mesh_,
dimSigma
)
);
volScalarField& sigma = tsigma.ref();
const volScalarField& T = thermo.T();
const volScalarField& p = thermo.p();
volScalarField::Internal& sigmai = sigma;
const volScalarField::Internal& pi = p;
const volScalarField::Internal& Ti = T;
forAll(sigmai, celli)
{
sigmai[celli] = liquid.sigma(pi[celli], Ti[celli]);
}
volScalarField::Boundary& sigmaBf = sigma.boundaryFieldRef();
const volScalarField::Boundary& pBf = p.boundaryField();
const volScalarField::Boundary& TBf = T.boundaryField();
forAll(sigmaBf, patchi)
{
scalarField& sigmaPf = sigmaBf[patchi];
const scalarField& pPf = pBf[patchi];
const scalarField& TPf = TBf[patchi];
forAll(sigmaPf, facei)
{
sigmaPf[facei] = liquid.sigma(pPf[facei], TPf[facei]);
}
}
return tsigma;
}
bool Foam::surfaceTensionModels::liquidProperties::readDict
(
const dictionary& dict
)
{
return true;
}
bool Foam::surfaceTensionModels::liquidProperties::writeData
(
Ostream& os
) const
{
if (surfaceTensionModel::writeData(os))
{
return os.good();
}
return false;
}
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 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/>.
Class
Foam::surfaceTensionModels::liquidProperties
Description
Temperature-dependent surface tension model in which the surface tension
function provided by the phase Foam::liquidProperties class is used.
Usage
\table
Property | Description | Required | Default value
phase | Phase name | yes |
\endtable
Example of the surface tension specification:
\verbatim
sigma
{
type liquidProperties;
phase water;
}
\endverbatim
See also
Foam::surfaceTensionModel
SourceFiles
liquidPropertiesSurfaceTension.C
\*---------------------------------------------------------------------------*/
#ifndef liquidPropertiesSurfaceTension_H
#define liquidPropertiesSurfaceTension_H
#include "surfaceTensionModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace surfaceTensionModels
{
/*---------------------------------------------------------------------------*\
Class liquidProperties Declaration
\*---------------------------------------------------------------------------*/
class liquidProperties
:
public surfaceTensionModel
{
// Private data
//- Name of the liquid phase
word phaseName_;
public:
//- Runtime type information
TypeName("liquidProperties");
// Constructors
//- Construct from dictionary and mesh
liquidProperties
(
const dictionary& dict,
const fvMesh& mesh
);
//- Destructor
virtual ~liquidProperties() = default;
// Member Functions
//- Surface tension coefficient
virtual tmp<volScalarField> sigma() const;
//- Update surface tension coefficient from given dictionary
virtual bool readDict(const dictionary& dict);
//- Write in dictionary format
virtual bool writeData(Ostream& os) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace surfaceTensionModels
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
twoPhaseMixtureThermo.C
LIB = $(FOAM_LIBBIN)/libtwoPhaseMixtureThermo
EXE_INC = \
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \
-I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude
LIB_LIBS = \
-lcompressibleTransportModels \
-lfluidThermophysicalModels \
-lspecie \
-ltwoPhaseMixture \
-linterfaceProperties \
-lfiniteVolume
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2013-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 "twoPhaseMixtureThermo.H"
#include "gradientEnergyFvPatchScalarField.H"
#include "mixedEnergyFvPatchScalarField.H"
#include "collatedFileOperation.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(twoPhaseMixtureThermo, 0);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::twoPhaseMixtureThermo::twoPhaseMixtureThermo
(
const volVectorField& U,
const surfaceScalarField& phi
)
:
psiThermo(U.mesh(), word::null),
twoPhaseMixture(U.mesh(), *this),
interfaceProperties(alpha1(), U, *this),
thermo1_(nullptr),
thermo2_(nullptr)
{
{
volScalarField T1(IOobject::groupName("T", phase1Name()), T_);
T1.write();
}
{
volScalarField T2(IOobject::groupName("T", phase2Name()), T_);
T2.write();
}
// Note: we're writing files to be read in immediately afterwards.
// Avoid any thread-writing problems.
fileHandler().flush();
thermo1_ = rhoThermo::New(U.mesh(), phase1Name());
thermo2_ = rhoThermo::New(U.mesh(), phase2Name());
// thermo1_->validate(phase1Name(), "e");
// thermo2_->validate(phase2Name(), "e");
correct();
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::twoPhaseMixtureThermo::~twoPhaseMixtureThermo()
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
void Foam::twoPhaseMixtureThermo::correctThermo()
{
thermo1_->he() = thermo1_->he(p_, T_);
thermo1_->correct();
thermo2_->he() = thermo2_->he(p_, T_);
thermo2_->correct();
}
void Foam::twoPhaseMixtureThermo::correct()
{
psi_ = alpha1()*thermo1_->psi() + alpha2()*thermo2_->psi();
mu_ = alpha1()*thermo1_->mu() + alpha2()*thermo2_->mu();
alpha_ = alpha1()*thermo1_->alpha() + alpha2()*thermo2_->alpha();
interfaceProperties::correct();
}
Foam::word Foam::twoPhaseMixtureThermo::thermoName() const
{
return thermo1_->thermoName() + ',' + thermo2_->thermoName();
}
bool Foam::twoPhaseMixtureThermo::incompressible() const
{
return thermo1_->incompressible() && thermo2_->incompressible();
}
bool Foam::twoPhaseMixtureThermo::isochoric() const
{
return thermo1_->isochoric() && thermo2_->isochoric();
}
Foam::tmp<Foam::volScalarField> Foam::twoPhaseMixtureThermo::he
(
const volScalarField& p,
const volScalarField& T
) const
{
return alpha1()*thermo1_->he(p, T) + alpha2()*thermo2_->he(p, T);
}
Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureThermo::he
(
const scalarField& p,
const scalarField& T,
const labelList& cells
) const
{
return
scalarField(alpha1(), cells)*thermo1_->he(p, T, cells)
+ scalarField(alpha2(), cells)*thermo2_->he(p, T, cells);
}
Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureThermo::he
(
const scalarField& p,
const scalarField& T,
const label patchi
) const
{
return
alpha1().boundaryField()[patchi]*thermo1_->he(p, T, patchi)
+ alpha2().boundaryField()[patchi]*thermo2_->he(p, T, patchi);
}
Foam::tmp<Foam::volScalarField> Foam::twoPhaseMixtureThermo::hc() const
{
return alpha1()*thermo1_->hc() + alpha2()*thermo2_->hc();
}
Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureThermo::THE
(
const scalarField& h,
const scalarField& p,
const scalarField& T0,
const labelList& cells
) const
{
NotImplemented;
return T0;
}
Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureThermo::THE
(
const scalarField& h,
const scalarField& p,
const scalarField& T0,
const label patchi
) const
{
NotImplemented;
return T0;
}
Foam::tmp<Foam::volScalarField> Foam::twoPhaseMixtureThermo::Cp() const
{
return alpha1()*thermo1_->Cp() + alpha2()*thermo2_->Cp();
}
Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureThermo::Cp
(
const scalarField& p,
const scalarField& T,
const label patchi
) const
{
return
alpha1().boundaryField()[patchi]*thermo1_->Cp(p, T, patchi)
+ alpha2().boundaryField()[patchi]*thermo2_->Cp(p, T, patchi);
}
Foam::tmp<Foam::volScalarField> Foam::twoPhaseMixtureThermo::Cv() const
{
return alpha1()*thermo1_->Cv() + alpha2()*thermo2_->Cv();
}
Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureThermo::Cv
(
const scalarField& p,
const scalarField& T,
const label patchi
) const
{
return
alpha1().boundaryField()[patchi]*thermo1_->Cv(p, T, patchi)
+ alpha2().boundaryField()[patchi]*thermo2_->Cv(p, T, patchi);
}
Foam::tmp<Foam::volScalarField> Foam::twoPhaseMixtureThermo::gamma() const
{
return alpha1()*thermo1_->gamma() + alpha2()*thermo2_->gamma();
}
Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureThermo::gamma
(
const scalarField& p,
const scalarField& T,
const label patchi
) const
{
return
alpha1().boundaryField()[patchi]*thermo1_->gamma(p, T, patchi)
+ alpha2().boundaryField()[patchi]*thermo2_->gamma(p, T, patchi);
}
Foam::tmp<Foam::volScalarField> Foam::twoPhaseMixtureThermo::Cpv() const
{
return alpha1()*thermo1_->Cpv() + alpha2()*thermo2_->Cpv();
}
Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureThermo::Cpv
(
const scalarField& p,
const scalarField& T,
const label patchi
) const
{
return
alpha1().boundaryField()[patchi]*thermo1_->Cpv(p, T, patchi)
+ alpha2().boundaryField()[patchi]*thermo2_->Cpv(p, T, patchi);
}
Foam::tmp<Foam::volScalarField> Foam::twoPhaseMixtureThermo::CpByCpv() const
{
return
alpha1()*thermo1_->CpByCpv()
+ alpha2()*thermo2_->CpByCpv();
}
Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureThermo::CpByCpv
(
const scalarField& p,
const scalarField& T,
const label patchi
) const
{
return
alpha1().boundaryField()[patchi]*thermo1_->CpByCpv(p, T, patchi)
+ alpha2().boundaryField()[patchi]*thermo2_->CpByCpv(p, T, patchi);
}
Foam::tmp<Foam::volScalarField> Foam::twoPhaseMixtureThermo::W() const
{
return alpha1()*thermo1_->W() + alpha2()*thermo1_->W();
}
Foam::tmp<Foam::volScalarField> Foam::twoPhaseMixtureThermo::nu() const
{
return mu()/(alpha1()*thermo1_->rho() + alpha2()*thermo2_->rho());
}
Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureThermo::nu
(
const label patchi
) const
{
return
mu(patchi)
/(
alpha1().boundaryField()[patchi]*thermo1_->rho(patchi)
+ alpha2().boundaryField()[patchi]*thermo2_->rho(patchi)
);
}
Foam::tmp<Foam::volScalarField> Foam::twoPhaseMixtureThermo::kappa() const
{
return alpha1()*thermo1_->kappa() + alpha2()*thermo2_->kappa();
}
Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureThermo::kappa
(
const label patchi
) const
{
return
alpha1().boundaryField()[patchi]*thermo1_->kappa(patchi)
+ alpha2().boundaryField()[patchi]*thermo2_->kappa(patchi);
}
Foam::tmp<Foam::volScalarField> Foam::twoPhaseMixtureThermo::alphahe() const
{
return
alpha1()*thermo1_->alphahe()
+ alpha2()*thermo2_->alphahe();
}
Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureThermo::alphahe
(
const label patchi
) const
{
return
alpha1().boundaryField()[patchi]*thermo1_->alphahe(patchi)
+ alpha2().boundaryField()[patchi]*thermo2_->alphahe(patchi);
}
Foam::tmp<Foam::volScalarField> Foam::twoPhaseMixtureThermo::kappaEff
(
const volScalarField& alphat
) const
{
return
alpha1()*thermo1_->kappaEff(alphat)
+ alpha2()*thermo2_->kappaEff(alphat);
}
Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureThermo::kappaEff
(
const scalarField& alphat,
const label patchi
) const
{
return
alpha1().boundaryField()[patchi]*thermo1_->kappaEff(alphat, patchi)
+ alpha2().boundaryField()[patchi]*thermo2_->kappaEff(alphat, patchi);
}
Foam::tmp<Foam::volScalarField> Foam::twoPhaseMixtureThermo::alphaEff
(
const volScalarField& alphat
) const
{
return
alpha1()*thermo1_->alphaEff(alphat)
+ alpha2()*thermo2_->alphaEff(alphat);
}
Foam::tmp<Foam::scalarField> Foam::twoPhaseMixtureThermo::alphaEff
(
const scalarField& alphat,
const label patchi
) const
{
return
alpha1().boundaryField()[patchi]*thermo1_->alphaEff(alphat, patchi)
+ alpha2().boundaryField()[patchi]*thermo2_->alphaEff(alphat, patchi);
}
bool Foam::twoPhaseMixtureThermo::read()
{
if (psiThermo::read())
{
return interfaceProperties::read();
}
return false;
}
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2013-2017 OpenFOAM Foundation
Copyright (C) 2021 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::twoPhaseMixtureThermo
Description
SourceFiles
twoPhaseMixtureThermoI.H
twoPhaseMixtureThermo.C
twoPhaseMixtureThermoIO.C
\*---------------------------------------------------------------------------*/
#ifndef twoPhaseMixtureThermo_H
#define twoPhaseMixtureThermo_H
#include "rhoThermo.H"
#include "psiThermo.H"
#include "twoPhaseMixture.H"
#include "interfaceProperties.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class twoPhaseMixtureThermo Declaration
\*---------------------------------------------------------------------------*/
class twoPhaseMixtureThermo
:
public psiThermo,
public twoPhaseMixture,
public interfaceProperties
{
// Private data
//- Thermo-package of phase 1
autoPtr<rhoThermo> thermo1_;
//- Thermo-package of phase 2
autoPtr<rhoThermo> thermo2_;
public:
//- Runtime type information
TypeName("twoPhaseMixtureThermo");
// Constructors
//- Construct from components
twoPhaseMixtureThermo
(
const volVectorField& U,
const surfaceScalarField& phi
);
//- Destructor
virtual ~twoPhaseMixtureThermo();
// Member Functions
const rhoThermo& thermo1() const
{
return *thermo1_;
}
const rhoThermo& thermo2() const
{
return *thermo2_;
}
rhoThermo& thermo1()
{
return *thermo1_;
}
rhoThermo& thermo2()
{
return *thermo2_;
}
//- Correct the thermodynamics of each phase
virtual void correctThermo();
//- Update mixture properties
virtual void correct();
//- Return the name of the thermo physics
virtual word thermoName() const;
//- Return true if the equation of state is incompressible
// i.e. rho != f(p)
virtual bool incompressible() const;
//- Return true if the equation of state is isochoric
// i.e. rho = const
virtual bool isochoric() const;
// Access to thermodynamic state variables
//- Enthalpy/Internal energy [J/kg]
// Non-const access allowed for transport equations
virtual volScalarField& he()
{
NotImplemented;
return thermo1_->he();
}
//- Enthalpy/Internal energy [J/kg]
virtual const volScalarField& he() const
{
NotImplemented;
return thermo1_->he();
}
//- 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 [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, // starting temperature
const labelList& cells
) const;
//- Temperature from enthalpy/internal energy for patch
virtual tmp<scalarField> THE
(
const scalarField& h,
const scalarField& p,
const scalarField& T0, // starting temperature
const label patchi
) const;
// Fields derived from thermodynamic state variables
//- Heat capacity at constant pressure [J/kg/K]
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;
//- Heat capacity using pressure and temperature
virtual tmp<scalarField> Cp
(
const scalarField& p,
const scalarField& T,
const labelList& cells
) const
{
NotImplemented;
return tmp<scalarField>::New(p);
}
//- Heat capacity at constant volume [J/kg/K]
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;
//- Density from pressure and temperature
virtual tmp<scalarField> rhoEoS
(
const scalarField& p,
const scalarField& T,
const labelList& cells
) const
{
NotImplemented;
return tmp<scalarField>::New(p);
}
//- 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]
virtual tmp<volScalarField> W() const;
// Fields derived from transport state variables
//- 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;
//- Thermal diffusivity for temperature of mixture [J/m/s/K]
virtual tmp<volScalarField> kappa() const;
//- Thermal diffusivity 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 of mixture [J/m/s/K]
virtual tmp<volScalarField> kappaEff
(
const volScalarField& alphat
) const;
//- Effective thermal diffusivity of mixture for patch [J/m/s/K]
virtual tmp<scalarField> kappaEff
(
const scalarField& alphat,
const label patchi
) const;
//- Effective thermal diffusivity of mixture [J/m/s/K]
virtual tmp<volScalarField> alphaEff
(
const volScalarField& alphat
) const;
//- Effective thermal diffusivity of mixture for patch [J/m/s/K]
virtual tmp<scalarField> alphaEff
(
const scalarField& alphat,
const label patchi
) const;
// IO
//- Read base transportProperties dictionary
virtual bool read();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
#------------------------------------------------------------------------------
wclean libso multiphaseMixtureThermo
wclean
#------------------------------------------------------------------------------
#!/bin/sh
cd "${0%/*}" || exit # Run from this directory
. ${WM_PROJECT_DIR:?}/wmake/scripts/AllwmakeParseArguments
#------------------------------------------------------------------------------
wmake $targetType multiphaseMixtureThermo
wmake $targetType
#------------------------------------------------------------------------------
compressibleMultiphaseInterFoam.C
EXE = $(FOAM_APPBIN)/compressibleMultiphaseInterFoam
EXE_INC = \
-I../VoF \
-I../interFoam \
-ImultiphaseMixtureThermo/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/transportModels/twoPhaseMixture/lnInclude \
-I$(LIB_SRC)/transportModels/interfaceProperties/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude
EXE_LIBS = \
-lfiniteVolume \
-lfvOptions \
-lmeshTools \
-lmultiphaseMixtureThermo \
-lcompressibleTransportModels \
-lfluidThermophysicalModels \
-lspecie \
-linterfaceProperties \
-lturbulenceModels \
-lcompressibleTurbulenceModels
{
fvScalarMatrix TEqn
(
fvm::ddt(rho, T)
+ fvm::div(mixture.rhoPhi(), T)
- fvm::laplacian(mixture.alphaEff(turbulence->mut()), T)
+ (
fvc::div(fvc::absolute(phi, U), p)
+ fvc::ddt(rho, K) + fvc::div(mixture.rhoPhi(), K)
)*mixture.rCv()
);
TEqn.relax();
TEqn.solve();
mixture.correct();
}
fvVectorMatrix UEqn
(
fvm::ddt(rho, U)
+ fvm::div(mixture.rhoPhi(), U)
+ turbulence->divDevRhoReff(U)
);
UEqn.relax();
if (pimple.momentumPredictor())
{
solve
(
UEqn
==
fvc::reconstruct
(
(
mixture.surfaceTensionForce()
- ghf*fvc::snGrad(rho)
- fvc::snGrad(p_rgh)
) * mesh.magSf()
)
);
K = 0.5*magSqr(U);
}
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2013-2016 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/>.
Application
compressibleMultiphaseInterFoam
Group
grpMultiphaseSolvers
Description
Solver for N compressible, non-isothermal immiscible fluids using a VOF
(volume of fluid) phase-fraction based interface capturing approach.
The momentum and other fluid properties are of the "mixture" and a single
momentum equation is solved.
Turbulence modelling is generic, i.e. laminar, RAS or LES may be selected.
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "multiphaseMixtureThermo.H"
#include "turbulentFluidThermoModel.H"
#include "pimpleControl.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
argList::addNote
(
"Solver for N compressible, non-isothermal immiscible fluids"
" using VOF phase-fraction based interface capturing."
);
#include "postProcess.H"
#include "addCheckCaseOptions.H"
#include "setRootCaseLists.H"
#include "createTime.H"
#include "createMesh.H"
#include "createControl.H"
#include "createTimeControls.H"
#include "createFields.H"
#include "CourantNo.H"
#include "setInitialDeltaT.H"
volScalarField& p = mixture.p();
volScalarField& T = mixture.T();
turbulence->validate();
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nStarting time loop\n" << endl;
while (runTime.run())
{
#include "readTimeControls.H"
#include "CourantNo.H"
#include "alphaCourantNo.H"
#include "setDeltaT.H"
++runTime;
Info<< "Time = " << runTime.timeName() << nl << endl;
// --- Pressure-velocity PIMPLE corrector loop
while (pimple.loop())
{
mixture.solve();
solve(fvm::ddt(rho) + fvc::div(mixture.rhoPhi()));
#include "UEqn.H"
#include "TEqn.H"
// --- Pressure corrector loop
while (pimple.correct())
{
#include "pEqn.H"
}
if (pimple.turbCorr())
{
turbulence->correct();
}
}
runTime.write();
runTime.printExecutionTime(Info);
}
Info<< "End\n" << endl;
return 0;
}
// ************************************************************************* //
Info<< "Reading field p_rgh\n" << endl;
volScalarField p_rgh
(
IOobject
(
"p_rgh",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
Info<< "Reading field U\n" << endl;
volVectorField U
(
IOobject
(
"U",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
#include "createPhi.H"
Info<< "Constructing multiphaseMixtureThermo\n" << endl;
multiphaseMixtureThermo mixture(U, phi);
volScalarField rho
(
IOobject
(
"rho",
runTime.timeName(),
mesh,
IOobject::READ_IF_PRESENT
),
mixture.rho()
);
dimensionedScalar pMin("pMin", dimPressure, mixture);
mesh.setFluxRequired(p_rgh.name());
#include "readGravitationalAcceleration.H"
#include "readhRef.H"
#include "gh.H"
// Construct compressible turbulence model
autoPtr<compressible::turbulenceModel> turbulence
(
compressible::turbulenceModel::New
(
rho,
U,
mixture.rhoPhi(),
mixture
)
);
#include "createK.H"
phaseModel/phaseModel.C
alphaContactAngle/alphaContactAngleFvPatchScalarField.C
multiphaseMixtureThermo.C
LIB = $(FOAM_LIBBIN)/libmultiphaseMixtureThermo
EXE_INC = \
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude
LIB_LIBS = \
-lcompressibleTransportModels \
-lfluidThermophysicalModels \
-lspecie \
-lfiniteVolume \
-lmeshTools
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2013 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 "alphaContactAngleFvPatchScalarField.H"
#include "addToRunTimeSelectionTable.H"
#include "fvPatchFieldMapper.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
alphaContactAngleFvPatchScalarField::interfaceThetaProps::interfaceThetaProps
(
Istream& is
)
:
theta0_(readScalar(is)),
uTheta_(readScalar(is)),
thetaA_(readScalar(is)),
thetaR_(readScalar(is))
{}
Istream& operator>>
(
Istream& is,
alphaContactAngleFvPatchScalarField::interfaceThetaProps& tp
)
{
is >> tp.theta0_ >> tp.uTheta_ >> tp.thetaA_ >> tp.thetaR_;
return is;
}
Ostream& operator<<
(
Ostream& os,
const alphaContactAngleFvPatchScalarField::interfaceThetaProps& tp
)
{
os << tp.theta0_ << token::SPACE
<< tp.uTheta_ << token::SPACE
<< tp.thetaA_ << token::SPACE
<< tp.thetaR_;
return os;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
alphaContactAngleFvPatchScalarField::alphaContactAngleFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
zeroGradientFvPatchScalarField(p, iF)
{}
alphaContactAngleFvPatchScalarField::alphaContactAngleFvPatchScalarField
(
const alphaContactAngleFvPatchScalarField& gcpsf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
zeroGradientFvPatchScalarField(gcpsf, p, iF, mapper),
thetaProps_(gcpsf.thetaProps_)
{}
alphaContactAngleFvPatchScalarField::alphaContactAngleFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
zeroGradientFvPatchScalarField(p, iF),
thetaProps_(dict.lookup("thetaProperties"))
{
evaluate();
}
alphaContactAngleFvPatchScalarField::alphaContactAngleFvPatchScalarField
(
const alphaContactAngleFvPatchScalarField& gcpsf,
const DimensionedField<scalar, volMesh>& iF
)
:
zeroGradientFvPatchScalarField(gcpsf, iF),
thetaProps_(gcpsf.thetaProps_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void alphaContactAngleFvPatchScalarField::write(Ostream& os) const
{
fvPatchScalarField::write(os);
os.writeEntry("thetaProperties", thetaProps_);
writeEntry("value", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField
(
fvPatchScalarField,
alphaContactAngleFvPatchScalarField
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2013 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::alphaContactAngleFvPatchScalarField
Description
Contact-angle boundary condition for multi-phase interface-capturing
simulations. Used in conjunction with multiphaseMixture.
SourceFiles
alphaContactAngleFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef alphaContactAngleFvPatchScalarField_H
#define alphaContactAngleFvPatchScalarField_H
#include "zeroGradientFvPatchFields.H"
#include "multiphaseMixtureThermo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class alphaContactAngleFvPatch Declaration
\*---------------------------------------------------------------------------*/
class alphaContactAngleFvPatchScalarField
:
public zeroGradientFvPatchScalarField
{
public:
class interfaceThetaProps
{
//- Equilibrium contact angle
scalar theta0_;
//- Dynamic contact angle velocity scale
scalar uTheta_;
//- Limiting advancing contact angle
scalar thetaA_;
//- Limiting receding contact angle
scalar thetaR_;
public:
// Constructors
interfaceThetaProps()
{}
interfaceThetaProps(Istream&);
// Member functions
//- Return the equilibrium contact angle theta0
scalar theta0(bool matched=true) const
{
if (matched) return theta0_;
else return 180.0 - theta0_;
}
//- Return the dynamic contact angle velocity scale
scalar uTheta() const
{
return uTheta_;
}
//- Return the limiting advancing contact angle
scalar thetaA(bool matched=true) const
{
if (matched) return thetaA_;
else return 180.0 - thetaA_;
}
//- Return the limiting receding contact angle
scalar thetaR(bool matched=true) const
{
if (matched) return thetaR_;
else return 180.0 - thetaR_;
}
// IO functions
friend Istream& operator>>(Istream&, interfaceThetaProps&);
friend Ostream& operator<<(Ostream&, const interfaceThetaProps&);
};
typedef HashTable
<
interfaceThetaProps,
multiphaseMixtureThermo::interfacePair,
multiphaseMixtureThermo::interfacePair::hash
> thetaPropsTable;
private:
// Private data
thetaPropsTable thetaProps_;
public:
//- Runtime type information
TypeName("alphaContactAngle");
// Constructors
//- Construct from patch and internal field
alphaContactAngleFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
alphaContactAngleFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given alphaContactAngleFvPatchScalarField
// onto a new patch
alphaContactAngleFvPatchScalarField
(
const alphaContactAngleFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct and return a clone
virtual tmp<fvPatchScalarField> clone() const
{
return tmp<fvPatchScalarField>
(
new alphaContactAngleFvPatchScalarField(*this)
);
}
//- Construct as copy setting internal field reference
alphaContactAngleFvPatchScalarField
(
const alphaContactAngleFvPatchScalarField&,
const DimensionedField<scalar, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchScalarField> clone
(
const DimensionedField<scalar, volMesh>& iF
) const
{
return tmp<fvPatchScalarField>
(
new alphaContactAngleFvPatchScalarField(*this, iF)
);
}
// Member functions
//- Return the contact angle properties
const thetaPropsTable& thetaProps() const
{
return thetaProps_;
}
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment