https://mooseframework.inl.gov
Loading...
Searching...
No Matches
MaxIncrement.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 "MaxIncrement.h"
11
13
16{
19 "max_increment", "max_increment > 0", "The maximum newton increment for the variable.");
20 MooseEnum increment_type("absolute fractional", "absolute");
21 params.addParam<MooseEnum>(
22 "increment_type",
23 increment_type,
24 "Type of increment to compare against max_increment. 'absolute': use variable increment. "
25 "'fractional': use variable increment divided by the variable value.");
26
27 params.addClassDescription("Limits a variable's update by some max fraction");
28
29 return params;
30}
31
33 : ElementDamper(parameters),
34 _max_increment(parameters.get<Real>("max_increment")),
35 _increment_type(getParam<MooseEnum>("increment_type").getEnum<IncrementTypeEnum>())
36{
37}
38
39Real
41{
42 Real inc = std::abs(_u_increment[_qp]);
44 inc /= std::abs(_u[_qp]);
45
46 if (inc > _max_increment)
47 return _max_increment / inc;
48
49 return 1.0;
50}
registerMooseObject("MooseApp", MaxIncrement)
Base class for deriving element dampers.
const VariableValue & _u
Holds the current solution at the current quadrature point.
unsigned int _qp
Quadrature point index.
static InputParameters validParams()
const VariableValue & _u_increment
The current Newton increment.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
void addRequiredRangeCheckedParam(const std::string &name, const std::string &parsed_function, const std::string &doc_string)
These methods add an range checked parameters.
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.
enum MaxIncrement::IncrementTypeEnum _increment_type
virtual Real computeQpDamping() override
This MUST be overridden by a child damper.
MaxIncrement(const InputParameters &parameters)
Real _max_increment
The maximum Newton increment for the variable.
static InputParameters validParams()
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition MooseEnum.h:55