[11637] | 1 | MODULE nemogcm |
---|
| 2 | !!====================================================================== |
---|
| 3 | !! *** MODULE nemogcm *** |
---|
| 4 | !! StandAlone Surface module : surface fluxes |
---|
| 5 | !!====================================================================== |
---|
| 6 | !! History : 3.6 ! 2011-11 (S. Alderson, G. Madec) original code |
---|
[11831] | 7 | !! - ! 2013-06 (I. Epicoco, S. Mocavero, CMCC) nemo_northcomms: setup avoiding MPI communication |
---|
[11637] | 8 | !! - ! 2014-12 (G. Madec) remove KPP scheme and cross-land advection (cla) |
---|
| 9 | !! 4.0 ! 2016-10 (G. Madec, S. Flavoni) domain configuration / user defined interface |
---|
[12249] | 10 | !! 4.x ! 2019-12 (L. Brodeau) STATION_ASF test-case |
---|
[11637] | 11 | !!---------------------------------------------------------------------- |
---|
| 12 | |
---|
| 13 | !!---------------------------------------------------------------------- |
---|
[11831] | 14 | !! nemo_gcm : solve ocean dynamics, tracer, biogeochemistry and/or sea-ice |
---|
[11637] | 15 | !! nemo_init : initialization of the NEMO system |
---|
| 16 | !! nemo_ctl : initialisation of the contol print |
---|
| 17 | !! nemo_closefile: close remaining open files |
---|
| 18 | !! nemo_alloc : dynamical allocation |
---|
| 19 | !!---------------------------------------------------------------------- |
---|
[11831] | 20 | USE step_oce ! module used in the ocean time stepping module (step.F90) |
---|
[12249] | 21 | USE sbc_oce ! surface boundary condition: ocean #LB: rm? |
---|
[11637] | 22 | USE phycst ! physical constant (par_cst routine) |
---|
| 23 | USE domain ! domain initialization (dom_init & dom_cfg routines) |
---|
| 24 | USE closea ! treatment of closed seas (for ln_closea) |
---|
| 25 | USE usrdef_nam ! user defined configuration |
---|
[12249] | 26 | USE step, ONLY : Nbb, Nnn, Naa, Nrhs ! time level indices |
---|
[11637] | 27 | USE daymod ! calendar |
---|
| 28 | USE restart ! open restart file |
---|
| 29 | !LB:USE step ! NEMO time-stepping (stp routine) |
---|
| 30 | USE c1d ! 1D configuration |
---|
| 31 | USE step_c1d ! Time stepping loop for the 1D configuration |
---|
| 32 | USE sbcssm ! |
---|
| 33 | ! |
---|
| 34 | USE lib_mpp ! distributed memory computing |
---|
| 35 | USE mppini ! shared/distributed memory setting (mpp_init routine) |
---|
| 36 | USE lib_fortran ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined) |
---|
| 37 | #if defined key_iomput |
---|
| 38 | USE xios ! xIOserver |
---|
| 39 | #endif |
---|
| 40 | |
---|
| 41 | IMPLICIT NONE |
---|
| 42 | PRIVATE |
---|
| 43 | |
---|
| 44 | PUBLIC nemo_gcm ! called by model.F90 |
---|
| 45 | PUBLIC nemo_init ! needed by AGRIF |
---|
| 46 | |
---|
| 47 | CHARACTER(lc) :: cform_aaa="( /, 'AAAAAAAA', / ) " ! flag for output listing |
---|
| 48 | |
---|
| 49 | !!---------------------------------------------------------------------- |
---|
[11831] | 50 | !! NEMO/OCE 4.0 , NEMO Consortium (2018) |
---|
| 51 | !! $Id: nemogcm.F90 11536 2019-09-11 13:54:18Z smasson $ |
---|
[11637] | 52 | !! Software governed by the CeCILL license (see ./LICENSE) |
---|
| 53 | !!---------------------------------------------------------------------- |
---|
| 54 | CONTAINS |
---|
| 55 | |
---|
| 56 | SUBROUTINE nemo_gcm |
---|
| 57 | !!---------------------------------------------------------------------- |
---|
| 58 | !! *** ROUTINE nemo_gcm *** |
---|
| 59 | !! |
---|
| 60 | !! ** Purpose : NEMO solves the primitive equations on an orthogonal |
---|
| 61 | !! curvilinear mesh on the sphere. |
---|
| 62 | !! |
---|
| 63 | !! ** Method : - model general initialization |
---|
| 64 | !! - launch the time-stepping (stp routine) |
---|
| 65 | !! - finalize the run by closing files and communications |
---|
| 66 | !! |
---|
| 67 | !! References : Madec, Delecluse, Imbard, and Levy, 1997: internal report, IPSL. |
---|
| 68 | !! Madec, 2008, internal report, IPSL. |
---|
| 69 | !!---------------------------------------------------------------------- |
---|
| 70 | INTEGER :: istp ! time step index |
---|
[11831] | 71 | REAL(wp):: zstptiming ! elapsed time for 1 time step |
---|
[11637] | 72 | !!---------------------------------------------------------------------- |
---|
| 73 | ! |
---|
| 74 | ! !-----------------------! |
---|
| 75 | CALL nemo_init !== Initialisations ==! |
---|
| 76 | ! !-----------------------! |
---|
| 77 | ! check that all process are still there... If some process have an error, |
---|
| 78 | ! they will never enter in step and other processes will wait until the end of the cpu time! |
---|
| 79 | CALL mpp_max( 'nemogcm', nstop ) |
---|
| 80 | |
---|
| 81 | IF(lwp) WRITE(numout,cform_aaa) ! Flag AAAAAAA |
---|
| 82 | |
---|
| 83 | ! !-----------------------! |
---|
| 84 | ! !== time stepping ==! |
---|
| 85 | ! !-----------------------! |
---|
| 86 | istp = nit000 |
---|
| 87 | ! |
---|
| 88 | DO WHILE ( istp <= nitend .AND. nstop == 0 ) !== C1D time-stepping ==! |
---|
| 89 | CALL stp_c1d( istp ) |
---|
| 90 | istp = istp + 1 |
---|
| 91 | END DO |
---|
| 92 | ! |
---|
| 93 | ! !------------------------! |
---|
| 94 | ! !== finalize the run ==! |
---|
| 95 | ! !------------------------! |
---|
| 96 | IF(lwp) WRITE(numout,cform_aaa) ! Flag AAAAAAA |
---|
| 97 | ! |
---|
| 98 | IF( nstop /= 0 .AND. lwp ) THEN ! error print |
---|
[11831] | 99 | WRITE(ctmp1,*) ' ==>>> nemo_gcm: a total of ', nstop, ' errors have been found' |
---|
| 100 | CALL ctl_stop( ctmp1 ) |
---|
[11637] | 101 | ENDIF |
---|
| 102 | ! |
---|
| 103 | IF( ln_timing ) CALL timing_finalize |
---|
| 104 | ! |
---|
| 105 | CALL nemo_closefile |
---|
| 106 | ! |
---|
| 107 | #if defined key_iomput |
---|
[11831] | 108 | CALL xios_finalize ! end mpp communications with xios |
---|
[11637] | 109 | #else |
---|
[11831] | 110 | IF( lk_mpp ) THEN ; CALL mppstop ! end mpp communications |
---|
[11637] | 111 | ENDIF |
---|
| 112 | #endif |
---|
| 113 | ! |
---|
| 114 | IF(lwm) THEN |
---|
| 115 | IF( nstop == 0 ) THEN ; STOP 0 |
---|
[11831] | 116 | ELSE ; STOP 123 |
---|
[11637] | 117 | ENDIF |
---|
| 118 | ENDIF |
---|
| 119 | ! |
---|
| 120 | END SUBROUTINE nemo_gcm |
---|
| 121 | |
---|
| 122 | |
---|
| 123 | SUBROUTINE nemo_init |
---|
| 124 | !!---------------------------------------------------------------------- |
---|
| 125 | !! *** ROUTINE nemo_init *** |
---|
| 126 | !! |
---|
| 127 | !! ** Purpose : initialization of the NEMO GCM |
---|
| 128 | !!---------------------------------------------------------------------- |
---|
[11831] | 129 | INTEGER :: ios, ilocal_comm ! local integers |
---|
[11637] | 130 | !! |
---|
[12249] | 131 | NAMELIST/namctl/ sn_cfctl, nn_print, nn_ictls, nn_ictle, & |
---|
[11637] | 132 | & nn_isplt , nn_jsplt, nn_jctls, nn_jctle, & |
---|
| 133 | & ln_timing, ln_diacfl |
---|
| 134 | NAMELIST/namcfg/ ln_read_cfg, cn_domcfg, ln_closea, ln_write_cfg, cn_domcfg_out, ln_use_jattr |
---|
| 135 | !!---------------------------------------------------------------------- |
---|
| 136 | ! |
---|
| 137 | cxios_context = 'nemo' |
---|
| 138 | ! |
---|
[11831] | 139 | ! !-------------------------------------------------! |
---|
| 140 | ! ! set communicator & select the local rank ! |
---|
| 141 | ! ! must be done as soon as possible to get narea ! |
---|
| 142 | ! !-------------------------------------------------! |
---|
[11637] | 143 | ! |
---|
[11831] | 144 | #if defined key_iomput |
---|
| 145 | IF( Agrif_Root() ) THEN |
---|
[12249] | 146 | CALL xios_initialize( "for_xios_mpi_id", return_comm=ilocal_comm ) ! nemo local communicator given by xios |
---|
[11831] | 147 | ENDIF |
---|
| 148 | CALL mpp_start( ilocal_comm ) |
---|
| 149 | #else |
---|
[12249] | 150 | CALL mpp_start( ) |
---|
[11831] | 151 | #endif |
---|
| 152 | ! |
---|
| 153 | narea = mpprank + 1 ! mpprank: the rank of proc (0 --> mppsize -1 ) |
---|
| 154 | lwm = (narea == 1) ! control of output namelists |
---|
| 155 | ! |
---|
| 156 | ! !---------------------------------------------------------------! |
---|
| 157 | ! ! Open output files, reference and configuration namelist files ! |
---|
| 158 | ! !---------------------------------------------------------------! |
---|
| 159 | ! |
---|
| 160 | ! open ocean.output as soon as possible to get all output prints (including errors messages) |
---|
| 161 | IF( lwm ) CALL ctl_opn( numout, 'ocean.output', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) |
---|
| 162 | ! open reference and configuration namelist files |
---|
[12249] | 163 | CALL load_nml( numnam_ref, 'namelist_ref', -1, lwm ) |
---|
| 164 | CALL load_nml( numnam_cfg, 'namelist_cfg', -1, lwm ) |
---|
[11831] | 165 | IF( lwm ) CALL ctl_opn( numond, 'output.namelist.dyn', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) |
---|
| 166 | ! open /dev/null file to be able to supress output write easily |
---|
| 167 | CALL ctl_opn( numnul, '/dev/null', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) |
---|
| 168 | ! |
---|
| 169 | ! !--------------------! |
---|
[12249] | 170 | ! ! Open listing units ! -> need sn_cfctl from namctl to define lwp |
---|
[11831] | 171 | ! !--------------------! |
---|
| 172 | ! |
---|
[11637] | 173 | READ ( numnam_ref, namctl, IOSTAT = ios, ERR = 901 ) |
---|
[11831] | 174 | 901 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namctl in reference namelist' ) |
---|
[11637] | 175 | READ ( numnam_cfg, namctl, IOSTAT = ios, ERR = 902 ) |
---|
[11831] | 176 | 902 IF( ios > 0 ) CALL ctl_nam ( ios , 'namctl in configuration namelist' ) |
---|
[11637] | 177 | ! |
---|
[12254] | 178 | ! finalize the definition of namctl variables |
---|
| 179 | IF( sn_cfctl%l_allon ) THEN |
---|
| 180 | ! Turn on all options. |
---|
| 181 | CALL nemo_set_cfctl( sn_cfctl, .TRUE., .TRUE. ) |
---|
| 182 | ! Ensure all processors are active |
---|
| 183 | sn_cfctl%procmin = 0 ; sn_cfctl%procmax = 1000000 ; sn_cfctl%procincr = 1 |
---|
| 184 | ELSEIF( sn_cfctl%l_config ) THEN |
---|
| 185 | ! Activate finer control of report outputs |
---|
| 186 | ! optionally switch off output from selected areas (note this only |
---|
| 187 | ! applies to output which does not involve global communications) |
---|
| 188 | IF( ( narea < sn_cfctl%procmin .OR. narea > sn_cfctl%procmax ) .OR. & |
---|
| 189 | & ( MOD( narea - sn_cfctl%procmin, sn_cfctl%procincr ) /= 0 ) ) & |
---|
| 190 | & CALL nemo_set_cfctl( sn_cfctl, .FALSE., .FALSE. ) |
---|
| 191 | ELSE |
---|
| 192 | ! turn off all options. |
---|
| 193 | CALL nemo_set_cfctl( sn_cfctl, .FALSE., .TRUE. ) |
---|
| 194 | ENDIF |
---|
| 195 | ! |
---|
[12249] | 196 | lwp = (narea == 1) .OR. sn_cfctl%l_oceout ! control of all listing output print |
---|
[11637] | 197 | ! |
---|
[11831] | 198 | IF(lwp) THEN ! open listing units |
---|
[11637] | 199 | ! |
---|
[11831] | 200 | IF( .NOT. lwm ) & ! alreay opened for narea == 1 |
---|
| 201 | & CALL ctl_opn( numout, 'ocean.output', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE., narea ) |
---|
[11637] | 202 | ! |
---|
| 203 | WRITE(numout,*) |
---|
[11831] | 204 | WRITE(numout,*) ' CNRS - NERC - Met OFFICE - MERCATOR-ocean - CMCC' |
---|
[11637] | 205 | WRITE(numout,*) ' NEMO team' |
---|
| 206 | WRITE(numout,*) ' Ocean General Circulation Model' |
---|
| 207 | WRITE(numout,*) ' NEMO version 4.0 (2019) ' |
---|
[11831] | 208 | WRITE(numout,*) ' STATION_ASF ' |
---|
[11637] | 209 | WRITE(numout,*) " ._ ._ ._ ._ ._ " |
---|
| 210 | WRITE(numout,*) " _.-._)`\_.-._)`\_.-._)`\_.-._)`\_.-._)`\_ " |
---|
| 211 | WRITE(numout,*) |
---|
| 212 | WRITE(numout,*) " o _, _, " |
---|
| 213 | WRITE(numout,*) " o .' ( .-' / " |
---|
| 214 | WRITE(numout,*) " o _/..._'. .' / " |
---|
| 215 | WRITE(numout,*) " ( o .-'` ` '-./ _.' " |
---|
| 216 | WRITE(numout,*) " ) ( o) ;= <_ ( " |
---|
| 217 | WRITE(numout,*) " ( '-.,\\__ __.-;`\ '. ) " |
---|
| 218 | WRITE(numout,*) " ) ) \) |`\ \) '. \ ( ( " |
---|
| 219 | WRITE(numout,*) " ( ( \_/ '-._\ ) ) " |
---|
| 220 | WRITE(numout,*) " ) ) jgs ` ( ( " |
---|
| 221 | WRITE(numout,*) " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ " |
---|
| 222 | WRITE(numout,*) |
---|
| 223 | ! |
---|
| 224 | WRITE(numout,cform_aaa) ! Flag AAAAAAA |
---|
| 225 | ! |
---|
| 226 | ENDIF |
---|
| 227 | ! |
---|
[11831] | 228 | IF(lwm) WRITE( numond, namctl ) |
---|
| 229 | ! |
---|
| 230 | ! !------------------------------------! |
---|
| 231 | ! ! Set global domain size parameters ! |
---|
| 232 | ! !------------------------------------! |
---|
| 233 | ! |
---|
| 234 | READ ( numnam_ref, namcfg, IOSTAT = ios, ERR = 903 ) |
---|
| 235 | 903 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namcfg in reference namelist' ) |
---|
| 236 | READ ( numnam_cfg, namcfg, IOSTAT = ios, ERR = 904 ) |
---|
| 237 | 904 IF( ios > 0 ) CALL ctl_nam ( ios , 'namcfg in configuration namelist' ) |
---|
| 238 | ! |
---|
| 239 | IF( ln_read_cfg ) THEN ! Read sizes in domain configuration file |
---|
| 240 | CALL domain_cfg ( cn_cfg, nn_cfg, jpiglo, jpjglo, jpkglo, jperio ) |
---|
| 241 | ELSE ! user-defined namelist |
---|
| 242 | CALL usr_def_nam( cn_cfg, nn_cfg, jpiglo, jpjglo, jpkglo, jperio ) |
---|
| 243 | ENDIF |
---|
| 244 | ! |
---|
| 245 | IF(lwm) WRITE( numond, namcfg ) |
---|
| 246 | ! |
---|
| 247 | ! !-----------------------------------------! |
---|
| 248 | ! ! mpp parameters and domain decomposition ! |
---|
| 249 | ! !-----------------------------------------! |
---|
| 250 | CALL mpp_init |
---|
[11637] | 251 | |
---|
| 252 | ! Now we know the dimensions of the grid and numout has been set: we can allocate arrays |
---|
| 253 | CALL nemo_alloc() |
---|
| 254 | |
---|
[12249] | 255 | ! Initialise time level indices |
---|
| 256 | Nbb = 1; Nnn = 2; Naa = 3; Nrhs = Naa |
---|
| 257 | |
---|
[11637] | 258 | ! !-------------------------------! |
---|
| 259 | ! ! NEMO general initialization ! |
---|
| 260 | ! !-------------------------------! |
---|
| 261 | |
---|
| 262 | CALL nemo_ctl ! Control prints |
---|
| 263 | ! |
---|
| 264 | ! ! General initialization |
---|
| 265 | IF( ln_timing ) CALL timing_init ! timing |
---|
| 266 | IF( ln_timing ) CALL timing_start( 'nemo_init') |
---|
| 267 | ! |
---|
[11831] | 268 | CALL phy_cst ! Physical constants |
---|
| 269 | CALL eos_init ! Equation of state |
---|
| 270 | IF( lk_c1d ) CALL c1d_init ! 1D column configuration |
---|
[12249] | 271 | CALL dom_init( Nbb, Nnn, Naa, "OPA") ! Domain |
---|
| 272 | IF( sn_cfctl%l_prtctl ) & |
---|
| 273 | & CALL prt_ctl_init ! Print control |
---|
[11831] | 274 | |
---|
[12249] | 275 | IF( ln_rstart ) THEN ! Restart from a file |
---|
| 276 | ! ! ------------------- |
---|
| 277 | CALL rst_read( Nbb, Nnn ) ! Read the restart file |
---|
| 278 | CALL day_init ! model calendar (using both namelist and restart infos) |
---|
| 279 | ! |
---|
| 280 | ELSE ! Start from rest |
---|
| 281 | ! ! --------------- |
---|
| 282 | numror = 0 ! define numror = 0 -> no restart file to read |
---|
| 283 | neuler = 0 ! Set time-step indicator at nit000 (euler forward) |
---|
| 284 | CALL day_init ! model calendar (using both namelist and restart infos) |
---|
| 285 | ENDIF |
---|
| 286 | ! |
---|
[11637] | 287 | |
---|
[11831] | 288 | ! ! external forcing |
---|
[12249] | 289 | CALL sbc_init( Nbb, Nnn, Naa ) ! surface boundary conditions (including sea-ice) |
---|
[11637] | 290 | |
---|
| 291 | ! |
---|
| 292 | IF(lwp) WRITE(numout,cform_aaa) ! Flag AAAAAAA |
---|
| 293 | ! |
---|
| 294 | IF( ln_timing ) CALL timing_stop( 'nemo_init') |
---|
| 295 | ! |
---|
| 296 | END SUBROUTINE nemo_init |
---|
| 297 | |
---|
| 298 | |
---|
| 299 | SUBROUTINE nemo_ctl |
---|
| 300 | !!---------------------------------------------------------------------- |
---|
| 301 | !! *** ROUTINE nemo_ctl *** |
---|
| 302 | !! |
---|
| 303 | !! ** Purpose : control print setting |
---|
| 304 | !! |
---|
[11831] | 305 | !! ** Method : - print namctl and namcfg information and check some consistencies |
---|
[11637] | 306 | !!---------------------------------------------------------------------- |
---|
| 307 | ! |
---|
| 308 | IF(lwp) THEN ! control print |
---|
| 309 | WRITE(numout,*) |
---|
| 310 | WRITE(numout,*) 'nemo_ctl: Control prints' |
---|
| 311 | WRITE(numout,*) '~~~~~~~~' |
---|
| 312 | WRITE(numout,*) ' Namelist namctl' |
---|
[12249] | 313 | WRITE(numout,*) ' sn_cfctl%l_glochk = ', sn_cfctl%l_glochk |
---|
| 314 | WRITE(numout,*) ' sn_cfctl%l_allon = ', sn_cfctl%l_allon |
---|
[11637] | 315 | WRITE(numout,*) ' finer control over o/p sn_cfctl%l_config = ', sn_cfctl%l_config |
---|
| 316 | WRITE(numout,*) ' sn_cfctl%l_runstat = ', sn_cfctl%l_runstat |
---|
| 317 | WRITE(numout,*) ' sn_cfctl%l_trcstat = ', sn_cfctl%l_trcstat |
---|
| 318 | WRITE(numout,*) ' sn_cfctl%l_oceout = ', sn_cfctl%l_oceout |
---|
| 319 | WRITE(numout,*) ' sn_cfctl%l_layout = ', sn_cfctl%l_layout |
---|
[12249] | 320 | WRITE(numout,*) ' sn_cfctl%l_prtctl = ', sn_cfctl%l_prtctl |
---|
| 321 | WRITE(numout,*) ' sn_cfctl%l_prttrc = ', sn_cfctl%l_prttrc |
---|
| 322 | WRITE(numout,*) ' sn_cfctl%l_oasout = ', sn_cfctl%l_oasout |
---|
[11831] | 323 | WRITE(numout,*) ' sn_cfctl%procmin = ', sn_cfctl%procmin |
---|
| 324 | WRITE(numout,*) ' sn_cfctl%procmax = ', sn_cfctl%procmax |
---|
| 325 | WRITE(numout,*) ' sn_cfctl%procincr = ', sn_cfctl%procincr |
---|
| 326 | WRITE(numout,*) ' sn_cfctl%ptimincr = ', sn_cfctl%ptimincr |
---|
[11637] | 327 | WRITE(numout,*) ' level of print nn_print = ', nn_print |
---|
| 328 | WRITE(numout,*) ' Start i indice for SUM control nn_ictls = ', nn_ictls |
---|
| 329 | WRITE(numout,*) ' End i indice for SUM control nn_ictle = ', nn_ictle |
---|
| 330 | WRITE(numout,*) ' Start j indice for SUM control nn_jctls = ', nn_jctls |
---|
| 331 | WRITE(numout,*) ' End j indice for SUM control nn_jctle = ', nn_jctle |
---|
| 332 | WRITE(numout,*) ' number of proc. following i nn_isplt = ', nn_isplt |
---|
| 333 | WRITE(numout,*) ' number of proc. following j nn_jsplt = ', nn_jsplt |
---|
| 334 | WRITE(numout,*) ' timing by routine ln_timing = ', ln_timing |
---|
| 335 | WRITE(numout,*) ' CFL diagnostics ln_diacfl = ', ln_diacfl |
---|
| 336 | ENDIF |
---|
| 337 | ! |
---|
| 338 | nprint = nn_print ! convert DOCTOR namelist names into OLD names |
---|
| 339 | nictls = nn_ictls |
---|
| 340 | nictle = nn_ictle |
---|
| 341 | njctls = nn_jctls |
---|
| 342 | njctle = nn_jctle |
---|
| 343 | isplt = nn_isplt |
---|
| 344 | jsplt = nn_jsplt |
---|
| 345 | |
---|
| 346 | IF(lwp) THEN ! control print |
---|
| 347 | WRITE(numout,*) |
---|
| 348 | WRITE(numout,*) ' Namelist namcfg' |
---|
| 349 | WRITE(numout,*) ' read domain configuration file ln_read_cfg = ', ln_read_cfg |
---|
| 350 | WRITE(numout,*) ' filename to be read cn_domcfg = ', TRIM(cn_domcfg) |
---|
| 351 | WRITE(numout,*) ' keep closed seas in the domain (if exist) ln_closea = ', ln_closea |
---|
| 352 | WRITE(numout,*) ' create a configuration definition file ln_write_cfg = ', ln_write_cfg |
---|
| 353 | WRITE(numout,*) ' filename to be written cn_domcfg_out = ', TRIM(cn_domcfg_out) |
---|
| 354 | WRITE(numout,*) ' use file attribute if exists as i/p j-start ln_use_jattr = ', ln_use_jattr |
---|
| 355 | ENDIF |
---|
| 356 | IF( .NOT.ln_read_cfg ) ln_closea = .false. ! dealing possible only with a domcfg file |
---|
| 357 | ! |
---|
| 358 | ! ! Parameter control |
---|
| 359 | ! |
---|
[12249] | 360 | IF( sn_cfctl%l_prtctl .OR. sn_cfctl%l_prttrc ) THEN ! sub-domain area indices for the control prints |
---|
[11637] | 361 | IF( lk_mpp .AND. jpnij > 1 ) THEN |
---|
| 362 | isplt = jpni ; jsplt = jpnj ; ijsplt = jpni*jpnj ! the domain is forced to the real split domain |
---|
| 363 | ELSE |
---|
| 364 | IF( isplt == 1 .AND. jsplt == 1 ) THEN |
---|
| 365 | CALL ctl_warn( ' - isplt & jsplt are equal to 1', & |
---|
| 366 | & ' - the print control will be done over the whole domain' ) |
---|
| 367 | ENDIF |
---|
| 368 | ijsplt = isplt * jsplt ! total number of processors ijsplt |
---|
| 369 | ENDIF |
---|
| 370 | IF(lwp) WRITE(numout,*)' - The total number of processors over which the' |
---|
| 371 | IF(lwp) WRITE(numout,*)' print control will be done is ijsplt : ', ijsplt |
---|
| 372 | ! |
---|
| 373 | ! ! indices used for the SUM control |
---|
| 374 | IF( nictls+nictle+njctls+njctle == 0 ) THEN ! print control done over the default area |
---|
| 375 | lsp_area = .FALSE. |
---|
| 376 | ELSE ! print control done over a specific area |
---|
| 377 | lsp_area = .TRUE. |
---|
| 378 | IF( nictls < 1 .OR. nictls > jpiglo ) THEN |
---|
| 379 | CALL ctl_warn( ' - nictls must be 1<=nictls>=jpiglo, it is forced to 1' ) |
---|
| 380 | nictls = 1 |
---|
| 381 | ENDIF |
---|
| 382 | IF( nictle < 1 .OR. nictle > jpiglo ) THEN |
---|
| 383 | CALL ctl_warn( ' - nictle must be 1<=nictle>=jpiglo, it is forced to jpiglo' ) |
---|
| 384 | nictle = jpiglo |
---|
| 385 | ENDIF |
---|
| 386 | IF( njctls < 1 .OR. njctls > jpjglo ) THEN |
---|
| 387 | CALL ctl_warn( ' - njctls must be 1<=njctls>=jpjglo, it is forced to 1' ) |
---|
| 388 | njctls = 1 |
---|
| 389 | ENDIF |
---|
| 390 | IF( njctle < 1 .OR. njctle > jpjglo ) THEN |
---|
| 391 | CALL ctl_warn( ' - njctle must be 1<=njctle>=jpjglo, it is forced to jpjglo' ) |
---|
| 392 | njctle = jpjglo |
---|
| 393 | ENDIF |
---|
| 394 | ENDIF |
---|
| 395 | ENDIF |
---|
| 396 | ! |
---|
| 397 | IF( 1._wp /= SIGN(1._wp,-0._wp) ) CALL ctl_stop( 'nemo_ctl: The intrinsec SIGN function follows f2003 standard.', & |
---|
| 398 | & 'Compile with key_nosignedzero enabled:', & |
---|
| 399 | & '--> add -Dkey_nosignedzero to the definition of %CPP in your arch file' ) |
---|
| 400 | ! |
---|
| 401 | END SUBROUTINE nemo_ctl |
---|
| 402 | |
---|
| 403 | |
---|
| 404 | SUBROUTINE nemo_closefile |
---|
| 405 | !!---------------------------------------------------------------------- |
---|
| 406 | !! *** ROUTINE nemo_closefile *** |
---|
| 407 | !! |
---|
| 408 | !! ** Purpose : Close the files |
---|
| 409 | !!---------------------------------------------------------------------- |
---|
| 410 | ! |
---|
| 411 | IF( lk_mpp ) CALL mppsync |
---|
| 412 | ! |
---|
| 413 | CALL iom_close ! close all input/output files managed by iom_* |
---|
| 414 | ! |
---|
| 415 | IF( numstp /= -1 ) CLOSE( numstp ) ! time-step file |
---|
| 416 | IF( numrun /= -1 ) CLOSE( numrun ) ! run statistics file |
---|
| 417 | IF( lwm.AND.numond /= -1 ) CLOSE( numond ) ! oce output namelist |
---|
| 418 | IF( lwm.AND.numoni /= -1 ) CLOSE( numoni ) ! ice output namelist |
---|
| 419 | IF( numevo_ice /= -1 ) CLOSE( numevo_ice ) ! ice variables (temp. evolution) |
---|
| 420 | IF( numout /= 6 ) CLOSE( numout ) ! standard model output file |
---|
| 421 | ! |
---|
| 422 | numout = 6 ! redefine numout in case it is used after this point... |
---|
| 423 | ! |
---|
| 424 | END SUBROUTINE nemo_closefile |
---|
| 425 | |
---|
| 426 | |
---|
| 427 | SUBROUTINE nemo_alloc |
---|
| 428 | !!---------------------------------------------------------------------- |
---|
| 429 | !! *** ROUTINE nemo_alloc *** |
---|
| 430 | !! |
---|
| 431 | !! ** Purpose : Allocate all the dynamic arrays of the OPA modules |
---|
| 432 | !! |
---|
| 433 | !! ** Method : |
---|
| 434 | !!---------------------------------------------------------------------- |
---|
| 435 | USE diawri , ONLY : dia_wri_alloc |
---|
| 436 | USE dom_oce , ONLY : dom_oce_alloc |
---|
| 437 | ! |
---|
| 438 | INTEGER :: ierr |
---|
| 439 | !!---------------------------------------------------------------------- |
---|
| 440 | ! |
---|
[11831] | 441 | ierr = oce_alloc () ! ocean |
---|
| 442 | ierr = ierr + dia_wri_alloc() |
---|
| 443 | ierr = ierr + dom_oce_alloc() ! ocean domain |
---|
[11637] | 444 | ! |
---|
| 445 | CALL mpp_sum( 'nemogcm', ierr ) |
---|
| 446 | IF( ierr /= 0 ) CALL ctl_stop( 'STOP', 'nemo_alloc: unable to allocate standard ocean arrays' ) |
---|
| 447 | ! |
---|
| 448 | END SUBROUTINE nemo_alloc |
---|
| 449 | |
---|
[11831] | 450 | |
---|
[11637] | 451 | SUBROUTINE nemo_set_cfctl(sn_cfctl, setto, for_all ) |
---|
| 452 | !!---------------------------------------------------------------------- |
---|
| 453 | !! *** ROUTINE nemo_set_cfctl *** |
---|
| 454 | !! |
---|
| 455 | !! ** Purpose : Set elements of the output control structure to setto. |
---|
| 456 | !! for_all should be .false. unless all areas are to be |
---|
| 457 | !! treated identically. |
---|
| 458 | !! |
---|
| 459 | !! ** Method : Note this routine can be used to switch on/off some |
---|
| 460 | !! types of output for selected areas but any output types |
---|
| 461 | !! that involve global communications (e.g. mpp_max, glob_sum) |
---|
| 462 | !! should be protected from selective switching by the |
---|
| 463 | !! for_all argument |
---|
| 464 | !!---------------------------------------------------------------------- |
---|
| 465 | LOGICAL :: setto, for_all |
---|
| 466 | TYPE(sn_ctl) :: sn_cfctl |
---|
| 467 | !!---------------------------------------------------------------------- |
---|
| 468 | IF( for_all ) THEN |
---|
| 469 | sn_cfctl%l_runstat = setto |
---|
| 470 | sn_cfctl%l_trcstat = setto |
---|
| 471 | ENDIF |
---|
| 472 | sn_cfctl%l_oceout = setto |
---|
| 473 | sn_cfctl%l_layout = setto |
---|
[12249] | 474 | sn_cfctl%l_prtctl = setto |
---|
| 475 | sn_cfctl%l_prttrc = setto |
---|
| 476 | sn_cfctl%l_oasout = setto |
---|
[11637] | 477 | END SUBROUTINE nemo_set_cfctl |
---|
| 478 | |
---|
| 479 | !!====================================================================== |
---|
| 480 | END MODULE nemogcm |
---|