Skip to content
Snippets Groups Projects
Commit 21fa837b authored by Timo Koch's avatar Timo Koch
Browse files

[richards] Remove untransparent regularization leading to false pn output

parent 9d4bde5a
No related branches found
No related tags found
2 merge requests!617[WIP] Next,!360Improve Richards model - Add RichardsNC model
...@@ -87,7 +87,10 @@ public: ...@@ -87,7 +87,10 @@ public:
const auto& materialParams = problem.spatialParams().materialLawParams(element, scv, elemSol); const auto& materialParams = problem.spatialParams().materialLawParams(element, scv, elemSol);
relativePermeabilityWetting_ = MaterialLaw::krw(materialParams, fluidState_.saturation(wPhaseIdx)); relativePermeabilityWetting_ = MaterialLaw::krw(materialParams, fluidState_.saturation(wPhaseIdx));
pnRef_ = problem.nonWettingReferencePressure();
//! precompute the minimum capillary pressure (entry pressure)
minPc_ = MaterialLaw::pc(materialParams, /*Sw=*/ 1.0);
pn_ = problem.nonWettingReferencePressure();
porosity_ = problem.spatialParams().porosity(element, scv, elemSol); porosity_ = problem.spatialParams().porosity(element, scv, elemSol);
permeability_ = problem.spatialParams().permeability(element, scv, elemSol); permeability_ = problem.spatialParams().permeability(element, scv, elemSol);
} }
...@@ -107,21 +110,19 @@ public: ...@@ -107,21 +110,19 @@ public:
const auto& materialParams = problem.spatialParams().materialLawParams(element, scv, elemSol); const auto& materialParams = problem.spatialParams().materialLawParams(element, scv, elemSol);
const auto& priVars = ParentType::extractDofPriVars(elemSol, scv); const auto& priVars = ParentType::extractDofPriVars(elemSol, scv);
const Scalar minPc = MaterialLaw::pc(materialParams, 1.0); // set the wetting pressure
fluidState.setPressure(wPhaseIdx, priVars[pressureIdx]); fluidState.setPressure(wPhaseIdx, priVars[pressureIdx]);
using std::max; // compute the capillary pressure to compute the saturation
pn_ = max(problem.nonWettingReferencePressure(), priVars[pressureIdx] + minPc); // the material law takes care of cases where pc gets negative
const Scalar pc = problem.nonWettingReferencePressure() - fluidState.pressure(wPhaseIdx);
// saturations const Scalar sw = MaterialLaw::sw(materialParams, pc);
const Scalar sw = MaterialLaw::sw(materialParams, pn_ - fluidState.pressure(wPhaseIdx));
fluidState.setSaturation(wPhaseIdx, sw); fluidState.setSaturation(wPhaseIdx, sw);
// density and viscosity // density and viscosity
typename FluidSystem::ParameterCache paramCache; typename FluidSystem::ParameterCache paramCache;
paramCache.updateAll(fluidState); paramCache.updateAll(fluidState);
fluidState.setDensity(wPhaseIdx, FluidSystem::density(fluidState, paramCache, wPhaseIdx)); fluidState.setDensity(wPhaseIdx, FluidSystem::density(fluidState, paramCache, wPhaseIdx));
fluidState.setViscosity(wPhaseIdx, FluidSystem::viscosity(fluidState, paramCache, wPhaseIdx)); fluidState.setViscosity(wPhaseIdx, FluidSystem::viscosity(fluidState, paramCache, wPhaseIdx));
// compute and set the enthalpy // compute and set the enthalpy
...@@ -232,9 +233,15 @@ public: ...@@ -232,9 +233,15 @@ public:
* The capillary pressure is defined as the difference in * The capillary pressure is defined as the difference in
* pressures of the non-wetting and the wetting phase, i.e. * pressures of the non-wetting and the wetting phase, i.e.
* \f[ p_c = p_n - p_w \f] * \f[ p_c = p_n - p_w \f]
*
* \note Capillary pressures are always larger than the entry pressure
* This regularization doesn't affect the residual in which pc is not needed.
*/ */
Scalar capillaryPressure() const Scalar capillaryPressure() const
{ return pn_ - fluidState_.pressure(wPhaseIdx); } {
using std::max;
return max(minPc_, pn_ - fluidState_.pressure(wPhaseIdx));
}
/*! /*!
* \brief Returns the pressureHead \f$\mathrm{[cm]}\f$ of a given phase within * \brief Returns the pressureHead \f$\mathrm{[cm]}\f$ of a given phase within
...@@ -251,7 +258,7 @@ public: ...@@ -251,7 +258,7 @@ public:
* or the gravity different * or the gravity different
*/ */
Scalar pressureHead(const int phaseIdx) const Scalar pressureHead(const int phaseIdx) const
{ return 100.0 *(pressure(phaseIdx) - pnRef_)/density(phaseIdx)/9.81; } { return 100.0 *(pressure(phaseIdx) - pn_)/density(phaseIdx)/9.81; }
/*! /*!
* \brief Returns the water content * \brief Returns the water content
...@@ -268,12 +275,12 @@ public: ...@@ -268,12 +275,12 @@ public:
{ return saturation(phaseIdx) * porosity_; } { return saturation(phaseIdx) * porosity_; }
protected: protected:
FluidState fluidState_; FluidState fluidState_; //! the fluid state
Scalar relativePermeabilityWetting_; Scalar relativePermeabilityWetting_; //! the relative permeability of the wetting phase
Scalar porosity_; Scalar porosity_; //! the porosity
PermeabilityType permeability_; PermeabilityType permeability_; //! the instrinsic permeability
Scalar pnRef_; Scalar pn_; //! the reference non-wetting pressure
static Scalar pn_; Scalar minPc_; //! the minimum capillary pressure (entry pressure)
private: private:
Implementation &asImp_() Implementation &asImp_()
...@@ -283,9 +290,6 @@ private: ...@@ -283,9 +290,6 @@ private:
{ return *static_cast<const Implementation*>(this); } { return *static_cast<const Implementation*>(this); }
}; };
template <class TypeTag>
typename GET_PROP_TYPE(TypeTag, Scalar) RichardsVolumeVariables<TypeTag>::pn_;
} // end namespace Dumux } // end namespace Dumux
#endif #endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment