https://mooseframework.inl.gov
SCMPinSurfaceTemperature.C
Go to the documentation of this file.
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 
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 
21 registerMooseObjectRenamed("SubChannelApp",
22  PinSurfaceTemperature,
23  "06/30/2025 24:00",
25 
28 {
30  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  params.addRequiredParam<Real>("height", "Axial location on fuel pin [m]");
34  params.addRequiredParam<int>("index", "Index of fuel pin");
35  return params;
36 }
37 
39  : GeneralPostprocessor(parameters),
40  _mesh(SCM::getConstMesh<SubChannelMesh>(_fe_problem.mesh())),
41  _height(getParam<Real>("height")),
42  _i_pin(getParam<int>("index")),
43  _value(0)
44 {
45  if (!_mesh.pinMeshExist())
46  mooseError(
47  name(),
48  " : The SCMPinSurfaceTemperature post processor calculates temperature on pins. A Pin "
49  "Mesh should be defined.");
50 }
51 
52 void
54 {
55  auto Tpin_soln = SolutionHandle(_fe_problem.getVariable(0, "Tpin"));
56  auto nz = _mesh.getNumOfAxialCells();
57  auto z_grid = _mesh.getZGrid();
58  auto total_length =
60 
61  if (_height >= total_length)
62  {
63  auto * node = _mesh.getPinNode(_i_pin, nz);
64  _value = Tpin_soln(node);
65  }
66  else
67  {
68  for (unsigned int iz = 0; iz < nz; iz++)
69  {
70  if (_height >= z_grid[iz] && _height < z_grid[iz + 1])
71  {
72  auto * node_out = _mesh.getPinNode(_i_pin, iz + 1);
73  auto * node_in = _mesh.getPinNode(_i_pin, iz);
74  _value = Tpin_soln(node_in) + (Tpin_soln(node_out) - Tpin_soln(node_in)) *
75  (_height - z_grid[iz]) / (z_grid[iz + 1] - z_grid[iz]);
76  break;
77  }
78  }
79  }
80 }
81 
82 Real
84 {
85  return _value;
86 }
Returns the surface temperature of a specific fuel pin at a user defined height.
virtual const std::vector< Real > & getZGrid() const
Get axial location of layers.
MeshBase & mesh
Provide a simple RAII interface for linear lagrange solution variables.
registerMooseObject("SubChannelApp", SCMPinSurfaceTemperature)
virtual Node * getPinNode(unsigned int i_pin, unsigned iz) const =0
Get the pin mesh node for a given pin index and elevation index.
virtual const std::string & name() const
void addRequiredParam(const std::string &name, const std::string &doc_string)
virtual const MooseVariableFieldBase & getVariable(const THREAD_ID tid, const std::string &var_name, Moose::VarKindType expected_var_type=Moose::VarKindType::VAR_ANY, Moose::VarFieldType expected_var_field_type=Moose::VarFieldType::VAR_FIELD_ANY) const override
static InputParameters validParams()
virtual const Real & getHeatedLength() const
Return heated length.
const T & getConstMesh(const MooseMesh &mesh)
function to cast const mesh
Definition: SCM.h:21
virtual void execute() override
virtual const unsigned int & getNumOfAxialCells() const
Return the number of axial cells.
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual bool pinMeshExist() const =0
Return if Pin Mesh exists or not.
FEProblemBase & _fe_problem
const Real & _height
axial location [m]
Real _value
value we want to calculate
const SubChannelMesh & _mesh
geometric information
void mooseError(Args &&... args) const
void addClassDescription(const std::string &doc_string)
Base class for subchannel meshes.
virtual const Real & getHeatedLengthExit() const
Return unheated length at exit.
static InputParameters validParams()
void ErrorVector unsigned int
Definition: SCM.h:16
virtual const Real & getHeatedLengthEntry() const
Return unheated length at entry.
registerMooseObjectRenamed("SubChannelApp", PinSurfaceTemperature, "06/30/2025 24:00", SCMPinSurfaceTemperature)
SCMPinSurfaceTemperature(const InputParameters &params)
virtual Real getValue() const override