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.)
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
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))
148 case (
'-DEV',
'--DEVELOP')
150 write (line,
'(2a,g0)') &
151 trim(adjustl(cexe)),
': develop version ', ltyp
153 case (
'-C',
'--COMPILER')
156 write (line,
'(2a,1x,a)') &
157 trim(adjustl(cexe)),
':', trim(adjustl(compiler))
159 case (
'-S',
'--SILENT')
160 write (line,
'(2a,1x,a)') &
161 trim(adjustl(cexe)),
':',
'all screen output sent to mfsim.stdout'
163 case (
'-D',
'--DISCLAIMER')
166 case (
'-P',
'--PARALLEL')
168 case (
'-LIC',
'--LICENSE')
171 case (
'-CO',
'--COMPILER-OPT')
175 case (
'-L',
'--LEVEL')
176 if (len_trim(clevel) < 1)
then
178 call get_command_argument(iarg, clevel)
181 select case (trim(adjustl(clevel)))
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))
195 write (line,
'(2a,2(1x,a))') &
196 trim(adjustl(cexe)),
':',
'stdout output level', &
197 trim(adjustl(clevel))
199 case (
'-M',
'--MODE')
200 if (len_trim(cmode) < 1)
then
202 call get_command_argument(iarg, cmode)
205 select case (trim(adjustl(cmode)))
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))
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.'
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))
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.'
248 if (icountcmd > 0)
then
260 character(len=*),
intent(in) :: header
261 character(len=*),
intent(in) :: cexe
263 character(len=LINELENGTH) :: line
265 character(len=*),
parameter :: OPTIONSFMT = &
267 &'Options GNU long option Meaning ',/,&
268 &' -h, -? --help Show this message',/,&
269 &' -v --version Display program version information.',/,&
270 &' -dev --develop Display program develop option mode.',/,&
271 &' -d --disclaimer Display program disclaimer.',/,&
272 &' -p --parallel Run program in parallel mode.',/,&
273 &' -lic --license Display program license information.',/,&
274 &' -c --compiler Display compiler information.',/,&
275 &' -co --compiler-opt Display compiler options.',/,&
276 &' -s --silent All STDOUT to mfsim.stdout.',/,"// &
277 "' -l <str> --level <str> STDOUT output to screen based on <str>.',/,&
278 &' <str>=summary Limited output to STDOUT.',/,&
279 &' <str>=debug Enhanced output to STDOUT.',/,&
280 &' -m <str> --mode <str> MODFLOW 6 simulation mode based on <str>.',/,&
281 &' <str>=validate Check model input for',/,&
282 &' errors but do not ',/,&
283 &' assemble or solve matrix ',/,&
284 &' equations or write ',/,&
285 &' solution output.',/,"// &
287 &'Bug reporting and contributions are welcome from the community. ',/,&
288 &'Questions can be asked on the issues page[1]. Before creating a new',/,&
289 &'issue, please take a moment to search and make sure a similar issue',/,&
290 &'does not already exist. If one does exist, you can comment (most',/,&
291 &'simply even with just :+1:) to show your support for that issue.',/,&
293 &'[1] https://github.com/MODFLOW-USGS/modflow6/issues',/)"
297 write (line,
'(a,1x,a,15x,a,2(1x,a),2a)') &
298 'usage:', cexe,
'run MODFLOW', trim(adjustl(
mfvnam)), &
299 'using "', trim(adjustl(
simfile)),
'"'
301 write (line,
'(a,1x,a,1x,a,5x,a)') &
302 ' or:', cexe,
'[options]', &
303 'retrieve program information'
subroutine write_usage(header, cexe)
Write command line argument usage.
subroutine, public getcommandlinearguments()
Get command line arguments.
subroutine, public get_compiler(txt)
@ brief Get compiler information
subroutine, public get_compile_options(txt)
@ brief Get compilation options
subroutine, public get_compile_date(txt)
@ brief Get compilation date
This module contains simulation constants.
integer(i4b), parameter linelength
maximum length of a standard line
@ mvalidate
validation mode - do not run time steps
integer(i4b), parameter lenhugeline
maximum length of a huge line
integer(i4b), parameter lenbigline
maximum length of a big line
@ vsummary
write summary output
@ vdebug
write debug output
@ vall
write all simulation notes and warnings
This module defines variable data types.
Store and issue logging messages to output units.
subroutine, public write_message(text, iunit, fmt, skipbefore, skipafter, advance)
Write a message to an output unit.
subroutine, public write_message_counter(text, iunit, icount, iwidth, skipbefore, skipafter)
Write a message with configurable indentation and numbering.
This module contains simulation methods.
subroutine, public ustop(stopmess, ioutlocal)
Stop the simulation.
subroutine, public store_error(msg, terminate)
Store an error message.
This module contains simulation variables.
character(len=linelength) simulation_mode
integer(i4b) isim_level
simulation output level
character(len=linelength) simstdout
name of standard out file if screen output is piped to a file
character(len=linelength) simfile
simulation name file
character(len=linelength) simlstfile
simulation listing file name
integer(i4b) istdout
unit number for stdout
integer(i4b) isim_mode
simulation mode
This module contains version information.
subroutine write_license(iout)
@ brief Write program license
character(len= *), parameter fmtdisclaimer
character(len=40), parameter version
integer(i4b), parameter idevelopmode
character(len=2), parameter mfvnam