Line data Source code
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 "ReferenceResidualInterface.h" 11 : #include "MooseObject.h" 12 : #include "MooseEnum.h" 13 : 14 : InputParameters 15 29793 : ReferenceResidualInterface::validParams() 16 : { 17 29793 : InputParameters params = emptyInputParameters(); 18 : 19 29793 : params.addParam<std::vector<NonlinearVariableName>>( 20 : "solution_variables", "Set of solution variables to be checked for relative convergence"); 21 29793 : params.addParam<std::vector<AuxVariableName>>( 22 : "reference_residual_variables", 23 : "Set of variables that provide reference residuals for relative convergence check"); 24 29793 : params.addParam<TagName>("reference_vector", "The tag name of the reference residual vector."); 25 89379 : params.addParam<Real>("acceptable_multiplier", 26 59586 : 1.0, 27 : "Multiplier applied to relative tolerance for acceptable limit"); 28 89379 : params.addParam<unsigned int>( 29 : "acceptable_iterations", 30 59586 : 0, 31 : "Iterations after which convergence to acceptable limits is accepted"); 32 29793 : 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 29793 : params.addParam<std::vector<NonlinearVariableName>>( 37 : "converge_on", 38 : {}, 39 : "If supplied, use only these variables in the individual variable convergence check"); 40 29793 : MooseEnum Lnorm("global_L2 local_L2 global_Linf local_Linf", "global_L2"); 41 29793 : params.addParam<MooseEnum>( 42 : "normalization_type", 43 : Lnorm, 44 : "The normalization type used to compare the reference and actual residuals."); 45 29793 : 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 29793 : 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 29793 : 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 29793 : 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 29793 : MooseEnum zero_ref_res("zero_tolerance relative_tolerance", "relative_tolerance"); 64 29793 : 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 29793 : zero_ref_res.addDocumentation("zero_tolerance", 69 : "Solve is treated as converged if the residual is zero"); 70 29793 : zero_ref_res.addDocumentation( 71 : "relative_tolerance", 72 : "Solve is treated as converged if the residual is below the relative tolerance"); 73 : 74 29793 : params.addParamNamesToGroup("acceptable_iterations acceptable_multiplier", 75 : "Acceptable convergence"); 76 29793 : params.addParamNamesToGroup("reference_vector reference_residual_variables", 77 : "Reference residual"); 78 29793 : params.addParamNamesToGroup("solution_variables group_variables", 79 : "Variables to check for convergence"); 80 : 81 59586 : return params; 82 29793 : } 83 : 84 659 : ReferenceResidualInterface::ReferenceResidualInterface(const MooseObject * moose_object) 85 659 : : _use_group_variables(false) 86 : { 87 659 : if (moose_object->isParamValid("group_variables")) 88 : { 89 : _group_variables = 90 14 : moose_object->getParam<std::vector<std::vector<NonlinearVariableName>>>("group_variables"); 91 14 : _use_group_variables = true; 92 : } 93 659 : }