LCOV - code coverage report
Current view: top level - include/userobjects - PorousFlowCapillaryPressure.h (source / functions) Hit Total Coverage
Test: porous_flow Test Coverage Lines: 4 4 100.0 %
Date: 2017-11-21 14:47:27 Functions: 3 3 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /****************************************************************/
       2             : /* MOOSE - Multiphysics Object Oriented Simulation Environment  */
       3             : /*                                                              */
       4             : /*          All contents are licensed under LGPL V2.1           */
       5             : /*             See LICENSE for full restrictions                */
       6             : /****************************************************************/
       7             : 
       8             : #ifndef POROUSFLOWCAPILLARYPRESSURE_H
       9             : #define POROUSFLOWCAPILLARYPRESSURE_H
      10             : 
      11             : #include "GeneralUserObject.h"
      12             : 
      13             : class PorousFlowCapillaryPressure;
      14             : 
      15             : template <>
      16             : InputParameters validParams<PorousFlowCapillaryPressure>();
      17             : 
      18             : /**
      19             :  * Base class for capillary pressure for multiphase flow in porous media. To implement
      20             :  * an effective saturation formulation, override effectiveSaturation() and derivatives.
      21             :  * To implement a capillary pressure curve that will include the logarithmic extension,
      22             :  * override capillaryPressureCurve() and derivatives.
      23             :  *
      24             :  * Note: Capillary pressure is calculated as a function of true saturation, not
      25             :  * effective saturation (saturation minus residual). Derivatives are returned wrt
      26             :  * true saturation, so no scaling of them is required in objects using these methods.
      27             :  *
      28             :  * Includes an optional logarithmic extension in the low saturation region where
      29             :  * capillary pressure can go to infinity as saturation tends to 0. Calculation of
      30             :  * logarithmic extension from Webb, A simple extension of two-phase characteristic
      31             :  * curves to include the dry region, Water Resources Research 36, 1425-1430 (2000)
      32             :  */
      33         118 : class PorousFlowCapillaryPressure : public GeneralUserObject
      34             : {
      35             : public:
      36             :   PorousFlowCapillaryPressure(const InputParameters & parameters);
      37             : 
      38        1502 :   virtual void initialize() final{};
      39        1502 :   virtual void execute() final{};
      40        1502 :   virtual void finalize() final{};
      41             :   virtual void initialSetup() override;
      42             : 
      43             :   /**
      44             :    * Capillary pressure is calculated as a function of true saturation. Note that this
      45             :    * method includes the ability to use a logarithmic extension at low saturation.
      46             :    * @param saturation true saturation
      47             :    * @return capillary pressure (Pa)
      48             :    */
      49             :   virtual Real capillaryPressure(Real saturation) const;
      50             : 
      51             :   /**
      52             :    * Derivative of capillary pressure wrt true saturation
      53             :    * @param saturation true saturation
      54             :    * @return derivative of capillary pressure with respect to true saturation
      55             :    */
      56             :   virtual Real dCapillaryPressure(Real saturation) const;
      57             : 
      58             :   /**
      59             :    * Second derivative of capillary pressure wrt true saturation
      60             :    * @param saturation true saturation
      61             :    * @return second derivative of capillary pressure with respect to true saturation
      62             :    */
      63             :   virtual Real d2CapillaryPressure(Real saturation) const;
      64             : 
      65             :   /**
      66             :    * Effective saturation as a function of capillary pressure
      67             :    * @param pc capillary pressure (Pa)
      68             :    * @return effective saturation
      69             :    */
      70             :   virtual Real effectiveSaturation(Real pc) const = 0;
      71             : 
      72             :   /**
      73             :    * Derivative of effective saturation wrt capillary pressure
      74             :    * @param pc capillary pressure (Pa)
      75             :    * @return derivative of effective saturation wrt capillary pressure
      76             :    */
      77             :   virtual Real dEffectiveSaturation(Real pc) const = 0;
      78             : 
      79             :   /**
      80             :    * Second derivative of effective saturation wrt capillary pressure
      81             :    * @param pc capillary pressure
      82             :    * @return second derivative of effective saturation wrt capillary pressure
      83             :    */
      84             :   virtual Real d2EffectiveSaturation(Real pc) const = 0;
      85             : 
      86             : protected:
      87             :   /**
      88             :    * Effective saturation of liquid phase given liquid saturation and residual
      89             :    * liquid saturation.
      90             :    * Note: not to be mistaken with effectiveSaturation(pc) which is a function
      91             :    * of capillary pressure.
      92             :    * @param saturation true saturation
      93             :    * @return effective saturation
      94             :    */
      95             :   Real effectiveSaturationFromSaturation(Real saturation) const;
      96             : 
      97             :   /**
      98             :    * Calculates the saturation where the logarithmic extension to capillary
      99             :    * pressure meets the raw curve using Newton's method
     100             :    *
     101             :    * @return saturation where logarithmic extension begins
     102             :    */
     103             :   Real extensionSaturation() const;
     104             : 
     105             :   /**
     106             :    * Calculates the saturation where the logarithmic extension to capillary
     107             :    * pressure at low saturation
     108             :    *
     109             :    * @param s effective saturation
     110             :    * @return capillary pressure function in the logarithmic extension
     111             :    */
     112             :   Real interceptFunction(Real s) const;
     113             : 
     114             :   /**
     115             :    * Calculates the saturation where the logarithmic extension to capillary
     116             :    * pressure at low saturation
     117             :    *
     118             :    * @param s effective saturation
     119             :    * @return derivative of logarithmic extension function
     120             :    */
     121             :   Real interceptFunctionDeriv(Real s) const;
     122             : 
     123             :   /**
     124             :    * The capillary pressure in the logarithmic extension
     125             :    *
     126             :    * @param s liquid saturation
     127             :    * @return capillary pressure in logarithmic extension
     128             :    */
     129             :   Real capillaryPressureLogExt(Real s) const;
     130             : 
     131             :   /**
     132             :    * The derivative of capillary pressure in the logarithmic extension
     133             :    *
     134             :    * @param s liquid saturation
     135             :    * @return derivative of capillary pressure in logarithmic extension
     136             :    */
     137             :   Real dCapillaryPressureLogExt(Real s) const;
     138             : 
     139             :   /**
     140             :    * The second derivative of capillary pressure in the logarithmic extension
     141             :    *
     142             :    * @param s liquid saturation
     143             :    * @return second derivative of capillary pressure in logarithmic extension
     144             :    */
     145             :   Real d2CapillaryPressureLogExt(Real s) const;
     146             : 
     147             :   /**
     148             :    * Raw capillary pressure curve (does not include logarithmic extension)
     149             :    * @param saturation true saturation
     150             :    * @return capillary pressure (Pa)
     151             :    */
     152             :   virtual Real capillaryPressureCurve(Real saturation) const = 0;
     153             : 
     154             :   /**
     155             :    * Derivative of raw capillary pressure wrt true saturation
     156             :    * @param saturation true saturation
     157             :    * @return derivative of capillary pressure with respect to true saturation
     158             :    */
     159             :   virtual Real dCapillaryPressureCurve(Real saturation) const = 0;
     160             : 
     161             :   /**
     162             :    * Second derivative of raw capillary pressure wrt true saturation
     163             :    * @param saturation true saturation
     164             :    * @return second derivative of capillary pressure with respect to true saturation
     165             :    */
     166             :   virtual Real d2CapillaryPressureCurve(Real saturation) const = 0;
     167             : 
     168             :   /// Liquid residual saturation
     169             :   const Real _sat_lr;
     170             :   /// Derivative of effective saturation with respect to saturation
     171             :   const Real _dseff_ds;
     172             :   /// Flag to use a logarithmic extension for low saturation
     173             :   bool _log_ext;
     174             :   /// Maximum capillary pressure (Pa). Note: must be <= 0
     175             :   const Real _pc_max;
     176             :   /// Saturation where the logarithmic extension meets the raw curve
     177             :   Real _sat_ext;
     178             :   /// Capillary pressure where the extension meets the raw curve
     179             :   Real _pc_ext;
     180             :   /// Gradient of the logarithmic extension
     181             :   Real _slope_ext;
     182             :   /// log(10)
     183             :   const Real _log10;
     184             : };
     185             : 
     186             : #endif // POROUSFLOWCAPILLARYPRESSURE_H

Generated by: LCOV version 1.11