From 1212b4a17b71f0f6a61251eb90b2cf34059070f0 Mon Sep 17 00:00:00 2001 From: Katharina Heck <katharina.heck@iws.uni-stuttgart.de> Date: Fri, 9 Jun 2017 13:12:09 +0200 Subject: [PATCH] [fix] adapt to changes in next and use compositional localresidual instead of own --- dumux/porousmediumflow/3p3c/implicit/model.hh | 4 ++++ dumux/porousmediumflow/3p3c/implicit/properties.hh | 2 ++ .../3p3c/implicit/propertydefaults.hh | 12 +++++++++--- .../3p3c/implicit/volumevariables.hh | 14 +++++++++++++- 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/dumux/porousmediumflow/3p3c/implicit/model.hh b/dumux/porousmediumflow/3p3c/implicit/model.hh index 15f4010914..63bb7080d2 100644 --- a/dumux/porousmediumflow/3p3c/implicit/model.hh +++ b/dumux/porousmediumflow/3p3c/implicit/model.hh @@ -164,11 +164,15 @@ public: vtkOutputModule.addSecondaryVariable("rhon", [](const VolumeVariables& v){ return v.density(nPhaseIdx); }); vtkOutputModule.addSecondaryVariable("rhog", [](const VolumeVariables& v){ return v.density(gPhaseIdx); }); + for (int i = 0; i < numPhases; ++i) for (int j = 0; j < numComponents; ++j) vtkOutputModule.addSecondaryVariable("x^" + FluidSystem::componentName(j) + "_" + FluidSystem::phaseName(i), [i,j](const VolumeVariables& v){ return v.moleFraction(i,j); }); + vtkOutputModule.addSecondaryVariable("porosity", [](const VolumeVariables& v){ return v.porosity(); }); + vtkOutputModule.addSecondaryVariable("permeability", + [](const VolumeVariables& v){ return v.permeability(); }); vtkOutputModule.addSecondaryVariable("temperature", [](const VolumeVariables& v){ return v.temperature(); }); } diff --git a/dumux/porousmediumflow/3p3c/implicit/properties.hh b/dumux/porousmediumflow/3p3c/implicit/properties.hh index 3c74683eb3..84dc9e7986 100644 --- a/dumux/porousmediumflow/3p3c/implicit/properties.hh +++ b/dumux/porousmediumflow/3p3c/implicit/properties.hh @@ -73,6 +73,8 @@ NEW_PROP_TAG(ProblemEnableGravity); //!< Returns whether gravity is considered i NEW_PROP_TAG(UseConstraintSolver); //!< Determines whether a constraint solver should be used explicitly NEW_PROP_TAG(SpatialParamsForchCoeff); //!< Property for the forchheimer coefficient NEW_PROP_TAG(TauTortuosity); //!< Tortuosity value (tau) used in macroscopic diffusion +NEW_PROP_TAG(UseMoles);//!< Defines whether mole (true) or mass (false) fractions are used +NEW_PROP_TAG(ReplaceCompEqIdx); //!< The index of the total mass balance equation, if one component balance is replaced (ReplaceCompEqIdx < NumComponents) } } diff --git a/dumux/porousmediumflow/3p3c/implicit/propertydefaults.hh b/dumux/porousmediumflow/3p3c/implicit/propertydefaults.hh index f5542001a0..b945ea2024 100644 --- a/dumux/porousmediumflow/3p3c/implicit/propertydefaults.hh +++ b/dumux/porousmediumflow/3p3c/implicit/propertydefaults.hh @@ -34,10 +34,11 @@ #include "volumevariables.hh" #include "properties.hh" #include "newtoncontroller.hh" -#include "localresidual.hh" #include "primaryvariableswitch.hh" +//#include "localresidual.hh" #include <dumux/porousmediumflow/compositional/switchableprimaryvariables.hh> +#include <dumux/porousmediumflow/compositional/localresidual.hh> #include <dumux/porousmediumflow/nonisothermal/implicit/propertydefaults.hh> #include <dumux/material/fluidmatrixinteractions/diffusivitymillingtonquirk.hh> #include <dumux/porousmediumflow/implicit/darcyfluxvariables.hh> @@ -87,6 +88,8 @@ SET_PROP(ThreePThreeC, NumPhases) "Only fluid systems with 3 phases are supported by the 3p3c model!"); }; +//! Set as default that no component mass balance is replaced by the total mass balance +SET_INT_PROP(ThreePThreeC, ReplaceCompEqIdx, 100); /*! * \brief The fluid state which is used by the volume variables to * store the thermodynamic state. This should be chosen @@ -110,7 +113,7 @@ SET_INT_PROP(ThreePThreeC, NumEq, 3); //!< set the number of equations to 2 SET_TYPE_PROP(ThreePThreeC, MaterialLawParams, typename GET_PROP_TYPE(TypeTag, MaterialLaw)::Params); //! The local residual function of the conservation equations -SET_TYPE_PROP(ThreePThreeC, LocalResidual, ThreePThreeCLocalResidual<TypeTag>); +SET_TYPE_PROP(ThreePThreeC, LocalResidual, CompositionalLocalResidual<TypeTag>); //! Enable advection SET_BOOL_PROP(ThreePThreeC, EnableAdvection, true); @@ -174,6 +177,9 @@ SET_SCALAR_PROP(BoxModel, SpatialParamsForchCoeff, 0.55); */ SET_SCALAR_PROP(ThreePThreeC, TauTortuosity, 0.5); +//! Use mole fractions in the balance equations by default +SET_BOOL_PROP(ThreePThreeC, UseMoles, true); + //! Somerton is used as default model to compute the effective thermal heat conductivity SET_PROP(ThreePThreeCNI, ThermalConductivityModel) { @@ -198,7 +204,7 @@ SET_TYPE_PROP(ThreePThreeCNI, IsothermalModel, ThreePThreeCModel<TypeTag>); SET_TYPE_PROP(ThreePThreeCNI, IsothermalVolumeVariables, ThreePThreeCVolumeVariables<TypeTag>); //set isothermal LocalResidual -SET_TYPE_PROP(ThreePThreeCNI, IsothermalLocalResidual, ThreePThreeCLocalResidual<TypeTag>); +SET_TYPE_PROP(ThreePThreeCNI, IsothermalLocalResidual, CompositionalLocalResidual<TypeTag>); //set isothermal Indices SET_PROP(ThreePThreeCNI, IsothermalIndices) diff --git a/dumux/porousmediumflow/3p3c/implicit/volumevariables.hh b/dumux/porousmediumflow/3p3c/implicit/volumevariables.hh index 1168f2808e..16df2e8ebe 100644 --- a/dumux/porousmediumflow/3p3c/implicit/volumevariables.hh +++ b/dumux/porousmediumflow/3p3c/implicit/volumevariables.hh @@ -49,6 +49,8 @@ class ThreePThreeCVolumeVariables : public ImplicitVolumeVariables<TypeTag> using Scalar = typename GET_PROP_TYPE(TypeTag, Scalar); using GridView = typename GET_PROP_TYPE(TypeTag, GridView); using Problem = typename GET_PROP_TYPE(TypeTag, Problem); + using SpatialParams = typename GET_PROP_TYPE(TypeTag, SpatialParams); + using PermeabilityType = typename SpatialParams::PermeabilityType; using Model = typename GET_PROP_TYPE(TypeTag, Model); using FVElementGeometry = typename GET_PROP_TYPE(TypeTag, FVElementGeometry); using SubControlVolume = typename GET_PROP_TYPE(TypeTag, SubControlVolume); @@ -56,6 +58,7 @@ class ThreePThreeCVolumeVariables : public ImplicitVolumeVariables<TypeTag> using FluidSystem = typename GET_PROP_TYPE(TypeTag, FluidSystem); using MaterialLaw = typename GET_PROP_TYPE(TypeTag, MaterialLaw); using MaterialLawParams = typename GET_PROP_TYPE(TypeTag, MaterialLawParams); + using ElementSolutionVector = typename GET_PROP_TYPE(TypeTag, ElementSolutionVector); // constraint solvers using SpatialParams = typename GET_PROP_TYPE(TypeTag, SpatialParams); @@ -122,6 +125,7 @@ public: const MaterialLawParams &materialParams = problem.spatialParams().materialLawParams(element, scv, elemSol); + Scalar temp = ParentType::temperature(elemSol, problem, element, scv); fluidState_.setTemperature(temp); @@ -664,6 +668,12 @@ public: Scalar bulkDensTimesAdsorpCoeff() const { return bulkDensTimesAdsorpCoeff_; } + /*! + * \brief Returns the average permeability within the control volume in \f$[m^2]\f$. + */ + const PermeabilityType& permeability() const + { return permeability_; } + /*! * \brief Returns the average permeability within the control volume in \f$[m^2]\f$. */ @@ -691,7 +701,7 @@ protected: Scalar massFrac_[numPhases][numComponents]; Scalar porosity_; //!< Effective porosity within the control volume - PermeabilityType permeability_; //!< Effective permeability within the control volume + PermeabilityType permeability_; //!> Effective permeability within the control volume Scalar mobility_[numPhases]; //!< Effective mobility within the control volume Scalar bulkDensTimesAdsorpCoeff_; //!< the basis for calculating adsorbed NAPL FluidState fluidState_; @@ -703,6 +713,8 @@ private: diffCoefficient_[phaseIdx][compIdx] = std::move(d); else if (compIdx > phaseIdx) diffCoefficient_[phaseIdx][compIdx-1] = std::move(d); + else if (phaseIdx == nPhaseIdx) + diffCoefficient_[phaseIdx][compIdx-1] = 0; else DUNE_THROW(Dune::InvalidStateException, "Diffusion coeffiecient for phaseIdx = compIdx doesn't exist"); } -- GitLab