diff --git a/dumux/material/fluidmatrixinteractions/2p/efftoabslawparams.hh b/dumux/material/fluidmatrixinteractions/2p/efftoabslawparams.hh index 4a432d8633a34deda5e3c49040ecfb511c4fc580..31698c304463f7971c65fb59d55f0bd35121c377 100644 --- a/dumux/material/fluidmatrixinteractions/2p/efftoabslawparams.hh +++ b/dumux/material/fluidmatrixinteractions/2p/efftoabslawparams.hh @@ -26,6 +26,8 @@ #ifndef DUMUX_EFF_TO_ABS_LAW_PARAMS_HH #define DUMUX_EFF_TO_ABS_LAW_PARAMS_HH +#include <dune/common/float_cmp.hh> + namespace Dumux { /*! @@ -45,6 +47,17 @@ public: : EffLawParams() { swr_ = snr_ = 0; } + /*! + * \brief Equality comparison with another set of params + */ + template<class OtherParams> + bool operator== (const OtherParams& otherParams) const + { + return Dune::FloatCmp::eq(swr_, otherParams.swr(), /*eps*/1e-6*swr_) + && Dune::FloatCmp::eq(snr_, otherParams.snr(), /*eps*/1e-6*snr_) + && EffLawParamsT::operator==(otherParams); + } + /*! * \brief Return the residual wetting saturation. */ diff --git a/dumux/material/fluidmatrixinteractions/2p/regularizedvangenuchtenparams.hh b/dumux/material/fluidmatrixinteractions/2p/regularizedvangenuchtenparams.hh index 62d1f79962547203430d771cffc1719bdf69f163..d968cb98a47973131a98ef778a557547d2aea288 100644 --- a/dumux/material/fluidmatrixinteractions/2p/regularizedvangenuchtenparams.hh +++ b/dumux/material/fluidmatrixinteractions/2p/regularizedvangenuchtenparams.hh @@ -26,6 +26,8 @@ #ifndef REGULARIZED_VAN_GENUCHTEN_PARAMS_HH #define REGULARIZED_VAN_GENUCHTEN_PARAMS_HH +#include <dune/common/float_cmp.hh> + #include "vangenuchtenparams.hh" namespace Dumux @@ -53,6 +55,19 @@ public: initialize(); } + /*! + * \brief Equality comparison with another set of params + */ + template<class OtherParams> + bool operator== (const OtherParams& otherParams) const + { + return Dune::FloatCmp::eq(pcLowSw_, otherParams.pcLowSw(), /*eps*/1e-6*pcLowSw_) + && Dune::FloatCmp::eq(pcHighSw_, otherParams.pcHighSw(), /*eps*/1e-6*pcHighSw_) + && Dune::FloatCmp::eq(krnLowSw_, otherParams.krnLowSw(), /*eps*/1e-6*krnLowSw_) + && Dune::FloatCmp::eq(krwHighSw_, otherParams.krwHighSw(), /*eps*/1e-6*krwHighSw_) + && Parent::operator==(otherParams); + } + /*! * \brief Sets some default regularization thresholds */ diff --git a/dumux/material/fluidmatrixinteractions/2p/vangenuchtenparams.hh b/dumux/material/fluidmatrixinteractions/2p/vangenuchtenparams.hh index 0513827e00d9ac0e6cc6b916451e09694fdb45cd..1d948e4cd6f3073717eb12104c2605a46c2091f3 100644 --- a/dumux/material/fluidmatrixinteractions/2p/vangenuchtenparams.hh +++ b/dumux/material/fluidmatrixinteractions/2p/vangenuchtenparams.hh @@ -25,6 +25,8 @@ #ifndef VAN_GENUCHTEN_PARAMS_HH #define VAN_GENUCHTEN_PARAMS_HH +#include <dune/common/float_cmp.hh> + namespace Dumux { /*! @@ -50,6 +52,16 @@ public: setVgn(vgn); } + /*! + * \brief Equality comparison with another set of params + */ + template<class OtherParams> + bool operator== (const OtherParams& otherParams) const + { + return Dune::FloatCmp::eq(vgAlpha_, otherParams.vgAlpha(), /*eps*/1e-6*vgAlpha_) + && Dune::FloatCmp::eq(vgn_, otherParams.vgn(), /*eps*/1e-6*vgn_); + } + /*! * \brief Return the \f$\mathrm{\alpha}\f$ shape parameter \f$\mathrm{[1/Pa]}\f$ of van Genuchten's * curve. diff --git a/dumux/porousmediumflow/2p/boxmaterialinterfaceparams.hh b/dumux/porousmediumflow/2p/boxmaterialinterfaceparams.hh index 4c50018aedbfbbe71b542a746a11d66dd1b75065..7a1905049f32bc27117898d7b00b54e8129483bc 100644 --- a/dumux/porousmediumflow/2p/boxmaterialinterfaceparams.hh +++ b/dumux/porousmediumflow/2p/boxmaterialinterfaceparams.hh @@ -73,7 +73,7 @@ public: DUNE_THROW(Dune::InvalidStateException, "Determination of the interface material parameters with " "this class only makes sense when using the box method!"); - isOnMaterialInterface_.resize(fvGridGeometry.numDofs(), true); + isOnMaterialInterface_.resize(fvGridGeometry.numDofs(), false); dofParams_.resize(fvGridGeometry.numDofs(), nullptr); for (const auto& element : elements(fvGridGeometry.gridView())) { @@ -85,13 +85,20 @@ public: { const auto& params = spatialParams.materialLawParams(element, scv, elemSol); - // is no parameters had been set, set them now + // if no parameters had been set, set them now if (dofParams_[scv.dofIndex()] == nullptr) dofParams_[scv.dofIndex()] = ¶ms; // otherwise only use the current ones if endPointPc (e.g. Brooks-Corey entry pressure) is lower else if (MaterialLaw::endPointPc( params ) < MaterialLaw::endPointPc( *(dofParams_[scv.dofIndex()]) )) + { dofParams_[scv.dofIndex()] = ¶ms; + isOnMaterialInterface_[scv.dofIndex()] = true; + } + + // keep track of material interfaces in any case + else if ( !(params == *(dofParams_[scv.dofIndex()])) ) + isOnMaterialInterface_[scv.dofIndex()] = true; } } }