LCOV - code coverage report
Current view: top level - src/auxkernels - PorousFlowPropertyAux.C (source / functions) Hit Total Coverage
Test: porous_flow Test Coverage Lines: 59 67 88.1 %
Date: 2017-11-17 17:48:31 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 "PorousFlowPropertyAux.h"
       9             : 
      10             : template <>
      11             : InputParameters
      12         143 : validParams<PorousFlowPropertyAux>()
      13             : {
      14         143 :   InputParameters params = validParams<AuxKernel>();
      15         429 :   params.addRequiredParam<UserObjectName>(
      16         143 :       "PorousFlowDictator", "The UserObject that holds the list of PorousFlow variable names");
      17             :   MooseEnum property_enum("pressure saturation temperature density viscosity mass_fraction relperm "
      18         429 :                           "enthalpy internal_energy");
      19         429 :   params.addRequiredParam<MooseEnum>(
      20         143 :       "property", property_enum, "The fluid property that this auxillary kernel is to calculate");
      21         429 :   params.addParam<unsigned int>("phase", 0, "The index of the phase this auxillary kernel acts on");
      22         429 :   params.addParam<unsigned int>(
      23         143 :       "fluid_component", 0, "The index of the fluid component this auxillary kernel acts on");
      24         286 :   params.addClassDescription("AuxKernel to provide access to properties evaluated at quadpoints. "
      25             :                              "Note that elemental AuxVariables must be used, so that these "
      26         143 :                              "properties are integrated over each element.");
      27         143 :   return params;
      28             : }
      29             : 
      30         143 : PorousFlowPropertyAux::PorousFlowPropertyAux(const InputParameters & parameters)
      31             :   : AuxKernel(parameters),
      32         286 :     _dictator(getUserObject<PorousFlowDictator>("PorousFlowDictator")),
      33         286 :     _property_enum(getParam<MooseEnum>("property").getEnum<PropertyEnum>()),
      34         429 :     _phase(getParam<unsigned int>("phase")),
      35        1001 :     _fluid_component(getParam<unsigned int>("fluid_component"))
      36             : {
      37             :   // Check that the phase and fluid_component are valid
      38         143 :   if (_phase >= _dictator.numPhases())
      39             :     mooseError("Phase number in the AuxKernel ",
      40           0 :                _name,
      41           0 :                " is greater than the number of phases in the problem");
      42             : 
      43         143 :   if (_fluid_component >= _dictator.numComponents())
      44             :     mooseError("Fluid component number in the AuxKernel ",
      45           0 :                _name,
      46           0 :                " is greater than the number of phases in the problem");
      47             : 
      48             :   // Only get material properties required by this instance of the AuxKernel
      49         143 :   switch (_property_enum)
      50             :   {
      51             :     case PropertyEnum::PRESSURE:
      52          50 :       _pressure = &getMaterialProperty<std::vector<Real>>("PorousFlow_porepressure_qp");
      53          25 :       break;
      54             : 
      55             :     case PropertyEnum::SATURATION:
      56          96 :       _saturation = &getMaterialProperty<std::vector<Real>>("PorousFlow_saturation_qp");
      57          48 :       break;
      58             : 
      59             :     case PropertyEnum::TEMPERATURE:
      60           0 :       _temperature = &getMaterialProperty<Real>("PorousFlow_temperature_qp");
      61           0 :       break;
      62             : 
      63             :     case PropertyEnum::DENSITY:
      64          20 :       _fluid_density = &getMaterialProperty<std::vector<Real>>("PorousFlow_fluid_phase_density_qp");
      65          10 :       break;
      66             : 
      67             :     case PropertyEnum::VISCOSITY:
      68          20 :       _fluid_viscosity = &getMaterialProperty<std::vector<Real>>("PorousFlow_viscosity_qp");
      69          10 :       break;
      70             : 
      71             :     case PropertyEnum::MASS_FRACTION:
      72          22 :       _mass_fractions =
      73          44 :           &getMaterialProperty<std::vector<std::vector<Real>>>("PorousFlow_mass_frac_qp");
      74          22 :       break;
      75             : 
      76             :     case PropertyEnum::RELPERM:
      77          24 :       _relative_permeability =
      78          48 :           &getMaterialProperty<std::vector<Real>>("PorousFlow_relative_permeability_qp");
      79          24 :       break;
      80             : 
      81             :     case PropertyEnum::ENTHALPY:
      82           4 :       _enthalpy = &getMaterialProperty<std::vector<Real>>("PorousFlow_fluid_phase_enthalpy_qp");
      83             : 
      84             :     case PropertyEnum::INTERNAL_ENERGY:
      85           4 :       _internal_energy =
      86           8 :           &getMaterialProperty<std::vector<Real>>("PorousFlow_fluid_phase_internal_energy_qp");
      87             :   }
      88         143 : }
      89             : 
      90             : Real
      91      150304 : PorousFlowPropertyAux::computeValue()
      92             : {
      93             :   Real property = 0.0;
      94             : 
      95      150304 :   switch (_property_enum)
      96             :   {
      97             :     case PropertyEnum::PRESSURE:
      98       88472 :       property = (*_pressure)[_qp][_phase];
      99       44236 :       break;
     100             : 
     101             :     case PropertyEnum::SATURATION:
     102      107544 :       property = (*_saturation)[_qp][_phase];
     103       53772 :       break;
     104             : 
     105             :     case PropertyEnum::TEMPERATURE:
     106           0 :       property = (*_temperature)[_qp];
     107           0 :       break;
     108             : 
     109             :     case PropertyEnum::DENSITY:
     110          80 :       property = (*_fluid_density)[_qp][_phase];
     111          40 :       break;
     112             : 
     113             :     case PropertyEnum::VISCOSITY:
     114          80 :       property = (*_fluid_viscosity)[_qp][_phase];
     115          40 :       break;
     116             : 
     117             :     case PropertyEnum::MASS_FRACTION:
     118       43344 :       property = (*_mass_fractions)[_qp][_phase][_fluid_component];
     119       21672 :       break;
     120             : 
     121             :     case PropertyEnum::RELPERM:
     122       61056 :       property = (*_relative_permeability)[_qp][_phase];
     123       30528 :       break;
     124             : 
     125             :     case PropertyEnum::ENTHALPY:
     126          16 :       property = (*_enthalpy)[_qp][_phase];
     127           8 :       break;
     128             : 
     129             :     case PropertyEnum::INTERNAL_ENERGY:
     130          16 :       property = (*_internal_energy)[_qp][_phase];
     131           8 :       break;
     132             :   }
     133             : 
     134      150304 :   return property;
     135        2499 : }

Generated by: LCOV version 1.11