60 integer(I4B) :: ncount
72 integer(I4B) :: ncount
79 integer(I4B) :: ncount
86 integer(I4B),
intent(in) :: imax
95 character(len=*),
intent(in) :: msg
96 logical,
optional,
intent(in) :: terminate
101 if (
present(terminate))
then
102 lterminate = terminate
127 integer(I4B),
intent(in) :: iunit
128 character(len=*),
intent(inout) :: fname
136 inquire (unit=iunit, name=fname)
143 if (ios /=
oswin)
then
144 ipos = index(fname,
'/', back=.true.)
151 ipos = index(fname,
'\', back=.true.)
157 ilen = len_trim(fname)
158 write (fname,
'(a)') fname(ipos + 1:ilen)//
' '
173 integer(I4B),
intent(in) :: iunit
174 logical,
optional,
intent(in) :: terminate
176 logical :: lterminate
177 character(len=LINELENGTH) :: fname
178 character(len=LINELENGTH) ::
errmsg
181 if (
present(terminate))
then
182 lterminate = terminate
190 "Error occurred while reading file '", trim(adjustl(fname)),
"'"
209 character(len=*),
intent(in) :: filename
210 logical,
optional,
intent(in) :: terminate
212 logical :: lterminate
213 character(len=LINELENGTH) ::
errmsg
216 if (
present(terminate))
then
217 lterminate = terminate
224 "ERROR OCCURRED WHILE READING FILE '", trim(adjustl(filename)),
"'"
242 character(len=*),
intent(in) :: msg
243 character(len=*),
intent(in),
optional :: substring
247 if (
present(substring))
then
264 character(len=*),
intent(in) :: cblock
265 character(len=*),
intent(in) :: cvar
266 character(len=*),
intent(in) :: cver
267 character(len=*),
intent(in),
optional :: endmsg
269 integer(I4B),
intent(in),
optional :: iunit
272 character(len=MAXCHARLEN) :: message
273 character(len=LINELENGTH) :: fname
276 write (message,
'(a)') &
277 trim(cblock)//
" BLOCK VARIABLE '"//trim(cvar)//
"'"
278 if (
present(iunit))
then
280 write (message,
'(a,1x,3a)') &
281 trim(message),
"IN FILE '", trim(fname),
"'"
283 write (message,
'(a)') &
284 trim(message)//
' WAS DEPRECATED IN VERSION '//trim(cver)//
'.'
285 if (
present(endmsg))
then
286 write (message,
'(a,1x,2a)') trim(message), trim(endmsg),
'.'
303 character(len=*),
intent(in) :: note
316 subroutine ustop(stopmess, ioutlocal)
318 character,
optional,
intent(in) :: stopmess * (*)
320 integer(I4B),
optional,
intent(in) :: ioutlocal
339 character,
optional,
intent(in) :: stopmess * (*)
341 integer(I4B),
optional,
intent(in) :: ioutlocal
344 character(len=*),
parameter :: fmt =
'(1x,a)'
345 character(len=*),
parameter :: msg =
'Stopping due to error(s)'
349 call sim_notes%write_all(
'NOTES:',
'note(s)', &
351 call sim_warnings%write_all(
'WARNING REPORT:',
'warning(s)', &
354 call sim_errors%write_all(
'ERROR REPORT:',
'error(s)', iunit=
iout)
356 'file unit error(s)', iunit=
iout)
359 if (
present(stopmess))
then
360 if (stopmess .ne.
' ')
then
363 if (
present(ioutlocal))
then
364 if (ioutlocal > 0 .and. ioutlocal /=
iout)
then
365 write (ioutlocal, fmt) trim(stopmess)
378 if (
present(ioutlocal))
then
379 if (ioutlocal > 0 .and. ioutlocal /=
iout)
write (ioutlocal, fmt) msg
410 logical,
intent(inout) :: hasconverged
413 character(len=*),
parameter :: fmtfail = &
414 "(1x, 'Simulation convergence failure.', &
415 &' Simulation will terminate after output and deallocation.')"
418 hasconverged = .true.
435 hasconverged = .false.
459 write_sys_command=.false.)
465 call store_warning(
'Running parallel MODFLOW on only 1 process')
481 character(len=*),
parameter :: fmtnocnvg = &
482 &
"(1x, 'Simulation convergence failure occurred ', i0, ' time(s).')"
533 character(len=7) :: output_file
539 inquire (unit=i, opened=opened)
542 if (.not. opened)
then
547 inquire (unit=i, write=output_file)
548 if (trim(adjustl(output_file)) ==
'YES')
then
This module contains simulation constants.
integer(i4b), parameter linelength
maximum length of a standard line
integer(i4b), parameter iulast
maximum file unit number (this allows for 9000 open files)
integer(i4b), parameter iustart
starting file unit number
@ osundef
unknown operating system
@ oswin
Windows operating system.
integer(i4b), parameter maxcharlen
maximum length of char string
@ vsummary
write summary output
@ vdebug
write debug output
@ vall
write all simulation notes and warnings
real(dp), parameter done
real constant 1
integer(i4b) function, public get_os()
Get operating system.
subroutine pstop(status, message)
Stop the program, optionally specifying an error status code.
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.
This module contains simulation methods.
subroutine, public ustop(stopmess, ioutlocal)
Stop the simulation.
subroutine, public store_warning(msg, substring)
Store warning message.
subroutine, public store_error(msg, terminate)
Store an error message.
subroutine, public converge_check(hasconverged)
Simulation convergence check.
subroutine, public maxerrors(imax)
Set the maximum number of errors to be stored.
type(messagestype) sim_uniterrors
subroutine, public converge_reset()
Reset the simulation convergence flag.
subroutine, public initial_message()
Print the header and initializes messaging.
integer(i4b) function, public count_errors()
Return number of errors.
subroutine sim_closefiles()
Close all open files.
integer(i4b) function, public count_notes()
Return the number of notes stored.
integer(i4b) function, public count_warnings()
Return number of warnings.
subroutine, public final_message()
Create final message.
subroutine, public deprecation_warning(cblock, cvar, cver, endmsg, iunit)
Store deprecation warning message.
subroutine, public store_error_filename(filename, terminate)
Store the erroring file name.
subroutine, public store_error_unit(iunit, terminate)
Store the file unit number.
subroutine get_filename(iunit, fname)
Get the file name.
type(messagestype) sim_warnings
subroutine print_final_message(stopmess, ioutlocal)
Print the final messages.
type(messagestype) sim_notes
type(messagestype) sim_errors
subroutine, public store_note(note)
Store note.
This module contains simulation variables.
character(len=maxcharlen) errmsg
error message string
integer(i4b) iforcestop
forced stop flag (1) forces a call to ustop(..) when the simulation has ended, (0) doesn't
integer(i4b) isimcontinue
simulation continue flag (1) to continue if isimcnvg = 0, (0) to terminate
character(len=linelength) simulation_mode
integer(i4b) isim_level
simulation output level
integer(i4b) ireturnerr
return code for program (0) successful, (1) non-convergence, (2) error
character(len=maxcharlen) warnmsg
warning message string
integer(i4b) numnoconverge
number of times the simulation did not converge
integer(i4b) iout
file unit number for simulation output
integer(i4b) iunext
next file unit number to assign
integer(i4b) istdout
unit number for stdout
integer(i4b) isimcnvg
simulation convergence flag (1) if all objects have converged, (0) otherwise
This module contains version information.
subroutine write_listfile_header(iout, cmodel_type, write_sys_command, write_kind_info)
Write program header.
Container for related messages.