LCOV - code coverage report
Current view: top level - src/materials - PorousFlowDiffusivityBase.C (source / functions) Hit Total Coverage
Test: porous_flow Test Coverage Lines: 28 30 93.3 %
Date: 2017-11-21 14:47:27 Functions: 5 5 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 "PorousFlowDiffusivityBase.h"
       9             : 
      10             : template <>
      11             : InputParameters
      12          10 : validParams<PorousFlowDiffusivityBase>()
      13             : {
      14          10 :   InputParameters params = validParams<PorousFlowMaterialVectorBase>();
      15          30 :   params.addRequiredParam<std::vector<Real>>(
      16             :       "diffusion_coeff",
      17             :       "List of diffusion coefficients.  Order is i) component 0 in phase 0; ii) "
      18             :       "component 1 in phase 0 ...; component 0 in phase 1; ... component k in "
      19          10 :       "phase n (m^2/s");
      20          20 :   params.addClassDescription("Base class for effective diffusivity for each phase");
      21          20 :   params.set<bool>("at_nodes") = false;
      22          10 :   return params;
      23             : }
      24             : 
      25          30 : PorousFlowDiffusivityBase::PorousFlowDiffusivityBase(const InputParameters & parameters)
      26             :   : PorousFlowMaterialVectorBase(parameters),
      27             : 
      28          60 :     _tortuosity(declareProperty<std::vector<Real>>("PorousFlow_tortuosity_qp")),
      29             :     _dtortuosity_dvar(
      30          60 :         declareProperty<std::vector<std::vector<Real>>>("dPorousFlow_tortuosity_qp_dvar")),
      31             :     _diffusion_coeff(
      32          60 :         declareProperty<std::vector<std::vector<Real>>>("PorousFlow_diffusion_coeff_qp")),
      33             :     _ddiffusion_coeff_dvar(declareProperty<std::vector<std::vector<std::vector<Real>>>>(
      34          60 :         "dPorousFlow_diffusion_coeff_qp_dvar")),
      35         240 :     _input_diffusion_coeff(getParam<std::vector<Real>>("diffusion_coeff"))
      36             : {
      37             :   // Also, the number of diffusion coefficients must be equal to the num_phases * num_components
      38          30 :   if (_input_diffusion_coeff.size() != _num_phases * _num_components)
      39             :     mooseError("The number of diffusion coefficients entered is not equal to the number of phases "
      40           0 :                "multiplied by the number of fluid components");
      41          30 :   if (_nodal_material == true)
      42           0 :     mooseError("PorousFlowRelativeDiffusivity classes are only defined for at_nodes = false");
      43          30 : }
      44             : 
      45             : void
      46       54992 : PorousFlowDiffusivityBase::computeQpProperties()
      47             : {
      48      109984 :   _diffusion_coeff[_qp].resize(_num_phases);
      49      109984 :   _ddiffusion_coeff_dvar[_qp].resize(_num_phases);
      50      109984 :   _dtortuosity_dvar[_qp].resize(_num_phases);
      51             : 
      52      167760 :   for (unsigned int ph = 0; ph < _num_phases; ++ph)
      53             :   {
      54      112768 :     _diffusion_coeff[_qp][ph].resize(_num_components);
      55      112768 :     _ddiffusion_coeff_dvar[_qp][ph].resize(_num_components);
      56      112768 :     _dtortuosity_dvar[_qp][ph].assign(_num_var, 0.0);
      57             : 
      58      281920 :     for (unsigned int comp = 0; comp < _num_components; ++comp)
      59             :     {
      60      338304 :       _diffusion_coeff[_qp][ph][comp] = _input_diffusion_coeff[ph + comp];
      61      225536 :       _ddiffusion_coeff_dvar[_qp][ph][comp].assign(_num_var, 0.0);
      62             :     }
      63             :   }
      64       57491 : }

Generated by: LCOV version 1.11