[325] | 1 | MODULE opa |
---|
[2444] | 2 | !!====================================================================== |
---|
[325] | 3 | !! *** MODULE opa *** |
---|
[2444] | 4 | !! Off-line Ocean : passive tracer evolution, dynamics read in files |
---|
| 5 | !!====================================================================== |
---|
| 6 | !! History : 3.3 ! 2010-05 (C. Ethe) Full reorganization of the off-line: phasing with the on-line |
---|
| 7 | !!---------------------------------------------------------------------- |
---|
[325] | 8 | |
---|
| 9 | !!---------------------------------------------------------------------- |
---|
[2444] | 10 | !! opa_model : off-line: solve ocean tracer only |
---|
| 11 | !! opa_init : initialization of the opa model |
---|
| 12 | !! opa_ctl : initialisation of algorithm flag |
---|
| 13 | !! opa_closefile : close remaining files |
---|
[325] | 14 | !!---------------------------------------------------------------------- |
---|
| 15 | USE dom_oce ! ocean space domain variables |
---|
| 16 | USE oce ! dynamics and tracers variables |
---|
[2444] | 17 | USE c1d ! 1D configuration |
---|
[325] | 18 | USE domcfg ! domain configuration (dom_cfg routine) |
---|
| 19 | USE domain ! domain initialization (dom_init routine) |
---|
| 20 | USE istate ! initial state setting (istate_init routine) |
---|
| 21 | USE eosbn2 ! equation of state (eos bn2 routine) |
---|
[2444] | 22 | ! ! ocean physics |
---|
[2053] | 23 | USE ldftra ! lateral diffusivity setting (ldf_tra_init routine) |
---|
| 24 | USE ldfslp ! slopes of neutral surfaces (ldf_slp_init routine) |
---|
| 25 | USE traqsr ! solar radiation penetration (tra_qsr_init routine) |
---|
| 26 | USE trabbl ! bottom boundary layer (tra_bbl_init routine) |
---|
[2444] | 27 | USE zdfini ! vertical physics: initialization |
---|
[325] | 28 | USE phycst ! physical constant (par_cst routine) |
---|
| 29 | USE dtadyn ! Lecture and Interpolation of the dynamical fields |
---|
[1014] | 30 | USE trcini ! Initilization of the passive tracers |
---|
[2053] | 31 | USE daymod ! calendar (day routine) |
---|
| 32 | USE trcstp ! passive tracer time-stepping (trc_stp routine) |
---|
| 33 | USE dtadyn ! Lecture and interpolation of the dynamical fields |
---|
| 34 | USE stpctl ! time stepping control (stp_ctl routine) |
---|
[2444] | 35 | ! ! I/O & MPP |
---|
| 36 | USE iom ! I/O library |
---|
| 37 | USE in_out_manager ! I/O manager |
---|
| 38 | USE mppini ! shared/distributed memory setting (mpp_init routine) |
---|
| 39 | USE lib_mpp ! distributed memory computing |
---|
[1450] | 40 | #if defined key_iomput |
---|
| 41 | USE mod_ioclient |
---|
| 42 | #endif |
---|
| 43 | |
---|
[325] | 44 | IMPLICIT NONE |
---|
| 45 | PRIVATE |
---|
[2444] | 46 | |
---|
| 47 | PUBLIC opa_model ! called by model.F90 |
---|
[325] | 48 | |
---|
[2444] | 49 | CHARACTER (len=64) :: cform_aaa="( /, 'AAAAAAAA', / ) " ! flag for output listing |
---|
[1325] | 50 | |
---|
[325] | 51 | !!---------------------------------------------------------------------- |
---|
[2287] | 52 | !! NEMO/OFF 3.3 , NEMO Consortium (2010) |
---|
| 53 | !! $Id$ |
---|
[2444] | 54 | !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) |
---|
[325] | 55 | !!---------------------------------------------------------------------- |
---|
| 56 | CONTAINS |
---|
| 57 | |
---|
| 58 | SUBROUTINE opa_model |
---|
| 59 | !!---------------------------------------------------------------------- |
---|
| 60 | !! *** ROUTINE opa *** |
---|
| 61 | !! |
---|
[1325] | 62 | !! ** Purpose : opa solves the primitive equations on an orthogonal |
---|
[325] | 63 | !! curvilinear mesh on the sphere. |
---|
| 64 | !! |
---|
| 65 | !! ** Method : - model general initialization |
---|
[2444] | 66 | !! - launch the time-stepping (dta_dyn and trc_stp) |
---|
| 67 | !! - finalize the run by closing files and communications |
---|
[325] | 68 | !! |
---|
[2444] | 69 | !! References : Madec, Delecluse,Imbard, and Levy, 1997: internal report, IPSL. |
---|
| 70 | !! Madec, 2008, internal report, IPSL. |
---|
[1325] | 71 | !!---------------------------------------------------------------------- |
---|
[2053] | 72 | INTEGER :: istp, indic ! time step index |
---|
[1325] | 73 | !!---------------------------------------------------------------------- |
---|
| 74 | |
---|
| 75 | CALL opa_init ! Initializations |
---|
| 76 | |
---|
| 77 | IF( lk_mpp ) CALL mpp_max( nstop ) |
---|
| 78 | |
---|
| 79 | ! check that all process are still there... If some process have an error, |
---|
| 80 | ! they will never enter in step and other processes will wait until the end of the cpu time! |
---|
| 81 | IF( lk_mpp ) CALL mpp_max( nstop ) |
---|
| 82 | |
---|
[2444] | 83 | ! !-----------------------! |
---|
| 84 | ! !== time stepping ==! |
---|
| 85 | ! !-----------------------! |
---|
[1325] | 86 | istp = nit000 |
---|
| 87 | ! |
---|
[2444] | 88 | DO WHILE ( istp <= nitend .AND. nstop == 0 ) ! time stepping |
---|
[2053] | 89 | ! |
---|
[2444] | 90 | IF( istp /= nit000 ) CALL day ( istp ) ! Calendar (day was already called at nit000 in day_init) |
---|
| 91 | CALL iom_setkt( istp ) ! say to iom that we are at time step kstp |
---|
| 92 | CALL dta_dyn ( istp ) ! Interpolation of the dynamical fields |
---|
| 93 | CALL trc_stp ( istp ) ! time-stepping |
---|
| 94 | CALL stp_ctl ( istp, indic ) ! Time loop: control and print |
---|
[1325] | 95 | istp = istp + 1 |
---|
| 96 | IF( lk_mpp ) CALL mpp_max( nstop ) |
---|
| 97 | END DO |
---|
| 98 | |
---|
[2444] | 99 | ! !------------------------! |
---|
| 100 | ! !== finalize the run ==! |
---|
| 101 | ! !------------------------! |
---|
| 102 | IF(lwp) WRITE(numout,cform_aaa) ! Flag AAAAAAA |
---|
[1325] | 103 | |
---|
| 104 | IF( nstop /= 0 .AND. lwp ) THEN ! error print |
---|
| 105 | WRITE(numout,cform_err) |
---|
| 106 | WRITE(numout,*) nstop, ' error have been found' |
---|
| 107 | ENDIF |
---|
[2444] | 108 | ! |
---|
[1325] | 109 | CALL opa_closefile |
---|
[2444] | 110 | ! |
---|
[1325] | 111 | IF( lk_mpp ) CALL mppstop ! Close all files (mpp) |
---|
| 112 | ! |
---|
| 113 | END SUBROUTINE opa_model |
---|
| 114 | |
---|
| 115 | |
---|
| 116 | SUBROUTINE opa_init |
---|
| 117 | !!---------------------------------------------------------------------- |
---|
| 118 | !! *** ROUTINE opa_init *** |
---|
[325] | 119 | !! |
---|
[2444] | 120 | !! ** Purpose : initialization of the opa model in off-line mode |
---|
[325] | 121 | !!---------------------------------------------------------------------- |
---|
[2444] | 122 | INTEGER :: ji ! dummy loop indices |
---|
| 123 | INTEGER :: ilocal_comm ! local integer |
---|
| 124 | CHARACTER(len=80), DIMENSION(10) :: cltxt = '' |
---|
[2053] | 125 | !! |
---|
| 126 | NAMELIST/namctl/ ln_ctl , nn_print, nn_ictls, nn_ictle, & |
---|
| 127 | & nn_isplt, nn_jsplt, nn_jctls, nn_jctle, nn_bench |
---|
[325] | 128 | !!---------------------------------------------------------------------- |
---|
[2053] | 129 | ! |
---|
| 130 | ! ! open Namelist file |
---|
| 131 | CALL ctl_opn( numnam, 'namelist', 'OLD', 'FORMATTED', 'SEQUENTIAL', -1, 6, .FALSE. ) |
---|
| 132 | ! |
---|
| 133 | READ( numnam, namctl ) ! Namelist namctl : Control prints & Benchmark |
---|
| 134 | ! |
---|
| 135 | ! !--------------------------------------------! |
---|
| 136 | ! ! set communicator & select the local node ! |
---|
| 137 | ! !--------------------------------------------! |
---|
| 138 | #if defined key_iomput |
---|
| 139 | CALL init_ioclient( ilocal_comm ) ! nemo local communicator (used or not) given by the io_server |
---|
| 140 | narea = mynode( cltxt, ilocal_comm ) ! Nodes selection |
---|
[1450] | 141 | #else |
---|
[2053] | 142 | narea = mynode( cltxt ) ! Nodes selection (control print return in cltxt) |
---|
[1450] | 143 | #endif |
---|
[2053] | 144 | narea = narea + 1 ! mynode return the rank of proc (0 --> jpnij -1 ) |
---|
[1450] | 145 | |
---|
[2053] | 146 | lwp = (narea == 1) .OR. ln_ctl ! control of all listing output print |
---|
[496] | 147 | |
---|
[2053] | 148 | IF(lwp) THEN ! open listing units |
---|
| 149 | ! |
---|
| 150 | CALL ctl_opn( numout, 'ocean.output', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, 6, .FALSE., narea ) |
---|
| 151 | ! |
---|
| 152 | WRITE(numout,*) |
---|
| 153 | WRITE(numout,*) ' CNRS - NERC - Met OFFICE - MERCATOR-ocean' |
---|
| 154 | WRITE(numout,*) ' NEMO team' |
---|
| 155 | WRITE(numout,*) ' Ocean General Circulation Model' |
---|
[2444] | 156 | WRITE(numout,*) ' version 3.3 (2010) ' |
---|
[2053] | 157 | WRITE(numout,*) |
---|
| 158 | WRITE(numout,*) |
---|
| 159 | DO ji = 1, SIZE(cltxt) |
---|
| 160 | IF( TRIM(cltxt(ji)) /= '' ) WRITE(numout,*) cltxt(ji) ! control print of mynode |
---|
| 161 | END DO |
---|
| 162 | WRITE(numout,cform_aaa) ! Flag AAAAAAA |
---|
| 163 | ! |
---|
[325] | 164 | ENDIF |
---|
[2444] | 165 | ! !--------------------------------! |
---|
| 166 | ! ! Model general initialization ! |
---|
| 167 | ! !--------------------------------! |
---|
[325] | 168 | |
---|
[2444] | 169 | CALL opa_ctl ! Control prints & Benchmark |
---|
[1450] | 170 | |
---|
[2444] | 171 | ! ! Domain decomposition |
---|
[2053] | 172 | IF( jpni*jpnj == jpnij ) THEN ; CALL mpp_init ! standard cutting out |
---|
| 173 | ELSE ; CALL mpp_init2 ! eliminate land processors |
---|
[325] | 174 | ENDIF |
---|
[2444] | 175 | ! |
---|
| 176 | ! ! General initialization |
---|
[2053] | 177 | CALL phy_cst ! Physical constants |
---|
| 178 | CALL eos_init ! Equation of state |
---|
| 179 | CALL dom_cfg ! Domain configuration |
---|
| 180 | CALL dom_init ! Domain |
---|
| 181 | CALL istate_init ! ocean initial state (Dynamics and tracers) |
---|
| 182 | |
---|
| 183 | ! ! Ocean physics |
---|
| 184 | #if ! defined key_degrad |
---|
| 185 | CALL ldf_tra_init ! Lateral ocean tracer physics |
---|
| 186 | #endif |
---|
| 187 | IF( lk_ldfslp ) CALL ldf_slp_init ! slope of lateral mixing |
---|
[2082] | 188 | |
---|
[2053] | 189 | ! ! Active tracers |
---|
| 190 | CALL tra_qsr_init ! penetrative solar radiation qsr |
---|
| 191 | IF( lk_trabbl ) CALL tra_bbl_init ! advective (and/or diffusive) bottom boundary layer scheme |
---|
| 192 | |
---|
[2082] | 193 | ! ! Passive tracers |
---|
| 194 | CALL trc_init ! Passive tracers initialization |
---|
| 195 | ! ! Dynamics |
---|
[2053] | 196 | CALL dta_dyn_init ! Initialization for the dynamics |
---|
| 197 | CALL iom_init ! iom_put initialization |
---|
| 198 | |
---|
[325] | 199 | IF(lwp) WRITE(numout,cform_aaa) ! Flag AAAAAAA |
---|
[2444] | 200 | ! |
---|
[1325] | 201 | END SUBROUTINE opa_init |
---|
[325] | 202 | |
---|
[2444] | 203 | |
---|
| 204 | SUBROUTINE opa_ctl |
---|
[1450] | 205 | !!---------------------------------------------------------------------- |
---|
[2444] | 206 | !! *** ROUTINE opa_ctl *** |
---|
[1450] | 207 | !! |
---|
[2444] | 208 | !! ** Purpose : control print setting |
---|
[1450] | 209 | !! |
---|
[2444] | 210 | !! ** Method : - print namctl information and check some consistencies |
---|
[1450] | 211 | !!---------------------------------------------------------------------- |
---|
[2444] | 212 | ! |
---|
| 213 | IF(lwp) THEN ! Parameter print |
---|
[1450] | 214 | WRITE(numout,*) |
---|
| 215 | WRITE(numout,*) 'opa_flg: Control prints & Benchmark' |
---|
| 216 | WRITE(numout,*) '~~~~~~~ ' |
---|
[2053] | 217 | WRITE(numout,*) ' Namelist namctl' |
---|
| 218 | WRITE(numout,*) ' run control (for debugging) ln_ctl = ', ln_ctl |
---|
| 219 | WRITE(numout,*) ' level of print nn_print = ', nn_print |
---|
| 220 | WRITE(numout,*) ' Start i indice for SUM control nn_ictls = ', nn_ictls |
---|
| 221 | WRITE(numout,*) ' End i indice for SUM control nn_ictle = ', nn_ictle |
---|
| 222 | WRITE(numout,*) ' Start j indice for SUM control nn_jctls = ', nn_jctls |
---|
| 223 | WRITE(numout,*) ' End j indice for SUM control nn_jctle = ', nn_jctle |
---|
| 224 | WRITE(numout,*) ' number of proc. following i nn_isplt = ', nn_isplt |
---|
| 225 | WRITE(numout,*) ' number of proc. following j nn_jsplt = ', nn_jsplt |
---|
| 226 | WRITE(numout,*) ' benchmark parameter (0/1) nn_bench = ', nn_bench |
---|
[1450] | 227 | ENDIF |
---|
[2444] | 228 | ! |
---|
[2053] | 229 | nprint = nn_print ! convert DOCTOR namelist names into OLD names |
---|
| 230 | nictls = nn_ictls |
---|
| 231 | nictle = nn_ictle |
---|
| 232 | njctls = nn_jctls |
---|
| 233 | njctle = nn_jctle |
---|
| 234 | isplt = nn_isplt |
---|
| 235 | jsplt = nn_jsplt |
---|
| 236 | nbench = nn_bench |
---|
[2444] | 237 | ! ! Parameter control |
---|
[2053] | 238 | ! |
---|
| 239 | IF( ln_ctl ) THEN ! sub-domain area indices for the control prints |
---|
| 240 | IF( lk_mpp ) THEN |
---|
| 241 | isplt = jpni ; jsplt = jpnj ; ijsplt = jpni*jpnj ! the domain is forced to the real splitted domain |
---|
[1450] | 242 | ELSE |
---|
| 243 | IF( isplt == 1 .AND. jsplt == 1 ) THEN |
---|
[2053] | 244 | CALL ctl_warn( ' - isplt & jsplt are equal to 1', & |
---|
| 245 | & ' - the print control will be done over the whole domain' ) |
---|
[1450] | 246 | ENDIF |
---|
[2053] | 247 | ijsplt = isplt * jsplt ! total number of processors ijsplt |
---|
[1450] | 248 | ENDIF |
---|
| 249 | IF(lwp) WRITE(numout,*)' - The total number of processors over which the' |
---|
| 250 | IF(lwp) WRITE(numout,*)' print control will be done is ijsplt : ', ijsplt |
---|
[2053] | 251 | ! |
---|
| 252 | ! ! indices used for the SUM control |
---|
| 253 | IF( nictls+nictle+njctls+njctle == 0 ) THEN ! print control done over the default area |
---|
[1450] | 254 | lsp_area = .FALSE. |
---|
[2053] | 255 | ELSE ! print control done over a specific area |
---|
[1450] | 256 | lsp_area = .TRUE. |
---|
| 257 | IF( nictls < 1 .OR. nictls > jpiglo ) THEN |
---|
| 258 | CALL ctl_warn( ' - nictls must be 1<=nictls>=jpiglo, it is forced to 1' ) |
---|
| 259 | nictls = 1 |
---|
| 260 | ENDIF |
---|
| 261 | IF( nictle < 1 .OR. nictle > jpiglo ) THEN |
---|
| 262 | CALL ctl_warn( ' - nictle must be 1<=nictle>=jpiglo, it is forced to jpiglo' ) |
---|
| 263 | nictle = jpiglo |
---|
| 264 | ENDIF |
---|
| 265 | IF( njctls < 1 .OR. njctls > jpjglo ) THEN |
---|
| 266 | CALL ctl_warn( ' - njctls must be 1<=njctls>=jpjglo, it is forced to 1' ) |
---|
| 267 | njctls = 1 |
---|
| 268 | ENDIF |
---|
| 269 | IF( njctle < 1 .OR. njctle > jpjglo ) THEN |
---|
| 270 | CALL ctl_warn( ' - njctle must be 1<=njctle>=jpjglo, it is forced to jpjglo' ) |
---|
| 271 | njctle = jpjglo |
---|
| 272 | ENDIF |
---|
[2053] | 273 | ENDIF |
---|
| 274 | ENDIF |
---|
[2444] | 275 | ! |
---|
[2053] | 276 | IF( nbench == 1 ) THEN ! Benchmark |
---|
[1450] | 277 | SELECT CASE ( cp_cfg ) |
---|
[2053] | 278 | CASE ( 'gyre' ) ; CALL ctl_warn( ' The Benchmark is activated ' ) |
---|
| 279 | CASE DEFAULT ; CALL ctl_stop( ' The Benchmark is based on the GYRE configuration:', & |
---|
| 280 | & ' key_gyre must be used or set nbench = 0' ) |
---|
[1450] | 281 | END SELECT |
---|
| 282 | ENDIF |
---|
[2431] | 283 | ! |
---|
[2444] | 284 | IF( lk_c1d .AND. .NOT.lk_iomput ) CALL ctl_stop( 'opa_ctl: The 1D configuration must be used ', & |
---|
| 285 | & 'with the IOM Input/Output manager. ' , & |
---|
| 286 | & 'Compile with key_iomput enabled' ) |
---|
[2431] | 287 | ! |
---|
[2444] | 288 | END SUBROUTINE opa_ctl |
---|
[1450] | 289 | |
---|
| 290 | |
---|
[1325] | 291 | SUBROUTINE opa_closefile |
---|
| 292 | !!---------------------------------------------------------------------- |
---|
| 293 | !! *** ROUTINE opa_closefile *** |
---|
| 294 | !! |
---|
| 295 | !! ** Purpose : Close the files |
---|
| 296 | !!---------------------------------------------------------------------- |
---|
[2444] | 297 | ! |
---|
[1325] | 298 | IF ( lk_mpp ) CALL mppsync |
---|
[2444] | 299 | ! |
---|
| 300 | CALL iom_close ! close all input/output files managed by iom_* |
---|
| 301 | ! |
---|
| 302 | IF( numstp /= -1 ) CLOSE( numstp ) ! time-step file |
---|
| 303 | IF( numnam /= -1 ) CLOSE( numnam ) ! oce namelist |
---|
| 304 | IF( numout /= 6 ) CLOSE( numout ) ! standard model output file |
---|
| 305 | numout = 6 ! redefine numout in case it is used after this point... |
---|
| 306 | ! |
---|
[1325] | 307 | END SUBROUTINE opa_closefile |
---|
| 308 | |
---|
[325] | 309 | !!====================================================================== |
---|
| 310 | END MODULE opa |
---|