MODULE in_out_manager !!====================================================================== !! *** MODULE in_out_manager *** !! Ocean physics: vertical mixing coefficient compute from the tke !! turbulent closure parameterization !!===================================================================== !! History : 1.0 ! 2002-06 (G. Madec) original code !! 2.0 ! 2006-07 (S. Masson) iom, add ctl_stop, ctl_warn !! 3.0 ! 2008-06 (G. Madec) add ctmp4 to ctmp10 !!---------------------------------------------------------------------- !!---------------------------------------------------------------------- !! ctl_stop : update momentum and tracer Kz from a tke scheme !! ctl_warn : initialization, namelist read, and parameters control !! getunit : give the index of an unused logical unit !!---------------------------------------------------------------------- USE par_kind ! kind definition USE par_oce ! ocean parameter USE lib_print ! formated print library IMPLICIT NONE PUBLIC !!---------------------------------------------------------------------- !! namrun namelist parameters !!---------------------------------------------------------------------- CHARACTER(len=16) :: cexper = "exp0" !: experiment name used for output filename CHARACTER(len=32) :: cn_ocerst_in = "restart" !: suffix of ocean restart name (input) CHARACTER(len=32) :: cn_ocerst_out = "restart" !: suffix of ocean restart name (output) LOGICAL :: ln_rstart = .FALSE. !: start from (F) rest or (T) a restart file INTEGER :: no = 0 !: job number INTEGER :: nrstdt = 0 !: control of the time step (0, 1 or 2) INTEGER :: nn_rstssh = 0 !: hand made initilization of ssh or not (1/0) INTEGER :: nit000 = 1 !: index of the first time step INTEGER :: nitend = 10 !: index of the last time step INTEGER :: ndate0 = 961115 !: initial calendar date aammjj INTEGER :: nleapy = 0 !: Leap year calendar flag (0/1 or 30) INTEGER :: ninist = 0 !: initial state output flag (0/1) LOGICAL :: ln_dimgnnn = .FALSE. !: type of dimgout. (F): 1 file for all proc !: (T): 1 file per proc LOGICAL :: ln_mskland = .FALSE. !: mask land points in NetCDF outputs (costly: + ~15%) LOGICAL :: ln_clobber = .FALSE. !: clobber (overwrite) an existing file INTEGER :: nn_chunksz = 0 !: chunksize (bytes) for NetCDF file (working only with iom_nf90 routines) !!---------------------------------------------------------------------- !! was in restart but moved here because of the OFF line... better solution should be found... !!---------------------------------------------------------------------- INTEGER :: nitrst !: time step at which restart file should be written !!---------------------------------------------------------------------- !! output monitoring !!---------------------------------------------------------------------- LOGICAL :: ln_ctl = .FALSE. !: run control for debugging INTEGER :: nstock = 10 !: restart file frequency INTEGER :: nprint = 0 !: level of print (0 no print) INTEGER :: nwrite = 10 !: restart file frequency INTEGER :: nictls = 0 !: Start i indice for the SUM control INTEGER :: nictle = 0 !: End i indice for the SUM control INTEGER :: njctls = 0 !: Start j indice for the SUM control INTEGER :: njctle = 0 !: End j indice for the SUM control INTEGER :: isplt = 1 !: number of processors following i INTEGER :: jsplt = 1 !: number of processors following j INTEGER :: ijsplt = 1 !: nb of local domain = nb of processors INTEGER :: nbench = 0 !: benchmark parameter (0/1) INTEGER :: nbit_cmp = 0 !: bit reproducibility (0/1) !!---------------------------------------------------------------------- !! logical units !!---------------------------------------------------------------------- INTEGER :: numstp !: logical unit for time step INTEGER :: numout = 6 !: logical unit for output print INTEGER :: numnam !: logical unit for namelist INTEGER :: numnam_ice !: logical unit for ice namelist INTEGER :: numevo_ice !: logical unit for ice variables (temp. evolution) INTEGER :: numsol !: logical unit for solver statistics INTEGER :: numwri !: logical unit for output write INTEGER :: numgap !: logical unit for differences diagnostic INTEGER :: numbol !: logical unit for "bol" diagnostics INTEGER :: numptr !: logical unit for Poleward TRansports INTEGER :: numflo !: logical unit for drifting floats !!---------------------------------------------------------------------- !! Run control !!---------------------------------------------------------------------- INTEGER :: nstop = 0 !: error flag (=number of reason for a premature stop run) INTEGER :: nwarn = 0 !: warning flag (=number of warning found during the run) CHARACTER(len=200) :: ctmp1, ctmp2, ctmp3 !: temporary characters 1 to 3 CHARACTER(len=200) :: ctmp4, ctmp5, ctmp6 !: temporary characters 4 to 6 CHARACTER(len=200) :: ctmp7, ctmp8, ctmp9 !: temporary characters 7 to 9 CHARACTER(len=200) :: ctmp10 !: temporary character 10 CHARACTER (len=64) :: cform_err = "(/,' ===>>> : E R R O R', /,' ===========',/)" !: CHARACTER (len=64) :: cform_war = "(/,' ===>>> : W A R N I N G', /,' ===============',/)" !: LOGICAL :: lwp = .FALSE. !: boolean : true on the 1st processor only LOGICAL :: lsp_area = .TRUE. !: to make a control print over a specific area !!---------------------------------------------------------------------- !! NEMO/OPA 3.0 , LOCEAN-IPSL (2008) !! $Id$ !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) !!---------------------------------------------------------------------- CONTAINS SUBROUTINE ctl_stop( cd1, cd2, cd3, cd4, cd5, & & cd6, cd7, cd8, cd9, cd10 ) !!---------------------------------------------------------------------- !! *** ROUTINE stop_opa *** !! !! ** Purpose : print in ocean.outpput file a error message and !! increment the error number (nstop) by one. !!---------------------------------------------------------------------- CHARACTER(len=*), INTENT(in), OPTIONAL :: cd1, cd2, cd3, cd4, cd5 CHARACTER(len=*), INTENT(in), OPTIONAL :: cd6, cd7, cd8, cd9, cd10 !!---------------------------------------------------------------------- ! nstop = nstop + 1 IF(lwp) THEN WRITE(numout,"(/,' ===>>> : E R R O R', /,' ===========',/)") IF( PRESENT(cd1 ) ) WRITE(numout,*) cd1 IF( PRESENT(cd2 ) ) WRITE(numout,*) cd2 IF( PRESENT(cd3 ) ) WRITE(numout,*) cd3 IF( PRESENT(cd4 ) ) WRITE(numout,*) cd4 IF( PRESENT(cd5 ) ) WRITE(numout,*) cd5 IF( PRESENT(cd6 ) ) WRITE(numout,*) cd6 IF( PRESENT(cd7 ) ) WRITE(numout,*) cd7 IF( PRESENT(cd8 ) ) WRITE(numout,*) cd8 IF( PRESENT(cd9 ) ) WRITE(numout,*) cd9 IF( PRESENT(cd10) ) WRITE(numout,*) cd10 ENDIF CALL FLUSH(numout) ! END SUBROUTINE ctl_stop SUBROUTINE ctl_warn( cd1, cd2, cd3, cd4, cd5, & & cd6, cd7, cd8, cd9, cd10 ) !!---------------------------------------------------------------------- !! *** ROUTINE stop_warn *** !! !! ** Purpose : print in ocean.outpput file a error message and !! increment the warning number (nwarn) by one. !!---------------------------------------------------------------------- CHARACTER(len=*), INTENT(in), OPTIONAL :: cd1, cd2, cd3, cd4, cd5 CHARACTER(len=*), INTENT(in), OPTIONAL :: cd6, cd7, cd8, cd9, cd10 !!---------------------------------------------------------------------- ! nwarn = nwarn + 1 IF(lwp) THEN WRITE(numout,"(/,' ===>>> : W A R N I N G', /,' ===============',/)") IF( PRESENT(cd1 ) ) WRITE(numout,*) cd1 IF( PRESENT(cd2 ) ) WRITE(numout,*) cd2 IF( PRESENT(cd3 ) ) WRITE(numout,*) cd3 IF( PRESENT(cd4 ) ) WRITE(numout,*) cd4 IF( PRESENT(cd5 ) ) WRITE(numout,*) cd5 IF( PRESENT(cd6 ) ) WRITE(numout,*) cd6 IF( PRESENT(cd7 ) ) WRITE(numout,*) cd7 IF( PRESENT(cd8 ) ) WRITE(numout,*) cd8 IF( PRESENT(cd9 ) ) WRITE(numout,*) cd9 IF( PRESENT(cd10) ) WRITE(numout,*) cd10 ENDIF CALL FLUSH(numout) ! END SUBROUTINE ctl_warn FUNCTION getunit() !!---------------------------------------------------------------------- !! *** FUNCTION getunit *** !! !! ** Purpose : return the index of an unused logical unit !!---------------------------------------------------------------------- INTEGER :: getunit LOGICAL :: llopn !!---------------------------------------------------------------------- ! getunit = 15 ! choose a unit that is big enough then it is not already used in NEMO llopn = .TRUE. DO WHILE( (getunit < 998) .AND. llopn ) getunit = getunit + 1 INQUIRE( unit = getunit, opened = llopn ) END DO IF( (getunit == 999) .AND. llopn ) THEN CALL ctl_stop( 'getunit: All logical units until 999 are used...' ) getunit = -1 ENDIF ! END FUNCTION getunit !!===================================================================== END MODULE in_out_manager