MODgvec_SFL_Boozer Module

Module SFL boozer

Transform to Straight-field line BOOZER coordinates


Uses

  • module~~modgvec_sfl_boozer~~UsesGraph module~modgvec_sfl_boozer MODgvec_SFL_Boozer module~modgvec_fbase MODgvec_fBase module~modgvec_sfl_boozer->module~modgvec_fbase module~modgvec_globals MODgvec_Globals module~modgvec_sfl_boozer->module~modgvec_globals module~modgvec_hmap MODgvec_hmap module~modgvec_sfl_boozer->module~modgvec_hmap module~modgvec_newton MODgvec_Newton module~modgvec_sfl_boozer->module~modgvec_newton module~modgvec_fbase->module~modgvec_globals iso_fortran_env iso_fortran_env module~modgvec_globals->iso_fortran_env module~modgvec_c_hmap MODgvec_c_hmap module~modgvec_hmap->module~modgvec_c_hmap module~modgvec_hmap_axisnb MODgvec_hmap_axisNB module~modgvec_hmap->module~modgvec_hmap_axisnb module~modgvec_hmap_cyl MODgvec_hmap_cyl module~modgvec_hmap->module~modgvec_hmap_cyl module~modgvec_hmap_frenet MODgvec_hmap_frenet module~modgvec_hmap->module~modgvec_hmap_frenet module~modgvec_hmap_knot MODgvec_hmap_knot module~modgvec_hmap->module~modgvec_hmap_knot module~modgvec_hmap_rz MODgvec_hmap_RZ module~modgvec_hmap->module~modgvec_hmap_rz module~modgvec_newton->module~modgvec_globals module~modgvec_c_hmap->module~modgvec_globals module~modgvec_hmap_axisnb->module~modgvec_fbase module~modgvec_hmap_axisnb->module~modgvec_globals module~modgvec_hmap_axisnb->module~modgvec_c_hmap module~modgvec_io_netcdf MODgvec_IO_NETCDF module~modgvec_hmap_axisnb->module~modgvec_io_netcdf module~modgvec_hmap_cyl->module~modgvec_globals module~modgvec_hmap_cyl->module~modgvec_c_hmap module~modgvec_hmap_frenet->module~modgvec_globals module~modgvec_hmap_frenet->module~modgvec_c_hmap module~modgvec_hmap_knot->module~modgvec_globals module~modgvec_hmap_knot->module~modgvec_c_hmap module~modgvec_hmap_rz->module~modgvec_globals module~modgvec_hmap_rz->module~modgvec_c_hmap module~modgvec_io_netcdf->module~modgvec_globals netcdf netcdf module~modgvec_io_netcdf->netcdf

Used by

  • module~~modgvec_sfl_boozer~~UsedByGraph module~modgvec_sfl_boozer MODgvec_SFL_Boozer module~modgvec_transform_sfl MODgvec_Transform_SFL module~modgvec_transform_sfl->module~modgvec_sfl_boozer 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 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

Interfaces

private interface sfl_boozer_new


Derived Types

type, public ::  t_sfl_boozer

Class for the computation of the boozer transform, on a given radial grid positions rho, with iota(rho) phiPrime(rho) values.

Read more…

Components

Type Visibility Attributes Name Initial
logical, public :: initialized = .FALSE.

set to true in init, set to false in free

integer, public :: nrho

number of rho positions

logical, public :: relambda

if =True, J^s=0 will be recomputed, for exact integrability condition of boozer transform (but slower!)

type(t_fBase), public, ALLOCATABLE :: nu_fbase
real(kind=wp), public, ALLOCATABLE :: rho_pos(:)

rho positions, iota and phiPrime at these rho positions

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

rho positions, iota and phiPrime at these rho positions

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

rho positions, iota and phiPrime at these rho positions

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

Fourier modes for all rho positions of lambda (recomputed on the fourier space of nu) and nu for boozer transform , (iMode,irho)

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

Fourier modes for all rho positions of lambda (recomputed on the fourier space of nu) and nu for boozer transform , (iMode,irho)

type(PP_T_HMAP), public, POINTER :: hmap

pointer to hmap class

type(PP_T_HMAP_AUXVAR), public, ALLOCATABLE :: hmap_xv(:)

auxiliary variables for hmap

class(c_hmap), public, POINTER :: hmap

pointer to hmap class

class(c_hmap_auxvar), public, ALLOCATABLE :: hmap_xv(:)

auxiliary variables for hmap

Type-Bound Procedures

procedure, public :: get_boozer => Get_Boozer_sinterp
procedure, public :: free => sfl_boozer_free
procedure, public :: find_angles => self_find_boozer_angles
procedure, public :: find_angles_irho => self_find_boozer_angles_irho

type, private, extends(c_newton_Root2D) ::  t_newton_Root2D_boozer

Components

Type Visibility Attributes Name Initial
type(t_fBase), public, POINTER :: AB_fbase_in
real(kind=wp), public, POINTER :: A_in(:)
real(kind=wp), public, POINTER :: B_in(:)
real(kind=wp), public :: x0(2)

Type-Bound Procedures

procedure, public :: FR => get_booz_newton_FR
procedure, public :: dFR => get_booz_newton_dFR

Functions

private function get_booz_newton(x0, bounds, AB_fbase_in, A_in, B_in) result(x_out)

This function returns the result of the 2D newton root search for the boozer angle

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in) :: x0(2)
real(kind=wp), intent(in) :: bounds(2)
type(t_fBase), intent(in), TARGET :: AB_fbase_in
real(kind=wp), intent(in), TARGET :: A_in(1:AB_fbase_in%modes)
real(kind=wp), intent(in), TARGET :: B_in(1:AB_fbase_in%modes)

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

private function get_booz_newton_FR(sf, x) result(FF)

Target function for finding the logical angle for given boozer angles

Arguments

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

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

private function get_booz_newton_dFR(sf, x) result(dFF)

Derivative of the target function for finding the logical angle for given boozer angles

Arguments

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

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


Subroutines

public subroutine sfl_boozer_new(sf, mn_max, mn_nyq, nfp, sin_cos, hmap_in, nrho, rho_pos, iota, phiPrime, relambda_in)

initialize sfl boozer class

Arguments

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

self

integer, intent(in) :: mn_max(2)

maximum Fourier modes in theta and zeta

integer, intent(in) :: mn_nyq(2)

number of equidistant integration points (trapezoidal rule) in m and n

integer, intent(in) :: nfp

number of field periods

character(len=8) :: sin_cos

can be either only sine: " sin" only cosine: " cos" or full: "sin_cos"

type(PP_T_HMAP), intent(in), TARGET :: hmap_in
integer, intent(in) :: nrho

number of rho positions

real(kind=wp), intent(in) :: rho_pos(nrho)

rho positions, iota and phiPrime at these rho positions

real(kind=wp), intent(in) :: iota(nrho)

rho positions, iota and phiPrime at these rho positions

real(kind=wp), intent(in) :: phiPrime(nrho)

rho positions, iota and phiPrime at these rho positions

logical, intent(in), optional :: relambda_in

DEFAULT=TRUE: lambda is recomputed on the given fourier resolution, RECOMMENDED for exact integrability condition of boozer transform, but slower. FALSE: lambda from equilibrium solution is taken.

private subroutine sfl_boozer_free(sf)

finalize sfl boozer class

Arguments

Type IntentOptional Attributes Name
class(t_sfl_boozer), intent(inout) :: sf

self

private subroutine Get_Boozer_sinterp(sf, X1_base_in, X2_base_in, LA_base_in, X1_in, X2_in, LA_in)

Builds the boozer transform coordinate theta^B = theta + lambda + iota(s)*nu(s,theta,zeta) zeta^B = zeta +nu(s,theta,zeta)

Read more…

Arguments

Type IntentOptional Attributes Name
class(t_sfl_boozer), intent(inout) :: sf

!-----------------------------------------------------------------------------------------------------------------------------------

class(t_base), intent(in) :: X1_base_in
class(t_base), intent(in) :: X2_base_in
class(t_base), intent(in) :: LA_base_in
real(kind=wp), intent(in) :: X1_in(1:X1_base_in%s%nbase,1:X1_base_in%f%modes)
real(kind=wp), intent(in) :: X2_in(1:X2_base_in%s%nbase,1:X2_base_in%f%modes)
real(kind=wp), intent(in) :: LA_in(1:LA_base_in%s%nbase,1:LA_base_in%f%modes)

private subroutine self_find_boozer_angles(sf, tz_dim, tz_boozer, thetzeta_out)

interface to find_boozer_angles from the class t_sfl_boozer

Arguments

Type IntentOptional Attributes Name
class(t_sfl_boozer), intent(in) :: sf
integer, intent(in) :: tz_dim
real(kind=wp), intent(in) :: tz_boozer(2,tz_dim)
real(kind=wp), intent(out) :: thetzeta_out(2,tz_dim,sf%nrho)

theta,zeta position in original angles, for given boozer angles

private subroutine self_find_boozer_angles_irho(sf, irho, tz_dim, tz_boozer, thetzeta_out)

interface to find_boozer_angles from the class t_sfl_boozer

Arguments

Type IntentOptional Attributes Name
class(t_sfl_boozer), intent(in) :: sf
integer, intent(in) :: irho
integer, intent(in) :: tz_dim
real(kind=wp), intent(in) :: tz_boozer(2,tz_dim)
real(kind=wp), intent(out) :: thetzeta_out(2,tz_dim)

public subroutine find_boozer_angles(nrho, iota, fbase_in, LA_in, nu_in, tz_dim, tz_boozer, thetzeta_out)

on one flux surface, find for an given list of (thet_j,zeta_j), the corresponding (thet_j,zeta_j) positions, given Here, new boozer angles are theta=theta+Gt(theta,zeta) zeta=zeta+nu(theta,zeta), with Gt=lambda+iotanu and nu periodic functions and zero average and same base Note that in this routine, we will use a 2d root search with a newton method, setting [f1,f2]^T = [thet+A(thet,zeta)-thet=0, zeta+B(thet,zeta)-zeta*=0]^T that includes the derivatives (Jacobian), so that the newton step needs to the solved: -[f1] [ 1+dA/dthet dA/dzeta] [dthet] | | = | | | | -[f2] [ dB/dthet 1+dB/dzeta] [dzeta]

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: nrho

number of surfaces, (second dimension of LA_in and nu_in modes)

real(kind=wp), intent(in) :: iota(nrho)

iota at the rho positions.

type(t_fBase), intent(in) :: fbase_in
real(kind=wp), intent(in) :: LA_in(1:fbase_in%modes,nrho)
real(kind=wp), intent(in) :: nu_in(1:fbase_in%modes,nrho)
integer, intent(in) :: tz_dim
real(kind=wp), intent(in) :: tz_boozer(2,tz_dim)
real(kind=wp), intent(out) :: thetzeta_out(2,tz_dim,nrho)

theta,zeta position in original angles, for given boozer angles