Skip to content
Snippets Groups Projects
Commit 54d13d38 authored by Dennis Gläser's avatar Dennis Gläser
Browse files

[mineralization] simplify porosityprecipitation law

parent a805d433
No related branches found
No related tags found
1 merge request!889Feature/simplify perm poro laws
......@@ -24,7 +24,6 @@
#ifndef DUMUX_POROSITY_PRECIPITATION_HH
#define DUMUX_POROSITY_PRECIPITATION_HH
#include <dumux/common/properties.hh>
#include <dumux/discretization/evalsolution.hh>
namespace Dumux {
......@@ -32,58 +31,39 @@ namespace Dumux {
/*!
* \ingroup Fluidmatrixinteractions
* \brief Calculates the porosity depending on the volume fractions of precipitated minerals.
*
* \tparam Scalar The type used for scalar values
* \numComp The number of components in the fluid phases
* \numSolidPhases The number of precipitating solid phases
*/
template<class TypeTag>
template<class Scalar, int numComp, int numSolidPhases>
class PorosityPrecipitation
{
using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
using Problem = typename GET_PROP_TYPE(TypeTag, Problem);
using GridView = typename GET_PROP_TYPE(TypeTag, GridView);
using SpatialParams = typename GET_PROP_TYPE(TypeTag, SpatialParams);
using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVGridGeometry)::LocalView;
using SubControlVolume = typename FVElementGeometry::SubControlVolume;
static const int dim = GridView::dimension;
static const int dimWorld = GridView::dimensionworld;
static const int numComponents = GET_PROP_TYPE(TypeTag, ModelTraits)::numComponents();
static const int numSolidPhases = GET_PROP_TYPE(TypeTag, ModelTraits)::numSPhases();
using Element = typename GridView::template Codim<0>:: Entity;
public:
void init(const SpatialParams& spatialParams)
{
spatialParamsPtr_ = &spatialParams;
}
/*!
* \brief calculates the porosity in a sub-control volume
* \param element element
* \param elemSol the element solution
* \param scv sub control volume
* \param refPoro The solid matrix porosity without precipitates
* \param minPoro A minimum porosity value
*/
template<class ElementSolution>
template<class Element, class SubControlVolume, class ElemSol>
Scalar evaluatePorosity(const Element& element,
const SubControlVolume& scv,
const ElementSolution& elemSol) const
const ElemSol& elemSol,
Scalar refPoro,
Scalar minPoro = 0.0) const
{
auto priVars = evalSolution(element, element.geometry(), elemSol, scv.center());
Scalar sumPrecipitates = 0.0;
for (unsigned int solidPhaseIdx = 0; solidPhaseIdx < numSolidPhases; ++solidPhaseIdx)
sumPrecipitates += priVars[numComponents + solidPhaseIdx];
auto minPoro = spatialParams_().minPorosity(element, scv);
sumPrecipitates += priVars[numComp + solidPhaseIdx];
using std::max;
return max(minPoro, spatialParams_().referencePorosity(element, scv) - sumPrecipitates);
return max(minPoro, refPoro - sumPrecipitates);
}
private:
const SpatialParams& spatialParams_() const
{ return *spatialParamsPtr_; }
const SpatialParams* spatialParamsPtr_;
};
} // namespace Dumux
......
......@@ -83,7 +83,8 @@ class DissolutionSpatialparams : public FVSpatialParams<TypeTag>
using SubControlVolume = typename FVElementGeometry::SubControlVolume;
using Element = typename GridView::template Codim<0>::Entity;
using PorosityLaw = PorosityPrecipitation<TypeTag>;
using ModelTraits = typename GET_PROP_TYPE(TypeTag, ModelTraits);
using PorosityLaw = PorosityPrecipitation<Scalar, ModelTraits::numComponents(), ModelTraits::numSPhases()>;
using PermeabilityLaw = PermeabilityKozenyCarman<TypeTag>;
public:
......@@ -110,7 +111,6 @@ public:
materialParams_.setLambda(bcLambda1_);
//! Initialize the parameter laws
poroLaw_.init(*this);
permLaw_.init(*this);
}
......@@ -145,7 +145,7 @@ public:
Scalar porosity(const Element& element,
const SubControlVolume& scv,
const ElementSolution& elemSol) const
{ return poroLaw_.evaluatePorosity(element, scv, elemSol); }
{ return poroLaw_.evaluatePorosity(element, scv, elemSol, referencePorosity_, 1e-5); }
/*!
* \brief Define the reference permeability \f$[m^2]\f$ distribution
......
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