get_CLA_gvec_to_jorek Subroutine

public subroutine get_CLA_gvec_to_jorek()

Uses

  • proc~~get_cla_gvec_to_jorek~~UsesGraph proc~get_cla_gvec_to_jorek get_CLA_gvec_to_jorek module~modgvec_cla MODgvec_cla proc~get_cla_gvec_to_jorek->module~modgvec_cla module~modgvec_gvec_to_jorek_vars MODgvec_gvec_to_jorek_Vars proc~get_cla_gvec_to_jorek->module~modgvec_gvec_to_jorek_vars module~modgvec_cla_kinds MODgvec_cla_kinds module~modgvec_cla->module~modgvec_cla_kinds module~modgvec_base MODgvec_base module~modgvec_gvec_to_jorek_vars->module~modgvec_base module~modgvec_fbase MODgvec_fBase module~modgvec_gvec_to_jorek_vars->module~modgvec_fbase module~modgvec_globals MODgvec_Globals module~modgvec_gvec_to_jorek_vars->module~modgvec_globals module~modgvec_base->module~modgvec_fbase module~modgvec_base->module~modgvec_globals module~modgvec_sbase MODgvec_sBase module~modgvec_base->module~modgvec_sbase module~modgvec_sgrid MODgvec_sGrid module~modgvec_base->module~modgvec_sgrid module~modgvec_fbase->module~modgvec_globals iso_fortran_env iso_fortran_env module~modgvec_globals->iso_fortran_env module~modgvec_sbase->module~modgvec_globals module~modgvec_sbase->module~modgvec_sgrid module~sll_m_bsplines sll_m_bsplines module~modgvec_sbase->module~sll_m_bsplines module~sll_m_spline_interpolator_1d sll_m_spline_interpolator_1d module~modgvec_sbase->module~sll_m_spline_interpolator_1d module~sll_m_spline_matrix sll_m_spline_matrix module~modgvec_sbase->module~sll_m_spline_matrix module~modgvec_sgrid->module~modgvec_globals module~sll_m_assert sll_m_assert module~sll_m_bsplines->module~sll_m_assert module~sll_m_bsplines_base sll_m_bsplines_base module~sll_m_bsplines->module~sll_m_bsplines_base module~sll_m_bsplines_non_uniform sll_m_bsplines_non_uniform module~sll_m_bsplines->module~sll_m_bsplines_non_uniform module~sll_m_bsplines_uniform sll_m_bsplines_uniform module~sll_m_bsplines->module~sll_m_bsplines_uniform module~sll_m_errors sll_m_errors module~sll_m_bsplines->module~sll_m_errors module~sll_m_working_precision sll_m_working_precision module~sll_m_bsplines->module~sll_m_working_precision module~sll_m_spline_interpolator_1d->module~sll_m_spline_matrix module~sll_m_spline_interpolator_1d->module~sll_m_assert module~sll_m_boundary_condition_descriptors sll_m_boundary_condition_descriptors module~sll_m_spline_interpolator_1d->module~sll_m_boundary_condition_descriptors module~sll_m_spline_interpolator_1d->module~sll_m_bsplines_base module~sll_m_spline_interpolator_1d->module~sll_m_errors module~sll_m_spline_1d sll_m_spline_1d module~sll_m_spline_interpolator_1d->module~sll_m_spline_1d module~sll_m_spline_interpolator_1d->module~sll_m_working_precision module~sll_m_spline_matrix->module~sll_m_errors module~sll_m_spline_matrix_banded sll_m_spline_matrix_banded module~sll_m_spline_matrix->module~sll_m_spline_matrix_banded module~sll_m_spline_matrix_base sll_m_spline_matrix_base module~sll_m_spline_matrix->module~sll_m_spline_matrix_base module~sll_m_spline_matrix_dense sll_m_spline_matrix_dense module~sll_m_spline_matrix->module~sll_m_spline_matrix_dense module~sll_m_spline_matrix->module~sll_m_working_precision module~sll_m_boundary_condition_descriptors->module~sll_m_working_precision module~sll_m_bsplines_base->module~sll_m_assert module~sll_m_bsplines_base->module~sll_m_working_precision module~sll_m_bsplines_non_uniform->module~sll_m_assert module~sll_m_bsplines_non_uniform->module~sll_m_bsplines_base module~sll_m_bsplines_non_uniform->module~sll_m_working_precision module~sll_m_bsplines_uniform->module~sll_m_assert module~sll_m_bsplines_uniform->module~sll_m_bsplines_base module~sll_m_bsplines_uniform->module~sll_m_errors module~sll_m_bsplines_uniform->module~sll_m_working_precision module~sll_m_errors->iso_fortran_env module~sll_m_spline_1d->module~sll_m_assert module~sll_m_spline_1d->module~sll_m_bsplines_base module~sll_m_spline_1d->module~sll_m_working_precision module~sll_m_spline_matrix_banded->iso_fortran_env module~sll_m_spline_matrix_banded->module~sll_m_assert module~sll_m_spline_matrix_banded->module~sll_m_errors module~sll_m_spline_matrix_banded->module~sll_m_spline_matrix_base module~sll_m_spline_matrix_banded->module~sll_m_working_precision module~sll_m_spline_matrix_base->module~sll_m_working_precision module~sll_m_spline_matrix_dense->iso_fortran_env module~sll_m_spline_matrix_dense->module~sll_m_assert module~sll_m_spline_matrix_dense->module~sll_m_errors module~sll_m_spline_matrix_dense->module~sll_m_spline_matrix_base module~sll_m_spline_matrix_dense->module~sll_m_working_precision

Get command line arguments

!!! CALL cla_get('-t',Nzeta_out)

Arguments

None

Calls

proc~~get_cla_gvec_to_jorek~~CallsGraph proc~get_cla_gvec_to_jorek get_CLA_gvec_to_jorek interface~cla_get cla_get proc~get_cla_gvec_to_jorek->interface~cla_get interface~cla_init cla_init proc~get_cla_gvec_to_jorek->interface~cla_init proc~cla_help cla_help proc~get_cla_gvec_to_jorek->proc~cla_help proc~cla_key_present cla_key_present proc~get_cla_gvec_to_jorek->proc~cla_key_present proc~cla_posarg_register cla_posarg_register proc~get_cla_gvec_to_jorek->proc~cla_posarg_register proc~cla_register cla_register proc~get_cla_gvec_to_jorek->proc~cla_register proc~cla_validate cla_validate proc~get_cla_gvec_to_jorek->proc~cla_validate proc~cla_get_char cla_get_char interface~cla_get->proc~cla_get_char proc~cla_get_float_r4 cla_get_float_r4 interface~cla_get->proc~cla_get_float_r4 proc~cla_get_float_r8 cla_get_float_r8 interface~cla_get->proc~cla_get_float_r8 proc~cla_get_int_i4 cla_get_int_i4 interface~cla_get->proc~cla_get_int_i4 proc~cla_get_int_i8 cla_get_int_i8 interface~cla_get->proc~cla_get_int_i8 proc~cla_get_logical cla_get_logical interface~cla_get->proc~cla_get_logical proc~cla_init_default cla_init_default interface~cla_init->proc~cla_init_default proc~cla_init_str cla_init_str interface~cla_init->proc~cla_init_str proc~cla_command_argument_count cla_command_argument_count proc~cla_key_present->proc~cla_command_argument_count proc~cla_fatal cla_fatal proc~cla_key_present->proc~cla_fatal proc~cla_get_command_argument cla_get_command_argument proc~cla_key_present->proc~cla_get_command_argument proc~cla_key_arg_match cla_key_arg_match proc~cla_key_present->proc~cla_key_arg_match proc~cla_show cla_show proc~cla_key_present->proc~cla_show proc~cla_posarg_register->proc~cla_fatal proc~cla_str_eq cla_str_eq proc~cla_posarg_register->proc~cla_str_eq proc~cla_register->proc~cla_fatal proc~cla_register->proc~cla_str_eq proc~cla_validate_info cla_validate_info proc~cla_validate->proc~cla_validate_info proc~cla_get_char->proc~cla_command_argument_count proc~cla_get_char->proc~cla_get_command_argument proc~cla_get_char->proc~cla_key_arg_match proc~cla_get_char->proc~cla_show proc~cla_get_char->proc~cla_str_eq proc~cla_get_float_r4->proc~cla_fatal proc~cla_get_float_r4->proc~cla_get_char proc~cla_get_float_r8->proc~cla_fatal proc~cla_get_float_r8->proc~cla_get_char proc~cla_get_int_i4->proc~cla_fatal proc~cla_get_int_i4->proc~cla_get_char proc~cla_get_int_i8->proc~cla_fatal proc~cla_get_int_i8->proc~cla_get_char proc~cla_get_logical->proc~cla_get_char proc~cla_key_arg_match->proc~cla_str_eq proc~cla_show->proc~cla_key_present proc~cla_show->proc~cla_get_char proc~cla_message cla_message proc~cla_show->proc~cla_message proc~cla_validate_info->proc~cla_help proc~cla_validate_info->proc~cla_command_argument_count proc~cla_validate_info->proc~cla_get_command_argument proc~cla_validate_info->proc~cla_key_arg_match proc~cla_validate_info->proc~cla_str_eq

Source Code

SUBROUTINE get_CLA_gvec_to_jorek()
! MODULES
USE MODgvec_cla
USE MODgvec_gvec_to_jorek_Vars, ONLY: gvecfileName,FileNameOut
USE MODgvec_gvec_to_jorek_Vars, ONLY: Ns_out,npfactor,s_max,factorField,Nthet_out,SFLcoord,cmdline, generate_test_data
IMPLICIT NONE
!-----------------------------------------------------------------------------------------------------------------------------------
! INPUT VARIABLES
!-----------------------------------------------------------------------------------------------------------------------------------
! OUTPUT VARIABLES
!-----------------------------------------------------------------------------------------------------------------------------------
! LOCAL VARIABLES
CHARACTER(LEN=STRLEN)   :: f_str
CHARACTER(LEN=24)       :: execname="convert_gvec_to_jorek"
LOGICAL                 :: commandFailed
CHARACTER(LEN=6),DIMENSION(0:2),PARAMETER :: SFLcoordName=(/" GVEC "," PEST ","BOOZER"/)
!===================================================================================================================================

  !USING CLAF90 module to get command line arguments!
  CALL cla_init()

  CALL cla_register('-r',  '--rpoints', &
       'Number of radial points in s=[0,1] for output [MANDATORY, >1]', cla_int,'2') !must be provided
  CALL cla_register('-n',  '--npfactor', &
       'Number of angular points, computed from max. mode numbers (=npfactor*mn_max_in) [DEFAULT = 4]',cla_int,'4')
  CALL cla_register('-p',  '--polpoints', &
       'Number of poloidal points, if specified overwrites factor*m_max  [OPTIONAL]',cla_int,'-1')
!  CALL cla_register('-t',  '--torpoints', &
!       'Number of toroidal points, if specified overwrites factor*n_max  [OPTIONAL]',cla_int,'-1')
  CALL cla_register('-s',  '--sflcoord', &
       'which angular coordinates to choose: =0: GVEC coord. (no SFL), =1: PEST SFL, =2: BOOZER SFL [DEFAULT = 0]', &
       cla_int,'0')
  CALL cla_register('-f',  '--factorfield', &
       'factor(real number) on max. mode numbers (mn_max_out=factorfield*mn_max_in) in output representation. [DEFAULT = 1.0]',&
             cla_float,'1.0')
  CALL cla_register('-x',  '--smax', &
       'radial range goes from [0,1]*smax, thats THE RADIAL LIKE COORDINATE.0 < smax<=1.0 [DEFAULT = 1.0]',&
             cla_float,'1.0')
  CALL cla_register('-g',  '--generate_test_data', &
       'determine whether test data is generated  [DEFAULT = FALSE]', cla_int,'.false.')
  !positional argument
  CALL cla_posarg_register('gvecfile.dat', &
       'Input filename of GVEC restart file [MANDATORY]',  cla_char,'xxx') !
  CALL cla_posarg_register('outfile.dat', &
       'Output filename  [OPTIONAL, DEFAULT: gvec2jorek_nameofgvecfile]',  cla_char,'yyy') !

  CALL cla_validate(execname)
  CALL cla_get('-r',NS_out)
  CALL cla_get('-n',npfactor)
  CALL cla_get('-p',Nthet_out)
!!!!!  CALL cla_get('-t',Nzeta_out)
  CALL cla_get('-s',SFLcoord)
  CALL cla_get('-f',factorField)
  CALL cla_get('-x',s_max)
  CALL cla_get('-g',generate_test_data)
  CALL cla_get('gvecfile.dat',f_str)
  gvecfilename=TRIM(f_str)
  CALL cla_get('outfile.dat',f_str)
  FileNameOut=TRIM(f_str)

  commandFailed=.FALSE.
  IF(.NOT.((cla_key_present('-r')).AND.(Ns_out.GE.2))) THEN
    IF (.not. generate_test_data) THEN
      IF(.NOT.commandFailed) CALL cla_help(execname)
      commandFailed=.TRUE.
      SWRITE(UNIT_StdOut,*) " ==> [-r,--rpoints] argument is MANDATORY and must be >1 !!!"
    END IF
  END IF
  IF((SFLcoord.LT.0).OR.(SFLcoord.GT.2)) THEN
    IF(.NOT.commandFailed) CALL cla_help(execname)
    commandFailed=.TRUE.
    SWRITE(UNIT_StdOut,*) " ==> [-s,--sflcoord] argument  must be 0,1,2 !!!"
  END IF
  IF((INDEX(gvecfilename,'xxx').NE.0))THEN
    IF(.NOT.commandFailed) CALL cla_help(execname)
    commandFailed=.TRUE.
    SWRITE(UNIT_StdOut,*) " ==> input gvec filename is MANDATORY must be specified as first positional argument!!!"
  END IF
  IF((INDEX(FileNameOut,'yyy').NE.0))THEN
    FileNameOut="gvec2jorek_"//TRIM(gvecfilename)
  END IF
  IF((s_max.GT.1.0_wp).OR.(s_max.LE.0.0_wp)) THEN
    commandFailed=.TRUE.
    SWRITE(UNIT_StdOut,*) " ==> input parameter smax must be 0.0<smax <=1.0!!!"
  END IF
  IF(commandFailed) STOP

  SWRITE(UNIT_stdOut,'(A)')     ' INPUT PARAMETERS:'
  SWRITE(UNIT_stdOut,'(A,I6)')  '  * Number of radial points        : ',Ns_out
  SWRITE(UNIT_stdOut,'(A,I4)')  '  * npfactor points from modes     : ',npfactor
  IF(Nthet_out.NE.-1) THEN
    SWRITE(UNIT_stdOut,'(A,I4)')'  * number of points in theta      : ',Nthet_out
  END IF
!  IF(Nzeta_out.NE.-1) THEN
!    SWRITE(UNIT_stdOut,'(A,I4)')'  * number of points in zeta       : ',Nzeta_out
!  END IF
  SWRITE(UNIT_stdOut,'(A,E11.4)')'  * factor for output modes        : ',factorField
  SWRITE(UNIT_stdOut,'(A,I4,A)')'  * SFL coordinates flag           : ',SFLcoord,' ( '//SFLcoordName(SFLcoord)//' )'
  SWRITE(UNIT_stdOut,'(A,A)')   '  * generate test data for JOREK   : ',MERGE(".false.",".true. ",generate_test_data)
  SWRITE(UNIT_stdOut,'(A,A)')   '  * GVEC input file                : ',TRIM(gvecfileName)
  SWRITE(UNIT_stdOut,'(A,A)')   '  * output file name               : ',TRIM(FileNameOut)
  SWRITE(UNIT_stdOut,fmt_sep)
  IF(SFLcoord.NE.0)THEN
    SWRITE(UNIT_StdOut,*) "SFLcoord=",SFLcoord,", but only GVEC coordinates (=0) is currently implemented!"
    STOP
  END IF

  CALL GET_COMMAND(cmdline)

END SUBROUTINE get_cla_gvec_to_jorek