128 mpp_set_warn_level, &
130 mpp_pe, mpp_npes, mpp_root_pe, &
132 mpp_clock_begin, mpp_clock_end, &
133 mpp_clock_id, mpp_init, mpp_exit, &
134 mpp_clock_sync, mpp_clock_detailed, &
135 clock_component, clock_subcomponent,&
136 clock_module_driver, clock_module, &
137 clock_routine, clock_loop, &
138 clock_infra, mpp_clock_set_grain, &
139 mpp_set_stack_size, &
140 stdin, stdout, stderr, stdlog, &
141 mpp_error_state, lowercase, &
146 mpp_domains_init, mpp_domains_exit, &
151 use mpp_io_mod,
only: mpp_io_init, mpp_open, mpp_close, &
152 mpp_ascii, mpp_native, mpp_ieee32, mpp_netcdf, &
153 mpp_rdonly, mpp_wronly, mpp_append, mpp_overwr, &
154 mpp_sequential, mpp_direct, &
155 mpp_single, mpp_multi, mpp_delete, mpp_io_exit, &
197 public :: lowercase, uppercase,
string, &
201 public ::
mpp_error, note, warning, fatal, &
203 mpp_pe, mpp_npes, mpp_root_pe, &
204 stdin, stdout, stderr, stdlog, &
206 public :: mpp_clock_id, mpp_clock_begin, mpp_clock_end
207 public :: mpp_clock_sync, mpp_clock_detailed
208 public :: clock_component, clock_subcomponent, &
209 clock_module_driver, clock_module, &
210 clock_routine, clock_loop, clock_infra
212 public :: do_cf_compliance
221 INTEGER :: multiplenmlsinfile
224 INTEGER :: missingvar
311 #include<file_version.h> 353 integer,
intent(in),
optional :: localcomm
354 integer :: unit, ierr, io
359 if(
present(localcomm))
then 360 call mpp_init(localcomm=localcomm)
364 call mpp_domains_init
371 #ifdef INTERNAL_FILE_NML 377 ierr=1;
do while (ierr /= 0)
378 read (unit, nml=fms_nml, iostat=io, end=10)
381 10
call mpp_close (unit)
394 call mpp_set_warn_level ( fatal )
396 call mpp_set_warn_level ( warning )
399 'invalid entry for namelist variable warning_level', fatal )
406 call mpp_clock_set_grain (0)
408 call mpp_clock_set_grain (clock_component)
409 case(
'SUBCOMPONENT' )
410 call mpp_clock_set_grain (clock_subcomponent)
411 case(
'MODULE_DRIVER' )
412 call mpp_clock_set_grain (clock_module_driver)
414 call mpp_clock_set_grain (clock_module)
416 call mpp_clock_set_grain (clock_routine)
418 call mpp_clock_set_grain (clock_loop)
420 call mpp_clock_set_grain (clock_infra)
423 'invalid entry for namelist variable clock_grain', fatal )
435 'invalid entry for namelist variable clock_flags', fatal )
441 if (mpp_pe() == mpp_root_pe())
then 443 write (unit, nml=fms_nml)
480 call mpp_domains_exit
528 subroutine error_mesg (routine, message, level)
529 character(len=*),
intent(in) :: routine, message
530 integer,
intent(in) :: level
538 call mpp_error ( routine, message, level )
575 character(len=*),
intent(in) :: routine, message
576 character(len=*),
intent(out),
optional :: err_msg
579 if(
present(err_msg))
then 583 call mpp_error(trim(routine),trim(message),fatal)
658 INTEGER,
INTENT(in) :: iostat
659 CHARACTER(len=*),
INTENT(in) :: nml_name
661 CHARACTER(len=256) :: err_str
668 IF ( iostat <= 0 .OR.&
669 & iostat ==
nml_errors%multipleNMLSinFile .OR.&
674 WRITE (err_str,*)
'Unknown namelist, or mistyped namelist variable in namelist ',trim(nml_name),
', (IOSTAT = ',iostat,
')' 675 CALL error_mesg (
'check_nml_error in fms_mod', err_str, fatal)
678 WRITE (err_str,*)
'Unknown error while reading namelist ',trim(nml_name),
', (IOSTAT = ',iostat,
')' 679 CALL error_mesg (
'check_nml_error in fms_mod', err_str, fatal)
692 INTEGER,
PARAMETER :: unit_begin = 20, unit_end = 1024
693 INTEGER :: fileunit, io_stat
694 INTEGER,
DIMENSION(5) :: nml_iostats
701 namelist /a_nml/ i1, r1
702 namelist /b_nml/ i2, r2, l1
703 namelist /badtype1_nml/ i1, r1
704 namelist /badtype2_nml/ i1, r1
705 namelist /missingvar_nml/ i2, r2
706 namelist /not_in_file_nml/ i2, r2
716 IF ( mpp_pe() == mpp_root_pe() )
THEN 718 file_opened:
DO fileunit = unit_begin, unit_end
719 INQUIRE(unit=fileunit, opened=opened)
720 IF ( .NOT.opened )
EXIT file_opened
723 #if defined(__PGI) || defined(_CRAYFTN) 724 OPEN (unit=fileunit, file=
'_read_error.nml', iostat=io_stat)
726 OPEN (unit=fileunit, status=
'SCRATCH', iostat=io_stat)
730 WRITE (unit=fileunit, nml=a_nml, iostat=io_stat)
731 WRITE (unit=fileunit, nml=b_nml, iostat=io_stat)
732 WRITE (unit=fileunit, iostat=io_stat, fmt=
'(/,"&badType1_nml i1=1, r1=''bad'' /",/)')
733 WRITE (unit=fileunit, iostat=io_stat, fmt=
'(/,"&badType2_nml i1=1, r1=.true. /",/)')
734 WRITE (unit=fileunit, iostat=io_stat, fmt=
'(/,"&missingVar_nml i2=1, r2=1.0e0, l1=.true. /",/)')
737 rewind(unit=fileunit)
740 READ (unit=fileunit, nml=b_nml, iostat=nml_iostats(1))
741 rewind(unit=fileunit)
744 READ (unit=fileunit, nml=badtype1_nml, iostat=nml_iostats(2))
745 rewind(unit=fileunit)
748 READ (unit=fileunit, nml=badtype2_nml, iostat=nml_iostats(3))
749 rewind(unit=fileunit)
752 READ (unit=fileunit, nml=missingvar_nml, iostat=nml_iostats(4))
753 rewind(unit=fileunit)
756 READ (unit=fileunit, nml=not_in_file_nml, iostat=nml_iostats(5))
759 CLOSE (unit=fileunit)
762 IF ( nml_iostats(2) * nml_iostats(3) .EQ. 0 )
THEN 763 IF ( nml_iostats(2) .NE. 0 .AND. nml_iostats(3) .EQ. 0 )
THEN 764 nml_iostats(3) = nml_iostats(2)
765 ELSE IF ( nml_iostats(2) .EQ. 0 .AND. nml_iostats(3) .NE.0 )
THEN 766 nml_iostats(2) = nml_iostats(3)
768 nml_iostats(2) = nml_iostats(4)
769 nml_iostats(2) = nml_iostats(4)
776 nml_errors%multipleNMLSinFile = nml_iostats(1)
831 character(len=*),
intent(in) ::
string, string_array(:)
832 integer,
optional,
intent(out) :: index
840 if (
present(index)) index = 0
842 do i = 1,
size(string_array(:))
844 if ( trim(
string) == trim(string_array(i)) )
then 846 if (
present(index)) index = i
888 real,
intent(in) :: array(:)
889 integer,
intent(out),
optional :: direction
895 if (
present(direction)) direction = 0
898 if (
size(array(:)) < 2 )
return 901 if ( array(1) < array(
size(array(:))) )
then 902 do i = 2,
size(array(:))
903 if (array(i-1) < array(i)) cycle
907 if (
present(direction)) direction = +1
911 do i = 2,
size(array(:))
912 if (array(i-1) > array(i)) cycle
916 if (
present(direction)) direction = -1
subroutine, public print_memuse_stats(text, unit, always)
character(len=16) clock_flags
subroutine, public set_domain(Domain2)
integer function, public open_direct_file(file, action, recl)
logical module_is_initialized
logical function, public file_exist(file_name, domain, no_domain)
logical function, public fms_error_handler(routine, message, err_msg)
subroutine, public write_version_number(version, tag, unit)
character(len=8) warning_level
integer function, public check_nml_error(IOSTAT, NML_NAME)
logical, private do_nml_error_init
subroutine, private nml_error_init
subroutine, public memutils_init(print_flag)
character(len=input_str_length), dimension(:), allocatable, target, public input_nml_file
integer, public clock_flag_default
integer function, public open_ieee32_file(file, action)
logical function, public monotonic_array(array, direction)
subroutine, public fms_init(localcomm)
character(len=16) clock_grain
subroutine, public get_domain_decomp(x, y)
subroutine, public fms_io_init()
subroutine, public field_size(filename, fieldname, siz, field_found, domain, no_domain)
type(nml_errors_type), save nml_errors
integer, dimension(20), private nml_error_codes
subroutine, public nullify_domain()
integer function, public open_namelist_file(file)
integer domains_stack_size
subroutine, public fms_end()
subroutine, public fms_io_exit()
integer function, public open_restart_file(file, action)
character(len=64) iospec_ieee32
integer, private num_nml_error_codes
integer function, public open_file(file, form, action, access, threading, recl, dist)
subroutine, public get_mosaic_tile_grid(grid_file, mosaic_file, domain, tile_count)
logical function, public string_array_index(string, string_array, index)
logical, public print_memory_usage
subroutine, public error_mesg(routine, message, level)
subroutine, public close_file(unit, status, dist)
logical function, public field_exist(file_name, field_name, domain, no_domain)