LCOV - code coverage report
Current view: top level - src/bcs - PorousFlowHalfGaussianSink.C (source / functions) Hit Total Coverage
Test: porous_flow Test Coverage Lines: 28 28 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 "PorousFlowHalfGaussianSink.h"
       9             : 
      10             : template <>
      11             : InputParameters
      12           5 : validParams<PorousFlowHalfGaussianSink>()
      13             : {
      14           5 :   InputParameters params = validParams<PorousFlowSinkPTDefiner>();
      15          15 :   params.addRequiredParam<Real>("max",
      16             :                                 "Maximum of the Gaussian flux multiplier.  Flux out is "
      17             :                                 "multiplied by max*exp((-0.5*(p - center)/sd)^2) for "
      18             :                                 "p<center, and by = max for p>center.  Here p is the nodal "
      19             :                                 "porepressure for the fluid_phase specified (or, for heat "
      20           5 :                                 "fluxes, it is the temperature).");
      21          15 :   params.addRequiredParam<Real>("sd",
      22             :                                 "Standard deviation of the Gaussian flux multiplier "
      23           5 :                                 "(measured in Pa (or K for heat fluxes)).");
      24          15 :   params.addRequiredParam<Real>(
      25           5 :       "center", "Center of the Gaussian flux multiplier (measured in Pa (or K for heat fluxes)).");
      26          10 :   params.addClassDescription("Applies a flux sink to a boundary. The base flux defined by "
      27           5 :                              "PorousFlowSink is multiplied by a Gaussian.");
      28           5 :   return params;
      29             : }
      30             : 
      31           5 : PorousFlowHalfGaussianSink::PorousFlowHalfGaussianSink(const InputParameters & parameters)
      32             :   : PorousFlowSinkPTDefiner(parameters),
      33          15 :     _maximum(getParam<Real>("max")),
      34          15 :     _sd(getParam<Real>("sd")),
      35          30 :     _center(getParam<Real>("center"))
      36             : {
      37           5 : }
      38             : 
      39             : Real
      40      122272 : PorousFlowHalfGaussianSink::multiplier() const
      41             : {
      42      122272 :   if (ptVar() >= _center)
      43       59388 :     return PorousFlowSink::multiplier() * _maximum;
      44       62884 :   return PorousFlowSink::multiplier() * _maximum *
      45      125768 :          std::exp(-0.5 * std::pow((ptVar() - _center) / _sd, 2));
      46             : }
      47             : 
      48             : Real
      49        7936 : PorousFlowHalfGaussianSink::dmultiplier_dvar(unsigned int pvar) const
      50             : {
      51        7936 :   if (ptVar() >= _center)
      52        4288 :     return PorousFlowSink::dmultiplier_dvar(pvar) * _maximum;
      53        7296 :   const Real str = _maximum * std::exp(-0.5 * std::pow((ptVar() - _center) / _sd, 2));
      54        3648 :   return PorousFlowSink::dmultiplier_dvar(pvar) * str +
      55        7296 :          PorousFlowSink::multiplier() * str * (_center - ptVar()) / std::pow(_sd, 2) * dptVar(pvar);
      56        2499 : }

Generated by: LCOV version 1.11