LCOV - code coverage report
Current view: top level - src/bcs - INSMomentumNoBCBCBase.C (source / functions) Hit Total Coverage
Test: idaholab/moose navier_stokes: 9fc4b0 Lines: 32 33 97.0 %
Date: 2025-08-14 10:14:56 Functions: 2 2 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 "INSMomentumNoBCBCBase.h"
      11             : #include "MooseMesh.h"
      12             : #include "NS.h"
      13             : 
      14             : InputParameters
      15         246 : INSMomentumNoBCBCBase::validParams()
      16             : {
      17         246 :   InputParameters params = IntegratedBC::validParams();
      18             : 
      19         246 :   params.addClassDescription("Base class for the 'No BC' boundary condition.");
      20             :   // Coupled variables
      21         492 :   params.addRequiredCoupledVar("u", "x-velocity");
      22         492 :   params.addCoupledVar("v", "y-velocity"); // only required in 2D and 3D
      23         492 :   params.addCoupledVar("w", "z-velocity"); // only required in 3D
      24         246 :   params.addRequiredCoupledVar(NS::pressure, "pressure");
      25             : 
      26             :   // Required parameters
      27         492 :   params.addRequiredParam<RealVectorValue>("gravity", "Direction of the gravity vector");
      28         492 :   params.addRequiredParam<unsigned>(
      29             :       "component",
      30             :       "0,1,2 depending on if we are solving the x,y,z component of the momentum equation");
      31         492 :   params.addParam<bool>("integrate_p_by_parts",
      32         492 :                         true,
      33             :                         "Allows simulations to be run with pressure BC if set to false");
      34             : 
      35             :   // Optional parameters
      36         492 :   params.addParam<MaterialPropertyName>("mu_name", "mu", "The name of the dynamic viscosity");
      37         492 :   params.addParam<MaterialPropertyName>("rho_name", "rho", "The name of the density");
      38             : 
      39         246 :   return params;
      40           0 : }
      41             : 
      42         132 : INSMomentumNoBCBCBase::INSMomentumNoBCBCBase(const InputParameters & parameters)
      43             :   : IntegratedBC(parameters),
      44             : 
      45             :     // Coupled variables
      46         132 :     _u_vel(coupledValue("u")),
      47         132 :     _v_vel(_mesh.dimension() >= 2 ? coupledValue("v") : _zero),
      48         132 :     _w_vel(_mesh.dimension() == 3 ? coupledValue("w") : _zero),
      49         132 :     _p(coupledValue(NS::pressure)),
      50             : 
      51             :     // Gradients
      52         132 :     _grad_u_vel(coupledGradient("u")),
      53         132 :     _grad_v_vel(_mesh.dimension() >= 2 ? coupledGradient("v") : _grad_zero),
      54         132 :     _grad_w_vel(_mesh.dimension() == 3 ? coupledGradient("w") : _grad_zero),
      55             : 
      56             :     // Variable numberings
      57         132 :     _u_vel_var_number(coupled("u")),
      58         132 :     _v_vel_var_number(_mesh.dimension() >= 2 ? coupled("v") : libMesh::invalid_uint),
      59         132 :     _w_vel_var_number(_mesh.dimension() == 3 ? coupled("w") : libMesh::invalid_uint),
      60         132 :     _p_var_number(coupled(NS::pressure)),
      61             : 
      62             :     // Required parameters
      63         264 :     _gravity(getParam<RealVectorValue>("gravity")),
      64         264 :     _component(getParam<unsigned>("component")),
      65         264 :     _integrate_p_by_parts(getParam<bool>("integrate_p_by_parts")),
      66             : 
      67             :     // Material properties
      68         264 :     _mu(getMaterialProperty<Real>("mu_name")),
      69         396 :     _rho(getMaterialProperty<Real>("rho_name"))
      70             : {
      71         132 : }

Generated by: LCOV version 1.14