Subroutine to get and write information on command line arguments.
31 character(len=LINELENGTH) :: tag
32 character(len=LINELENGTH) :: uctag
33 character(len=LENHUGELINE) :: line
34 character(len=LINELENGTH) :: clevel
35 character(len=LINELENGTH) :: cmode
36 character(len=LINELENGTH) :: header
37 character(len=LINELENGTH) :: errmsg
38 character(len=LINELENGTH) :: cexe
39 character(len=LENBIGLINE) :: compiler
40 character(len=20) :: cdate
41 character(len=LENBIGLINE) :: coptions
45 integer(I4B) :: icountcmd
54 icountcmd = command_argument_count()
55 call get_command_argument(0, cexe)
60 ipos = index(cexe,
'/', back=.true.)
62 ipos = index(cexe,
'\', back=.true.)
72 call get_compile_date(cdate)
73 write (header,
'(a,4(1x,a),a)') &
74 trim(adjustl(cexe)),
'- MODFLOW', &
75 trim(adjustl(version)),
'(compiled', trim(adjustl(cdate)),
')'
78 do iarg = 1, icountcmd
79 call get_command_argument(iarg, uctag)
81 if (trim(adjustl(uctag)) ==
'-S' .or. &
82 trim(adjustl(uctag)) ==
'--SILENT')
then
86 open (unit=istdout, file=trim(adjustl(simstdout)))
99 if (iarg > icountcmd)
then
104 call get_command_argument(iarg, tag)
109 ipos = index(uctag,
'-')
116 ipos = index(uctag,
'--LEVEL=')
118 ipos = index(tag,
'=')
120 clevel = tag(ipos + 1:ilen)
122 uctag = tag(1:ipos - 1)
128 ipos = index(uctag,
'--MODE=')
130 ipos = index(tag,
'=')
132 cmode = tag(ipos + 1:ilen)
134 uctag = tag(1:ipos - 1)
139 select case (trim(adjustl(uctag)))
140 case (
'-H',
'-?',
'--HELP')
142 call write_usage(trim(adjustl(header)), trim(adjustl(cexe)))
143 case (
'-V',
'--VERSION')
145 write (line,
'(2a,2(1x,a))') &
146 trim(adjustl(cexe)),
':', trim(adjustl(version))
147 call write_message_counter(line, skipbefore=1, skipafter=1)
148 case (
'-DEV',
'--DEVELOP')
150 write (line,
'(2a,g0)') &
151 trim(adjustl(cexe)),
': develop version ', ltyp
152 call write_message_counter(line, skipbefore=1, skipafter=1)
153 case (
'-C',
'--COMPILER')
155 call get_compiler(compiler)
156 write (line,
'(2a,1x,a)') &
157 trim(adjustl(cexe)),
':', trim(adjustl(compiler))
158 call write_message_counter(line, skipbefore=1, skipafter=1)
159 case (
'-S',
'--SILENT')
160 write (line,
'(2a,1x,a)') &
161 trim(adjustl(cexe)),
':',
'all screen output sent to mfsim.stdout'
162 call write_message_counter(line, skipbefore=1, skipafter=1)
163 case (
'-D',
'--DISCLAIMER')
165 call write_message(
'', fmt=fmtdisclaimer)
166 case (
'-P',
'--PARALLEL')
167 simulation_mode =
'PARALLEL'
168 case (
'-LIC',
'--LICENSE')
171 case (
'-CO',
'--COMPILER-OPT')
173 call get_compile_options(coptions)
174 call write_message_counter(coptions, skipbefore=1, skipafter=1)
175 case (
'-L',
'--LEVEL')
176 if (len_trim(clevel) < 1)
then
178 call get_command_argument(iarg, clevel)
181 select case (trim(adjustl(clevel)))
183 isim_level = vsummary
187 call write_usage(trim(adjustl(header)), trim(adjustl(cexe)))
188 write (errmsg,
'(2a,1x,a)') &
189 trim(adjustl(cexe)),
': illegal STDOUT level option -', &
190 trim(adjustl(clevel))
191 call store_error(errmsg)
195 write (line,
'(2a,2(1x,a))') &
196 trim(adjustl(cexe)),
':',
'stdout output level', &
197 trim(adjustl(clevel))
198 call write_message_counter(line, skipbefore=1, skipafter=1)
199 case (
'-M',
'--MODE')
200 if (len_trim(cmode) < 1)
then
202 call get_command_argument(iarg, cmode)
205 select case (trim(adjustl(cmode)))
207 isim_mode = mvalidate
209 call write_usage(trim(adjustl(header)), trim(adjustl(cexe)))
210 errmsg = trim(adjustl(cexe))//
': illegal MODFLOW 6 '// &
211 'simulation mode option - '//trim(adjustl(cmode))
212 call store_error(errmsg, terminate=.true.)
216 line = trim(adjustl(cexe))//
': MODFLOW 6 simulation mode '// &
217 trim(adjustl(cmode))//
'. Model input will be checked for all '// &
218 'stress periods but the matrix equations will not be '// &
219 'assembled or solved.'
220 call write_message_counter(line, skipbefore=1, skipafter=1)
223 call write_usage(trim(adjustl(header)), trim(adjustl(cexe)))
224 write (errmsg,
'(2a,1x,a)') &
225 trim(adjustl(cexe)),
': illegal option -', trim(adjustl(tag))
226 call store_error(errmsg, terminate=.true.)
231 if (.not. lstop)
then
232 inquire (file=trim(adjustl(simfile)), exist=lexist)
233 if (.NOT. lexist)
then
235 write (errmsg,
'(2a,2(1x,a))') &
236 trim(adjustl(cexe)),
':', trim(adjustl(simfile)), &
237 'is not present in working directory.'
238 call store_error(errmsg, terminate=.true.)
248 if (icountcmd > 0)
then
249 call write_message(
'')