← back to index

config_src/infra/FMS2/MOM_error_infra.F90

portedportable, not yet portedexecuted, not portableexecutable, not hit by this run

1! This file is part of MOM6, the Modular Ocean Model version 6.
2! See the LICENSE file for licensing information.
3! SPDX-License-Identifier: Apache-2.0
4
5!> Routines for error handling and I/O management
6module MOM_error_infra
7
8use mpp_mod, only : mpp_error, mpp_pe, mpp_root_pe, mpp_stdlog=>stdlog, mpp_stdout=>stdout
9use mpp_mod, only : NOTE, WARNING, FATAL
10
11implicit none ; private
12
13public :: MOM_err, is_root_pe, stdlog, stdout
14!> Integer parameters encoding the severity of an error message
15public :: NOTE, WARNING, FATAL
16
17contains
18
19!> MOM_err writes an error message, and may cause the run to stop depending on the
20!! severity of the error.
216subroutine MOM_err(severity, message)
22 integer, intent(in) :: severity !< The severity level of this error
23 character(len=*), intent(in) :: message !< A message to write out
24
256 call mpp_error(severity, message)
266end subroutine MOM_err
27
28!> stdout returns the standard Fortran unit number for output
292integer function stdout()
302 stdout = mpp_stdout()
312end function stdout
32
33!> stdlog returns the standard Fortran unit number to use to log messages
346integer function stdlog()
356 stdlog = mpp_stdlog()
366end function stdlog
37
38!> is_root_pe returns .true. if the current PE is the root PE.
398725logical function is_root_pe()
408725 is_root_pe = .false.
418725 if (mpp_pe() == mpp_root_pe()) is_root_pe = .true.
428725end function is_root_pe
43
44end module MOM_error_infra