PB3D [2.47]
Ideal linear high-n MHD stability in 3-D
Loading...
Searching...
No Matches
files_ops.f90
Go to the documentation of this file.
1!------------------------------------------------------------------------------!
2!> Operations related to files !
3!------------------------------------------------------------------------------!
5#include <PB3D_macros.h>
7 use messages
8 use num_vars, only: dp, max_str_ln
9 implicit none
10 private
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(:) !< optional arguments that can be passed using <tt>--[name]</tt>
20 integer, allocatable :: inc_args(:) !< number of arguments for each optional argument
21
22contains
23 !> Initialize the variables for the module.
24 subroutine init_files()
25 use num_vars, only: ltest, prog_style
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
73 !> Parses the command line arguments.
74 !!
75 !! \note The input arguments are saved in \c command_arg
76 !!
77 !! \return ierr
78 integer function parse_args() result(ierr)
79 use num_vars, only: prog_style, prog_name
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
169 !> Open the input files.
170 !!
171 !! - input file with user options
172 !! - equilibrium file in
173 !! - NetCDF for VMEC
174 !! - plain for HELENA
175 !!
176 !! \return ierr
177 integer function open_input() result(ierr)
178 use num_vars, only: eq_i, input_i, rank, prog_style, no_plots, &
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
301 !> \private
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')
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
389 !> \private
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
467 !> \private
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
510 !> Open the output files
511 !!
512 !! - output file <tt>.txt</tt>
513 !! - shell commands file <tt>.sh</tt>
514 !! - HDF5 file: only for PB3D, not for POST.
515 !! - memory usage file <tt>.dat</tt>
516 !!
517 !! Also sets some output variables.
518 !!
519 !! \note
520 !! -# memory usage file is only for debug version.
521 !! -# There can be resart of a Richardson level for PB3D
522 !! -# There can also be a direct jump to the solution for PB3D, if the
523 !! equilibrium and perturbation phases are already done and saved (see
524 !! init_files()).
525 !! -# In the case of a Richardson restart, PB3D reopens the HDF5 file.
526 !!
527 !! \return ierr
528 integer function open_output() result(ierr)
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
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
701 !> Closes the output file.
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
718end module files_ops
Operations related to files !
Definition files_ops.f90:4
integer function, public parse_args()
Parses the command line arguments.
Definition files_ops.f90:79
character(len=max_str_ln), dimension(:), allocatable, public opt_args
optional arguments that can be passed using –[name]
Definition files_ops.f90:19
subroutine, public init_files()
Initialize the variables for the module.
Definition files_ops.f90:25
subroutine, public close_output()
Closes the output file.
integer function, public open_input()
Open the input files.
integer function, public open_output()
Open the output files.
Operations on HDF5 and XDMF variables.
Definition HDF5_ops.f90:27
integer function, public create_output_hdf5(hdf5_name)
Creates an HDF5 output file.
Utilities pertaining to HDF5 and XDMF.
integer function, public probe_hdf5_group(hdf5_name, group_name, group_exists)
Probe HDF5 file for group existence.
Numerical utilities related to giving output.
Definition messages.f90:4
character(len=max_str_ln), dimension(:), allocatable, public temp_output
temporary output, before output file is opened
Definition messages.f90:27
integer, public lvl
determines the indenting. higher lvl = more indenting
Definition messages.f90:20
subroutine, public lvl_ud(inc)
Increases/decreases lvl of output.
Definition messages.f90:254
subroutine, public writo(input_str, persistent, error, warning, alert)
Write output to file identified by output_i.
Definition messages.f90:275
logical, public temp_output_active
true if temporary output is to be written in temp_output
Definition messages.f90:26
Numerical variables used by most other modules.
Definition num_vars.f90:4
integer, parameter, public dp
double precision
Definition num_vars.f90:46
logical, public ltest
whether or not to call the testing routines
Definition num_vars.f90:112
character(len=3), parameter, public output_name
name of output file
Definition num_vars.f90:55
character(len=max_str_ln), public input_name
will hold the full name of the input file
Definition num_vars.f90:174
logical, public print_mem_usage
print memory usage is printed
Definition num_vars.f90:149
integer, parameter, public shell_commands_i
file number of shell commands file
Definition num_vars.f90:186
logical, public compare_tor_pos
compare quantities at toroidal positions (only for POST)
Definition num_vars.f90:151
logical, public no_output
no output shown
Definition num_vars.f90:145
integer, public n_procs
nr. of MPI processes
Definition num_vars.f90:69
character(len=max_str_ln), public eq_name
name of equilibrium file from VMEC or HELENA
Definition num_vars.f90:138
integer, parameter, public max_str_ln
maximum length of strings
Definition num_vars.f90:50
integer, public prog_style
program style (1: PB3D, 2: PB3D_POST)
Definition num_vars.f90:53
integer, parameter, public mem_usage_i
file number of memory usage file
Definition num_vars.f90:187
character(len=4), public prog_name
name of program, used for info
Definition num_vars.f90:54
integer, parameter, public eq_i
file number of equilibrium file from VMEC or HELENA
Definition num_vars.f90:183
integer, public eq_style
either 1 (VMEC) or 2 (HELENA)
Definition num_vars.f90:89
character(len=9), parameter, public mem_usage_name
name of memory usage file
Definition num_vars.f90:57
logical, public plot_vmec_modes
plot VMEC modes
Definition num_vars.f90:143
character(len=max_str_ln), public pb3d_name
name of PB3D output file
Definition num_vars.f90:139
logical, public invert_top_bottom_h
invert top and bottom for HELENA equilibria
Definition num_vars.f90:144
logical, public export_hel
export HELENA
Definition num_vars.f90:142
integer, parameter, public pb3d_i
file number of PB3D output file
Definition num_vars.f90:184
real(dp), dimension(2), public rz_0
origin of geometrical poloidal coordinate
Definition num_vars.f90:179
integer, public rank
MPI rank.
Definition num_vars.f90:68
integer, parameter, public input_i
file number of input file
Definition num_vars.f90:182
integer, public rich_restart_lvl
starting Richardson level (0: none [default])
Definition num_vars.f90:173
logical, public jump_to_sol
jump to solution
Definition num_vars.f90:141
logical, public do_execute_command_line
call "execute_command_line" inside program
Definition num_vars.f90:148
logical, public swap_angles
swap angles theta and zeta in plots (only for POST)
Definition num_vars.f90:150
integer, parameter, public output_i
file number of output file
Definition num_vars.f90:185
character(len=14), parameter, public shell_commands_name
name of shell commands file
Definition num_vars.f90:56
logical, public no_plots
no plots made
Definition num_vars.f90:140
Variables concerning Richardson extrapolation.
Definition rich_vars.f90:4
logical, public no_guess
disable guessing Eigenfunction from previous level of Richardson
Definition rich_vars.f90:24
Operations on strings.
elemental character(len=max_str_ln) function, public i2str(k)
Convert an integer to string.
elemental character(len=max_str_ln) function, public r2str(k)
Convert a real (double) to string.