LCOV - code coverage report
Current view: top level - src/bcs - ADVolumeJunction1PhaseBC.C (source / functions) Hit Total Coverage
Test: idaholab/moose thermal_hydraulics: #30301 (3b550b) with base 2ad78d Lines: 30 31 96.8 %
Date: 2025-07-30 13:02:48 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 "ADVolumeJunction1PhaseBC.h"
      11             : #include "ADVolumeJunction1PhaseUserObject.h"
      12             : #include "THMIndicesVACE.h"
      13             : 
      14             : registerMooseObject("ThermalHydraulicsApp", ADVolumeJunction1PhaseBC);
      15             : 
      16             : InputParameters
      17       15765 : ADVolumeJunction1PhaseBC::validParams()
      18             : {
      19       15765 :   InputParameters params = ADOneDIntegratedBC::validParams();
      20             : 
      21       31530 :   params.addRequiredParam<unsigned int>("connection_index", "Index of the connected flow channel");
      22       31530 :   params.addRequiredParam<UserObjectName>("volume_junction_uo", "Volume junction user object name");
      23             : 
      24       31530 :   params.addRequiredCoupledVar("A_elem", "Cross-sectional area, elemental");
      25       31530 :   params.addRequiredCoupledVar("A_linear", "Cross-sectional area, linear");
      26             : 
      27       31530 :   params.addRequiredCoupledVar("rhoA", "Flow channel variable: rho*A");
      28       31530 :   params.addRequiredCoupledVar("rhouA", "Flow channel variable: rho*u*A");
      29       31530 :   params.addRequiredCoupledVar("rhoEA", "Flow channel variable: rho*E*A");
      30             : 
      31       15765 :   params.addClassDescription(
      32             :       "Adds boundary fluxes for flow channels connected to a 1-phase volume junction");
      33             : 
      34       15765 :   return params;
      35           0 : }
      36             : 
      37        8628 : ADVolumeJunction1PhaseBC::ADVolumeJunction1PhaseBC(const InputParameters & params)
      38             :   : ADOneDIntegratedBC(params),
      39             : 
      40        8628 :     _connection_index(getParam<unsigned int>("connection_index")),
      41        8628 :     _volume_junction_uo(getUserObject<ADVolumeJunction1PhaseUserObject>("volume_junction_uo")),
      42             : 
      43        8628 :     _A_elem(adCoupledValue("A_elem")),
      44        8628 :     _A_linear(adCoupledValue("A_linear")),
      45             : 
      46        8628 :     _rhoA_jvar(coupled("rhoA")),
      47        8628 :     _rhouA_jvar(coupled("rhouA")),
      48        8628 :     _rhoEA_jvar(coupled("rhoEA")),
      49             : 
      50        8628 :     _flow_channel_jvar_map(getFlowChannelIndexMapping()),
      51       17256 :     _equation_index(_flow_channel_jvar_map.at(_var.number()))
      52             : {
      53        8628 : }
      54             : 
      55             : ADReal
      56      404766 : ADVolumeJunction1PhaseBC::computeQpResidual()
      57             : {
      58      404766 :   const auto & flux = _volume_junction_uo.getFlux(_connection_index);
      59             : 
      60             :   // Note that the ratio A_linear / A_elem is necessary because A_elem is passed
      61             :   // to the flux function, but A_linear is to be used on the boundary.
      62      404766 :   return flux[_equation_index] * _A_linear[_qp] / _A_elem[_qp] * _normal * _test[_i][_qp];
      63             : }
      64             : 
      65             : std::map<unsigned int, unsigned int>
      66        8628 : ADVolumeJunction1PhaseBC::getFlowChannelIndexMapping() const
      67             : {
      68             :   std::map<unsigned int, unsigned int> jvar_map;
      69        8628 :   jvar_map.insert(std::pair<unsigned int, unsigned int>(_rhoA_jvar, THMVACE1D::MASS));
      70        8628 :   jvar_map.insert(std::pair<unsigned int, unsigned int>(_rhouA_jvar, THMVACE1D::MOMENTUM));
      71        8628 :   jvar_map.insert(std::pair<unsigned int, unsigned int>(_rhoEA_jvar, THMVACE1D::ENERGY));
      72             : 
      73        8628 :   return jvar_map;
      74             : }

Generated by: LCOV version 1.14