https://mooseframework.inl.gov
Loading...
Searching...
No Matches
AverageVariableChange.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 "MooseUtils.h"
12
14
17{
19
20 params.addClassDescription("Computes the volume-weighted L1 or L2 norm of the change of a "
21 "variable over a time step or between nonlinear iterations.");
22
23 MooseEnum change_over("time_step nonlinear_iteration");
25 "change_over", change_over, "Interval over which to compute the change");
26
27 MooseEnum norm("L1 L2");
28 params.addRequiredParam<MooseEnum>("norm", norm, "Type of norm to compute");
29
30 return params;
31}
32
35 _change_over(getParam<MooseEnum>("change_over")),
36 _u_change_old(_change_over == "time_step" ? coupledValueOld("variable")
37 : coupledValuePreviousNL("variable")),
38 _norm(getParam<MooseEnum>("norm")),
39 _norm_exponent(_norm == "L1" ? 1 : 2),
40 _volume(0)
41{
42}
43
44void
50
51void
57
58void
60{
62 const auto & pps = static_cast<const AverageVariableChange &>(y);
63 _volume += pps._volume;
64}
65
66void
72
73Real
75{
76 mooseAssert(!MooseUtils::absoluteFuzzyEqual(_volume, 0.0), "Volume must be nonzero.");
78}
79
80Real
registerMooseObject("MooseApp", AverageVariableChange)
Computes the volume-weighted L1 or L2 norm of the change of a variable over a time step or between no...
virtual Real getValue() const override
This will get called to actually grab the final value the postprocessor has calculated.
virtual void execute() override
Execute method.
const VariableValue & _u_change_old
"Old" solution value in the change
AverageVariableChange(const InputParameters &parameters)
virtual Real computeQpIntegral() override
static InputParameters validParams()
Real _volume
Subdomain(s) volume.
virtual void initialize() override
Called before execute() is ever called so that data can be cleared.
virtual void finalize() override
This is called after execute() and after threadJoin()! This is probably where you want to do MPI comm...
virtual void threadJoin(const UserObject &y) override
Must override.
const unsigned int _norm_exponent
Norm exponent.
virtual void execute() override
Execute method.
virtual void threadJoin(const UserObject &y) override
Must override.
virtual void initialize() override
Called before execute() is ever called so that data can be cleared.
This postprocessor computes a volume integral of the specified variable.
const VariableValue & _u
Holds the solution at current quadrature points.
const Real & _current_elem_volume
The current element volume (available during execute())
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
void addRequiredParam(const std::string &name, const std::string &doc_string)
This method adds a parameter and documentation string to the InputParameters object that will be extr...
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.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition MooseEnum.h:55
void gatherSum(T &value)
Gather the parallel sum of the variable passed in.
Base class for user-specific data.
Definition UserObject.h:20
MooseUnits pow(const MooseUnits &, int)
Definition Units.C:537