LCOV - code coverage report
Current view: top level - src/bcs - NSMomentumViscousBC.C (source / functions) Hit Total Coverage
Test: idaholab/moose navier_stokes: 9fc4b0 Lines: 0 29 0.0 %
Date: 2025-08-14 10:14:56 Functions: 0 5 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 "NSMomentumViscousBC.h"
      11             : 
      12             : registerMooseObject("NavierStokesApp", NSMomentumViscousBC);
      13             : 
      14             : InputParameters
      15           0 : NSMomentumViscousBC::validParams()
      16             : {
      17           0 :   InputParameters params = NSIntegratedBC::validParams();
      18           0 :   params.addClassDescription("This class corresponds to the viscous part of the 'natural' boundary "
      19             :                              "condition for the momentum equations.");
      20           0 :   params.addRequiredParam<unsigned>(
      21             :       "component", "(0,1,2) = (x,y,z) for which momentum component this BC is applied to");
      22           0 :   return params;
      23           0 : }
      24             : 
      25           0 : NSMomentumViscousBC::NSMomentumViscousBC(const InputParameters & parameters)
      26             :   : NSIntegratedBC(parameters),
      27           0 :     _component(getParam<unsigned>("component")),
      28             :     // Derivative computing object
      29           0 :     _vst_derivs(*this)
      30             : {
      31           0 : }
      32             : 
      33             : Real
      34           0 : NSMomentumViscousBC::computeQpResidual()
      35             : {
      36             :   // n . (-tau) . v
      37             : 
      38             :   // Vector-valued test function
      39             :   RealVectorValue v_test;
      40           0 :   v_test(_component) = _test[_i][_qp];
      41             : 
      42             :   // The viscous contribution: n . tau . v
      43           0 :   Real visc_term = _normals[_qp] * (_viscous_stress_tensor[_qp] * v_test);
      44             : 
      45             :   // Note the sign...
      46           0 :   return -visc_term;
      47             : }
      48             : 
      49             : Real
      50           0 : NSMomentumViscousBC::computeQpJacobian()
      51             : {
      52             :   // See Eqns. (41)--(43) from the notes for the viscous boundary term contributions
      53             :   Real visc_term = 0.0;
      54             : 
      55             :   // Set variable names as in the notes
      56           0 :   const unsigned int k = _component;
      57           0 :   const unsigned int m = _component + 1; // _component = 0,1,2 -> m = 1,2,3 global variable number
      58             : 
      59             :   // FIXME: attempt calling shared dtau function
      60           0 :   for (unsigned int ell = 0; ell < LIBMESH_DIM; ++ell)
      61           0 :     visc_term += _vst_derivs.dtau(k, ell, m) * _normals[_qp](ell);
      62             : 
      63             :   // Multiply visc_term by test function
      64           0 :   visc_term *= _test[_i][_qp];
      65             : 
      66             :   // Note the sign...
      67           0 :   return -visc_term;
      68             : }
      69             : 
      70             : Real
      71           0 : NSMomentumViscousBC::computeQpOffDiagJacobian(unsigned jvar)
      72             : {
      73           0 :   if (isNSVariable(jvar))
      74             :   {
      75             : 
      76             :     // See Eqns. (41)--(43) from the notes for the viscous boundary
      77             :     // term contributions.
      78             : 
      79             :     // Map jvar into the variable m for our problem, regardless of
      80             :     // how Moose has numbered things.
      81           0 :     unsigned m = mapVarNumber(jvar);
      82             : 
      83             :     // Now compute viscous contribution
      84             :     Real visc_term = 0.0;
      85             : 
      86             :     // Set variable names as in the notes
      87           0 :     const unsigned int k = _component;
      88             : 
      89           0 :     for (unsigned int ell = 0; ell < LIBMESH_DIM; ++ell)
      90           0 :       visc_term += _vst_derivs.dtau(k, ell, m) * _normals[_qp](ell);
      91             : 
      92             :     // Multiply visc_term by test function
      93           0 :     visc_term *= _test[_i][_qp];
      94             : 
      95             :     // Note the sign...
      96           0 :     return -visc_term;
      97             :   }
      98             :   else
      99             :     return 0.0;
     100             : }

Generated by: LCOV version 1.14