diff --git a/dumux/porousmediumflow/3p3c/implicit/model.hh b/dumux/porousmediumflow/3p3c/implicit/model.hh index 15f401091437774ae3ff4b846e21b28d94773650..63bb7080d2d0b7abf4277fef1972a6ba5a82c281 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 3c74683eb3821c7cf5936f8abb8d35615ae54201..84dc9e7986d675f02a753d1ef0a27abd322b573b 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 f5542001a02ff3885f14fb40b659efa4a61f6738..b945ea2024d0fe69685e11cf1323d50ff0b40f99 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 1168f2808e6b350c96692dc207800f9a3ec2c4d9..16df2e8ebeba81870016730209a469282892630b 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"); }