From 584b763a0a61222e1a0126846eaf9381c0ae6e8f Mon Sep 17 00:00:00 2001 From: Markus Wolff <markus.wolff@twt-gmbh.de> Date: Mon, 20 Feb 2012 10:28:20 +0000 Subject: [PATCH] improved doxygen documentation + some clean-up git-svn-id: svn://svn.iws.uni-stuttgart.de/DUMUX/dumux/trunk@7825 2fb0f335-1f38-0410-981e-8018bf24f1b0 --- .../decoupled/2p/diffusion/fv/fvpressure2p.hh | 43 +++++++------ .../2p/diffusion/fv/fvpressure2padaptive.hh | 60 +++++++++++-------- .../2p/diffusion/fv/fvpressureproperties2p.hh | 9 +-- .../fv/fvpressureproperties2padaptive.hh | 9 ++- .../decoupled/2p/diffusion/fv/fvvelocity2p.hh | 4 +- .../2p/diffusion/fv/fvvelocity2padaptive.hh | 47 +++++++-------- 6 files changed, 89 insertions(+), 83 deletions(-) diff --git a/dumux/decoupled/2p/diffusion/fv/fvpressure2p.hh b/dumux/decoupled/2p/diffusion/fv/fvpressure2p.hh index 67f6371d62..600a1bb4b3 100644 --- a/dumux/decoupled/2p/diffusion/fv/fvpressure2p.hh +++ b/dumux/decoupled/2p/diffusion/fv/fvpressure2p.hh @@ -30,14 +30,14 @@ /** * @file - * @brief Finite Volume Discretization of a two-phase flow pressure equation. + * @brief Finite Volume discretization of a two-phase flow pressure equation. * @author Markus Wolff, Bernd Flemisch, Jochen Fritz, */ namespace Dumux { //! \ingroup FVPressure2p -/*! \brief Finite Volume discretization of a two-phase flow pressure equation of the sequential IMPES Model. +/*! \brief Finite Volume discretization of a two-phase flow pressure equation of the sequential IMPES model. * * This class provides a finite volume (FV) implementation for solving equations of the form * \f[ @@ -65,8 +65,8 @@ namespace Dumux * saturation (\f$ \lambda_\alpha = k_{r_\alpha} / \mu_\alpha \f$),\f$ f_\alpha = \lambda_\alpha / \lambda \f$ the fractional flow function of a phase, * \f$ \rho_\alpha \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$. + * For all cases, \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$. * * The slightly compressible case is only implemented for phase pressures! In this case for a wetting (\f$ w \f$) phase pressure as primary variable the equations are formulated as * \f[ @@ -141,6 +141,7 @@ template<class TypeTag> class FVPressure2P: public FVPressure<TypeTag> protected: //! \cond \private + typedef typename ParentType::EntryType EntryType; enum { rhs = ParentType::rhs, matrix = ParentType::matrix @@ -148,29 +149,25 @@ protected: //! \endcond public: - - //! \cond \private - // Function which calculates the source entry - void getSource(Dune::FieldVector<Scalar, 2>& entry, const Element& element, const CellData& cellData, const bool first); + void getSource(EntryType& entry, const Element& element, const CellData& cellData, const bool first); // Function which calculates the storage entry - void getStorage(Dune::FieldVector<Scalar, 2>& entry, const Element& element, const CellData& cellData, const bool first); + void getStorage(EntryType& entry, const Element& element, const CellData& cellData, const bool first); // Function which calculates the flux entry - void getFlux(Dune::FieldVector<Scalar, 2>& entry, const Intersection& intersection, const CellData& cellData, const bool first); + void getFlux(EntryType& entry, const Intersection& intersection, const CellData& cellData, const bool first); // Function which calculates the boundary flux entry - void getFluxOnBoundary(Dune::FieldVector<Scalar, 2>& entry, + void getFluxOnBoundary(EntryType& entry, const Intersection& intersection, const CellData& cellData, const bool first); // updates and stores constitutive relations void updateMaterialLaws(); - //! \endcond /*! \brief Initializes the pressure model * - * \copydoc ParentType::initialize() + * \copydetails ParentType::initialize() * * \param solveTwice indicates if more than one iteration is allowed to get an initial pressure solution */ @@ -219,7 +216,7 @@ public: /*! \brief Pressure update * - * \copydoc ParentType::update() + * \copydetails ParentType::update() * */ void update() @@ -382,7 +379,7 @@ public: //! Constructs a FVPressure2P object /** - * \param problem a problem class object + * \param problem A problem class object */ FVPressure2P(Problem& problem) : ParentType(problem), problem_(problem), gravity_(problem.gravity()), maxError_(0.), timeStep_(1.) @@ -440,12 +437,12 @@ private: /*! \brief Function which calculates the source entry * - * \copydoc FVPressure::getSource(Dune::FieldVector<Scalar,2>&,const Element&,const CellData&,const bool) + * \copydetails FVPressure::getSource(EntryType&,const Element&,const CellData&,const bool) * * Source of each fluid phase has to be added as mass flux (\f$\text{kg}/(\text{m}^3 \text{s}\f$). */ template<class TypeTag> -void FVPressure2P<TypeTag>::getSource(Dune::FieldVector<Scalar, 2>& entry, const Element& element +void FVPressure2P<TypeTag>::getSource(EntryType& entry, const Element& element , const CellData& cellData, const bool first) { // cell volume, assume linear map here @@ -468,7 +465,7 @@ void FVPressure2P<TypeTag>::getSource(Dune::FieldVector<Scalar, 2>& entry, const /** \brief Function which calculates the storage entry * - * \copydoc FVPressure::getStorage(Dune::FieldVector<Scalar,2>&,const Element&,const CellData&,const bool) + * \copydetails FVPressure::getStorage(EntryType&,const Element&,const CellData&,const bool) * * If compressibility is enabled this functions calculates the term * \f[ @@ -488,7 +485,7 @@ void FVPressure2P<TypeTag>::getSource(Dune::FieldVector<Scalar, 2>& entry, const * where \f$a_{error}\f$ is a weighting factor (default: \f$a_{error} = 0.5\f$) */ template<class TypeTag> -void FVPressure2P<TypeTag>::getStorage(Dune::FieldVector<Scalar, 2>& entry, const Element& element +void FVPressure2P<TypeTag>::getStorage(EntryType& entry, const Element& element , const CellData& cellData, const bool first) { //volume correction due to density differences @@ -549,11 +546,11 @@ void FVPressure2P<TypeTag>::getStorage(Dune::FieldVector<Scalar, 2>& entry, cons /*! \brief Function which calculates the flux entry * - * \copydoc FVPressure::getFlux(Dune::FieldVector<Scalar,2>&,const Intersection&,const CellData&,const bool) + * \copydetails FVPressure::getFlux(EntryType&,const Intersection&,const CellData&,const bool) * */ template<class TypeTag> -void FVPressure2P<TypeTag>::getFlux(Dune::FieldVector<Scalar, 2>& entry, const Intersection& intersection +void FVPressure2P<TypeTag>::getFlux(EntryType& entry, const Intersection& intersection , const CellData& cellDataI, const bool first) { ElementPointer elementI = intersection.inside(); @@ -695,13 +692,13 @@ void FVPressure2P<TypeTag>::getFlux(Dune::FieldVector<Scalar, 2>& entry, const I /*! \brief Function which calculates the flux entry at a boundary * - * \copydoc FVPressure::getFluxOnBoundary(Dune::FieldVector<Scalar,2>&,const Intersection&,const CellData&,const bool) + * \copydetails FVPressure::getFluxOnBoundary(EntryType&,const Intersection&,const CellData&,const bool) * * Dirichlet boundary condition is a pressure depending on the formulation (\f$p_w\f$ (default), \f$p_n\f$, \f$p_{global}\f$), * Neumann boundary condition are the phase mass fluxes (\f$q_w\f$ and \f$q_n\f$, [\f$\text{kg}/(\text{m}^2 \text{s}\f$]) */ template<class TypeTag> -void FVPressure2P<TypeTag>::getFluxOnBoundary(Dune::FieldVector<Scalar, 2>& entry, +void FVPressure2P<TypeTag>::getFluxOnBoundary(EntryType& entry, const Intersection& intersection, const CellData& cellData, const bool first) { ElementPointer element = intersection.inside(); diff --git a/dumux/decoupled/2p/diffusion/fv/fvpressure2padaptive.hh b/dumux/decoupled/2p/diffusion/fv/fvpressure2padaptive.hh index 3469817880..3a7c07a485 100644 --- a/dumux/decoupled/2p/diffusion/fv/fvpressure2padaptive.hh +++ b/dumux/decoupled/2p/diffusion/fv/fvpressure2padaptive.hh @@ -31,30 +31,18 @@ /** * @file - * @brief Finite Volume Discretization of a pressure equation. + * @brief Finite Volume discretization of a two-phase flow pressure equation. * @author Bernd Flemisch, Jochen Fritz, Markus Wolff */ namespace Dumux { -//! \ingroup FV2p -//! \brief Finite Volume discretization of the pressure equation of the sequential IMPES Model. -/*! Provides a Finite Volume 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$. +//! \ingroup FVPressure2p +/*! \brief Finite Volume discretization of a two-phase flow pressure equation of the sequential IMPES model. + * + * Details see FVPressure2P * - * \tparam TypeTag The Type Tag */ template<class TypeTag> class FVPressure2PAdaptive: public FVPressure2P<TypeTag> { @@ -111,10 +99,19 @@ template<class TypeTag> class FVPressure2PAdaptive: public FVPressure2P<TypeTag> typedef Dune::FieldVector<Scalar, dimWorld> GlobalPosition; typedef Dune::FieldMatrix<Scalar, dim, dim> FieldMatrix; -public: - void getFlux(Dune::FieldVector<Scalar, 2>&, const Intersection&, const CellData&, const bool); + typedef typename ParentType::EntryType EntryType; - //pressure solution routine: update estimate for secants, assemble, solve. +public: + // Function which calculates the flux entry + void getFlux(EntryType&, const Intersection&, const CellData&, const bool); + + /*! \brief Pressure update + * + * \copydetails FVPressure2P::update() + * + * The grid-adaptive implementation also reconstructs the velocity directly after the pressure update. + * This is necessary to make sure the hanging nodes are treated correctly! + */ void update() { int gridSize = problem_.gridView().size(0); @@ -132,7 +129,11 @@ public: return; } - //! \copydoc Dumux::FVPressure1P::addOutputVtkFields(MultiWriter &writer) + /*! \brief Adds pressure output to the output file + * + * \copydetails FVPressure2P::addOutputVtkFields(MultiWriter&) + * + */ template<class MultiWriter> void addOutputVtkFields(MultiWriter &writer) { @@ -142,11 +143,15 @@ public: //! Constructs a FVPressure2PAdaptive object /** - * \param problem a problem class object + * \param problem A problem class object */ FVPressure2PAdaptive(Problem& problem) : ParentType(problem), problem_(problem), velocity_(problem), gravity_(problem.gravity()) { + if (dim != 2) + { + DUNE_THROW(Dune::NotImplemented, "Adaptive finite volume implementation only available in 2-d!"); + } if (pressureType_ != pw && pressureType_ != pn && pressureType_ != pglobal) { DUNE_THROW(Dune::NotImplemented, "Pressure type not supported!"); @@ -189,9 +194,16 @@ private: static const int saturationType_ = GET_PROP_VALUE(TypeTag, SaturationFormulation); //!< gives kind of saturation used (\f$S_w\f$, \f$S_n\f$) }; -//!function which assembles the system of equations to be solved. Only works for 2D. +/*! \brief Function which calculates the flux entry. + * + * \copydetails FVPressure2P::getFlux(EntryType&,const Intersection&,const CellData&,const bool) + * + * Implementation of the getFlux() function for cell-cell interfaces with hanging nodes. + * In case of hanging nodes the function does not return a vector of entries but directly manipulates the global matrix! + * + */ template<class TypeTag> -void FVPressure2PAdaptive<TypeTag>::getFlux(Dune::FieldVector<Scalar, 2>& entries, const Intersection& intersection +void FVPressure2PAdaptive<TypeTag>::getFlux(EntryType& entries, const Intersection& intersection , const CellData& cellDataI, const bool first) { ElementPointer elementI = intersection.inside(); diff --git a/dumux/decoupled/2p/diffusion/fv/fvpressureproperties2p.hh b/dumux/decoupled/2p/diffusion/fv/fvpressureproperties2p.hh index 07c8a5f81b..63cff04e42 100644 --- a/dumux/decoupled/2p/diffusion/fv/fvpressureproperties2p.hh +++ b/dumux/decoupled/2p/diffusion/fv/fvpressureproperties2p.hh @@ -21,7 +21,7 @@ *****************************************************************************/ /*! - * \ingroup IMPES + * \ingroup FVPressure2p * \ingroup Properties */ /*! @@ -53,7 +53,7 @@ namespace Properties // Type tags ////////////////////////////////////////////////////////////////// -//! The type tag for the two-phase problems +//! The type tag for two-phase problems using a standard finite volume model NEW_TYPE_TAG(FVPressureTwoP, INHERITS_FROM(PressureTwoP)); ////////////////////////////////////////////////////////////////// @@ -73,12 +73,13 @@ namespace Properties ////////////////////////////////////////////////////////////////// // Properties ////////////////////////////////////////////////////////////////// +//! Set velocity reconstruction implementation standard cell centered finite volume schemes as default SET_TYPE_PROP( FVPressureTwoP, Velocity, Dumux::FVVelocity2P<TypeTag> ); +//! Set finite volume implementation of the two-phase pressure equation as default pressure model SET_TYPE_PROP(FVPressureTwoP, PressureModel, Dumux::FVPressure2P<TypeTag>); -//! Faces are only regarded from one side and not from both cells +//! Allow assembling algorithm for the pressure matrix to assemble only from one side of a cell-cell interface SET_BOOL_PROP(FVPressureTwoP, VisitFacesOnlyOnce, true); -// \} } } diff --git a/dumux/decoupled/2p/diffusion/fv/fvpressureproperties2padaptive.hh b/dumux/decoupled/2p/diffusion/fv/fvpressureproperties2padaptive.hh index e1cec52b4f..2b1f643827 100644 --- a/dumux/decoupled/2p/diffusion/fv/fvpressureproperties2padaptive.hh +++ b/dumux/decoupled/2p/diffusion/fv/fvpressureproperties2padaptive.hh @@ -21,7 +21,7 @@ *****************************************************************************/ /*! - * \ingroup IMPES + * \ingroup FVPressure2p * \ingroup Properties */ /*! @@ -53,7 +53,7 @@ namespace Properties // Type tags ////////////////////////////////////////////////////////////////// -//! The type tag for the two-phase problems +//! The type tag for two-phase problems using a grid-adaptive finite volume model NEW_TYPE_TAG(FVPressureTwoPAdaptive, INHERITS_FROM(PressureTwoP)); ////////////////////////////////////////////////////////////////// @@ -73,10 +73,13 @@ namespace Properties ////////////////////////////////////////////////////////////////// // Properties ////////////////////////////////////////////////////////////////// + +//! Set velocity reconstruction implementation for grid-adaptive cell centered finite volume schemes as default SET_TYPE_PROP( FVPressureTwoPAdaptive, Velocity, Dumux::FVVelocity2PAdaptive<TypeTag> ); +//! Set finite volume implementation of the two-phase pressure equation which allows hanging nodes as default pressure model SET_TYPE_PROP(FVPressureTwoPAdaptive, PressureModel, Dumux::FVPressure2PAdaptive<TypeTag>); +//! Allow assembling algorithm for the pressure matrix to assemble only from one side of a cell-cell interface SET_BOOL_PROP(FVPressureTwoPAdaptive, VisitFacesOnlyOnce, true); -// \} } } diff --git a/dumux/decoupled/2p/diffusion/fv/fvvelocity2p.hh b/dumux/decoupled/2p/diffusion/fv/fvvelocity2p.hh index 83c2e20ffb..170a0e0265 100644 --- a/dumux/decoupled/2p/diffusion/fv/fvvelocity2p.hh +++ b/dumux/decoupled/2p/diffusion/fv/fvvelocity2p.hh @@ -143,11 +143,11 @@ public: } } - //! \cond \private + // Calculates the velocity at a cell-cell interface. void calculateVelocity(const Intersection&, CellData&); + //Calculates the velocity at a boundary. void calculateVelocityOnBoundary(const Intersection&, CellData&); - //! \endcond /*! \brief Indicates if velocity is reconstructed in the pressure step or in the transport step * diff --git a/dumux/decoupled/2p/diffusion/fv/fvvelocity2padaptive.hh b/dumux/decoupled/2p/diffusion/fv/fvvelocity2padaptive.hh index bc34cfbebd..a13bc28aeb 100644 --- a/dumux/decoupled/2p/diffusion/fv/fvvelocity2padaptive.hh +++ b/dumux/decoupled/2p/diffusion/fv/fvvelocity2padaptive.hh @@ -32,23 +32,11 @@ namespace Dumux { -//! \ingroup FV2p -//! \brief Determines the velocity from a finite volume solution of the pressure equation of the sequential Model (IMPES). -/*! Calculates phase velocities or total velocity from a known pressure field in context of a Finite Volume implementation for the evaluation - * of equations of the form - * \f[\text{div}\, \boldsymbol{v}_{total} = q.\f] - * The wetting or the non-wetting phase pressure, or the global pressure has to be given as piecewise constant cell values. - * The phase velocities are calculated following Darcy's law as - * \f[\boldsymbol{v}_\alpha = \lambda_\alpha \boldsymbol{K} \left(\text{grad}\, p_\alpha + \rho_\alpha g \text{grad}\, z\right),\f] - * where \f$p_\alpha\f$ denotes the pressure of phase \f$_\alpha\f$ (wetting or non-wetting), \f$\boldsymbol{K}\f$ the absolute permeability, \f$\lambda_\alpha\f$ the phase mobility, \f$\rho_\alpha\f$ the phase density and \f$g\f$ the gravity constant. - * The total velocity is either calculated as sum of the phase velocities - * \f[\boldsymbol{v}_{total} = \boldsymbol{v}_{wetting}+\boldsymbol{v}_{non-wetting},\f] - * or with a given global pressure - * \f[\boldsymbol{v}_{total} = \lambda_{total} \boldsymbol{K} \left(\text{grad}\, p_{global} + \sum f_\alpha \rho_\alpha g \text{grad}\, z\right).\f] +//! \ingroup FVPressure2p +/*! \brief Determines the velocity from a finite volume solution of the pressure equation of a sequential model (IMPES). * - * \tparam TypeTag The Type Tag + * Details see FVVelocity2P */ - template<class TypeTag> class FVVelocity2PAdaptive: public FVVelocity2P<TypeTag> { @@ -109,14 +97,16 @@ typedef typename GridView::Traits::template Codim<0>::Entity Element; typedef Dune::FieldMatrix<Scalar,dim,dim> FieldMatrix; public: - //! Constructs a FVVelocity2PAdaptive object - /*! - * \param problem a problem class object + /*! \brief Constructs a FVVelocity2PAdaptive object + * \param problem A problem class object */ FVVelocity2PAdaptive(Problem& problem) : ParentType(problem), problem_(problem), gravity_(problem.gravity()) { - // todo: kompatibilität prüfen + if (dim != 2) + { + DUNE_THROW(Dune::NotImplemented, "Adaptive finite volume implementation only available in 2-d!"); + } if (GET_PROP_VALUE(TypeTag, EnableCompressibility) && velocityType_ == vt) { DUNE_THROW(Dune::NotImplemented, "Total velocity - global pressure - model cannot be used with compressible fluids!"); @@ -142,16 +132,13 @@ public: } } - //! Calculate the velocity. - /*! - * - * Given the piecewise constant pressure \f$p\f$, - * this method calculates the velocity - * The method is needed in the IMPES (Implicit Pressure Explicit Saturation) algorithm which is used for a fractional flow formulation - * to provide the velocity field required for the solution of the saturation equation. - */ + //Calculates the velocity at a cell-cell interface. void calculateVelocity(const Intersection& intersection, CellData& cellDataI); + /*! \brief Indicates if velocity is reconstructed in the pressure step or in the transport step + * + * Returns false (In the adaptive finite volume scheme the velocity has to be calculated separately to make sure the hanging nodes are treated correctly.) + */ bool calculateVelocityInTransport() { return false; @@ -169,6 +156,12 @@ private: static const int saturationType_ = GET_PROP_VALUE(TypeTag, SaturationFormulation); //!< gives kind of saturation used (\f$S_w\f$, \f$S_n\f$) }; +/*! \brief Calculates the velocity at a cell-cell interface. +* +* \copydetails FVVelocity2P::calculateVelocity(const Intersection&,CellData&) +* +* Implementation of calculateVelocity() function for cell-cell interfaces with hanging nodes. +*/ template<class TypeTag> void FVVelocity2PAdaptive<TypeTag>::calculateVelocity(const Intersection& intersection, CellData& cellDataI) { -- GitLab