gemseo / mda

# newton module¶

## A set of Newton algorithm variants for solving MDAs¶

Root finding methods include:

Each of these methods is implemented by a class in this module. Both inherits from a common abstract cache.

class gemseo.mda.newton.MDANewtonRaphson(disciplines, max_mda_iter=10, relax_factor=0.99, name=None, grammar_type='JSON', linear_solver='lgmres', tolerance=1e-06, linear_solver_tolerance=1e-12, warm_start=False, use_lu_fact=False, norm0=None)[source]

Newton solver for MDA.

The Newton-Raphson method is parameterized by a relaxation factor $$\alpha \in (0, 1]$$ to limit the length of the steps taken along the Newton direction. The new iterate is given by:

$x_{k+1} = x_k - \alpha f'(x_k)^{-1} f(x_k)$

Constructor.

Parameters
• disciplines (list(MDODiscipline)) – list of disciplines

• max_mda_iter (int) – maximum number of iterations

• relax_factor (float) – relaxation factor in the Newton step (default 1.)

• name (str) – name

• grammar_type (str) – the type of grammar to use for IO declaration either JSON_GRAMMAR_TYPE or SIMPLE_GRAMMAR_TYPE

• linear_solver (str) – linear solver used to compute the Newton step

• n_processes (int) – number of processes running the MDA. if >1, the run is parallel

• tolerance (float) – tolerance of the iterative direct coupling solver, norm of the current residuals divided by initial residuals norm shall be lower than the tolerance to stop iterating

• warm_start (bool) – if True, the second iteration and ongoing start from the previous coupling solution

• linear_solver_tolerance (float) – Tolerance of the linear solver in the adjoint equation

• use_lu_fact (bool) – if True, when using adjoint/forward differenciation, store a LU factorization of the matrix to solve faster multiple RHS problem

• norm0 (float) – reference value of the norm of the residual to compute the decrease stop criteria. Iterations stops when norm(residual)/norm0<tolerance

class gemseo.mda.newton.MDAQuasiNewton(disciplines, max_mda_iter=10, name=None, grammar_type='JSON', method='hybr', use_gradient=False, tolerance=1e-06, linear_solver_tolerance=1e-12, warm_start=False, use_lu_fact=False, norm0=None)[source]

Quasi-Newton solver for MDA.

Quasi-Newton methods include numerous variants ( Broyden, Levenberg-Marquardt, …). The name of the variant should be provided as a parameter method of the class.

The new iterate is given by:

$x_{k+1} = x_k - \rho_k B_k f(x_k)$

where $$\rho_k$$ is a coefficient chosen in order to minimize the convergence and $$B_k$$ is an approximation of the inverse of the Jacobian $$Df(x_k)^{-1}$$.

Constructor.

Parameters
• disciplines (list(MDODiscipline)) – the disciplines list

• max_mda_iter (int) – maximum number of iterations

• name (str) – name

• grammar_type (str) – the type of grammar to use for IO declaration either JSON_GRAMMAR_TYPE or SIMPLE_GRAMMAR_TYPE

• method (str) – method name in scipy root finding, among self.QUASI_NEWTON_METHODS

• use_gradient (bool) – if True, used the analytic gradient of the discipline

• tolerance (float) – tolerance of the iterative direct coupling solver, norm of the current residuals divided by initial residuals norm shall be lower than the tolerance to stop iterating

• linear_solver_tolerance (float) – Tolerance of the linear solver in the adjoint equation

• warm_start (bool) – if True, the second iteration and ongoing start from the previous coupling solution

• use_lu_fact (bool) – if True, when using adjoint/forward differenciation, store a LU factorization of the matrix to solve faster multiple RHS problem

• norm0 (float) – reference value of the norm of the residual to compute the decrease stop criteria. Iterations stops when norm(residual)/norm0<tolerance

ANDERSON = 'anderson'
BROYDEN1 = 'broyden1'
BROYDEN2 = 'broyden2'
DF_SANE = 'df-sane'
DIAG_BROYDEN = 'diagbroyden'
EXCITING_MIXING = 'excitingmixing'
HYBRID = 'hybr'
KRYLOV = 'krylov'
LEVENBERG_MARQUARDT = 'lm'
LINEAR_MIXING = 'linearmixing'
QUASI_NEWTON_METHODS = ['hybr', 'lm', 'broyden1', 'broyden2', 'anderson', 'linearmixing', 'diagbroyden', 'excitingmixing', 'krylov', 'df-sane']
class gemseo.mda.newton.MDARoot(disciplines, max_mda_iter=10, name=None, grammar_type='JSON', tolerance=1e-06, linear_solver_tolerance=1e-12, warm_start=False, use_lu_fact=False, norm0=None)[source]

Abstract class implementing MDAs based on (Quasi-)Newton methods.

Constructor.

Parameters
• disciplines (list(MDODiscipline)) – the disciplines list

• max_mda_iter (int) – maximum number of iterations

• grammar_type (str) – the type of grammar to use for IO declaration either JSON_GRAMMAR_TYPE or SIMPLE_GRAMMAR_TYPE

• tolerance (float) – tolerance of the iterative direct coupling solver, norm of the current residuals divided by initial residuals norm shall be lower than the tolerance to stop iterating

• name (str) – the name of the chain

• linear_solver_tolerance (float) – Tolerance of the linear solver in the adjoint equation

• warm_start (bool) – if True, the second iteration and ongoing start from the previous coupling solution

• use_lu_fact (bool) – if True, when using adjoint/forward differenciation, store a LU factorization of the matrix to solve faster multiple RHS problem

execute_all_disciplines(input_local_data)[source]

Execute all self.disciplines.

Parameters

input_local_data – the input data of the disciplines