LCOV - code coverage report
Current view: top level - src/postprocessors - VolumeJunctionCoupledFlux1PhasePostprocessor.C (source / functions) Hit Total Coverage
Test: idaholab/moose thermal_hydraulics: #31785 (ce6ccf) with base ac8805 Lines: 41 42 97.6 %
Date: 2025-11-07 22:18:25 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 "VolumeJunctionCoupledFlux1PhasePostprocessor.h"
      11             : #include "ADVolumeJunction1PhaseUserObject.h"
      12             : #include "ADNumericalFlux3EqnBase.h"
      13             : #include "SinglePhaseFluidProperties.h"
      14             : #include "THMIndicesVACE.h"
      15             : 
      16             : registerMooseObject("ThermalHydraulicsApp", VolumeJunctionCoupledFlux1PhasePostprocessor);
      17             : 
      18             : InputParameters
      19          76 : VolumeJunctionCoupledFlux1PhasePostprocessor::validParams()
      20             : {
      21          76 :   InputParameters params = GeneralPostprocessor::validParams();
      22             : 
      23         152 :   MooseEnum equation("mass energy");
      24         152 :   params.addRequiredParam<MooseEnum>(
      25             :       "equation", equation, "Equation for which to query flux vector");
      26         152 :   params.addRequiredParam<PostprocessorName>("pressure", "Pressure post-processor");
      27         152 :   params.addRequiredParam<PostprocessorName>("temperature", "Temperature post-processor");
      28         152 :   params.addRequiredParam<Real>("A_coupled", "Area of the flux coupling");
      29         152 :   params.addRequiredParam<RealVectorValue>("normal_from_junction",
      30             :                                            "Unit normal vector from the junction");
      31         152 :   params.addRequiredParam<UserObjectName>(
      32             :       "volume_junction_uo",
      33             :       "ADVolumeJunction1PhaseUserObject object corresponding to the volume junction");
      34         152 :   params.addRequiredParam<UserObjectName>("numerical_flux_uo", "ADNumericalFlux3EqnBase object");
      35         152 :   params.addRequiredParam<UserObjectName>("fluid_properties", "SinglePhaseFluidProperties object");
      36             : 
      37          76 :   params.addClassDescription("Computes a mass or energy flux for VolumeJunctionCoupledFlux1Phase.");
      38             : 
      39          76 :   return params;
      40          76 : }
      41             : 
      42          38 : VolumeJunctionCoupledFlux1PhasePostprocessor::VolumeJunctionCoupledFlux1PhasePostprocessor(
      43          38 :     const InputParameters & parameters)
      44             :   : GeneralPostprocessor(parameters),
      45          38 :     _equation(getParam<MooseEnum>("equation")),
      46          38 :     _p(getPostprocessorValue("pressure")),
      47          38 :     _T(getPostprocessorValue("temperature")),
      48          76 :     _A_coupled(getParam<Real>("A_coupled")),
      49          76 :     _normal_from_junction(getParam<RealVectorValue>("normal_from_junction")),
      50          38 :     _normal_to_junction(-_normal_from_junction),
      51          38 :     _volume_junction_uo(getUserObject<ADVolumeJunction1PhaseUserObject>("volume_junction_uo")),
      52          38 :     _numerical_flux_uo(getUserObject<ADNumericalFlux3EqnBase>("numerical_flux_uo")),
      53          76 :     _fp(getUserObject<SinglePhaseFluidProperties>("fluid_properties"))
      54             : {
      55          38 : }
      56             : 
      57             : void
      58         142 : VolumeJunctionCoupledFlux1PhasePostprocessor::finalize()
      59             : {
      60         142 :   const auto rho = _fp.rho_from_p_T(_p, _T);
      61         142 :   const auto E = _fp.e_from_p_T(_p, _T);
      62             : 
      63         142 :   std::vector<ADReal> U(THMVACE3D::N_FLUX_INPUTS, 0.0);
      64         142 :   U[THMVACE3D::RHOA] = rho * _A_coupled;
      65         142 :   U[THMVACE3D::RHOEA] = rho * E * _A_coupled;
      66         142 :   U[THMVACE3D::AREA] = _A_coupled;
      67             : 
      68             :   const auto flux_3d =
      69         142 :       _volume_junction_uo.compute3DFlux(_numerical_flux_uo, U, _normal_to_junction);
      70             : 
      71         142 :   if (_equation == "mass")
      72          71 :     _value = raw_value(flux_3d[THMVACE3D::MASS]);
      73          71 :   else if (_equation == "energy")
      74          71 :     _value = raw_value(flux_3d[THMVACE3D::ENERGY]);
      75             :   else
      76           0 :     mooseError("Invalid MooseEnum value.");
      77         142 : }
      78             : 
      79             : PostprocessorValue
      80         142 : VolumeJunctionCoupledFlux1PhasePostprocessor::getValue() const
      81             : {
      82         142 :   return _value;
      83             : }

Generated by: LCOV version 1.14