[2496] | 1 | MODULE nemogcm |
---|
[2442] | 2 | !!====================================================================== |
---|
[2496] | 3 | !! *** MODULE nemogcm *** |
---|
| 4 | !! Ocean system : NEMO GCM (ocean dynamics, on-line tracers, biochemistry and sea-ice) |
---|
[2442] | 5 | !!====================================================================== |
---|
[9598] | 6 | !! History : 3.6 ! 2015-12 (A. Ryan) Original code (from OCE/) |
---|
[7646] | 7 | !! 4.0 ! 2016-11 (G. Madec, S. Flavoni) domain configuration / user defined interface |
---|
[1593] | 8 | !!---------------------------------------------------------------------- |
---|
[3] | 9 | |
---|
| 10 | !!---------------------------------------------------------------------- |
---|
[7646] | 11 | !! nemo_gcm : solve ocean dynamics, tracer, biogeochemistry and/or sea-ice |
---|
| 12 | !! nemo_init : initialization of the NEMO system |
---|
| 13 | !! nemo_ctl : initialisation of the contol print |
---|
| 14 | !! nemo_closefile: close remaining open files |
---|
| 15 | !! nemo_alloc : dynamical allocation |
---|
[3] | 16 | !!---------------------------------------------------------------------- |
---|
[7646] | 17 | USE step_oce ! module used in the ocean time stepping module (step.F90) |
---|
| 18 | USE domain ! domain initialization (dom_init & dom_cfg routines) |
---|
| 19 | USE istate ! initial state setting (istate_init routine) |
---|
| 20 | USE phycst ! physical constant (par_cst routine) |
---|
| 21 | USE step ! NEMO time-stepping (stp routine) |
---|
| 22 | USE cpl_oasis3 ! OASIS3 coupling |
---|
| 23 | USE diaobs ! Observation diagnostics (dia_obs_init routine) |
---|
[3625] | 24 | #if defined key_nemocice_decomp |
---|
| 25 | USE ice_domain_size, only: nx_global, ny_global |
---|
| 26 | #endif |
---|
[7646] | 27 | ! ! Stand Alone Observation operator modules |
---|
| 28 | USE sao_data |
---|
| 29 | USE sao_intp |
---|
| 30 | ! |
---|
| 31 | USE lib_mpp ! distributed memory computing |
---|
| 32 | USE mppini ! shared/distributed memory setting (mpp_init routine) |
---|
| 33 | USE lbcnfd , ONLY : isendto, nsndto, nfsloop, nfeloop ! Setup of north fold exchanges |
---|
| 34 | USE lib_fortran ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined) |
---|
[1412] | 35 | #if defined key_iomput |
---|
[7646] | 36 | USE xios ! xIOserver |
---|
[1359] | 37 | #endif |
---|
[268] | 38 | |
---|
[2715] | 39 | IMPLICIT NONE |
---|
[3] | 40 | PRIVATE |
---|
| 41 | |
---|
[4829] | 42 | PUBLIC nemo_gcm ! called by model.F90 |
---|
[2496] | 43 | PUBLIC nemo_init ! needed by AGRIF |
---|
[3764] | 44 | PUBLIC nemo_alloc ! needed by TAM |
---|
[467] | 45 | |
---|
[2498] | 46 | CHARACTER(lc) :: cform_aaa="( /, 'AAAAAAAA', / ) " ! flag for output listing |
---|
[1593] | 47 | |
---|
[3] | 48 | !!---------------------------------------------------------------------- |
---|
[9598] | 49 | !! NEMO/OCE 4.0 , NEMO Consortium (2018) |
---|
[2392] | 50 | !! $Id$ |
---|
[10068] | 51 | !! Software governed by the CeCILL license (see ./LICENSE) |
---|
[3] | 52 | !!---------------------------------------------------------------------- |
---|
| 53 | CONTAINS |
---|
| 54 | |
---|
[4120] | 55 | SUBROUTINE nemo_gcm |
---|
| 56 | !!---------------------------------------------------------------------- |
---|
| 57 | !! *** SUBROUTINE offline_obs_oper *** |
---|
| 58 | !! |
---|
| 59 | !! ** Purpose : To use NEMO components to interpolate model fields |
---|
| 60 | !! to observation space. |
---|
| 61 | !! |
---|
| 62 | !! ** Method : 1. Initialise NEMO |
---|
| 63 | !! 2. Initialise offline obs_oper |
---|
| 64 | !! 3. Cycle through match ups |
---|
| 65 | !! 4. Write results to file |
---|
| 66 | !!---------------------------------------------------------------------- |
---|
[7646] | 67 | ! |
---|
| 68 | CALL nemo_init ! Initialise NEMO |
---|
| 69 | ! |
---|
| 70 | CALL sao_data_init ! Initialise Stand Alone Observation operator data |
---|
| 71 | ! |
---|
| 72 | CALL dia_obs_init ! Initialise obs_operator |
---|
| 73 | ! |
---|
| 74 | CALL sao_interp ! Interpolate to observation space |
---|
| 75 | ! |
---|
| 76 | CALL dia_obs_wri ! Pipe to output files |
---|
| 77 | ! |
---|
| 78 | CALL dia_obs_dealloc ! Reset the obs_oper between |
---|
| 79 | ! |
---|
| 80 | IF(lk_mpp) CALL mppstop ! Safely stop MPI (end mpp communications) |
---|
| 81 | ! |
---|
[4120] | 82 | END SUBROUTINE nemo_gcm |
---|
[389] | 83 | |
---|
[4829] | 84 | |
---|
[2496] | 85 | SUBROUTINE nemo_init |
---|
[389] | 86 | !!---------------------------------------------------------------------- |
---|
[2496] | 87 | !! *** ROUTINE nemo_init *** |
---|
[389] | 88 | !! |
---|
[2496] | 89 | !! ** Purpose : initialization of the NEMO GCM |
---|
[389] | 90 | !!---------------------------------------------------------------------- |
---|
[7646] | 91 | INTEGER :: ios, ilocal_comm ! local integer |
---|
[5600] | 92 | ! |
---|
[10570] | 93 | NAMELIST/namctl/ ln_ctl , sn_cfctl, nn_print, nn_ictls, nn_ictle, & |
---|
| 94 | & nn_isplt , nn_jsplt, nn_jctls, nn_jctle, & |
---|
[9019] | 95 | & ln_timing, ln_diacfl |
---|
[9436] | 96 | NAMELIST/namcfg/ ln_read_cfg, cn_domcfg, ln_closea, ln_write_cfg, cn_domcfg_out, ln_use_jattr |
---|
[3] | 97 | !!---------------------------------------------------------------------- |
---|
[1593] | 98 | ! |
---|
[5600] | 99 | cxios_context = 'nemo' |
---|
[2496] | 100 | ! |
---|
[11536] | 101 | ! !-------------------------------------------------! |
---|
| 102 | ! ! set communicator & select the local rank ! |
---|
| 103 | ! ! must be done as soon as possible to get narea ! |
---|
| 104 | ! !-------------------------------------------------! |
---|
[1593] | 105 | ! |
---|
[1412] | 106 | #if defined key_iomput |
---|
[2200] | 107 | IF( Agrif_Root() ) THEN |
---|
[5600] | 108 | IF( lk_oasis ) THEN |
---|
[11536] | 109 | CALL cpl_init( "oceanx", ilocal_comm ) ! nemo local communicator given by oasis |
---|
| 110 | CALL xios_initialize( "not used" , local_comm =ilocal_comm ) ! send nemo communicator to xios |
---|
[5600] | 111 | ELSE |
---|
[11536] | 112 | CALL xios_initialize( "for_xios_mpi_id", return_comm=ilocal_comm ) ! nemo local communicator given by xios |
---|
[5600] | 113 | ENDIF |
---|
[2200] | 114 | ENDIF |
---|
[11536] | 115 | CALL mpp_start( ilocal_comm ) |
---|
[532] | 116 | #else |
---|
[5600] | 117 | IF( lk_oasis ) THEN |
---|
| 118 | IF( Agrif_Root() ) THEN |
---|
[11536] | 119 | CALL cpl_init( "oceanx", ilocal_comm ) ! nemo local communicator given by oasis |
---|
[5600] | 120 | ENDIF |
---|
[11536] | 121 | CALL mpp_start( ilocal_comm ) |
---|
[5600] | 122 | ELSE |
---|
[11536] | 123 | CALL mpp_start( ) |
---|
[2236] | 124 | ENDIF |
---|
[532] | 125 | #endif |
---|
[11536] | 126 | ! |
---|
| 127 | narea = mpprank + 1 ! mpprank: the rank of proc (0 --> mppsize -1 ) |
---|
| 128 | lwm = (narea == 1) ! control of output namelists |
---|
| 129 | ! |
---|
| 130 | ! !---------------------------------------------------------------! |
---|
| 131 | ! ! Open output files, reference and configuration namelist files ! |
---|
| 132 | ! !---------------------------------------------------------------! |
---|
| 133 | ! |
---|
| 134 | ! open ocean.output as soon as possible to get all output prints (including errors messages) |
---|
| 135 | IF( lwm ) CALL ctl_opn( numout, 'ocean.output', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) |
---|
| 136 | ! open reference and configuration namelist files |
---|
| 137 | CALL ctl_opn( numnam_ref, 'namelist_ref', 'OLD', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) |
---|
| 138 | CALL ctl_opn( numnam_cfg, 'namelist_cfg', 'OLD', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) |
---|
| 139 | IF( lwm ) CALL ctl_opn( numond, 'output.namelist.dyn', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) |
---|
| 140 | ! open /dev/null file to be able to supress output write easily |
---|
| 141 | CALL ctl_opn( numnul, '/dev/null', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) |
---|
| 142 | ! |
---|
| 143 | ! !--------------------! |
---|
| 144 | ! ! Open listing units ! -> need ln_ctl from namctl to define lwp |
---|
| 145 | ! !--------------------! |
---|
| 146 | ! |
---|
| 147 | REWIND( numnam_ref ) ! Namelist namctl in reference namelist |
---|
| 148 | READ ( numnam_ref, namctl, IOSTAT = ios, ERR = 901 ) |
---|
| 149 | 901 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namctl in reference namelist' ) |
---|
| 150 | REWIND( numnam_cfg ) ! Namelist namctl in confguration namelist |
---|
| 151 | READ ( numnam_cfg, namctl, IOSTAT = ios, ERR = 902 ) |
---|
| 152 | 902 IF( ios > 0 ) CALL ctl_nam ( ios , 'namctl in configuration namelist' ) |
---|
| 153 | ! |
---|
| 154 | lwp = (narea == 1) .OR. ln_ctl ! control of all listing output print |
---|
| 155 | ! |
---|
| 156 | IF(lwp) THEN ! open listing units |
---|
[1593] | 157 | ! |
---|
[11536] | 158 | IF( .NOT. lwm ) & ! alreay opened for narea == 1 |
---|
| 159 | & CALL ctl_opn( numout, 'ocean.output', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE., narea ) |
---|
[1593] | 160 | ! |
---|
[1579] | 161 | WRITE(numout,*) |
---|
[11536] | 162 | WRITE(numout,*) ' CNRS - NERC - Met OFFICE - MERCATOR-ocean - CMCC' |
---|
[1593] | 163 | WRITE(numout,*) ' NEMO team' |
---|
[5042] | 164 | WRITE(numout,*) ' Stand Alone Observation operator' |
---|
[10570] | 165 | WRITE(numout,*) ' NEMO version 4.0 (2019) ' |
---|
[1579] | 166 | WRITE(numout,*) |
---|
[10570] | 167 | WRITE(numout,*) " ._ ._ ._ ._ ._ " |
---|
| 168 | WRITE(numout,*) " _.-._)`\_.-._)`\_.-._)`\_.-._)`\_.-._)`\_ " |
---|
[1579] | 169 | WRITE(numout,*) |
---|
[10570] | 170 | WRITE(numout,*) " o _, _, " |
---|
| 171 | WRITE(numout,*) " o .' ( .-' / " |
---|
| 172 | WRITE(numout,*) " o _/..._'. .' / " |
---|
| 173 | WRITE(numout,*) " ( o .-'` ` '-./ _.' " |
---|
| 174 | WRITE(numout,*) " ) ( o) ;= <_ ( " |
---|
| 175 | WRITE(numout,*) " ( '-.,\\__ __.-;`\ '. ) " |
---|
| 176 | WRITE(numout,*) " ) ) \) |`\ \) '. \ ( ( " |
---|
| 177 | WRITE(numout,*) " ( ( \_/ '-._\ ) ) " |
---|
[11536] | 178 | WRITE(numout,*) " ) ) jgs ` ( ( " |
---|
[10570] | 179 | WRITE(numout,*) " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ " |
---|
| 180 | WRITE(numout,*) |
---|
[1593] | 181 | ! |
---|
[7646] | 182 | WRITE(numout,cform_aaa) ! Flag AAAAAAA |
---|
| 183 | ! |
---|
[473] | 184 | ENDIF |
---|
[11536] | 185 | ! |
---|
| 186 | ! finalize the definition of namctl variables |
---|
| 187 | IF( sn_cfctl%l_config ) THEN |
---|
| 188 | ! Activate finer control of report outputs |
---|
| 189 | ! optionally switch off output from selected areas (note this only |
---|
| 190 | ! applies to output which does not involve global communications) |
---|
| 191 | IF( ( narea < sn_cfctl%procmin .OR. narea > sn_cfctl%procmax ) .OR. & |
---|
| 192 | & ( MOD( narea - sn_cfctl%procmin, sn_cfctl%procincr ) /= 0 ) ) & |
---|
| 193 | & CALL nemo_set_cfctl( sn_cfctl, .FALSE., .FALSE. ) |
---|
| 194 | ELSE |
---|
| 195 | ! Use ln_ctl to turn on or off all options. |
---|
| 196 | CALL nemo_set_cfctl( sn_cfctl, ln_ctl, .TRUE. ) |
---|
| 197 | ENDIF |
---|
| 198 | ! |
---|
| 199 | IF(lwm) WRITE( numond, namctl ) |
---|
| 200 | ! |
---|
| 201 | ! !------------------------------------! |
---|
| 202 | ! ! Set global domain size parameters ! |
---|
| 203 | ! !------------------------------------! |
---|
| 204 | ! |
---|
| 205 | REWIND( numnam_ref ) ! Namelist namcfg in reference namelist |
---|
| 206 | READ ( numnam_ref, namcfg, IOSTAT = ios, ERR = 903 ) |
---|
| 207 | 903 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namcfg in reference namelist' ) |
---|
| 208 | REWIND( numnam_cfg ) ! Namelist namcfg in confguration namelist |
---|
| 209 | READ ( numnam_cfg, namcfg, IOSTAT = ios, ERR = 904 ) |
---|
| 210 | 904 IF( ios > 0 ) CALL ctl_nam ( ios , 'namcfg in configuration namelist' ) |
---|
| 211 | ! |
---|
| 212 | IF( ln_read_cfg ) THEN ! Read sizes in domain configuration file |
---|
| 213 | CALL domain_cfg ( cn_cfg, nn_cfg, jpiglo, jpjglo, jpkglo, jperio ) |
---|
| 214 | ELSE ! user-defined namelist |
---|
| 215 | CALL usr_def_nam( cn_cfg, nn_cfg, jpiglo, jpjglo, jpkglo, jperio ) |
---|
| 216 | ENDIF |
---|
| 217 | ! |
---|
| 218 | IF(lwm) WRITE( numond, namcfg ) |
---|
| 219 | ! |
---|
| 220 | ! !-----------------------------------------! |
---|
| 221 | ! ! mpp parameters and domain decomposition ! |
---|
| 222 | ! !-----------------------------------------! |
---|
| 223 | CALL mpp_init |
---|
[2715] | 224 | |
---|
[7646] | 225 | ! Now we know the dimensions of the grid and numout has been set: we can allocate arrays |
---|
[2715] | 226 | CALL nemo_alloc() |
---|
| 227 | |
---|
[2496] | 228 | ! !-------------------------------! |
---|
| 229 | ! ! NEMO general initialization ! |
---|
| 230 | ! !-------------------------------! |
---|
[473] | 231 | |
---|
[9436] | 232 | CALL nemo_ctl ! Control prints |
---|
[2382] | 233 | ! |
---|
[9436] | 234 | ! ! General initialization |
---|
| 235 | IF( ln_timing ) CALL timing_init ! timing |
---|
| 236 | IF( ln_timing ) CALL timing_start( 'nemo_init') |
---|
[3294] | 237 | ! |
---|
[9019] | 238 | CALL phy_cst ! Physical constants |
---|
| 239 | CALL eos_init ! Equation of state |
---|
[9367] | 240 | CALL dom_init('SAO') ! Domain |
---|
[413] | 241 | |
---|
[3294] | 242 | |
---|
[9019] | 243 | IF( ln_ctl ) CALL prt_ctl_init ! Print control |
---|
[2027] | 244 | |
---|
[9019] | 245 | CALL istate_init ! ocean initial state (Dynamics and tracers) |
---|
[2496] | 246 | END SUBROUTINE nemo_init |
---|
[467] | 247 | |
---|
| 248 | |
---|
[2496] | 249 | SUBROUTINE nemo_ctl |
---|
[467] | 250 | !!---------------------------------------------------------------------- |
---|
[2496] | 251 | !! *** ROUTINE nemo_ctl *** |
---|
[467] | 252 | !! |
---|
[3764] | 253 | !! ** Purpose : control print setting |
---|
[467] | 254 | !! |
---|
[2442] | 255 | !! ** Method : - print namctl information and check some consistencies |
---|
[467] | 256 | !!---------------------------------------------------------------------- |
---|
[2442] | 257 | ! |
---|
[2496] | 258 | IF(lwp) THEN ! control print |
---|
[531] | 259 | WRITE(numout,*) |
---|
[7646] | 260 | WRITE(numout,*) 'nemo_ctl: Control prints' |
---|
[9436] | 261 | WRITE(numout,*) '~~~~~~~~' |
---|
[1593] | 262 | WRITE(numout,*) ' Namelist namctl' |
---|
[1601] | 263 | WRITE(numout,*) ' run control (for debugging) ln_ctl = ', ln_ctl |
---|
[10570] | 264 | WRITE(numout,*) ' finer control over o/p sn_cfctl%l_config = ', sn_cfctl%l_config |
---|
| 265 | WRITE(numout,*) ' sn_cfctl%l_runstat = ', sn_cfctl%l_runstat |
---|
| 266 | WRITE(numout,*) ' sn_cfctl%l_trcstat = ', sn_cfctl%l_trcstat |
---|
| 267 | WRITE(numout,*) ' sn_cfctl%l_oceout = ', sn_cfctl%l_oceout |
---|
| 268 | WRITE(numout,*) ' sn_cfctl%l_layout = ', sn_cfctl%l_layout |
---|
| 269 | WRITE(numout,*) ' sn_cfctl%l_mppout = ', sn_cfctl%l_mppout |
---|
| 270 | WRITE(numout,*) ' sn_cfctl%l_mpptop = ', sn_cfctl%l_mpptop |
---|
| 271 | WRITE(numout,*) ' sn_cfctl%procmin = ', sn_cfctl%procmin |
---|
| 272 | WRITE(numout,*) ' sn_cfctl%procmax = ', sn_cfctl%procmax |
---|
| 273 | WRITE(numout,*) ' sn_cfctl%procincr = ', sn_cfctl%procincr |
---|
| 274 | WRITE(numout,*) ' sn_cfctl%ptimincr = ', sn_cfctl%ptimincr |
---|
[1601] | 275 | WRITE(numout,*) ' level of print nn_print = ', nn_print |
---|
| 276 | WRITE(numout,*) ' Start i indice for SUM control nn_ictls = ', nn_ictls |
---|
| 277 | WRITE(numout,*) ' End i indice for SUM control nn_ictle = ', nn_ictle |
---|
| 278 | WRITE(numout,*) ' Start j indice for SUM control nn_jctls = ', nn_jctls |
---|
| 279 | WRITE(numout,*) ' End j indice for SUM control nn_jctle = ', nn_jctle |
---|
| 280 | WRITE(numout,*) ' number of proc. following i nn_isplt = ', nn_isplt |
---|
| 281 | WRITE(numout,*) ' number of proc. following j nn_jsplt = ', nn_jsplt |
---|
[9019] | 282 | WRITE(numout,*) ' timing by routine ln_timing = ', ln_timing |
---|
| 283 | WRITE(numout,*) ' CFL diagnostics ln_diacfl = ', ln_diacfl |
---|
[531] | 284 | ENDIF |
---|
[2442] | 285 | ! |
---|
[1601] | 286 | nprint = nn_print ! convert DOCTOR namelist names into OLD names |
---|
| 287 | nictls = nn_ictls |
---|
| 288 | nictle = nn_ictle |
---|
| 289 | njctls = nn_jctls |
---|
| 290 | njctle = nn_jctle |
---|
| 291 | isplt = nn_isplt |
---|
| 292 | jsplt = nn_jsplt |
---|
[4829] | 293 | |
---|
| 294 | IF(lwp) THEN ! control print |
---|
| 295 | WRITE(numout,*) |
---|
| 296 | WRITE(numout,*) ' Namelist namcfg' |
---|
[7646] | 297 | WRITE(numout,*) ' read domain configuration file ln_read_cfg = ', ln_read_cfg |
---|
| 298 | WRITE(numout,*) ' filename to be read cn_domcfg = ', TRIM(cn_domcfg) |
---|
[9436] | 299 | WRITE(numout,*) ' keep closed seas in the domain (if exist) ln_closea = ', ln_closea |
---|
[10570] | 300 | WRITE(numout,*) ' create a configuration definition file ln_write_cfg = ', ln_write_cfg |
---|
[7646] | 301 | WRITE(numout,*) ' filename to be written cn_domcfg_out = ', TRIM(cn_domcfg_out) |
---|
| 302 | WRITE(numout,*) ' use file attribute if exists as i/p j-start ln_use_jattr = ', ln_use_jattr |
---|
[4829] | 303 | ENDIF |
---|
[9436] | 304 | IF( .NOT.ln_read_cfg ) ln_closea = .false. ! dealing possible only with a domcfg file |
---|
| 305 | ! |
---|
[2442] | 306 | ! ! Parameter control |
---|
[1593] | 307 | ! |
---|
| 308 | IF( ln_ctl ) THEN ! sub-domain area indices for the control prints |
---|
[3294] | 309 | IF( lk_mpp .AND. jpnij > 1 ) THEN |
---|
[2496] | 310 | isplt = jpni ; jsplt = jpnj ; ijsplt = jpni*jpnj ! the domain is forced to the real split domain |
---|
[531] | 311 | ELSE |
---|
| 312 | IF( isplt == 1 .AND. jsplt == 1 ) THEN |
---|
[1593] | 313 | CALL ctl_warn( ' - isplt & jsplt are equal to 1', & |
---|
| 314 | & ' - the print control will be done over the whole domain' ) |
---|
[531] | 315 | ENDIF |
---|
[1593] | 316 | ijsplt = isplt * jsplt ! total number of processors ijsplt |
---|
[531] | 317 | ENDIF |
---|
| 318 | IF(lwp) WRITE(numout,*)' - The total number of processors over which the' |
---|
| 319 | IF(lwp) WRITE(numout,*)' print control will be done is ijsplt : ', ijsplt |
---|
[1593] | 320 | ! |
---|
| 321 | ! ! indices used for the SUM control |
---|
| 322 | IF( nictls+nictle+njctls+njctle == 0 ) THEN ! print control done over the default area |
---|
[3764] | 323 | lsp_area = .FALSE. |
---|
[1593] | 324 | ELSE ! print control done over a specific area |
---|
[531] | 325 | lsp_area = .TRUE. |
---|
| 326 | IF( nictls < 1 .OR. nictls > jpiglo ) THEN |
---|
| 327 | CALL ctl_warn( ' - nictls must be 1<=nictls>=jpiglo, it is forced to 1' ) |
---|
| 328 | nictls = 1 |
---|
| 329 | ENDIF |
---|
| 330 | IF( nictle < 1 .OR. nictle > jpiglo ) THEN |
---|
| 331 | CALL ctl_warn( ' - nictle must be 1<=nictle>=jpiglo, it is forced to jpiglo' ) |
---|
| 332 | nictle = jpiglo |
---|
| 333 | ENDIF |
---|
| 334 | IF( njctls < 1 .OR. njctls > jpjglo ) THEN |
---|
| 335 | CALL ctl_warn( ' - njctls must be 1<=njctls>=jpjglo, it is forced to 1' ) |
---|
| 336 | njctls = 1 |
---|
| 337 | ENDIF |
---|
| 338 | IF( njctle < 1 .OR. njctle > jpjglo ) THEN |
---|
| 339 | CALL ctl_warn( ' - njctle must be 1<=njctle>=jpjglo, it is forced to jpjglo' ) |
---|
| 340 | njctle = jpjglo |
---|
| 341 | ENDIF |
---|
[1593] | 342 | ENDIF |
---|
| 343 | ENDIF |
---|
[2442] | 344 | ! |
---|
[10570] | 345 | IF( 1._wp /= SIGN(1._wp,-0._wp) ) CALL ctl_stop( 'nemo_ctl: The intrinsec SIGN function follows f2003 standard.', & |
---|
| 346 | & 'Compile with key_nosignedzero enabled:', & |
---|
| 347 | & '--> add -Dkey_nosignedzero to the definition of %CPP in your arch file' ) |
---|
[3764] | 348 | ! |
---|
[2496] | 349 | END SUBROUTINE nemo_ctl |
---|
[467] | 350 | |
---|
| 351 | |
---|
[2496] | 352 | SUBROUTINE nemo_closefile |
---|
[467] | 353 | !!---------------------------------------------------------------------- |
---|
[2496] | 354 | !! *** ROUTINE nemo_closefile *** |
---|
[467] | 355 | !! |
---|
| 356 | !! ** Purpose : Close the files |
---|
| 357 | !!---------------------------------------------------------------------- |
---|
[1593] | 358 | ! |
---|
| 359 | IF( lk_mpp ) CALL mppsync |
---|
| 360 | ! |
---|
[1685] | 361 | CALL iom_close ! close all input/output files managed by iom_* |
---|
[1593] | 362 | ! |
---|
[4829] | 363 | IF( numstp /= -1 ) CLOSE( numstp ) ! time-step file |
---|
[9019] | 364 | IF( numrun /= -1 ) CLOSE( numrun ) ! run statistics file |
---|
[4829] | 365 | IF( numnam_ref /= -1 ) CLOSE( numnam_ref ) ! oce reference namelist |
---|
| 366 | IF( numnam_cfg /= -1 ) CLOSE( numnam_cfg ) ! oce configuration namelist |
---|
| 367 | IF( lwm.AND.numond /= -1 ) CLOSE( numond ) ! oce output namelist |
---|
| 368 | IF( numnam_ice_ref /= -1 ) CLOSE( numnam_ice_ref ) ! ice reference namelist |
---|
| 369 | IF( numnam_ice_cfg /= -1 ) CLOSE( numnam_ice_cfg ) ! ice configuration namelist |
---|
| 370 | IF( lwm.AND.numoni /= -1 ) CLOSE( numoni ) ! ice output namelist |
---|
| 371 | IF( numevo_ice /= -1 ) CLOSE( numevo_ice ) ! ice variables (temp. evolution) |
---|
| 372 | IF( numout /= 6 ) CLOSE( numout ) ! standard model output file |
---|
| 373 | IF( numdct_vol /= -1 ) CLOSE( numdct_vol ) ! volume transports |
---|
| 374 | IF( numdct_heat /= -1 ) CLOSE( numdct_heat ) ! heat transports |
---|
| 375 | IF( numdct_salt /= -1 ) CLOSE( numdct_salt ) ! salt transports |
---|
[1593] | 376 | ! |
---|
[2442] | 377 | numout = 6 ! redefine numout in case it is used after this point... |
---|
| 378 | ! |
---|
[2496] | 379 | END SUBROUTINE nemo_closefile |
---|
[467] | 380 | |
---|
[2715] | 381 | |
---|
| 382 | SUBROUTINE nemo_alloc |
---|
| 383 | !!---------------------------------------------------------------------- |
---|
| 384 | !! *** ROUTINE nemo_alloc *** |
---|
| 385 | !! |
---|
| 386 | !! ** Purpose : Allocate all the dynamic arrays of the OPA modules |
---|
| 387 | !! |
---|
| 388 | !! ** Method : |
---|
| 389 | !!---------------------------------------------------------------------- |
---|
| 390 | USE diawri , ONLY: dia_wri_alloc |
---|
| 391 | USE dom_oce , ONLY: dom_oce_alloc |
---|
| 392 | ! |
---|
| 393 | INTEGER :: ierr |
---|
| 394 | !!---------------------------------------------------------------------- |
---|
| 395 | ! |
---|
[3764] | 396 | ierr = oce_alloc () ! ocean |
---|
[2715] | 397 | ierr = ierr + dia_wri_alloc () |
---|
| 398 | ierr = ierr + dom_oce_alloc () ! ocean domain |
---|
| 399 | ! |
---|
[10425] | 400 | CALL mpp_sum( 'nemogcm', ierr ) |
---|
[2715] | 401 | IF( ierr /= 0 ) CALL ctl_stop( 'STOP', 'nemo_alloc : unable to allocate standard ocean arrays' ) |
---|
| 402 | ! |
---|
| 403 | END SUBROUTINE nemo_alloc |
---|
| 404 | |
---|
[10570] | 405 | SUBROUTINE nemo_set_cfctl(sn_cfctl, setto, for_all ) |
---|
| 406 | !!---------------------------------------------------------------------- |
---|
| 407 | !! *** ROUTINE nemo_set_cfctl *** |
---|
| 408 | !! |
---|
| 409 | !! ** Purpose : Set elements of the output control structure to setto. |
---|
| 410 | !! for_all should be .false. unless all areas are to be |
---|
| 411 | !! treated identically. |
---|
| 412 | !! |
---|
| 413 | !! ** Method : Note this routine can be used to switch on/off some |
---|
| 414 | !! types of output for selected areas but any output types |
---|
| 415 | !! that involve global communications (e.g. mpp_max, glob_sum) |
---|
| 416 | !! should be protected from selective switching by the |
---|
| 417 | !! for_all argument |
---|
| 418 | !!---------------------------------------------------------------------- |
---|
| 419 | LOGICAL :: setto, for_all |
---|
[10601] | 420 | TYPE(sn_ctl) :: sn_cfctl |
---|
[10570] | 421 | !!---------------------------------------------------------------------- |
---|
| 422 | IF( for_all ) THEN |
---|
| 423 | sn_cfctl%l_runstat = setto |
---|
| 424 | sn_cfctl%l_trcstat = setto |
---|
| 425 | ENDIF |
---|
| 426 | sn_cfctl%l_oceout = setto |
---|
| 427 | sn_cfctl%l_layout = setto |
---|
| 428 | sn_cfctl%l_mppout = setto |
---|
| 429 | sn_cfctl%l_mpptop = setto |
---|
| 430 | END SUBROUTINE nemo_set_cfctl |
---|
| 431 | |
---|
[3] | 432 | !!====================================================================== |
---|
[2496] | 433 | END MODULE nemogcm |
---|
[4829] | 434 | |
---|