t_hmap_axisNB Derived Type

type, public, extends(c_hmap) :: t_hmap_axisNB


Inherits

type~~t_hmap_axisnb~~InheritsGraph type~t_hmap_axisnb t_hmap_axisNB type~c_hmap c_hmap type~t_hmap_axisnb->type~c_hmap type~t_fbase t_fBase type~t_hmap_axisnb->type~t_fbase fb_hat type~t_ncfile t_ncfile type~t_hmap_axisnb->type~t_ncfile nc

Components

Type Visibility Attributes Name Initial
integer, public :: which_hmap

points to hmap (1: MHD3D)

integer, public :: nfp = -1

number of field periods used in hmap. If =-1, its not used

integer, public :: n_max = 0

maximum number of toroidal modes needed to describe hmap. Used for estimating the number of integration points.

logical, public :: initialized = .FALSE.
integer, public :: nzeta = 0

number of points in zeta direction of the input axis

integer, public :: sgn_rot

sign of rotation around Z axis, either +1 or -1: positive means that from one field period to the next, xyz rotate counterclockwise around the Z-axis (right hand rule), negative then clockwise.

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

zeta positions in one field period (1:nzeta), on 'half' grid: zeta(i)=(i-0.5)/nzeta*(2pi/nfp)

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

cartesian coordinates of the axis for a full turn, (1:NFPnzeta,1:3), zeta is on 'half' grid: zeta(i)=(i-0.5)/(NFPnzeta)*(2pi)

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

"normal" vector of axis frame in cartesian coordinates for a full turn (1:NFP*nzeta,1:3). NOT ASSUMED TO BE ORTHOGONAL to tangent of curve

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

"Bi-normal" vector of axis frame in cartesian coordinates for a full turn (1:NFP*nzeta,1:3). NOT ASSUMED TO BE ORTHOGONAL to tangent of curve or Nxyz

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

fourier modes of xhat,yhat,zhat on one field period, x=cos(zeta)xhat-sgn_rotsin(zeta)yhat, y=sin(zeta)xhat+sgn_rotcos(zeta)yhat, z=zhat

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

1d fourier modes of Nxyz, one field period

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

1d fourier modes of Bxyz, one field period

character(len=1024), public :: ncfile = " "

name of netcdf file with axis information

type(t_fBase), public :: fb_hat

container for 1d fourier base of xhat

class(t_ncfile), public, ALLOCATABLE :: nc

container for netcdf-file


Constructor

public interface t_hmap_axisNB

  • public function hmap_axisNB_init() result(sf)

    initialize the type hmap_axisNB, reading from parameterfile and call init_params

    Arguments

    None

    Return Value type(t_hmap_axisNB)

    self

  • public function hmap_axisNB_init_params(ncfile, nvisu) result(sf)

    initialize the type hmap_axisNB and read "G-frame" from netcdf

    transform from full period cartesian coordinates to one-field period "hat" cartesian coordinates, by rotating around the zaxis with the local angle zeta, with the sign given by which direction xyz(zeta=0) rotates to xyz(zeta=2pi/nfp) INVERSION OF: x=cos(zeta)xhat - sgn_rotsin(zeta)yhat, y=cos(zeta)yhat + sgn_rotsin(zeta)xhat, z <=> zhat ==> xhat=cos(zeta)x+sgn_rotsin(zeta)y, yhat=cos(zeta)y-sgn_rotsin(zeta)x, check that all points on full period are the same in the xhat,yhat,zhat coordinates NOTE THIS FUNCTION IS USING sinz=sin(zeta),cosz=cos(zeta) and sgn_rot computed above!!!!

    Arguments

    Type IntentOptional Attributes Name
    character(len=*), intent(in) :: ncfile

    netcdf file containing the group "axis" from which to read the G-frame

    integer, intent(in) :: nvisu

    number of visualization points for G-Frame per field period, -1: no visualization

    Return Value type(t_hmap_axisNB)

    self


Finalization Procedures

final :: hmap_axisNB_free

  • public subroutine hmap_axisNB_free(sf)

    finalize the type hmap_axisNB

    Arguments

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

    self


Type-Bound Procedures

procedure, public :: eval_aux_all => hmap_eval_aux_all

  • public function hmap_eval_aux_all(sf, np, q1_in, q2_in, xv) result(xyz)

    call %eval_aux on 1d array of points of size np, using auxiliary variable array of same size

    Arguments

    Type IntentOptional Attributes Name
    class(c_hmap), intent(in) :: sf
    integer, intent(in) :: np
    real(kind=wp), intent(in) :: q1_in(1:np)
    real(kind=wp), intent(in) :: q2_in(1:np)
    class(c_hmap_auxvar), intent(in) :: xv(1:np)

    Return Value real(kind=wp), (1:3,1:np)

procedure, public :: eval_dxdq_aux_all => hmap_eval_dxdq_aux_all

  • public function hmap_eval_dxdq_aux_all(sf, np, q1, q2, q1_vec, q2_vec, q3_vec, xv) result(dxdq_qvec)

    call %eval_dxdq_aux on 1d array of points of size np, using auxiliary variable array of same size

    Arguments

    Type IntentOptional Attributes Name
    class(c_hmap), intent(in) :: sf
    integer, intent(in) :: np
    real(kind=wp), intent(in) :: q1(1:np)
    real(kind=wp), intent(in) :: q2(1:np)
    real(kind=wp), intent(in) :: q1_vec(1:np)
    real(kind=wp), intent(in) :: q2_vec(1:np)
    real(kind=wp), intent(in) :: q3_vec(1:np)
    class(c_hmap_auxvar), intent(in) :: xv(1:np)

    Return Value real(kind=wp), (1:3,1:np)

procedure, public :: eval_Jh_aux_all => hmap_eval_Jh_aux_all

  • public function hmap_eval_Jh_aux_all(sf, np, q1, q2, xv) result(Jh)

    call %eval_Jh_aux on 1d array of points of size np, using auxiliary variable array of same size

    Arguments

    Type IntentOptional Attributes Name
    class(c_hmap), intent(in) :: sf
    integer, intent(in) :: np
    real(kind=wp), intent(in) :: q1(1:np)
    real(kind=wp), intent(in) :: q2(1:np)
    class(c_hmap_auxvar), intent(in) :: xv(1:np)

    Return Value real(kind=wp), (1:np)

procedure, public :: eval_Jh_dq_aux_all => hmap_eval_Jh_dq_aux_all

  • public function hmap_eval_Jh_dq_aux_all(sf, np, q1, q2, q1_vec, q2_vec, q3_vec, xv) result(Jh_dq)

    call %eval_Jh_dq1_aux on 1d array of points of size np, using auxiliary variable array of same size

    Arguments

    Type IntentOptional Attributes Name
    class(c_hmap), intent(in) :: sf
    integer, intent(in) :: np
    real(kind=wp), intent(in) :: q1(1:np)
    real(kind=wp), intent(in) :: q2(1:np)
    real(kind=wp), intent(in) :: q1_vec(1:np)
    real(kind=wp), intent(in) :: q2_vec(1:np)
    real(kind=wp), intent(in) :: q3_vec(1:np)
    class(c_hmap_auxvar), intent(in) :: xv(1:np)

    Return Value real(kind=wp), (1:np)

procedure, public :: eval_gij_aux_all => hmap_eval_gij_aux_all

  • public function hmap_eval_gij_aux_all(sf, np, qL1, qL2, qL3, q1, q2, qR1, qR2, qR3, xv) result(g_ab)

    Arguments

    Type IntentOptional Attributes Name
    class(c_hmap), intent(in) :: sf
    integer, intent(in) :: np
    real(kind=wp), intent(in) :: qL1(1:np)
    real(kind=wp), intent(in) :: qL2(1:np)
    real(kind=wp), intent(in) :: qL3(1:np)
    real(kind=wp), intent(in) :: q1(1:np)
    real(kind=wp), intent(in) :: q2(1:np)
    real(kind=wp), intent(in) :: qR1(1:np)
    real(kind=wp), intent(in) :: qR2(1:np)
    real(kind=wp), intent(in) :: qR3(1:np)
    class(c_hmap_auxvar), intent(in) :: xv(1:np)

    Return Value real(kind=wp), (1:np)

procedure, public :: eval_gij_dq_aux_all => hmap_eval_gij_dq_aux_all

  • public function hmap_eval_gij_dq_aux_all(sf, np, qL1, qL2, qL3, q1, q2, qR1, qR2, qR3, q1_vec, q2_vec, q3_vec, xv) result(g_ab_dq)

    Arguments

    Type IntentOptional Attributes Name
    class(c_hmap), intent(in) :: sf
    integer, intent(in) :: np
    real(kind=wp), intent(in) :: qL1(1:np)
    real(kind=wp), intent(in) :: qL2(1:np)
    real(kind=wp), intent(in) :: qL3(1:np)
    real(kind=wp), intent(in) :: q1(1:np)
    real(kind=wp), intent(in) :: q2(1:np)
    real(kind=wp), intent(in) :: qR1(1:np)
    real(kind=wp), intent(in) :: qR2(1:np)
    real(kind=wp), intent(in) :: qR3(1:np)
    real(kind=wp), intent(in) :: q1_vec(1:np)
    real(kind=wp), intent(in) :: q2_vec(1:np)
    real(kind=wp), intent(in) :: q3_vec(1:np)
    class(c_hmap_auxvar), intent(in) :: xv(1:np)

    Return Value real(kind=wp), (1:np)

procedure, public :: eval_all => hmap_axisNB_eval_all

  • public subroutine hmap_axisNB_eval_all(sf, ndims, dim_zeta, xv, q1, q2, dX1_dt, dX2_dt, dX1_dz, dX2_dz, Jh, g_tt, g_tz, g_zz, Jh_dq1, g_tt_dq1, g_tz_dq1, g_zz_dq1, Jh_dq2, g_tt_dq2, g_tz_dq2, g_zz_dq2, g_t1, g_t2, g_z1, g_z2, Gh11, Gh22)

    evaluate all metrics necessary for optimizer

    Arguments

    Type IntentOptional Attributes Name
    class(t_hmap_axisNB), intent(in) :: sf
    integer, intent(in) :: ndims(3)

    3D dimensions of input arrays

    integer, intent(in) :: dim_zeta

    which dimension is zeta dependent

    class(c_hmap_auxvar), intent(in) :: xv(ndims(dim_zeta))

    zeta point positions

    real(kind=wp), intent(in), DIMENSION(ndims(1),ndims(2),ndims(3)) :: q1
    real(kind=wp), intent(in), DIMENSION(ndims(1),ndims(2),ndims(3)) :: q2
    real(kind=wp), intent(in), DIMENSION(ndims(1),ndims(2),ndims(3)) :: dX1_dt
    real(kind=wp), intent(in), DIMENSION(ndims(1),ndims(2),ndims(3)) :: dX2_dt
    real(kind=wp), intent(in), DIMENSION(ndims(1),ndims(2),ndims(3)) :: dX1_dz
    real(kind=wp), intent(in), DIMENSION(ndims(1),ndims(2),ndims(3)) :: dX2_dz
    real(kind=wp), intent(out), DIMENSION(ndims(1),ndims(2),ndims(3)) :: Jh
    real(kind=wp), intent(out), DIMENSION(ndims(1),ndims(2),ndims(3)) :: g_tt
    real(kind=wp), intent(out), DIMENSION(ndims(1),ndims(2),ndims(3)) :: g_tz
    real(kind=wp), intent(out), DIMENSION(ndims(1),ndims(2),ndims(3)) :: g_zz
    real(kind=wp), intent(out), DIMENSION(ndims(1),ndims(2),ndims(3)) :: Jh_dq1
    real(kind=wp), intent(out), DIMENSION(ndims(1),ndims(2),ndims(3)) :: g_tt_dq1
    real(kind=wp), intent(out), DIMENSION(ndims(1),ndims(2),ndims(3)) :: g_tz_dq1
    real(kind=wp), intent(out), DIMENSION(ndims(1),ndims(2),ndims(3)) :: g_zz_dq1
    real(kind=wp), intent(out), DIMENSION(ndims(1),ndims(2),ndims(3)) :: Jh_dq2
    real(kind=wp), intent(out), DIMENSION(ndims(1),ndims(2),ndims(3)) :: g_tt_dq2
    real(kind=wp), intent(out), DIMENSION(ndims(1),ndims(2),ndims(3)) :: g_tz_dq2
    real(kind=wp), intent(out), DIMENSION(ndims(1),ndims(2),ndims(3)) :: g_zz_dq2
    real(kind=wp), intent(out), DIMENSION(ndims(1),ndims(2),ndims(3)) :: g_t1
    real(kind=wp), intent(out), DIMENSION(ndims(1),ndims(2),ndims(3)) :: g_t2
    real(kind=wp), intent(out), DIMENSION(ndims(1),ndims(2),ndims(3)) :: g_z1
    real(kind=wp), intent(out), DIMENSION(ndims(1),ndims(2),ndims(3)) :: g_z2
    real(kind=wp), intent(out), DIMENSION(ndims(1),ndims(2),ndims(3)) :: Gh11
    real(kind=wp), intent(out), DIMENSION(ndims(1),ndims(2),ndims(3)) :: Gh22

procedure, public :: eval => hmap_axisNB_eval

  • public function hmap_axisNB_eval(sf, q_in) result(x_out)

    evaluate the mapping h (q1,q2,zeta) -> (x,y,z)

    Arguments

    Type IntentOptional Attributes Name
    class(t_hmap_axisNB), intent(in) :: sf
    real(kind=wp), intent(in) :: q_in(3)

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

procedure, public :: eval_aux => hmap_axisNB_eval_aux

  • public function hmap_axisNB_eval_aux(sf, q1, q2, xv) result(x_out)

    evaluate the mapping h (q1,q2,zeta) -> (x,y,z)

    Arguments

    Type IntentOptional Attributes Name
    class(t_hmap_axisNB), intent(in) :: sf
    real(kind=wp), intent(in) :: q1
    real(kind=wp), intent(in) :: q2
    class(c_hmap_auxvar), intent(in) :: xv

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

procedure, public :: eval_dxdq => hmap_axisNB_eval_dxdq

  • public function hmap_axisNB_eval_dxdq(sf, q_in, q_vec) result(dxdq_qvec)

    evaluate total derivative of the mapping sum k=1,3 (dx(1:3)/dq^k) q_vec^k, where dx(1:3)/dq^k, k=1,2,3 is evaluated at q_in=(X^1,X^2,zeta) ,

    Arguments

    Type IntentOptional Attributes Name
    class(t_hmap_axisNB), intent(in) :: sf
    real(kind=wp), intent(in) :: q_in(3)
    real(kind=wp), intent(in) :: q_vec(3)

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

procedure, public :: eval_dxdq_aux => hmap_axisNB_eval_dxdq_aux

  • public function hmap_axisNB_eval_dxdq_aux(sf, q1, q2, q1_vec, q2_vec, q3_vec, xv) result(dxdq_qvec)

    evaluate total derivative of the mapping sum k=1,3 (dx(1:3)/dq^k) q_vec^k, where dx(1:3)/dq^k, k=1,2,3 is evaluated at q_in=(X^1,X^2,zeta) ,

    Arguments

    Type IntentOptional Attributes Name
    class(t_hmap_axisNB), intent(in) :: sf
    real(kind=wp), intent(in) :: q1
    real(kind=wp), intent(in) :: q2
    real(kind=wp), intent(in) :: q1_vec
    real(kind=wp), intent(in) :: q2_vec
    real(kind=wp), intent(in) :: q3_vec
    class(c_hmap_auxvar), intent(in) :: xv

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

procedure, public :: eval_Jh => hmap_axisNB_eval_Jh

  • public function hmap_axisNB_eval_Jh(sf, q_in) result(Jh)

    evaluate Jacobian of mapping h: J_h=sqrt(det(G)) at q=(q^1,q^2,zeta)

    Arguments

    Type IntentOptional Attributes Name
    class(t_hmap_axisNB), intent(in) :: sf
    real(kind=wp), intent(in) :: q_in(3)

    Return Value real(kind=wp)

procedure, public :: eval_Jh_aux => hmap_axisNB_eval_Jh_aux

  • public function hmap_axisNB_eval_Jh_aux(sf, q1, q2, xv) result(Jh)

    evaluate Jacobian of mapping h: J_h=sqrt(det(G)) at q=(q^1,q^2,zeta)

    Arguments

    Type IntentOptional Attributes Name
    class(t_hmap_axisNB), intent(in) :: sf
    real(kind=wp), intent(in) :: q1
    real(kind=wp), intent(in) :: q2
    class(c_hmap_auxvar), intent(in) :: xv

    Return Value real(kind=wp)

procedure, public :: eval_Jh_dq => hmap_axisNB_eval_Jh_dq

  • public function hmap_axisNB_eval_Jh_dq(sf, q_in, q_vec) result(Jh_dq)

    evaluate derivative of Jacobian of mapping h: sum_k q_vec^k dJ_h/dq^k, k=1,2,3 at q=(q^1,q^2,zeta)

    Arguments

    Type IntentOptional Attributes Name
    class(t_hmap_axisNB), intent(in) :: sf
    real(kind=wp), intent(in) :: q_in(3)
    real(kind=wp), intent(in) :: q_vec(3)

    Return Value real(kind=wp)

procedure, public :: eval_Jh_dq_aux => hmap_axisNB_eval_Jh_dq_aux

  • public function hmap_axisNB_eval_Jh_dq_aux(sf, q1, q2, q1_vec, q2_vec, q3_vec, xv) result(Jh_dq)

    evaluate derivative of Jacobian of mapping h: sum_k q_vec^k dJ_h/dq^k, k=1,2,3 at q=(q^1,q^2,zeta)

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(t_hmap_axisNB), intent(in) :: sf
    real(kind=wp), intent(in) :: q1
    real(kind=wp), intent(in) :: q2
    real(kind=wp), intent(in) :: q1_vec
    real(kind=wp), intent(in) :: q2_vec
    real(kind=wp), intent(in) :: q3_vec
    class(c_hmap_auxvar), intent(in) :: xv

    Return Value real(kind=wp)

procedure, public :: eval_gij => hmap_axisNB_eval_gij

  • public function hmap_axisNB_eval_gij(sf, qL_in, q_G, qR_in) result(g_ab)

    evaluate sum_ij (qL_i (G_ij(q_G)) qR_j) ,, where qL=(dX^1/dalpha,dX^2/dalpha ,dzeta/dalpha) and qR=(dX^1/dbeta,dX^2/dbeta ,dzeta/dbeta) and dzeta_dalpha then known to be either 0.0 for ds and dtheta and 1.0 for dzeta

    Arguments

    Type IntentOptional Attributes Name
    class(t_hmap_axisNB), intent(in) :: sf
    real(kind=wp), intent(in) :: qL_in(3)
    real(kind=wp), intent(in) :: q_G(3)
    real(kind=wp), intent(in) :: qR_in(3)

    Return Value real(kind=wp)

procedure, public :: eval_gij_aux => hmap_axisNB_eval_gij_aux

  • public function hmap_axisNB_eval_gij_aux(sf, qL1, qL2, qL3, q1, q2, qR1, qR2, qR3, xv) result(g_ab)

    evaluate sum_ij (qL_i (G_ij(q_G)) qR_j) ,, where qL=(dX^1/dalpha,dX^2/dalpha ,dzeta/dalpha) and qR=(dX^1/dbeta,dX^2/dbeta ,dzeta/dbeta) and dzeta_dalpha then known to be either 0.0 for ds and dtheta and 1.0 for dzeta

    Arguments

    Type IntentOptional Attributes Name
    class(t_hmap_axisNB), intent(in) :: sf
    real(kind=wp), intent(in) :: qL1
    real(kind=wp), intent(in) :: qL2
    real(kind=wp), intent(in) :: qL3
    real(kind=wp), intent(in) :: q1
    real(kind=wp), intent(in) :: q2
    real(kind=wp), intent(in) :: qR1
    real(kind=wp), intent(in) :: qR2
    real(kind=wp), intent(in) :: qR3
    class(c_hmap_auxvar), intent(in) :: xv

    Return Value real(kind=wp)

procedure, public :: eval_gij_dq => hmap_axisNB_eval_gij_dq

  • public function hmap_axisNB_eval_gij_dq(sf, qL_in, q_G, qR_in, q_vec) result(g_ab_dq)

    evaluate sum_k q_vec^k * sum_ij (qL_i d/dq^k(G_ij(q_G)) qR_j) , k=1,2,3 where qL=(dX^1/dalpha,dX^2/dalpha [,dzeta/dalpha]) and qR=(dX^1/dbeta,dX^2/dbeta [,dzeta/dbeta]) and where qL=(dX^1/dalpha,dX^2/dalpha ,dzeta/dalpha) and qR=(dX^1/dbeta,dX^2/dbeta ,dzeta/dbeta) and dzeta_dalpha then known to be either 0.0 for ds and dtheta and 1.0 for dzeta

    Arguments

    Type IntentOptional Attributes Name
    class(t_hmap_axisNB), intent(in) :: sf
    real(kind=wp), intent(in) :: qL_in(3)
    real(kind=wp), intent(in) :: q_G(3)
    real(kind=wp), intent(in) :: qR_in(3)
    real(kind=wp), intent(in) :: q_vec(3)

    Return Value real(kind=wp)

procedure, public :: eval_gij_dq_aux => hmap_axisNB_eval_gij_dq_aux

  • public function hmap_axisNB_eval_gij_dq_aux(sf, qL1, qL2, qL3, q1, q2, qR1, qR2, qR3, q1_vec, q2_vec, q3_vec, xv) result(g_ab_dq)

    evaluate sum_k q_vec^k * sum_ij (qL_i d/dq^k(G_ij(q_G)) qR_j) , k=1,2,3 where qL=(dX^1/dalpha,dX^2/dalpha [,dzeta/dalpha]) and qR=(dX^1/dbeta,dX^2/dbeta [,dzeta/dbeta]) and where qL=(dX^1/dalpha,dX^2/dalpha ,dzeta/dalpha) and qR=(dX^1/dbeta,dX^2/dbeta ,dzeta/dbeta) and dzeta_dalpha then known to be either 0.0 for ds and dtheta and 1.0 for dzeta

    Read more…

    Arguments

    Type IntentOptional Attributes Name
    class(t_hmap_axisNB), intent(in) :: sf
    real(kind=wp), intent(in) :: qL1
    real(kind=wp), intent(in) :: qL2
    real(kind=wp), intent(in) :: qL3
    real(kind=wp), intent(in) :: q1
    real(kind=wp), intent(in) :: q2
    real(kind=wp), intent(in) :: qR1
    real(kind=wp), intent(in) :: qR2
    real(kind=wp), intent(in) :: qR3
    real(kind=wp), intent(in) :: q1_vec
    real(kind=wp), intent(in) :: q2_vec
    real(kind=wp), intent(in) :: q3_vec
    class(c_hmap_auxvar), intent(in) :: xv

    Return Value real(kind=wp)

procedure, public :: get_dx_dqi => hmap_axisNB_get_dx_dqi

  • public subroutine hmap_axisNB_get_dx_dqi(sf, q_in, dx_dq1, dx_dq2, dx_dq3)

    evaluate all first derivatives dx(1:3)/dq^i, i=1,2,3 , at q_in=(X^1,X^2,zeta),

    Arguments

    Type IntentOptional Attributes Name
    class(t_hmap_axisNB), intent(in) :: sf
    real(kind=wp), intent(in) :: q_in(3)
    real(kind=wp), intent(out), DIMENSION(3) :: dx_dq1
    real(kind=wp), intent(out), DIMENSION(3) :: dx_dq2
    real(kind=wp), intent(out), DIMENSION(3) :: dx_dq3

procedure, public :: get_dx_dqi_aux => hmap_axisNB_get_dx_dqi_aux

  • public subroutine hmap_axisNB_get_dx_dqi_aux(sf, q1, q2, xv, dx_dq1, dx_dq2, dx_dq3)

    evaluate all first derivatives dx(1:3)/dq^i, i=1,2,3 , at q_in=(X^1,X^2,zeta),

    Arguments

    Type IntentOptional Attributes Name
    class(t_hmap_axisNB), intent(in) :: sf
    real(kind=wp), intent(in) :: q1
    real(kind=wp), intent(in) :: q2
    class(c_hmap_auxvar), intent(in) :: xv
    real(kind=wp), intent(out), DIMENSION(3) :: dx_dq1
    real(kind=wp), intent(out), DIMENSION(3) :: dx_dq2
    real(kind=wp), intent(out), DIMENSION(3) :: dx_dq3

procedure, public :: get_ddx_dqij => hmap_axisNB_get_ddx_dqij

  • public subroutine hmap_axisNB_get_ddx_dqij(sf, q_in, ddx_dq11, ddx_dq12, ddx_dq13, ddx_dq22, ddx_dq23, ddx_dq33)

    evaluate all second derivatives d^2x(1:3)/(dq^i dq^j), i,j=1,2,3 is evaluated at q_in=(X^1,X^2,zeta),

    Arguments

    Type IntentOptional Attributes Name
    class(t_hmap_axisNB), intent(in) :: sf
    real(kind=wp), intent(in) :: q_in(3)
    real(kind=wp), intent(out), DIMENSION(3) :: ddx_dq11
    real(kind=wp), intent(out), DIMENSION(3) :: ddx_dq12
    real(kind=wp), intent(out), DIMENSION(3) :: ddx_dq13
    real(kind=wp), intent(out), DIMENSION(3) :: ddx_dq22
    real(kind=wp), intent(out), DIMENSION(3) :: ddx_dq23
    real(kind=wp), intent(out), DIMENSION(3) :: ddx_dq33

procedure, public :: get_ddx_dqij_aux => hmap_axisNB_get_ddx_dqij_aux

  • public subroutine hmap_axisNB_get_ddx_dqij_aux(sf, q1, q2, xv, ddx_dq11, ddx_dq12, ddx_dq13, ddx_dq22, ddx_dq23, ddx_dq33)

    evaluate all second derivatives d^2x(1:3)/(dq^i dq^j), i,j=1,2,3 is evaluated at q_in=(X^1,X^2,zeta),

    Arguments

    Type IntentOptional Attributes Name
    class(t_hmap_axisNB), intent(in) :: sf
    real(kind=wp), intent(in) :: q1
    real(kind=wp), intent(in) :: q2
    class(c_hmap_auxvar), intent(in) :: xv
    real(kind=wp), intent(out), DIMENSION(3) :: ddx_dq11
    real(kind=wp), intent(out), DIMENSION(3) :: ddx_dq12
    real(kind=wp), intent(out), DIMENSION(3) :: ddx_dq13
    real(kind=wp), intent(out), DIMENSION(3) :: ddx_dq22
    real(kind=wp), intent(out), DIMENSION(3) :: ddx_dq23
    real(kind=wp), intent(out), DIMENSION(3) :: ddx_dq33

procedure, public :: eval_TNB => hmap_axisNB_eval_TNB_hat

  • public subroutine hmap_axisNB_eval_TNB_hat(sf, zeta, X0, T, N, B, Np, Bp, Tp, Npp, Bpp)

    evaluate curve X0(zeta), and T=X0',N,B,N',B', using the fourier series of X0_hat,N_hat and B_hat and transform from "hat" coordinates to cartesian coordinates: x=xhatcos(zeta)-sgn_rotyhatsin(zeta), y=yhatcos(zeta)+sgn_rotsin(zeta)xhat, z=zhat

    Arguments

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

    position along closed curve parametrized in [0,2pi]

    real(kind=wp), intent(out) :: X0(1:3)

    curve position in cartesian coordinates

    real(kind=wp), intent(out) :: T(1:3)

    tangent X0'

    real(kind=wp), intent(out) :: N(1:3)

    Normal

    real(kind=wp), intent(out) :: B(1:3)

    bi-Normal

    real(kind=wp), intent(out) :: Np(1:3)

    derivative of Normal in zeta (N')

    real(kind=wp), intent(out) :: Bp(1:3)

    derivative of bi-Normal in zeta (B')

    real(kind=wp), intent(out), optional :: Tp(1:3)

    derivative of tangent in zeta (X0'')

    real(kind=wp), intent(out), optional :: Npp(1:3)

    2nd derivative of Normal in zeta (N'')

    real(kind=wp), intent(out), optional :: Bpp(1:3)

    2nd derivative of bi-Normal in zeta (B'')

Source Code

TYPE,EXTENDS(c_hmap) :: t_hmap_axisNB
  !---------------------------------------------------------------------------------------------------------------------------------
  LOGICAL  :: initialized=.FALSE.
  !---------------------------------------------------------------------------------------------------------------------------------
  ! parameters for hmap_axisNB:
  !INTEGER              :: nfp   !! already part of c_hmap. Is overwritten in init!
  !curve description
  INTEGER              :: nzeta=0       !! number of points in zeta direction of the input axis
  INTEGER              :: sgn_rot       !! sign of rotation around Z axis,  either +1 or -1: positive means that from one field period to the next,
                                        !! xyz rotate counterclockwise around the Z-axis (right hand rule), negative then clockwise.
  REAL(wp),ALLOCATABLE :: zeta(:)       !! zeta positions in one field period (1:nzeta),  on 'half' grid: zeta(i)=(i-0.5)/nzeta*(2pi/nfp)
  REAL(wp),ALLOCATABLE :: xyz(:,:)      !! cartesian coordinates of the axis for a full turn, (1:NFP*nzeta,1:3), zeta is on 'half' grid: zeta(i)=(i-0.5)/(NFP*nzeta)*(2pi)
  REAL(wp),ALLOCATABLE :: Nxyz(:,:)     !! "normal" vector of axis frame in cartesian coordinates for a full turn (1:NFP*nzeta,1:3). NOT ASSUMED TO BE ORTHOGONAL to tangent of curve
  REAL(wp),ALLOCATABLE :: Bxyz(:,:)      !! "Bi-normal" vector of axis frame in cartesian coordinates for a full turn (1:NFP*nzeta,1:3). NOT ASSUMED TO BE ORTHOGONAL to tangent of curve or Nxyz
  !fourier modes
  REAL(wp),ALLOCATABLE :: xyz_hat_modes(:,:)   !! fourier modes of xhat,yhat,zhat on one field period,
                                               !! x=cos(zeta)xhat-sgn_rot*sin(zeta)yhat,
                                               !! y=sin(zeta)xhat+sgn_rot*cos(zeta)yhat, z=zhat
  REAL(wp),ALLOCATABLE :: Nxyz_hat_modes(:,:)   !! 1d fourier modes of Nxyz, one field period
  REAL(wp),ALLOCATABLE :: Bxyz_hat_modes(:,:)   !! 1d fourier modes of Bxyz, one field period

  CHARACTER(LEN=1024)   :: ncfile=" " !! name of netcdf file with axis information
  !---------------------------------------------------------------------------------------------------------------------------------
  TYPE(t_fbase)        :: fb_hat  !! container for 1d fourier base of xhat
  CLASS(t_ncfile),ALLOCATABLE  :: nc  !! container for netcdf-file


  CONTAINS

  FINAL     :: hmap_axisNB_free
  PROCEDURE :: eval_all        => hmap_axisNB_eval_all
  PROCEDURE :: eval            => hmap_axisNB_eval
  PROCEDURE :: eval_aux        => hmap_axisNB_eval_aux
  PROCEDURE :: eval_dxdq       => hmap_axisNB_eval_dxdq
  PROCEDURE :: eval_dxdq_aux   => hmap_axisNB_eval_dxdq_aux
  PROCEDURE :: eval_Jh         => hmap_axisNB_eval_Jh
  PROCEDURE :: eval_Jh_aux     => hmap_axisNB_eval_Jh_aux
  PROCEDURE :: eval_Jh_dq      => hmap_axisNB_eval_Jh_dq
  PROCEDURE :: eval_Jh_dq_aux  => hmap_axisNB_eval_Jh_dq_aux
  PROCEDURE :: eval_gij        => hmap_axisNB_eval_gij
  PROCEDURE :: eval_gij_aux    => hmap_axisNB_eval_gij_aux
  PROCEDURE :: eval_gij_dq     => hmap_axisNB_eval_gij_dq
  PROCEDURE :: eval_gij_dq_aux => hmap_axisNB_eval_gij_dq_aux
  PROCEDURE :: get_dx_dqi       => hmap_axisNB_get_dx_dqi
  PROCEDURE :: get_dx_dqi_aux   => hmap_axisNB_get_dx_dqi_aux
  PROCEDURE :: get_ddx_dqij     => hmap_axisNB_get_ddx_dqij
  PROCEDURE :: get_ddx_dqij_aux => hmap_axisNB_get_ddx_dqij_aux

  !---------------------------------------------------------------------------------------------------------------------------------
  ! procedures for hmap_axisNB:
  PROCEDURE :: eval_TNB         => hmap_axisNB_eval_TNB_hat

END TYPE t_hmap_axisNB