t_rProfile_bspl Derived Type

type, public, extends(c_rProfile) :: t_rProfile_bspl


Inherits

type~~t_rprofile_bspl~~InheritsGraph type~t_rprofile_bspl t_rProfile_bspl type~c_rprofile c_rProfile type~t_rprofile_bspl->type~c_rprofile type~sll_c_bsplines sll_c_bsplines type~t_rprofile_bspl->type~sll_c_bsplines bspl

Components

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

number of knots, including repeated edge knots

integer, public :: deg = 0
real(kind=wp), public, ALLOCATABLE :: knots(:)

knot values, includinng edge knots

class(sll_c_bsplines), public, ALLOCATABLE :: bspl

b-spline class


Constructor

public interface t_rProfile_bspl

  • public function bsplProfile_new(knots, coefs) result(sf)

    initialize the rProfile of type bspline

    Arguments

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

    knots of the B-Spline with repeated start and end points

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

    B-Spline coefficients

    Return Value type(t_rProfile_bspl)

    self


Finalization Procedures

final :: bsplProfile_free

  • public subroutine bsplProfile_free(sf)

    finalize the type rProfile

    Arguments

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

    self


Type-Bound Procedures

procedure, public :: eval_at_rho => rProfile_eval_at_rho

  • public function rProfile_eval_at_rho(sf, rho, deriv) result(derivative)

    evaluate the n-th derivative of a radial profile with respect to rho ~sqrt(magnetic flux). NOTE: n has to be in [0,4] due to an explicit implementation of the product rule.

    Arguments

    Type IntentOptional Attributes Name
    class(c_rProfile) :: sf

    self

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

    rho position rho ~sqrt(magnetic flux)

    integer, intent(in), optional :: deriv

    derivative in rho

    Return Value real(kind=wp)

    n-th derivative of a radial profile with respect to rho ~sqrt(magnetic flux).

procedure, public :: eval_at_rho2 => bsplProfile_eval_at_rho2

  • public function bsplProfile_eval_at_rho2(sf, rho2, deriv) result(profile_prime_value)

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

    Arguments

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

    self

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

    evaluation point in the toroidal flux coordinate (rho2=phi/phi_edge= rhopos^2)

    integer, intent(in), optional :: deriv

    derivative of bspline(rho^2) in rho^2

    Return Value real(kind=wp)

procedure, public :: antiderivative => bsplProfile_antiderivative

  • public function bsplProfile_antiderivative(sf) result(antideriv)

    get the exact spline antiderivative, with respect to rho2 the knotspan is increased by an extra multiplicity on both ends, and the new coefficients are computed as beta(i) = beta(i-1) + alpha(i)*(t(i+degree+1)-t(i))/(degree+1) From deBoor, "A practical guide to Splines", p.128

    Arguments

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

    self

    Return Value class(c_rProfile), ALLOCATABLE

Source Code

  TYPE, EXTENDS(c_rProfile) :: t_rProfile_bspl

    INTEGER               :: n_knots !! number of knots, including repeated edge knots
    !INTEGER               :: n_coefs !! number of B-Spline coefficients, part of abstract type
    INTEGER               :: deg = 0
    REAL(wp), ALLOCATABLE :: knots(:)   !! knot values, includinng edge knots
    !REAL(wp), ALLOCATABLE :: coefs(:)   !! B-Spline coefficients, part of abstract type
    CLASS(sll_c_bsplines),ALLOCATABLE :: bspl !! b-spline class

    CONTAINS
    PROCEDURE :: eval_at_rho2        => bsplProfile_eval_at_rho2
    PROCEDURE :: antiderivative      => bsplProfile_antiderivative
    FINAL :: bsplProfile_free

  END TYPE t_rProfile_bspl