100 mooseError(
"computeResidualAndDerivative has to be implemented if "
101 "automatic_differentiation_return_mapping = true.");
157 const Real reference_residual);
236 std::stringstream * iter_output =
nullptr);
264 std::stringstream * iter_output);
277 const Real init_resid_sign,
280 std::stringstream * iter_output);
void mooseError(Args &&... args)
Moose::GenericType< Real, is_ad > GenericReal
Moose::GenericType< ChainedReal, is_ad > GenericChainedReal
SingleVariableReturnMappingSolutionTempl< true > ADSingleVariableReturnMappingSolution
SingleVariableReturnMappingSolutionTempl< false > SingleVariableReturnMappingSolution
Base class that provides capability for Newton return mapping iterations on a single variable.
GenericReal< is_ad > _initial_residual
Residual values, kept as members to retain solver state for summary outputting.
virtual ~SingleVariableReturnMappingSolutionTempl()
Real _absolute_tolerance
Absolute convergence tolerance.
const bool _ad_derivative
virtual GenericChainedReal< is_ad > computeResidualAndDerivative(const GenericReal< is_ad > &, const GenericChainedReal< is_ad > &)
Compute the residual and the derivative for a predicted value of the scalar.
virtual GenericReal< is_ad > computeDerivative(const GenericReal< is_ad > &, const GenericReal< is_ad > &)=0
Compute the derivative of the residual as a function of the scalar variable.
bool _check_range
Whether to check to see whether iterative solution is within admissible range, and set within that ra...
bool convergedAcceptable(const unsigned int it, const Real reference)
Check to see whether the residual is within acceptable convergence limits.
const std::string _svrms_name
MOOSE input name of the object performing the solve.
virtual void preStep(const GenericReal< is_ad > &, const GenericReal< is_ad > &, const GenericReal< is_ad > &)
This method is called before taking a step in the return mapping algorithm.
GenericReal< is_ad > _derivative
Derivative of the residual.
bool converged(const GenericReal< is_ad > &residual, const Real reference)
Check to see whether the residual is within the convergence limits.
unsigned int _iteration
iteration number
Real _relative_tolerance
Relative convergence tolerance.
void computeResidualAndDerivativeHelper(const GenericReal< is_ad > &effective_trial_stress, const GenericReal< is_ad > &scalar)
Helper function to compute and set the _residual and _derivative.
void updateBounds(const GenericReal< is_ad > &scalar, const GenericReal< is_ad > &residual, const Real init_resid_sign, GenericReal< is_ad > &scalar_upper_bound, GenericReal< is_ad > &scalar_lower_bound, std::stringstream *iter_output)
Update the upper and lower bounds of the root for the effective inelastic strain.
static InputParameters validParams()
bool _bracket_solution
Whether to save upper and lower bounds of root for scalar, and set solution to the midpoint between t...
virtual GenericReal< is_ad > minimumPermissibleValue(const GenericReal< is_ad > &effective_trial_stress) const
Compute the minimum permissible value of the scalar.
const std::size_t _num_resids
Number of residuals to be stored in history.
const unsigned int _max_its
Maximum number of return mapping iterations.
virtual void iterationFinalize(const GenericReal< is_ad > &)
Finalize internal state variables for a model for a given iteration.
virtual void outputIterationStep(std::stringstream *iter_output, const GenericReal< is_ad > &effective_trial_stress, const GenericReal< is_ad > &scalar, const Real reference_residual)
Output information for a single iteration step to build the convergence history of the model.
SolveState internalSolve(const GenericReal< is_ad > effective_trial_stress, GenericReal< is_ad > &scalar, std::stringstream *iter_output=nullptr)
Method called from within this class to perform the actual return mappping iterations.
enum SingleVariableReturnMappingSolutionTempl::InternalSolveOutput _internal_solve_output_on
const bool _internal_solve_full_iteration_history
Whether to output iteration information all the time (regardless of whether iterations converge)
virtual void outputIterationSummary(std::stringstream *iter_output, const unsigned int total_it)
Output summary information for the convergence history of the model.
virtual GenericReal< is_ad > computeResidual(const GenericReal< is_ad > &, const GenericReal< is_ad > &)=0
Compute the residual for a predicted value of the scalar.
bool _line_search
Whether to use line searches to improve convergence.
void checkPermissibleRange(GenericReal< is_ad > &scalar, GenericReal< is_ad > &scalar_increment, const GenericReal< is_ad > &scalar_old, const GenericReal< is_ad > min_permissible_scalar, const GenericReal< is_ad > 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.
Real _acceptable_multiplier
Multiplier applied to relative and absolute tolerances for acceptable convergence.
void returnMappingSolve(const GenericReal< is_ad > &effective_trial_stress, GenericReal< is_ad > &scalar, const ConsoleStream &console)
Perform the return mapping iterations.
GenericReal< is_ad > _residual
virtual Real computeReferenceResidual(const GenericReal< is_ad > &effective_trial_stress, const GenericReal< is_ad > &scalar)=0
Compute a reference quantity to be used for checking relative convergence.
std::vector< Real > _residual_history
History of residuals used to check whether progress is still being made on decreasing the residual.
virtual GenericReal< is_ad > initialGuess(const GenericReal< is_ad > &)
Compute an initial guess for the value of the scalar.
virtual GenericReal< is_ad > maximumPermissibleValue(const GenericReal< is_ad > &effective_trial_stress) const
Compute the maximum permissible value of the scalar.