Skip to content
Snippets Groups Projects
Commit 2d24a393 authored by Dennis Gläser's avatar Dennis Gläser Committed by Timo Koch
Browse files

port 2p model to new parameter interface

The box test passes here, but strangely the cc test fails
parent 5358d2f2
No related branches found
No related tags found
2 merge requests!617[WIP] Next,!318Unified Spatialparams interface, improved vtk output module
...@@ -42,19 +42,20 @@ namespace Dumux ...@@ -42,19 +42,20 @@ namespace Dumux
template <class TypeTag> template <class TypeTag>
class TwoPVolumeVariables : public ImplicitVolumeVariables<TypeTag> class TwoPVolumeVariables : public ImplicitVolumeVariables<TypeTag>
{ {
typedef ImplicitVolumeVariables<TypeTag> ParentType; using ParentType = ImplicitVolumeVariables<TypeTag>;
typedef typename GET_PROP_TYPE(TypeTag, VolumeVariables) Implementation; using Implementation = typename GET_PROP_TYPE(TypeTag, VolumeVariables);
typedef typename GET_PROP_TYPE(TypeTag, Scalar) Scalar; using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar);
typedef typename GET_PROP_TYPE(TypeTag, Problem) Problem; using Problem = typename GET_PROP_TYPE(TypeTag, Problem);
typedef typename GET_PROP_TYPE(TypeTag, FluidSystem) FluidSystem; using Indices = typename GET_PROP_TYPE(TypeTag, Indices);
typedef typename GET_PROP_TYPE(TypeTag, MaterialLaw) MaterialLaw; using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem);
typedef typename GET_PROP_TYPE(TypeTag, FVElementGeometry) FVElementGeometry; using MaterialLaw = typename GET_PROP_TYPE(TypeTag, MaterialLaw);
typedef typename GET_PROP_TYPE(TypeTag, SubControlVolume) SubControlVolume; using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry);
typedef typename GET_PROP_TYPE(TypeTag, PrimaryVariables) PrimaryVariables; using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume);
using ElementSolutionVector = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector);
typedef typename GET_PROP_TYPE(TypeTag, Indices) Indices;
enum { enum
{
pwsn = Indices::pwsn, pwsn = Indices::pwsn,
pnsw = Indices::pnsw, pnsw = Indices::pnsw,
pressureIdx = Indices::pressureIdx, pressureIdx = Indices::pressureIdx,
...@@ -65,26 +66,29 @@ class TwoPVolumeVariables : public ImplicitVolumeVariables<TypeTag> ...@@ -65,26 +66,29 @@ class TwoPVolumeVariables : public ImplicitVolumeVariables<TypeTag>
formulation = GET_PROP_VALUE(TypeTag, Formulation) formulation = GET_PROP_VALUE(TypeTag, Formulation)
}; };
typedef typename GET_PROP_TYPE(TypeTag, GridView) GridView; using GridView = typename GET_PROP_TYPE(TypeTag, GridView);
typedef typename GridView::template Codim<0>::Entity Element; using Element = typename GridView::template Codim<0>::Entity;
static constexpr bool isBox = GET_PROP_VALUE(TypeTag, ImplicitIsBox);
public: public:
// export type of fluid state for non-isothermal models // export type of fluid state for non-isothermal models
typedef typename GET_PROP_TYPE(TypeTag, FluidState) FluidState; using FluidState = typename GET_PROP_TYPE(TypeTag, FluidState);
using typename ParentType::PermeabilityType;
/*! /*!
* \copydoc ImplicitVolumeVariables::update * \copydoc ImplicitVolumeVariables::update
*/ */
void update(const PrimaryVariables &priVars, void update(const ElementSolutionVector &elemSol,
const Problem &problem, const Problem &problem,
const Element &element, const Element &element,
const SubControlVolume& scv) const SubControlVolume& scv)
{ {
ParentType::update(priVars, problem, element, scv); ParentType::update(elemSol, problem, element, scv);
completeFluidState(priVars, problem, element, scv, fluidState_); completeFluidState(elemSol, problem, element, scv, fluidState_);
const auto& materialParams = problem.spatialParams().materialLawParams(element, scv); const auto& materialParams = problem.spatialParams().materialLawParams(element, scv, elemSol);
mobility_[wPhaseIdx] = mobility_[wPhaseIdx] =
MaterialLaw::krw(materialParams, fluidState_.saturation(wPhaseIdx)) MaterialLaw::krw(materialParams, fluidState_.saturation(wPhaseIdx))
...@@ -95,25 +99,27 @@ public: ...@@ -95,25 +99,27 @@ public:
/ fluidState_.viscosity(nPhaseIdx); / fluidState_.viscosity(nPhaseIdx);
// porosity // porosity
porosity_ = problem.spatialParams().porosity(scv); porosity_ = problem.spatialParams().porosity(element, scv, elemSol);
permeability_ = problem.spatialParams().permeability(element, scv, elemSol);
// energy related quantities not belonging to the fluid state // energy related quantities not belonging to the fluid state
asImp_().updateEnergy_(priVars, problem, element, scv); asImp_().updateEnergy_(elemSol, problem, element, scv);
} }
/*! /*!
* \copydoc ImplicitModel::completeFluidState * \copydoc ImplicitModel::completeFluidState
*/ */
static void completeFluidState(const PrimaryVariables& priVars, static void completeFluidState(const ElementSolutionVector& elemSol,
const Problem& problem, const Problem& problem,
const Element& element, const Element& element,
const SubControlVolume& scv, const SubControlVolume& scv,
FluidState& fluidState) FluidState& fluidState)
{ {
Scalar t = Implementation::temperature_(priVars, problem, element, scv); Scalar t = Implementation::temperature_(elemSol, problem, element, scv);
fluidState.setTemperature(t); fluidState.setTemperature(t);
const auto& materialParams = problem.spatialParams().materialLawParams(element, scv); const auto& materialParams = problem.spatialParams().materialLawParams(element, scv, elemSol);
const auto& priVars = isBox ? elemSol[scv.index()] : elemSol[0];
if (int(formulation) == pwsn) { if (int(formulation) == pwsn) {
Scalar sn = priVars[saturationIdx]; Scalar sn = priVars[saturationIdx];
...@@ -229,8 +235,14 @@ public: ...@@ -229,8 +235,14 @@ public:
Scalar porosity() const Scalar porosity() const
{ return porosity_; } { return porosity_; }
/*!
* \brief Returns the permeability within the control volume in \f$[m^2]\f$.
*/
PermeabilityType permeability() const
{ return permeability_; }
protected: protected:
static Scalar temperature_(const PrimaryVariables &priVars, static Scalar temperature_(const ElementSolutionVector &elemSol,
const Problem& problem, const Problem& problem,
const Element &element, const Element &element,
const SubControlVolume &scv) const SubControlVolume &scv)
...@@ -249,14 +261,15 @@ protected: ...@@ -249,14 +261,15 @@ protected:
/*! /*!
* \brief Called by update() to compute the energy related quantities. * \brief Called by update() to compute the energy related quantities.
*/ */
void updateEnergy_(const PrimaryVariables &sol, void updateEnergy_(const ElementSolutionVector &elemSol,
const Problem &problem, const Problem &problem,
const Element &element, const Element &element,
const SubControlVolume& scv) const SubControlVolume& scv)
{ } {}
FluidState fluidState_; FluidState fluidState_;
Scalar porosity_; Scalar porosity_;
PermeabilityType permeability_;
Scalar mobility_[numPhases]; Scalar mobility_[numPhases];
private: private:
......
...@@ -116,8 +116,7 @@ public: ...@@ -116,8 +116,7 @@ public:
* \param fvGeometry The finite volume geometry of the element * \param fvGeometry The finite volume geometry of the element
* \param scvIdx The local index of the sub-control volume * \param scvIdx The local index of the sub-control volume
*/ */
Scalar intrinsicPermeability (const SubControlVolume &scv, Scalar permeabilityAtPos(const GlobalPosition& globalPos) const
const VolumeVariables& volVars) const
{ {
return 1e-10; return 1e-10;
} }
...@@ -129,7 +128,7 @@ public: ...@@ -129,7 +128,7 @@ public:
* \param fvGeometry The finite volume geometry of the element * \param fvGeometry The finite volume geometry of the element
* \param scvIdx The local index of the sub-control volume * \param scvIdx The local index of the sub-control volume
*/ */
Scalar porosity(const SubControlVolume &scv) const Scalar porosityAtPos(const GlobalPosition& globalPos) const
{ return 0.4; } { return 0.4; }
/*! /*!
......
...@@ -131,10 +131,9 @@ public: ...@@ -131,10 +131,9 @@ public:
* \param fvGeometry The finite volume geometry of the element * \param fvGeometry The finite volume geometry of the element
* \param scvIdx The local index of the sub-control volume * \param scvIdx The local index of the sub-control volume
*/ */
Scalar intrinsicPermeability (const SubControlVolume &scv, Scalar permeabilityAtPos(const GlobalPosition& globalPos) const
const VolumeVariables& volVars) const
{ {
if (isInLens_(scv.dofPosition())) if (isInLens_(globalPos))
return lensK_; return lensK_;
return outerK_; return outerK_;
} }
......
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