mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev
This commit is contained in:
@ -171,12 +171,7 @@ Foam::tmp<Foam::vectorField> Foam::axesRotation::transform
|
||||
const vectorField& st
|
||||
) const
|
||||
{
|
||||
notImplemented
|
||||
(
|
||||
"tmp<vectorField> Foam::axesRotation:: "
|
||||
"transform(const vectorField& st) const"
|
||||
);
|
||||
return tmp<vectorField>(NULL);
|
||||
return (R_ & st);
|
||||
}
|
||||
|
||||
|
||||
@ -185,12 +180,7 @@ Foam::tmp<Foam::vectorField> Foam::axesRotation::invTransform
|
||||
const vectorField& st
|
||||
) const
|
||||
{
|
||||
notImplemented
|
||||
(
|
||||
"tmp<vectorField> Foam::axesRotation::"
|
||||
"invTransform(const vectorField& st) const"
|
||||
);
|
||||
return tmp<vectorField>(NULL);
|
||||
return (Rtr_ & st);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,102 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "adiabaticPerfectFluid.H"
|
||||
#include "IOstreams.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Specie>
|
||||
Foam::adiabaticPerfectFluid<Specie>::adiabaticPerfectFluid(Istream& is)
|
||||
:
|
||||
Specie(is),
|
||||
p0_(readScalar(is)),
|
||||
rho0_(readScalar(is)),
|
||||
gamma_(readScalar(is)),
|
||||
B_(readScalar(is))
|
||||
{
|
||||
is.check
|
||||
(
|
||||
"adiabaticPerfectFluid<Specie>::adiabaticPerfectFluid(Istream& is)"
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class Specie>
|
||||
Foam::adiabaticPerfectFluid<Specie>::adiabaticPerfectFluid
|
||||
(
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
Specie(dict),
|
||||
p0_(readScalar(dict.subDict("equationOfState").lookup("p0"))),
|
||||
rho0_(readScalar(dict.subDict("equationOfState").lookup("rho0"))),
|
||||
gamma_(readScalar(dict.subDict("equationOfState").lookup("gamma"))),
|
||||
B_(readScalar(dict.subDict("equationOfState").lookup("B")))
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Specie>
|
||||
void Foam::adiabaticPerfectFluid<Specie>::write(Ostream& os) const
|
||||
{
|
||||
Specie::write(os);
|
||||
|
||||
dictionary dict("equationOfState");
|
||||
dict.add("p0", p0_);
|
||||
dict.add("rho0", rho0_);
|
||||
dict.add("gamma", gamma_);
|
||||
dict.add("B", B_);
|
||||
|
||||
os << indent << dict.dictName() << dict;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
|
||||
|
||||
template<class Specie>
|
||||
Foam::Ostream& Foam::operator<<
|
||||
(
|
||||
Ostream& os,
|
||||
const adiabaticPerfectFluid<Specie>& pf
|
||||
)
|
||||
{
|
||||
os << static_cast<const Specie&>(pf)
|
||||
<< token::SPACE << pf.R_
|
||||
<< token::SPACE << pf.rho0_
|
||||
<< token::SPACE << pf.gamma_
|
||||
<< token::SPACE << pf.B_;
|
||||
|
||||
os.check
|
||||
(
|
||||
"Ostream& operator<<(Ostream&, const adiabaticPerfectFluid<Specie>&)"
|
||||
);
|
||||
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,247 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::adiabaticPerfectFluid
|
||||
|
||||
Description
|
||||
AdiabaticPerfect gas equation of state.
|
||||
|
||||
SourceFiles
|
||||
adiabaticPerfectFluidI.H
|
||||
adiabaticPerfectFluid.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef adiabaticPerfectFluid_H
|
||||
#define adiabaticPerfectFluid_H
|
||||
|
||||
#include "autoPtr.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of friend functions and operators
|
||||
|
||||
template<class Specie> class adiabaticPerfectFluid;
|
||||
|
||||
template<class Specie>
|
||||
inline adiabaticPerfectFluid<Specie> operator+
|
||||
(
|
||||
const adiabaticPerfectFluid<Specie>&,
|
||||
const adiabaticPerfectFluid<Specie>&
|
||||
);
|
||||
|
||||
template<class Specie>
|
||||
inline adiabaticPerfectFluid<Specie> operator-
|
||||
(
|
||||
const adiabaticPerfectFluid<Specie>&,
|
||||
const adiabaticPerfectFluid<Specie>&
|
||||
);
|
||||
|
||||
template<class Specie>
|
||||
inline adiabaticPerfectFluid<Specie> operator*
|
||||
(
|
||||
const scalar,
|
||||
const adiabaticPerfectFluid<Specie>&
|
||||
);
|
||||
|
||||
template<class Specie>
|
||||
inline adiabaticPerfectFluid<Specie> operator==
|
||||
(
|
||||
const adiabaticPerfectFluid<Specie>&,
|
||||
const adiabaticPerfectFluid<Specie>&
|
||||
);
|
||||
|
||||
template<class Specie>
|
||||
Ostream& operator<<
|
||||
(
|
||||
Ostream&,
|
||||
const adiabaticPerfectFluid<Specie>&
|
||||
);
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class adiabaticPerfectFluid Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class Specie>
|
||||
class adiabaticPerfectFluid
|
||||
:
|
||||
public Specie
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Reference pressure
|
||||
scalar p0_;
|
||||
|
||||
//- Reference density
|
||||
scalar rho0_;
|
||||
|
||||
//- The isentropic exponent
|
||||
scalar gamma_;
|
||||
|
||||
//- Pressure offset for a stiffened gas
|
||||
scalar B_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
inline adiabaticPerfectFluid
|
||||
(
|
||||
const Specie& sp,
|
||||
const scalar p0,
|
||||
const scalar rho0,
|
||||
const scalar gamma,
|
||||
const scalar B
|
||||
);
|
||||
|
||||
//- Construct from Istream
|
||||
adiabaticPerfectFluid(Istream&);
|
||||
|
||||
//- Construct from dictionary
|
||||
adiabaticPerfectFluid(const dictionary& dict);
|
||||
|
||||
//- Construct as named copy
|
||||
inline adiabaticPerfectFluid
|
||||
(
|
||||
const word& name,
|
||||
const adiabaticPerfectFluid&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
inline autoPtr<adiabaticPerfectFluid> clone() const;
|
||||
|
||||
// Selector from Istream
|
||||
inline static autoPtr<adiabaticPerfectFluid> New(Istream& is);
|
||||
|
||||
// Selector from dictionary
|
||||
inline static autoPtr<adiabaticPerfectFluid> New
|
||||
(
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
//- Return the instantiated type name
|
||||
static word typeName()
|
||||
{
|
||||
return "adiabaticPerfectFluid<" + word(Specie::typeName_()) + '>';
|
||||
}
|
||||
|
||||
|
||||
// Fundamental properties
|
||||
|
||||
//- Is the equation of state is incompressible i.e. rho != f(p)
|
||||
static const bool incompressible = false;
|
||||
|
||||
//- Is the equation of state is isochoric i.e. rho = const
|
||||
static const bool isochoric = false;
|
||||
|
||||
//- Return density [kg/m^3]
|
||||
inline scalar rho(scalar p, scalar T) const;
|
||||
|
||||
//- Return compressibility rho/p [s^2/m^2]
|
||||
inline scalar psi(scalar p, scalar T) const;
|
||||
|
||||
//- Return compression factor []
|
||||
inline scalar Z(scalar p, scalar T) const;
|
||||
|
||||
//- Return (cp - cv) [J/(kmol K]
|
||||
inline scalar cpMcv(scalar p, scalar T) const;
|
||||
|
||||
|
||||
// IO
|
||||
|
||||
//- Write to Ostream
|
||||
void write(Ostream& os) const;
|
||||
|
||||
|
||||
// Member operators
|
||||
|
||||
inline void operator+=(const adiabaticPerfectFluid&);
|
||||
inline void operator-=(const adiabaticPerfectFluid&);
|
||||
|
||||
inline void operator*=(const scalar);
|
||||
|
||||
|
||||
// Friend operators
|
||||
|
||||
friend adiabaticPerfectFluid operator+ <Specie>
|
||||
(
|
||||
const adiabaticPerfectFluid&,
|
||||
const adiabaticPerfectFluid&
|
||||
);
|
||||
|
||||
friend adiabaticPerfectFluid operator- <Specie>
|
||||
(
|
||||
const adiabaticPerfectFluid&,
|
||||
const adiabaticPerfectFluid&
|
||||
);
|
||||
|
||||
friend adiabaticPerfectFluid operator* <Specie>
|
||||
(
|
||||
const scalar s,
|
||||
const adiabaticPerfectFluid&
|
||||
);
|
||||
|
||||
friend adiabaticPerfectFluid operator== <Specie>
|
||||
(
|
||||
const adiabaticPerfectFluid&,
|
||||
const adiabaticPerfectFluid&
|
||||
);
|
||||
|
||||
|
||||
// Ostream Operator
|
||||
|
||||
friend Ostream& operator<< <Specie>
|
||||
(
|
||||
Ostream&,
|
||||
const adiabaticPerfectFluid&
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "adiabaticPerfectFluidI.H"
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "adiabaticPerfectFluid.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,271 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "adiabaticPerfectFluid.H"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
template<class Specie>
|
||||
inline Foam::adiabaticPerfectFluid<Specie>::adiabaticPerfectFluid
|
||||
(
|
||||
const Specie& sp,
|
||||
const scalar p0,
|
||||
const scalar rho0,
|
||||
const scalar gamma,
|
||||
const scalar B
|
||||
)
|
||||
:
|
||||
Specie(sp),
|
||||
p0_(p0),
|
||||
rho0_(rho0),
|
||||
gamma_(gamma),
|
||||
B_(B)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Specie>
|
||||
inline Foam::adiabaticPerfectFluid<Specie>::adiabaticPerfectFluid
|
||||
(
|
||||
const word& name,
|
||||
const adiabaticPerfectFluid<Specie>& pf
|
||||
)
|
||||
:
|
||||
Specie(name, pf),
|
||||
p0_(pf.p0_),
|
||||
rho0_(pf.rho0_),
|
||||
gamma_(pf.gamma_),
|
||||
B_(pf.B_)
|
||||
{}
|
||||
|
||||
|
||||
template<class Specie>
|
||||
inline Foam::autoPtr<Foam::adiabaticPerfectFluid<Specie> >
|
||||
Foam::adiabaticPerfectFluid<Specie>::clone() const
|
||||
{
|
||||
return autoPtr<adiabaticPerfectFluid<Specie> >
|
||||
(
|
||||
new adiabaticPerfectFluid<Specie>(*this)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class Specie>
|
||||
inline Foam::autoPtr<Foam::adiabaticPerfectFluid<Specie> >
|
||||
Foam::adiabaticPerfectFluid<Specie>::New(Istream& is)
|
||||
{
|
||||
return autoPtr<adiabaticPerfectFluid<Specie> >
|
||||
(
|
||||
new adiabaticPerfectFluid<Specie>(is)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class Specie>
|
||||
inline Foam::autoPtr<Foam::adiabaticPerfectFluid<Specie> >
|
||||
Foam::adiabaticPerfectFluid<Specie>::New
|
||||
(
|
||||
const dictionary& dict
|
||||
)
|
||||
{
|
||||
return autoPtr<adiabaticPerfectFluid<Specie> >
|
||||
(
|
||||
new adiabaticPerfectFluid<Specie>(dict)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Specie>
|
||||
inline Foam::scalar Foam::adiabaticPerfectFluid<Specie>::rho
|
||||
(
|
||||
scalar p,
|
||||
scalar
|
||||
) const
|
||||
{
|
||||
return rho0_*pow((p + B_)/(p0_ + B_), 1.0/gamma_);
|
||||
}
|
||||
|
||||
|
||||
template<class Specie>
|
||||
inline Foam::scalar Foam::adiabaticPerfectFluid<Specie>::psi
|
||||
(
|
||||
scalar p,
|
||||
scalar
|
||||
) const
|
||||
{
|
||||
return
|
||||
(rho0_/(gamma_*(p0_ + B_)))
|
||||
*pow((p + B_)/(p0_ + B_), 1.0/gamma_ - 1.0);
|
||||
}
|
||||
|
||||
|
||||
template<class Specie>
|
||||
inline Foam::scalar Foam::adiabaticPerfectFluid<Specie>::Z(scalar, scalar) const
|
||||
{
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
|
||||
template<class Specie>
|
||||
inline Foam::scalar Foam::adiabaticPerfectFluid<Specie>::cpMcv
|
||||
(
|
||||
scalar,
|
||||
scalar
|
||||
) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
template<class Specie>
|
||||
inline void Foam::adiabaticPerfectFluid<Specie>::operator+=
|
||||
(
|
||||
const adiabaticPerfectFluid<Specie>& pf
|
||||
)
|
||||
{
|
||||
scalar molr1 = this->nMoles();
|
||||
|
||||
Specie::operator+=(pf);
|
||||
|
||||
molr1 /= this->nMoles();
|
||||
scalar molr2 = pf.nMoles()/this->nMoles();
|
||||
|
||||
p0_ = molr1*p0_ + molr2*pf.p0_;
|
||||
rho0_ = molr1*rho0_ + molr2*pf.rho0_;
|
||||
gamma_ = molr1*gamma_ + molr2*pf.gamma_;
|
||||
B_ = molr1*B_ + molr2*pf.B_;
|
||||
}
|
||||
|
||||
|
||||
template<class Specie>
|
||||
inline void Foam::adiabaticPerfectFluid<Specie>::operator-=
|
||||
(
|
||||
const adiabaticPerfectFluid<Specie>& pf
|
||||
)
|
||||
{
|
||||
scalar molr1 = this->nMoles();
|
||||
|
||||
Specie::operator-=(pf);
|
||||
|
||||
molr1 /= this->nMoles();
|
||||
scalar molr2 = pf.nMoles()/this->nMoles();
|
||||
|
||||
p0_ = molr1*p0_ - molr2*pf.p0_;
|
||||
rho0_ = molr1*rho0_ - molr2*pf.rho0_;
|
||||
gamma_ = molr1*gamma_ - molr2*pf.gamma_;
|
||||
B_ = molr1*B_ - molr2*pf.B_;
|
||||
}
|
||||
|
||||
|
||||
template<class Specie>
|
||||
inline void Foam::adiabaticPerfectFluid<Specie>::operator*=(const scalar s)
|
||||
{
|
||||
Specie::operator*=(s);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
||||
|
||||
template<class Specie>
|
||||
inline Foam::adiabaticPerfectFluid<Specie> Foam::operator+
|
||||
(
|
||||
const adiabaticPerfectFluid<Specie>& pf1,
|
||||
const adiabaticPerfectFluid<Specie>& pf2
|
||||
)
|
||||
{
|
||||
scalar nMoles = pf1.nMoles() + pf2.nMoles();
|
||||
scalar molr1 = pf1.nMoles()/nMoles;
|
||||
scalar molr2 = pf2.nMoles()/nMoles;
|
||||
|
||||
return rhoConst<Specie>
|
||||
(
|
||||
static_cast<const Specie&>(pf1)
|
||||
+ static_cast<const Specie&>(pf2),
|
||||
molr1*pf1.p0_ + molr2*pf2.p0_,
|
||||
molr1*pf1.rho0_ + molr2*pf2.rho0_,
|
||||
molr1*pf1.gamma_ + molr2*pf2.gamma_,
|
||||
molr1*pf1.B_ + molr2*pf2.B_
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class Specie>
|
||||
inline Foam::adiabaticPerfectFluid<Specie> Foam::operator-
|
||||
(
|
||||
const adiabaticPerfectFluid<Specie>& pf1,
|
||||
const adiabaticPerfectFluid<Specie>& pf2
|
||||
)
|
||||
{
|
||||
scalar nMoles = pf1.nMoles() + pf2.nMoles();
|
||||
scalar molr1 = pf1.nMoles()/nMoles;
|
||||
scalar molr2 = pf2.nMoles()/nMoles;
|
||||
|
||||
return rhoConst<Specie>
|
||||
(
|
||||
static_cast<const Specie&>(pf1)
|
||||
- static_cast<const Specie&>(pf2),
|
||||
molr1*pf1.p0_ - molr2*pf2.p0_,
|
||||
molr1*pf1.rho0_ - molr2*pf2.rho0_,
|
||||
molr1*pf1.gamma_ - molr2*pf2.gamma_,
|
||||
molr1*pf1.B_ - molr2*pf2.B_
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class Specie>
|
||||
inline Foam::adiabaticPerfectFluid<Specie> Foam::operator*
|
||||
(
|
||||
const scalar s,
|
||||
const adiabaticPerfectFluid<Specie>& pf
|
||||
)
|
||||
{
|
||||
return adiabaticPerfectFluid<Specie>
|
||||
(
|
||||
s*static_cast<const Specie&>(pf),
|
||||
pf.p0_,
|
||||
pf.rho0_,
|
||||
pf.gamma_,
|
||||
pf.B_
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class Specie>
|
||||
inline Foam::adiabaticPerfectFluid<Specie> Foam::operator==
|
||||
(
|
||||
const adiabaticPerfectFluid<Specie>& pf1,
|
||||
const adiabaticPerfectFluid<Specie>& pf2
|
||||
)
|
||||
{
|
||||
return pf2 - pf1;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,80 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "linear.H"
|
||||
#include "IOstreams.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Specie>
|
||||
Foam::linear<Specie>::linear(Istream& is)
|
||||
:
|
||||
Specie(is),
|
||||
psi_(readScalar(is)),
|
||||
rho0_(readScalar(is))
|
||||
{
|
||||
is.check("linear<Specie>::linear(Istream& is)");
|
||||
}
|
||||
|
||||
|
||||
template<class Specie>
|
||||
Foam::linear<Specie>::linear(const dictionary& dict)
|
||||
:
|
||||
Specie(dict),
|
||||
psi_(readScalar(dict.subDict("equationOfState").lookup("psi"))),
|
||||
rho0_(readScalar(dict.subDict("equationOfState").lookup("rho0")))
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Specie>
|
||||
void Foam::linear<Specie>::write(Ostream& os) const
|
||||
{
|
||||
Specie::write(os);
|
||||
|
||||
dictionary dict("equationOfState");
|
||||
dict.add("psi", psi_);
|
||||
dict.add("rho0", rho0_);
|
||||
|
||||
os << indent << dict.dictName() << dict;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
|
||||
|
||||
template<class Specie>
|
||||
Foam::Ostream& Foam::operator<<(Ostream& os, const linear<Specie>& pf)
|
||||
{
|
||||
os << static_cast<const Specie&>(pf)
|
||||
<< token::SPACE << pf.psi_
|
||||
<< token::SPACE << pf.rho0_;
|
||||
|
||||
os.check("Ostream& operator<<(Ostream&, const linear<Specie>&)");
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
232
src/thermophysicalModels/specie/equationOfState/linear/linear.H
Normal file
232
src/thermophysicalModels/specie/equationOfState/linear/linear.H
Normal file
@ -0,0 +1,232 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::linear
|
||||
|
||||
Description
|
||||
Perfect gas equation of state.
|
||||
|
||||
SourceFiles
|
||||
linearI.H
|
||||
linear.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef linear_H
|
||||
#define linear_H
|
||||
|
||||
#include "autoPtr.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of friend functions and operators
|
||||
|
||||
template<class Specie> class linear;
|
||||
|
||||
template<class Specie>
|
||||
inline linear<Specie> operator+
|
||||
(
|
||||
const linear<Specie>&,
|
||||
const linear<Specie>&
|
||||
);
|
||||
|
||||
template<class Specie>
|
||||
inline linear<Specie> operator-
|
||||
(
|
||||
const linear<Specie>&,
|
||||
const linear<Specie>&
|
||||
);
|
||||
|
||||
template<class Specie>
|
||||
inline linear<Specie> operator*
|
||||
(
|
||||
const scalar,
|
||||
const linear<Specie>&
|
||||
);
|
||||
|
||||
template<class Specie>
|
||||
inline linear<Specie> operator==
|
||||
(
|
||||
const linear<Specie>&,
|
||||
const linear<Specie>&
|
||||
);
|
||||
|
||||
template<class Specie>
|
||||
Ostream& operator<<
|
||||
(
|
||||
Ostream&,
|
||||
const linear<Specie>&
|
||||
);
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class linear Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class Specie>
|
||||
class linear
|
||||
:
|
||||
public Specie
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Compressibility
|
||||
scalar psi_;
|
||||
|
||||
//- The reference density
|
||||
scalar rho0_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
inline linear
|
||||
(
|
||||
const Specie& sp,
|
||||
const scalar psi,
|
||||
const scalar rho0
|
||||
);
|
||||
|
||||
//- Construct from Istream
|
||||
linear(Istream&);
|
||||
|
||||
//- Construct from dictionary
|
||||
linear(const dictionary& dict);
|
||||
|
||||
//- Construct as named copy
|
||||
inline linear(const word& name, const linear&);
|
||||
|
||||
//- Construct and return a clone
|
||||
inline autoPtr<linear> clone() const;
|
||||
|
||||
// Selector from Istream
|
||||
inline static autoPtr<linear> New(Istream& is);
|
||||
|
||||
// Selector from dictionary
|
||||
inline static autoPtr<linear> New(const dictionary& dict);
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
//- Return the instantiated type name
|
||||
static word typeName()
|
||||
{
|
||||
return "linear<" + word(Specie::typeName_()) + '>';
|
||||
}
|
||||
|
||||
|
||||
// Fundamental properties
|
||||
|
||||
//- Is the equation of state is incompressible i.e. rho != f(p)
|
||||
static const bool incompressible = false;
|
||||
|
||||
//- Is the equation of state is isochoric i.e. rho = const
|
||||
static const bool isochoric = false;
|
||||
|
||||
//- Return density [kg/m^3]
|
||||
inline scalar rho(scalar p, scalar T) const;
|
||||
|
||||
//- Return compressibility rho/p [s^2/m^2]
|
||||
inline scalar psi(scalar p, scalar T) const;
|
||||
|
||||
//- Return compression factor []
|
||||
inline scalar Z(scalar p, scalar T) const;
|
||||
|
||||
//- Return (cp - cv) [J/(kmol K]
|
||||
inline scalar cpMcv(scalar p, scalar T) const;
|
||||
|
||||
|
||||
// IO
|
||||
|
||||
//- Write to Ostream
|
||||
void write(Ostream& os) const;
|
||||
|
||||
|
||||
// Member operators
|
||||
|
||||
inline void operator+=(const linear&);
|
||||
inline void operator-=(const linear&);
|
||||
|
||||
inline void operator*=(const scalar);
|
||||
|
||||
|
||||
// Friend operators
|
||||
|
||||
friend linear operator+ <Specie>
|
||||
(
|
||||
const linear&,
|
||||
const linear&
|
||||
);
|
||||
|
||||
friend linear operator- <Specie>
|
||||
(
|
||||
const linear&,
|
||||
const linear&
|
||||
);
|
||||
|
||||
friend linear operator* <Specie>
|
||||
(
|
||||
const scalar s,
|
||||
const linear&
|
||||
);
|
||||
|
||||
friend linear operator== <Specie>
|
||||
(
|
||||
const linear&,
|
||||
const linear&
|
||||
);
|
||||
|
||||
|
||||
// Ostream Operator
|
||||
|
||||
friend Ostream& operator<< <Specie>
|
||||
(
|
||||
Ostream&,
|
||||
const linear&
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "linearI.H"
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "linear.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
232
src/thermophysicalModels/specie/equationOfState/linear/linearI.H
Normal file
232
src/thermophysicalModels/specie/equationOfState/linear/linearI.H
Normal file
@ -0,0 +1,232 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "linear.H"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
template<class Specie>
|
||||
inline Foam::linear<Specie>::linear
|
||||
(
|
||||
const Specie& sp,
|
||||
const scalar psi,
|
||||
const scalar rho0
|
||||
)
|
||||
:
|
||||
Specie(sp),
|
||||
psi_(psi),
|
||||
rho0_(rho0)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Specie>
|
||||
inline Foam::linear<Specie>::linear
|
||||
(
|
||||
const word& name,
|
||||
const linear<Specie>& pf
|
||||
)
|
||||
:
|
||||
Specie(name, pf),
|
||||
psi_(pf.psi_),
|
||||
rho0_(pf.rho0_)
|
||||
{}
|
||||
|
||||
|
||||
template<class Specie>
|
||||
inline Foam::autoPtr<Foam::linear<Specie> >
|
||||
Foam::linear<Specie>::clone() const
|
||||
{
|
||||
return autoPtr<linear<Specie> >(new linear<Specie>(*this));
|
||||
}
|
||||
|
||||
|
||||
template<class Specie>
|
||||
inline Foam::autoPtr<Foam::linear<Specie> >
|
||||
Foam::linear<Specie>::New(Istream& is)
|
||||
{
|
||||
return autoPtr<linear<Specie> >(new linear<Specie>(is));
|
||||
}
|
||||
|
||||
|
||||
template<class Specie>
|
||||
inline Foam::autoPtr<Foam::linear<Specie> >
|
||||
Foam::linear<Specie>::New
|
||||
(
|
||||
const dictionary& dict
|
||||
)
|
||||
{
|
||||
return autoPtr<linear<Specie> >(new linear<Specie>(dict));
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Specie>
|
||||
inline Foam::scalar Foam::linear<Specie>::rho(scalar p, scalar T) const
|
||||
{
|
||||
return rho0_ + psi_*p;
|
||||
}
|
||||
|
||||
|
||||
template<class Specie>
|
||||
inline Foam::scalar Foam::linear<Specie>::psi(scalar, scalar T) const
|
||||
{
|
||||
return psi_;
|
||||
}
|
||||
|
||||
|
||||
template<class Specie>
|
||||
inline Foam::scalar Foam::linear<Specie>::Z(scalar, scalar) const
|
||||
{
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
|
||||
template<class Specie>
|
||||
inline Foam::scalar Foam::linear<Specie>::cpMcv(scalar, scalar) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
template<class Specie>
|
||||
inline void Foam::linear<Specie>::operator+=
|
||||
(
|
||||
const linear<Specie>& pf
|
||||
)
|
||||
{
|
||||
scalar molr1 = this->nMoles();
|
||||
|
||||
Specie::operator+=(pf);
|
||||
|
||||
molr1 /= this->nMoles();
|
||||
scalar molr2 = pf.nMoles()/this->nMoles();
|
||||
|
||||
psi_ = molr1*psi_ + molr2*pf.psi_;
|
||||
rho0_ = molr1*rho0_ + molr2*pf.rho0_;
|
||||
}
|
||||
|
||||
|
||||
template<class Specie>
|
||||
inline void Foam::linear<Specie>::operator-=
|
||||
(
|
||||
const linear<Specie>& pf
|
||||
)
|
||||
{
|
||||
scalar molr1 = this->nMoles();
|
||||
|
||||
Specie::operator-=(pf);
|
||||
|
||||
molr1 /= this->nMoles();
|
||||
scalar molr2 = pf.nMoles()/this->nMoles();
|
||||
|
||||
psi_ = molr1*psi_ - molr2*pf.psi_;
|
||||
rho0_ = molr1*rho0_ - molr2*pf.rho0_;
|
||||
}
|
||||
|
||||
|
||||
template<class Specie>
|
||||
inline void Foam::linear<Specie>::operator*=(const scalar s)
|
||||
{
|
||||
Specie::operator*=(s);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
||||
|
||||
template<class Specie>
|
||||
inline Foam::linear<Specie> Foam::operator+
|
||||
(
|
||||
const linear<Specie>& pf1,
|
||||
const linear<Specie>& pf2
|
||||
)
|
||||
{
|
||||
scalar nMoles = pf1.nMoles() + pf2.nMoles();
|
||||
scalar molr1 = pf1.nMoles()/nMoles;
|
||||
scalar molr2 = pf2.nMoles()/nMoles;
|
||||
|
||||
return rhoConst<Specie>
|
||||
(
|
||||
static_cast<const Specie&>(pf1)
|
||||
+ static_cast<const Specie&>(pf2),
|
||||
molr1*pf1.psi_ + molr2*pf2.psi_,
|
||||
molr1*pf1.rho0_ + molr2*pf2.rho0_
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class Specie>
|
||||
inline Foam::linear<Specie> Foam::operator-
|
||||
(
|
||||
const linear<Specie>& pf1,
|
||||
const linear<Specie>& pf2
|
||||
)
|
||||
{
|
||||
scalar nMoles = pf1.nMoles() + pf2.nMoles();
|
||||
scalar molr1 = pf1.nMoles()/nMoles;
|
||||
scalar molr2 = pf2.nMoles()/nMoles;
|
||||
|
||||
return rhoConst<Specie>
|
||||
(
|
||||
static_cast<const Specie&>(pf1)
|
||||
- static_cast<const Specie&>(pf2),
|
||||
molr1*pf1.psi_ - molr2*pf2.psi_,
|
||||
molr1*pf1.rho0_ - molr2*pf2.rho0_
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class Specie>
|
||||
inline Foam::linear<Specie> Foam::operator*
|
||||
(
|
||||
const scalar s,
|
||||
const linear<Specie>& pf
|
||||
)
|
||||
{
|
||||
return linear<Specie>
|
||||
(
|
||||
s*static_cast<const Specie&>(pf),
|
||||
pf.psi_,
|
||||
pf.rho0_
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class Specie>
|
||||
inline Foam::linear<Specie> Foam::operator==
|
||||
(
|
||||
const linear<Specie>& pf1,
|
||||
const linear<Specie>& pf2
|
||||
)
|
||||
{
|
||||
return pf2 - pf1;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -3,9 +3,8 @@ cd ${0%/*} || exit 1 # run from this directory
|
||||
makeType=${1:-libso}
|
||||
set -x
|
||||
|
||||
wmake $makeType incompressible
|
||||
wmake $makeType interfaceProperties
|
||||
wmake $makeType twoPhaseInterfaceProperties
|
||||
# wmake $makeType compressible
|
||||
wmake $makeType twoPhaseProperties
|
||||
wmake $makeType incompressible
|
||||
|
||||
# ----------------------------------------------------------------- end-of-file
|
||||
|
||||
@ -9,6 +9,6 @@ viscosityModels/HerschelBulkley/HerschelBulkley.C
|
||||
transportModel/transportModel.C
|
||||
singlePhaseTransportModel/singlePhaseTransportModel.C
|
||||
|
||||
incompressibleTwoPhaseMixture/twoPhaseMixture.C
|
||||
incompressibleTwoPhaseMixture/incompressibleTwoPhaseMixture.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libincompressibleTransportModels
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
EXE_INC = \
|
||||
-I.. \
|
||||
-I../twoPhaseProperties/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude
|
||||
|
||||
LIB_LIBS = \
|
||||
-ltwoPhaseProperties \
|
||||
-lfiniteVolume
|
||||
|
||||
@ -23,7 +23,7 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "twoPhaseMixture.H"
|
||||
#include "incompressibleTwoPhaseMixture.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "surfaceFields.H"
|
||||
#include "fvc.H"
|
||||
@ -32,7 +32,7 @@ License
|
||||
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
|
||||
|
||||
//- Calculate and return the laminar viscosity
|
||||
void Foam::twoPhaseMixture::calcNu()
|
||||
void Foam::incompressibleTwoPhaseMixture::calcNu()
|
||||
{
|
||||
nuModel1_->correct();
|
||||
nuModel2_->correct();
|
||||
@ -50,7 +50,7 @@ void Foam::twoPhaseMixture::calcNu()
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::twoPhaseMixture::twoPhaseMixture
|
||||
Foam::incompressibleTwoPhaseMixture::incompressibleTwoPhaseMixture
|
||||
(
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& phi,
|
||||
@ -59,16 +59,14 @@ Foam::twoPhaseMixture::twoPhaseMixture
|
||||
)
|
||||
:
|
||||
transportModel(U, phi),
|
||||
|
||||
phase1Name_(found("phases") ? wordList(lookup("phases"))[0] : "phase1"),
|
||||
phase2Name_(found("phases") ? wordList(lookup("phases"))[1] : "phase2"),
|
||||
twoPhaseMixture(U.mesh(), *this, alpha1Name, alpha2Name),
|
||||
|
||||
nuModel1_
|
||||
(
|
||||
viscosityModel::New
|
||||
(
|
||||
"nu1",
|
||||
subDict(phase1Name_),
|
||||
subDict(phase1Name_ == "1" ? "phase1": phase1Name_),
|
||||
U,
|
||||
phi
|
||||
)
|
||||
@ -78,7 +76,7 @@ Foam::twoPhaseMixture::twoPhaseMixture
|
||||
viscosityModel::New
|
||||
(
|
||||
"nu2",
|
||||
subDict(phase2Name_),
|
||||
subDict(phase2Name_ == "2" ? "phase2": phase2Name_),
|
||||
U,
|
||||
phi
|
||||
)
|
||||
@ -90,30 +88,6 @@ Foam::twoPhaseMixture::twoPhaseMixture
|
||||
U_(U),
|
||||
phi_(phi),
|
||||
|
||||
alpha1_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
found("phases") ? word("alpha" + phase1Name_) : alpha1Name,
|
||||
U_.time().timeName(),
|
||||
U_.db(),
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
U_.mesh()
|
||||
),
|
||||
|
||||
alpha2_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
found("phases") ? word("alpha" + phase2Name_) : alpha2Name,
|
||||
U_.time().timeName(),
|
||||
U_.db()
|
||||
),
|
||||
1.0 - alpha1_
|
||||
),
|
||||
|
||||
nu_
|
||||
(
|
||||
IOobject
|
||||
@ -133,7 +107,8 @@ Foam::twoPhaseMixture::twoPhaseMixture
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::twoPhaseMixture::mu() const
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::incompressibleTwoPhaseMixture::mu() const
|
||||
{
|
||||
const volScalarField limitedAlpha1
|
||||
(
|
||||
@ -152,7 +127,8 @@ Foam::tmp<Foam::volScalarField> Foam::twoPhaseMixture::mu() const
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::surfaceScalarField> Foam::twoPhaseMixture::muf() const
|
||||
Foam::tmp<Foam::surfaceScalarField>
|
||||
Foam::incompressibleTwoPhaseMixture::muf() const
|
||||
{
|
||||
const surfaceScalarField alpha1f
|
||||
(
|
||||
@ -171,7 +147,8 @@ Foam::tmp<Foam::surfaceScalarField> Foam::twoPhaseMixture::muf() const
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::surfaceScalarField> Foam::twoPhaseMixture::nuf() const
|
||||
Foam::tmp<Foam::surfaceScalarField>
|
||||
Foam::incompressibleTwoPhaseMixture::nuf() const
|
||||
{
|
||||
const surfaceScalarField alpha1f
|
||||
(
|
||||
@ -192,7 +169,7 @@ Foam::tmp<Foam::surfaceScalarField> Foam::twoPhaseMixture::nuf() const
|
||||
}
|
||||
|
||||
|
||||
bool Foam::twoPhaseMixture::read()
|
||||
bool Foam::incompressibleTwoPhaseMixture::read()
|
||||
{
|
||||
if (transportModel::read())
|
||||
{
|
||||
@ -22,23 +22,23 @@ License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::twoPhaseMixture
|
||||
Foam::incompressibleTwoPhaseMixture
|
||||
|
||||
Description
|
||||
A two-phase incompressible transportModel
|
||||
|
||||
SourceFiles
|
||||
twoPhaseMixture.C
|
||||
incompressibleTwoPhaseMixture.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef twoPhaseMixture_H
|
||||
#define twoPhaseMixture_H
|
||||
#ifndef incompressibleTwoPhaseMixture_H
|
||||
#define incompressibleTwoPhaseMixture_H
|
||||
|
||||
#include "incompressible/transportModel/transportModel.H"
|
||||
#include "incompressible/viscosityModels/viscosityModel/viscosityModel.H"
|
||||
#include "dimensionedScalar.H"
|
||||
#include "volFields.H"
|
||||
#include "twoPhaseMixture.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -46,20 +46,18 @@ namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class twoPhaseMixture Declaration
|
||||
Class incompressibleTwoPhaseMixture Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class twoPhaseMixture
|
||||
class incompressibleTwoPhaseMixture
|
||||
:
|
||||
public transportModel
|
||||
public transportModel,
|
||||
public twoPhaseMixture
|
||||
{
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
word phase1Name_;
|
||||
word phase2Name_;
|
||||
|
||||
autoPtr<viscosityModel> nuModel1_;
|
||||
autoPtr<viscosityModel> nuModel2_;
|
||||
|
||||
@ -69,9 +67,6 @@ protected:
|
||||
const volVectorField& U_;
|
||||
const surfaceScalarField& phi_;
|
||||
|
||||
volScalarField alpha1_;
|
||||
volScalarField alpha2_;
|
||||
|
||||
volScalarField nu_;
|
||||
|
||||
|
||||
@ -86,7 +81,7 @@ public:
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
twoPhaseMixture
|
||||
incompressibleTwoPhaseMixture
|
||||
(
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& phi,
|
||||
@ -96,46 +91,12 @@ public:
|
||||
|
||||
|
||||
//- Destructor
|
||||
~twoPhaseMixture()
|
||||
virtual ~incompressibleTwoPhaseMixture()
|
||||
{}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
const word phase1Name() const
|
||||
{
|
||||
return phase1Name_;
|
||||
}
|
||||
|
||||
const word phase2Name() const
|
||||
{
|
||||
return phase2Name_;
|
||||
}
|
||||
|
||||
//- Return the phase-fraction of phase 1
|
||||
const volScalarField& alpha1() const
|
||||
{
|
||||
return alpha1_;
|
||||
}
|
||||
|
||||
//- Return the phase-fraction of phase 1
|
||||
volScalarField& alpha1()
|
||||
{
|
||||
return alpha1_;
|
||||
}
|
||||
|
||||
//- Return the phase-fraction of phase 2
|
||||
const volScalarField& alpha2() const
|
||||
{
|
||||
return alpha2_;
|
||||
}
|
||||
|
||||
//- Return the phase-fraction of phase 2
|
||||
volScalarField& alpha2()
|
||||
{
|
||||
return alpha2_;
|
||||
}
|
||||
|
||||
//- Return const-access to phase1 viscosityModel
|
||||
const viscosityModel& nuModel1() const
|
||||
{
|
||||
@ -1,5 +1,5 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/transportModels/twoPhaseInterfaceProperties/alphaContactAngle/alphaContactAngle \
|
||||
-I$(LIB_SRC)/transportModels/twoPhaseProperties/alphaContactAngle/alphaContactAngle \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude
|
||||
|
||||
LIB_LIBS = -lfiniteVolume
|
||||
|
||||
@ -1,7 +1,9 @@
|
||||
twoPhaseMixture/twoPhaseMixture.C
|
||||
|
||||
alphaContactAngle/alphaContactAngle/alphaContactAngleFvPatchScalarField.C
|
||||
alphaContactAngle/constantAlphaContactAngle/constantAlphaContactAngleFvPatchScalarField.C
|
||||
alphaContactAngle/dynamicAlphaContactAngle/dynamicAlphaContactAngleFvPatchScalarField.C
|
||||
alphaContactAngle/timeVaryingAlphaContactAngle/timeVaryingAlphaContactAngleFvPatchScalarField.C
|
||||
alphaFixedPressure/alphaFixedPressureFvPatchScalarField.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libtwoPhaseInterfaceProperties
|
||||
LIB = $(FOAM_LIBBIN)/libtwoPhaseProperties
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -0,0 +1,78 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "twoPhaseMixture.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::twoPhaseMixture::twoPhaseMixture
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const dictionary& dict,
|
||||
const word& alpha1Name,
|
||||
const word& alpha2Name
|
||||
)
|
||||
:
|
||||
phase1Name_
|
||||
(
|
||||
dict.found("phases")
|
||||
? wordList(dict.lookup("phases"))[0]
|
||||
: "1"
|
||||
),
|
||||
phase2Name_
|
||||
(
|
||||
dict.found("phases")
|
||||
? wordList(dict.lookup("phases"))[1]
|
||||
: "2"
|
||||
),
|
||||
|
||||
alpha1_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
dict.found("phases") ? word("alpha" + phase1Name_) : alpha1Name,
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
),
|
||||
|
||||
alpha2_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
dict.found("phases") ? word("alpha" + phase2Name_) : alpha2Name,
|
||||
mesh.time().timeName(),
|
||||
mesh
|
||||
),
|
||||
1.0 - alpha1_
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,127 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
Class
|
||||
Foam::twoPhaseMixture
|
||||
|
||||
Description
|
||||
A two-phase mixture model
|
||||
|
||||
SourceFiles
|
||||
twoPhaseMixture.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef twoPhaseMixture_H
|
||||
#define twoPhaseMixture_H
|
||||
|
||||
#include "volFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class twoPhaseMixture Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class twoPhaseMixture
|
||||
{
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
word phase1Name_;
|
||||
word phase2Name_;
|
||||
|
||||
volScalarField alpha1_;
|
||||
volScalarField alpha2_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
twoPhaseMixture
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const dictionary& dict,
|
||||
const word& alpha1Name = "alpha1",
|
||||
const word& alpha2Name = "alpha2"
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
~twoPhaseMixture()
|
||||
{}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
const word phase1Name() const
|
||||
{
|
||||
return phase1Name_;
|
||||
}
|
||||
|
||||
const word phase2Name() const
|
||||
{
|
||||
return phase2Name_;
|
||||
}
|
||||
|
||||
//- Return the phase-fraction of phase 1
|
||||
const volScalarField& alpha1() const
|
||||
{
|
||||
return alpha1_;
|
||||
}
|
||||
|
||||
//- Return the phase-fraction of phase 1
|
||||
volScalarField& alpha1()
|
||||
{
|
||||
return alpha1_;
|
||||
}
|
||||
|
||||
//- Return the phase-fraction of phase 2
|
||||
const volScalarField& alpha2() const
|
||||
{
|
||||
return alpha2_;
|
||||
}
|
||||
|
||||
//- Return the phase-fraction of phase 2
|
||||
volScalarField& alpha2()
|
||||
{
|
||||
return alpha2_;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -233,8 +233,7 @@ public:
|
||||
//- Return the effective turbulent temperature diffusivity for a patch
|
||||
virtual tmp<scalarField> kappaEff(const label patchI) const
|
||||
{
|
||||
return
|
||||
thermo().kappaEff(alphat()().boundaryField()[patchI], patchI);
|
||||
return thermo().kappaEff(alphat(patchI), patchI);
|
||||
}
|
||||
|
||||
//- Return the effective turbulent thermal diffusivity
|
||||
@ -246,8 +245,7 @@ public:
|
||||
//- Return the effective turbulent thermal diffusivity for a patch
|
||||
virtual tmp<scalarField> alphaEff(const label patchI) const
|
||||
{
|
||||
return
|
||||
thermo().alphaEff(alphat()().boundaryField()[patchI], patchI);
|
||||
return thermo().alphaEff(alphat(patchI), patchI);
|
||||
}
|
||||
|
||||
//- Solve the turbulence equations and correct the turbulence viscosity
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -212,6 +212,12 @@ public:
|
||||
//- Return the turbulence thermal diffusivity
|
||||
virtual tmp<volScalarField> alphat() const = 0;
|
||||
|
||||
//- Return the turbulence thermal diffusivity for a patch
|
||||
virtual tmp<scalarField> alphat(const label patchI) const
|
||||
{
|
||||
return alphat()().boundaryField()[patchI];
|
||||
}
|
||||
|
||||
//- Return the effective turbulence temperature diffusivity
|
||||
virtual tmp<volScalarField> kappaEff() const = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user