LCOV - code coverage report
Current view: top level - src/linearfvkernels - LinearFVMomentumFriction.C (source / functions) Hit Total Coverage
Test: idaholab/moose navier_stokes: 9fc4b0 Lines: 22 22 100.0 %
Date: 2025-08-14 10:14:56 Functions: 5 5 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : //* This file is part of the MOOSE framework
       2             : //* https://www.mooseframework.org
       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 "LinearFVMomentumFriction.h"
      11             : #include "NS.h"
      12             : #include "NavierStokesMethods.h"
      13             : 
      14             : registerMooseObject("NavierStokesApp", LinearFVMomentumFriction);
      15             : 
      16             : InputParameters
      17         190 : LinearFVMomentumFriction::validParams()
      18             : {
      19         190 :   InputParameters params = LinearFVElementalKernel::validParams();
      20         190 :   params.addClassDescription("Computes a Darcy friction force term on fluid in the "
      21             :                              "Navier Stokes i-th momentum equation.");
      22         380 :   params.addParam<MooseFunctorName>("Darcy_name", "Name of the Darcy coefficients property.");
      23         190 :   params.addRequiredParam<MooseFunctorName>(NS::mu, "The dynamic viscosity");
      24             : 
      25         380 :   MooseEnum momentum_component("x=0 y=1 z=2");
      26         380 :   params.addRequiredParam<MooseEnum>(
      27             :       "momentum_component",
      28             :       momentum_component,
      29             :       "The component of the momentum equation that this kernel applies to.");
      30             : 
      31         190 :   return params;
      32         190 : }
      33             : 
      34         114 : LinearFVMomentumFriction::LinearFVMomentumFriction(const InputParameters & params)
      35             :   : LinearFVElementalKernel(params),
      36         114 :     _index(getParam<MooseEnum>("momentum_component")),
      37         456 :     _D(isParamValid("Darcy_name") ? &getFunctor<RealVectorValue>("Darcy_name") : nullptr),
      38         228 :     _mu(isParamValid(NS::mu) ? &getFunctor<Real>(NS::mu) : nullptr)
      39             : {
      40         114 : }
      41             : 
      42             : Real
      43      776880 : LinearFVMomentumFriction::computeMatrixContribution()
      44             : {
      45      776880 :   const auto elem_arg = makeElemArg(_current_elem_info->elem());
      46      776880 :   const auto state = determineState();
      47      776880 :   return computeFrictionWCoefficient(elem_arg, state) * _current_elem_volume;
      48             : }
      49             : 
      50             : Real
      51      776880 : LinearFVMomentumFriction::computeRightHandSideContribution()
      52             : {
      53      776880 :   return 0;
      54             : }
      55             : 
      56             : Real
      57      776880 : LinearFVMomentumFriction::computeFrictionWCoefficient(const Moose::ElemArg & elem_arg,
      58             :                                                       const Moose::StateArg & state)
      59             : {
      60      776880 :   return (*_mu)(elem_arg, state) * (*_D)(elem_arg, state)(_index);
      61             : }

Generated by: LCOV version 1.14