MODgvec_hmap_frenet Module

Module ** hmap_frenet **

This map uses the Frenet frame of a given periodic input curve X0(zeta) along the curve parameter zeta in [0,2pi]. It uses the signed orthonormal Frenet-Serret frame (TNB frame) that can be computed from derivatives of X0 in zeta. h: X_0(\zeta) + q_1 \sigma N(\zeta) + q_2 \sigma B(\zeta) with a sign switching function \sigma(\zeta), that accounts for points of zero curvature. the tangent is T=X_0' / |X_0'|, the bi-normal is B= (X_0' x X_0'') / |X_0' x X_0''|, and the normal N= B X T Derivatives use the Frenet-Serret formulas:

dT/dl = k N dN/dl = -kappa T + tau B dB/dl = -tau N

With l(\zeta) being the arc-length, and l' = |X_0'|. the curvature is kappa= |X_0' x X_0''| / (l')^3, and the torsion tau= (X_0' x X_0'').X_0''' / |X_0' x X_0''|^2

As a first representation of the curve X0(\zeta), we choose zeta to be the geometric toroidal angle zeta=phi, such that R0(zeta)cos(zeta) X0(zeta)=( R0(zeta)sin(zeta) ) Z0(zeta) and both R0,Z0 are represented as a real Fourier series with modes 0... n_max and number of Field periods Nfp R0(zeta) = sum_{n=0}^{n_{max}} rc(n)cos(nNfpzeta) + rs(n)sin(nNfpzeta)


Uses

  • module~~modgvec_hmap_frenet~~UsesGraph module~modgvec_hmap_frenet MODgvec_hmap_frenet module~modgvec_c_hmap MODgvec_c_hmap module~modgvec_hmap_frenet->module~modgvec_c_hmap module~modgvec_globals MODgvec_Globals module~modgvec_hmap_frenet->module~modgvec_globals module~modgvec_c_hmap->module~modgvec_globals iso_fortran_env iso_fortran_env module~modgvec_globals->iso_fortran_env

Used by

  • module~~modgvec_hmap_frenet~~UsedByGraph module~modgvec_hmap_frenet MODgvec_hmap_frenet module~modgvec_hmap MODgvec_hmap module~modgvec_hmap->module~modgvec_hmap_frenet 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_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~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~initsolution InitSolution proc~initsolution->module~modgvec_mhd3d_vars proc~initsolutionmhd3d t_functional_mhd3d%InitSolutionMHD3D proc~initsolutionmhd3d->module~modgvec_mhd3d_vars proc~minimizemhd3d t_functional_mhd3d%MinimizeMHD3D proc~minimizemhd3d->module~modgvec_mhd3d_vars proc~minimizemhd3d_descent MinimizeMHD3D_descent proc~minimizemhd3d_descent->module~modgvec_mhd3d_vars proc~readstate ReadState proc~readstate->module~modgvec_mhd3d_vars proc~readstate->module~modgvec_readstate_vars proc~restartfromstate RestartFromState proc~restartfromstate->module~modgvec_mhd3d_vars proc~restartfromstate->module~modgvec_readstate_vars proc~rungvec rungvec proc~rungvec->module~modgvec_mhd3d_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_mhd3d_vars program~gvec_post->module~modgvec_readstate_vars

Variables

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

Interfaces

public interface t_hmap_frenet

  • public function hmap_frenet_init() result(sf)

    initialize the type hmap_frenet, reading from parameterfile and then call init_params

    Arguments

    None

    Return Value type(t_hmap_frenet)

    self

  • public function hmap_frenet_init_params(nfp, n_max, nvisu, Rc, Rs, Zc, Zs, omnig) result(sf)

    initialize the type hmap_frenet with number of elements

    Arguments

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

    number of field periods

    integer, intent(in) :: n_max

    maximum mode number of guiding curve

    integer, intent(in) :: nvisu

    number of visualization points per field period (-1: no visualization)

    real(kind=wp), intent(in) :: Rc(0:n_max)

    R cos(-n*zeta) modes of guiding curve, 0..n_max

    real(kind=wp), intent(in) :: Rs(0:n_max)

    R sin(-n*zeta) modes of guiding curve, 0..n_max

    real(kind=wp), intent(in) :: Zc(0:n_max)

    Z cos(-n*zeta) modes of guiding curve, 0..n_max

    real(kind=wp), intent(in) :: Zs(0:n_max)

    Z sin(-n*zeta) modes of guiding curve, 0..n_max

    logical, intent(in) :: omnig

    omnigeneity, gives sign function of Frenet frame. False: sigma=1, True: sigma=+1 for 0<=zeta<=pi/nfp, and -1 for pi/nfp<zeta<2pi

    Return Value type(t_hmap_frenet)

    self

public interface t_hmap_frenet_auxvar

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

    initialize the aux variable

    Arguments

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

    self

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


Derived Types

type, public, extends(c_hmap_auxvar) ::  t_hmap_frenet_auxvar

Store data that can be precomputed on a set ot zeta points depends on hmap_frenet, 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 :: lp
real(kind=wp), public :: kappa
real(kind=wp), public :: tau
real(kind=wp), public :: sigma
real(kind=wp), public :: lp_p
real(kind=wp), public :: kappa_p
real(kind=wp), public :: tau_p
real(kind=wp), public, DIMENSION(3) :: X0
real(kind=wp), public, DIMENSION(3) :: T
real(kind=wp), public, DIMENSION(3) :: N
real(kind=wp), public, DIMENSION(3) :: B

Constructor

public function hmap_frenet_init_aux (sf, zeta, do_2nd_der)

initialize the aux variable

type, public, extends(c_hmap) ::  t_hmap_frenet

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

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

input maximum mode number (without nfp), 0...n_max,

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

input cosine coefficients of R0 as array (0:n_max) of modes (0,1,...,n_max)*nfp

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

input sine coefficients of R0 as array (0:n_max) of modes (0,1,...,n_max)*nfp

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

input cosine coefficients of Z0 as array (0:n_max) of modes (0,1,...,n_max)*nfp

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

input sine coefficients of Z0 as array (0:n_max) of modes (0,1,...,n_max)*nfp

integer, public, ALLOCATABLE :: Xn(:)

array of mode numbers, local variable =(0,1,...,n_max)*nfp

logical, public :: omnig = .FALSE.

omnigenity. True: sign change of frame at pi/nfp , False: no sign change

Constructor

public function hmap_frenet_init ()

initialize the type hmap_frenet, reading from parameterfile and then call init_params

public function hmap_frenet_init_params (nfp, n_max, nvisu, Rc, Rs, Zc, Zs, omnig)

initialize the type hmap_frenet with number of elements

Finalizations Procedures

final :: hmap_frenet_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_frenet_eval_all
procedure, public :: eval => hmap_frenet_eval
procedure, public :: eval_aux => hmap_frenet_eval_aux
procedure, public :: eval_dxdq => hmap_frenet_eval_dxdq
procedure, public :: eval_dxdq_aux => hmap_frenet_eval_dxdq_aux
procedure, public :: eval_Jh => hmap_frenet_eval_Jh
procedure, public :: eval_Jh_aux => hmap_frenet_eval_Jh_aux
procedure, public :: eval_Jh_dq => hmap_frenet_eval_Jh_dq
procedure, public :: eval_Jh_dq_aux => hmap_frenet_eval_Jh_dq_aux
procedure, public :: eval_gij => hmap_frenet_eval_gij
procedure, public :: eval_gij_aux => hmap_frenet_eval_gij_aux
procedure, public :: eval_gij_dq => hmap_frenet_eval_gij_dq
procedure, public :: eval_gij_dq_aux => hmap_frenet_eval_gij_dq_aux
procedure, public :: get_dx_dqi => hmap_frenet_get_dx_dqi
procedure, public :: get_dx_dqi_aux => hmap_frenet_get_dx_dqi_aux
procedure, public :: get_ddx_dqij => hmap_frenet_get_ddx_dqij
procedure, public :: get_ddx_dqij_aux => hmap_frenet_get_ddx_dqij_aux
procedure, public :: eval_X0 => hmap_frenet_eval_X0_fromRZ
procedure, public :: sigma => hmap_frenet_sigma

Functions

public function hmap_frenet_init() result(sf)

initialize the type hmap_frenet, reading from parameterfile and then call init_params

Arguments

None

Return Value type(t_hmap_frenet)

self

public function hmap_frenet_init_params(nfp, n_max, nvisu, Rc, Rs, Zc, Zs, omnig) result(sf)

initialize the type hmap_frenet with number of elements

Arguments

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

number of field periods

integer, intent(in) :: n_max

maximum mode number of guiding curve

integer, intent(in) :: nvisu

number of visualization points per field period (-1: no visualization)

real(kind=wp), intent(in) :: Rc(0:n_max)

R cos(-n*zeta) modes of guiding curve, 0..n_max

real(kind=wp), intent(in) :: Rs(0:n_max)

R sin(-n*zeta) modes of guiding curve, 0..n_max

real(kind=wp), intent(in) :: Zc(0:n_max)

Z cos(-n*zeta) modes of guiding curve, 0..n_max

real(kind=wp), intent(in) :: Zs(0:n_max)

Z sin(-n*zeta) modes of guiding curve, 0..n_max

logical, intent(in) :: omnig

omnigeneity, gives sign function of Frenet frame. False: sigma=1, True: sigma=+1 for 0<=zeta<=pi/nfp, and -1 for pi/nfp<zeta<2pi

Return Value type(t_hmap_frenet)

self

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

initialize the aux variable

Arguments

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

self

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

public function hmap_frenet_sigma(sf, zeta) result(sigma)

sign function depending on zeta, if omnig=False, sigma=1 if omnig=True, sigma=+1 for 0<=zeta<=pi/nfp, and -1 for pi/nfp<zeta<2pi

Arguments

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

Return Value real(kind=wp)

public function hmap_frenet_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_frenet), intent(in) :: sf
real(kind=wp), intent(in) :: q_in(3)

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

public function hmap_frenet_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_frenet), 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_frenet_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_frenet), 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_frenet_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_frenet), 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_frenet_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_frenet), intent(in) :: sf
real(kind=wp), intent(in) :: q_in(3)

Return Value real(kind=wp)

public function hmap_frenet_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_frenet), 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_frenet_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_frenet), 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_frenet_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_frenet), 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_frenet_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 of ds and dtheta and 1 for dzeta

Arguments

Type IntentOptional Attributes Name
class(t_hmap_frenet), 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_frenet_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 of ds and dtheta and 1 for dzeta

Arguments

Type IntentOptional Attributes Name
class(t_hmap_frenet), 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_frenet_eval_gij_dq(sf, qL_in, q_G, qR_in, q_vec) result(g_ab_dq)

evaluate sum_k=1,3 q_vec^k * sum_ij (qL_i d/dq^k(G_ij(q_G)) qR_j) , k=1,2 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 of ds and dtheta and 1 for dzeta

Arguments

Type IntentOptional Attributes Name
class(t_hmap_frenet), 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_frenet_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_ij (qL_i d/dq^k(G_ij(q_G)) qR_j) , k=1,2 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 of ds and dtheta and 1 for dzeta

Read more…

Arguments

Type IntentOptional Attributes Name
class(t_hmap_frenet), 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_frenet_free(sf)

finalize the type hmap_frenet

Arguments

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

self

public subroutine checkZeroCurvature(sf)

Sample axis and check for zero (<1.e-12) curvature

Arguments

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

public subroutine VisuFrenet(sf, nvisu)

Write evaluation of the axis and signed frenet frame to file

Arguments

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

public subroutine hmap_frenet_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_frenet), 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_frenet_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_frenet_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_frenet_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_frenet), 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_frenet_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_frenet), 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_frenet_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_frenet), 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_frenet_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_frenet), 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 pure subroutine hmap_frenet_eval_X0_fromRZ(sf, zeta, X0, X0p, X0pp, X0ppp, X0p4)

evaluate curve X0(zeta), position and first three derivatives, from given R0,Z0 Fourier

Read more…

Arguments

Type IntentOptional Attributes Name
class(t_hmap_frenet), 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) :: X0p(1:3)

1st derivative in zeta

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

2nd derivative in zeta

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

3rd derivative in zeta

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

4th derivative in zeta

public pure subroutine eval_fourier1d(n_max, xn, xc, xs, zeta, x, xp, xpp, xppp, xp4)

evaluate 1d fourier series from given cos/sin coefficients and mode numbers xn SUM(xc(0:n_max)COS(xn(0:n_max)zeta)+xs(0:n_max)SIN(xn(0:n_max)zeta) evaluate all derivatives 1,2,3 alongside

Arguments

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

number of modes is n_max+1 (0...n_max)

integer, intent(in) :: xn(0:n_max)

array of mode numbers

real(kind=wp), intent(in) :: xc(0:n_max)

cosine coefficients

real(kind=wp), intent(in) :: xs(0:n_max)

sine coefficients

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

angular position [0,2pi]

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

value at zeta

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

1st derivative in zeta

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

2nd derivative in zeta

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

3rd derivative in zeta

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

4th derivative in zeta

public subroutine hmap_frenet_test(sf)

test hmap_frenet - evaluation of the map

Read more…

Arguments

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

self