LCOV - code coverage report
Current view: top level - src/kernels - PorousFlowAdvectiveFlux.C (source / functions) Hit Total Coverage
Test: idaholab/moose porous_flow: #31405 (292dce) with base fef103 Lines: 30 34 88.2 %
Date: 2025-09-04 07:55:56 Functions: 4 4 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //* This file is part of the MOOSE framework
       2             : //* https://mooseframework.inl.gov
       3             : //*
       4             : //* All rights reserved, see COPYRIGHT for full restrictions
       5             : //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
       6             : //*
       7             : //* Licensed under LGPL 2.1, please see LICENSE for details
       8             : //* https://www.gnu.org/licenses/lgpl-2.1.html
       9             : 
      10             : #include "PorousFlowAdvectiveFlux.h"
      11             : 
      12             : registerMooseObject("PorousFlowApp", PorousFlowAdvectiveFlux);
      13             : 
      14             : InputParameters
      15        7078 : PorousFlowAdvectiveFlux::validParams()
      16             : {
      17        7078 :   InputParameters params = PorousFlowDarcyBase::validParams();
      18       14156 :   params.addParam<unsigned int>(
      19       14156 :       "fluid_component", 0, "The index corresponding to the fluid component for this kernel");
      20        7078 :   params.addClassDescription(
      21             :       "Fully-upwinded advective flux of the component given by fluid_component");
      22        7078 :   return params;
      23           0 : }
      24             : 
      25        3855 : PorousFlowAdvectiveFlux::PorousFlowAdvectiveFlux(const InputParameters & parameters)
      26             :   : PorousFlowDarcyBase(parameters),
      27        3855 :     _mass_fractions(
      28        7710 :         getMaterialProperty<std::vector<std::vector<Real>>>("PorousFlow_mass_frac_nodal")),
      29        7710 :     _dmass_fractions_dvar(getMaterialProperty<std::vector<std::vector<std::vector<Real>>>>(
      30             :         "dPorousFlow_mass_frac_nodal_dvar")),
      31        3855 :     _relative_permeability(
      32        3855 :         getMaterialProperty<std::vector<Real>>("PorousFlow_relative_permeability_nodal")),
      33        7710 :     _drelative_permeability_dvar(getMaterialProperty<std::vector<std::vector<Real>>>(
      34             :         "dPorousFlow_relative_permeability_nodal_dvar")),
      35       11565 :     _fluid_component(getParam<unsigned int>("fluid_component"))
      36             : {
      37        3855 :   if (_fluid_component >= _dictator.numComponents())
      38           0 :     paramError(
      39             :         "fluid_component",
      40             :         "The Dictator proclaims that the maximum fluid component index in this simulation is ",
      41           0 :         _dictator.numComponents() - 1,
      42             :         " whereas you have used ",
      43           0 :         _fluid_component,
      44             :         ". Remember that indexing starts at 0. The Dictator does not take such mistakes lightly.");
      45        3855 : }
      46             : 
      47             : Real
      48    17017847 : PorousFlowAdvectiveFlux::mobility(unsigned nodenum, unsigned phase) const
      49             : {
      50    17017847 :   return _mass_fractions[nodenum][phase][_fluid_component] * _fluid_density_node[nodenum][phase] *
      51    17017847 :          _relative_permeability[nodenum][phase] / _fluid_viscosity[nodenum][phase];
      52             : }
      53             : 
      54             : Real
      55     9433846 : PorousFlowAdvectiveFlux::dmobility(unsigned nodenum, unsigned phase, unsigned pvar) const
      56             : {
      57     9433846 :   Real dm = _dmass_fractions_dvar[nodenum][phase][_fluid_component][pvar] *
      58     9433846 :             _fluid_density_node[nodenum][phase] * _relative_permeability[nodenum][phase] /
      59     9433846 :             _fluid_viscosity[nodenum][phase];
      60     9433846 :   dm += _mass_fractions[nodenum][phase][_fluid_component] *
      61     9433846 :         _dfluid_density_node_dvar[nodenum][phase][pvar] * _relative_permeability[nodenum][phase] /
      62             :         _fluid_viscosity[nodenum][phase];
      63     9433846 :   dm += _mass_fractions[nodenum][phase][_fluid_component] * _fluid_density_node[nodenum][phase] *
      64     9433846 :         _drelative_permeability_dvar[nodenum][phase][pvar] / _fluid_viscosity[nodenum][phase];
      65     9433846 :   dm -= _mass_fractions[nodenum][phase][_fluid_component] * _fluid_density_node[nodenum][phase] *
      66     9433846 :         _relative_permeability[nodenum][phase] * _dfluid_viscosity_dvar[nodenum][phase][pvar] /
      67             :         std::pow(_fluid_viscosity[nodenum][phase], 2);
      68     9433846 :   return dm;
      69             : }

Generated by: LCOV version 1.14