MODgvec_Newton Module

Module NEWTON

Some simple Newton solvers


Uses

  • module~~modgvec_newton~~UsesGraph module~modgvec_newton MODgvec_Newton module~modgvec_globals MODgvec_Globals module~modgvec_newton->module~modgvec_globals iso_fortran_env iso_fortran_env module~modgvec_globals->iso_fortran_env

Used by

  • module~~modgvec_newton~~UsedByGraph module~modgvec_newton MODgvec_Newton module~modgvec_sfl_boozer MODgvec_SFL_Boozer module~modgvec_sfl_boozer->module~modgvec_newton module~modgvec_transform_sfl MODgvec_Transform_SFL module~modgvec_transform_sfl->module~modgvec_newton module~modgvec_transform_sfl->module~modgvec_sfl_boozer proc~get_booz_newton get_booz_newton proc~get_booz_newton->module~modgvec_newton proc~get_pest_newton get_pest_newton proc~get_pest_newton->module~modgvec_newton module~modgvec_gvec_to_castor3d_vars MODgvec_gvec_to_castor3d_Vars module~modgvec_gvec_to_castor3d_vars->module~modgvec_transform_sfl module~modgvec_gvec_to_gene_vars MODgvec_gvec_to_gene_Vars module~modgvec_gvec_to_gene_vars->module~modgvec_transform_sfl module~modgvec_gvec_to_hopr_vars MODgvec_gvec_to_hopr_vars module~modgvec_gvec_to_hopr_vars->module~modgvec_transform_sfl proc~buildtransform_sfl t_transform_sfl%BuildTransform_SFL proc~buildtransform_sfl->module~modgvec_sfl_boozer proc~evaluate_boozer_list_tz_all evaluate_boozer_list_tz_all proc~evaluate_boozer_list_tz_all->module~modgvec_sfl_boozer proc~get_boozer get_boozer proc~get_boozer->module~modgvec_sfl_boozer proc~init_boozer init_boozer proc~init_boozer->module~modgvec_sfl_boozer proc~transform_sfl_init t_transform_sfl%transform_SFL_init proc~transform_sfl_init->module~modgvec_sfl_boozer

Interfaces

public interface NewtonMin1D

public interface NewtonRoot1D

public interface NewtonRoot1D_FdF

public interface NewtonMin2D

public interface NewtonRoot2D

public interface t_newton_Root1D_wrap_Min1D


Abstract Interfaces

abstract interface

  • public function i_newton_Min1D(sf, x) result(y1x1)

    Arguments

    Type IntentOptional Attributes Name
    class(c_newton_Min1D), intent(in) :: sf
    real(kind=wp), intent(in) :: x

    Return Value real(kind=wp)

abstract interface

  • public function i_newton_Root1D(sf, x) result(y1x1)

    Arguments

    Type IntentOptional Attributes Name
    class(c_newton_Root1D), intent(in) :: sf
    real(kind=wp), intent(in) :: x

    Return Value real(kind=wp)

abstract interface

  • public function i_newton_Root1D_FdF(sf, x) result(y2x1)

    Arguments

    Type IntentOptional Attributes Name
    class(c_newton_Root1D_FdF), intent(in) :: sf
    real(kind=wp), intent(in) :: x

    Return Value real(kind=wp), (2)

abstract interface

  • public function i_newton_Min2D_FR(sf, x) result(y1x2)

    Arguments

    Type IntentOptional Attributes Name
    class(c_newton_Min2D), intent(in) :: sf
    real(kind=wp), intent(in) :: x(2)

    Return Value real(kind=wp)

abstract interface

  • public function i_newton_Min2D_dFR(sf, x) result(y2x2)

    Arguments

    Type IntentOptional Attributes Name
    class(c_newton_Min2D), intent(in) :: sf
    real(kind=wp), intent(in) :: x(2)

    Return Value real(kind=wp), (2)

abstract interface

  • public function i_newton_Min2D_ddFR(sf, x) result(y22x2)

    Arguments

    Type IntentOptional Attributes Name
    class(c_newton_Min2D), intent(in) :: sf
    real(kind=wp), intent(in) :: x(2)

    Return Value real(kind=wp), (2,2)

abstract interface

  • public function i_newton_Root2D_FR(sf, x) result(y2x2)

    Arguments

    Type IntentOptional Attributes Name
    class(c_newton_Root2D), intent(in) :: sf
    real(kind=wp), intent(in) :: x(2)

    Return Value real(kind=wp), (2)

abstract interface

  • public function i_newton_Root2D_dFR(sf, x) result(y22x2)

    Arguments

    Type IntentOptional Attributes Name
    class(c_newton_Root2D), intent(in) :: sf
    real(kind=wp), intent(in) :: x(2)

    Return Value real(kind=wp), (2,2)


Derived Types

type, public, ABSTRACT ::  c_newton_Min1D

Type-Bound Procedures

procedure(i_newton_Min1D), public, deferred :: FR
procedure(i_newton_Min1D), public, deferred :: dFR
procedure(i_newton_Min1D), public, deferred :: ddFR

type, public, ABSTRACT ::  c_newton_Root1D

Type-Bound Procedures

procedure(i_newton_Root1D), public, deferred :: FR
procedure(i_newton_Root1D), public, deferred :: dFR

type, public, extends(c_newton_Root1D) ::  t_newton_Root1D_wrap_Min1D

This functional wraps a functional passed to Min1D for use with Root1D (returns the derivative: FR -> dFR, dFR -> ddFR)

Components

Type Visibility Attributes Name Initial
class(c_newton_Min1D), public, ALLOCATABLE :: parent

Constructor

public function newton_Root1D_wrap_Min1D_new (parent)

constructor for the Min1D type wrapped for Root1D

Type-Bound Procedures

procedure, public :: FR => newton_Root1D_wrap_Min1D_FR
procedure, public :: dFR => newton_Root1D_wrap_Min1D_dFR

type, public, ABSTRACT ::  c_newton_Root1D_FdF

Type-Bound Procedures

procedure(i_newton_Root1D_FdF), public, deferred :: FRdFR

type, public, ABSTRACT ::  c_newton_Min2D

Type-Bound Procedures

procedure(i_newton_Min2D_FR), public, deferred :: FR
procedure(i_newton_Min2D_dFR), public, deferred :: dFR
procedure(i_newton_Min2D_ddFR), public, deferred :: ddFR

type, public, ABSTRACT ::  c_newton_Root2D

Type-Bound Procedures

procedure(i_newton_Root2D_FR), public, deferred :: FR
procedure(i_newton_Root2D_dFR), public, deferred :: dFR

Functions

public function NewtonMin1D(tol, a, b, maxstep, x, fobj) result(fmin)

Newton's iterative algorithm to find the minimimum of function f(x) in the interval [a,b], using df(x)=0 and the derivative

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: tol

abort tolerance

real(kind=wp), intent(in) :: a

search interval

real(kind=wp), intent(in) :: b

search interval

real(kind=wp), intent(in) :: maxstep

max|dx| allowed

real(kind=wp), intent(inout) :: x

initial guess on input, result on output

class(c_newton_Min1D), intent(in) :: fobj

functional to minimize with f(x), d/dx f(x), d^2/dx^2 f(x)

Return Value real(kind=wp)

on output =f(x)

public function newton_Root1D_wrap_Min1D_new(parent) result(sf)

constructor for the Min1D type wrapped for Root1D

Arguments

Type IntentOptional Attributes Name
class(c_newton_Min1D), intent(in) :: parent

Return Value type(t_newton_Root1D_wrap_Min1D)

public function newton_Root1D_wrap_Min1D_FR(sf, x) result(y1x1)

f(x) function of the Min1D type wrapped for Root1D

Arguments

Type IntentOptional Attributes Name
class(t_newton_Root1D_wrap_Min1D), intent(in) :: sf
real(kind=wp), intent(in) :: x

Return Value real(kind=wp)

public function newton_Root1D_wrap_Min1D_dFR(sf, x) result(y1x1)

d/dx f(x) function of the Min1D type wrapped for Root1D

Arguments

Type IntentOptional Attributes Name
class(t_newton_Root1D_wrap_Min1D), intent(in) :: sf
real(kind=wp), intent(in) :: x

Return Value real(kind=wp)

public function NewtonRoot1D(tol, a, b, maxstep, xin, F0, fobj) result(xout)

Newton's iterative algorithm to find the root of function FR(x(:)) in the interval [a(:),b(:)], using d/dx(:)F(x)=0 and the derivative

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: tol

abort tolerance

real(kind=wp), intent(in) :: a

search interval

real(kind=wp), intent(in) :: b

search interval

real(kind=wp), intent(in) :: maxstep

max|dx| allowed

real(kind=wp), intent(in) :: xin

initial guess

real(kind=wp), intent(in) :: F0

function to find root is FR(x)-F0

class(c_newton_Root1D) :: fobj

Return Value real(kind=wp)

on output =f(x)

public function NewtonRoot1D_FdF(tol, a, b, maxstep, xin, F0, fobj) result(xout)

Newton's iterative algorithm to find the root of function FR(x(:)) in the interval [a(:),b(:)], using d/dx(:)F(x)=0 and the derivative

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: tol

abort tolerance

real(kind=wp), intent(in) :: a

search interval

real(kind=wp), intent(in) :: b

search interval

real(kind=wp), intent(in) :: maxstep

max|dx| allowed

real(kind=wp), intent(in) :: xin

initial guess on input

real(kind=wp), intent(in) :: F0

function to find root is FR(x)-F0

class(c_newton_Root1D_FdF) :: fobj

function to find root f(x) & derivative d/dx f(x) as FRdFR method

Return Value real(kind=wp)

output x for f(x)=0

public function NewtonMin2D(tol, a, b, x, fobj) result(fmin)

Newton's iterative algorithm to find the minimimum of function f(x,y) in the interval x(i)[a(i),b(i)], using grad(f(x)=0 and the derivative

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: tol

abort tolerance

real(kind=wp), intent(in) :: a(2)

search interval (2D)

real(kind=wp), intent(in) :: b(2)

search interval (2D)

real(kind=wp), intent(inout) :: x(2)

initial guess on input, result on output

class(c_newton_Min2D) :: fobj

functional f(x,y) to minimize with f, f', f''

Return Value real(kind=wp)

on output =f(x,y)

public function NewtonRoot2D(tol, a, b, maxstep, xin, fobj) result(xout)

Newton's iterative algorithm to find the root of function [f1(x1,x2),f2(x1,x2)]=[0,0] in the interval a(i)<=x(i)<=b(i), using the Jacobian dfi/dxj, i=1,2, j=1,2, such that fi(x1,x2)=fi(x1_0,x2_0)+ [dfi/dx1,dfi/dx2].[dx1,dx2] in each step, we find dx1,dx2 st -[[dfi/dxj]] dxj =fi(x1_0,x2_0)

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: tol

abort tolerance

real(kind=wp), intent(in) :: a(2)

search interval (2D)

real(kind=wp), intent(in) :: b(2)

search interval (2D)

real(kind=wp), intent(in) :: maxstep(2)

max|dx| allowed

real(kind=wp), intent(in) :: xin(2)

initial guess

class(c_newton_Root2D) :: fobj

function to find root f1(x1,x2)=0,f2(x1,x2)=0 and derivatives d fi(x1,x2)/dxj

Return Value real(kind=wp), (2)

x1,x2 that have f1(x1,x2)=0 and f2(x1,x2)=0