LCOV - code coverage report
Current view: top level - src/kernels - VolumeJunctionCoupledFlux1PhaseKernel.C (source / functions) Hit Total Coverage
Test: idaholab/moose thermal_hydraulics: #32971 (54bef8) with base c6cf66 Lines: 35 36 97.2 %
Date: 2026-05-29 20:41:18 Functions: 3 3 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 "VolumeJunctionCoupledFlux1PhaseKernel.h"
      11             : #include "ADVolumeJunction1PhaseUserObject.h"
      12             : #include "ADNumericalFlux3EqnBase.h"
      13             : #include "SinglePhaseFluidProperties.h"
      14             : #include "THMIndicesVACE.h"
      15             : 
      16             : registerMooseObject("ThermalHydraulicsApp", VolumeJunctionCoupledFlux1PhaseKernel);
      17             : 
      18             : InputParameters
      19         475 : VolumeJunctionCoupledFlux1PhaseKernel::validParams()
      20             : {
      21         475 :   InputParameters params = ADKernel::validParams();
      22             : 
      23         950 :   params.addRequiredParam<unsigned int>("equation_index", "Equation index");
      24         950 :   params.addRequiredParam<PostprocessorName>("pressure", "Pressure post-processor");
      25         950 :   params.addRequiredParam<PostprocessorName>("temperature", "Temperature post-processor");
      26         950 :   params.addRequiredParam<Real>("A_coupled", "Area of the flux coupling");
      27         950 :   params.addRequiredParam<RealVectorValue>("normal_from_junction",
      28             :                                            "Unit normal vector from the junction");
      29         950 :   params.addRequiredParam<UserObjectName>("volume_junction_uo", "Volume junction object");
      30         950 :   params.addRequiredParam<UserObjectName>("numerical_flux_uo", "Numerical flux object");
      31         950 :   params.addRequiredParam<UserObjectName>("fluid_properties", "SinglePhaseFluidProperties object");
      32             : 
      33         475 :   params.addClassDescription(
      34             :       "Applies a flux to the volume junction for VolumeJunctionCoupledFlux1Phase.");
      35             : 
      36         475 :   return params;
      37           0 : }
      38             : 
      39         250 : VolumeJunctionCoupledFlux1PhaseKernel::VolumeJunctionCoupledFlux1PhaseKernel(
      40         250 :     const InputParameters & params)
      41             :   : ADKernel(params),
      42         250 :     _equation_index(getParam<unsigned int>("equation_index")),
      43         250 :     _p(getPostprocessorValue("pressure")),
      44         250 :     _T(getPostprocessorValue("temperature")),
      45         500 :     _A_coupled(getParam<Real>("A_coupled")),
      46         500 :     _normal_from_junction(getParam<RealVectorValue>("normal_from_junction")),
      47         250 :     _normal_to_junction(-_normal_from_junction),
      48         250 :     _volume_junction_uo(getUserObject<ADVolumeJunction1PhaseUserObject>("volume_junction_uo")),
      49         250 :     _numerical_flux_uo(getUserObject<ADNumericalFlux3EqnBase>("numerical_flux_uo")),
      50         500 :     _fp(getUserObject<SinglePhaseFluidProperties>("fluid_properties"))
      51             : {
      52         250 : }
      53             : 
      54             : ADReal
      55        2605 : VolumeJunctionCoupledFlux1PhaseKernel::computeQpResidual()
      56             : {
      57        2605 :   const auto rho = _fp.rho_from_p_T(_p, _T);
      58        2605 :   const auto E = _fp.e_from_p_T(_p, _T);
      59             : 
      60        2605 :   std::vector<ADReal> U(THMVACE3D::N_FLUX_INPUTS, 0.0);
      61        2605 :   U[THMVACE3D::RHOA] = rho * _A_coupled;
      62        2605 :   U[THMVACE3D::RHOEA] = rho * E * _A_coupled;
      63        2605 :   U[THMVACE3D::AREA] = _A_coupled;
      64             : 
      65             :   const auto flux_3d =
      66        2605 :       _volume_junction_uo.compute3DFlux(_numerical_flux_uo, U, _normal_to_junction);
      67        2605 :   const auto residual = _volume_junction_uo.computeResidual(flux_3d, U, _normal_to_junction, false);
      68        5210 :   return residual[_equation_index];
      69        2605 : }

Generated by: LCOV version 1.14