hmap_frenet_eval_X0_fromRZ Subroutine

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

angle zeta=geometric toroidal angle phi=atan(y/x)

Type Bound

t_hmap_frenet

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


Calls

proc~~hmap_frenet_eval_x0_fromrz~~CallsGraph proc~hmap_frenet_eval_x0_fromrz t_hmap_frenet%hmap_frenet_eval_X0_fromRZ proc~eval_fourier1d eval_fourier1d proc~hmap_frenet_eval_x0_fromrz->proc~eval_fourier1d

Called by

proc~~hmap_frenet_eval_x0_fromrz~~CalledByGraph proc~hmap_frenet_eval_x0_fromrz t_hmap_frenet%hmap_frenet_eval_X0_fromRZ proc~checkzerocurvature checkZeroCurvature proc~checkzerocurvature->proc~hmap_frenet_eval_x0_fromrz proc~hmap_frenet_eval t_hmap_frenet%hmap_frenet_eval proc~hmap_frenet_eval->proc~hmap_frenet_eval_x0_fromrz proc~hmap_frenet_eval_dxdq t_hmap_frenet%hmap_frenet_eval_dxdq proc~hmap_frenet_eval_dxdq->proc~hmap_frenet_eval_x0_fromrz proc~hmap_frenet_eval_gij t_hmap_frenet%hmap_frenet_eval_gij proc~hmap_frenet_eval_gij->proc~hmap_frenet_eval_x0_fromrz proc~hmap_frenet_eval_gij_dq t_hmap_frenet%hmap_frenet_eval_gij_dq proc~hmap_frenet_eval_gij_dq->proc~hmap_frenet_eval_x0_fromrz proc~hmap_frenet_eval_jh t_hmap_frenet%hmap_frenet_eval_Jh proc~hmap_frenet_eval_jh->proc~hmap_frenet_eval_x0_fromrz proc~hmap_frenet_eval_jh_dq t_hmap_frenet%hmap_frenet_eval_Jh_dq proc~hmap_frenet_eval_jh_dq->proc~hmap_frenet_eval_x0_fromrz proc~hmap_frenet_get_ddx_dqij t_hmap_frenet%hmap_frenet_get_ddx_dqij proc~hmap_frenet_get_ddx_dqij->proc~hmap_frenet_eval_x0_fromrz proc~hmap_frenet_get_dx_dqi t_hmap_frenet%hmap_frenet_get_dx_dqi proc~hmap_frenet_get_dx_dqi->proc~hmap_frenet_eval_x0_fromrz proc~hmap_frenet_init_aux hmap_frenet_init_aux proc~hmap_frenet_init_aux->proc~hmap_frenet_eval_x0_fromrz proc~visufrenet VisuFrenet proc~visufrenet->proc~hmap_frenet_eval_x0_fromrz interface~t_hmap_frenet_auxvar t_hmap_frenet_auxvar interface~t_hmap_frenet_auxvar->proc~hmap_frenet_init_aux proc~hmap_frenet_init_params hmap_frenet_init_params proc~hmap_frenet_init_params->proc~checkzerocurvature proc~hmap_frenet_init_params->proc~visufrenet proc~hmap_frenet_test hmap_frenet_test proc~hmap_frenet_init_params->proc~hmap_frenet_test proc~hmap_frenet_test->proc~hmap_frenet_eval proc~hmap_frenet_test->proc~hmap_frenet_eval_dxdq proc~hmap_frenet_test->proc~hmap_frenet_eval_gij proc~hmap_frenet_test->proc~hmap_frenet_eval_gij_dq proc~hmap_frenet_test->proc~hmap_frenet_eval_jh proc~hmap_frenet_test->proc~hmap_frenet_eval_jh_dq proc~hmap_frenet_test->proc~hmap_frenet_get_ddx_dqij proc~hmap_frenet_test->proc~hmap_frenet_get_dx_dqi proc~hmap_frenet_test->proc~hmap_frenet_init_aux interface~t_hmap_frenet t_hmap_frenet interface~t_hmap_frenet->proc~hmap_frenet_init_params proc~hmap_frenet_init hmap_frenet_init interface~t_hmap_frenet->proc~hmap_frenet_init proc~hmap_frenet_init->proc~hmap_frenet_init_params

Source Code

PURE SUBROUTINE hmap_frenet_eval_X0_fromRZ( sf,zeta,X0,X0p,X0pp,X0ppp,X0p4)
! MODULES
IMPLICIT NONE
!-----------------------------------------------------------------------------------------------------------------------------------
! INPUT VARIABLES
  CLASS(t_hmap_frenet), INTENT(IN ) :: sf
  REAL(wp)            , INTENT(IN ) :: zeta       !! position along closed curve parametrized in [0,2pi]
!-----------------------------------------------------------------------------------------------------------------------------------
! OUTPUT VARIABLES
  REAL(wp)            , INTENT(OUT) :: X0(1:3)      !! curve position in cartesian coordinates
  REAL(wp)            , INTENT(OUT) :: X0p(1:3)     !! 1st derivative in zeta
  REAL(wp)            , INTENT(OUT) :: X0pp(1:3)    !! 2nd derivative in zeta
  REAL(wp)            , INTENT(OUT) :: X0ppp(1:3)   !! 3rd derivative in zeta
  REAL(wp)            , INTENT(OUT),OPTIONAL :: X0p4(1:3)  !! 4th derivative in zeta
!-----------------------------------------------------------------------------------------------------------------------------------
! LOCAL VARIABLES
  REAL(wp) :: R0,R0p,R0pp,R0ppp,R0p4,Z0p4
  REAL(wp) :: coszeta,sinzeta
!===================================================================================================================================
  CALL eval_fourier1d(sf%n_max,sf%Xn,sf%rc,sf%rs,zeta,R0,R0p,R0pp,R0ppp,R0p4)
  CALL eval_fourier1d(sf%n_max,sf%Xn,sf%zc,sf%zs,zeta,X0(3),X0p(3),X0pp(3),X0ppp(3),Z0p4) !=Z0,Z0p,Z0pp,Z0ppp
  coszeta=COS(zeta)
  sinzeta=SIN(zeta)
  ASSOCIATE(x   =>X0(1)   ,y   =>X0(2)   , &
            xp  =>X0p(1)  ,yp  =>X0p(2)  , &
            xpp =>X0pp(1) ,ypp =>X0pp(2) , &
            xppp=>X0ppp(1),yppp=>X0ppp(2))
    !! angle zeta=geometric toroidal angle phi=atan(y/x)
    x=R0*coszeta
    y=R0*sinzeta

    xp = R0p*coszeta  - R0*sinzeta
    yp = R0p*sinzeta  + R0*coszeta
    !xp  = R0p*coszeta  -y
    !yp  = R0p*sinzeta  +x

    xpp = R0pp*coszeta - 2*R0p*sinzeta - R0*coszeta
    ypp = R0pp*sinzeta + 2*R0p*coszeta - R0*sinzeta
    !xpp  = R0pp*coszeta -2.0_wp*yp + x
    !ypp  = R0pp*sinzeta +2.0_wp*xp + y

    xppp = R0ppp*coszeta - 3*R0pp*sinzeta - 3*R0p*coszeta + R0*sinzeta
    yppp = R0ppp*sinzeta + 3*R0pp*coszeta - 3*R0p*sinzeta - R0*coszeta
    !xppp  = R0ppp*coszeta +3.0_wp*(xp-ypp) + y
    !yppp  = R0ppp*sinzeta +3.0_wp*(yp+xpp) + x
  IF(PRESENT(X0p4))THEN
    X0p4(1)  = R0p4*coszeta - 4*R0ppp*sinzeta - 6*R0pp*coszeta  + 4*R0p*sinzeta + R0*coszeta
    X0p4(2)  = R0p4*sinzeta + 4*R0ppp*coszeta - 6*R0pp*sinzeta  - 4*R0p*coszeta + R0*sinzeta
    X0p4(3)  = Z0p4
  END IF
  END ASSOCIATE !x,y,xp,yp,...

END SUBROUTINE hmap_frenet_eval_X0_fromRZ