LCOV - code coverage report
Current view: top level - src/postprocessors - SCMPinSurfaceTemperature.C (source / functions) Hit Total Coverage
Test: idaholab/moose subchannel: #31405 (292dce) with base fef103 Lines: 24 33 72.7 %
Date: 2025-09-04 07:58:06 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 "SCMPinSurfaceTemperature.h"
      11             : #include "SolutionHandle.h"
      12             : #include "FEProblemBase.h"
      13             : #include "Function.h"
      14             : #include "MooseMesh.h"
      15             : #include "MooseVariable.h"
      16             : #include "SubProblem.h"
      17             : #include "libmesh/system.h"
      18             : #include "SCM.h"
      19             : 
      20             : registerMooseObject("SubChannelApp", SCMPinSurfaceTemperature);
      21             : registerMooseObjectRenamed("SubChannelApp",
      22             :                            PinSurfaceTemperature,
      23             :                            "06/30/2025 24:00",
      24             :                            SCMPinSurfaceTemperature);
      25             : 
      26             : InputParameters
      27          12 : SCMPinSurfaceTemperature::validParams()
      28             : {
      29          12 :   InputParameters params = GeneralPostprocessor::validParams();
      30          12 :   params.addClassDescription(
      31             :       "Returns the surface temperature of a specific fuel pin at a user defined height. Applies a "
      32             :       "linear reconstruction for the temperature.");
      33          24 :   params.addRequiredParam<Real>("height", "Axial location on fuel pin [m]");
      34          24 :   params.addRequiredParam<int>("index", "Index of fuel pin");
      35          12 :   return params;
      36           0 : }
      37             : 
      38           6 : SCMPinSurfaceTemperature::SCMPinSurfaceTemperature(const InputParameters & parameters)
      39             :   : GeneralPostprocessor(parameters),
      40           6 :     _mesh(SCM::getConstMesh<SubChannelMesh>(_fe_problem.mesh())),
      41          12 :     _height(getParam<Real>("height")),
      42          12 :     _i_pin(getParam<int>("index")),
      43           6 :     _value(0)
      44             : {
      45           6 :   if (!_mesh.pinMeshExist())
      46           0 :     mooseError(
      47             :         name(),
      48             :         " : The SCMPinSurfaceTemperature post processor calculates temperature on pins. A Pin "
      49             :         "Mesh should be defined.");
      50           6 : }
      51             : 
      52             : void
      53           6 : SCMPinSurfaceTemperature::execute()
      54             : {
      55           6 :   auto Tpin_soln = SolutionHandle(_fe_problem.getVariable(0, "Tpin"));
      56           6 :   auto nz = _mesh.getNumOfAxialCells();
      57           6 :   auto z_grid = _mesh.getZGrid();
      58             :   auto total_length =
      59           6 :       _mesh.getHeatedLength() + _mesh.getHeatedLengthEntry() + _mesh.getHeatedLengthExit();
      60             : 
      61           6 :   if (_height >= total_length)
      62             :   {
      63           6 :     auto * node = _mesh.getPinNode(_i_pin, nz);
      64           6 :     _value = Tpin_soln(node);
      65             :   }
      66             :   else
      67             :   {
      68           0 :     for (unsigned int iz = 0; iz < nz; iz++)
      69             :     {
      70           0 :       if (_height >= z_grid[iz] && _height < z_grid[iz + 1])
      71             :       {
      72           0 :         auto * node_out = _mesh.getPinNode(_i_pin, iz + 1);
      73           0 :         auto * node_in = _mesh.getPinNode(_i_pin, iz);
      74           0 :         _value = Tpin_soln(node_in) + (Tpin_soln(node_out) - Tpin_soln(node_in)) *
      75           0 :                                           (_height - z_grid[iz]) / (z_grid[iz + 1] - z_grid[iz]);
      76           0 :         break;
      77             :       }
      78             :     }
      79             :   }
      80           6 : }
      81             : 
      82             : Real
      83           6 : SCMPinSurfaceTemperature::getValue() const
      84             : {
      85           6 :   return _value;
      86             : }

Generated by: LCOV version 1.14