[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 | !!====================================================================== |
---|
[1593] | 6 | !! History : OPA ! 1990-10 (C. Levy, G. Madec) Original code |
---|
| 7 | !! 7.0 ! 1991-11 (M. Imbard, C. Levy, G. Madec) |
---|
[3764] | 8 | !! 7.1 ! 1993-03 (M. Imbard, C. Levy, G. Madec, O. Marti, M. Guyon, A. Lazar, |
---|
| 9 | !! P. Delecluse, C. Perigaud, G. Caniaux, B. Colot, C. Maes) release 7.1 |
---|
[1593] | 10 | !! - ! 1992-06 (L.Terray) coupling implementation |
---|
[3764] | 11 | !! - ! 1993-11 (M.A. Filiberti) IGLOO sea-ice |
---|
| 12 | !! 8.0 ! 1996-03 (M. Imbard, C. Levy, G. Madec, O. Marti, M. Guyon, A. Lazar, |
---|
[2104] | 13 | !! P. Delecluse, L.Terray, M.A. Filiberti, J. Vialar, A.M. Treguier, M. Levy) release 8.0 |
---|
[1593] | 14 | !! 8.1 ! 1997-06 (M. Imbard, G. Madec) |
---|
[9656] | 15 | !! 8.2 ! 1999-11 (M. Imbard, H. Goosse) sea-ice model |
---|
[3764] | 16 | !! ! 1999-12 (V. Thierry, A-M. Treguier, M. Imbard, M-A. Foujols) OPEN-MP |
---|
[1593] | 17 | !! ! 2000-07 (J-M Molines, M. Imbard) Open Boundary Conditions (CLIPPER) |
---|
| 18 | !! NEMO 1.0 ! 2002-08 (G. Madec) F90: Free form and modules |
---|
| 19 | !! - ! 2004-06 (R. Redler, NEC CCRLE, Germany) add OASIS[3/4] coupled interfaces |
---|
| 20 | !! - ! 2004-08 (C. Talandier) New trends organization |
---|
| 21 | !! - ! 2005-06 (C. Ethe) Add the 1D configuration possibility |
---|
| 22 | !! - ! 2005-11 (V. Garnier) Surface pressure gradient organization |
---|
| 23 | !! - ! 2006-03 (L. Debreu, C. Mazauric) Agrif implementation |
---|
| 24 | !! - ! 2006-04 (G. Madec, R. Benshila) Step reorganization |
---|
| 25 | !! - ! 2007-07 (J. Chanut, A. Sellar) Unstructured open boundaries (BDY) |
---|
| 26 | !! 3.2 ! 2009-08 (S. Masson) open/write in the listing file in mpp |
---|
[3764] | 27 | !! 3.3 ! 2010-05 (K. Mogensen, A. Weaver, M. Martin, D. Lea) Assimilation interface |
---|
[2236] | 28 | !! - ! 2010-10 (C. Ethe, G. Madec) reorganisation of initialisation phase |
---|
[3294] | 29 | !! 3.3.1! 2011-01 (A. R. Porter, STFC Daresbury) dynamical allocation |
---|
[5836] | 30 | !! - ! 2011-11 (C. Harris) decomposition changes for running with CICE |
---|
| 31 | !! 3.6 ! 2012-05 (C. Calone, J. Simeon, G. Madec, C. Ethe) Add grid coarsening |
---|
| 32 | !! - ! 2014-12 (G. Madec) remove KPP scheme and cross-land advection (cla) |
---|
[7646] | 33 | !! 4.0 ! 2016-10 (G. Madec, S. Flavoni) domain configuration / user defined interface |
---|
[1593] | 34 | !!---------------------------------------------------------------------- |
---|
[3] | 35 | |
---|
| 36 | !!---------------------------------------------------------------------- |
---|
[6140] | 37 | !! nemo_gcm : solve ocean dynamics, tracer, biogeochemistry and/or sea-ice |
---|
| 38 | !! nemo_init : initialization of the NEMO system |
---|
| 39 | !! nemo_ctl : initialisation of the contol print |
---|
| 40 | !! nemo_closefile: close remaining open files |
---|
| 41 | !! nemo_alloc : dynamical allocation |
---|
[3] | 42 | !!---------------------------------------------------------------------- |
---|
[15261] | 43 | #if defined key_oasis3 |
---|
| 44 | USE mod_oasis ! For coupling |
---|
| 45 | #endif |
---|
[6140] | 46 | USE step_oce ! module used in the ocean time stepping module (step.F90) |
---|
[7646] | 47 | USE phycst ! physical constant (par_cst routine) |
---|
| 48 | USE domain ! domain initialization (dom_init & dom_cfg routines) |
---|
[9161] | 49 | USE closea ! treatment of closed seas (for ln_closea) |
---|
[7646] | 50 | USE usrdef_nam ! user defined configuration |
---|
[6140] | 51 | USE tideini ! tidal components initialization (tide_ini routine) |
---|
[9019] | 52 | USE bdy_oce, ONLY : ln_bdy |
---|
[6140] | 53 | USE bdyini ! open boundary cond. setting (bdy_init routine) |
---|
| 54 | USE istate ! initial state setting (istate_init routine) |
---|
| 55 | USE ldfdyn ! lateral viscosity setting (ldfdyn_init routine) |
---|
| 56 | USE ldftra ! lateral diffusivity setting (ldftra_init routine) |
---|
| 57 | USE trdini ! dyn/tra trends initialization (trd_init routine) |
---|
| 58 | USE asminc ! assimilation increments |
---|
| 59 | USE asmbkg ! writing out state trajectory |
---|
| 60 | USE diaptr ! poleward transports (dia_ptr_init routine) |
---|
| 61 | USE diadct ! sections transports (dia_dct_init routine) |
---|
| 62 | USE diaobs ! Observation diagnostics (dia_obs_init routine) |
---|
| 63 | USE diacfl ! CFL diagnostics (dia_cfl_init routine) |
---|
[11536] | 64 | USE diaharm ! tidal harmonics diagnostics (dia_harm_init routine) |
---|
[6140] | 65 | USE step ! NEMO time-stepping (stp routine) |
---|
| 66 | USE icbini ! handle bergs, initialisation |
---|
| 67 | USE icbstp ! handle bergs, calving, themodynamics and transport |
---|
| 68 | USE cpl_oasis3 ! OASIS3 coupling |
---|
| 69 | USE c1d ! 1D configuration |
---|
| 70 | USE step_c1d ! Time stepping loop for the 1D configuration |
---|
| 71 | USE dyndmp ! Momentum damping |
---|
| 72 | USE stopar ! Stochastic param.: ??? |
---|
| 73 | USE stopts ! Stochastic param.: ??? |
---|
[7646] | 74 | USE diurnal_bulk ! diurnal bulk SST |
---|
| 75 | USE step_diu ! diurnal bulk SST timestepping (called from here if run offline) |
---|
| 76 | USE crsini ! initialise grid coarsening utility |
---|
| 77 | USE diatmb ! Top,middle,bottom output |
---|
| 78 | USE dia25h ! 25h mean output |
---|
| 79 | USE sbc_oce , ONLY : lk_oasis |
---|
| 80 | USE wet_dry ! Wetting and drying setting (wad_init routine) |
---|
[1594] | 81 | #if defined key_top |
---|
[6140] | 82 | USE trcini ! passive tracer initialisation |
---|
[1594] | 83 | #endif |
---|
[7646] | 84 | #if defined key_nemocice_decomp |
---|
| 85 | USE ice_domain_size, only: nx_global, ny_global |
---|
| 86 | #endif |
---|
| 87 | ! |
---|
[6140] | 88 | USE lib_mpp ! distributed memory computing |
---|
[7646] | 89 | USE mppini ! shared/distributed memory setting (mpp_init routine) |
---|
[9213] | 90 | USE lbcnfd , ONLY : isendto, nsndto, nfsloop, nfeloop ! Setup of north fold exchanges |
---|
[7646] | 91 | USE lib_fortran ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined) |
---|
[11913] | 92 | USE sbccpl |
---|
[1412] | 93 | #if defined key_iomput |
---|
[6140] | 94 | USE xios ! xIOserver |
---|
[1359] | 95 | #endif |
---|
[9780] | 96 | #if defined key_agrif |
---|
| 97 | USE agrif_all_update ! Master Agrif update |
---|
| 98 | #endif |
---|
[268] | 99 | |
---|
[2715] | 100 | IMPLICIT NONE |
---|
[3] | 101 | PRIVATE |
---|
| 102 | |
---|
[2496] | 103 | PUBLIC nemo_gcm ! called by model.F90 |
---|
[15544] | 104 | PUBLIC nemo_gcm_init ! called by nemo_gcm or external subroutine |
---|
| 105 | PUBLIC nemo_gcm_run ! called by nemo_gcm or external subroutine |
---|
| 106 | PUBLIC nemo_gcm_finalise ! called by nemo_gcm or external subroutine |
---|
[2496] | 107 | PUBLIC nemo_init ! needed by AGRIF |
---|
[3764] | 108 | PUBLIC nemo_alloc ! needed by TAM |
---|
[467] | 109 | |
---|
[2498] | 110 | CHARACTER(lc) :: cform_aaa="( /, 'AAAAAAAA', / ) " ! flag for output listing |
---|
[1593] | 111 | |
---|
[10425] | 112 | #if defined key_mpp_mpi |
---|
[11536] | 113 | ! need MPI_Wtime |
---|
[10425] | 114 | INCLUDE 'mpif.h' |
---|
| 115 | #endif |
---|
| 116 | |
---|
[3] | 117 | !!---------------------------------------------------------------------- |
---|
[9570] | 118 | !! NEMO/OCE 4.0 , NEMO Consortium (2018) |
---|
[2392] | 119 | !! $Id$ |
---|
[10068] | 120 | !! Software governed by the CeCILL license (see ./LICENSE) |
---|
[3] | 121 | !!---------------------------------------------------------------------- |
---|
| 122 | CONTAINS |
---|
| 123 | |
---|
[2496] | 124 | SUBROUTINE nemo_gcm |
---|
[3] | 125 | !!---------------------------------------------------------------------- |
---|
[2496] | 126 | !! *** ROUTINE nemo_gcm *** |
---|
[3] | 127 | !! |
---|
[3764] | 128 | !! ** Purpose : NEMO solves the primitive equations on an orthogonal |
---|
[1593] | 129 | !! curvilinear mesh on the sphere. |
---|
[3] | 130 | !! |
---|
[15544] | 131 | !! ** Method : - calls nemo_gcm_init, nemo_gcm_run, nemo_gcm_finalise |
---|
| 132 | !! |
---|
| 133 | !! References : Madec, Delecluse, Imbard, and Levy, 1997: internal report, IPSL. |
---|
| 134 | !! Madec, 2008, internal report, IPSL. |
---|
| 135 | !!---------------------------------------------------------------------- |
---|
| 136 | CALL nemo_gcm_init |
---|
| 137 | CALL nemo_gcm_run |
---|
| 138 | CALL nemo_gcm_finalise |
---|
| 139 | END SUBROUTINE nemo_gcm |
---|
| 140 | |
---|
| 141 | SUBROUTINE nemo_gcm_init |
---|
| 142 | !!---------------------------------------------------------------------- |
---|
| 143 | !! *** ROUTINE nemo_gcm_init *** |
---|
| 144 | !! |
---|
| 145 | !! ** Purpose : NEMO solves the primitive equations on an orthogonal |
---|
| 146 | !! curvilinear mesh on the sphere. |
---|
| 147 | !! |
---|
[3] | 148 | !! ** Method : - model general initialization |
---|
| 149 | !! |
---|
[2715] | 150 | !! References : Madec, Delecluse, Imbard, and Levy, 1997: internal report, IPSL. |
---|
[1593] | 151 | !! Madec, 2008, internal report, IPSL. |
---|
[3] | 152 | !!---------------------------------------------------------------------- |
---|
[392] | 153 | #if defined key_agrif |
---|
[1593] | 154 | CALL Agrif_Init_Grids() ! AGRIF: set the meshes |
---|
[389] | 155 | #endif |
---|
[1593] | 156 | ! !-----------------------! |
---|
[2496] | 157 | CALL nemo_init !== Initialisations ==! |
---|
[1593] | 158 | ! !-----------------------! |
---|
[2715] | 159 | #if defined key_agrif |
---|
[3680] | 160 | CALL Agrif_Declare_Var_dom ! AGRIF: set the meshes for DOM |
---|
| 161 | CALL Agrif_Declare_Var ! " " " " " DYN/TRA |
---|
[2715] | 162 | # if defined key_top |
---|
[3680] | 163 | CALL Agrif_Declare_Var_top ! " " " " " TOP |
---|
[2715] | 164 | # endif |
---|
[9570] | 165 | # if defined key_si3 |
---|
[9611] | 166 | CALL Agrif_Declare_Var_ice ! " " " " " Sea ice |
---|
[7646] | 167 | # endif |
---|
[2715] | 168 | #endif |
---|
[15544] | 169 | END SUBROUTINE nemo_gcm_init |
---|
| 170 | |
---|
| 171 | SUBROUTINE nemo_gcm_run |
---|
| 172 | !!---------------------------------------------------------------------- |
---|
| 173 | !! *** ROUTINE nemo_gcm_run *** |
---|
| 174 | !! |
---|
| 175 | !! ** Purpose : NEMO solves the primitive equations on an orthogonal |
---|
| 176 | !! curvilinear mesh on the sphere. |
---|
| 177 | !! |
---|
| 178 | !! ** Method : - launch the time-stepping (stp routine) |
---|
| 179 | !! |
---|
| 180 | !! References : Madec, Delecluse, Imbard, and Levy, 1997: internal report, IPSL. |
---|
| 181 | !! Madec, 2008, internal report, IPSL. |
---|
| 182 | !!---------------------------------------------------------------------- |
---|
| 183 | INTEGER :: istp ! time step index |
---|
| 184 | REAL(wp):: zstptiming ! elapsed time for 1 time step |
---|
| 185 | !!---------------------------------------------------------------------- |
---|
| 186 | ! |
---|
[682] | 187 | ! check that all process are still there... If some process have an error, |
---|
| 188 | ! they will never enter in step and other processes will wait until the end of the cpu time! |
---|
[10425] | 189 | CALL mpp_max( 'nemogcm', nstop ) |
---|
[682] | 190 | |
---|
[1593] | 191 | IF(lwp) WRITE(numout,cform_aaa) ! Flag AAAAAAA |
---|
[15261] | 192 | WRITE(numout,*)"RSRH at time stepping" ; flush(numout) |
---|
[1593] | 193 | |
---|
[15261] | 194 | |
---|
[1593] | 195 | ! !-----------------------! |
---|
| 196 | ! !== time stepping ==! |
---|
| 197 | ! !-----------------------! |
---|
[900] | 198 | istp = nit000 |
---|
[9210] | 199 | ! |
---|
[2236] | 200 | #if defined key_c1d |
---|
[9210] | 201 | DO WHILE ( istp <= nitend .AND. nstop == 0 ) !== C1D time-stepping ==! |
---|
| 202 | CALL stp_c1d( istp ) |
---|
| 203 | istp = istp + 1 |
---|
| 204 | END DO |
---|
[2236] | 205 | #else |
---|
[9210] | 206 | ! |
---|
| 207 | # if defined key_agrif |
---|
| 208 | ! !== AGRIF time-stepping ==! |
---|
| 209 | CALL Agrif_Regrid() |
---|
[9213] | 210 | ! |
---|
[9780] | 211 | ! Recursive update from highest nested level to lowest: |
---|
| 212 | CALL Agrif_step_child_adj(Agrif_Update_All) |
---|
| 213 | ! |
---|
[9210] | 214 | DO WHILE( istp <= nitend .AND. nstop == 0 ) |
---|
| 215 | CALL stp |
---|
| 216 | istp = istp + 1 |
---|
| 217 | END DO |
---|
| 218 | ! |
---|
| 219 | IF( .NOT. Agrif_Root() ) THEN |
---|
| 220 | CALL Agrif_ParentGrid_To_ChildGrid() |
---|
| 221 | IF( ln_diaobs ) CALL dia_obs_wri |
---|
| 222 | IF( ln_timing ) CALL timing_finalize |
---|
| 223 | CALL Agrif_ChildGrid_To_ParentGrid() |
---|
| 224 | ENDIF |
---|
| 225 | ! |
---|
| 226 | # else |
---|
| 227 | ! |
---|
| 228 | IF( .NOT.ln_diurnal_only ) THEN !== Standard time-stepping ==! |
---|
| 229 | ! |
---|
| 230 | DO WHILE( istp <= nitend .AND. nstop == 0 ) |
---|
[11536] | 231 | |
---|
[10425] | 232 | ncom_stp = istp |
---|
[11536] | 233 | IF( ln_timing ) THEN |
---|
| 234 | zstptiming = MPI_Wtime() |
---|
| 235 | IF ( istp == ( nit000 + 1 ) ) elapsed_time = zstptiming |
---|
| 236 | IF ( istp == nitend ) elapsed_time = zstptiming - elapsed_time |
---|
| 237 | ENDIF |
---|
| 238 | |
---|
[13311] | 239 | ! RSRH. You can compile with OASIS but not want to do any |
---|
| 240 | ! coupling. We need to cater for that properly! |
---|
[13443] | 241 | IF (ln_cpl .OR. ln_couple_test) CALL sbc_cpl_snd( istp ) ! Coupling to atmos |
---|
| 242 | ! RSRH. For test purposes we call the receive here. For proper |
---|
| 243 | ! runs we need to do this elsewhere (reference UKESM/GC3 etc) |
---|
| 244 | !IF (ln_cpl .OR. ln_couple_test) CALL sbc_cpl_rcv( istp ) ! Coupling from atmos |
---|
[13311] | 245 | |
---|
[9210] | 246 | CALL stp ( istp ) |
---|
[389] | 247 | istp = istp + 1 |
---|
[11536] | 248 | |
---|
| 249 | IF( lwp .AND. ln_timing ) WRITE(numtime,*) 'timing step ', istp-1, ' : ', MPI_Wtime() - zstptiming |
---|
| 250 | |
---|
[389] | 251 | END DO |
---|
[9210] | 252 | ! |
---|
| 253 | ELSE !== diurnal SST time-steeping only ==! |
---|
| 254 | ! |
---|
| 255 | DO WHILE( istp <= nitend .AND. nstop == 0 ) |
---|
[11913] | 256 | CALL stp_diurnal( istp ) ! time step only the diurnal SST |
---|
[9210] | 257 | istp = istp + 1 |
---|
| 258 | END DO |
---|
| 259 | ! |
---|
| 260 | ENDIF |
---|
| 261 | ! |
---|
| 262 | # endif |
---|
| 263 | ! |
---|
[2236] | 264 | #endif |
---|
[9210] | 265 | ! |
---|
[6140] | 266 | IF( ln_diaobs ) CALL dia_obs_wri |
---|
[3609] | 267 | ! |
---|
| 268 | IF( ln_icebergs ) CALL icb_end( nitend ) |
---|
[3764] | 269 | |
---|
[1593] | 270 | ! !------------------------! |
---|
| 271 | ! !== finalize the run ==! |
---|
| 272 | ! !------------------------! |
---|
[15261] | 273 | WRITE(numout,*)"RSRH at finalize" ; flush(numout) |
---|
[7646] | 274 | IF(lwp) WRITE(numout,cform_aaa) ! Flag AAAAAAA |
---|
[1593] | 275 | ! |
---|
[7646] | 276 | IF( nstop /= 0 .AND. lwp ) THEN ! error print |
---|
[11536] | 277 | WRITE(ctmp1,*) ' ==>>> nemo_gcm: a total of ', nstop, ' errors have been found' |
---|
| 278 | CALL ctl_stop( ctmp1 ) |
---|
[389] | 279 | ENDIF |
---|
[1593] | 280 | ! |
---|
[9124] | 281 | IF( ln_timing ) CALL timing_finalize |
---|
[3294] | 282 | ! |
---|
[13311] | 283 | write(numout,*) "RSRH calling nemo_closefile " , lk_oasis; flush(numout) |
---|
[2496] | 284 | CALL nemo_closefile |
---|
[4990] | 285 | ! |
---|
[15544] | 286 | END SUBROUTINE nemo_gcm_run |
---|
| 287 | |
---|
| 288 | SUBROUTINE nemo_gcm_finalise |
---|
| 289 | !!---------------------------------------------------------------------- |
---|
| 290 | !! *** ROUTINE nemo_gcm_finalise *** |
---|
| 291 | !! |
---|
| 292 | !! ** Purpose : NEMO solves the primitive equations on an orthogonal |
---|
| 293 | !! curvilinear mesh on the sphere. |
---|
| 294 | !! |
---|
| 295 | !! ** Method : - finalize the run by closing files and communications |
---|
| 296 | !! |
---|
| 297 | !! References : Madec, Delecluse, Imbard, and Levy, 1997: internal report, IPSL. |
---|
| 298 | !! Madec, 2008, internal report, IPSL. |
---|
| 299 | !!---------------------------------------------------------------------- |
---|
| 300 | integer :: nerror |
---|
| 301 | !!---------------------------------------------------------------------- |
---|
| 302 | ! |
---|
[3769] | 303 | #if defined key_iomput |
---|
[13311] | 304 | CALL xios_finalize() ! end mpp communications with xios |
---|
| 305 | |
---|
[15261] | 306 | #if defined key_oasis3 |
---|
| 307 | IF (lk_oasis) THEN |
---|
| 308 | CALL oasis_terminate(nerror) |
---|
| 309 | CALL mppstop ! end mpp communications |
---|
| 310 | ELSEIF( lk_mpp ) THEN |
---|
| 311 | CALL mppstop ! RSRH temp for development |
---|
| 312 | ENDIF |
---|
| 313 | #endif |
---|
| 314 | |
---|
[532] | 315 | #else |
---|
[15261] | 316 | ! RSRH It's unclear if the following will work |
---|
| 317 | ! since we never compile w/o key_iomput |
---|
[13311] | 318 | IF ( lk_oasis ) THEN |
---|
| 319 | CALL cpl_finalize() ! end coupling and mpp communications with OASIS |
---|
| 320 | ELSEIF( lk_mpp ) THEN |
---|
| 321 | CALL mppstop ! end mpp communications |
---|
[4990] | 322 | ENDIF |
---|
[532] | 323 | #endif |
---|
[900] | 324 | ! |
---|
[15544] | 325 | IF (.NOT. mpi_pre_initialised) THEN |
---|
| 326 | IF(lwm) THEN |
---|
| 327 | IF( nstop == 0 ) THEN |
---|
| 328 | STOP 0 |
---|
| 329 | ELSE |
---|
| 330 | STOP 123 |
---|
| 331 | ENDIF |
---|
[10436] | 332 | ENDIF |
---|
[10425] | 333 | ENDIF |
---|
| 334 | ! |
---|
[15544] | 335 | END SUBROUTINE nemo_gcm_finalise |
---|
[389] | 336 | |
---|
| 337 | |
---|
[2496] | 338 | SUBROUTINE nemo_init |
---|
[389] | 339 | !!---------------------------------------------------------------------- |
---|
[2496] | 340 | !! *** ROUTINE nemo_init *** |
---|
[389] | 341 | !! |
---|
[2496] | 342 | !! ** Purpose : initialization of the NEMO GCM |
---|
[389] | 343 | !!---------------------------------------------------------------------- |
---|
[13311] | 344 | INTEGER :: ios, ilocal_comm, nerror, ncomp_id, llmpi_init, ierr ! local integers |
---|
[9213] | 345 | !! |
---|
[10570] | 346 | NAMELIST/namctl/ ln_ctl , sn_cfctl, nn_print, nn_ictls, nn_ictle, & |
---|
| 347 | & nn_isplt , nn_jsplt, nn_jctls, nn_jctle, & |
---|
[9019] | 348 | & ln_timing, ln_diacfl |
---|
[9213] | 349 | NAMELIST/namcfg/ ln_read_cfg, cn_domcfg, ln_closea, ln_write_cfg, cn_domcfg_out, ln_use_jattr |
---|
[3] | 350 | !!---------------------------------------------------------------------- |
---|
[1593] | 351 | ! |
---|
[5407] | 352 | cxios_context = 'nemo' |
---|
[2496] | 353 | ! |
---|
[11536] | 354 | ! !-------------------------------------------------! |
---|
| 355 | ! ! set communicator & select the local rank ! |
---|
| 356 | ! ! must be done as soon as possible to get narea ! |
---|
| 357 | ! !-------------------------------------------------! |
---|
[1593] | 358 | ! |
---|
[15544] | 359 | CALL set_mpi_pre_initialised() |
---|
[1412] | 360 | #if defined key_iomput |
---|
[15261] | 361 | IF( Agrif_Root() ) THEN |
---|
| 362 | IF(.not.lk_oasis) THEN |
---|
| 363 | CALL xios_initialize( "for_xios_mpi_id", return_comm=ilocal_comm ) ! nemo local communicator given by xios |
---|
| 364 | ENDIF |
---|
| 365 | ENDIF |
---|
| 366 | |
---|
| 367 | #if defined key_oasis3 |
---|
[13311] | 368 | IF( lk_oasis ) THEN |
---|
[15544] | 369 | IF (.NOT. mpi_pre_initialised) THEN |
---|
| 370 | CALL mpi_init(nerror) |
---|
| 371 | ENDIF |
---|
[13443] | 372 | CALL oasis_init_comp ( ncomp_id, "toyoce", nerror, .TRUE. ) |
---|
[13311] | 373 | CALL oasis_get_localcomm ( ilocal_comm , nerror ) |
---|
| 374 | CALL xios_initialize( "toyoce", local_comm =ilocal_comm ) |
---|
[2200] | 375 | ENDIF |
---|
[15261] | 376 | #endif |
---|
| 377 | |
---|
[11536] | 378 | CALL mpp_start( ilocal_comm ) |
---|
[532] | 379 | #endif |
---|
[15261] | 380 | |
---|
[11536] | 381 | ! |
---|
| 382 | narea = mpprank + 1 ! mpprank: the rank of proc (0 --> mppsize -1 ) |
---|
| 383 | lwm = (narea == 1) ! control of output namelists |
---|
| 384 | ! |
---|
| 385 | ! !---------------------------------------------------------------! |
---|
| 386 | ! ! Open output files, reference and configuration namelist files ! |
---|
| 387 | ! !---------------------------------------------------------------! |
---|
| 388 | ! |
---|
| 389 | ! open ocean.output as soon as possible to get all output prints (including errors messages) |
---|
| 390 | IF( lwm ) CALL ctl_opn( numout, 'ocean.output', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) |
---|
| 391 | ! open reference and configuration namelist files |
---|
| 392 | CALL ctl_opn( numnam_ref, 'namelist_ref', 'OLD', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) |
---|
| 393 | CALL ctl_opn( numnam_cfg, 'namelist_cfg', 'OLD', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) |
---|
| 394 | IF( lwm ) CALL ctl_opn( numond, 'output.namelist.dyn', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) |
---|
| 395 | ! open /dev/null file to be able to supress output write easily |
---|
| 396 | CALL ctl_opn( numnul, '/dev/null', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE. ) |
---|
| 397 | ! |
---|
| 398 | ! !--------------------! |
---|
| 399 | ! ! Open listing units ! -> need ln_ctl from namctl to define lwp |
---|
| 400 | ! !--------------------! |
---|
| 401 | ! |
---|
| 402 | REWIND( numnam_ref ) ! Namelist namctl in reference namelist |
---|
| 403 | READ ( numnam_ref, namctl, IOSTAT = ios, ERR = 901 ) |
---|
| 404 | 901 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namctl in reference namelist' ) |
---|
| 405 | REWIND( numnam_cfg ) ! Namelist namctl in confguration namelist |
---|
| 406 | READ ( numnam_cfg, namctl, IOSTAT = ios, ERR = 902 ) |
---|
| 407 | 902 IF( ios > 0 ) CALL ctl_nam ( ios , 'namctl in configuration namelist' ) |
---|
| 408 | ! |
---|
| 409 | lwp = (narea == 1) .OR. ln_ctl ! control of all listing output print |
---|
| 410 | ! |
---|
| 411 | IF(lwp) THEN ! open listing units |
---|
[1593] | 412 | ! |
---|
[11536] | 413 | IF( .NOT. lwm ) & ! alreay opened for narea == 1 |
---|
| 414 | & CALL ctl_opn( numout, 'ocean.output', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, -1, .FALSE., narea ) |
---|
[1593] | 415 | ! |
---|
[13311] | 416 | |
---|
[1579] | 417 | WRITE(numout,*) |
---|
[11536] | 418 | WRITE(numout,*) ' CNRS - NERC - Met OFFICE - MERCATOR-ocean - CMCC' |
---|
[1593] | 419 | WRITE(numout,*) ' NEMO team' |
---|
[1579] | 420 | WRITE(numout,*) ' Ocean General Circulation Model' |
---|
[10510] | 421 | WRITE(numout,*) ' NEMO version 4.0 (2019) ' |
---|
[1579] | 422 | WRITE(numout,*) |
---|
[10510] | 423 | WRITE(numout,*) " ._ ._ ._ ._ ._ " |
---|
| 424 | WRITE(numout,*) " _.-._)`\_.-._)`\_.-._)`\_.-._)`\_.-._)`\_ " |
---|
[1579] | 425 | WRITE(numout,*) |
---|
[10510] | 426 | WRITE(numout,*) " o _, _, " |
---|
| 427 | WRITE(numout,*) " o .' ( .-' / " |
---|
| 428 | WRITE(numout,*) " o _/..._'. .' / " |
---|
| 429 | WRITE(numout,*) " ( o .-'` ` '-./ _.' " |
---|
| 430 | WRITE(numout,*) " ) ( o) ;= <_ ( " |
---|
| 431 | WRITE(numout,*) " ( '-.,\\__ __.-;`\ '. ) " |
---|
| 432 | WRITE(numout,*) " ) ) \) |`\ \) '. \ ( ( " |
---|
| 433 | WRITE(numout,*) " ( ( \_/ '-._\ ) ) " |
---|
[10583] | 434 | WRITE(numout,*) " ) ) jgs ` ( ( " |
---|
[10510] | 435 | WRITE(numout,*) " ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ " |
---|
| 436 | WRITE(numout,*) |
---|
[1593] | 437 | ! |
---|
[7646] | 438 | WRITE(numout,cform_aaa) ! Flag AAAAAAA |
---|
| 439 | ! |
---|
[473] | 440 | ENDIF |
---|
[10425] | 441 | ! |
---|
[11536] | 442 | ! finalize the definition of namctl variables |
---|
| 443 | IF( sn_cfctl%l_config ) THEN |
---|
| 444 | ! Activate finer control of report outputs |
---|
| 445 | ! optionally switch off output from selected areas (note this only |
---|
| 446 | ! applies to output which does not involve global communications) |
---|
| 447 | IF( ( narea < sn_cfctl%procmin .OR. narea > sn_cfctl%procmax ) .OR. & |
---|
| 448 | & ( MOD( narea - sn_cfctl%procmin, sn_cfctl%procincr ) /= 0 ) ) & |
---|
| 449 | & CALL nemo_set_cfctl( sn_cfctl, .FALSE., .FALSE. ) |
---|
| 450 | ELSE |
---|
| 451 | ! Use ln_ctl to turn on or off all options. |
---|
| 452 | CALL nemo_set_cfctl( sn_cfctl, ln_ctl, .TRUE. ) |
---|
| 453 | ENDIF |
---|
| 454 | ! |
---|
| 455 | IF(lwm) WRITE( numond, namctl ) |
---|
| 456 | ! |
---|
| 457 | ! !------------------------------------! |
---|
| 458 | ! ! Set global domain size parameters ! |
---|
| 459 | ! !------------------------------------! |
---|
| 460 | ! |
---|
| 461 | REWIND( numnam_ref ) ! Namelist namcfg in reference namelist |
---|
| 462 | READ ( numnam_ref, namcfg, IOSTAT = ios, ERR = 903 ) |
---|
| 463 | 903 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namcfg in reference namelist' ) |
---|
| 464 | REWIND( numnam_cfg ) ! Namelist namcfg in confguration namelist |
---|
| 465 | READ ( numnam_cfg, namcfg, IOSTAT = ios, ERR = 904 ) |
---|
| 466 | 904 IF( ios > 0 ) CALL ctl_nam ( ios , 'namcfg in configuration namelist' ) |
---|
| 467 | ! |
---|
| 468 | IF( ln_read_cfg ) THEN ! Read sizes in domain configuration file |
---|
| 469 | CALL domain_cfg ( cn_cfg, nn_cfg, jpiglo, jpjglo, jpkglo, jperio ) |
---|
| 470 | ELSE ! user-defined namelist |
---|
| 471 | CALL usr_def_nam( cn_cfg, nn_cfg, jpiglo, jpjglo, jpkglo, jperio ) |
---|
| 472 | ENDIF |
---|
| 473 | ! |
---|
| 474 | IF(lwm) WRITE( numond, namcfg ) |
---|
| 475 | ! |
---|
| 476 | ! !-----------------------------------------! |
---|
| 477 | ! ! mpp parameters and domain decomposition ! |
---|
| 478 | ! !-----------------------------------------! |
---|
| 479 | CALL mpp_init |
---|
[2715] | 480 | |
---|
[7646] | 481 | ! Now we know the dimensions of the grid and numout has been set: we can allocate arrays |
---|
[2715] | 482 | CALL nemo_alloc() |
---|
| 483 | |
---|
[2496] | 484 | ! !-------------------------------! |
---|
| 485 | ! ! NEMO general initialization ! |
---|
| 486 | ! !-------------------------------! |
---|
[473] | 487 | |
---|
[7646] | 488 | CALL nemo_ctl ! Control prints |
---|
[2382] | 489 | ! |
---|
[9213] | 490 | ! ! General initialization |
---|
| 491 | IF( ln_timing ) CALL timing_init ! timing |
---|
| 492 | IF( ln_timing ) CALL timing_start( 'nemo_init') |
---|
[3294] | 493 | ! |
---|
[9367] | 494 | CALL phy_cst ! Physical constants |
---|
| 495 | CALL eos_init ! Equation of state |
---|
| 496 | IF( lk_c1d ) CALL c1d_init ! 1D column configuration |
---|
| 497 | CALL wad_init ! Wetting and drying options |
---|
| 498 | CALL dom_init("OPA") ! Domain |
---|
| 499 | IF( ln_crs ) CALL crs_init ! coarsened grid: domain initialization |
---|
| 500 | IF( ln_ctl ) CALL prt_ctl_init ! Print control |
---|
[6140] | 501 | |
---|
[9213] | 502 | CALL diurnal_sst_bulk_init ! diurnal sst |
---|
| 503 | IF( ln_diurnal ) CALL diurnal_sst_coolskin_init ! cool skin |
---|
| 504 | ! |
---|
| 505 | IF( ln_diurnal_only ) THEN ! diurnal only: a subset of the initialisation routines |
---|
| 506 | CALL istate_init ! ocean initial state (Dynamics and tracers) |
---|
| 507 | CALL sbc_init ! Forcings : surface module |
---|
| 508 | CALL tra_qsr_init ! penetrative solar radiation qsr |
---|
| 509 | IF( ln_diaobs ) THEN ! Observation & model comparison |
---|
| 510 | CALL dia_obs_init ! Initialize observational data |
---|
| 511 | CALL dia_obs( nit000 - 1 ) ! Observation operator for restart |
---|
[6140] | 512 | ENDIF |
---|
[9213] | 513 | IF( lk_asminc ) CALL asm_inc_init ! Assimilation increments |
---|
| 514 | ! |
---|
| 515 | RETURN ! end of initialization |
---|
[6140] | 516 | ENDIF |
---|
| 517 | |
---|
[9213] | 518 | CALL istate_init ! ocean initial state (Dynamics and tracers) |
---|
[3651] | 519 | |
---|
[5836] | 520 | ! ! external forcing |
---|
[9213] | 521 | CALL tide_init ! tidal harmonics |
---|
| 522 | CALL sbc_init ! surface boundary conditions (including sea-ice) |
---|
| 523 | CALL bdy_init ! Open boundaries initialisation |
---|
[9019] | 524 | |
---|
[5836] | 525 | ! ! Ocean physics |
---|
[9019] | 526 | CALL zdf_phy_init ! Vertical physics |
---|
| 527 | |
---|
[2082] | 528 | ! ! Lateral physics |
---|
[9019] | 529 | CALL ldf_tra_init ! Lateral ocean tracer physics |
---|
| 530 | CALL ldf_eiv_init ! eddy induced velocity param. |
---|
| 531 | CALL ldf_dyn_init ! Lateral ocean momentum physics |
---|
[2082] | 532 | |
---|
[9019] | 533 | ! ! Active tracers |
---|
| 534 | IF( ln_traqsr ) CALL tra_qsr_init ! penetrative solar radiation qsr |
---|
| 535 | CALL tra_bbc_init ! bottom heat flux |
---|
[10350] | 536 | CALL tra_bbl_init ! advective (and/or diffusive) bottom boundary layer scheme |
---|
[9019] | 537 | CALL tra_dmp_init ! internal tracer damping |
---|
| 538 | CALL tra_adv_init ! horizontal & vertical advection |
---|
| 539 | CALL tra_ldf_init ! lateral mixing |
---|
[2027] | 540 | |
---|
[9019] | 541 | ! ! Dynamics |
---|
| 542 | IF( lk_c1d ) CALL dyn_dmp_init ! internal momentum damping |
---|
| 543 | CALL dyn_adv_init ! advection (vector or flux form) |
---|
| 544 | CALL dyn_vor_init ! vorticity term including Coriolis |
---|
| 545 | CALL dyn_ldf_init ! lateral mixing |
---|
| 546 | CALL dyn_hpg_init ! horizontal gradient of Hydrostatic pressure |
---|
| 547 | CALL dyn_spg_init ! surface pressure gradient |
---|
[3764] | 548 | |
---|
[5836] | 549 | #if defined key_top |
---|
| 550 | ! ! Passive tracers |
---|
[9019] | 551 | CALL trc_init |
---|
[5836] | 552 | #endif |
---|
[9019] | 553 | IF( l_ldfslp ) CALL ldf_slp_init ! slope of lateral mixing |
---|
[5836] | 554 | |
---|
| 555 | ! ! Icebergs |
---|
[9019] | 556 | CALL icb_init( rdt, nit000) ! initialise icebergs instance |
---|
[5836] | 557 | |
---|
| 558 | ! ! Misc. options |
---|
[9019] | 559 | CALL sto_par_init ! Stochastic parametrization |
---|
| 560 | IF( ln_sto_eos ) CALL sto_pts_init ! RRandom T/S fluctuations |
---|
[4147] | 561 | |
---|
[5836] | 562 | ! ! Diagnostics |
---|
[11536] | 563 | CALL flo_init ! drifting Floats |
---|
[9019] | 564 | IF( ln_diacfl ) CALL dia_cfl_init ! Initialise CFL diagnostics |
---|
| 565 | CALL dia_ptr_init ! Poleward TRansports initialization |
---|
[11536] | 566 | CALL dia_dct_init ! Sections tranports |
---|
[9019] | 567 | CALL dia_hsb_init ! heat content, salt content and volume budgets |
---|
| 568 | CALL trd_init ! Mixed-layer/Vorticity/Integral constraints trends |
---|
| 569 | CALL dia_obs_init ! Initialize observational data |
---|
[9213] | 570 | CALL dia_tmb_init ! TMB outputs |
---|
| 571 | CALL dia_25h_init ! 25h mean outputs |
---|
[11536] | 572 | CALL dia_harm_init ! tidal harmonics outputs |
---|
| 573 | IF( ln_diaobs ) CALL dia_obs( nit000-1 ) ! Observation operator for restart |
---|
[6140] | 574 | |
---|
[9019] | 575 | ! ! Assimilation increments |
---|
| 576 | IF( lk_asminc ) CALL asm_inc_init ! Initialize assimilation increments |
---|
[1593] | 577 | ! |
---|
[9213] | 578 | IF(lwp) WRITE(numout,cform_aaa) ! Flag AAAAAAA |
---|
[11913] | 579 | |
---|
| 580 | IF (nstop > 0) THEN |
---|
| 581 | CALL CTL_STOP('STOP','Critical errors in NEMO initialisation') |
---|
| 582 | END IF |
---|
| 583 | |
---|
[9213] | 584 | ! |
---|
| 585 | IF( ln_timing ) CALL timing_stop( 'nemo_init') |
---|
| 586 | ! |
---|
[2496] | 587 | END SUBROUTINE nemo_init |
---|
[467] | 588 | |
---|
| 589 | |
---|
[2496] | 590 | SUBROUTINE nemo_ctl |
---|
[467] | 591 | !!---------------------------------------------------------------------- |
---|
[2496] | 592 | !! *** ROUTINE nemo_ctl *** |
---|
[467] | 593 | !! |
---|
[3764] | 594 | !! ** Purpose : control print setting |
---|
[467] | 595 | !! |
---|
[11536] | 596 | !! ** Method : - print namctl and namcfg information and check some consistencies |
---|
[467] | 597 | !!---------------------------------------------------------------------- |
---|
[2442] | 598 | ! |
---|
[2496] | 599 | IF(lwp) THEN ! control print |
---|
[531] | 600 | WRITE(numout,*) |
---|
[7646] | 601 | WRITE(numout,*) 'nemo_ctl: Control prints' |
---|
[9213] | 602 | WRITE(numout,*) '~~~~~~~~' |
---|
[1593] | 603 | WRITE(numout,*) ' Namelist namctl' |
---|
[1601] | 604 | WRITE(numout,*) ' run control (for debugging) ln_ctl = ', ln_ctl |
---|
[10570] | 605 | WRITE(numout,*) ' finer control over o/p sn_cfctl%l_config = ', sn_cfctl%l_config |
---|
| 606 | WRITE(numout,*) ' sn_cfctl%l_runstat = ', sn_cfctl%l_runstat |
---|
| 607 | WRITE(numout,*) ' sn_cfctl%l_trcstat = ', sn_cfctl%l_trcstat |
---|
| 608 | WRITE(numout,*) ' sn_cfctl%l_oceout = ', sn_cfctl%l_oceout |
---|
| 609 | WRITE(numout,*) ' sn_cfctl%l_layout = ', sn_cfctl%l_layout |
---|
| 610 | WRITE(numout,*) ' sn_cfctl%l_mppout = ', sn_cfctl%l_mppout |
---|
| 611 | WRITE(numout,*) ' sn_cfctl%l_mpptop = ', sn_cfctl%l_mpptop |
---|
| 612 | WRITE(numout,*) ' sn_cfctl%procmin = ', sn_cfctl%procmin |
---|
| 613 | WRITE(numout,*) ' sn_cfctl%procmax = ', sn_cfctl%procmax |
---|
| 614 | WRITE(numout,*) ' sn_cfctl%procincr = ', sn_cfctl%procincr |
---|
| 615 | WRITE(numout,*) ' sn_cfctl%ptimincr = ', sn_cfctl%ptimincr |
---|
[1601] | 616 | WRITE(numout,*) ' level of print nn_print = ', nn_print |
---|
| 617 | WRITE(numout,*) ' Start i indice for SUM control nn_ictls = ', nn_ictls |
---|
| 618 | WRITE(numout,*) ' End i indice for SUM control nn_ictle = ', nn_ictle |
---|
| 619 | WRITE(numout,*) ' Start j indice for SUM control nn_jctls = ', nn_jctls |
---|
| 620 | WRITE(numout,*) ' End j indice for SUM control nn_jctle = ', nn_jctle |
---|
| 621 | WRITE(numout,*) ' number of proc. following i nn_isplt = ', nn_isplt |
---|
| 622 | WRITE(numout,*) ' number of proc. following j nn_jsplt = ', nn_jsplt |
---|
[9019] | 623 | WRITE(numout,*) ' timing by routine ln_timing = ', ln_timing |
---|
| 624 | WRITE(numout,*) ' CFL diagnostics ln_diacfl = ', ln_diacfl |
---|
[531] | 625 | ENDIF |
---|
[2442] | 626 | ! |
---|
[1601] | 627 | nprint = nn_print ! convert DOCTOR namelist names into OLD names |
---|
| 628 | nictls = nn_ictls |
---|
| 629 | nictle = nn_ictle |
---|
| 630 | njctls = nn_jctls |
---|
| 631 | njctle = nn_jctle |
---|
| 632 | isplt = nn_isplt |
---|
[9213] | 633 | jsplt = nn_jsplt |
---|
[4147] | 634 | |
---|
| 635 | IF(lwp) THEN ! control print |
---|
| 636 | WRITE(numout,*) |
---|
| 637 | WRITE(numout,*) ' Namelist namcfg' |
---|
[7646] | 638 | WRITE(numout,*) ' read domain configuration file ln_read_cfg = ', ln_read_cfg |
---|
| 639 | WRITE(numout,*) ' filename to be read cn_domcfg = ', TRIM(cn_domcfg) |
---|
[9213] | 640 | WRITE(numout,*) ' keep closed seas in the domain (if exist) ln_closea = ', ln_closea |
---|
| 641 | WRITE(numout,*) ' create a configuration definition file ln_write_cfg = ', ln_write_cfg |
---|
[7646] | 642 | WRITE(numout,*) ' filename to be written cn_domcfg_out = ', TRIM(cn_domcfg_out) |
---|
| 643 | WRITE(numout,*) ' use file attribute if exists as i/p j-start ln_use_jattr = ', ln_use_jattr |
---|
[4147] | 644 | ENDIF |
---|
[9213] | 645 | IF( .NOT.ln_read_cfg ) ln_closea = .false. ! dealing possible only with a domcfg file |
---|
| 646 | ! |
---|
[2442] | 647 | ! ! Parameter control |
---|
[1593] | 648 | ! |
---|
| 649 | IF( ln_ctl ) THEN ! sub-domain area indices for the control prints |
---|
[3294] | 650 | IF( lk_mpp .AND. jpnij > 1 ) THEN |
---|
[2496] | 651 | isplt = jpni ; jsplt = jpnj ; ijsplt = jpni*jpnj ! the domain is forced to the real split domain |
---|
[531] | 652 | ELSE |
---|
| 653 | IF( isplt == 1 .AND. jsplt == 1 ) THEN |
---|
[1593] | 654 | CALL ctl_warn( ' - isplt & jsplt are equal to 1', & |
---|
| 655 | & ' - the print control will be done over the whole domain' ) |
---|
[531] | 656 | ENDIF |
---|
[1593] | 657 | ijsplt = isplt * jsplt ! total number of processors ijsplt |
---|
[531] | 658 | ENDIF |
---|
| 659 | IF(lwp) WRITE(numout,*)' - The total number of processors over which the' |
---|
| 660 | IF(lwp) WRITE(numout,*)' print control will be done is ijsplt : ', ijsplt |
---|
[1593] | 661 | ! |
---|
| 662 | ! ! indices used for the SUM control |
---|
| 663 | IF( nictls+nictle+njctls+njctle == 0 ) THEN ! print control done over the default area |
---|
[3764] | 664 | lsp_area = .FALSE. |
---|
[1593] | 665 | ELSE ! print control done over a specific area |
---|
[531] | 666 | lsp_area = .TRUE. |
---|
| 667 | IF( nictls < 1 .OR. nictls > jpiglo ) THEN |
---|
| 668 | CALL ctl_warn( ' - nictls must be 1<=nictls>=jpiglo, it is forced to 1' ) |
---|
| 669 | nictls = 1 |
---|
| 670 | ENDIF |
---|
| 671 | IF( nictle < 1 .OR. nictle > jpiglo ) THEN |
---|
| 672 | CALL ctl_warn( ' - nictle must be 1<=nictle>=jpiglo, it is forced to jpiglo' ) |
---|
| 673 | nictle = jpiglo |
---|
| 674 | ENDIF |
---|
| 675 | IF( njctls < 1 .OR. njctls > jpjglo ) THEN |
---|
| 676 | CALL ctl_warn( ' - njctls must be 1<=njctls>=jpjglo, it is forced to 1' ) |
---|
| 677 | njctls = 1 |
---|
| 678 | ENDIF |
---|
| 679 | IF( njctle < 1 .OR. njctle > jpjglo ) THEN |
---|
| 680 | CALL ctl_warn( ' - njctle must be 1<=njctle>=jpjglo, it is forced to jpjglo' ) |
---|
| 681 | njctle = jpjglo |
---|
| 682 | ENDIF |
---|
[1593] | 683 | ENDIF |
---|
| 684 | ENDIF |
---|
[2442] | 685 | ! |
---|
[9213] | 686 | IF( 1._wp /= SIGN(1._wp,-0._wp) ) CALL ctl_stop( 'nemo_ctl: The intrinsec SIGN function follows f2003 standard.', & |
---|
[10425] | 687 | & 'Compile with key_nosignedzero enabled:', & |
---|
| 688 | & '--> add -Dkey_nosignedzero to the definition of %CPP in your arch file' ) |
---|
[3764] | 689 | ! |
---|
[9023] | 690 | #if defined key_agrif |
---|
[9124] | 691 | IF( ln_timing ) CALL ctl_stop( 'AGRIF not implemented with ln_timing = true') |
---|
[9023] | 692 | #endif |
---|
| 693 | ! |
---|
[2496] | 694 | END SUBROUTINE nemo_ctl |
---|
[467] | 695 | |
---|
| 696 | |
---|
[2496] | 697 | SUBROUTINE nemo_closefile |
---|
[467] | 698 | !!---------------------------------------------------------------------- |
---|
[2496] | 699 | !! *** ROUTINE nemo_closefile *** |
---|
[467] | 700 | !! |
---|
| 701 | !! ** Purpose : Close the files |
---|
| 702 | !!---------------------------------------------------------------------- |
---|
[1593] | 703 | ! |
---|
| 704 | IF( lk_mpp ) CALL mppsync |
---|
| 705 | ! |
---|
[1685] | 706 | CALL iom_close ! close all input/output files managed by iom_* |
---|
[13311] | 707 | |
---|
[1593] | 708 | ! |
---|
[4147] | 709 | IF( numstp /= -1 ) CLOSE( numstp ) ! time-step file |
---|
[9019] | 710 | IF( numrun /= -1 ) CLOSE( numrun ) ! run statistics file |
---|
[4147] | 711 | IF( numnam_ref /= -1 ) CLOSE( numnam_ref ) ! oce reference namelist |
---|
| 712 | IF( numnam_cfg /= -1 ) CLOSE( numnam_cfg ) ! oce configuration namelist |
---|
[4624] | 713 | IF( lwm.AND.numond /= -1 ) CLOSE( numond ) ! oce output namelist |
---|
[4147] | 714 | IF( numnam_ice_ref /= -1 ) CLOSE( numnam_ice_ref ) ! ice reference namelist |
---|
| 715 | IF( numnam_ice_cfg /= -1 ) CLOSE( numnam_ice_cfg ) ! ice configuration namelist |
---|
[4624] | 716 | IF( lwm.AND.numoni /= -1 ) CLOSE( numoni ) ! ice output namelist |
---|
[4147] | 717 | IF( numevo_ice /= -1 ) CLOSE( numevo_ice ) ! ice variables (temp. evolution) |
---|
| 718 | IF( numout /= 6 ) CLOSE( numout ) ! standard model output file |
---|
| 719 | IF( numdct_vol /= -1 ) CLOSE( numdct_vol ) ! volume transports |
---|
| 720 | IF( numdct_heat /= -1 ) CLOSE( numdct_heat ) ! heat transports |
---|
| 721 | IF( numdct_salt /= -1 ) CLOSE( numdct_salt ) ! salt transports |
---|
[1593] | 722 | ! |
---|
[13311] | 723 | ! numout = 6 ! redefine numout in case it is used after this point... |
---|
[2442] | 724 | ! |
---|
[2496] | 725 | END SUBROUTINE nemo_closefile |
---|
[467] | 726 | |
---|
[2715] | 727 | |
---|
| 728 | SUBROUTINE nemo_alloc |
---|
| 729 | !!---------------------------------------------------------------------- |
---|
| 730 | !! *** ROUTINE nemo_alloc *** |
---|
| 731 | !! |
---|
| 732 | !! ** Purpose : Allocate all the dynamic arrays of the OPA modules |
---|
| 733 | !! |
---|
| 734 | !! ** Method : |
---|
| 735 | !!---------------------------------------------------------------------- |
---|
[9213] | 736 | USE diawri , ONLY : dia_wri_alloc |
---|
| 737 | USE dom_oce , ONLY : dom_oce_alloc |
---|
| 738 | USE trc_oce , ONLY : trc_oce_alloc |
---|
| 739 | USE bdy_oce , ONLY : bdy_oce_alloc |
---|
[2715] | 740 | ! |
---|
| 741 | INTEGER :: ierr |
---|
| 742 | !!---------------------------------------------------------------------- |
---|
| 743 | ! |
---|
[9213] | 744 | ierr = oce_alloc () ! ocean |
---|
| 745 | ierr = ierr + dia_wri_alloc() |
---|
| 746 | ierr = ierr + dom_oce_alloc() ! ocean domain |
---|
| 747 | ierr = ierr + zdf_oce_alloc() ! ocean vertical physics |
---|
| 748 | ierr = ierr + trc_oce_alloc() ! shared TRC / TRA arrays |
---|
| 749 | ierr = ierr + bdy_oce_alloc() ! bdy masks (incl. initialization) |
---|
[2715] | 750 | ! |
---|
[10425] | 751 | CALL mpp_sum( 'nemogcm', ierr ) |
---|
[9213] | 752 | IF( ierr /= 0 ) CALL ctl_stop( 'STOP', 'nemo_alloc: unable to allocate standard ocean arrays' ) |
---|
[2715] | 753 | ! |
---|
| 754 | END SUBROUTINE nemo_alloc |
---|
| 755 | |
---|
[11536] | 756 | |
---|
[10570] | 757 | SUBROUTINE nemo_set_cfctl(sn_cfctl, setto, for_all ) |
---|
| 758 | !!---------------------------------------------------------------------- |
---|
| 759 | !! *** ROUTINE nemo_set_cfctl *** |
---|
| 760 | !! |
---|
| 761 | !! ** Purpose : Set elements of the output control structure to setto. |
---|
| 762 | !! for_all should be .false. unless all areas are to be |
---|
| 763 | !! treated identically. |
---|
| 764 | !! |
---|
| 765 | !! ** Method : Note this routine can be used to switch on/off some |
---|
| 766 | !! types of output for selected areas but any output types |
---|
| 767 | !! that involve global communications (e.g. mpp_max, glob_sum) |
---|
| 768 | !! should be protected from selective switching by the |
---|
| 769 | !! for_all argument |
---|
| 770 | !!---------------------------------------------------------------------- |
---|
| 771 | LOGICAL :: setto, for_all |
---|
[10588] | 772 | TYPE(sn_ctl) :: sn_cfctl |
---|
[10570] | 773 | !!---------------------------------------------------------------------- |
---|
| 774 | IF( for_all ) THEN |
---|
| 775 | sn_cfctl%l_runstat = setto |
---|
| 776 | sn_cfctl%l_trcstat = setto |
---|
| 777 | ENDIF |
---|
| 778 | sn_cfctl%l_oceout = setto |
---|
| 779 | sn_cfctl%l_layout = setto |
---|
| 780 | sn_cfctl%l_mppout = setto |
---|
| 781 | sn_cfctl%l_mpptop = setto |
---|
| 782 | END SUBROUTINE nemo_set_cfctl |
---|
| 783 | |
---|
[3] | 784 | !!====================================================================== |
---|
[2496] | 785 | END MODULE nemogcm |
---|
[4354] | 786 | |
---|