autopdex.solver.solver

autopdex.solver.solver(dofs, settings, static_settings, **kwargs)[source]

General solver function to solve a given problem based on provided settings.

This function chooses and runs the appropriate solver type (e.g., minimization, linear, Newton) based on the provided static_settings and returns the solution and any additional information.

Parameters:
  • dofs (jnp.ndarray or dict) – Degrees of freedom or initial guess for the solution.

  • settings (dict) – Dictionary containing various settings and parameters required for assembling the problem.

  • static_settings (dict) – Dictionary containing static settings such as solver type, verbose level, and variational schemes.

  • **kwargs (dict) – Additional keyword arguments passed to the specific solver functions.

Returns:

The solution obtained from the selected solver. Any: Additional information from the solver, such as number of iterations or convergence status.

Return type:

jnp.ndarray

Solver Types:
  • ‘minimize’ : Uses nonlinear minimization solvers (e.g., LBFGS, BFGS, etc.).

  • ‘linear’ : Solves linear systems using specified backend (e.g., JAX, PETSc, PARDISO, PyAMG, Scipy).

  • ‘diagonal linear’ : Solves linear systems assuming a diagonal tangent matrix.

  • ‘newton’ : Uses the Newton method for solving nonlinear systems.

  • ‘damped newton’ : Uses a damped Newton method for solving nonlinear systems.

For the different solvers, the function conducts the following functions in which more documentation is provided:
  • ‘minimize’ : solver.solve_nonlinear_minimization

  • ‘linear’ : solver.solve_linear

  • ‘diagonal linear’ : solver.solve_diagonal_linear

  • ‘newton’ : solver.solve_newton

  • ‘damped newton’ : solver.solve_damped_newton

Notes

  • If all domains are using ‘least square pde loss’ variational scheme and verbosity level is >=1, it prints the L2 error before and after optimization.