https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
24{
27 "Returns the surface temperature of a specific fuel pin at a user defined height. Applies a "
28 "linear reconstruction for the temperature.");
29 params.addRequiredParam<Real>("height", "Axial location on fuel pin [m]");
30 params.addRequiredParam<unsigned int>("index", "Index of fuel pin");
31 return params;
32}
33
35 : GeneralPostprocessor(parameters),
36 _mesh(SCM::getConstMesh<SubChannelMesh>(_fe_problem.mesh())),
37 _height(getParam<Real>("height")),
38 _i_pin(getParam<unsigned int>("index")),
39 _value(0)
40{
41 if (!_mesh.pinMeshExist())
43 name(),
44 " : The SCMPinSurfaceTemperature post processor calculates temperature on pins. A Pin "
45 "Mesh should be defined.");
46 // getNumOfPins() is zero off rank 0, so every rank checks against the rank 0 count
47 auto n_pins = _mesh.getNumOfPins();
49 if (_i_pin >= n_pins)
50 paramError("index", "is out of range; valid pin indices are 0 to ", n_pins - 1, ".");
51 if (MooseUtils::absoluteFuzzyLessThan(_height, _mesh.getZGrid().front()))
53 "height", _height, " is below the inlet of the mesh at ", _mesh.getZGrid().front(), ".");
55}
56
57void
59{
60 // Creating a solution handle is collective, so it must happen on every processor
61 const auto Tpin_soln = SolutionHandle(_fe_problem.getVariable(0, "Tpin"));
62 // No data on other ranks
63 if (processor_id() != 0)
64 return;
65 _value = Tpin_soln.interpolate(
67}
68
69void
71{
72 // The subchannel solution is only available on processor 0
74}
75
76Real
78{
79 return _value;
80}
registerMooseObject("SubChannelApp", SCMPinSurfaceTemperature)
void ErrorVector unsigned int
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()
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
const std::string & name() const
void paramError(const std::string &param, Args... args) const
void mooseError(Args &&... args) const
Returns the surface temperature of a specific fuel pin at a user defined height.
virtual void execute() override
const Real & _height
axial location [m]
static InputParameters validParams()
Real _weight
linear interpolation weight of the height within the axial cell
unsigned int _iz
axial cell containing the height
const SubChannelMesh & _mesh
geometric information
const unsigned int & _i_pin
pin index
virtual Real getValue() const override
virtual void finalize() override
SCMPinSurfaceTemperature(const InputParameters &params)
Real _value
value we want to calculate
Provide a simple RAII interface for linear lagrange solution variables.
Base class for subchannel meshes.
virtual const std::vector< Real > & getZGrid() const
Get axial location of layers.
bool pinMeshExist() const
Return if Pin Mesh exists or not.
virtual unsigned int getNumOfPins() const =0
Return the number of pins.
std::pair< unsigned int, Real > getAxialInterpolation(Real z) const
Get the axial cell containing height z and the linear interpolation weight within it.
virtual Node * getPinNode(unsigned int i_pin, unsigned int iz) const =0
Get the pin mesh node for a given pin index and elevation index.
void broadcast(T &data, const unsigned int root_id=0, const bool identical_sizes=false) const
FEProblemBase & _fe_problem
const Parallel::Communicator & _communicator
processor_id_type processor_id() const
MeshBase & mesh
Definition SCM.h:18