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
259 character(len=*),
intent(in) :: cblock
260 character(len=*),
intent(in) :: cvar
261 character(len=*),
intent(in) :: cver
262 character(len=*),
intent(in),
optional :: endmsg
264 integer(I4B),
intent(in),
optional :: iunit
267 character(len=MAXCHARLEN) :: message
268 character(len=LINELENGTH) :: fname
271 write (message,
'(a)') &
272 trim(cblock)//
" BLOCK VARIABLE '"//trim(cvar)//
"'"
273 if (
present(iunit))
then
275 write (message,
'(a,1x,3a)') &
276 trim(message),
"IN FILE '", trim(fname),
"'"
278 write (message,
'(a)') &
279 trim(message)//
' WAS DEPRECATED IN VERSION '//trim(cver)//
'.'
280 if (
present(endmsg))
then
281 write (message,
'(a,1x,2a)') trim(message), trim(endmsg),
'.'
298 character(len=*),
intent(in) :: note
311 subroutine ustop(stopmess, ioutlocal)
313 character,
optional,
intent(in) :: stopmess * (*)
315 integer(I4B),
optional,
intent(in) :: ioutlocal
334 character,
optional,
intent(in) :: stopmess * (*)
336 integer(I4B),
optional,
intent(in) :: ioutlocal
339 character(len=*),
parameter :: fmt =
'(1x,a)'
340 character(len=*),
parameter :: msg =
'Stopping due to error(s)'
344 call sim_notes%write_all(
'NOTES:',
'note(s)', &
346 call sim_warnings%write_all(
'WARNING REPORT:',
'warning(s)', &
349 call sim_errors%write_all(
'ERROR REPORT:',
'error(s)', iunit=
iout)
351 'file unit error(s)', iunit=
iout)
354 if (
present(stopmess))
then
355 if (stopmess .ne.
' ')
then
358 if (
present(ioutlocal))
then
359 if (ioutlocal > 0 .and. ioutlocal /=
iout)
then
360 write (ioutlocal, fmt) trim(stopmess)
373 if (
present(ioutlocal))
then
374 if (ioutlocal > 0 .and. ioutlocal /=
iout)
write (ioutlocal, fmt) msg
405 logical,
intent(inout) :: hasconverged
408 character(len=*),
parameter :: fmtfail = &
409 "(1x, 'Simulation convergence failure.', &
410 &' Simulation will terminate after output and deallocation.')"
413 hasconverged = .true.
430 hasconverged = .false.
454 write_sys_command=.false.)
460 call store_warning(
'Running parallel MODFLOW on only 1 process')
476 character(len=*),
parameter :: fmtnocnvg = &
477 &
"(1x, 'Simulation convergence failure occurred ', i0, ' time(s).')"
513 if (iforcestop == 1)
then
528 character(len=7) :: output_file
534 inquire (unit=i, opened=opened)
537 if (.not. opened)
then
542 inquire (unit=i, write=output_file)
543 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.