Commit 4575b4d9 authored by Kilian Weishaupt's avatar Kilian Weishaupt Committed by Ned Coltman
Browse files

[sagd][zerohyst] Adapt to new material law

parent 68f6c5ed
...@@ -27,9 +27,9 @@ ...@@ -27,9 +27,9 @@
#include <algorithm> #include <algorithm>
#include "parkervangenuchtenzerohysteresisparams.hh" #include <dumux/material/fluidmatrixinteractions/fluidmatrixinteraction.hh>
namespace Dumux { namespace Dumux::FluidMatrix {
/*! /*!
* \brief Implementation of van Genuchten's capillary pressure <-> * \brief Implementation of van Genuchten's capillary pressure <->
* saturation relation. This class bundles the "raw" curves * saturation relation. This class bundles the "raw" curves
...@@ -38,117 +38,290 @@ namespace Dumux { ...@@ -38,117 +38,290 @@ namespace Dumux {
* *
* \sa VanGenuchten, VanGenuchtenThreephase * \sa VanGenuchten, VanGenuchtenThreephase
*/ */
template <class ScalarT, class ParamsT = ParkerVanGenZeroHyst3PParams<ScalarT> > template <class ScalarT>
class ParkerVanGenZeroHyst3P class ParkerVanGenZeroHyst3P : Adapter<ParkerVanGenZeroHyst3P<ScalarT>, ThreePhasePcKrSw>
{ {
public: public:
using Params = ParamsT; using Scalar = ScalarT;
using Scalar = typename Params::Scalar;
/*! /*!
* \brief The capillary pressure-saturation curve. * \brief The parameter type
* * \tparam Scalar The scalar type
*/ */
static Scalar pc(const Params &params, Scalar sw) struct Params
{ {
DUNE_THROW(Dune::NotImplemented, "Capillary pressures for three phases is not so simple! Use pcgn, pcnw, and pcgw"); Params()
} {
betaGw_ = betaNw_ = betaGn_ = 1.;
}
DUNE_DEPRECATED_MSG("use pc() (uncapitalized 'c') instead") Params(Scalar vgAlpha,
static Scalar pC(const Params &params, Scalar swe) Scalar vgn,
{ Dune::FieldVector<Scalar, 4> residualSaturation,
return pc(params, swe); Scalar betaNw = 1.,
} Scalar betaGn = 1.,
Scalar betaGw = 1.,
bool regardSnr = false,
Scalar TrappedSatN = 1.)
{
setVgAlpha(vgAlpha);
setVgn(vgn);
setSwr(residualSaturation[0]);
setSnr(residualSaturation[1]);
setSgr(residualSaturation[2]);
setSwrx(residualSaturation[3]);
setBetaNw(betaNw);
setBetaGn(betaGn);
setBetaGw(betaGw);
setTrappedSatN(TrappedSatN);
};
Scalar TrappedSatN() const
{
return TrappedSatN_;
}
static Scalar pcgw(const Params &params, Scalar sw) void setTrappedSatN(Scalar v)
{ {
return 0; TrappedSatN_ = v;
} }
DUNE_DEPRECATED_MSG("use pcgw() (uncapitalized 'cgw') instead") /*!
static Scalar pCGW(const Params &params, Scalar sw) * \brief Return the \f$\alpha\f$ shape parameter of van Genuchten's
{ * curve.
return pcgw(params, sw); */
} Scalar vgAlpha() const
{
return vgAlpha_;
}
static Scalar pcnw(const Params &params, Scalar sw) /*!
{ * \brief Set the \f$\alpha\f$ shape parameter of van Genuchten's
return 0; * curve.
} */
void setVgAlpha(Scalar v)
{
vgAlpha_ = v;
}
DUNE_DEPRECATED_MSG("use pcnw() (uncapitalized 'cnw') instead") /*!
static Scalar pCNW(const Params &params, Scalar sw) * \brief Return the \f$m\f$ shape parameter of van Genuchten's
{ * curve.
return pcnw(params, sw); */
} Scalar vgm() const
{
return vgm_;
}
static Scalar pcgn(const Params &params, Scalar St) /*!
{ * \brief Set the \f$m\f$ shape parameter of van Genuchten's
return 0; * curve.
} *
* The \f$n\f$ shape parameter is set to \f$n = \frac{1}{1 - m}\f$
*/
void setVgm(Scalar m)
{
vgm_ = m; vgn_ = 1/(1 - vgm_);
}
DUNE_DEPRECATED_MSG("use pcgn() (uncapitalized 'cgn') instead") /*!
static Scalar pCGN(const Params &params, Scalar St) * \brief Return the \f$n\f$ shape parameter of van Genuchten's
{ * curve.
return pcgn(params, St); */
} Scalar vgn() const
{
return vgn_;
}
static Scalar pcAlpha(const Params &params, Scalar sn) /*!
{ * \brief Set the \f$n\f$ shape parameter of van Genuchten's
return(1); * curve.
} *
* The \f$n\f$ shape parameter is set to \f$m = 1 - \frac{1}{n}\f$
*/
void setVgn(Scalar n)
{
vgn_ = n; vgm_ = 1 - 1/vgn_;
}
DUNE_DEPRECATED_MSG("use pcAlpha() (uncapitalized 'c') instead") /*!
static Scalar pCAlpha(const Params &params, Scalar sn) * \brief Return the residual saturation.
{ */
return pcAlpha(params, sn); Scalar satResidual(int phaseIdx) const
} {
switch (phaseIdx)
{
case 0:
return swr_;
break;
case 1:
return snr_;
break;
case 2:
return sgr_;
break;
}
DUNE_THROW(Dune::InvalidStateException, "Invalid phase index " << phaseIdx);
}
/*! /*!
* \brief The saturation-capillary pressure curve. * \brief Set all residual saturations.
* */
*/ void setResiduals(Dune::FieldVector<Scalar, 3> residualSaturation)
static Scalar sw(const Params &params, Scalar pc) {
{ setSwr(residualSaturation[0]);
DUNE_THROW(Dune::NotImplemented, "sw(pc) for three phases not implemented! Do it yourself!"); setSnr(residualSaturation[1]);
} setSgr(residualSaturation[2]);
}
DUNE_DEPRECATED_MSG("use sw() (uncapitalized 's') instead")
static Scalar Sw(const Params &params, Scalar pc)
{
return sw(params, pc);
}
/*! /*!
* \brief Returns the partial derivative of the capillary * \brief Return the residual wetting saturation.
* pressure to the effective saturation. */
* Scalar swr() const
*/ {
static Scalar dpc_dsw(const Params &params, Scalar sw) return swr_;
{ }
DUNE_THROW(Dune::NotImplemented, "dpc/dsw for three phases not implemented! Do it yourself!");
}
DUNE_DEPRECATED_MSG("use dpc_dsw() (uncapitalized 'c', 's') instead") /*!
static Scalar dpC_dSw(const Params &params, Scalar sw) * \brief Set the residual wetting saturation.
{ */
return dpc_dsw(params, sw); void setSwr(Scalar input)
} {
swr_ = input;
}
/*! /*!
* \brief Returns the partial derivative of the effective * \brief Return the residual nonwetting saturation.
* saturation to the capillary pressure. */
*/ Scalar snr() const
static Scalar dsw_dpc(const Params &params, Scalar pc) {
{ return snr_;
DUNE_THROW(Dune::NotImplemented, "dsw/dpc for three phases not implemented! Do it yourself!"); }
}
DUNE_DEPRECATED_MSG("use dsw_dpc() (uncapitalized 's', 'c') instead") /*!
static Scalar dSw_dpC(const Params &params, Scalar pc) * \brief Set the residual nonwetting saturation.
{ */
return dsw_dpc(params, pc); void setSnr(Scalar input)
} {
snr_ = input;
}
/*!
* \brief Return the residual gas saturation.
*/
Scalar sgr() const
{
return sgr_;
}
/*!
* \brief Set the residual gas saturation.
*/
void setSgr(Scalar input)
{
sgr_ = input;
}
Scalar swrx() const
{
return swrx_;
}
/*!
* \brief Set the residual gas saturation.
*/
void setSwrx(Scalar input)
{
swrx_ = input;
}
/*!
* \brief defines the scaling parameters of capillary pressure between the phases (=1 for Gas-Water)
*/
void setBetaNw(Scalar input)
{
betaNw_ = input;
}
void setBetaGn(Scalar input)
{
betaGn_ = input;
}
void setBetaGw(Scalar input)
{
betaGw_ = input;
}
/*!
* \brief Return the values for the beta scaling parameters of capillary pressure between the phases
*/
Scalar betaNw() const
{
return betaNw_;
}
Scalar betaGn() const
{
return betaGn_;
}
Scalar betaGw() const
{
return betaGw_;
}
bool krRegardsSnr() const
{
return krRegardsSnr_;
}
/*!
* \brief defines if residual n-phase saturation should be regarded in its relative permeability.
*/
void setKrRegardsSnr(bool input)
{
krRegardsSnr_ = input;
}
private:
Scalar vgAlpha_;
Scalar vgm_;
Scalar vgn_;
Scalar swr_;
Scalar snr_;
Scalar sgr_;
Scalar swrx_; /* (sw+sn)_r */
Scalar betaNw_;
Scalar betaGn_;
Scalar betaGw_;
Scalar TrappedSatN_;
bool krRegardsSnr_ ;
};
ParkerVanGenZeroHyst3P(const Params& params)
: params_(params)
{}
Scalar pcgw(const Scalar sw, const Scalar sn) const
{ return 0;}
Scalar pcnw(const Scalar sw, const Scalar sn) const
{ return 0; }
Scalar pcgn(const Scalar sw, const Scalar sn) const
{ return 0; }
Scalar pcAlpha(const Scalar sw, const Scalar sn) const
{ return 1; }
void updateTappedSn(const Scalar trappedSn)
{ params_.setTrappedSatN(trappedSn); }
/*! /*!
* \brief The relative permeability for the wetting phase of * \brief The relative permeability for the wetting phase of
...@@ -159,15 +332,13 @@ public: ...@@ -159,15 +332,13 @@ public:
* (see p61. in "Comparison of the Three-Phase Oil Relative Permeability Models" * (see p61. in "Comparison of the Three-Phase Oil Relative Permeability Models"
* MOJDEH DELSHAD and GARY A. POPE, Transport in Porous Media 4 (1989), 59-83.) * MOJDEH DELSHAD and GARY A. POPE, Transport in Porous Media 4 (1989), 59-83.)
* *
* \param sw saturation saturation of the water phase.
* \param sn saturation of the NAPL phase. * \param sn saturation of the NAPL phase.
* \param sg saturation of the gas phase.
* \param saturation saturation of the water phase.
* \param params Array of parameters.
*/ */
static Scalar krw(const Params &params, Scalar saturation, Scalar sn, Scalar sg) Scalar krw(const Scalar sw, const Scalar sn) const
{ {
//transformation to effective saturation //transformation to effective saturation
Scalar se = (saturation - params.swr()) / (1-params.TrappedSatN()-params.swr()); const Scalar se = (sw - params_.swr()) / (1 - params_.TrappedSatN() - params_.swr());
// regularization // regularization
if (se > 1.0) if (se > 1.0)
...@@ -175,7 +346,7 @@ public: ...@@ -175,7 +346,7 @@ public:
if (se < 0.0) if (se < 0.0)
return 0.; return 0.;
Scalar r = 1. - std::pow(1 - std::pow(se, 1/params.vgm()), params.vgm()); const Scalar r = 1. - std::pow(1 - std::pow(se, 1/params_.vgm()), params_.vgm());
return std::sqrt(se)*r*r; return std::sqrt(se)*r*r;
}; };
...@@ -192,15 +363,13 @@ public: ...@@ -192,15 +363,13 @@ public:
* Journal of Contaminant Hydrology 66 (2003), 261-285 * Journal of Contaminant Hydrology 66 (2003), 261-285
* *
* *
* \param sw saturation of the water phase. * \param sw saturation saturation of the water phase.
* \param sg saturation of the gas phase. * \param sn saturation of the NAPL phase.
* \param saturation saturation of the NAPL phase.
* \param params Array of parameters.
*/ */
static Scalar krn(const Params &params, Scalar sw, Scalar saturation, Scalar sg) Scalar krn(const Scalar sw, const Scalar sn) const
{ {
Scalar swe = std::min((sw - params.swr()) / (1 - params.TrappedSatN()- params.swr()), 1.); Scalar swe = std::min((sw - params_.swr()) / (1 - params_.TrappedSatN()- params_.swr()), 1.);
Scalar ste = std::min((sw + saturation - params.swr()) / (1 - params.swr()), 1.); Scalar ste = std::min((sw + sn - params_.swr()) / (1 - params_.swr()), 1.);
// regularization // regularization
if (swe <= 0.0) if (swe <= 0.0)
...@@ -211,19 +380,19 @@ public: ...@@ -211,19 +380,19 @@ public:
return 0.; return 0.;
Scalar krn_; Scalar krn_;
krn_ = std::pow(1 - std::pow(swe, 1/params.vgm()), params.vgm()); krn_ = std::pow(1 - std::pow(swe, 1/params_.vgm()), params_.vgm());
krn_ -= std::pow(1 - std::pow(ste, 1/params.vgm()), params.vgm()); krn_ -= std::pow(1 - std::pow(ste, 1/params_.vgm()), params_.vgm());
krn_ *= krn_; krn_ *= krn_;
if (params.krRegardsSnr()) if (params_.krRegardsSnr())
{ {
// regard Snr in the permeability of the n-phase, see Helmig1997 // regard Snr in the permeability of the n-phase, see Helmig1997
Scalar resIncluded = std::max(std::min((saturation - params.snr()/ (1-params.swr())), 1.), 0.); const Scalar resIncluded = std::max(std::min((sn - params_.snr()/ (1-params_.swr())), 1.), 0.);
krn_ *= std::sqrt(resIncluded ); krn_ *= std::sqrt(resIncluded );
} }
else else
krn_ *= std::sqrt(saturation / (1 - params.swr())); // Hint: (ste - swe) = sn / (1-Srw) krn_ *= std::sqrt(sn / (1 - params_.swr())); // Hint: (ste - swe) = sn / (1-Srw)
return krn_; return krn_;
}; };
...@@ -237,15 +406,13 @@ public: ...@@ -237,15 +406,13 @@ public:
* (see p61. in "Comparison of the Three-Phase Oil Relative Permeability Models" * (see p61. in "Comparison of the Three-Phase Oil Relative Permeability Models"
* MOJDEH DELSHAD and GARY A. POPE, Transport in Porous Media 4 (1989), 59-83.) * MOJDEH DELSHAD and GARY A. POPE, Transport in Porous Media 4 (1989), 59-83.)
* *
* \param sw saturation of the water phase. * \param sw saturation saturation of the water phase.
* \param sn saturation of the NAPL phase. * \param sn saturation of the NAPL phase.
* \param saturation saturation of the gas phase.
* \param params Array of parameters.
*/ */
static Scalar krg(const Params &params, Scalar sw, Scalar sn, Scalar saturation) Scalar krg(const Scalar sw, const Scalar sn) const
{ {
// se = (sw+sn - Sgr)/(1-Sgr) const Scalar st = sw + sn;
Scalar se = std::min(((1-saturation) - params.sgr()) / (1 - params.sgr()), 1.); const Scalar se = std::min(((1-st) - params_.sgr()) / (1 - params_.sgr()), 1.);
// regularization // regularization
if (se > 1.0) if (se > 1.0)
...@@ -255,55 +422,44 @@ public: ...@@ -255,55 +422,44 @@ public:
Scalar scalFact = 1.; Scalar scalFact = 1.;
if (saturation<=0.1) if (st<=0.1)
{ {
scalFact = (saturation - params.sgr())/(0.1 - params.sgr()); scalFact = (st - params_.sgr())/(0.1 - params_.sgr());
if (scalFact < 0.) if (scalFact < 0.)
scalFact = 0.; scalFact = 0.;
} }
Scalar result = scalFact * std::pow(1 - se, 1.0/3.) * std::pow(1 - std::pow(se, 1/params.vgm()), 2*params.vgm()); return scalFact * std::pow(1 - se, 1.0/3.) * std::pow(1 - std::pow(se, 1/params_.vgm()), 2*params_.vgm());
return result;
}; };
/*! /*!
* \brief The relative permeability for a phase. * \brief The relative permeability for a phase.
* \param sw saturation of the water phase. * \param sw saturation saturation of the water phase.
* \param sg saturation of the gas phase.
* \param sn saturation of the NAPL phase. * \param sn saturation of the NAPL phase.
* \param params Array of parameters.
* \param phase indicator, The saturation of all phases. * \param phase indicator, The saturation of all phases.
*/ */
static Scalar kr(const Params &params, const int phase, const Scalar sw, const Scalar sn, const Scalar sg) Scalar kr(const int phaseIdx, const Scalar sw, const Scalar sn) const
{ {
switch (phase) switch (phaseIdx)
{ {
case 0: case 0:
return krw(params, sw, sn, sg); return krw(sw, sn);
break; break;
case 1: case 1:
return krn(params, sw, sn, sg); return krn(sw, sn);
break; break;
case 2: case 2:
return krg(params, sw, sn, sg); return krg(sw, sn);
break; break;
} }