diff --git a/dumux/implicit/1p2c/1p2clocalresidual.hh b/dumux/implicit/1p2c/1p2clocalresidual.hh index 4cf0c15b8861bc82fa51af3ea967d414e0d61b2f..69a38de0b44a2307f4901892163c98290d20fd8e 100644 --- a/dumux/implicit/1p2c/1p2clocalresidual.hh +++ b/dumux/implicit/1p2c/1p2clocalresidual.hh @@ -105,7 +105,7 @@ public: const VolumeVariables &volVars = elemVolVars[scvIdx]; storage = 0; - if(!useMoles) + if(!useMoles) //mass-fraction formulation { // storage term of continuity equation - massfractions storage[conti0EqIdx] += @@ -114,7 +114,7 @@ public: storage[transportEqIdx] += volVars.fluidState().density(phaseIdx) * volVars.fluidState().massFraction(phaseIdx, transportCompIdx) * volVars.porosity(); } - else + else //mole-fraction formulation { // storage term of continuity equation- molefractions //careful: molarDensity changes with moleFrac! @@ -170,7 +170,7 @@ public: const VolumeVariables &dn = this->curVolVars_(fluxVars.downstreamIdx()); - if(!useMoles) + if(!useMoles) //mass-fraction formulation { // total mass flux - massfraction //KmvpNormal is the Darcy velocity multiplied with the normal vector, calculated in 1p2cfluxvariables.hh @@ -187,7 +187,7 @@ public: + (1 - upwindWeight_)*dn.fluidState().density(phaseIdx)*dn.fluidState().massFraction(phaseIdx, transportCompIdx)/dn.viscosity()); } - else + else //mole-fraction formulation { // total mass flux - molefraction //KmvpNormal is the Darcy velocity multiplied with the normal vector, calculated in 1p2cfluxvariables.hh @@ -219,7 +219,7 @@ public: Scalar tmp(0); // diffusive flux of second component - if(!useMoles) + if(!useMoles) //mass-fraction formulation { // diffusive flux of the second component - massfraction tmp = -(fluxVars.moleFractionGrad(transportCompIdx)*fluxVars.face().normal); @@ -234,7 +234,7 @@ public: // convert it to a mass flux and add it flux[transportEqIdx] += tmp * FluidSystem::molarMass(transportCompIdx); } - else + else //mole-fraction formulation { // diffusive flux of the second component - molefraction tmp = -(fluxVars.moleFractionGrad(transportCompIdx)*fluxVars.face().normal); diff --git a/dumux/implicit/1p2c/1p2cmodel.hh b/dumux/implicit/1p2c/1p2cmodel.hh index a2ef602e9b407d0fa9631c31cd209f8ba152d8a1..3aab3ba736b759a541e57c4ac6cc7c1863c8cfb9 100644 --- a/dumux/implicit/1p2c/1p2cmodel.hh +++ b/dumux/implicit/1p2c/1p2cmodel.hh @@ -64,6 +64,8 @@ namespace Dumux * All equations are discretized using a vertex-centered finite volume (box) * or cell-centered finite volume scheme as spatial * and the implicit Euler method as time discretization. + * The model is able to use either mole or mass fractions. The property useMoles can be set to either true or false in the + * problem file. Make sure that the according units are used in the problem setup. useMoles is set to true by default. * * The primary variables are the pressure \f$p\f$ and the mole or mass fraction of dissolved component \f$x\f$. */ diff --git a/dumux/implicit/1p2c/1p2cpropertydefaults.hh b/dumux/implicit/1p2c/1p2cpropertydefaults.hh index ec568d8ced3d58b32b5512734f9cac5b472a997f..4df765a1b65c25f9f73d1ee38ec2a65af97fda2e 100644 --- a/dumux/implicit/1p2c/1p2cpropertydefaults.hh +++ b/dumux/implicit/1p2c/1p2cpropertydefaults.hh @@ -53,7 +53,7 @@ SET_INT_PROP(OnePTwoC, NumEq, 2); //!< set the number of equations to 2 SET_INT_PROP(OnePTwoC, NumPhases, 1); //!< The number of phases in the 1p2c model is 1 SET_INT_PROP(OnePTwoC, NumComponents, 2); //!< The number of components in the 1p2c model is 2 SET_SCALAR_PROP(OnePTwoC, Scaling, 1); //!< Scaling of the model is set to 1 by default -SET_BOOL_PROP(OnePTwoC, UseMoles, false); //!< Define that mass fractions are used in the balance equations +SET_BOOL_PROP(OnePTwoC, UseMoles, true); //!< Define that mole fractions are used in the balance equations //! Use the 1p2c local residual function for the 1p2c model SET_TYPE_PROP(OnePTwoC, LocalResidual, OnePTwoCLocalResidual<TypeTag>); diff --git a/test/implicit/1p2c/1p2coutflowproblem.hh b/test/implicit/1p2c/1p2coutflowproblem.hh index cf7b25ac1a0cef02486bc9e9962cd04b0354ad57..77664eb8e116009d4ee17ee09cfc65aea7e44b70 100644 --- a/test/implicit/1p2c/1p2coutflowproblem.hh +++ b/test/implicit/1p2c/1p2coutflowproblem.hh @@ -79,7 +79,7 @@ SET_TYPE_PROP(OnePTwoCOutflowProblem, Dumux::OnePTwoCOutflowSpatialParams<TypeTag>); // Define whether mole(true) or mass (false) fractions are used -SET_BOOL_PROP(OnePTwoCOutflowProblem, UseMoles, false); +SET_BOOL_PROP(OnePTwoCOutflowProblem, UseMoles, true); // Enable velocity output SET_BOOL_PROP(OnePTwoCOutflowProblem, VtkAddVelocity, true); @@ -108,6 +108,9 @@ SET_BOOL_PROP(OnePTwoCOutflowProblem, ProblemEnableGravity, false); * and leaves the domain at the right boundary * where an outflow boundary condition is applied. * + * The model is able to use either mole or mass fractions. The property useMoles can be set to either true or false in the + * problem file. Make sure that the according units are used in the problem setup. The default setting for useMoles is true. + * * This problem uses the \ref OnePTwoCBoxModel model. * * To run the simulation execute the following line in shell: @@ -161,6 +164,16 @@ public: std::string, Problem, Name); + + //stateing in the console whether mole or mass fractions are used + if(!useMoles) + { + std::cout<<"problem uses mass-fractions"<<std::endl; + } + else + { + std::cout<<"problem uses mole-fractions"<<std::endl; + } } /*! @@ -242,6 +255,8 @@ public: * For this method, the \a priVars parameter stores the mass flux * in normal direction of each component. Negative values mean * influx. + * + * The units must be according to either using mole or mass fractions. (mole/(m^2*s) or kg/(m^2*s)) */ void neumann(PrimaryVariables &priVars, const Element &element, @@ -268,6 +283,8 @@ public: * of a component is generated or annihilate per volume * unit. Positive values mean that mass is created, negative ones * mean that it vanishes. + * + * The units must be according to either using mole or mass fractions. (mole/(m^3*s) or kg/(m^3*s)) */ void sourceAtPos(PrimaryVariables &priVars, const GlobalPosition &globalPos) const