LCOV - code coverage report
Current view: top level - src/fvkernels - PINSFVMomentumPressurePorosityGradient.C (source / functions) Hit Total Coverage
Test: idaholab/moose navier_stokes: ba1ead Lines: 0 21 0.0 %
Date: 2025-08-13 06:50:25 Functions: 0 3 0.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 "PINSFVMomentumPressurePorosityGradient.h"
      11             : #include "PINSFVSuperficialVelocityVariable.h"
      12             : #include "NS.h"
      13             : 
      14             : registerMooseObject("NavierStokesApp", PINSFVMomentumPressurePorosityGradient);
      15             : 
      16             : InputParameters
      17           0 : PINSFVMomentumPressurePorosityGradient::validParams()
      18             : {
      19           0 :   InputParameters params = FVElementalKernel::validParams();
      20           0 :   params.addClassDescription("Introduces the coupled pressure times porosity gradient term "
      21             :                              "into the Navier-Stokes porous media momentum equation.");
      22           0 :   params.addRequiredParam<MooseFunctorName>(NS::pressure, "The pressure");
      23           0 :   MooseEnum momentum_component("x=0 y=1 z=2");
      24           0 :   params.addRequiredParam<MooseEnum>(
      25             :       "momentum_component",
      26             :       momentum_component,
      27             :       "The component of the momentum equation that this kernel applies to.");
      28           0 :   params.addRequiredParam<MooseFunctorName>(NS::porosity, "Porosity auxiliary variable");
      29             : 
      30           0 :   return params;
      31           0 : }
      32             : 
      33           0 : PINSFVMomentumPressurePorosityGradient::PINSFVMomentumPressurePorosityGradient(
      34           0 :     const InputParameters & params)
      35             :   : FVElementalKernel(params),
      36           0 :     _p(getFunctor<ADReal>(NS::pressure)),
      37           0 :     _eps(getFunctor<ADReal>(NS::porosity)),
      38           0 :     _index(getParam<MooseEnum>("momentum_component"))
      39             : {
      40           0 :   if (!dynamic_cast<PINSFVSuperficialVelocityVariable *>(&_var))
      41           0 :     mooseError(
      42             :         "PINSFVMomentumPressurePorosityGradient may only be used with a superficial velocity "
      43             :         "variable, of variable type PINSFVSuperficialVelocityVariable.");
      44           0 : }
      45             : 
      46             : ADReal
      47           0 : PINSFVMomentumPressurePorosityGradient::computeQpResidual()
      48             : {
      49           0 :   const auto & elem = makeElemArg(_current_elem);
      50           0 :   const auto state = determineState();
      51           0 :   return -_p(elem, state) * _eps.gradient(elem, state)(_index);
      52             : }

Generated by: LCOV version 1.14