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