LCOV - code coverage report
Current view: top level - src/postprocessors - SCMPinSurfaceTemperature.C (source / functions) Hit Total Coverage
Test: idaholab/moose subchannel: #32971 (54bef8) with base c6cf66 Lines: 33 35 94.3 %
Date: 2026-05-29 20:40:47 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             : 
      22             : InputParameters
      23         222 : SCMPinSurfaceTemperature::validParams()
      24             : {
      25         222 :   InputParameters params = GeneralPostprocessor::validParams();
      26         222 :   params.addClassDescription(
      27             :       "Returns the surface temperature of a specific fuel pin at a user defined height. Applies a "
      28             :       "linear reconstruction for the temperature.");
      29         444 :   params.addRequiredParam<Real>("height", "Axial location on fuel pin [m]");
      30         444 :   params.addRequiredParam<int>("index", "Index of fuel pin");
      31         222 :   return params;
      32           0 : }
      33             : 
      34         111 : SCMPinSurfaceTemperature::SCMPinSurfaceTemperature(const InputParameters & parameters)
      35             :   : GeneralPostprocessor(parameters),
      36         111 :     _mesh(SCM::getConstMesh<SubChannelMesh>(_fe_problem.mesh())),
      37         222 :     _height(getParam<Real>("height")),
      38         222 :     _i_pin(getParam<int>("index")),
      39         111 :     _value(0)
      40             : {
      41         111 :   if (!_mesh.pinMeshExist())
      42           0 :     mooseError(
      43             :         name(),
      44             :         " : The SCMPinSurfaceTemperature post processor calculates temperature on pins. A Pin "
      45             :         "Mesh should be defined.");
      46         111 : }
      47             : 
      48             : void
      49         102 : SCMPinSurfaceTemperature::execute()
      50             : {
      51             :   // No data on other ranks
      52         102 :   if (processor_id() != 0)
      53           2 :     return;
      54         100 :   auto Tpin_soln = SolutionHandle(_fe_problem.getVariable(0, "Tpin"));
      55         100 :   auto nz = _mesh.getNumOfAxialCells();
      56         100 :   auto z_grid = _mesh.getZGrid();
      57             :   auto total_length =
      58         100 :       _mesh.getHeatedLength() + _mesh.getHeatedLengthEntry() + _mesh.getHeatedLengthExit();
      59             : 
      60         100 :   if (_height >= total_length)
      61             :   {
      62           4 :     auto * node = _mesh.getPinNode(_i_pin, nz);
      63           4 :     _value = Tpin_soln(node);
      64             :   }
      65             :   else
      66             :   {
      67         608 :     for (unsigned int iz = 0; iz < nz; iz++)
      68             :     {
      69         608 :       if (_height >= z_grid[iz] && _height < z_grid[iz + 1])
      70             :       {
      71          96 :         auto * node_out = _mesh.getPinNode(_i_pin, iz + 1);
      72          96 :         auto * node_in = _mesh.getPinNode(_i_pin, iz);
      73          96 :         _value = Tpin_soln(node_in) + (Tpin_soln(node_out) - Tpin_soln(node_in)) *
      74          96 :                                           (_height - z_grid[iz]) / (z_grid[iz + 1] - z_grid[iz]);
      75          96 :         break;
      76             :       }
      77             :     }
      78             :   }
      79         100 : }
      80             : 
      81             : Real
      82         102 : SCMPinSurfaceTemperature::getValue() const
      83             : {
      84         102 :   return _value;
      85             : }

Generated by: LCOV version 1.14