ContinuationSolver

TACS Nonlinear Continuation Solver

This continuation solver uses a predictor-corrector scheme to increment the load scale in nonlinear problems. Each iteration of the continuation solver consists of three steps:

  1. Predictor computation: If enabled, the solver will use the solutions from previous continuation steps to extrapolate the equilibrium path to the current load scale, which should provide a good initial guess for the inner solver.

  2. Corrector computation: The continuation solver calls an inner solver to solve the nonlinear problem at the current load scale.

  3. Load scale update: The continuation solver increments the load scale, the size of the step taken is adapted each iteration to try and achieve a target number of inner solver iterations.

Options

Options can be set using the ContinuationSolver.setOption and ContinuationSolver.setOptions methods. Current option values for a class instance can be printed out using the ContinuationSolver.printOptions method. The following options, their default values and descriptions are listed below:

+----------------------------------------+
|  ContinuationSolver default options:   |
+----------------------------------------+
'MaxLambda': 1.0
	 Final continuation parameter value to aim for.
'AbsTol': 1e-08
	 Convergence criteria for the nonlinear residual norm.
'RelTol': 1e-08
	 Relative convergence criteria for the nonlinear residual norm, norm is measured relative to that of the external load vector.
'CoarseAbsTol': 0.0001
	 Residual norm criteria for intermediate continuation steps, making this larger may speed up the nonlinear solver by allowing it to only partially converge intermediate steps.
'CoarseRelTol': 0.0001
	 Relative residual norm criteria for intermediate load increments.
'TargetIter': 8
	 Target number of Newton iterations for each continuation increment.
'MaxIter': 30
	 Maximum number of continuation steps.
'InitialStep': 0.2
	 Initial continuation step size.
'MinStep': 0.0001
	 Minimum continuation step size.
'MaxStep': inf
	 Maximum continuation step size.
'MinStepFactor': 0.5
	 The minimum factor by which the continuation step size can decrease in a single step.
'MaxStepFactor': 2.0
	 The maximum factor by which the continuation step size can increase in a single step.
'RetractionFactor': 0.5
	 The factor by which the continuation step size is reduced when the Newton solver fails to converge.
'UsePredictor': False
	 Flag for using predictor step in continuation.
'NumPredictorStates': 2
	 Number of previous equilibrium states to use in computing the predictor step.

API Reference

class tacs.solvers.ContinuationSolver(jacFunc: Callable, pcUpdateFunc: Callable, linearSolver: KSM, setLambdaFunc: Callable, getLambdaFunc: Callable, innerSolver: BaseSolver, options: dict | None = None, comm: Comm | None = None)[source]

Create a continuation solver instance

Parameters:
  • jacFunc (function) -- Function to update the residual Jacobian at the current state, with signature jacFunc() -> None

  • pcUpdateFunc (function) -- Function to update the residual Jacobian preconditioner at the current state, with signature pcUpdateFunc() -> None

  • linearSolver (tacs.TACS.KSM) -- TACS linear solver object to use for the Newton solve, the linear solver owns the matrix and preconditioner

  • setLambdaFunc (function) -- Function to set the continuation parameter, with signature setLambdaFunc(lambda:float) -> None

  • setLambdaFunc -- Function to get the current continuation parameter, with signature getLambdaFunc() -> float

  • innerSolver (TACS Nonlinear Solver) -- A Solver object to use for the corrector solve in each increment (e.g a NewtonSolver object)

  • options (dict, optional) -- Dictionary holding solver-specific option parameters (case-insensitive)., by default None

  • comm (mpi4py.MPI.Intracomm, optional) -- The comm object on which to create the pyTACS object., by default mpi4py.MPI.COMM_WORLD

getHistoryVariables() Dict[str, Dict][source]

Get the variables to be stored in the solver history

This method allows for implementation of any logic that dictates any changes in the stored variables depending on the current options.

Returns:

Dictionary of solver variables, keys are the variable names, value is another dictionary with keys "type" and "print", where "type" is the data type of the variable and "print" is a boolean indicating whether or not to print the variable to the screen

Return type:

Dict[str, Dict]

setOption(name: str, value: Any) None[source]

Set a solver option value. The name is not case sensitive.

Parameters:
  • name (str) -- Name of option to modify

  • value (depends on option) -- New option value to set

setConvergenceTolerance(absTol: float | None = None, relTol: float | None = None) None[source]

Set the convergence tolerance of the solver

Parameters:
  • absTol (float, optional) -- Absolute tolerance, not changed if no value is provided

  • relTol (float, optional) -- Relative tolerance, not changed if no value is provided

initializeSolve(u0: Vec | None = None) None[source]

Perform any initialization required before the solve

solve(u0: Vec | None = None, result: Vec | None = None) None[source]

Solve the residual equations r(u) = 0

Parameters:
  • u0 (TACS vector, optional) -- Initial guess, by default uses the current state

  • result (TACS vector, optional) -- Vector in which to store the solution, by default None. The problem's state is updated with the solution whether or not this is provided.

computeForceVectors() None[source]

Compute the current forcing vector

The continuation solver is based on the assumption that the residual takes the following form:

r(u, lambda) = F_int(u) + lambda * F_ext(u, lambda)

This function computes fInt and fExt using two residual evaluations at lambda=0 and lambda=1: f_int = r(u, 0) f_ext = r(u, 1) - f_int

dtype

alias of float64

property fatalFailure: bool

Whether the solver has failed, set as a property rather than an attribute so that it is read-only

Note that a fatalFailure is not the same as not converging, this flag is meant to reflect that there has been a fatal failure in the solver which requires a full reset

getOption(name)

Get a solver option value. The name is not case sensitive.

Parameters:

name (str) -- Name of option to get

property hasConverged: bool

Whether the solver has converged, set as a property rather than an attribute so that it is read-only

property iterationCount: int

Number of iterations performed, set as a property rather than an attribute so that it is read-only

classmethod printDefaultOptions()

Prints a nicely formatted dictionary of all the default solver options to the stdout

printModifiedOptions()

Prints a nicely formatted table of all the options that have been modified from their defaults

printOptions()

Prints a nicely formatted dictionary of all the current solver options to the stdout on the root processor

reset() None

Reset the solver

Currently this just zeros out the state vector, but more functionality may be added in future

setCallback(callback: Callable) None

Set a callback function to be called at each iteration

Parameters:

callback (callable, optional) -- Callback function, should have the following signature: callback(solver: tacs.solver, u: tacs.TACS.Vec, res: tacs.TACS.Vec, monitorVars: dict) -> None Where: - solver is the solver object - u is the current state vector - res is the current residual vector - monitorVars is a dictionary of variables to monitor, which can be specified through the "nonlinearSolverMonitorVars" option

setOptions(options)

Set multiple solver options at once. The names are not case sensitive.

Parameters:

options (dict) -- Dictionary of option names and values to set

setRefNorm(norm: float) None

Set the reference norm used to compute relative convergence measures

Parameters:

norm (float) -- Reference norm