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