Loading...
Searching...
No Matches
TwoPhaseLETCurvesParams.hpp
Go to the documentation of this file.
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*
This file is part of the Open Porous Media project (OPM).
OPM 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.
OPM 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 OPM. If not, see <http://www.gnu.org/licenses/>.
Consult the COPYING file in the top-level source directory of this
module for the precise wording of the license and the list of
copyright holders.
*/
#ifndef OPM_TWO_PHASE_LET_CURVES_PARAMS_HPP
#define OPM_TWO_PHASE_LET_CURVES_PARAMS_HPP
#include <opm/material/common/Valgrind.hpp>
#include <opm/material/common/EnsureFinalized.hpp>
namespace Opm {
template <class TraitsT>
class TwoPhaseLETCurvesParams : public EnsureFinalized
{
using Scalar = typename TraitsT::Scalar;
public:
using Traits = TraitsT;
static constexpr int wIdx = 0; //wetting phase index for two phase let
static constexpr int nwIdx = 1; //non-wetting phase index for two phase let
TwoPhaseLETCurvesParams()
{
Valgrind::SetUndefined(*this);
}
virtual ~TwoPhaseLETCurvesParams() {}
void finalize()
{
EnsureFinalized :: finalize ();
// printLETCoeffs();
}
Scalar Smin(const unsigned phaseIdx) const
{ EnsureFinalized::check(); if (phaseIdx<Traits::numPhases) return Smin_[phaseIdx]; return 0.0;}
Scalar dS(const unsigned phaseIdx) const
{ EnsureFinalized::check(); if (phaseIdx<Traits::numPhases) return dS_[phaseIdx]; return 0.0;}
Scalar Sminpc() const
{ EnsureFinalized::check(); return Sminpc_; }
Scalar dSpc() const
{ EnsureFinalized::check(); return dSpc_; }
Scalar L(const unsigned phaseIdx) const
{ EnsureFinalized::check(); if (phaseIdx<Traits::numPhases) return L_[phaseIdx]; return 0.0;}
Scalar E(const unsigned phaseIdx) const
{ EnsureFinalized::check(); if (phaseIdx<Traits::numPhases) return E_[phaseIdx]; return 0.0;}
Scalar T(const unsigned phaseIdx) const
{ EnsureFinalized::check(); if (phaseIdx<Traits::numPhases) return T_[phaseIdx]; return 0.0;}
Scalar Krt(const unsigned phaseIdx) const
{ EnsureFinalized::check(); if (phaseIdx<Traits::numPhases) return Krt_[phaseIdx]; return 0.0;}
Scalar Lpc() const
{ EnsureFinalized::check(); return Lpc_; }
Scalar Epc() const
{ EnsureFinalized::check(); return Epc_; }
Scalar Tpc() const
{ EnsureFinalized::check(); return Tpc_; }
Scalar Pcir() const
{ EnsureFinalized::check(); return Pcir_; }
Scalar Pct() const
{ EnsureFinalized::check(); return Pct_; }
template <class Container>
void setKrwSamples(const Container& letProp, const Container& )
{
setLETCoeffs(wIdx, letProp[2], letProp[3], letProp[4], letProp[5]);
//Smin_[wIdx] = letProp[1];
//dS_[nwIdx] = 1.0 - letProp[0];
Smin_[wIdx] = letProp[0];
dS_[wIdx] = letProp[1] - letProp[0];
}
template <class Container>
void setKrnSamples(const Container& letProp, const Container& )
{
setLETCoeffs(nwIdx, letProp[2], letProp[3], letProp[4], letProp[5]);
//Smin_[nwIdx] = letProp[1];
//dS_[wIdx] = 1.0 - letProp[0];
Smin_[nwIdx] = letProp[0];
dS_[nwIdx] = letProp[1] - letProp[0];
}
template <class Container>
void setPcnwSamples(const Container& letProp, const Container& )
{
setLETPcCoeffs(letProp[2], letProp[3], letProp[4], letProp[5], letProp[6]);
Sminpc_ = letProp[0];
dSpc_ = 1.0 - letProp[0] - letProp[1];
}
private:
void setLETCoeffs(unsigned phaseIdx, Scalar L, Scalar E, Scalar T, Scalar Krt)
{
if (phaseIdx < Traits::numPhases) {
L_[phaseIdx]=L;
E_[phaseIdx]=E;
T_[phaseIdx]=T;
Krt_[phaseIdx]=Krt;
}
}
void setLETPcCoeffs(Scalar L, Scalar E, Scalar T, Scalar Pcir, Scalar Pct)
{
Lpc_=L;
Epc_=E;
Tpc_=T;
Pcir_=Pcir;
Pct_=Pct;
}
void printLETCoeffs()
{
/*
std::cout << "# LET parameters: "<< std::endl;
for (int i=0; i<Traits::numPhases; ++i) {
std::cout << "Kr[" << i;
std::cout << "]: Smin:" << Smin_[i];
std::cout << " dS:" << dS_[i];
std::cout << " L:" << L_[i];
std::cout << " E:" << E_[i];
std::cout << " T:" << T_[i];
std::cout << " Krt:" << Krt_[i];
std::cout << std::endl;
}
std::cout << "Pc: Smin:" << Sminpc_;
std::cout << " dS:" << dSpc_;
std::cout << " L:" << Lpc_;
std::cout << " E:" << Epc_;
std::cout << " T:" << Tpc_;
std::cout << " Pcir:" << Pcir_;
std::cout << " Pct:" << Pct_;
std::cout << std::endl;
std::cout << "================================="<< std::endl;
*/
}
Scalar Smin_[Traits::numPhases];
Scalar dS_[Traits::numPhases];
Scalar L_[Traits::numPhases];
Scalar E_[Traits::numPhases];
Scalar T_[Traits::numPhases];
Scalar Krt_[Traits::numPhases];
Scalar Sminpc_;
Scalar dSpc_;
Scalar Lpc_;
Scalar Epc_;
Scalar Tpc_;
Scalar Pcir_;
Scalar Pct_;
};
} // namespace Opm
#endif // OPM_TWO_PHASE_LET_CURVES_PARAMS_HPP
EnsureFinalized.hpp
Default implementation for asserting finalization of parameter objects.
Valgrind.hpp
Some templates to wrap the valgrind client request macros.
Opm::Valgrind::SetUndefined
OPM_HOST_DEVICE void SetUndefined(const T &value)
Make the memory on which an object resides undefined in valgrind runs.
Definition Valgrind.hpp:174
Opm::EnsureFinalized::EnsureFinalized
OPM_HOST_DEVICE EnsureFinalized()
The default constructor.
Definition EnsureFinalized.hpp:58
Opm::TwoPhaseLETCurvesParams::Sminpc
Scalar Sminpc() const
Returns the Epc_ parameter.
Definition TwoPhaseLETCurvesParams.hpp:87
Opm::TwoPhaseLETCurvesParams::setPcnwSamples
void setPcnwSamples(const Container &letProp, const Container &)
Set the LET-related parameters for the capillary pressure curve of the non-wetting phase.
Definition TwoPhaseLETCurvesParams.hpp:190
Opm::TwoPhaseLETCurvesParams::Smin
Scalar Smin(const unsigned phaseIdx) const
Returns the Smin_ parameter.
Definition TwoPhaseLETCurvesParams.hpp:75
Opm::TwoPhaseLETCurvesParams::finalize
void finalize()
Calculate all dependent quantities once the independent quantities of the parameter object have been ...
Definition TwoPhaseLETCurvesParams.hpp:65
Opm::TwoPhaseLETCurvesParams::T
Scalar T(const unsigned phaseIdx) const
Returns the T_ parameter.
Definition TwoPhaseLETCurvesParams.hpp:111
Opm::TwoPhaseLETCurvesParams::dSpc
Scalar dSpc() const
Returns the Epc_ parameter.
Definition TwoPhaseLETCurvesParams.hpp:93
Opm::TwoPhaseLETCurvesParams::Epc
Scalar Epc() const
Returns the Epc_ parameter.
Definition TwoPhaseLETCurvesParams.hpp:129
Opm::TwoPhaseLETCurvesParams::L
Scalar L(const unsigned phaseIdx) const
Returns the L_ parameter.
Definition TwoPhaseLETCurvesParams.hpp:99
Opm::TwoPhaseLETCurvesParams::dS
Scalar dS(const unsigned phaseIdx) const
Returns the dS_ parameter.
Definition TwoPhaseLETCurvesParams.hpp:81
Opm::TwoPhaseLETCurvesParams::Lpc
Scalar Lpc() const
Returns the Lpc_ parameter.
Definition TwoPhaseLETCurvesParams.hpp:123
Opm::TwoPhaseLETCurvesParams::E
Scalar E(const unsigned phaseIdx) const
Returns the E_ parameter.
Definition TwoPhaseLETCurvesParams.hpp:105
Opm::TwoPhaseLETCurvesParams::setKrwSamples
void setKrwSamples(const Container &letProp, const Container &)
Set the LET-related parameters for the relative permeability curve of the wetting phase.
Definition TwoPhaseLETCurvesParams.hpp:157
Opm::TwoPhaseLETCurvesParams::Krt
Scalar Krt(const unsigned phaseIdx) const
Returns the Krt_ parameter.
Definition TwoPhaseLETCurvesParams.hpp:117
Opm::TwoPhaseLETCurvesParams::setKrnSamples
void setKrnSamples(const Container &letProp, const Container &)
Set the LET-related parameters for the relative permeability curve of the non-wetting phase.
Definition TwoPhaseLETCurvesParams.hpp:173
Opm::TwoPhaseLETCurvesParams::Pct
Scalar Pct() const
Returns the Pct_ parameter.
Definition TwoPhaseLETCurvesParams.hpp:147
Opm::TwoPhaseLETCurvesParams::Pcir
Scalar Pcir() const
Returns the Pcir_ parameter.
Definition TwoPhaseLETCurvesParams.hpp:141
Opm::TwoPhaseLETCurvesParams::Tpc
Scalar Tpc() const
Returns the Tpc_ parameter.
Definition TwoPhaseLETCurvesParams.hpp:135
Opm
This class implements a small container which holds the transmissibility mulitpliers for all the face...
Definition Exceptions.hpp:30