LCOV - code coverage report
Current view: top level - src/dirackernels - PorousFlowPolyLineSink.C (source / functions) Hit Total Coverage
Test: porous_flow Test Coverage Lines: 31 31 100.0 %
Date: 2017-11-21 14:47:27 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 "PorousFlowPolyLineSink.h"
       9             : 
      10             : template <>
      11             : InputParameters
      12          24 : validParams<PorousFlowPolyLineSink>()
      13             : {
      14          24 :   InputParameters params = validParams<PorousFlowLineSink>();
      15          72 :   params.addRequiredParam<std::vector<Real>>(
      16             :       "p_or_t_vals",
      17          24 :       "Tuple of pressure (or temperature) values.  Must be monotonically increasing.");
      18          72 :   params.addRequiredParam<std::vector<Real>>(
      19             :       "fluxes",
      20             :       "Tuple of flux values (measured in kg.m^-1.s^-1 if no 'use_*' are employed).  "
      21             :       "These flux values are multiplied by the line-segment length to achieve a flux in "
      22             :       "kg.s^-1.  A piecewise-linear fit is performed to the (p_or_t_vals,flux) pairs to "
      23             :       "obtain the flux at any arbitrary pressure (or temperature).  If a quad-point "
      24             :       "pressure is less than the first pressure value, the first flux value is used.  If "
      25             :       "quad-point pressure exceeds the final pressure value, the final flux value is "
      26             :       "used.  This flux is OUT of the medium: hence positive values of flux means this "
      27          24 :       "will be a SINK, while negative values indicate this flux will be a SOURCE.");
      28          48 :   params.addClassDescription("Approximates a polyline sink by using a number of point sinks with "
      29          24 :                              "given weighting whose positions are read from a file");
      30          24 :   return params;
      31             : }
      32             : 
      33          24 : PorousFlowPolyLineSink::PorousFlowPolyLineSink(const InputParameters & parameters)
      34             :   : PorousFlowLineSink(parameters),
      35         120 :     _sink_func(getParam<std::vector<Real>>("p_or_t_vals"), getParam<std::vector<Real>>("fluxes"))
      36             : {
      37          24 : }
      38             : 
      39             : Real
      40       54148 : PorousFlowPolyLineSink::computeQpBaseOutflow(unsigned current_dirac_ptid) const
      41             : {
      42             :   Real outflow = 0.0;
      43             : 
      44       54148 :   if (current_dirac_ptid > 0)
      45             :     // contribution from half-segment "behind" this point (must have >1 point for
      46             :     // current_dirac_ptid>0)
      47       49824 :     outflow += _half_seg_len[current_dirac_ptid - 1];
      48             : 
      49      108296 :   if (current_dirac_ptid + 1 < _zs.size() || _zs.size() == 1)
      50             :     // contribution from half-segment "ahead of" this point, or we only have one point
      51       95768 :     outflow += _half_seg_len[current_dirac_ptid];
      52             : 
      53      162444 :   return outflow * _test[_i][_qp] * _sink_func.sample(ptqp()) * _rs[current_dirac_ptid];
      54             : }
      55             : 
      56             : void
      57       35888 : PorousFlowPolyLineSink::computeQpBaseOutflowJacobian(unsigned jvar,
      58             :                                                      unsigned current_dirac_ptid,
      59             :                                                      Real & outflow,
      60             :                                                      Real & outflowp) const
      61             : {
      62       35888 :   outflow = 0.0;
      63       35888 :   outflowp = 0.0;
      64             : 
      65       35888 :   if (_dictator.notPorousFlowVariable(jvar))
      66             :     return;
      67       35888 :   const unsigned pvar = _dictator.porousFlowVariableNum(jvar);
      68             : 
      69       35888 :   if (current_dirac_ptid > 0)
      70             :     // contribution from half-segment "behind" this point (must have >1 point for
      71             :     // current_dirac_ptid>0)
      72       32768 :     outflow += _half_seg_len[current_dirac_ptid - 1];
      73             : 
      74       71776 :   if (current_dirac_ptid + 1 < _zs.size() || _zs.size() == 1)
      75             :     // contribution from half-segment "ahead of" this point, or we only have one point
      76       63200 :     outflow += _half_seg_len[current_dirac_ptid];
      77             : 
      78      143552 :   outflowp = outflow * _test[_i][_qp] * _sink_func.sampleDerivative(ptqp()) * dptqp(pvar) *
      79      107664 :              _phi[_j][_qp] * _rs[current_dirac_ptid];
      80      107664 :   outflow *= _test[_i][_qp] * _sink_func.sample(ptqp()) * _rs[current_dirac_ptid];
      81        2499 : }

Generated by: LCOV version 1.11