LCOV - code coverage report
Current view: top level - src/materials - PorousFlowVariableBase.C (source / functions) Hit Total Coverage
Test: porous_flow Test Coverage Lines: 60 60 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 "PorousFlowVariableBase.h"
       9             : 
      10             : template <>
      11             : InputParameters
      12         375 : validParams<PorousFlowVariableBase>()
      13             : {
      14         375 :   InputParameters params = validParams<PorousFlowMaterial>();
      15         750 :   params.addClassDescription("Base class for thermophysical variable materials. Provides pressure "
      16         375 :                              "and saturation material properties for all phases as required");
      17         375 :   return params;
      18             : }
      19             : 
      20        1125 : PorousFlowVariableBase::PorousFlowVariableBase(const InputParameters & parameters)
      21             :   : DerivativeMaterialInterface<PorousFlowMaterial>(parameters),
      22             : 
      23        1125 :     _num_phases(_dictator.numPhases()),
      24        1125 :     _num_components(_dictator.numComponents()),
      25        1125 :     _num_pf_vars(_dictator.numVariables()),
      26             : 
      27        1125 :     _porepressure(_nodal_material
      28        3375 :                       ? declareProperty<std::vector<Real>>("PorousFlow_porepressure_nodal")
      29        2271 :                       : declareProperty<std::vector<Real>>("PorousFlow_porepressure_qp")),
      30             :     _dporepressure_dvar(
      31        1125 :         _nodal_material
      32        3375 :             ? declareProperty<std::vector<std::vector<Real>>>("dPorousFlow_porepressure_nodal_dvar")
      33        2271 :             : declareProperty<std::vector<std::vector<Real>>>("dPorousFlow_porepressure_qp_dvar")),
      34        1125 :     _gradp_qp(_nodal_material
      35        1698 :                   ? nullptr
      36        2271 :                   : &declareProperty<std::vector<RealGradient>>("PorousFlow_grad_porepressure_qp")),
      37        1698 :     _dgradp_qp_dgradv(_nodal_material ? nullptr
      38             :                                       : &declareProperty<std::vector<std::vector<Real>>>(
      39        2271 :                                             "dPorousFlow_grad_porepressure_qp_dgradvar")),
      40        1698 :     _dgradp_qp_dv(_nodal_material ? nullptr
      41             :                                   : &declareProperty<std::vector<std::vector<RealGradient>>>(
      42        2271 :                                         "dPorousFlow_grad_porepressure_qp_dvar")),
      43             : 
      44        3375 :     _saturation(_nodal_material ? declareProperty<std::vector<Real>>("PorousFlow_saturation_nodal")
      45        2271 :                                 : declareProperty<std::vector<Real>>("PorousFlow_saturation_qp")),
      46             :     _dsaturation_dvar(
      47        1125 :         _nodal_material
      48        3375 :             ? declareProperty<std::vector<std::vector<Real>>>("dPorousFlow_saturation_nodal_dvar")
      49        2271 :             : declareProperty<std::vector<std::vector<Real>>>("dPorousFlow_saturation_qp_dvar")),
      50        1125 :     _grads_qp(_nodal_material
      51        1698 :                   ? nullptr
      52        2271 :                   : &declareProperty<std::vector<RealGradient>>("PorousFlow_grad_saturation_qp")),
      53        1698 :     _dgrads_qp_dgradv(_nodal_material ? nullptr
      54             :                                       : &declareProperty<std::vector<std::vector<Real>>>(
      55        2271 :                                             "dPorousFlow_grad_saturation_qp_dgradvar")),
      56        1698 :     _dgrads_qp_dv(_nodal_material ? nullptr
      57             :                                   : &declareProperty<std::vector<std::vector<RealGradient>>>(
      58       16896 :                                         "dPorousFlow_grad_saturation_qp_dv"))
      59             : {
      60        1125 : }
      61             : 
      62             : void
      63      153808 : PorousFlowVariableBase::initQpStatefulProperties()
      64             : {
      65      307616 :   _porepressure[_qp].resize(_num_phases);
      66      307616 :   _saturation[_qp].resize(_num_phases);
      67             :   // the porepressure and saturation values get set by derived classes
      68      153808 : }
      69             : 
      70             : void
      71     8038302 : PorousFlowVariableBase::computeQpProperties()
      72             : {
      73             :   // do we really need this stuff here?  it seems very inefficient to keep resizing everything!
      74    16076604 :   _porepressure[_qp].resize(_num_phases);
      75    16076604 :   _dporepressure_dvar[_qp].resize(_num_phases);
      76             : 
      77    16076604 :   _saturation[_qp].resize(_num_phases);
      78    16076604 :   _dsaturation_dvar[_qp].resize(_num_phases);
      79             : 
      80     8038302 :   if (!_nodal_material)
      81             :   {
      82     8098932 :     (*_gradp_qp)[_qp].resize(_num_phases);
      83     8098932 :     (*_dgradp_qp_dgradv)[_qp].resize(_num_phases);
      84     8098932 :     (*_dgradp_qp_dv)[_qp].resize(_num_phases);
      85             : 
      86     8098932 :     (*_grads_qp)[_qp].resize(_num_phases);
      87     8098932 :     (*_dgrads_qp_dgradv)[_qp].resize(_num_phases);
      88     8098932 :     (*_dgrads_qp_dv)[_qp].resize(_num_phases);
      89             :   }
      90             : 
      91             :   /// Prepare the derivative matrices with zeroes
      92    26358730 :   for (unsigned phase = 0; phase < _num_phases; ++phase)
      93             :   {
      94    18320428 :     _dporepressure_dvar[_qp][phase].assign(_num_pf_vars, 0.0);
      95    18320428 :     _dsaturation_dvar[_qp][phase].assign(_num_pf_vars, 0.0);
      96     9160214 :     if (!_nodal_material)
      97             :     {
      98     9174100 :       (*_dgradp_qp_dgradv)[_qp][phase].assign(_num_pf_vars, 0.0);
      99     9174100 :       (*_dgradp_qp_dv)[_qp][phase].assign(_num_pf_vars, RealGradient());
     100     9174100 :       (*_dgrads_qp_dgradv)[_qp][phase].assign(_num_pf_vars, 0.0);
     101     9174100 :       (*_dgrads_qp_dv)[_qp][phase].assign(_num_pf_vars, RealGradient());
     102             :     }
     103             :   }
     104     8040801 : }

Generated by: LCOV version 1.11