File:NewtonHook.f90: Difference between revisions

From openpipeflow.org
Jump to navigation Jump to search
Line 12: Line 12:
To download, click the link above.
To download, click the link above.


Prior to calling the subroutine <tt>newtonhook(...)</tt>, the arrays <tt>new_x(:)</tt> and <tt>new_fx(:)</tt> need to be allocated the dimension $n$.  Also <tt>new_x(:)</tt> needs to be assigned the initial guess prior to the call. As the calculation proceeds, the vector <tt>new_x(:)</tt> is updated with improved vectors (smaller <tt>new_f(:)</tt>).
* Prior to calling the subroutine <tt>newtonhook(...)</tt>, the arrays <tt>new_x(:)</tt> and <tt>new_fx(:)</tt> need to be allocated the dimension $n$.   
* <tt>new_x(:)</tt> needs to be assigned the initial guess prior to calling <tt>newtonhook(...)</tt>.
* <tt>newtonhook(...)</tt> needs to be passed functions that calculate
** $\vec{F}(\vec{x})$,
* As the calculation proceeds, the vector <tt>new_x(:)</tt> is updated with improved vectors (smaller <tt>new_f(:)</tt>).

Revision as of 08:27, 14 December 2016

$ \renewcommand{\vec}[1]{ {\bf #1} } \newcommand{\bnabla}{ \vec{\nabla} } \newcommand{\Rey}{Re} \def\vechat#1{ \hat{ \vec{#1} } } \def\mat#1{#1} $

The method

Implements the Newton-Raphson-Krylov method for solving \[\vec{F}(\vec{x})=\vec{0},\] where $\vec{x}$ and $\vec{F}$ are $n$-vectors, using a Hookstep-Trust-region approach.

For each iteration, $\vec{x}_{i+1} = \vec{x}_i + \vec{\delta x}$, the linear problem \[\left.\frac{\vec{dF}}{\vec{dx}}\right|_{\vec{x}_i}\,\vec{\delta x}=-\vec{F}(\vec{x}_i) \] is solved for the step $\vec{\delta x}$ subject to the condition that it be smaller than some magnitude $\delta$, where $\delta$ is the size of the trust region. This problem is in the form $A\vec{x}=\vec{b}$, where $A$ is an $n\times n$ matrix, and is solved using the Krylov-subspace method, GMRES(m). See File:GMRESm.f90.

The code

To download, click the link above.

  • Prior to calling the subroutine newtonhook(...), the arrays new_x(:) and new_fx(:) need to be allocated the dimension $n$.
  • new_x(:) needs to be assigned the initial guess prior to calling newtonhook(...).
  • newtonhook(...) needs to be passed functions that calculate
    • $\vec{F}(\vec{x})$,
  • As the calculation proceeds, the vector new_x(:) is updated with improved vectors (smaller new_f(:)).

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeDimensionsUserComment
current04:50, 26 June 2019 (6 KB)Apwillis (talk | contribs)Minor edits in comments only.
05:32, 13 December 2016 (6 KB)Apwillis (talk | contribs)== The method == Implements the Newton-Raphson method for solving \[\vec{F}(\vec{x})=\vec{0}\] with a Hookstep-Trust-region approach. At each iteration, the linear problem for the step in $\vec{x}$ is solved subject to the condition that the step be ...