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
134 inquire (unit=iunit, name=fname)
141 if (ios /=
oswin)
then
142 ipos = index(fname,
'/', back=.true.)
149 ipos = index(fname,
'\', back=.true.)
155 ilen = len_trim(fname)
156 write (fname,
'(a)') fname(ipos + 1:ilen)//
' '
170 integer(I4B),
intent(in) :: iunit
171 logical,
optional,
intent(in) :: terminate
173 logical :: lterminate
174 character(len=LINELENGTH) :: fname
175 character(len=LINELENGTH) :: errmsg
178 if (
present(terminate))
then
179 lterminate = terminate
186 write (errmsg,
'(3a)') &
187 "Error occurred while reading file '", trim(adjustl(fname)),
"'"
205 character(len=*),
intent(in) :: filename
206 logical,
optional,
intent(in) :: terminate
208 logical :: lterminate
209 character(len=LINELENGTH) :: errmsg
212 if (
present(terminate))
then
213 lterminate = terminate
219 write (errmsg,
'(3a)') &
220 "ERROR OCCURRED WHILE READING FILE '", trim(adjustl(filename)),
"'"
238 character(len=*),
intent(in) :: msg
239 character(len=*),
intent(in),
optional :: substring
243 if (
present(substring))
then
260 character(len=*),
intent(in) :: cblock
261 character(len=*),
intent(in) :: cvar
262 character(len=*),
intent(in) :: cver
263 character(len=*),
intent(in),
optional :: endmsg
265 integer(I4B),
intent(in),
optional :: iunit
268 character(len=MAXCHARLEN) :: message
269 character(len=LINELENGTH) :: fname
272 write (message,
'(a)') &
273 trim(cblock)//
" BLOCK VARIABLE '"//trim(cvar)//
"'"
274 if (
present(iunit))
then
276 write (message,
'(a,1x,3a)') &
277 trim(message),
"IN FILE '", trim(fname),
"'"
279 write (message,
'(a)') &
280 trim(message)//
' WAS DEPRECATED IN VERSION '//trim(cver)//
'.'
281 if (
present(endmsg))
then
282 write (message,
'(a,1x,2a)') trim(message), trim(endmsg),
'.'
299 character(len=*),
intent(in) :: note
312 subroutine ustop(stopmess, ioutlocal)
314 character,
optional,
intent(in) :: stopmess * (*)
316 integer(I4B),
optional,
intent(in) :: ioutlocal
335 character,
optional,
intent(in) :: stopmess * (*)
337 integer(I4B),
optional,
intent(in) :: ioutlocal
340 character(len=*),
parameter :: fmt =
'(1x,a)'
341 character(len=*),
parameter :: msg =
'Stopping due to error(s)'
345 call sim_notes%write_all(
'NOTES:',
'note(s)', &
347 call sim_warnings%write_all(
'WARNING REPORT:',
'warning(s)', &
350 call sim_errors%write_all(
'ERROR REPORT:',
'error(s)', iunit=
iout)
352 'file unit error(s)', iunit=
iout)
355 if (
present(stopmess))
then
356 if (stopmess .ne.
' ')
then
359 if (
present(ioutlocal))
then
360 if (ioutlocal > 0 .and. ioutlocal /=
iout)
then
361 write (ioutlocal, fmt) trim(stopmess)
374 if (
present(ioutlocal))
then
375 if (ioutlocal > 0 .and. ioutlocal /=
iout)
write (ioutlocal, fmt) msg
406 logical,
intent(inout) :: hasconverged
409 character(len=*),
parameter :: fmtfail = &
410 "(1x, 'Simulation convergence failure.', &
411 &' Simulation will terminate after output and deallocation.')"
414 hasconverged = .true.
431 hasconverged = .false.
455 write_sys_command=.false.)
461 call store_warning(
'Running parallel MODFLOW on only 1 process')
477 character(len=*),
parameter :: fmtnocnvg = &
478 &
"(1x, 'Simulation convergence failure occurred ', i0, ' time(s).')"
514 if (iforcestop == 1)
then
529 character(len=7) :: output_file
535 inquire (unit=i, opened=opened)
538 if (.not. opened)
then
543 inquire (unit=i, write=output_file)
544 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.