https://mooseframework.inl.gov
SubChannelPointValue.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 
10 #include "SubChannelPointValue.h"
11 #include "FEProblemBase.h"
12 #include "Function.h"
13 #include "MooseMesh.h"
14 #include "MooseVariable.h"
15 #include "SubProblem.h"
16 #include "libmesh/system.h"
17 #include "SCM.h"
18 
20 
23 {
25  params.addRequiredParam<VariableName>("variable", "Variable you want the value of");
26  params.addRequiredParam<Real>("height", "Axial location of point [m]");
27  params.addRequiredParam<int>("index", "Index of subchannel");
28  params.addClassDescription(
29  "Prints out a user selected value of a specified subchannel at a user selected axial height");
30  return params;
31 }
32 
34  : GeneralPostprocessor(parameters),
35  _mesh(SCM::getConstMesh<SubChannelMesh>(_fe_problem.mesh())),
36  _height(getParam<Real>("height")),
37  _i_ch(getParam<int>("index")),
38  _var_number(_subproblem
39  .getVariable(_tid,
40  parameters.get<VariableName>("variable"),
43  .number()),
44  _system(_subproblem.getSystem(getParam<VariableName>("variable"))),
45  _value(0)
46 {
47  _point =
49 }
50 
51 void
53 {
54  _value = _system.point_value(_var_number, _point, false);
55 
57  {
58  auto pl = _subproblem.mesh().getPointLocator();
59  pl->enable_out_of_mesh_mode();
60  auto * elem = (*pl)(_point);
61  auto elem_id = elem ? elem->id() : DofObject::invalid_id;
62  gatherMin(elem_id);
63  if (elem_id == DofObject::invalid_id)
64  mooseError(name(), " height: No element located at given height.");
65  }
66 }
67 
68 Real
70 {
71  return _value;
72 }
virtual MooseMesh & mesh()=0
VarFieldType
bool absoluteFuzzyEqual(const T &var1, const T2 &var2, const T3 &tol=libMesh::TOLERANCE *libMesh::TOLERANCE)
registerMooseObject("SubChannelApp", SubChannelPointValue)
virtual Real getValue() const override
MeshBase & mesh
const unsigned int _var_number
void gatherMin(T &value)
static InputParameters validParams()
SubChannelPointValue(const InputParameters &params)
std::vector< std::vector< Real > > _subchannel_position
x,y coordinates of the subchannel centroids
virtual const std::string & name() const
void addRequiredParam(const std::string &name, const std::string &doc_string)
SubProblem & _subproblem
static InputParameters validParams()
const T & getConstMesh(const MooseMesh &mesh)
function to cast const mesh
Definition: SCM.h:21
VarKindType
Real _value
value we want to calculate
Calculates the value of a user selected variable at a user selected point in the assembly.
const SubChannelMesh & _mesh
geometric information
const int & _i_ch
subchannel index
VAR_ANY
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
virtual void execute() override
void mooseError(Args &&... args) const
void addClassDescription(const std::string &doc_string)
VAR_FIELD_STANDARD
Base class for subchannel meshes.
virtual std::unique_ptr< libMesh::PointLocatorBase > getPointLocator() const
void ErrorVector unsigned int
Definition: SCM.h:16
const Elem & get(const ElemType type_in)
const Real & _height
axial location [m]