https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
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");
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"),
41 Moose::VarKindType::VAR_ANY,
42 Moose::VarFieldType::VAR_FIELD_STANDARD)
43 .number()),
44 _system(_subproblem.getSystem(getParam<VariableName>("variable"))),
45 _value(0)
46{
47 _point =
49}
50
51void
53{
54 _value = _system.point_value(_var_number, _point, false);
55
56 if (MooseUtils::absoluteFuzzyEqual(_value, 0.0))
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
68Real
70{
71 return _value;
72}
registerMooseObject("SubChannelApp", SubChannelPointValue)
void ErrorVector unsigned int
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 mooseError(Args &&... args) const
virtual std::unique_ptr< libMesh::PointLocatorBase > getPointLocator() const
Base class for subchannel meshes.
std::vector< std::vector< Real > > _subchannel_position
x,y coordinates of the subchannel centroids
Calculates the value of a user selected variable at a user selected point in the assembly.
static InputParameters validParams()
SubChannelPointValue(const InputParameters &params)
virtual void execute() override
const Real & _height
axial location [m]
virtual Real getValue() const override
Real _value
value we want to calculate
const unsigned int _var_number
const int & _i_ch
subchannel index
const SubChannelMesh & _mesh
geometric information
virtual MooseMesh & mesh()=0
SubProblem & _subproblem
void gatherMin(T &value)
MeshBase & mesh
Definition SCM.h:17