LCOV - code coverage report
Current view: top level - src/auxkernels - PorousFlowDarcyVelocityComponent.C (source / functions) Hit Total Coverage
Test: porous_flow Test Coverage Lines: 30 33 90.9 %
Date: 2017-11-20 14:50:56 Functions: 5 5 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /****************************************************************/
       2             : /*               DO NOT MODIFY THIS HEADER                      */
       3             : /* MOOSE - Multiphysics Object Oriented Simulation Environment  */
       4             : /*                                                              */
       5             : /*           (c) 2010 Battelle Energy Alliance, LLC             */
       6             : /*                   ALL RIGHTS RESERVED                        */
       7             : /*                                                              */
       8             : /*          Prepared by Battelle Energy Alliance, LLC           */
       9             : /*            Under Contract No. DE-AC07-05ID14517              */
      10             : /*            With the U. S. Department of Energy               */
      11             : /*                                                              */
      12             : /*            See COPYRIGHT for full restrictions               */
      13             : /****************************************************************/
      14             : #include "PorousFlowDarcyVelocityComponent.h"
      15             : 
      16             : template <>
      17             : InputParameters
      18          18 : validParams<PorousFlowDarcyVelocityComponent>()
      19             : {
      20          18 :   InputParameters params = validParams<AuxKernel>();
      21          54 :   params.addRequiredParam<RealVectorValue>("gravity",
      22          18 :                                            "Gravitational acceleration vector downwards (m/s^2)");
      23          54 :   params.addRequiredParam<UserObjectName>(
      24          18 :       "PorousFlowDictator", "The UserObject that holds the list of PorousFlow variable names");
      25          54 :   params.addParam<unsigned int>("fluid_phase", 0, "The index corresponding to the fluid phase");
      26          54 :   MooseEnum component("x=0 y=1 z=2");
      27          54 :   params.addRequiredParam<MooseEnum>(
      28          18 :       "component", component, "The spatial component of the Darcy flux to return");
      29          36 :   params.addClassDescription("Darcy velocity (in m^3.s^-1.m^-2, or m.s^-1)  -(k_ij * krel /mu "
      30             :                              "(nabla_j P - w_j)), where k_ij is the permeability tensor, krel is "
      31             :                              "the relative permeability, mu is the fluid viscosity, P is the fluid "
      32          18 :                              "pressure, and w_j is the fluid weight.");
      33          18 :   return params;
      34             : }
      35             : 
      36          44 : PorousFlowDarcyVelocityComponent::PorousFlowDarcyVelocityComponent(
      37          44 :     const InputParameters & parameters)
      38             :   : AuxKernel(parameters),
      39             :     _relative_permeability(
      40          88 :         getMaterialProperty<std::vector<Real>>("PorousFlow_relative_permeability_qp")),
      41          88 :     _fluid_viscosity(getMaterialProperty<std::vector<Real>>("PorousFlow_viscosity_qp")),
      42          88 :     _permeability(getMaterialProperty<RealTensorValue>("PorousFlow_permeability_qp")),
      43          88 :     _grad_p(getMaterialProperty<std::vector<RealGradient>>("PorousFlow_grad_porepressure_qp")),
      44          88 :     _fluid_density_qp(getMaterialProperty<std::vector<Real>>("PorousFlow_fluid_phase_density_qp")),
      45          88 :     _dictator(getUserObject<PorousFlowDictator>("PorousFlowDictator")),
      46         132 :     _ph(getParam<unsigned int>("fluid_phase")),
      47          88 :     _component(getParam<MooseEnum>("component")),
      48         528 :     _gravity(getParam<RealVectorValue>("gravity"))
      49             : {
      50          44 :   if (_ph >= _dictator.numPhases())
      51           0 :     mooseError(
      52             :         "The Dictator proclaims that the number of phases in this simulation is ",
      53           0 :         _dictator.numPhases(),
      54             :         " whereas you have used the AuxKernel PorousFlowDarcyVelocityComponent with fluid_phase = ",
      55             :         _ph,
      56           0 :         ".  The Dictator is watching you, to ensure your wellbeing.");
      57          44 : }
      58             : 
      59             : Real
      60      125026 : PorousFlowDarcyVelocityComponent::computeValue()
      61             : {
      62             :   // note that in the following, _relative_permeaility and _fluid_viscosity are upwinded (nodal)
      63             :   // values
      64      750156 :   return -(_permeability[_qp] * (_grad_p[_qp][_ph] - _fluid_density_qp[_qp][_ph] * _gravity) *
      65      500104 :            _relative_permeability[_qp][_ph] / _fluid_viscosity[_qp][_ph])(_component);
      66        2499 : }

Generated by: LCOV version 1.11