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.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(t_hmap_axisNB), | intent(in) | :: | sf | |||
| integer, | intent(in) | :: | sgn_rot |
sign of rotation |
||
| integer, | intent(out) | :: | error_nfp |
SUBROUTINE CheckFieldPeriodicity( sf ,sgn_rot,error_nfp) ! MODULES IMPLICIT NONE !----------------------------------------------------------------------------------------------------------------------------------- ! INPUT VARIABLES CLASS(t_hmap_axisNB), INTENT(IN) :: sf INTEGER, INTENT(in) :: sgn_rot !! sign of rotation !----------------------------------------------------------------------------------------------------------------------------------- ! OUTPUT VARIABLES INTEGER, INTENT(out) :: error_nfp !----------------------------------------------------------------------------------------------------------------------------------- ! LOCAL VARIABLES REAL(wp) :: dzeta_fp REAL(wp),DIMENSION(3) :: X0_a,T,N_a,B_a,Np,Bp REAL(wp),DIMENSION(3) :: X0_b,N_b,B_b INTEGER :: ifp,iz,error_x,error_n,error_b !=================================================================================================================================== error_nfp=0 dzeta_fp=TWOPI/REAL(sf%nfp,wp) CALL sf%eval_TNB(sf%zeta(1),X0_a,T,N_a,B_a,Np,Bp) CALL sf%eval_TNB(sf%zeta(1)+dzeta_fp,X0_b,T,N_b,B_b,Np,Bp) DO ifp=0,sf%nfp error_x=0 error_n=0 error_b=0 DO iz=1,sf%nzeta CALL sf%eval_TNB(sf%zeta(iz)+ ifp*dzeta_fp ,X0_a,T,N_a,B_a,Np,Bp) CALL sf%eval_TNB(sf%zeta(iz)+(ifp+1)*dzeta_fp,X0_b,T,N_b,B_b,Np,Bp) IF(.NOT.(SUM((X0_b - rodrigues(X0_a,sgn_rot*dzeta_fp))**2).LT.1.0e-12))THEN error_x=error_x+1 END IF IF(.NOT.(SUM((X0_b+N_b - rodrigues(X0_a+N_a,sgn_rot*dzeta_fp))**2).LT.1.0e-12))THEN error_n=error_n+1 END IF IF(.NOT.(SUM((X0_b+B_b - rodrigues(X0_a+B_a,sgn_rot*dzeta_fp))**2).LT.1.0e-12))THEN error_b=error_b+1 END IF END DO !iz IF(error_x.NE.0)THEN WRITE(UNIT_stdOut,*)'problem in CheckFieldPeriodicity: at least one pair of two axis points do not match at NFP' error_nfp=-10 IF(error_n.NE.0)THEN WRITE(UNIT_stdOut,*)'problem in CheckFieldPeriodicity: at least one pair of two normal vectors do not match at NFP' error_nfp=-20 ELSEIF(error_b.NE.0)THEN WRITE(UNIT_stdOut,*)'problem in CheckFieldPeriodicity: at least one pair of two bi-normal vectors do not match at NFP' error_nfp=-30 END IF END IF END DO !ifp END SUBROUTINE CheckFieldPeriodicity