-
Notifications
You must be signed in to change notification settings - Fork 37
Expand file tree
/
Copy pathgemini_cli.in.f90
More file actions
91 lines (70 loc) · 2.06 KB
/
Copy pathgemini_cli.in.f90
File metadata and controls
91 lines (70 loc) · 2.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
module gemini_cli
use gemini3d_config, only : gemini_cfg
use gemini3d_sysinfo, only : get_compiler_vendor
use filesystem, only : expanduser
use mpimod, only : mpibreakdown, mpi_cfg
use exe_frontend, only : help_gemini_bin
implicit none (type, external)
private
public :: cli
contains
subroutine cli(cfg, lid2, lid3, debug)
type(gemini_cfg), intent(out) :: cfg
integer, intent(out) :: lid2, lid3
logical, intent(inout) :: debug
integer :: argc, i, ierr
character(512) :: argv
character(8) :: date
character(10) :: time
cfg%git_revision = "@git_rev@"
argc = command_argument_count()
call get_command_argument(1, argv, status=i)
if (i/=0) then
call help_gemini_bin()
ierr = mpibreakdown()
stop 1
endif
select case (argv)
case ('-h', '-help')
call help_gemini_bin()
ierr = mpibreakdown()
stop
case ('-compiler')
print '(A)', get_compiler_vendor()
stop
case ('-git')
print '(A)', cfg%git_revision
stop
end select
call get_command_argument(0, argv)
call date_and_time(date,time)
print '(2A,I6,A3,I6,A)', trim(argv), ' Process: ', mpi_cfg%myid,' / ',mpi_cfg%lid-1, ' at ' // date // 'T' // time
!> READ FILE INPUT
call get_command_argument(1, argv, status=i)
if (i/=0) error stop 'bad command line'
cfg%outdir = expanduser(argv)
!! default values
lid2 = -1 !< sentinel
!> simple but effective command line parsing
do i = 2,argc
call get_command_argument(i,argv)
select case (argv)
case ('-d', '-debug')
debug = .true.
case ('-dryrun')
!! this is a no file output test mode that runs one time step then quits
!! it helps avoid HPC queuing when a simple setup error exists
cfg%dryrun = .true.
case ('-nooutput')
cfg%nooutput = .true.
case ('-manual_grid')
call get_command_argument(i+1, argv, status=ierr)
if(ierr/=0) error stop '-manual_grid lx2 lx3 parameters are required. lx2 missing'
read(argv,*) lid2
call get_command_argument(i+2, argv, status=ierr)
if(ierr/=0) error stop '-manual_grid lx2 lx3 parameters are required. lx3 missing'
read(argv,*) lid3
end select
end do
end subroutine cli
end module gemini_cli