https://mooseframework.inl.gov
NodalMaxValueId.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 "NodalMaxValueId.h"
11 #include "MooseMesh.h"
12 #include "SubProblem.h"
13 // libMesh
14 #include "libmesh/boundary_info.h"
15 
17 registerMooseObjectRenamed("MooseApp", NodalProxyMaxValue, "04/01/2022 00:00", NodalMaxValueId);
18 
21 {
23  params.addClassDescription(
24  "Finds the node id with the maximum nodal value across all postprocessors.");
25  return params;
26 }
27 
29  : NodalVariablePostprocessor(parameters), _value(-std::numeric_limits<Real>::max())
30 {
31 }
32 
33 void
35 {
37 }
38 
39 Real
41 {
42  return _u[_qp];
43 }
44 
45 void
47 {
48  Real val = computeValue();
49 
50  if (val > _value)
51  {
52  _value = val;
53  _node_id = _current_node->id();
54  }
55 }
56 
57 Real
59 {
60  return _node_id;
61 }
62 
63 void
65 {
67 }
68 
69 void
71 {
72  const auto & pps = static_cast<const NodalMaxValueId &>(y);
73  if (pps._value > _value)
74  {
75  _value = pps._value;
76  _node_id = pps._node_id;
77  }
78 }
This is a base class for other classes which compute post-processed values based on nodal solution va...
static InputParameters validParams()
virtual void initialize() override
Called before execute() is ever called so that data can be cleared.
const Node *const & _current_node
Reference to current node pointer.
const VariableValue & _u
Holds the solution at current quadrature points.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
virtual Real getValue() const override
This will get called to actually grab the final value the postprocessor has calculated.
void threadJoin(const UserObject &y) override
Must override.
auto max(const L &left, const R &right)
dof_id_type _node_id
void gatherProxyValueMax(T1 &proxy, T2 &value)
Deteremine the value of a variable according to the parallel maximum of the provided proxy...
Definition: UserObject.h:239
const unsigned int _qp
Quadrature point index.
Computes the id of the node with the maximum value across all processes.
registerMooseObject("MooseApp", NodalMaxValueId)
virtual void finalize() override
This is called after execute() and after threadJoin()! This is probably where you want to do MPI comm...
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
registerMooseObjectRenamed("MooseApp", NodalProxyMaxValue, "04/01/2022 00:00", NodalMaxValueId)
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump...
virtual void execute() override
Execute method.
static InputParameters validParams()
virtual Real computeValue()
The method called to compute the value that will be returned by the proxy value.
Base class for user-specific data.
Definition: UserObject.h:40
NodalMaxValueId(const InputParameters &parameters)