MODgvec_cubic_spline Module

Module ** cubic spline **

Define a cubic spline by points and function values, with boundary conditions and represent it as a B-Spline for evaluation


Uses

  • module~~modgvec_cubic_spline~~UsesGraph module~modgvec_cubic_spline MODgvec_cubic_spline module~modgvec_globals MODgvec_Globals module~modgvec_cubic_spline->module~modgvec_globals module~sll_m_bsplines sll_m_bsplines module~modgvec_cubic_spline->module~sll_m_bsplines iso_fortran_env iso_fortran_env module~modgvec_globals->iso_fortran_env module~sll_m_bsplines_base sll_m_bsplines_base module~sll_m_bsplines->module~sll_m_bsplines_base module~sll_m_bsplines_non_uniform sll_m_bsplines_non_uniform module~sll_m_bsplines->module~sll_m_bsplines_non_uniform module~sll_m_bsplines_uniform sll_m_bsplines_uniform module~sll_m_bsplines->module~sll_m_bsplines_uniform module~sll_m_working_precision sll_m_working_precision module~sll_m_bsplines->module~sll_m_working_precision module~sll_m_bsplines_base->module~sll_m_working_precision module~sll_m_bsplines_non_uniform->module~sll_m_bsplines_base module~sll_m_bsplines_non_uniform->module~sll_m_working_precision module~sll_m_bsplines_uniform->module~sll_m_bsplines_base module~sll_m_bsplines_uniform->module~sll_m_working_precision

Used by

  • module~~modgvec_cubic_spline~~UsedByGraph module~modgvec_cubic_spline MODgvec_cubic_spline module~modgvec_vmec MODgvec_VMEC module~modgvec_vmec->module~modgvec_cubic_spline module~modgvec_vmec_vars MODgvec_VMEC_Vars module~modgvec_vmec_vars->module~modgvec_cubic_spline proc~initprofile InitProfile proc~initprofile->module~modgvec_cubic_spline proc~initvmec InitVMEC proc~initvmec->module~modgvec_cubic_spline proc~initvmec->module~modgvec_vmec_vars proc~vmec1d_visu VMEC1D_visu proc~vmec1d_visu->module~modgvec_cubic_spline proc~vmec1d_visu->module~modgvec_vmec proc~vmec1d_visu->module~modgvec_vmec_vars proc~finalizemhd3d t_functional_mhd3d%FinalizeMHD3D proc~finalizemhd3d->module~modgvec_vmec proc~finalizevmec FinalizeVMEC proc~finalizevmec->module~modgvec_vmec_vars proc~fitspline FitSpline proc~fitspline->module~modgvec_vmec_vars proc~fitsplinehalf FitSplineHalf proc~fitsplinehalf->module~modgvec_vmec_vars proc~initmhd3d t_functional_mhd3d%InitMHD3D proc~initmhd3d->module~modgvec_vmec proc~initmhd3d->module~modgvec_vmec_vars proc~initsolution InitSolution proc~initsolution->module~modgvec_vmec proc~initsolution->module~modgvec_vmec_vars proc~vmec3d_visu VMEC3D_visu proc~vmec3d_visu->module~modgvec_vmec_vars proc~vmec_evalsplmode VMEC_EvalSplMode proc~vmec_evalsplmode->module~modgvec_vmec_vars

Interfaces

public interface t_cubspl

  • public function cubspl_new(x, f, BC, BC_val) result(sf)

    Interpolation of function values f(x_i)=f_i, i=1,n with a cubic spline, given left and right boundary condition types of boundary conditions: 0: not-a-knot 1: f'(x_boundary)=0 2: f''(x_boundary)=0

    Arguments

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

    x positions

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

    function values at x positions

    integer, intent(in) :: BC(1:2)

    Boundary condition at x(1)/x(n): =0: not-a-knot, =1: first der. =BC_val(1)/BC_val(2), =2: second der. =BC_val(1)/BC_val(2)

    real(kind=wp), intent(in), optional :: BC_val(1:2)

    Boundary value for BC(1:2) >0,

    Return Value type(t_cubspl)

    self

public interface interpolate_cubic_spline


Derived Types

type, public ::  t_cubspl

Components

Type Visibility Attributes Name Initial
real(kind=wp), public, ALLOCATABLE :: coefs(:)

B-Spline coefficients

real(kind=wp), public, ALLOCATABLE :: knots(:)

knots (=break points with repeated knots at the end)

class(sll_c_bsplines), public, ALLOCATABLE :: bspl

b-spline class

Constructor

public function cubspl_new (x, f, BC, BC_val)

Interpolation of function values f(x_i)=f_i, i=1,n with a cubic spline, given left and right boundary condition types of boundary conditions: 0: not-a-knot 1: f'(x_boundary)=0 2: f''(x_boundary)=0

Finalizations Procedures

final :: cubspl_free

Type-Bound Procedures

procedure, public :: eval => cubspl_eval
procedure, public :: eval_at_rho => cubspl_eval

for testing


Functions

public function cubspl_new(x, f, BC, BC_val) result(sf)

Interpolation of function values f(x_i)=f_i, i=1,n with a cubic spline, given left and right boundary condition types of boundary conditions: 0: not-a-knot 1: f'(x_boundary)=0 2: f''(x_boundary)=0

Arguments

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

x positions

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

function values at x positions

integer, intent(in) :: BC(1:2)

Boundary condition at x(1)/x(n): =0: not-a-knot, =1: first der. =BC_val(1)/BC_val(2), =2: second der. =BC_val(1)/BC_val(2)

real(kind=wp), intent(in), optional :: BC_val(1:2)

Boundary value for BC(1:2) >0,

Return Value type(t_cubspl)

self

public function cubspl_eval(sf, xpos, deriv) result(y)

evaluate the n-th derivative of the bsplProfile at position s

Arguments

Type IntentOptional Attributes Name
class(t_cubspl), intent(in) :: sf

self

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

position

integer, intent(in) :: deriv

derivative (=0: no derivative)

Return Value real(kind=wp), (size(xpos))


Subroutines

public subroutine interpolate_cubic_spline(x, f, coefs, knots, BC, BC_val)

used as rhs, then overwritten in solve

Arguments

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

x positions

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

function values at x positions

real(kind=wp), intent(inout), ALLOCATABLE :: coefs(:)

B-Spline coefficients of interpolated cubic spline

real(kind=wp), intent(inout), ALLOCATABLE :: knots(:)

B-Spline knots of interpolated cubic spline

integer, intent(in) :: BC(1:2)

Boundary condition at x(1)/x(n): =0: not-a-knot, =1: first der. =BC_val(1)/BC_val(2), =2: second der. =BC_val(1)/BC_val(2)

real(kind=wp), intent(in), optional :: BC_val(1:2)

Boundary value for BC(1:2) >0,

public subroutine cubspl_free(sf)

finalize the type rProfile

Arguments

Type IntentOptional Attributes Name
type(t_cubspl), intent(inout) :: sf

self