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 18 : SCMPinSurfaceTemperature::validParams() 28 : { 29 18 : InputParameters params = GeneralPostprocessor::validParams(); 30 18 : 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 36 : params.addRequiredParam<Real>("height", "Axial location on fuel pin [m]"); 34 36 : params.addRequiredParam<int>("index", "Index of fuel pin"); 35 18 : return params; 36 0 : } 37 : 38 9 : SCMPinSurfaceTemperature::SCMPinSurfaceTemperature(const InputParameters & parameters) 39 : : GeneralPostprocessor(parameters), 40 9 : _mesh(SCM::getConstMesh<SubChannelMesh>(_fe_problem.mesh())), 41 18 : _height(getParam<Real>("height")), 42 18 : _i_pin(getParam<int>("index")), 43 9 : _value(0) 44 : { 45 9 : 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 9 : } 51 : 52 : void 53 9 : SCMPinSurfaceTemperature::execute() 54 : { 55 : // No data on other ranks 56 9 : if (processor_id() != 0) 57 3 : return; 58 6 : auto Tpin_soln = SolutionHandle(_fe_problem.getVariable(0, "Tpin")); 59 6 : auto nz = _mesh.getNumOfAxialCells(); 60 6 : auto z_grid = _mesh.getZGrid(); 61 : auto total_length = 62 6 : _mesh.getHeatedLength() + _mesh.getHeatedLengthEntry() + _mesh.getHeatedLengthExit(); 63 : 64 6 : if (_height >= total_length) 65 : { 66 6 : auto * node = _mesh.getPinNode(_i_pin, nz); 67 6 : _value = Tpin_soln(node); 68 : } 69 : else 70 : { 71 0 : for (unsigned int iz = 0; iz < nz; iz++) 72 : { 73 0 : if (_height >= z_grid[iz] && _height < z_grid[iz + 1]) 74 : { 75 0 : auto * node_out = _mesh.getPinNode(_i_pin, iz + 1); 76 0 : auto * node_in = _mesh.getPinNode(_i_pin, iz); 77 0 : _value = Tpin_soln(node_in) + (Tpin_soln(node_out) - Tpin_soln(node_in)) * 78 0 : (_height - z_grid[iz]) / (z_grid[iz + 1] - z_grid[iz]); 79 0 : break; 80 : } 81 : } 82 : } 83 6 : } 84 : 85 : Real 86 9 : SCMPinSurfaceTemperature::getValue() const 87 : { 88 9 : return _value; 89 : }