https://mooseframework.inl.gov
Loading...
Searching...
No Matches
TimeIntegratedPostprocessor.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 "CrankNicolson.h"
12#include "TransientBase.h"
13
16 TotalVariableValue,
17 "04/01/2022 00:00",
19
22{
24 params.addClassDescription("Integrate a Postprocessor value over time.");
25 params.addParam<PostprocessorName>("value", "The name of the postprocessor");
26 MooseEnum schemes("implicit-euler trapezoidal-rule", "trapezoidal-rule");
27 params.addParam<MooseEnum>(
28 "time_integration_scheme", schemes, "Time integration scheme to use for the postprocessors");
29 return params;
30}
31
33 : GeneralPostprocessor(parameters),
34 _value(0),
35 _value_old(getPostprocessorValueOldByName(name())),
36 _pps_value(getPostprocessorValue("value")),
37 _pps_value_old(getPostprocessorValueOld("value")),
38 _time_integration_scheme(getParam<MooseEnum>("time_integration_scheme"))
39{
40 if (!dynamic_cast<TransientBase *>(_app.getExecutioner()))
42 "Time integration of postprocessor has only been implemented with a transient executioner");
43
44 // Only check if the user did not select it manually
45 if (!isParamSetByUser("time_integration_scheme"))
46 {
47 const auto time_integrators =
48 dynamic_cast<TransientBase *>(_app.getExecutioner())->getTimeIntegrators();
49 for (const auto & ti : time_integrators)
51 !dynamic_cast<CrankNicolson *>(ti))
53 "The time integration in this postprocessor uses the trapezoidal rule method. The "
54 "equation time integration scheme does not use the trapezoidal rule. If the "
55 "postprocessor uses variable values, even indirectly, we would recommend you "
56 "code the same time integration method for the time-integrated postprocessor. "
57 "Specify the 'time_integration_scheme' parameter to silence this warning.");
58 }
59}
60
61void
65
66void
68{
71 // 2nd order trapezoidal rule is a better default for other integrators
72 else
74}
75
76Real
void mooseInfo(Args &&... args)
Emit an informational message with the given stringified, concatenated args.
Definition MooseError.h:401
void mooseError(Args &&... args)
Emit an error message with the given stringified, concatenated args and terminate the application.
Definition MooseError.h:311
registerMooseObject("MooseApp", TimeIntegratedPostprocessor)
registerMooseObjectRenamed("MooseApp", TotalVariableValue, "04/01/2022 00:00", TimeIntegratedPostprocessor)
Crank-Nicolson time integrator.
This class is here to combine the Postprocessor interface and the base class Postprocessor object alo...
static InputParameters validParams()
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an optional parameter and a documentation string to the InputParameters object.
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.
Executioner * getExecutioner() const
Retrieve the Executioner for this App.
Definition MooseApp.C:2015
bool isParamSetByUser(const std::string &name) const
Test if the supplied parameter is set by a user, as opposed to not set or set to default.
Definition MooseBase.h:205
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition MooseEnum.h:55
MooseApp & _app
The MOOSE application this is associated with.
Definition MooseBase.h:375
Integrate a post-processor value over time using trapezoidal rule.
Real _value
The total value of the variable.
virtual void initialize() override
Called before execute() is ever called so that data can be cleared.
const PostprocessorValue & _value_old
My old value.
virtual void execute() override
Execute method.
const PostprocessorValue & _pps_value_old
The old post-processor value.
const MooseEnum & _time_integration_scheme
The time integration method.
const PostprocessorValue & _pps_value
The current post-processor value.
virtual Real getValue() const override
This will get called to actually grab the final value the postprocessor has calculated.
TimeIntegratedPostprocessor(const InputParameters &parameters)
Base class for transient executioners that use a FixedPointSolve solve object for multiapp-main app i...
Real & _dt
Time step size.