[544] | 1 | MODULE in_out_manager |
---|
| 2 | !!====================================================================== |
---|
| 3 | !! *** MODULE in_out_manager *** |
---|
| 4 | !! Ocean physics: vertical mixing coefficient compute from the tke |
---|
| 5 | !! turbulent closure parameterization |
---|
| 6 | !!===================================================================== |
---|
[1056] | 7 | !! History : 1.0 ! 2002-06 (G. Madec) original code |
---|
| 8 | !! 2.0 ! 2006-07 (S. Masson) iom, add ctl_stop, ctl_warn |
---|
| 9 | !! 3.0 ! 2008-06 (G. Madec) add ctmp4 to ctmp10 |
---|
[544] | 10 | !!---------------------------------------------------------------------- |
---|
| 11 | |
---|
| 12 | !!---------------------------------------------------------------------- |
---|
| 13 | !! ctl_stop : update momentum and tracer Kz from a tke scheme |
---|
| 14 | !! ctl_warn : initialization, namelist read, and parameters control |
---|
[1056] | 15 | !! getunit : give the index of an unused logical unit |
---|
[544] | 16 | !!---------------------------------------------------------------------- |
---|
[1056] | 17 | USE par_kind ! kind definition |
---|
| 18 | USE par_oce ! ocean parameter |
---|
| 19 | USE lib_print ! formated print library |
---|
[544] | 20 | |
---|
| 21 | IMPLICIT NONE |
---|
| 22 | PUBLIC |
---|
| 23 | |
---|
| 24 | !!---------------------------------------------------------------------- |
---|
| 25 | !! namrun namelist parameters |
---|
| 26 | !!---------------------------------------------------------------------- |
---|
[1229] | 27 | CHARACTER(len=16) :: cexper = "exp0" !: experiment name used for output filename |
---|
| 28 | CHARACTER(len=32) :: cn_ocerst_in = "restart" !: suffix of ocean restart name (input) |
---|
| 29 | CHARACTER(len=32) :: cn_ocerst_out = "restart" !: suffix of ocean restart name (output) |
---|
| 30 | LOGICAL :: ln_rstart = .FALSE. !: start from (F) rest or (T) a restart file |
---|
| 31 | INTEGER :: no = 0 !: job number |
---|
| 32 | INTEGER :: nrstdt = 0 !: control of the time step (0, 1 or 2) |
---|
| 33 | INTEGER :: nn_rstssh = 0 !: hand made initilization of ssh or not (1/0) |
---|
| 34 | INTEGER :: nit000 = 1 !: index of the first time step |
---|
| 35 | INTEGER :: nitend = 10 !: index of the last time step |
---|
| 36 | INTEGER :: ndate0 = 961115 !: initial calendar date aammjj |
---|
| 37 | INTEGER :: nleapy = 0 !: Leap year calendar flag (0/1 or 30) |
---|
| 38 | INTEGER :: ninist = 0 !: initial state output flag (0/1) |
---|
| 39 | LOGICAL :: ln_dimgnnn = .FALSE. !: type of dimgout. (F): 1 file for all proc |
---|
| 40 | !: (T): 1 file per proc |
---|
[1312] | 41 | LOGICAL :: ln_mskland = .FALSE. !: mask land points in NetCDF outputs (costly: + ~15%) |
---|
[544] | 42 | !!---------------------------------------------------------------------- |
---|
[557] | 43 | !! was in restart but moved here because of the OFF line... better solution should be found... |
---|
| 44 | !!---------------------------------------------------------------------- |
---|
| 45 | INTEGER :: nitrst !: time step at which restart file should be written |
---|
[1239] | 46 | #if defined key_zdftke2 |
---|
| 47 | INTEGER :: nitrst_tke2 !: time step at which restart file should be written |
---|
| 48 | #endif |
---|
[557] | 49 | !!---------------------------------------------------------------------- |
---|
[544] | 50 | !! output monitoring |
---|
| 51 | !!---------------------------------------------------------------------- |
---|
[556] | 52 | LOGICAL :: ln_ctl = .FALSE. !: run control for debugging |
---|
[547] | 53 | INTEGER :: nstock = 10 !: restart file frequency |
---|
[544] | 54 | INTEGER :: nprint = 0 !: level of print (0 no print) |
---|
[547] | 55 | INTEGER :: nwrite = 10 !: restart file frequency |
---|
[544] | 56 | INTEGER :: nictls = 0 !: Start i indice for the SUM control |
---|
| 57 | INTEGER :: nictle = 0 !: End i indice for the SUM control |
---|
| 58 | INTEGER :: njctls = 0 !: Start j indice for the SUM control |
---|
| 59 | INTEGER :: njctle = 0 !: End j indice for the SUM control |
---|
| 60 | INTEGER :: isplt = 1 !: number of processors following i |
---|
| 61 | INTEGER :: jsplt = 1 !: number of processors following j |
---|
| 62 | INTEGER :: ijsplt = 1 !: nb of local domain = nb of processors |
---|
[556] | 63 | INTEGER :: nbench = 0 !: benchmark parameter (0/1) |
---|
| 64 | INTEGER :: nbit_cmp = 0 !: bit reproducibility (0/1) |
---|
[544] | 65 | !!---------------------------------------------------------------------- |
---|
| 66 | !! logical units |
---|
| 67 | !!---------------------------------------------------------------------- |
---|
[624] | 68 | INTEGER :: numstp !: logical unit for time step |
---|
| 69 | INTEGER :: numout !: logical unit for output print |
---|
| 70 | INTEGER :: numnam !: logical unit for namelist |
---|
| 71 | INTEGER :: numnam_ice !: logical unit for ice namelist |
---|
| 72 | INTEGER :: numevo_ice !: logical unit for ice variables (temp. evolution) |
---|
| 73 | INTEGER :: numsol !: logical unit for solver statistics |
---|
| 74 | INTEGER :: numwri !: logical unit for output write |
---|
| 75 | INTEGER :: numisp !: logical unit for island statistics |
---|
| 76 | INTEGER :: numgap !: logical unit for differences diagnostic |
---|
| 77 | INTEGER :: numbol !: logical unit for "bol" diagnostics |
---|
| 78 | INTEGER :: numptr !: logical unit for Poleward TRansports |
---|
| 79 | INTEGER :: numflo !: logical unit for drifting floats |
---|
[544] | 80 | |
---|
| 81 | !!---------------------------------------------------------------------- |
---|
| 82 | !! Run control |
---|
| 83 | !!---------------------------------------------------------------------- |
---|
[631] | 84 | |
---|
[544] | 85 | INTEGER :: nstop = 0 !: error flag (=number of reason for a premature stop run) |
---|
| 86 | INTEGER :: nwarn = 0 !: warning flag (=number of warning found during the run) |
---|
[1056] | 87 | CHARACTER(len=200) :: ctmp1, ctmp2, ctmp3 !: temporary characters 1 to 3 |
---|
| 88 | CHARACTER(len=200) :: ctmp4, ctmp5, ctmp6 !: temporary characters 4 to 6 |
---|
| 89 | CHARACTER(len=200) :: ctmp7, ctmp8, ctmp9 !: temporary characters 7 to 9 |
---|
| 90 | CHARACTER(len=200) :: ctmp10 !: temporary character 10 |
---|
[544] | 91 | CHARACTER (len=64) :: cform_err = "(/,' ===>>> : E R R O R', /,' ===========',/)" !: |
---|
| 92 | CHARACTER (len=64) :: cform_war = "(/,' ===>>> : W A R N I N G', /,' ===============',/)" !: |
---|
| 93 | LOGICAL :: lwp !: boolean : true on the 1st processor only |
---|
| 94 | LOGICAL :: lsp_area = .TRUE. !: to make a control print over a specific area |
---|
| 95 | !!---------------------------------------------------------------------- |
---|
[1056] | 96 | !! NEMO/OPA 3.0 , LOCEAN-IPSL (2008) |
---|
[1146] | 97 | !! $Id$ |
---|
[544] | 98 | !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt) |
---|
| 99 | !!---------------------------------------------------------------------- |
---|
| 100 | |
---|
| 101 | CONTAINS |
---|
| 102 | |
---|
| 103 | SUBROUTINE ctl_stop( cd1, cd2, cd3, cd4, cd5, & |
---|
| 104 | & cd6, cd7, cd8, cd9, cd10 ) |
---|
[1056] | 105 | !!---------------------------------------------------------------------- |
---|
[544] | 106 | !! *** ROUTINE stop_opa *** |
---|
| 107 | !! |
---|
[1056] | 108 | !! ** Purpose : print in ocean.outpput file a error message and |
---|
| 109 | !! increment the error number (nstop) by one. |
---|
| 110 | !!---------------------------------------------------------------------- |
---|
[544] | 111 | CHARACTER(len=*), INTENT(in), OPTIONAL :: cd1, cd2, cd3, cd4, cd5 |
---|
| 112 | CHARACTER(len=*), INTENT(in), OPTIONAL :: cd6, cd7, cd8, cd9, cd10 |
---|
[1056] | 113 | !!---------------------------------------------------------------------- |
---|
[544] | 114 | ! |
---|
| 115 | nstop = nstop + 1 |
---|
| 116 | IF(lwp) THEN |
---|
| 117 | WRITE(numout,"(/,' ===>>> : E R R O R', /,' ===========',/)") |
---|
| 118 | IF( PRESENT(cd1 ) ) WRITE(numout,*) cd1 |
---|
| 119 | IF( PRESENT(cd2 ) ) WRITE(numout,*) cd2 |
---|
| 120 | IF( PRESENT(cd3 ) ) WRITE(numout,*) cd3 |
---|
| 121 | IF( PRESENT(cd4 ) ) WRITE(numout,*) cd4 |
---|
| 122 | IF( PRESENT(cd5 ) ) WRITE(numout,*) cd5 |
---|
| 123 | IF( PRESENT(cd6 ) ) WRITE(numout,*) cd6 |
---|
| 124 | IF( PRESENT(cd7 ) ) WRITE(numout,*) cd7 |
---|
| 125 | IF( PRESENT(cd8 ) ) WRITE(numout,*) cd8 |
---|
| 126 | IF( PRESENT(cd9 ) ) WRITE(numout,*) cd9 |
---|
| 127 | IF( PRESENT(cd10) ) WRITE(numout,*) cd10 |
---|
| 128 | ENDIF |
---|
| 129 | CALL FLUSH(numout) |
---|
| 130 | ! |
---|
| 131 | END SUBROUTINE ctl_stop |
---|
| 132 | |
---|
| 133 | |
---|
| 134 | SUBROUTINE ctl_warn( cd1, cd2, cd3, cd4, cd5, & |
---|
| 135 | & cd6, cd7, cd8, cd9, cd10 ) |
---|
[1056] | 136 | !!---------------------------------------------------------------------- |
---|
[544] | 137 | !! *** ROUTINE stop_warn *** |
---|
| 138 | !! |
---|
[1056] | 139 | !! ** Purpose : print in ocean.outpput file a error message and |
---|
| 140 | !! increment the warning number (nwarn) by one. |
---|
| 141 | !!---------------------------------------------------------------------- |
---|
[544] | 142 | CHARACTER(len=*), INTENT(in), OPTIONAL :: cd1, cd2, cd3, cd4, cd5 |
---|
| 143 | CHARACTER(len=*), INTENT(in), OPTIONAL :: cd6, cd7, cd8, cd9, cd10 |
---|
[1056] | 144 | !!---------------------------------------------------------------------- |
---|
[544] | 145 | ! |
---|
| 146 | nwarn = nwarn + 1 |
---|
| 147 | IF(lwp) THEN |
---|
| 148 | WRITE(numout,"(/,' ===>>> : W A R N I N G', /,' ===============',/)") |
---|
| 149 | IF( PRESENT(cd1 ) ) WRITE(numout,*) cd1 |
---|
| 150 | IF( PRESENT(cd2 ) ) WRITE(numout,*) cd2 |
---|
| 151 | IF( PRESENT(cd3 ) ) WRITE(numout,*) cd3 |
---|
| 152 | IF( PRESENT(cd4 ) ) WRITE(numout,*) cd4 |
---|
| 153 | IF( PRESENT(cd5 ) ) WRITE(numout,*) cd5 |
---|
| 154 | IF( PRESENT(cd6 ) ) WRITE(numout,*) cd6 |
---|
| 155 | IF( PRESENT(cd7 ) ) WRITE(numout,*) cd7 |
---|
| 156 | IF( PRESENT(cd8 ) ) WRITE(numout,*) cd8 |
---|
| 157 | IF( PRESENT(cd9 ) ) WRITE(numout,*) cd9 |
---|
| 158 | IF( PRESENT(cd10) ) WRITE(numout,*) cd10 |
---|
| 159 | ENDIF |
---|
| 160 | CALL FLUSH(numout) |
---|
| 161 | ! |
---|
| 162 | END SUBROUTINE ctl_warn |
---|
| 163 | |
---|
| 164 | |
---|
| 165 | FUNCTION getunit() |
---|
[1056] | 166 | !!---------------------------------------------------------------------- |
---|
| 167 | !! *** FUNCTION getunit *** |
---|
| 168 | !! |
---|
| 169 | !! ** Purpose : return the index of an unused logical unit |
---|
| 170 | !!---------------------------------------------------------------------- |
---|
| 171 | INTEGER :: getunit |
---|
| 172 | LOGICAL :: llopn |
---|
| 173 | !!---------------------------------------------------------------------- |
---|
| 174 | ! |
---|
| 175 | getunit = 15 ! choose a unit that is big enough then it is not already used in NEMO |
---|
| 176 | llopn = .TRUE. |
---|
| 177 | DO WHILE( (getunit < 998) .AND. llopn ) |
---|
| 178 | getunit = getunit + 1 |
---|
| 179 | INQUIRE( unit = getunit, opened = llopn ) |
---|
| 180 | END DO |
---|
| 181 | IF( (getunit == 999) .AND. llopn ) THEN |
---|
| 182 | CALL ctl_stop( 'getunit: All logical units until 999 are used...' ) |
---|
| 183 | getunit = -1 |
---|
| 184 | ENDIF |
---|
| 185 | ! |
---|
[544] | 186 | END FUNCTION getunit |
---|
| 187 | |
---|
| 188 | !!===================================================================== |
---|
| 189 | END MODULE in_out_manager |
---|