MODgvec_hmap_axisNB Module

Module ** hmap_axisNB **

This map uses a given periodic input curve X0(zeta) along the curve parameter zeta in [0,2pi]. It is very similar to a Frenet-Serret frame (TNB frame), but with normal N and binormal B vectors as input functions as well. h: X_0(\zeta) + q_1 N(\zeta) + q_2 B(\zeta) the tangent is T=X_0', and N and B are assumed to be continous along zeta, so no switches. Note that since N, B are input functions, they are not assumed to be unit length nor orthogonal, but together with the tangent of the curve T = X_0' , (T, N, B) should form a linearly independent set of basis vectors, with T.(B x N) > 0.

As a representation of the curve X0(\zeta), zeta is the curve parametrization in [0,2pi] and the 3 cartesian coordinates of X0,N,B are given at a set of zeta points over one full turn, with nzeta*Nfp number of points. these will then be fourier transformed to compute derivatives


Uses

  • module~~modgvec_hmap_axisnb~~UsesGraph module~modgvec_hmap_axisnb MODgvec_hmap_axisNB module~modgvec_c_hmap MODgvec_c_hmap module~modgvec_hmap_axisnb->module~modgvec_c_hmap module~modgvec_fbase MODgvec_fBase module~modgvec_hmap_axisnb->module~modgvec_fbase module~modgvec_globals MODgvec_Globals module~modgvec_hmap_axisnb->module~modgvec_globals module~modgvec_io_netcdf MODgvec_IO_NETCDF module~modgvec_hmap_axisnb->module~modgvec_io_netcdf module~modgvec_c_hmap->module~modgvec_globals module~modgvec_fbase->module~modgvec_globals iso_fortran_env iso_fortran_env module~modgvec_globals->iso_fortran_env module~modgvec_io_netcdf->module~modgvec_globals

Used by

  • module~~modgvec_hmap_axisnb~~UsedByGraph module~modgvec_hmap_axisnb MODgvec_hmap_axisNB module~modgvec_hmap MODgvec_hmap module~modgvec_hmap->module~modgvec_hmap_axisnb module~modgvec_mhd3d_vars MODgvec_MHD3D_Vars module~modgvec_mhd3d_vars->module~modgvec_hmap module~modgvec_readstate_vars MODgvec_ReadState_Vars module~modgvec_readstate_vars->module~modgvec_hmap module~modgvec_sfl_boozer MODgvec_SFL_Boozer module~modgvec_sfl_boozer->module~modgvec_hmap module~modgvec_transform_sfl MODgvec_Transform_SFL module~modgvec_transform_sfl->module~modgvec_hmap module~modgvec_transform_sfl->module~modgvec_sfl_boozer proc~evaluate_hmap evaluate_hmap proc~evaluate_hmap->module~modgvec_hmap proc~evaluate_hmap->module~modgvec_mhd3d_vars proc~evaluate_hmap_derivs evaluate_hmap_derivs proc~evaluate_hmap_derivs->module~modgvec_hmap proc~evaluate_hmap_derivs->module~modgvec_mhd3d_vars proc~evaluate_hmap_only evaluate_hmap_only proc~evaluate_hmap_only->module~modgvec_hmap proc~evaluate_hmap_only->module~modgvec_mhd3d_vars proc~evaluate_jac_h_derivs evaluate_jac_h_derivs proc~evaluate_jac_h_derivs->module~modgvec_hmap proc~evaluate_jac_h_derivs->module~modgvec_mhd3d_vars proc~evaluate_metric_derivs evaluate_metric_derivs proc~evaluate_metric_derivs->module~modgvec_hmap proc~evaluate_metric_derivs->module~modgvec_mhd3d_vars proc~init_la_from_solution Init_LA_from_Solution proc~init_la_from_solution->module~modgvec_hmap proc~init_la_from_solution->module~modgvec_mhd3d_vars proc~initmhd3d t_functional_mhd3d%InitMHD3D proc~initmhd3d->module~modgvec_hmap proc~initmhd3d->module~modgvec_mhd3d_vars proc~lambda_solve Lambda_solve proc~lambda_solve->module~modgvec_hmap proc~readstatefilefromascii ReadStateFileFromASCII proc~readstatefilefromascii->module~modgvec_hmap proc~readstatefilefromascii->module~modgvec_readstate_vars proc~sfl_boozer_new sfl_boozer_new proc~sfl_boozer_new->module~modgvec_hmap 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~addboundaryperturbation AddBoundaryPerturbation proc~addboundaryperturbation->module~modgvec_mhd3d_vars proc~analyze Analyze proc~analyze->module~modgvec_mhd3d_vars proc~applybc_fstrong ApplyBC_Fstrong proc~applybc_fstrong->module~modgvec_mhd3d_vars proc~buildprecond BuildPrecond proc~buildprecond->module~modgvec_mhd3d_vars proc~buildtransform_sfl t_transform_sfl%BuildTransform_SFL proc~buildtransform_sfl->module~modgvec_sfl_boozer proc~eval_prof_r eval_prof_r proc~eval_prof_r->module~modgvec_readstate_vars proc~evalaux EvalAux proc~evalaux->module~modgvec_mhd3d_vars proc~evalenergy EvalEnergy proc~evalenergy->module~modgvec_mhd3d_vars proc~evalforce EvalForce proc~evalforce->module~modgvec_mhd3d_vars proc~evaluate_boozer_list_tz_all evaluate_boozer_list_tz_all proc~evaluate_boozer_list_tz_all->module~modgvec_sfl_boozer proc~evaluate_hmap_only_pw evaluate_hmap_only_pw proc~evaluate_hmap_only_pw->module~modgvec_mhd3d_vars proc~evaluate_hmap_pw evaluate_hmap_pw proc~evaluate_hmap_pw->module~modgvec_mhd3d_vars proc~evaluate_jac_h_derivs_pw evaluate_jac_h_derivs_pw proc~evaluate_jac_h_derivs_pw->module~modgvec_mhd3d_vars proc~evaluate_profile evaluate_profile proc~evaluate_profile->module~modgvec_mhd3d_vars proc~evaluate_rho2_profile evaluate_rho2_profile proc~evaluate_rho2_profile->module~modgvec_mhd3d_vars proc~finalize_readstate Finalize_ReadState proc~finalize_readstate->module~modgvec_readstate_vars proc~finalizemhd3d t_functional_mhd3d%FinalizeMHD3D proc~finalizemhd3d->module~modgvec_mhd3d_vars proc~finalizemhd3d_evalfunc FinalizeMHD3D_EvalFunc proc~finalizemhd3d_evalfunc->module~modgvec_mhd3d_vars proc~find_pest_angles_2d find_pest_angles_2D proc~find_pest_angles_2d->module~modgvec_mhd3d_vars proc~find_pest_angles_2d->module~modgvec_transform_sfl proc~get_boozer get_boozer proc~get_boozer->module~modgvec_mhd3d_vars proc~get_boozer->module~modgvec_sfl_boozer proc~get_field Get_Field proc~get_field->module~modgvec_readstate_vars proc~gvec_to_jorek_prepare gvec_to_jorek_prepare proc~gvec_to_jorek_prepare->module~modgvec_readstate_vars proc~init Init proc~init->module~modgvec_mhd3d_vars proc~init_base Init_Base proc~init_base->module~modgvec_readstate_vars proc~init_boozer init_boozer proc~init_boozer->module~modgvec_mhd3d_vars proc~init_boozer->module~modgvec_sfl_boozer proc~init_gvec_to_jorek init_gvec_to_jorek proc~init_gvec_to_jorek->module~modgvec_readstate_vars proc~initaverageaxis InitAverageAxis proc~initaverageaxis->module~modgvec_mhd3d_vars proc~initializemhd3d_evalfunc InitializeMHD3D_evalFunc proc~initializemhd3d_evalfunc->module~modgvec_mhd3d_vars proc~initprofilesgp InitProfilesGP proc~initprofilesgp->module~modgvec_mhd3d_vars proc~initsolutionmhd3d t_functional_mhd3d%InitSolutionMHD3D proc~initsolutionmhd3d->module~modgvec_mhd3d_vars proc~initsolution~2 InitSolution proc~initsolution~2->module~modgvec_mhd3d_vars proc~minimize minimize proc~minimize->module~modgvec_mhd3d_vars proc~minimizemhd3d t_functional_mhd3d%MinimizeMHD3D proc~minimizemhd3d->module~modgvec_mhd3d_vars proc~readstate ReadState proc~readstate->module~modgvec_readstate_vars proc~restartfromstate RestartFromState proc~restartfromstate->module~modgvec_mhd3d_vars proc~restartfromstate->module~modgvec_readstate_vars proc~select_base select_base proc~select_base->module~modgvec_mhd3d_vars proc~select_base_dofs select_base_dofs proc~select_base_dofs->module~modgvec_mhd3d_vars proc~transform_sfl_init t_transform_sfl%transform_SFL_init proc~transform_sfl_init->module~modgvec_sfl_boozer proc~writestatetoascii WriteStateToASCII proc~writestatetoascii->module~modgvec_mhd3d_vars program~gvec_post GVEC_POST program~gvec_post->module~modgvec_readstate_vars

Variables

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

Interfaces

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

public interface t_hmap_axisNB_auxvar

  • public function hmap_axisNB_init_aux(sf, zeta, do_2nd_der) result(xv)

    initialize the aux variable

    Arguments

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

    self (hmap)

    real(kind=wp), intent(in) :: zeta
    logical, intent(in) :: do_2nd_der

    compute second derivative and store second derivative terms

    Return Value type(t_hmap_axisNB_auxvar)

    auxiliary variable


Derived Types

type, public, extends(c_hmap_auxvar) ::  t_hmap_axisNB_auxvar

Store data that can be precomputed on a set ot zeta points depends on hmap_axisNB, but could be used for different point sets in zeta

Components

Type Visibility Attributes Name Initial
real(kind=wp), public :: zeta
logical, public :: do_2nd_der
real(kind=wp), public, DIMENSION(3) :: X0

Position,Tangent,Normal,Bi-Normal and N',B' and T',B'',N''

real(kind=wp), public, DIMENSION(3) :: T

Position,Tangent,Normal,Bi-Normal and N',B' and T',B'',N''

real(kind=wp), public, DIMENSION(3) :: N

Position,Tangent,Normal,Bi-Normal and N',B' and T',B'',N''

real(kind=wp), public, DIMENSION(3) :: B

Position,Tangent,Normal,Bi-Normal and N',B' and T',B'',N''

real(kind=wp), public, DIMENSION(3) :: Np

Position,Tangent,Normal,Bi-Normal and N',B' and T',B'',N''

real(kind=wp), public, DIMENSION(3) :: Bp

Position,Tangent,Normal,Bi-Normal and N',B' and T',B'',N''

real(kind=wp), public, DIMENSION(3) :: Tp

Position,Tangent,Normal,Bi-Normal and N',B' and T',B'',N''

real(kind=wp), public, DIMENSION(3) :: Npp

Position,Tangent,Normal,Bi-Normal and N',B' and T',B'',N''

real(kind=wp), public, DIMENSION(3) :: Bpp

Position,Tangent,Normal,Bi-Normal and N',B' and T',B'',N''

real(kind=wp), public, DIMENSION(3) :: NxB

cross products

real(kind=wp), public, DIMENSION(3) :: NpxB

cross products

real(kind=wp), public, DIMENSION(3) :: NxBp

cross products

real(kind=wp), public :: BB

dot-products of above vectors, size(nzeta_eval)

real(kind=wp), public :: NN

dot-products of above vectors, size(nzeta_eval)

real(kind=wp), public :: NB

dot-products of above vectors, size(nzeta_eval)

real(kind=wp), public :: BpN

dot-products of above vectors, size(nzeta_eval)

real(kind=wp), public :: BpB

dot-products of above vectors, size(nzeta_eval)

real(kind=wp), public :: NpN

dot-products of above vectors, size(nzeta_eval)

real(kind=wp), public :: NpB

dot-products of above vectors, size(nzeta_eval)

Constructor

public function hmap_axisNB_init_aux (sf, zeta, do_2nd_der)

initialize the aux variable

type, public, extends(c_hmap) ::  t_hmap_axisNB

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 function hmap_axisNB_init ()

initialize the type hmap_axisNB, reading from parameterfile and call init_params

public function hmap_axisNB_init_params (ncfile, nvisu)

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

Read more…

Finalizations Procedures

final :: hmap_axisNB_free

Type-Bound Procedures

procedure, public :: eval_aux_all => hmap_eval_aux_all
procedure, public :: eval_dxdq_aux_all => hmap_eval_dxdq_aux_all
procedure, public :: eval_Jh_aux_all => hmap_eval_Jh_aux_all
procedure, public :: eval_Jh_dq_aux_all => hmap_eval_Jh_dq_aux_all
procedure, public :: eval_gij_aux_all => hmap_eval_gij_aux_all
procedure, public :: eval_gij_dq_aux_all => hmap_eval_gij_dq_aux_all
procedure, public :: eval_all => hmap_axisNB_eval_all
procedure, public :: eval => hmap_axisNB_eval
procedure, public :: eval_aux => hmap_axisNB_eval_aux
procedure, public :: eval_dxdq => hmap_axisNB_eval_dxdq
procedure, public :: eval_dxdq_aux => hmap_axisNB_eval_dxdq_aux
procedure, public :: eval_Jh => hmap_axisNB_eval_Jh
procedure, public :: eval_Jh_aux => hmap_axisNB_eval_Jh_aux
procedure, public :: eval_Jh_dq => hmap_axisNB_eval_Jh_dq
procedure, public :: eval_Jh_dq_aux => hmap_axisNB_eval_Jh_dq_aux
procedure, public :: eval_gij => hmap_axisNB_eval_gij
procedure, public :: eval_gij_aux => hmap_axisNB_eval_gij_aux
procedure, public :: eval_gij_dq => hmap_axisNB_eval_gij_dq
procedure, public :: eval_gij_dq_aux => hmap_axisNB_eval_gij_dq_aux
procedure, public :: get_dx_dqi => hmap_axisNB_get_dx_dqi
procedure, public :: get_dx_dqi_aux => hmap_axisNB_get_dx_dqi_aux
procedure, public :: get_ddx_dqij => hmap_axisNB_get_ddx_dqij
procedure, public :: get_ddx_dqij_aux => hmap_axisNB_get_ddx_dqij_aux
procedure, public :: eval_TNB => hmap_axisNB_eval_TNB_hat

Functions

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

Read more…

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

public function hmap_axisNB_init_aux(sf, zeta, do_2nd_der) result(xv)

initialize the aux variable

Arguments

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

self (hmap)

real(kind=wp), intent(in) :: zeta
logical, intent(in) :: do_2nd_der

compute second derivative and store second derivative terms

Return Value type(t_hmap_axisNB_auxvar)

auxiliary variable

public function rodrigues(pos, angle) result(pos_rot)

Rodrigues' rotation formula assumption for now is that the origin is fixed at rot_origin=(/0.,0.,0./) and the rotation axis is fixed at rot_axis=(/0.,0.,1./)

Arguments

Type IntentOptional Attributes Name
real(kind=wp) :: pos(3)
real(kind=wp) :: angle

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

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)

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)

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)

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)

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)

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)

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)

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)

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)

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)

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)

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)


Subroutines

public subroutine hmap_axisNB_free(sf)

finalize the type hmap_axisNB

Arguments

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

self

public subroutine ReadNETCDF(sf)

READ axis from netcdf file, needs netcdf library! ======= HEADER OF THE NETCDF FILE VERSION 3.1 =================================================================================== === FILE DESCRIPTION: * axis, normal and binormal of the frame are given in cartesian coordinates along the curve parameter zeta [0,2pi]. * The curve is allowed to have a field periodicity NFP, but the curve must be provided on a full turn. * The adata is given in real space, sampled along equidistant zeta point positions: zeta(i)=(i+0.5)/nzeta * (2pi/NFP), i=0,...,nzeta-1 always shifted by (2pi/NFP) for the next field period. Thus the number of points along the axis for a full turn is NFP*nzeta * definition of the axis-following frame in cartesian coordinates ( boundary surface at rho=1):

Read more…

Arguments

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

self

public subroutine allocate_readin_vars(sf)

Arguments

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

public subroutine CheckFieldPeriodicity(sf, sgn_rot, error_nfp)

Check that the TNB frame really has the field periodicity of NFP: assumption for now is that the origin is fixed at rot_origin=(/0.,0.,0./) and the rotation axis is fixed at rot_axis=(/0.,0.,1./) sign of the rotation 'sgn_rot' is now accounted for in the transformation to xhat, so it has to be passed here.

Arguments

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

sign of rotation

integer, intent(out) :: error_nfp

public subroutine Visu_axisNB(sf, nvisu)

Write evaluation of the axis and signed axisNB frame to file

Arguments

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

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

public pure subroutine hmap_axisNB_eval_all_e(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 quantities at one given point (elemental)

Arguments

Type IntentOptional Attributes Name
type(t_hmap_axisNB_auxvar), intent(in) :: xv

precomputed auxiliary variables

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

solution variables q1,q2

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

solution variables q1,q2

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

theta derivative of solution variables q1,q2

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

theta derivative of solution variables q1,q2

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

zeta derivative of solution variables q1,q2

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

zeta derivative of solution variables q1,q2

real(kind=wp), intent(out) :: Jh

Jac,1/Jac,g_{ab} with a=theta/zeta b=theta/zeta

real(kind=wp), intent(out) :: g_tt

Jac,1/Jac,g_{ab} with a=theta/zeta b=theta/zeta

real(kind=wp), intent(out) :: g_tz

Jac,1/Jac,g_{ab} with a=theta/zeta b=theta/zeta

real(kind=wp), intent(out) :: g_zz

Jac,1/Jac,g_{ab} with a=theta/zeta b=theta/zeta

real(kind=wp), intent(out) :: Jh_dq1

and their variation vs q1

real(kind=wp), intent(out) :: g_tt_dq1

and their variation vs q1

real(kind=wp), intent(out) :: g_tz_dq1

and their variation vs q1

real(kind=wp), intent(out) :: g_zz_dq1

and their variation vs q1

real(kind=wp), intent(out) :: Jh_dq2

and their variation vs q2

real(kind=wp), intent(out) :: g_tt_dq2

and their variation vs q2

real(kind=wp), intent(out) :: g_tz_dq2

and their variation vs q2

real(kind=wp), intent(out) :: g_zz_dq2

and their variation vs q2

real(kind=wp), intent(out) :: g_t1

dq^{i}/dthetaG^{i1}, dq^{i}/dthetaG^{i2}, and dq^{i}/dzetaG^{i1}, dq^{i}/dzetaG^{i2} and G^{11},G^{22}

real(kind=wp), intent(out) :: g_t2

dq^{i}/dthetaG^{i1}, dq^{i}/dthetaG^{i2}, and dq^{i}/dzetaG^{i1}, dq^{i}/dzetaG^{i2} and G^{11},G^{22}

real(kind=wp), intent(out) :: g_z1

dq^{i}/dthetaG^{i1}, dq^{i}/dthetaG^{i2}, and dq^{i}/dzetaG^{i1}, dq^{i}/dzetaG^{i2} and G^{11},G^{22}

real(kind=wp), intent(out) :: g_z2

dq^{i}/dthetaG^{i1}, dq^{i}/dthetaG^{i2}, and dq^{i}/dzetaG^{i1}, dq^{i}/dzetaG^{i2} and G^{11},G^{22}

real(kind=wp), intent(out) :: Gh11

dq^{i}/dthetaG^{i1}, dq^{i}/dthetaG^{i2}, and dq^{i}/dzetaG^{i1}, dq^{i}/dzetaG^{i2} and G^{11},G^{22}

real(kind=wp), intent(out) :: Gh22

dq^{i}/dthetaG^{i1}, dq^{i}/dthetaG^{i2}, and dq^{i}/dzetaG^{i1}, dq^{i}/dzetaG^{i2} and G^{11},G^{22}

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

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

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

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

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'')

public subroutine hmap_axisNB_test(sf)

test hmap_axisNB - evaluation of the map

Read more…

Arguments

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

self