diff --git a/dumux/decoupled/2p/diffusion/fv/fvpressureproperties2p.hh b/dumux/decoupled/2p/diffusion/fv/fvpressureproperties2p.hh index 63cff04e42e12fdbebff78da778b176134cbe771..5a5daff52b7d13560a72442a65b60c5ba6893123 100644 --- a/dumux/decoupled/2p/diffusion/fv/fvpressureproperties2p.hh +++ b/dumux/decoupled/2p/diffusion/fv/fvpressureproperties2p.hh @@ -27,7 +27,7 @@ /*! * \file * - * \brief Defines the properties required for finite volume pressure models in a twophase sequential model. + * \brief Defines the properties required for finite volume pressure models in a two-phase sequential model. */ #ifndef DUMUX_FVPRESSUREPORPERTIES2P_DECOUPLED_HH diff --git a/dumux/decoupled/2p/diffusion/fvmpfa/fvmpfaopressure2p.hh b/dumux/decoupled/2p/diffusion/fvmpfa/fvmpfaopressure2p.hh index e54dc118d2c843f5404ed9d237a336958b74e6f7..9366639f7f70518beef29996d5ac57223e5c6e5d 100644 --- a/dumux/decoupled/2p/diffusion/fvmpfa/fvmpfaopressure2p.hh +++ b/dumux/decoupled/2p/diffusion/fvmpfa/fvmpfaopressure2p.hh @@ -244,6 +244,10 @@ public: { DUNE_THROW(Dune::NotImplemented, "Pressure type not supported!"); } + if (dim != 2) + { + DUNE_THROW(Dune::NotImplemented, "MPFA method only implemented for 2-d!"); + } const Element& element = *(problem_.gridView().template begin<0> ()); FluidState fluidState; diff --git a/dumux/decoupled/2p/diffusion/fvmpfa/fvmpfaopressureproperties2p.hh b/dumux/decoupled/2p/diffusion/fvmpfa/fvmpfaopressureproperties2p.hh index c883287051bf15b6cac01abe0949af7dcadba80a..04eb3d708c7134511ec1b5fb9c5e8dab48cc8e2d 100644 --- a/dumux/decoupled/2p/diffusion/fvmpfa/fvmpfaopressureproperties2p.hh +++ b/dumux/decoupled/2p/diffusion/fvmpfa/fvmpfaopressureproperties2p.hh @@ -26,7 +26,7 @@ * \ingroup Properties * \file * - * \brief Properties for the MPFA-O method. + * \brief Properties for two-phase finite volume model with MPFA-O method. */ #ifndef DUMUX_FVMPFAOPROPERTIES2P_HH #define DUMUX_FVMPFAOPROPERTIES2P_HH diff --git a/dumux/decoupled/2p/diffusion/fvmpfa/fvmpfaovelocity2p.hh b/dumux/decoupled/2p/diffusion/fvmpfa/fvmpfaovelocity2p.hh index 2aabf8b45d2f5484886746887f169a75a0953419..00b51875a44bf811bfbc2505bbf19e81721b2518 100644 --- a/dumux/decoupled/2p/diffusion/fvmpfa/fvmpfaovelocity2p.hh +++ b/dumux/decoupled/2p/diffusion/fvmpfa/fvmpfaovelocity2p.hh @@ -46,6 +46,10 @@ class FVMPFAOPressure2P; * \boldsymbol v_{total} = \lambda_{total} \boldsymbol K \text{grad}\, p_{global}. * \f] * + * Remark1: only for 2-D quadrilateral grids! + * Remark2: can use UGGrid or SGrid/YaspGrid! + * Remark3: gravity is neglected! + * * \tparam TypeTag The Type Tag */ template<class TypeTag> class FVMPFAOVelocity2P:public FVMPFAOPressure2P<TypeTag> @@ -112,6 +116,15 @@ public: FVMPFAOVelocity2P(Problem& problem) : ParentType(problem), problem_(problem) { + if (pressureType_ != pGlobal) + { + DUNE_THROW(Dune::NotImplemented, "Pressure type not supported!"); + } + if (dim != 2) + { + DUNE_THROW(Dune::NotImplemented, "MPFA method only implemented for 2-d!"); + } + const Element& element = *(problem_.gridView().template begin<0> ()); FluidState fluidState; fluidState.setPressure(wPhaseIdx, problem_.referencePressure(element)); diff --git a/dumux/decoupled/2p/diffusion/mimetic/croperator.hh b/dumux/decoupled/2p/diffusion/mimetic/croperator.hh index e643bc43c7eba5b277d7f6f6e52fb85d2551bd1f..f4f68f5de4b7fc2182652ac700899c25ae019201 100644 --- a/dumux/decoupled/2p/diffusion/mimetic/croperator.hh +++ b/dumux/decoupled/2p/diffusion/mimetic/croperator.hh @@ -53,7 +53,7 @@ namespace Dumux { /*! - * \ingroup Mimetic2p + * \ingroup MimeticPressure2p */ /** * @brief defines a class for Crozieux-Raviart piecewise linear finite element functions @@ -72,10 +72,8 @@ namespace Dumux */ /*! @brief Extends CROperatorBase by a generic methods to assemble global stiffness matrix from local stiffness matrices * - * - * The template parameter TypeTag describes what kind of Assembler we are. There two choices: - * <dt>LevelTag</dt> We assemble on a grid level. - * <dt>LeafTag</dt> We assemble on the leaf entities of the grid + * \tparam Scalar The field type used in the elements of the global stiffness matrix + * \tparam GridView The grid view of the simulation grid */ template<class Scalar, class GridView> class CROperatorAssembler diff --git a/dumux/decoupled/2p/diffusion/mimetic/localstiffness.hh b/dumux/decoupled/2p/diffusion/mimetic/localstiffness.hh index 1c82d9874df0e891d39ca651da9fdc3de1237dd4..f693f5833efaf51efbfe1abd4cdb7d18e2f811a4 100644 --- a/dumux/decoupled/2p/diffusion/mimetic/localstiffness.hh +++ b/dumux/decoupled/2p/diffusion/mimetic/localstiffness.hh @@ -44,7 +44,7 @@ namespace Dumux { - /** @ingroup Mimetic2p + /** @ingroup MimeticPressure2p * * @{ */ @@ -60,8 +60,7 @@ namespace Dumux space and access to the local stiffness matrix. The actual assembling is done in a derived class via the virtual assemble method. - \tparam GridView A grid view type - \tparam Scalar The field type used in the elements of the stiffness matrix + \tparam TypeTag The problem TypeTag \tparam m number of degrees of freedom per node (system size) */ template<class TypeTag, int m> @@ -240,8 +239,7 @@ namespace Dumux space and access to the local stiffness matrix. The actual assembling is done in a derived class via the virtual assemble method. - \tparam GridView A grid view type - \tparam Scalar The field type used in the elements of the stiffness matrix + \tparam TypeTag The problem TypeTag \tparam m number of degrees of freedom per node (system size) */ template<class TypeTag, int m> diff --git a/dumux/decoupled/2p/diffusion/mimetic/mimeticgroundwater.hh b/dumux/decoupled/2p/diffusion/mimetic/mimeticgroundwater.hh index 54dde4826609465570e2f0fba5c3217c6d9519d9..d1fe4e0f1fd3ec871eef437994c12f047f1626c7 100644 --- a/dumux/decoupled/2p/diffusion/mimetic/mimeticgroundwater.hh +++ b/dumux/decoupled/2p/diffusion/mimetic/mimeticgroundwater.hh @@ -45,7 +45,7 @@ namespace Dumux { /*! -* \ingroup Mimetic2p +* \ingroup MimeticPressure2p */ /** * @brief compute local stiffness matrix for conforming finite elements for diffusion equation @@ -53,18 +53,15 @@ namespace Dumux */ //! A class for computing local stiffness matrices -/*! A class for computing local stiffness matrix for the -diffusion equation - -div j = q; j = -K grad u; in Omega - -u = g on Gamma1; j*n = J on Gamma2. - -Template parameters are: - -- Grid a DUNE grid type -- RT type used for return values -*/ +/*! A class for computing local stiffness matrix for the diffusion equation + * \f{eqnarray*}{ + * \text{div} \boldsymbol v_{total} &=& q \\ + * \boldsymbol v_{total} &=& - \lambda \boldsymbol K \text{grad} p + * \f} + * where \f$ p = p_D \f$ on \f$ \Gamma_{Dirichlet} \f$, and \f$ \boldsymbol v_{total} \cdot \boldsymbol n = q_N \f$ on \f$ \Gamma_{Neumann} \f$. + * + * \tparam TypeTag The problem TypeTag + */ template<class TypeTag> class MimeticGroundwaterEquationLocalStiffness : diff --git a/dumux/decoupled/2p/diffusion/mimetic/mimeticoperator.hh b/dumux/decoupled/2p/diffusion/mimetic/mimeticoperator.hh index 8790787c1cd378011272d73bdea178df04e813ca..1ca9a047de06d9765fe47c23a6c348249f9c14c5 100644 --- a/dumux/decoupled/2p/diffusion/mimetic/mimeticoperator.hh +++ b/dumux/decoupled/2p/diffusion/mimetic/mimeticoperator.hh @@ -51,16 +51,15 @@ namespace Dumux { /*! - * \ingroup Mimetic2P + * \ingroup MimeticPressure2p * @brief Levelwise assembler This class serves as a base class for local assemblers. It provides space and access to the local stiffness matrix. The actual assembling is done in a derived class via the virtual assemble method. - The template parameters are: - - - Scalar The field type used in the elements of the stiffness matrix + \tparam Scalar The field type used in the elements of the stiffness matrix + \tparam GridView The grid view of the simulation grid */ template<class Scalar, class GridView> class MimeticOperatorAssembler : public CROperatorAssembler<Scalar, GridView> diff --git a/dumux/decoupled/2p/diffusion/mimetic/mimeticpressure2p.hh b/dumux/decoupled/2p/diffusion/mimetic/mimeticpressure2p.hh index 06f344e6ca92012a2243f5460a11199f1aa84e81..b35421f34ef1d33b74977e7214648e0905c16b2c 100644 --- a/dumux/decoupled/2p/diffusion/mimetic/mimeticpressure2p.hh +++ b/dumux/decoupled/2p/diffusion/mimetic/mimeticpressure2p.hh @@ -43,25 +43,27 @@ namespace Dumux { -/*! \ingroup Mimetic2p +//! \ingroup MimeticPressure2p +/*! \brief Mimetic finite differences discretization of a two-phase pressure equation of the sequential IMPES model. * - * \brief mimetic method for the pressure equation + * This class provides a mimetic finite differences implementation for solving equations of the form + * \f[ + * \text{div}\, \boldsymbol{v}_{total} = q. + * \f] + * The total velocity \f$\boldsymbol{v}_{total}\f$ is defined using a global pressure approach. This leads to + * \f[ + * - \text{div}\, \left(\lambda \boldsymbol K \text{grad}\, p_{global}\right) = q. + * \f] + * Here, \f$ p_{global} \f$ is the global pressure of a classical fractional flow formulation + * (see e.g. P. Binning and M. A. Celia, “Practical implementation of the fractional flow approach to multi-phase flow simulation,†Advances in water resources, vol. 22, no. 5, pp. 461-478, 1999.), + * \f$ \boldsymbol K \f$ the absolute permeability, \f$ \lambda = \lambda_w + \lambda_n \f$ the total mobility depending on the + * saturation (\f$ \lambda_\alpha = k_{r_\alpha} / \mu_\alpha \f$) and \f$ q \f$ the source term. Gravity is neglected in this implementation. * - * Provides a mimetic implementation for the evaluation - * of equations of the form - * \f[\text{div}\, \boldsymbol{v}_{total} = q.\f] - * The definition of the total velocity \f$\boldsymbol{v}_total\f$ depends on the kind of pressure chosen. This could be a wetting (w) phase pressure leading to - * \f[ - \text{div}\, \left[\lambda \boldsymbol{K} \left(\text{grad}\, p_w + f_n \text{grad}\, p_c + \sum f_\alpha \rho_\alpha g \text{grad}\, z\right)\right] = q, \f] - * a non-wetting (n) phase pressure yielding - * \f[ - \text{div}\, \left[\lambda \boldsymbol{K} \left(\text{grad}\, p_n - f_w \text{grad}\, p_c + \sum f_\alpha \rho_\alpha g \text{grad}\, z\right)\right] = q, \f] - * or a global pressure leading to - * \f[ - \text{div}\, \left[\lambda \boldsymbol{K} \left(\text{grad}\, p_{global} + \sum f_\alpha \rho_\alpha g \text{grad}\, z\right)\right] = q.\f] - * Here, \f$p\f$ denotes a pressure, \f$\boldsymbol{K}\f$ the absolute permeability, \f$\lambda\f$ the total mobility, possibly depending on the - * saturation,\f$f\f$ the fractional flow function of a phase, \f$\rho\f$ a phase density, \f$g\f$ the gravity constant and \f$q\f$ the source term. - * For all cases, \f$p = p_D\f$ on \f$\Gamma_{Neumann}\f$, and \f$\boldsymbol{v}_{total} = q_N\f$ - * on \f$\Gamma_{Dirichlet}\f$. + * \f$ p = p_D \f$ on \f$ \Gamma_{Dirichlet} \f$, and \f$ \boldsymbol v_{total} \cdot \boldsymbol n = q_N \f$ on \f$ \Gamma_{Neumann} \f$. * - *\tparam TypeTag The Type Tag + * Remark: gravity is neglected! + * + * \tparam TypeTag The Type Tag */ template<class TypeTag> class MimeticPressure2P { @@ -138,6 +140,7 @@ template<class TypeTag> class MimeticPressure2P } protected: + //! \cond \private Problem& problem() { return problem_; @@ -147,11 +150,19 @@ protected: { return problem_; } + //! \endcond public: //constitutive functions are initialized and stored in the variables object void updateMaterialLaws(); + + /*! \brief Initializes the pressure model + * + * Initializes pressure and velocity field. + * + * \param solveTwice indicates if more than one iteration is allowed to get an initial pressure solution + */ void initialize(bool solveTwice = true) { updateMaterialLaws(); @@ -172,6 +183,7 @@ public: return; } + /*! \brief Pressure and velocity update */ void update() { assemble(false); @@ -184,6 +196,7 @@ public: return; } + /*! \brief Globally stores the pressure solution*/ void storePressureSolution() { int size = problem_.gridView().size(0); @@ -195,33 +208,54 @@ public: } } + /*! \brief Stores the pressure solution of a cell + * + * \param globalIdx Global cell index + * \param cellData A CellData object + */ void storePressureSolution(int globalIdx, CellData& cellData) { cellData.setGlobalPressure(pressure_[globalIdx]); } + // Globally stores the velocity solution at cell-cell interfaces void storeVelocity(); - /*! \name general methods for serialization, output */ - //@{ - // serialization methods - //! Function needed for restart option. + /*! \brief Function for serialization of the pressure field. + * + * Function needed for restart option. Writes the pressure of a grid element to a restart file. + * + * \param outstream Stream into the restart file. + * \param element Grid element + */ void serializeEntity(std::ostream &outstream, const Element &element) { int globalIdx = problem_.variables().index(element); outstream << pressure_[globalIdx][0]; } + /*! \brief Function for deserialization of the pressure field. + * + * Function needed for restart option. Reads the pressure of a grid element from a restart file. + * + * \param instream Stream from the restart file. + * \param element Grid element + */ void deserializeEntity(std::istream &instream, const Element &element) { int globalIdx = problem_.variables().index(element); instream >> pressure_[globalIdx][0]; } - //@} - //! \brief Write data files - /* \param name file name */ + /*! \brief Adds pressure output to the output file + * + * Adds the global pressure to the output. + * + * \tparam MultiWriter Class defining the output writer + * \param writer The output writer (usually a <tt>VTKMultiWriter</tt> object) + * + */ template<class MultiWriter> void addOutputVtkFields(MultiWriter &writer) { @@ -236,7 +270,7 @@ public: //! Constructs a MimeticPressure2P object /** - * \param problem The Dumux problem + * \param problem A problem class object */ MimeticPressure2P(Problem& problem) : problem_(problem), @@ -278,9 +312,8 @@ private: Scalar density_[numPhases]; Scalar viscosity_[numPhases]; -protected: - static const int pressureType = GET_PROP_VALUE(TypeTag, PressureFormulation); //!< gives kind of pressure used (\f$ 0 = p_w\f$, \f$ 1 = p_n\f$, \f$ 2 = p_{global}\f$) - static const int saturationType = GET_PROP_VALUE(TypeTag, SaturationFormulation); //!< gives kind of saturation used (\f$ 0 = S_w\f$, \f$ 1 = S_n\f$) + static const int pressureType = GET_PROP_VALUE(TypeTag, PressureFormulation); //!< gives kind of pressure used (\f$ 0 = p_w \f$, \f$ 1 = p_n \f$, \f$ 2 = p_{global} \f$) + static const int saturationType = GET_PROP_VALUE(TypeTag, SaturationFormulation); //!< gives kind of saturation used (\f$ 0 = S_w \f$, \f$ 1 = S_n \f$) }; //solves the system of equations to get the spatial distribution of the pressure @@ -299,7 +332,10 @@ void MimeticPressure2P<TypeTag>::solve() return; } -//constitutive functions are updated once if new saturations are calculated and stored in the variables object +/*! \brief Updates constitutive relations and stores them in the variable class + * + * Stores mobility, fractional flow function and capillary pressure for all grid cells. + */ template<class TypeTag> void MimeticPressure2P<TypeTag>::updateMaterialLaws() { @@ -333,6 +369,7 @@ void MimeticPressure2P<TypeTag>::updateMaterialLaws() return; } +/*! \brief Globally stores the velocity solution at cell-cell interfaces*/ template<class TypeTag> void MimeticPressure2P<TypeTag>::storeVelocity() { diff --git a/dumux/decoupled/2p/diffusion/mimetic/mimeticpressureproperties2p.hh b/dumux/decoupled/2p/diffusion/mimetic/mimeticpressureproperties2p.hh index 4a92176db122a144b4d77a4036fce20e2b2cb79d..7ccc632c4d9c2e9e97dcca959334a50bc61d33a5 100644 --- a/dumux/decoupled/2p/diffusion/mimetic/mimeticpressureproperties2p.hh +++ b/dumux/decoupled/2p/diffusion/mimetic/mimeticpressureproperties2p.hh @@ -22,13 +22,13 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. * *****************************************************************************/ /*! - * \ingroup IMPES + * \ingroup MimeticPressure2p * \ingroup Properties */ /*! * \file * - * \brief Defines the properties required for (immiscible) twophase sequential models. + * \brief Defines the properties required for a two-phase mimetic finite differences model. */ #ifndef DUMUX_MIMETICPROPERTIES2P_DECOUPLED_HH @@ -54,7 +54,7 @@ namespace Properties // Type tags ////////////////////////////////////////////////////////////////// -//! The type tag for the two-phase problems +//! The type tag for two-phase problems using a mimetic finite differences method. NEW_TYPE_TAG(MimeticPressureTwoP, INHERITS_FROM(PressureTwoP, Mimetic)) ; @@ -71,7 +71,9 @@ namespace Dumux { namespace Properties { +//! Set mimetic finite differences implementation of the two-phase pressure equation as default pressure model SET_TYPE_PROP(MimeticPressureTwoP, PressureModel, MimeticPressure2P<TypeTag>); +//! Set the local stiffness implementation for the two-phase model SET_TYPE_PROP(MimeticPressureTwoP, LocalStiffness, MimeticGroundwaterEquationLocalStiffness<TypeTag>); } }