PB3D  [2.45]
Ideal linear high-n MHD stability in 3-D
files_ops.f90
Go to the documentation of this file.
1 !------------------------------------------------------------------------------!
3 !------------------------------------------------------------------------------!
4 module files_ops
5 #include <PB3D_macros.h>
6  use str_utilities
7  use messages
8  use num_vars, only: dp, max_str_ln
9  implicit none
10  private
12  &opt_args
13 
14  ! user-specified arguments
15  integer :: numargs ! control the user-specified arguments
16  character(len=max_str_ln), allocatable :: command_arg(:) ! passeed command-line arguments
17 
18  ! options provided with command line
19  character(len=max_str_ln), allocatable :: opt_args(:)
20  integer, allocatable :: inc_args(:)
21 
22 contains
24  subroutine init_files()
26 
27  ! select according to program style
28  select case (prog_style)
29  case(1) ! PB3D
30  allocate(opt_args(25), inc_args(25))
31  opt_args = ''
32  inc_args = 0
33  opt_args(7) = '--no_guess'
34  opt_args(8) = '--jump_to_sol'
35  opt_args(9) = '--export_HEL'
36  opt_args(10) = '--plot_VMEC_modes'
37  opt_args(11) = '--invert_top_bottom_H'
38  opt_args(12) = '-st_pc_factor_shift_type'
39  opt_args(13) = '-st_pc_type'
40  opt_args(14) = '-st_pc_factor_mat_solver_package'
41  opt_args(15) = '-eps_type'
42  opt_args(16) = '-eps_monitor'
43  opt_args(17) = '-eps_tol'
44  opt_args(18) = '-eps_ncv'
45  opt_args(19) = '-eps_mpd'
46  opt_args(20) = '-eps_view'
47  opt_args(21) = '-st_type'
48  opt_args(22) = '-st_pc_type'
49  opt_args(23) = '-st_pc_factor_mat_solver_package'
50  opt_args(24) = '-log_view'
51  opt_args(25) = '-st_ksp_type'
52  inc_args(7:25) = [0,0,0,0,0,1,1,1,1,0,1,1,1,0,1,1,1,0,1]
53  case(2) ! POST
54  allocate(opt_args(8), inc_args(8))
55  opt_args = ''
56  opt_args(7) = '--swap_angles'
57  opt_args(8) = '--compare_tor_pos'
58  inc_args(7:8) = [0,2]
59  end select
60 
61  ! set common option arguments
62  ltest = .false. ! don't call the testing routines
63  lvl = 1
64  opt_args(1) = '-t'
65  opt_args(2) = '--test'
66  opt_args(3) = '--no_plots'
67  opt_args(4) = '--no_output'
68  opt_args(5) = '--do_execute_command_line'
69  opt_args(6) = '--mem_info'
70  inc_args(1:6) = [0,0,0,0,0,0]
71  end subroutine init_files
72 
78  integer function parse_args() result(ierr)
80 
81  character(*), parameter :: rout_name = 'parse_args'
82 
83  ! local variables
84  character(len=max_str_ln), allocatable :: open_error(:) ! message for incorrect usage
85  character(len=max_str_ln), allocatable :: open_help(:) ! message for help
86  integer :: iseq ! control the user-specified arguments
87  integer :: id ! dummy integer
88  character(len=max_str_ln) :: dum_str ! dummy string
89  integer :: min_args ! minimal nr. of arguments
90 
91  ! initialize ierr
92  ierr = 0
93 
94  ! Messages for the user
95  ! select according to program style
96  select case (prog_style)
97  case(1) ! PB3D
98  allocate(open_error(3))
99  allocate(open_help(6))
100  open_error(1) = "" ! incorrect usage
101  open_error(2) = "Usage: "//prog_name//&
102  &" USER_INPUT EQUILIBRIUM_INPUT [OPTIONS]"
103  open_error(3) = "Try './"//prog_name//" --help' or './"//&
104  &prog_name//" -h' for more information."
105  open_help(1) = open_error(2) ! help with usage
106  open_help(2) = ""
107  open_help(3) = " USER_INPUT input provided by the &
108  &user"
109  open_help(4) = " EQUILIBRIUM_INPUT output from VMEC or &
110  &HELENA, in .txt format"
111  open_help(5) = " [OPTIONS] (optional) &
112  &command-line options"
113  open_help(6) = ""
114  min_args = 2
115  case(2) ! POST
116  allocate(open_error(3))
117  allocate(open_help(6))
118  open_error(1) = "" ! incorrect usage
119  open_error(2) = "Usage: "//prog_name//&
120  &" USER_INPUT PB3D_OUTPUT [OPTIONS]"
121  open_error(3) = "Try './"//prog_name//" --help' or './"//&
122  &prog_name//" -h' for more information."
123  open_help(1) = open_error(2) ! help with usage
124  open_help(2) = ""
125  open_help(3) = " USER_INPUT input provided by the &
126  &user"
127  open_help(4) = " PB3D_OUTPUT output from PB3D code, &
128  &in .h5 format"
129  open_help(5) = " [OPTIONS] (optional) &
130  &command-line options"
131  open_help(6) = ""
132  min_args = 2
133  end select
134 
135  call writo("Parsing command line arguments")
136 
137  ! Find number of arguments and first argument
138  numargs = command_argument_count()
139  dum_str = ''
140  if (numargs.gt.0) call getarg(1,dum_str)
141 
142  ! print error if no arguments
143  if (dum_str.eq.'-h' .or. dum_str.eq.'--help') then
144  do id = 1,size(open_help)
145  call writo(open_help(id))
146  end do
147  ierr = 66 ! silent stop
148  chckerr('')
149  else if (numargs.lt.min_args) then
150  do id = 1,size(open_error)
151  call writo(open_error(id))
152  end do
153  ierr = 66 ! silent stop
154  chckerr('')
155  else
156  allocate(command_arg(numargs))
157  command_arg = ""
158  command_arg(1) = dum_str
159  end if
160 
161  ! Get the rest of the arguments
162  do iseq = 2, numargs
163  call getarg(iseq, command_arg(iseq))
164  end do
165 
166  call writo("Command line arguments parsed")
167  end function parse_args
168 
177  integer function open_input() result(ierr)
183  use rich_vars, only: no_guess
184 #if ldebug
185  use num_vars, only: ltest
186 #endif
187 
188  character(*), parameter :: rout_name = 'open_input'
189 
190  ! local variables
191  integer :: id ! counter
192  character(len=max_str_ln) :: err_msg ! error message
193  integer :: first_int ! first input integer of input file (HELENA)
194  integer :: istat ! status
195  character(len=max_str_ln) :: file_ext ! file extension
196 
197  ! initialize ierr
198  ierr = 0
199 
200  if (rank.eq.0) then ! following only for master process
201  call writo("Opening files")
202  call lvl_ud(1)
203 
204  ! select depending on program style
205  select case (prog_style)
206  case(1) ! PB3D
207  ! check for correct input file and use default if needed
208  input_name = command_arg(1) ! first argument is the name of the input file
209  open(unit=input_i,file=input_name,status='old',iostat=istat)
210  if (istat.eq.0) then
211  call writo('Input file "' // trim(input_name) &
212  &// '" opened')
213  else
214  call writo('No input file found. Default used')
215  input_name = ''
216  end if
217 
218  ! check for equilibrium file and print error if not found
219  ! (no default!)
220  eq_name = command_arg(2)
221  open(unit=eq_i,file=eq_name,status='old',iostat=ierr)
222  err_msg = 'No equilibrium file found.'
223  chckerr(err_msg)
224 
225  ! succeeded
226  call writo('equilibrium file "' // trim(eq_name) &
227  &// '" opened')
228 
229  ! Determine which equilibrium style (1: VMEC, 2: HELENA)
230  ! set eq_style to a nonsensical value
231  eq_style = -1
232 
233  ! Check for VMEC
234  file_ext = ''
235  do id = len(eq_name)-1,1,-1
236  if (eq_name(id:id).eq.'.') then
237  file_ext = eq_name(id+1:len(eq_name))
238  exit
239  end if
240  end do
241  if (trim(file_ext).eq.'nc') then
242  eq_style = 1
243  end if
244 
245  ! Check for HELENA
246  read(eq_i,*,iostat=istat) first_int
247  backspace(unit=eq_i) ! go back one line in the equilibrium file
248  if (istat.eq.0) then
249  eq_style = 2
250  end if
251 
252  ! Check if something was found
253  if (eq_style.lt.1 .or. eq_style.gt.2) then
254  ierr = 1
255  call writo('Unable to recognize type of input file')
256  call writo('If you are trying to open HELENA files, &
257  &you need to have a version that outputs the &
258  &variable IAS. See tutorial!')
259  chckerr('')
260  end if
261 
262  ! set PB3D output name
263  pb3d_name = prog_name//'_'//trim(output_name)//'.h5'
264  case(2) ! POST
265  ! check for correct input file and use default if needed
266  input_name = command_arg(1) ! first argument is the name of the input file
267  open(unit=input_i,file=input_name,status='old',iostat=istat)
268  if (istat.eq.0) then
269  call writo('Input file "' // trim(input_name) &
270  &// '" opened')
271  else
272  call writo('No input file found. Default used')
273  input_name = ''
274  end if
275 
276  ! check for PB3D_PB3D file and print error if not found (no
277  ! default!)
278  pb3d_name = command_arg(2)
279  open(unit=pb3d_i,file=pb3d_name,status='old',iostat=ierr)
280  err_msg = 'No PB3D file found.'
281  chckerr(err_msg)
282 
283  ! succeeded
284  call writo('PB3D output file "' // trim(pb3d_name) &
285  &// '" opened')
286  close(pb3d_i)
287  end select
288 
289  ! set options
290  if (numargs.gt.2) then ! options given
291  call writo('applying options')
292  call lvl_ud(1)
293  call read_opts
294  call lvl_ud(-1)
295  end if
296  call lvl_ud(-1)
297  call writo('Files opened')
298  end if
299  contains
300  ! this subroutine scans for chosen options
302  subroutine read_opts
303 #if ( lwith_intel && !lwith_gnu)
304  use ifport
305 #endif
306  integer :: jd
307  integer :: numopts
308  logical :: opt_taken(size(opt_args)) ! which of the options has been taken
309  logical :: opt_found
310 
311  ! set number of options still to be processed, no option taken yet
312  numopts = size(opt_args)
313  opt_taken = .false.
314  opt_found = .false.
315 
316  id = 3 ! start at third command argument
317  do while (id.le.numargs) ! try the remaining possible options
318  jd = 1
319  do while (jd.le.numopts .and. .not.opt_found) ! try all the options
320  if (trim(command_arg(id)).eq.trim(opt_args(jd))) then ! option found
321  opt_found = .true.
322  if (opt_taken(jd)) then ! option already taken
323  call writo('Option "'//trim(command_arg(id))//&
324  &'" already set, ignoring...',warning=.true.)
325  else ! option not yet taken
326  select case(jd)
327  ! common options 1..6
328  case (1,2) ! option test
329 #if ldebug
330  call writo('option test chosen')
331  ltest = .true.
332 #else
333  call writo('option test not available. &
334  &Recompile with cpp flag &
335  &''ldebug''...',warning=.true.)
336 #endif
337  case (3) ! disable plotting
338  call writo('option no_plots chosen: &
339  &plotting disabled')
340  no_plots = .true.
341  case (4) ! disable messages
342  call writo('option no_output chosen: &
343  &messages disabled')
344  no_output = .true.
345  case (5) ! disable execute_command_line
346  call writo('option do_execute_command_line &
347  &chosen: execute_command_line enabled')
348  do_execute_command_line = .true.
349  case (6) ! disable execute_command_line
350 #if ldebug
351  call writo('option mem_info chosen: &
352  &memory usage is printed')
353  call lvl_ud(1)
354  call writo('The PID of this process is: '//&
355  &trim(i2str(getpid())))
356  print_mem_usage = .true.
357  call lvl_ud(-1)
358 #else
359  call writo('option mem_info is only &
360  &available when compiled with &
361  &"ldebug"',warning=.true.)
362 #endif
363  ! specific options for each program style
364  case default
365  select case (prog_style)
366  case(1) ! PB3D
367  call apply_opt_pb3d(jd,id)
368  case(2) ! POST
369  call apply_opt_post(jd,id)
370  end select
371  end select
372  opt_taken(jd) = .true.
373  end if
374  id = id + inc_args(jd) ! skip a number of next arguments
375  end if
376  jd = jd + 1
377  ! FIND THE INCREMENT WITH BELOW FUNCTION
378  end do
379  if (.not.opt_found) then
380  call writo('Option "'//trim(command_arg(id))//'" invalid',&
381  &warning=.true.)
382  end if
383  id = id + 1
384  opt_found = .false.
385  end do
386  end subroutine read_opts
387 
388  ! apply chosen options for PB3D
390  subroutine apply_opt_pb3d(opt_nr,arg_nr) ! PB3D version
391  use num_vars, only: n_procs
392 
393  ! input / output
394  integer, intent(in) :: opt_nr ! option number
395  integer, intent(in) :: arg_nr ! argument number
396 
397  ! local variables
398  integer :: id ! counter
399  character(len=max_str_ln) :: opt_str ! string with option information
400 
401  select case(opt_nr)
402  case (7) ! disable guessing Eigenfunction from previous Richardson level
403  call writo('option no_guess chosen: Eigenfunction not &
404  &guessed from previous Richardson level')
405  no_guess = .true.
406  case (8) ! skip calculating perturbation variables
407  call writo('option jump_to_sol chosen: Skip all possible &
408  &equilibrium and perturbation drivers for first &
409  &Richardson level')
410  jump_to_sol = .true.
411  case (9) ! export HELENA
412  if (eq_style.eq.2) then
413  if (n_procs.eq.1) then
414  call writo('option export_HEL chosen: Exporting to &
415  &VMEC')
416  export_hel = .true.
417  else
418  call writo('Can only use export_HEL with 1 &
419  &process',warning=.true.)
420  export_hel = .false.
421  end if
422  else
423  call writo('Can only use export_HEL with HELENA',&
424  &warning=.true.)
425  export_hel = .false.
426  end if
427  case (10) ! output VMEC modes
428  if (eq_style.eq.1) then
429  call writo('option plot_VMEC_modes chosen: Plotting &
430  &(decay of) modes')
431  plot_vmec_modes = .true.
432  else
433  call writo('Can only output VMEC modes with VMEC',&
434  &warning=.true.)
435  plot_vmec_modes = .false.
436  end if
437  case (11) ! invert top and bottom for HELENA
438 #if ldebug
439  if (eq_style.eq.2) then
440  call writo('option invert_top_bottom_H chosen: &
441  &inverting top and bottom of equilibrium')
442  invert_top_bottom_h = .true.
443  else
444  call writo('Can only invert top and bottom for HELENA',&
445  &warning=.true.)
446  invert_top_bottom_h = .false.
447  end if
448 #else
449  call writo('Can only invert top and bottom for HELENA in &
450  &debug mode',warning=.true.)
451  invert_top_bottom_h = .false.
452 #endif
453  case (12:25)
454  opt_str = ''
455  do id = 1,inc_args(opt_nr)
456  opt_str = trim(opt_str)//' '//&
457  &trim(command_arg(arg_nr+id))
458  end do
459  call writo('option "'//trim(opt_args(opt_nr))//&
460  &trim(opt_str)//'" passed to SLEPC')
461  case default
462  call writo('Invalid option number',warning=.true.)
463  end select
464  end subroutine apply_opt_pb3d
465 
466  ! apply chosen options for POST
468  subroutine apply_opt_post(opt_nr,arg_nr) ! POST version
469  use num_vars, only: rz_0
470 
471  ! input / output
472  integer, intent(in) :: opt_nr ! option number
473  integer, intent(in) :: arg_nr ! argument number
474 
475  ! local variables
476  integer :: id ! counter
477 
478  select case(opt_nr)
479  case (7) ! disable guessing Eigenfunction from previous Richardson level
480  call writo('option swap_angles chosen: theta and zeta are &
481  &swapped in plots')
482  swap_angles = .true.
483  case (8) ! disable guessing Eigenfunction from previous Richardson level
484  call writo('option compare_tor_pos chosen: Comparing &
485  &B, J and kappa at different toroidal positions')
486  call lvl_ud(1)
487  compare_tor_pos = .true.
488  do id = 1,inc_args(opt_nr)
489  if (arg_nr+id.gt.size(command_arg)) then
490  ierr = 1
491  else
492  read(command_arg(arg_nr+id),*,iostat=ierr) rz_0(id)
493  end if
494  if (ierr.ne.0) then
495  call writo('Did you provide an origin for the &
496  &geometrical poloidal angle in the form')
497  call writo('"--compare_tor_pos R_0, Z_0"?')
498  end if
499  chckerr('failed to read RZ_0')
500  end do
501  call writo('Origin for geometrical poloidal angle: ('//&
502  &trim(r2str(rz_0(1)))//','//trim(r2str(rz_0(2)))//')')
503  call lvl_ud(-1)
504  case default
505  call writo('Invalid option number',warning=.true.)
506  end select
507  end subroutine apply_opt_post
508  end function open_input
509 
528  integer function open_output() result(ierr)
532  use hdf5_ops, only: create_output_hdf5
534 #if ldebug
536 #endif
537 #if ( lwith_intel && !lwith_gnu)
538  use ifport
539 #endif
540 
541  character(*), parameter :: rout_name = 'open_output'
542 
543  ! local variables (also used in child functions)
544  integer :: id ! counter
545  integer :: istat ! status
546  logical :: file_exists ! whether file exists
547  logical :: group_exists ! whether probed group exists
548  character(len=max_str_ln) :: full_output_name ! full name
549  character(len=max_str_ln) :: err_msg ! error message
550 
551  ! initialize ierr
552  ierr = 0
553 
554  ! user output
555  call writo('Attempting to open output files')
556  call lvl_ud(1)
557 
558  ! 1. LOG OUTPUT
559 
560  ! append extension to output name
561  full_output_name = prog_name//'_'//trim(output_name)//'.txt'
562 
563  ! actions depending on Richardson restart level and program style
564  if (rich_restart_lvl.gt.1 .and. prog_style.eq.1) then ! PB3D restart
565  ! append to existing file
566  open(output_i,file=trim(full_output_name),status='old',&
567  &position='append',iostat=ierr)
568  chckerr('Failed to open output file')
569 
570  ! print message
571  call writo('log output file "'//trim(full_output_name)//&
572  &'" reopened at number '//trim(i2str(output_i)))
573  else ! POST or PB3D no restart
574  ! open file after wiping it
575  open(output_i,file=trim(full_output_name),status='replace',&
576  &iostat=ierr)
577  chckerr('Failed to open output file')
578 
579  ! print message
580  call writo('log output file "'//trim(full_output_name)//&
581  &'" opened at number '//trim(i2str(output_i)))
582  end if
583 
584  ! if temporary output present, silently write it to log output file
585  do id = 1,size(temp_output)
586  write(output_i,'(A)',iostat=istat) trim(temp_output(id))
587  end do
588 
589  ! 2. SHELL COMMANDS
590 
591  ! recycle full_output_name for shell_commands file
592  full_output_name = prog_name//'_'//trim(shell_commands_name)//'.sh'
593 
594  ! create output file for shell commands
595  open(unit=shell_commands_i,file=trim(full_output_name),&
596  &status='replace',iostat=ierr)
597  chckerr('Failed to create shell command file')
598 
599  ! write header, close and make executable
600  write(shell_commands_i,'(A)',iostat=istat) '#!/bin/bash'
601  write(shell_commands_i,'(A)',iostat=istat) '# This file contains all &
602  &the shell commands from the '//trim(prog_name)//' run'
603  close(shell_commands_i)
604  istat = 0
605 #if ( lwith_intel && !lwith_gnu)
606  istat = system('chmod +x '//trim(full_output_name))
607 #else
608  call execute_command_line('chmod +x '//trim(full_output_name),&
609  &exitstat=istat) ! not too terrible if execute_command_line fails
610 #endif
611 
612  ! print message
613  call writo('shell commands script file "'//trim(full_output_name)//&
614  &'" created')
615 
616  ! 3. PROGRAM SPECIFIC
617 
618  ! specific actions for program styles
619  select case (prog_style)
620  case (1) ! PB3D
621  ! set up whether group exists
622  inquire(file=pb3d_name,exist=file_exists,iostat=ierr)
623  chckerr('Failed to inquire about file')
624  if (file_exists) then
625  ierr = probe_hdf5_group(pb3d_name,'X_2_int_R_'//&
626  &trim(i2str(rich_restart_lvl)),group_exists)
627  chckerr('')
628  else
629  group_exists = .false.
630  end if
631 
632  if (jump_to_sol) then
633  if (.not.group_exists) then
634  ierr = 1
635  call writo('No integrated tensorial perturbation &
636  &quantitites found to jump over',alert=.true.)
637  err_msg = 'These quantitites need to be set up'
638  chckerr(err_msg)
639  end if
640  else
641  ! give warning
642  if (group_exists) then
643  call writo('Integrated tensorial perturbation &
644  &quantitites were found for Richardson level '&
645  &//trim(i2str(rich_restart_lvl))//'.',&
646  &alert=.true.)
647  call lvl_ud(1)
648  call writo('Have you already calculated them and &
649  &are you re-running these simulations')
650  call writo('because you want to change the solution?')
651  call writo('If the solution method is the only &
652  &thing you are changing, you should')
653  call writo('consider using the command-line option &
654  &"--jump_to_sol"')
655  call lvl_ud(-1)
656  end if
657 
658  ! create HDF5 file for output if no restart
659  if (rich_restart_lvl.eq.1) then
660  ierr = create_output_hdf5(pb3d_name)
661  chckerr('')
662  end if
663  end if
664  case (2) ! POST
665  ! do nothing
666  end select
667 
668 #if ldebug
669  ! 4. MEMORY USAGE
670  if (print_mem_usage) then
671  ! recycle full_output_name for mem_usage file
672  full_output_name = prog_name//'_'//trim(mem_usage_name)//'.dat'
673 
674  ! create output file for memory usage
675  open(mem_usage_i,file=trim(full_output_name),status='replace',&
676  &iostat=ierr)
677  chckerr('Failed to open memory file')
678 
679  ! write header and close
680  write(mem_usage_i,'(A)',iostat=istat) '# Rank [] Count [] &
681  & Time [s] Mem. [kB] Max. tot. Memory [kB] &
682  &Max. X. Memory [kB]'
683  close(mem_usage_i)
684 
685  ! print message
686  call writo('memory usage data file "'//trim(full_output_name)//&
687  &'" created')
688  end if
689 #endif
690 
691  ! no more temporary output
692  temp_output_active = .false.
693 
694  ! deallocate temporary output if allocated
695  if (allocated(temp_output)) deallocate(temp_output)
696 
697  call lvl_ud(-1)
698  call writo('Output files opened')
699  end function open_output
700 
702  subroutine close_output()
705 
706  call writo('Closing output files')
707  call lvl_ud(1)
708  call writo('A log of the shell command is kept in the log file "'//&
709  &trim(prog_name)//'_'//trim(shell_commands_name)//'.sh"')
710  if (.not.do_execute_command_line) &
711  &call writo('Execute this script to do all the shell commands')
712  call lvl_ud(-1)
713  call writo('Output files closed')
714  call writo('')
715 
716  if (rank.eq.0) close(output_i)
717  end subroutine
718 end module files_ops
num_vars::swap_angles
logical, public swap_angles
swap angles theta and zeta in plots (only for POST)
Definition: num_vars.f90:150
num_vars::invert_top_bottom_h
logical, public invert_top_bottom_h
invert top and bottom for HELENA equilibria
Definition: num_vars.f90:144
num_vars::dp
integer, parameter, public dp
double precision
Definition: num_vars.f90:46
num_vars::input_i
integer, parameter, public input_i
file number of input file
Definition: num_vars.f90:182
num_vars
Numerical variables used by most other modules.
Definition: num_vars.f90:4
num_vars::input_name
character(len=max_str_ln), public input_name
will hold the full name of the input file
Definition: num_vars.f90:174
num_vars::max_str_ln
integer, parameter, public max_str_ln
maximum length of strings
Definition: num_vars.f90:50
files_ops::opt_args
character(len=max_str_ln), dimension(:), allocatable, public opt_args
optional arguments that can be passed using –[name]
Definition: files_ops.f90:19
rich_vars
Variables concerning Richardson extrapolation.
Definition: rich_vars.f90:4
str_utilities::i2str
elemental character(len=max_str_ln) function, public i2str(k)
Convert an integer to string.
Definition: str_utilities.f90:18
hdf5_ops
Operations on HDF5 and XDMF variables.
Definition: HDF5_ops.f90:27
num_vars::shell_commands_i
integer, parameter, public shell_commands_i
file number of shell commands file
Definition: num_vars.f90:186
num_vars::n_procs
integer, public n_procs
nr. of MPI processes
Definition: num_vars.f90:69
hdf5_utilities
Utilities pertaining to HDF5 and XDMF.
Definition: HDF5_utilities.f90:6
files_ops::open_input
integer function, public open_input()
Open the input files.
Definition: files_ops.f90:178
messages::lvl
integer, public lvl
determines the indenting. higher lvl = more indenting
Definition: messages.f90:20
str_utilities
Operations on strings.
Definition: str_utilities.f90:4
num_vars::prog_style
integer, public prog_style
program style (1: PB3D, 2: PB3D_POST)
Definition: num_vars.f90:53
num_vars::prog_name
character(len=4), public prog_name
name of program, used for info
Definition: num_vars.f90:54
hdf5_ops::create_output_hdf5
integer function, public create_output_hdf5(HDF5_name)
Creates an HDF5 output file.
Definition: HDF5_ops.f90:1075
num_vars::ltest
logical, public ltest
whether or not to call the testing routines
Definition: num_vars.f90:112
files_ops::parse_args
integer function, public parse_args()
Parses the command line arguments.
Definition: files_ops.f90:79
num_vars::shell_commands_name
character(len=14), parameter, public shell_commands_name
name of shell commands file
Definition: num_vars.f90:56
hdf5_utilities::probe_hdf5_group
integer function, public probe_hdf5_group(HDF5_name, group_name, group_exists)
Probe HDF5 file for group existence.
Definition: HDF5_utilities.f90:251
num_vars::compare_tor_pos
logical, public compare_tor_pos
compare quantities at toroidal positions (only for POST)
Definition: num_vars.f90:151
files_ops::init_files
subroutine, public init_files()
Initialize the variables for the module.
Definition: files_ops.f90:25
num_vars::rich_restart_lvl
integer, public rich_restart_lvl
starting Richardson level (0: none [default])
Definition: num_vars.f90:173
num_vars::export_hel
logical, public export_hel
export HELENA
Definition: num_vars.f90:142
num_vars::rz_0
real(dp), dimension(2), public rz_0
origin of geometrical poloidal coordinate
Definition: num_vars.f90:179
num_vars::print_mem_usage
logical, public print_mem_usage
print memory usage is printed
Definition: num_vars.f90:149
num_vars::mem_usage_i
integer, parameter, public mem_usage_i
file number of memory usage file
Definition: num_vars.f90:187
num_vars::eq_style
integer, public eq_style
either 1 (VMEC) or 2 (HELENA)
Definition: num_vars.f90:89
rich_vars::no_guess
logical, public no_guess
disable guessing Eigenfunction from previous level of Richardson
Definition: rich_vars.f90:24
num_vars::no_output
logical, public no_output
no output shown
Definition: num_vars.f90:145
messages::temp_output
character(len=max_str_ln), dimension(:), allocatable, public temp_output
temporary output, before output file is opened
Definition: messages.f90:27
str_utilities::r2str
elemental character(len=max_str_ln) function, public r2str(k)
Convert a real (double) to string.
Definition: str_utilities.f90:42
messages::writo
subroutine, public writo(input_str, persistent, error, warning, alert)
Write output to file identified by output_i.
Definition: messages.f90:275
messages
Numerical utilities related to giving output.
Definition: messages.f90:4
num_vars::plot_vmec_modes
logical, public plot_vmec_modes
plot VMEC modes
Definition: num_vars.f90:143
files_ops
Operations related to files !
Definition: files_ops.f90:4
num_vars::mem_usage_name
character(len=9), parameter, public mem_usage_name
name of memory usage file
Definition: num_vars.f90:57
num_vars::do_execute_command_line
logical, public do_execute_command_line
call "execute_command_line" inside program
Definition: num_vars.f90:148
num_vars::pb3d_name
character(len=max_str_ln), public pb3d_name
name of PB3D output file
Definition: num_vars.f90:139
num_vars::jump_to_sol
logical, public jump_to_sol
jump to solution
Definition: num_vars.f90:141
num_vars::eq_i
integer, parameter, public eq_i
file number of equilibrium file from VMEC or HELENA
Definition: num_vars.f90:183
messages::lvl_ud
subroutine, public lvl_ud(inc)
Increases/decreases lvl of output.
Definition: messages.f90:254
num_vars::no_plots
logical, public no_plots
no plots made
Definition: num_vars.f90:140
files_ops::close_output
subroutine, public close_output()
Closes the output file.
Definition: files_ops.f90:703
num_vars::pb3d_i
integer, parameter, public pb3d_i
file number of PB3D output file
Definition: num_vars.f90:184
num_vars::output_name
character(len=3), parameter, public output_name
name of output file
Definition: num_vars.f90:55
num_vars::rank
integer, public rank
MPI rank.
Definition: num_vars.f90:68
num_vars::output_i
integer, parameter, public output_i
file number of output file
Definition: num_vars.f90:185
messages::temp_output_active
logical, public temp_output_active
true if temporary output is to be written in temp_output
Definition: messages.f90:26
num_vars::eq_name
character(len=max_str_ln), public eq_name
name of equilibrium file from VMEC or HELENA
Definition: num_vars.f90:138
files_ops::open_output
integer function, public open_output()
Open the output files.
Definition: files_ops.f90:529