hmap_axisNB_eval_TNB_hat Subroutine

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

Type Bound

t_hmap_axisNB

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


Calls

proc~~hmap_axisnb_eval_tnb_hat~~CallsGraph proc~hmap_axisnb_eval_tnb_hat t_hmap_axisNB%hmap_axisNB_eval_TNB_hat __matvec_n __matvec_n proc~hmap_axisnb_eval_tnb_hat->__matvec_n proc~fbase_eval t_fBase%fBase_eval proc~hmap_axisnb_eval_tnb_hat->proc~fbase_eval proc~fbase_eval_xn t_fBase%fBase_eval_xn proc~fbase_eval->proc~fbase_eval_xn

Called by

proc~~hmap_axisnb_eval_tnb_hat~~CalledByGraph proc~hmap_axisnb_eval_tnb_hat t_hmap_axisNB%hmap_axisNB_eval_TNB_hat proc~checkfieldperiodicity CheckFieldPeriodicity proc~checkfieldperiodicity->proc~hmap_axisnb_eval_tnb_hat proc~hmap_axisnb_eval t_hmap_axisNB%hmap_axisNB_eval proc~hmap_axisnb_eval->proc~hmap_axisnb_eval_tnb_hat proc~hmap_axisnb_eval_dxdq t_hmap_axisNB%hmap_axisNB_eval_dxdq proc~hmap_axisnb_eval_dxdq->proc~hmap_axisnb_eval_tnb_hat proc~hmap_axisnb_eval_gij t_hmap_axisNB%hmap_axisNB_eval_gij proc~hmap_axisnb_eval_gij->proc~hmap_axisnb_eval_tnb_hat proc~hmap_axisnb_eval_gij_dq t_hmap_axisNB%hmap_axisNB_eval_gij_dq proc~hmap_axisnb_eval_gij_dq->proc~hmap_axisnb_eval_tnb_hat proc~hmap_axisnb_eval_jh t_hmap_axisNB%hmap_axisNB_eval_Jh proc~hmap_axisnb_eval_jh->proc~hmap_axisnb_eval_tnb_hat proc~hmap_axisnb_eval_jh_dq t_hmap_axisNB%hmap_axisNB_eval_Jh_dq proc~hmap_axisnb_eval_jh_dq->proc~hmap_axisnb_eval_tnb_hat proc~hmap_axisnb_get_ddx_dqij t_hmap_axisNB%hmap_axisNB_get_ddx_dqij proc~hmap_axisnb_get_ddx_dqij->proc~hmap_axisnb_eval_tnb_hat proc~hmap_axisnb_get_dx_dqi t_hmap_axisNB%hmap_axisNB_get_dx_dqi proc~hmap_axisnb_get_dx_dqi->proc~hmap_axisnb_eval_tnb_hat proc~hmap_axisnb_init_aux hmap_axisNB_init_aux proc~hmap_axisnb_init_aux->proc~hmap_axisnb_eval_tnb_hat proc~visu_axisnb Visu_axisNB proc~visu_axisnb->proc~hmap_axisnb_eval_tnb_hat interface~t_hmap_axisnb_auxvar t_hmap_axisNB_auxvar interface~t_hmap_axisnb_auxvar->proc~hmap_axisnb_init_aux proc~hmap_axisnb_init_params hmap_axisNB_init_params proc~hmap_axisnb_init_params->proc~checkfieldperiodicity proc~hmap_axisnb_init_params->proc~visu_axisnb proc~hmap_axisnb_test hmap_axisNB_test proc~hmap_axisnb_init_params->proc~hmap_axisnb_test proc~hmap_axisnb_test->proc~hmap_axisnb_eval proc~hmap_axisnb_test->proc~hmap_axisnb_eval_dxdq proc~hmap_axisnb_test->proc~hmap_axisnb_eval_gij proc~hmap_axisnb_test->proc~hmap_axisnb_eval_gij_dq proc~hmap_axisnb_test->proc~hmap_axisnb_eval_jh proc~hmap_axisnb_test->proc~hmap_axisnb_eval_jh_dq proc~hmap_axisnb_test->proc~hmap_axisnb_get_ddx_dqij proc~hmap_axisnb_test->proc~hmap_axisnb_get_dx_dqi proc~hmap_axisnb_test->proc~hmap_axisnb_init_aux interface~t_hmap_axisnb t_hmap_axisNB interface~t_hmap_axisnb->proc~hmap_axisnb_init_params proc~hmap_axisnb_init hmap_axisNB_init interface~t_hmap_axisnb->proc~hmap_axisnb_init proc~hmap_axisnb_init->proc~hmap_axisnb_init_params

Source Code

SUBROUTINE hmap_axisNB_eval_TNB_hat( sf,zeta,X0,T,N,B,Np,Bp,Tp,Npp,Bpp)
! MODULES
IMPLICIT NONE
!-----------------------------------------------------------------------------------------------------------------------------------
! INPUT VARIABLES
  CLASS(t_hmap_axisNB), 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) :: T(1:3)       !! tangent X0'
  REAL(wp)            , INTENT(OUT) :: N(1:3)       !! Normal
  REAL(wp)            , INTENT(OUT) :: B(1:3)       !! bi-Normal
  REAL(wp)            , INTENT(OUT) :: Np(1:3)      !! derivative of Normal in zeta (N')
  REAL(wp)            , INTENT(OUT) :: Bp(1:3)      !! derivative of bi-Normal in zeta  (B')
  REAL(wp)            , INTENT(OUT),OPTIONAL :: Tp(1:3)      !! derivative of tangent in zeta (X0'')
  REAL(wp)            , INTENT(OUT),OPTIONAL :: Npp(1:3)     !! 2nd derivative of Normal in zeta (N'')
  REAL(wp)            , INTENT(OUT),OPTIONAL :: Bpp(1:3)     !! 2nd derivative of bi-Normal in zeta  (B'')
!-----------------------------------------------------------------------------------------------------------------------------------
! LOCAL VARIABLES
  REAL(wp)                      :: base_x(sf%fb_hat%modes)
  REAL(wp)                      :: base_dxdz(sf%fb_hat%modes)
  REAL(wp)                      :: base_ddxdzz(sf%fb_hat%modes)
  REAL(wp)                      :: cosz,sinz
  REAL(wp),DIMENSION(3)         :: X0_hat,T_hat,N_hat,B_hat,Np_hat,Bp_hat,Tp_hat,Npp_hat,Bpp_hat
!===================================================================================================================================
  base_x     =sf%fb_hat%eval(           0   ,(/0.,zeta/))
  base_dxdz  =sf%fb_hat%eval(DERIV_ZETA     ,(/0.,zeta/))


  !hat coordinates (in one field period)
  __MATVEC_N(X0_hat ,sf%xyz_hat_modes( :,:),base_x)
  __MATVEC_N(N_hat  ,sf%Nxyz_hat_modes(:,:),base_x)
  __MATVEC_N(B_hat  ,sf%Bxyz_hat_modes(:,:),base_x)
  __MATVEC_N(T_hat  ,sf%xyz_hat_modes( :,:),base_dxdz)
  __MATVEC_N(Np_hat ,sf%Nxyz_hat_modes(:,:),base_dxdz)
  __MATVEC_N(Bp_hat ,sf%Bxyz_hat_modes(:,:),base_dxdz)
  IF(PRESENT(Tp).OR.PRESENT(Npp).OR.PRESENT(Bpp))THEN !second derivatives
    base_ddxdzz=sf%fb_hat%eval(DERIV_ZETA_ZETA,(/0.,zeta/))
    __MATVEC_N(Tp_hat ,sf%xyz_hat_modes( :,:),base_ddxdzz)
    __MATVEC_N(Npp_hat,sf%Nxyz_hat_modes(:,:),base_ddxdzz)
    __MATVEC_N(Bpp_hat,sf%Bxyz_hat_modes(:,:),base_ddxdzz)
  END IF

  ! apply transform to x,y,z: x=xhat*cos(zeta)-sgn*yhat*sin(zeta), y=yhat*cos(zeta)+xhat*sgn*sin(zeta), z=zhat
  ! sgn_rot was used in the transform from x to xhat, so it has to be used here as well!!
  cosz=COS(zeta); sinz=SIN(zeta)
  X0=(/X0_hat(1)*cosz - sf%sgn_rot*X0_hat(2)*sinz, &
       X0_hat(2)*cosz + sf%sgn_rot*X0_hat(1)*sinz , &
       X0_hat(3)/)
  !dX0/dzeta:
  T= (/(T_hat(1)-sf%sgn_rot*X0_hat(2))*cosz - (sf%sgn_rot*T_hat(2)+X0_hat(1))*sinz, &
       (T_hat(2)+sf%sgn_rot*X0_hat(1))*cosz + (sf%sgn_rot*T_hat(1)-X0_hat(2))*sinz, &
        T_hat(3)/)
  !transform N to x,y,z
  N=(/N_hat(1)*cosz - sf%sgn_rot*N_hat(2)*sinz, &
      N_hat(2)*cosz + sf%sgn_rot*N_hat(1)*sinz, &
      N_hat(3)/)
  !dN/dzeta:
  Np= (/(Np_hat(1)-sf%sgn_rot*N_hat(2))*cosz - (sf%sgn_rot*Np_hat(2)+N_hat(1))*sinz, &
        (Np_hat(2)+sf%sgn_rot*N_hat(1))*cosz + (sf%sgn_rot*Np_hat(1)-N_hat(2))*sinz  , &
         Np_hat(3)/)
  !transform B to x,y,z
  B=(/B_hat(1)*cosz - sf%sgn_rot*B_hat(2)*sinz, &
      B_hat(2)*cosz + sf%sgn_rot*B_hat(1)*sinz, &
      B_hat(3)/)
  !dB/dzeta:
  Bp= (/(Bp_hat(1)-sf%sgn_rot*B_hat(2))*cosz - (sf%sgn_rot*Bp_hat(2)+B_hat(1))*sinz, &
        (Bp_hat(2)+sf%sgn_rot*B_hat(1))*cosz + (sf%sgn_rot*Bp_hat(1)-B_hat(2))*sinz, &
         Bp_hat(3)/)
  IF(PRESENT(Tp))THEN
  !transform Tp to x,y,z
    Tp = (/(Tp_hat(1)-2*sf%sgn_rot*T_hat(2)-X0_hat(1))*cosz - (sf%sgn_rot*(Tp_hat(2)-X0_hat(2))+2*T_hat(1))*sinz, &
           (Tp_hat(2)+2*sf%sgn_rot*T_hat(1)-X0_hat(2))*cosz + (sf%sgn_rot*(Tp_hat(1)-X0_hat(1))-2*T_hat(2))*sinz , &
            Tp_hat(3)/)
  END IF
  IF(PRESENT(Npp))THEN
    !transform Npp to x,y,z
    Npp = (/(Npp_hat(1)-2*sf%sgn_rot*Np_hat(2)-N_hat(1))*cosz - (sf%sgn_rot*(Npp_hat(2)-N_hat(2))+2*Np_hat(1))*sinz, &
            (Npp_hat(2)+2*sf%sgn_rot*Np_hat(1)-N_hat(2))*cosz + (sf%sgn_rot*(Npp_hat(1)-N_hat(1))-2*Np_hat(2))*sinz , &
             Npp_hat(3)/)
  END IF
  IF(PRESENT(Bpp))THEN
    !transform Bpp to x,y,z
    Bpp = (/(Bpp_hat(1)-2*sf%sgn_rot*Bp_hat(2)-B_hat(1))*cosz - (sf%sgn_rot*(Bpp_hat(2)-B_hat(2))+2*Bp_hat(1))*sinz, &
            (Bpp_hat(2)+2*sf%sgn_rot*Bp_hat(1)-B_hat(2))*cosz + (sf%sgn_rot*(Bpp_hat(1)-B_hat(1))-2*Bp_hat(2))*sinz , &
             Bpp_hat(3)/)
  END IF

END SUBROUTINE hmap_axisNB_eval_TNB_hat