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