https://mooseframework.inl.gov
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. More...
 

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. More...
 
bool _use_group_variables
 True if any variables are grouped. More...
 

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 84 of file ReferenceResidualInterface.C.

85  : _use_group_variables(false)
86 {
87  if (moose_object->isParamValid("group_variables"))
88  {
90  moose_object->getParam<std::vector<std::vector<NonlinearVariableName>>>("group_variables");
91  _use_group_variables = true;
92  }
93 }
std::vector< std::vector< NonlinearVariableName > > _group_variables
Name of variables that are grouped together to check convergence.
bool isParamValid(const std::string &name) const
Test if the supplied parameter is valid.
bool _use_group_variables
True if any variables are grouped.
const T & getParam(const std::string &name) const
Retrieve a parameter for the object.

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()));
52  _use_group_variables = true;
53 }
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.

◆ validParams()

InputParameters ReferenceResidualInterface::validParams ( )
static

Definition at line 15 of file ReferenceResidualInterface.C.

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

16 {
18 
19  params.addParam<std::vector<NonlinearVariableName>>(
20  "solution_variables", "Set of solution variables to be checked for relative convergence");
21  params.addParam<std::vector<AuxVariableName>>(
22  "reference_residual_variables",
23  "Set of variables that provide reference residuals for relative convergence check");
24  params.addParam<TagName>("reference_vector", "The tag name of the reference residual vector.");
25  params.addParam<Real>("acceptable_multiplier",
26  1.0,
27  "Multiplier applied to relative tolerance for acceptable limit");
28  params.addParam<unsigned int>(
29  "acceptable_iterations",
30  0,
31  "Iterations after which convergence to acceptable limits is accepted");
32  params.addParam<std::vector<std::vector<NonlinearVariableName>>>(
33  "group_variables",
34  "Name of variables that are grouped together to check convergence. (Multiple groups can be "
35  "provided, separated by semicolon)");
36  params.addParam<std::vector<NonlinearVariableName>>(
37  "converge_on",
38  {},
39  "If supplied, use only these variables in the individual variable convergence check");
40  MooseEnum Lnorm("global_L2 local_L2 global_Linf local_Linf", "global_L2");
41  params.addParam<MooseEnum>(
42  "normalization_type",
43  Lnorm,
44  "The normalization type used to compare the reference and actual residuals.");
45  Lnorm.addDocumentation("global_L2",
46  "Compare the L2 norm of the residual vector to the L2 norm of the "
47  "absolute reference vector to determine relative convergence");
48  Lnorm.addDocumentation(
49  "local_L2",
50  "Compute the L2 norm of the residual vector divided component-wise by the absolute reference "
51  "vector to the L2 norm of the absolute reference vector to determine relative convergence");
52  Lnorm.addDocumentation(
53  "global_Linf",
54  "Compare the L-infinity norm of the residual vector to the L-infinity norm of the "
55  "absolute reference vector to determine relative convergence");
56  Lnorm.addDocumentation(
57  "local_Linf",
58  "Compute the L-infinity norm of the residual vector divided component-wise "
59  "by the absolute reference "
60  "vector to the L-infinity norm of the absolute reference vector to "
61  "determine relative convergence");
62 
63  MooseEnum zero_ref_res("zero_tolerance relative_tolerance", "relative_tolerance");
64  params.addParam<MooseEnum>("zero_reference_residual_treatment",
65  zero_ref_res,
66  "Determine behavior if a reference residual value of zero is present "
67  "for a particular variable.");
68  zero_ref_res.addDocumentation("zero_tolerance",
69  "Solve is treated as converged if the residual is zero");
70  zero_ref_res.addDocumentation(
71  "relative_tolerance",
72  "Solve is treated as converged if the residual is below the relative tolerance");
73 
74  params.addParamNamesToGroup("acceptable_iterations acceptable_multiplier",
75  "Acceptable convergence");
76  params.addParamNamesToGroup("reference_vector reference_residual_variables",
77  "Reference residual");
78  params.addParamNamesToGroup("solution_variables group_variables",
79  "Variables to check for convergence");
80 
81  return params;
82 }
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
InputParameters emptyInputParameters()
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition: MooseEnum.h:33
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
void addDocumentation(const std::string &name, const std::string &doc)
Add an item documentation string.
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 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...

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: