https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Postprocessor.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 "Postprocessor.h"
11#include "UserObject.h"
12#include "ReporterName.h"
13#include "ReporterContext.h"
14#include "FEProblemBase.h"
15
18{
21
22 params.registerBase("Postprocessor");
23 return params;
24}
25
27 : OutputInterface(moose_object->parameters()),
28 NonADFunctorInterface(moose_object),
29 Moose::FunctorBase<Real>(moose_object->name()),
30 _pp_name(moose_object->name()),
31 _current_value(declareValue(*moose_object)),
32 _pp_moose_object(*moose_object)
33{
34}
35
36#ifdef MOOSE_KOKKOS_ENABLED
38 : OutputInterface(object, key),
39 NonADFunctorInterface(object, key),
40 Moose::FunctorBase<Real>(object, key),
41 _pp_name(object._pp_name),
42 _current_value(object._current_value),
43 _pp_moose_object(object._pp_moose_object)
44{
45}
46#endif
47
50{
51 auto & fe_problem =
52 *moose_object.parameters().getCheckedPointerParam<FEProblemBase *>("_fe_problem_base");
53
55
56 const bool is_thread_0 = moose_object.parameters().get<THREAD_ID>("_tid") == 0;
57 mooseAssert(is_thread_0 ==
58 !fe_problem.getReporterData().hasReporterValue<PostprocessorValue>(r_name),
59 "Postprocessor Reporter threaded value declaration mismatch");
60
61 // Declare the Reporter value on thread 0 only; this lets us add error checking to
62 // make sure that it really is added only once
63 if (is_thread_0)
64 fe_problem.getReporterData(ReporterData::WriteKey())
66 r_name, REPORTER_MODE_UNSET, moose_object);
67
68 // At this point, thread 0 should have declared the value and getting it should be valid
69 return fe_problem.getReporterData().getReporterValue<PostprocessorValue>(r_name);
70}
71
73Postprocessor::evaluate(const ElemArg & /*elem_arg*/, const Moose::StateArg & /*state*/) const
74{
75 return getCurrentValue();
76}
77
79Postprocessor::evaluate(const FaceArg & /*face*/, const Moose::StateArg & /*state*/) const
80{
81 return getCurrentValue();
82}
83
85Postprocessor::evaluate(const ElemQpArg & /*elem_qp*/, const Moose::StateArg & /*state*/) const
86{
87 return getCurrentValue();
88}
89
91Postprocessor::evaluate(const ElemSideQpArg & /*elem_side_qp*/,
92 const Moose::StateArg & /*state*/) const
93{
94 return getCurrentValue();
95}
96
98Postprocessor::evaluate(const ElemPointArg & /*elem_point_arg*/,
99 const Moose::StateArg & /*state*/) const
100{
101 return getCurrentValue();
102}
103
105Postprocessor::evaluate(const NodeArg & /*node_arg*/, const Moose::StateArg & /*state*/) const
106{
107 return getCurrentValue();
108}
109
112 const Moose::StateArg & /*state*/) const
113{
114 return 0;
115}
116
118Postprocessor::evaluateGradient(const FaceArg & /*face*/, const Moose::StateArg & /*state*/) const
119{
120 return 0;
121}
122
125 const Moose::StateArg & /*state*/) const
126{
127 return 0;
128}
129
132 const Moose::StateArg & /*state*/) const
133{
134 return 0;
135}
136
139 const Moose::StateArg & /*state*/) const
140{
141 return 0;
142}
143
146 const Moose::StateArg & /*state*/) const
147{
148 return 0;
149}
150
152Postprocessor::evaluateDot(const ElemArg & /*elem_arg*/, const Moose::StateArg & /*state*/) const
153{
155 return 0;
156}
157
159Postprocessor::evaluateDot(const FaceArg & /*face*/, const Moose::StateArg & /*state*/) const
160{
162 return 0;
163}
164
166Postprocessor::evaluateDot(const ElemQpArg & /*elem_qp*/, const Moose::StateArg & /*state*/) const
167{
169 return 0;
170}
171
174 const Moose::StateArg & /*state*/) const
175{
177 return 0;
178}
179
181Postprocessor::evaluateDot(const ElemPointArg & /*elem_point_arg*/,
182 const Moose::StateArg & /*state*/) const
183{
185 return 0;
186}
187
189Postprocessor::evaluateDot(const NodeArg & /*node_arg*/, const Moose::StateArg & /*state*/) const
190{
192 return 0;
193}
194
195void
197{
198 mooseDoOnce(_pp_moose_object.mooseWarning(
199 "The time derivative functor operator was called on this post-processor.\n\nA zero value "
200 "will always be returned, even if the post-processor value changes with time."));
201}
Real PostprocessorValue
various MOOSE typedefs
Definition MooseTypes.h:230
unsigned int THREAD_ID
Definition MooseTypes.h:237
const ReporterMode REPORTER_MODE_UNSET
Specialization of SubProblem for solving nonlinear equations plus auxiliary equations.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
void registerBase(const std::string &value)
This method must be called from every base "Moose System" to create linkage with the Action System.
std::vector< std::pair< R1, R2 > > get(const std::string &param1, const std::string &param2) const
Combine two vector parameters into a single vector of pairs.
T getCheckedPointerParam(const std::string &name, const std::string &error_string="") const
Verifies that the requested parameter exists and is not NULL and returns it to the caller.
const InputParameters & parameters() const
Get the parameters of the object.
Definition MooseBase.h:131
Every object that can be built by the factory should be derived from this class.
Definition MooseObject.h:31
typename FunctorReturnType< Real, FunctorEvaluationKind::Gradient >::type GradientType
This rigmarole makes it so that a user can create functors that return containers (std::vector,...
An interface for accessing Moose::Functors for systems that do not care about automatic differentiati...
static InputParameters validParams()
A class to provide an common interface to objects requiring "outputs" option.
static InputParameters validParams()
A ReporterName that represents a Postprocessor.
Base class for all Postprocessors.
GradientType evaluateGradient(const ElemArg &elem, const Moose::StateArg &state) const override final
Evaluate the functor gradient with a given element.
void evaluateDotWarning() const
Internal method for giving a one-time warning for calling an evaluateDot() method.
const std::string & _pp_name
Post-processor name.
const MooseObject & _pp_moose_object
MOOSE object.
const PostprocessorValue & declareValue(const MooseObject &moose_object)
Internal method to be used to declare the value and store it within _current_value in the constructor...
static InputParameters validParams()
DotType evaluateDot(const ElemArg &elem, const Moose::StateArg &state) const override final
Evaluate the functor time derivative with a given element.
const PostprocessorValue & getCurrentValue() const
Postprocessor(const MooseObject *moose_object)
ValueType evaluate(const ElemArg &elem, const Moose::StateArg &state) const override final
Evaluate the functor with a given element.
void mooseWarning(Args &&... args) const
MOOSE now contains C++17 code, so give a reasonable error message stating what the user can do to add...
A structure that is used to evaluate Moose functors logically at an element/cell center.
A structure that is used to evaluate Moose functors at an arbitrary physical point contained within a...
Argument for requesting functor evaluation at a quadrature point location in an element.
Argument for requesting functor evaluation at quadrature point locations on an element side.
A structure defining a "face" evaluation calling argument for Moose functors.
State argument for evaluating functors.