www.mooseframework.org
SingleVariableReturnMappingSolution.h
Go to the documentation of this file.
1 /****************************************************************/
2 /* MOOSE - Multiphysics Object Oriented Simulation Environment */
3 /* */
4 /* All contents are licensed under LGPL V2.1 */
5 /* See LICENSE for full restrictions */
6 /****************************************************************/
7 #ifndef SINGLEVARIABLERETURNMAPPINGSOLUTION_H
8 #define SINGLEVARIABLERETURNMAPPINGSOLUTION_H
9 
10 #include "InputParameters.h"
11 #include "ConsoleStream.h"
12 
14 
15 template <>
17 
23 {
24 public:
25  SingleVariableReturnMappingSolution(const InputParameters & parameters);
27 
29  void setMaxIts(unsigned int max_its) { _max_its = max_its; }
30  void setRelativeTolerance(Real relative_tolerance) { _relative_tolerance = relative_tolerance; }
31  void setAbsoluteTolerance(Real absolute_tolerance) { _absolute_tolerance = absolute_tolerance; }
32 
33 protected:
40  void returnMappingSolve(const Real effective_trial_stress,
41  Real & scalar,
42  const ConsoleStream & console);
43 
49  virtual Real maximumPermissibleValue(const Real effective_trial_stress) const;
50 
57  virtual Real computeResidual(const Real effective_trial_stress, const Real scalar) = 0;
58 
65  virtual Real computeDerivative(const Real effective_trial_stress, const Real scalar) = 0;
66 
73  virtual Real computeReferenceResidual(const Real effective_trial_stress, const Real scalar) = 0;
74 
79  virtual void iterationFinalize(Real /*scalar*/) {}
80 
84 
87 
88 private:
90  unsigned int _max_its;
91 
93  const unsigned int _fixed_max_its;
94 
97 
100 
103 
106 
109 
113 
115  const std::size_t _num_resids;
116 
118  std::vector<Real> _residual_history;
119 
127  bool
128  internalSolve(const Real effective_trial_stress, Real & scalar, std::stringstream * iter_output);
129 
138  bool internalSolveLegacy(const Real effective_trial_stress,
139  Real & scalar,
140  std::stringstream * iter_output);
141 
148  bool converged(const Real residual, const Real reference);
149 
159  bool convergedAcceptable(const unsigned int it, const Real residual, const Real reference);
160 
170  void outputIterInfo(std::stringstream * iter_output,
171  const unsigned int it,
172  const Real effective_trial_stress,
173  const Real scalar,
174  const Real residual,
175  const Real reference_residual);
176 
187  void checkPermissibleRange(Real & scalar,
188  Real & scalar_increment,
189  const Real scalar_old,
190  const Real min_permissible_scalar,
191  const Real max_permissible_scalar,
192  std::stringstream * iter_output);
193 
203  void updateBounds(const Real scalar,
204  const Real residual,
205  const Real init_resid_sign,
206  Real & scalar_upper_bound,
207  Real & scalar_lower_bound,
208  std::stringstream * iter_output);
209 };
210 
211 #endif // SINGLEVARIABLERETURNMAPPINGSOLUTION_H
SingleVariableReturnMappingSolution(const InputParameters &parameters)
bool internalSolveLegacy(const Real effective_trial_stress, Real &scalar, std::stringstream *iter_output)
Method called from within this class to perform the actual return mappping iterations.
bool internalSolve(const Real effective_trial_stress, Real &scalar, std::stringstream *iter_output)
Method called from within this class to perform the actual return mappping iterations.
Real _acceptable_multiplier
Multiplier applied to relative and absolute tolerances for acceptable convergence.
bool _legacy_return_mapping
Whether to use the legacy return mapping algorithm and compute residuals in the legacy manner...
void outputIterInfo(std::stringstream *iter_output, const unsigned int it, const Real effective_trial_stress, const Real scalar, const Real residual, const Real reference_residual)
Output information about convergence history of the model.
const bool _output_iteration_info
Whether to output iteration information all the time (regardless of whether iterations converge) ...
bool converged(const Real residual, const Real reference)
Check to see whether the residual is within the convergence limits.
virtual Real computeDerivative(const Real effective_trial_stress, const Real scalar)=0
Compute the derivative of the residual as a function of the scalar variable.
void checkPermissibleRange(Real &scalar, Real &scalar_increment, const Real scalar_old, const Real min_permissible_scalar, const Real max_permissible_scalar, std::stringstream *iter_output)
Check to see whether solution is within admissible range, and set it within that range if it is not...
void updateBounds(const Real scalar, const Real residual, const Real init_resid_sign, Real &scalar_upper_bound, Real &scalar_lower_bound, std::stringstream *iter_output)
Update the upper and lower bounds of the root for the effective inelastic strain. ...
void setMaxIts(unsigned int max_its)
Functions for setting old default tolerances with legacy_return_mapping:
Base class that provides capability for Newton return mapping iterations on a single variable...
virtual void iterationFinalize(Real)
Finalize internal state variables for a model for a given iteration.
void returnMappingSolve(const Real effective_trial_stress, Real &scalar, const ConsoleStream &console)
Perform the return mapping iterations.
virtual Real maximumPermissibleValue(const Real effective_trial_stress) const
Compute the maximum permissible value of the scalar.
bool _line_search
Whether to use line searches to improve convergence.
virtual Real computeResidual(const Real effective_trial_stress, const Real scalar)=0
Compute the residual for a predicted value of the scalar.
std::vector< Real > _residual_history
History of residuals used to check whether progress is still being made on decreasing the residual...
Real _relative_tolerance
Relative convergence tolerance.
unsigned int _max_its
Maximum number of return mapping iterations (used only in legacy return mapping)
const std::size_t _num_resids
Number of residuals to be stored in history.
const unsigned int _fixed_max_its
Maximum number of return mapping iterations used in current procedure. Not settable by user...
bool _check_range
Whether to check to see whether iterative solution is within admissible range, and set within that ra...
Real _absolute_tolerance
Absolute convergence tolerance.
InputParameters validParams< SingleVariableReturnMappingSolution >()
virtual Real computeReferenceResidual(const Real effective_trial_stress, const Real scalar)=0
Compute a reference quantity to be used for checking relative convergence.
bool convergedAcceptable(const unsigned int it, const Real residual, const Real reference)
Check to see whether the residual is within acceptable convergence limits.
bool _bracket_solution
Whether to save upper and lower bounds of root for scalar, and set solution to the midpoint between t...