LCOV - code coverage report
Current view: top level - src/materials - PorousFlowThermalConductivityIdeal.C (source / functions) Hit Total Coverage
Test: porous_flow Test Coverage Lines: 44 47 93.6 %
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 "PorousFlowThermalConductivityIdeal.h"
       9             : 
      10             : template <>
      11             : InputParameters
      12          16 : validParams<PorousFlowThermalConductivityIdeal>()
      13             : {
      14          16 :   InputParameters params = validParams<PorousFlowMaterialVectorBase>();
      15          48 :   params.addRequiredParam<RealTensorValue>(
      16             :       "dry_thermal_conductivity",
      17          16 :       "The thermal conductivity of the rock matrix when the aqueous saturation is zero");
      18          48 :   params.addParam<RealTensorValue>("wet_thermal_conductivity",
      19             :                                    "The thermal conductivity of the rock matrix when the aqueous "
      20             :                                    "saturation is unity.  This defaults to "
      21          16 :                                    "dry_thermal_conductivity.");
      22          48 :   params.addParam<Real>("exponent",
      23             :                         1.0,
      24             :                         "Exponent on saturation.  Thermal conductivity = "
      25             :                         "dry_thermal_conductivity + S^exponent * "
      26             :                         "(wet_thermal_conductivity - dry_thermal_conductivity), "
      27          16 :                         "where S is the aqueous saturation");
      28          48 :   params.addParam<unsigned>("aqueous_phase_number",
      29             :                             0,
      30             :                             "The phase number of the aqueous phase.  In simulations without "
      31             :                             "fluids, this parameter and the exponent parameter will not be "
      32          16 :                             "used: only the dry_thermal_conductivity will be used.");
      33          32 :   params.set<bool>("at_nodes") = false;
      34          32 :   params.addClassDescription("This Material calculates rock-fluid combined thermal conductivity by "
      35             :                              "using a weighted sum.  Thermal conductivity = "
      36             :                              "dry_thermal_conductivity + S^exponent * (wet_thermal_conductivity - "
      37          16 :                              "dry_thermal_conductivity), where S is the aqueous saturation");
      38          16 :   return params;
      39             : }
      40             : 
      41          48 : PorousFlowThermalConductivityIdeal::PorousFlowThermalConductivityIdeal(
      42          48 :     const InputParameters & parameters)
      43             :   : PorousFlowMaterialVectorBase(parameters),
      44          96 :     _la_dry(getParam<RealTensorValue>("dry_thermal_conductivity")),
      45          96 :     _wet_and_dry_differ(parameters.isParamValid("wet_thermal_conductivity")),
      46         108 :     _la_wet(_wet_and_dry_differ ? getParam<RealTensorValue>("wet_thermal_conductivity")
      47         120 :                                 : getParam<RealTensorValue>("dry_thermal_conductivity")),
      48         144 :     _exponent(getParam<Real>("exponent")),
      49          48 :     _aqueous_phase(_num_phases > 0),
      50         144 :     _aqueous_phase_number(getParam<unsigned>("aqueous_phase_number")),
      51          48 :     _saturation_qp(_aqueous_phase
      52         135 :                        ? &getMaterialProperty<std::vector<Real>>("PorousFlow_saturation_qp")
      53             :                        : nullptr),
      54             :     _dsaturation_qp_dvar(
      55          48 :         _aqueous_phase
      56         135 :             ? &getMaterialProperty<std::vector<std::vector<Real>>>("dPorousFlow_saturation_qp_dvar")
      57             :             : nullptr),
      58          96 :     _la_qp(declareProperty<RealTensorValue>("PorousFlow_thermal_conductivity_qp")),
      59             :     _dla_qp_dvar(
      60         576 :         declareProperty<std::vector<RealTensorValue>>("dPorousFlow_thermal_conductivity_qp_dvar"))
      61             : {
      62          48 :   if (_aqueous_phase && (_aqueous_phase_number >= _num_phases))
      63           0 :     mooseError("PorousFlowThermalConductivityIdeal: Your aqueous phase number, ",
      64             :                _aqueous_phase_number,
      65             :                " must not exceed the number of fluid phases in the system, which is ",
      66             :                _num_phases,
      67           0 :                "\n");
      68          48 :   if (_nodal_material == true)
      69           0 :     mooseError("PorousFlowThermalConductivity classes are only defined for at_nodes = false");
      70          48 : }
      71             : 
      72             : void
      73      150030 : PorousFlowThermalConductivityIdeal::computeQpProperties()
      74             : {
      75      300060 :   _la_qp[_qp] = _la_dry;
      76      150030 :   if (_aqueous_phase && _wet_and_dry_differ)
      77       12848 :     _la_qp[_qp] +=
      78       38544 :         std::pow((*_saturation_qp)[_qp][_aqueous_phase_number], _exponent) * (_la_wet - _la_dry);
      79             : 
      80      300060 :   _dla_qp_dvar[_qp].assign(_num_var, RealTensorValue());
      81      150030 :   if (_aqueous_phase && _wet_and_dry_differ)
      82      182160 :     for (unsigned v = 0; v < _num_var; ++v)
      83      169312 :       _dla_qp_dvar[_qp][v] =
      84      169312 :           _exponent * std::pow((*_saturation_qp)[_qp][_aqueous_phase_number], _exponent - 1.0) *
      85      338624 :           (*_dsaturation_qp_dvar)[_qp][_aqueous_phase_number][v] * (_la_wet - _la_dry);
      86      152529 : }

Generated by: LCOV version 1.11