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

Generated by: LCOV version 1.14