59 integer(I4B) :: ncount
71 integer(I4B) :: ncount
78 integer(I4B) :: ncount
85 integer(I4B),
intent(in) :: imax
93 character(len=*),
intent(in) :: msg
94 logical,
optional,
intent(in) :: terminate
99 if (
present(terminate))
then
100 lterminate = terminate
125 integer(I4B),
intent(in) :: iunit
126 character(len=*),
intent(inout) :: fname
133 inquire (unit=iunit, name=fname)
140 if (ios /=
oswin)
then
141 ipos = index(fname,
'/', back=.true.)
148 ipos = index(fname,
'\', back=.true.)
154 ilen = len_trim(fname)
155 write (fname,
'(a)') fname(ipos + 1:ilen)//
' '
169 integer(I4B),
intent(in) :: iunit
170 logical,
optional,
intent(in) :: terminate
172 logical :: lterminate
173 character(len=LINELENGTH) :: fname
174 character(len=LINELENGTH) :: errmsg
177 if (
present(terminate))
then
178 lterminate = terminate
184 inquire (unit=iunit, name=fname)
185 write (errmsg,
'(3a)') &
186 "Error occurred while reading file '", trim(adjustl(fname)),
"'"
204 character(len=*),
intent(in) :: filename
205 logical,
optional,
intent(in) :: terminate
207 logical :: lterminate
208 character(len=LINELENGTH) :: errmsg
211 if (
present(terminate))
then
212 lterminate = terminate
218 write (errmsg,
'(3a)') &
219 "ERROR OCCURRED WHILE READING FILE '", trim(adjustl(filename)),
"'"
237 character(len=*),
intent(in) :: msg
238 character(len=*),
intent(in),
optional :: substring
242 if (
present(substring))
then
262 character(len=*),
intent(in) :: cblock
263 character(len=*),
intent(in) :: cvar
264 character(len=*),
intent(in) :: cver
265 character(len=*),
intent(in),
optional :: endmsg
267 integer(I4B),
intent(in),
optional :: iunit
270 character(len=MAXCHARLEN) :: message
271 character(len=LINELENGTH) :: fname
274 write (message,
'(a)') &
275 trim(cblock)//
" BLOCK VARIABLE '"//trim(cvar)//
"'"
276 if (
present(iunit))
then
278 write (message,
'(a,1x,3a)') &
279 trim(message),
"IN FILE '", trim(fname),
"'"
281 write (message,
'(a)') &
282 trim(message)//
' WAS DEPRECATED IN VERSION '//trim(cver)//
'.'
283 if (
present(endmsg))
then
284 write (message,
'(a,1x,2a)') trim(message), trim(endmsg),
'.'
301 character(len=*),
intent(in) :: note
314 subroutine ustop(stopmess, ioutlocal)
316 character,
optional,
intent(in) :: stopmess * (*)
318 integer(I4B),
optional,
intent(in) :: ioutlocal
337 character,
optional,
intent(in) :: stopmess * (*)
339 integer(I4B),
optional,
intent(in) :: ioutlocal
342 character(len=*),
parameter :: fmt =
'(1x,a)'
343 character(len=*),
parameter :: msg =
'Stopping due to error(s)'
347 call sim_notes%write_all(
'NOTES:',
'note(s)', &
349 call sim_warnings%write_all(
'WARNING REPORT:',
'warning(s)', &
352 call sim_errors%write_all(
'ERROR REPORT:',
'error(s)', iunit=
iout)
354 'file unit error(s)', iunit=
iout)
357 if (
present(stopmess))
then
358 if (stopmess .ne.
' ')
then
361 if (
present(ioutlocal))
then
362 if (ioutlocal > 0 .and. ioutlocal /=
iout)
then
363 write (ioutlocal, fmt) trim(stopmess)
376 if (
present(ioutlocal))
then
377 if (ioutlocal > 0 .and. ioutlocal /=
iout)
write (ioutlocal, fmt) msg
408 logical,
intent(inout) :: hasconverged
411 character(len=*),
parameter :: fmtfail = &
412 "(1x, 'Simulation convergence failure.', &
413 &' Simulation will terminate after output and deallocation.')"
416 hasconverged = .true.
433 hasconverged = .false.
457 write_sys_command=.false.)
463 call store_warning(
'Running parallel MODFLOW on only 1 process')
479 character(len=*),
parameter :: fmtnocnvg = &
480 &
"(1x, 'Simulation convergence failure occurred ', i0, ' time(s).')"
516 if (iforcestop == 1)
then
531 character(len=7) :: output_file
537 inquire (unit=i, opened=opened)
540 if (.not. opened)
then
545 inquire (unit=i, write=output_file)
546 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 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.
subroutine, public converge_check(hasConverged)
Simulation convergence check.
This module contains simulation variables.
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)
@ brief Write program header
Container for related messages.