https://mooseframework.inl.gov
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
ReferenceResidualInterface Class Reference

Interface class shared between ReferenceResidualProblem and ReferenceResidualConvergence. More...

#include <ReferenceResidualInterface.h>

Inheritance diagram for ReferenceResidualInterface:
[legend]

Public Member Functions

 ReferenceResidualInterface (const MooseObject *moose_object)
 
template<typename T >
void addGroupVariables (const std::set< T > &group_vars)
 Add a set of variables that need to be grouped together.
 

Static Public Member Functions

static InputParameters validParams ()
 

Protected Attributes

std::vector< std::vector< NonlinearVariableName > > _group_variables
 Name of variables that are grouped together to check convergence.
 
bool _use_group_variables
 True if any variables are grouped.
 

Detailed Description

Interface class shared between ReferenceResidualProblem and ReferenceResidualConvergence.

Definition at line 21 of file ReferenceResidualInterface.h.

Constructor & Destructor Documentation

◆ ReferenceResidualInterface()

ReferenceResidualInterface::ReferenceResidualInterface ( const MooseObject *  moose_object)

Definition at line 96 of file ReferenceResidualInterface.C.

98{
99 if (moose_object->isParamValid("group_variables"))
100 {
102 moose_object->getParam<std::vector<std::vector<NonlinearVariableName>>>("group_variables");
104 }
105}
const T & getParam(const std::string &name) const
Retrieve a parameter for the object.
Definition MooseBase.h:406
bool isParamValid(const std::string &name) const
Test if the supplied parameter is valid.
Definition MooseBase.h:199
bool _use_group_variables
True if any variables are grouped.
std::vector< std::vector< NonlinearVariableName > > _group_variables
Name of variables that are grouped together to check convergence.

Member Function Documentation

◆ addGroupVariables()

template<typename T >
void ReferenceResidualInterface::addGroupVariables ( const std::set< T > &  group_vars)

Add a set of variables that need to be grouped together.

For use in actions that create variables. This is templated for backwards compatibility to allow passing in std::string or NonlinearVariableName.

Template Parameters
Tstring type used for variable names
Parameters
group_varsA set of solution variables that need to be grouped.

Definition at line 48 of file ReferenceResidualInterface.h.

49{
50 _group_variables.push_back(
51 std::vector<NonlinearVariableName>(group_vars.begin(), group_vars.end()));
53}

◆ validParams()

InputParameters ReferenceResidualInterface::validParams ( )
static

Definition at line 15 of file ReferenceResidualInterface.C.

16{
18
19 params.addParam<SolverSystemName>(
20 "solver_sys", "nl0", "Solver system for which this object applies.");
21 params.addParam<TagName>(
22 "residual_vector",
23 "The tag name of the custom vector tag to use in place of the residual vector. This can be "
24 "used to provide greater control over which variable is used in absolute and relative "
25 "tolerancing. If not provided, the full residual vector will be used.");
26 params.addParam<TagName>("reference_vector", "The tag name of the reference residual vector.");
27 params.addParam<Real>("acceptable_multiplier",
28 1.0,
29 "Multiplier applied to relative tolerance for acceptable limit");
30 params.addParam<unsigned int>(
31 "acceptable_iterations",
32 0,
33 "Iterations after which convergence to acceptable limits is accepted");
34 params.addParam<std::vector<std::vector<NonlinearVariableName>>>(
35 "group_variables",
36 "Name of variables that are grouped together to check convergence. (Multiple groups can be "
37 "provided, separated by semicolon)");
38 params.addParam<std::vector<NonlinearVariableName>>(
39 "converge_on",
40 {},
41 "If supplied, use only these variables in the individual variable convergence check");
42 params.addParam<std::map<std::string, Real>>(
43 "variable_nl_abs_tol",
44 {},
45 "Pairs of a variable name and the absolute tolerance that replaces nl_abs_tol in that "
46 "variable's convergence check. Variables in a group must have the same tolerance.");
47 params.addParam<bool>("unscale_the_residual",
48 false,
49 "If set to true, utilize the variable specific residual scalar to unscale "
50 "the residual before comparing against the absolute tolerance. This will "
51 "also print the un-scaled residual to console. This will not change the "
52 "relative tolerance check except for console output");
53 MooseEnum Lnorm("global_L2 local_L2 global_Linf local_Linf", "global_L2");
54 params.addParam<MooseEnum>(
55 "normalization_type",
56 Lnorm,
57 "The normalization type used to compare the reference and actual residuals.");
58 Lnorm.addDocumentation("global_L2",
59 "Compare the L2 norm of the residual vector to the L2 norm of the "
60 "absolute reference vector to determine relative convergence");
61 Lnorm.addDocumentation(
62 "local_L2",
63 "Compute the L2 norm of the residual vector divided component-wise by the absolute reference "
64 "vector to the L2 norm of the absolute reference vector to determine relative convergence");
65 Lnorm.addDocumentation(
66 "global_Linf",
67 "Compare the L-infinity norm of the residual vector to the L-infinity norm of the "
68 "absolute reference vector to determine relative convergence");
69 Lnorm.addDocumentation(
70 "local_Linf",
71 "Compute the L-infinity norm of the residual vector divided component-wise "
72 "by the absolute reference "
73 "vector to the L-infinity norm of the absolute reference vector to "
74 "determine relative convergence");
75
76 MooseEnum zero_ref_res("zero_tolerance relative_tolerance", "relative_tolerance");
77 params.addParam<MooseEnum>("zero_reference_residual_treatment",
78 zero_ref_res,
79 "Determine behavior if a reference residual value of zero is present "
80 "for a particular variable.");
81 zero_ref_res.addDocumentation("zero_tolerance",
82 "Solve is treated as converged if the residual is zero");
83 zero_ref_res.addDocumentation(
84 "relative_tolerance",
85 "Solve is treated as converged if the residual is below the relative tolerance");
86
87 params.addParamNamesToGroup("acceptable_iterations acceptable_multiplier",
88 "Acceptable convergence");
89 params.addParamNamesToGroup("reference_vector", "Reference residual");
90 params.addParamNamesToGroup("group_variables variable_nl_abs_tol",
91 "Variables to check for convergence");
92
93 return params;
94}
InputParameters emptyInputParameters()
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
void addParamNamesToGroup(const std::string &space_delim_names, const std::string group_name)
This method takes a space delimited list of parameter names and adds them to the specified group name...
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 addDocumentation(const std::string &name, const std::string &doc)
Add an item documentation string.
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition MooseEnum.h:55
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real

Referenced by ReferenceResidualConvergence::validParams(), and ReferenceResidualProblem::validParams().

Member Data Documentation

◆ _group_variables

std::vector<std::vector<NonlinearVariableName> > ReferenceResidualInterface::_group_variables
protected

Name of variables that are grouped together to check convergence.

Definition at line 40 of file ReferenceResidualInterface.h.

Referenced by addGroupVariables(), ReferenceResidualConvergence::initialSetup(), and ReferenceResidualInterface().

◆ _use_group_variables

bool ReferenceResidualInterface::_use_group_variables
protected

True if any variables are grouped.

Definition at line 43 of file ReferenceResidualInterface.h.

Referenced by addGroupVariables(), ReferenceResidualConvergence::initialSetup(), and ReferenceResidualInterface().


The documentation for this class was generated from the following files: