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