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