LCOV - code coverage report
Current view: top level - src/bcs - ADJunctionOneToOne1PhaseBC.C (source / functions) Hit Total Coverage
Test: idaholab/moose thermal_hydraulics: #32971 (54bef8) with base c6cf66 Lines: 26 27 96.3 %
Date: 2026-05-29 20:41:18 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 "ADJunctionOneToOne1PhaseBC.h"
      11             : #include "ADJunctionOneToOne1PhaseUserObject.h"
      12             : #include "THMIndicesVACE.h"
      13             : 
      14             : registerMooseObject("ThermalHydraulicsApp", ADJunctionOneToOne1PhaseBC);
      15             : 
      16             : InputParameters
      17        1314 : ADJunctionOneToOne1PhaseBC::validParams()
      18             : {
      19        1314 :   InputParameters params = ADOneDIntegratedBC::validParams();
      20             : 
      21        2628 :   params.addRequiredParam<unsigned int>("connection_index", "Index of the connected flow channel");
      22        2628 :   params.addRequiredParam<UserObjectName>("junction_uo", "1-phase one-to-one junction user object");
      23             : 
      24        2628 :   params.addRequiredCoupledVar("rhoA", "Flow channel variable: rho*A");
      25        2628 :   params.addRequiredCoupledVar("rhouA", "Flow channel variable: rho*u*A");
      26        2628 :   params.addRequiredCoupledVar("rhoEA", "Flow channel variable: rho*E*A");
      27             : 
      28        1314 :   params.addClassDescription(
      29             :       "Adds boundary fluxes for flow channels connected to a 1-phase one-to-one junction");
      30             : 
      31        1314 :   return params;
      32           0 : }
      33             : 
      34         696 : ADJunctionOneToOne1PhaseBC::ADJunctionOneToOne1PhaseBC(const InputParameters & params)
      35             :   : ADOneDIntegratedBC(params),
      36             : 
      37         696 :     _connection_index(getParam<unsigned int>("connection_index")),
      38         696 :     _junction_uo(getUserObject<ADJunctionOneToOne1PhaseUserObject>("junction_uo")),
      39             : 
      40         696 :     _rhoA_jvar(coupled("rhoA")),
      41         696 :     _rhouA_jvar(coupled("rhouA")),
      42         696 :     _rhoEA_jvar(coupled("rhoEA")),
      43             : 
      44         696 :     _jvar_map(getIndexMapping()),
      45        1392 :     _equation_index(_jvar_map.at(_var.number()))
      46             : {
      47         696 : }
      48             : 
      49             : ADReal
      50       25122 : ADJunctionOneToOne1PhaseBC::computeQpResidual()
      51             : {
      52       25122 :   const auto & flux = _junction_uo.getFlux(_connection_index);
      53             : 
      54       25122 :   return flux[_equation_index] * _normal * _test[_i][_qp];
      55             : }
      56             : 
      57             : std::map<unsigned int, unsigned int>
      58         696 : ADJunctionOneToOne1PhaseBC::getIndexMapping() const
      59             : {
      60             :   std::map<unsigned int, unsigned int> jvar_map;
      61         696 :   jvar_map.insert(std::pair<unsigned int, unsigned int>(_rhoA_jvar, THMVACE1D::MASS));
      62         696 :   jvar_map.insert(std::pair<unsigned int, unsigned int>(_rhouA_jvar, THMVACE1D::MOMENTUM));
      63         696 :   jvar_map.insert(std::pair<unsigned int, unsigned int>(_rhoEA_jvar, THMVACE1D::ENERGY));
      64             : 
      65         696 :   return jvar_map;
      66             : }

Generated by: LCOV version 1.14