LCOV - code coverage report
Current view: top level - src/bcs - AdvectionBC.C (source / functions) Hit Total Coverage
Test: idaholab/moose navier_stokes: 9fc4b0 Lines: 24 25 96.0 %
Date: 2025-08-14 10:14: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 "AdvectionBC.h"
      11             : #include "MooseMesh.h"
      12             : 
      13             : registerMooseObject("NavierStokesApp", AdvectionBC);
      14             : 
      15             : InputParameters
      16          86 : AdvectionBC::validParams()
      17             : {
      18          86 :   InputParameters params = IntegratedBC::validParams();
      19          86 :   params.addClassDescription("Boundary conditions for outflow/outflow of advected quantities:"
      20             :                              "\n phi * velocity * normal, where phi is the advected quantitiy");
      21         172 :   params.addRequiredCoupledVar("velocity_vector",
      22             :                                "The components of the velocity vector up to problem dimension");
      23          86 :   return params;
      24           0 : }
      25             : 
      26          48 : AdvectionBC::AdvectionBC(const InputParameters & parameters)
      27             :   : IntegratedBC(parameters),
      28          96 :     _dim(_mesh.dimension()),
      29          48 :     _coupled_components(coupledComponents("velocity_vector")),
      30          96 :     _velocity(coupledValues("velocity_vector"))
      31             : {
      32          48 :   if (_dim > _coupled_components)
      33           2 :     paramError(
      34             :         "velocity_vector",
      35             :         "Number of components of velocity_vector must be at least equal to the mesh dimension");
      36          46 :   if (_coupled_components > 3)
      37           2 :     paramError("velocity_vector",
      38             :                "You cannot supply more than 3 components for the velocity vector");
      39          44 : }
      40             : 
      41             : Real
      42       13502 : AdvectionBC::computeQpResidual()
      43             : {
      44             :   RealVectorValue vel;
      45       53724 :   for (unsigned int j = 0; j < _coupled_components; ++j)
      46       40222 :     vel(j) = (*_velocity[j])[_qp];
      47       13502 :   if (vel * _normals[_qp] > 0)
      48       13502 :     return _test[_i][_qp] * _u[_qp] * vel * _normals[_qp];
      49             :   return 0;
      50             : }
      51             : 
      52             : Real
      53        5816 : AdvectionBC::computeQpJacobian()
      54             : {
      55             :   RealVectorValue vel;
      56       23152 :   for (unsigned int j = 0; j < _coupled_components; ++j)
      57       17336 :     vel(j) = (*_velocity[j])[_qp];
      58        5816 :   if (vel * _normals[_qp] > 0)
      59        5816 :     return _test[_i][_qp] * _phi[_j][_qp] * vel * _normals[_qp];
      60             :   return 0;
      61             : }

Generated by: LCOV version 1.14