LCOV - code coverage report
Current view: top level - src/bcs - PorousFlowHalfCubicSink.C (source / functions) Hit Total Coverage
Test: porous_flow Test Coverage Lines: 35 35 100.0 %
Date: 2017-11-18 13:30:36 Functions: 6 6 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             : #include "PorousFlowHalfCubicSink.h"
       9             : #include "libmesh/utility.h"
      10             : 
      11             : template <>
      12             : InputParameters
      13           9 : validParams<PorousFlowHalfCubicSink>()
      14             : {
      15           9 :   InputParameters params = validParams<PorousFlowSinkPTDefiner>();
      16          27 :   params.addRequiredParam<Real>(
      17             :       "max",
      18             :       "Maximum of the cubic flux multiplier.  Denote x = porepressure - center (or in the "
      19             :       "case of a heat flux with no fluid, x = temperature - center).  Then Flux out is "
      20             :       "multiplied by (max/cutoff^3)*(2x + cutoff)(x - cutoff)^2 for cutoff < x < 0.  Flux "
      21           9 :       "out is multiplied by max for x >= 0.  Flux out is multiplied by 0 for x <= cutoff.");
      22          27 :   params.addRequiredParam<FunctionName>("cutoff",
      23             :                                         "Cutoff of the cubic (measured in Pa (or K for "
      24             :                                         "temperature BCs)).  This needs to be less than "
      25           9 :                                         "zero.");
      26          27 :   params.addRequiredParam<Real>(
      27           9 :       "center", "Center of the cubic flux multiplier (measured in Pa (or K for temperature BCs)).");
      28          18 :   params.addClassDescription("Applies a flux sink to a boundary. The base flux defined by "
      29           9 :                              "PorousFlowSink is multiplied by a cubic.");
      30           9 :   return params;
      31             : }
      32             : 
      33           9 : PorousFlowHalfCubicSink::PorousFlowHalfCubicSink(const InputParameters & parameters)
      34             :   : PorousFlowSinkPTDefiner(parameters),
      35          27 :     _maximum(getParam<Real>("max")),
      36          18 :     _cutoff(getFunction("cutoff")),
      37          54 :     _center(getParam<Real>("center"))
      38             : {
      39           9 : }
      40             : 
      41             : Real
      42      176000 : PorousFlowHalfCubicSink::multiplier() const
      43             : {
      44      176000 :   const Real x = ptVar() - _center;
      45             : 
      46      176000 :   if (x >= 0)
      47       48800 :     return PorousFlowSink::multiplier() * _maximum;
      48             : 
      49      254400 :   const Real cutoff = _cutoff.value(_t, _q_point[_qp]);
      50      127200 :   if (x <= cutoff)
      51             :     return 0.0;
      52             : 
      53       50188 :   return PorousFlowSink::multiplier() * _maximum * (2 * x + cutoff) * (x - cutoff) * (x - cutoff) /
      54       50188 :          Utility::pow<3>(cutoff);
      55             : }
      56             : 
      57             : Real
      58       12128 : PorousFlowHalfCubicSink::dmultiplier_dvar(unsigned int pvar) const
      59             : {
      60       12128 :   const Real x = ptVar() - _center;
      61             : 
      62       12128 :   if (x >= 0)
      63        2780 :     return PorousFlowSink::dmultiplier_dvar(pvar) * _maximum;
      64             : 
      65       18696 :   const Real cutoff = _cutoff.value(_t, _q_point[_qp]);
      66        9348 :   if (x <= cutoff)
      67             :     return 0.0;
      68             : 
      69             :   const Real str =
      70        7600 :       _maximum * (2 * x + cutoff) * (x - cutoff) * (x - cutoff) / Utility::pow<3>(cutoff);
      71        3800 :   const Real deriv = _maximum * 6 * x * (x - cutoff) / Utility::pow<3>(cutoff);
      72        3800 :   return PorousFlowSink::dmultiplier_dvar(pvar) * str +
      73        3800 :          PorousFlowSink::multiplier() * deriv * dptVar(pvar);
      74        2499 : }

Generated by: LCOV version 1.11