[3324] | 1 | MODULE nemogcm |
---|
| 2 | !!====================================================================== |
---|
| 3 | !! *** MODULE nemogcm *** |
---|
[7646] | 4 | !! StandAlone Surface module : surface fluxes + sea-ice + iceberg floats |
---|
[3324] | 5 | !!====================================================================== |
---|
[7646] | 6 | !! History : 3.6 ! 2011-11 (S. Alderson, G. Madec) original code |
---|
| 7 | !! - ! 2013-06 (I. Epicoco, S. Mocavero, CMCC) nemo_northcomms: setup avoiding MPI communication |
---|
| 8 | !! - ! 2014-12 (G. Madec) remove KPP scheme and cross-land advection (cla) |
---|
| 9 | !! 4.0 ! 2016-10 (G. Madec, S. Flavoni) domain configuration / user defined interface |
---|
[3324] | 10 | !!---------------------------------------------------------------------- |
---|
| 11 | |
---|
| 12 | !!---------------------------------------------------------------------- |
---|
[7646] | 13 | !! nemo_gcm : solve ocean dynamics, tracer, biogeochemistry and/or sea-ice |
---|
| 14 | !! nemo_init : initialization of the NEMO system |
---|
| 15 | !! nemo_ctl : initialisation of the contol print |
---|
| 16 | !! nemo_closefile: close remaining open files |
---|
| 17 | !! nemo_alloc : dynamical allocation |
---|
[3324] | 18 | !!---------------------------------------------------------------------- |
---|
[7646] | 19 | USE step_oce ! module used in the ocean time stepping module |
---|
| 20 | USE sbc_oce ! surface boundary condition: ocean |
---|
| 21 | USE phycst ! physical constant (par_cst routine) |
---|
| 22 | USE domain ! domain initialization (dom_init & dom_cfg routines) |
---|
[9200] | 23 | USE closea ! treatment of closed seas (for ln_closea) |
---|
[7646] | 24 | USE usrdef_nam ! user defined configuration |
---|
| 25 | USE daymod ! calendar |
---|
[8583] | 26 | USE restart ! open restart file |
---|
[7646] | 27 | USE step ! NEMO time-stepping (stp routine) |
---|
| 28 | USE cpl_oasis3 ! |
---|
| 29 | USE sbcssm ! |
---|
| 30 | USE icbini ! handle bergs, initialisation |
---|
| 31 | USE icbstp ! handle bergs, calving, themodynamics and transport |
---|
[9019] | 32 | USE bdyini ! open boundary cond. setting (bdy_init routine). mandatory for sea-ice |
---|
| 33 | USE bdydta ! open boundary cond. setting (bdy_dta_init routine). mandatory for sea-ice |
---|
[7646] | 34 | ! |
---|
| 35 | USE lib_mpp ! distributed memory computing |
---|
| 36 | USE mppini ! shared/distributed memory setting (mpp_init routine) |
---|
[9213] | 37 | USE lbcnfd , ONLY : isendto, nsndto, nfsloop, nfeloop ! Setup of north fold exchanges |
---|
[7646] | 38 | USE lib_fortran ! Fortran utilities (allows no signed zero when 'key_nosignedzero' defined) |
---|
[3324] | 39 | #if defined key_iomput |
---|
[7646] | 40 | USE xios ! xIOserver |
---|
[3324] | 41 | #endif |
---|
| 42 | |
---|
| 43 | IMPLICIT NONE |
---|
| 44 | PRIVATE |
---|
| 45 | |
---|
| 46 | PUBLIC nemo_gcm ! called by model.F90 |
---|
| 47 | PUBLIC nemo_init ! needed by AGRIF |
---|
| 48 | |
---|
| 49 | CHARACTER(lc) :: cform_aaa="( /, 'AAAAAAAA', / ) " ! flag for output listing |
---|
| 50 | |
---|
| 51 | !!---------------------------------------------------------------------- |
---|
[9213] | 52 | !! NEMO/OPA 4.0 , NEMO Consortium (2018) |
---|
[5215] | 53 | !! $Id$ |
---|
[3324] | 54 | !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) |
---|
| 55 | !!---------------------------------------------------------------------- |
---|
| 56 | CONTAINS |
---|
| 57 | |
---|
| 58 | SUBROUTINE nemo_gcm |
---|
| 59 | !!---------------------------------------------------------------------- |
---|
| 60 | !! *** ROUTINE nemo_gcm *** |
---|
| 61 | !! |
---|
[7646] | 62 | !! ** Purpose : NEMO solves the primitive equations on an orthogonal |
---|
[3324] | 63 | !! curvilinear mesh on the sphere. |
---|
| 64 | !! |
---|
| 65 | !! ** Method : - model general initialization |
---|
| 66 | !! - launch the time-stepping (stp routine) |
---|
| 67 | !! - finalize the run by closing files and communications |
---|
| 68 | !! |
---|
| 69 | !! References : Madec, Delecluse, Imbard, and Levy, 1997: internal report, IPSL. |
---|
| 70 | !! Madec, 2008, internal report, IPSL. |
---|
| 71 | !!---------------------------------------------------------------------- |
---|
[7646] | 72 | INTEGER :: istp ! time step index |
---|
[3324] | 73 | !!---------------------------------------------------------------------- |
---|
| 74 | ! |
---|
| 75 | #if defined key_agrif |
---|
[9213] | 76 | CALL Agrif_Init_Grids() ! AGRIF: set the meshes |
---|
[3324] | 77 | #endif |
---|
| 78 | ! !-----------------------! |
---|
| 79 | CALL nemo_init !== Initialisations ==! |
---|
| 80 | ! !-----------------------! |
---|
| 81 | #if defined key_agrif |
---|
[5407] | 82 | CALL Agrif_Declare_Var_dom ! AGRIF: set the meshes for DOM |
---|
| 83 | CALL Agrif_Declare_Var ! " " " " " DYN/TRA |
---|
| 84 | # if defined key_top |
---|
| 85 | CALL Agrif_Declare_Var_top ! " " " " " TOP |
---|
| 86 | # endif |
---|
[7646] | 87 | # if defined key_lim3 |
---|
| 88 | CALL Agrif_Declare_Var_lim3 ! " " " " " LIM3 |
---|
| 89 | # endif |
---|
[3324] | 90 | #endif |
---|
| 91 | ! check that all process are still there... If some process have an error, |
---|
| 92 | ! they will never enter in step and other processes will wait until the end of the cpu time! |
---|
| 93 | IF( lk_mpp ) CALL mpp_max( nstop ) |
---|
| 94 | |
---|
| 95 | IF(lwp) WRITE(numout,cform_aaa) ! Flag AAAAAAA |
---|
| 96 | |
---|
| 97 | ! !-----------------------! |
---|
| 98 | ! !== time stepping ==! |
---|
| 99 | ! !-----------------------! |
---|
| 100 | istp = nit000 |
---|
[9213] | 101 | ! |
---|
[7646] | 102 | #if defined key_agrif |
---|
[9213] | 103 | ! !== AGRIF time-stepping ==! |
---|
[7646] | 104 | CALL Agrif_Regrid() |
---|
[9213] | 105 | ! |
---|
| 106 | DO WHILE( istp <= nitend .AND. nstop == 0 ) |
---|
| 107 | CALL stp |
---|
| 108 | istp = istp + 1 |
---|
| 109 | END DO |
---|
| 110 | ! |
---|
| 111 | IF( .NOT. Agrif_Root() ) THEN |
---|
| 112 | CALL Agrif_ParentGrid_To_ChildGrid() |
---|
| 113 | IF( ln_timing ) CALL timing_finalize |
---|
| 114 | CALL Agrif_ChildGrid_To_ParentGrid() |
---|
| 115 | ENDIF |
---|
| 116 | ! |
---|
[3324] | 117 | #else |
---|
[9213] | 118 | ! |
---|
| 119 | IF( .NOT.ln_diurnal_only ) THEN !== Standard time-stepping ==! |
---|
| 120 | ! |
---|
| 121 | DO WHILE( istp <= nitend .AND. nstop == 0 ) |
---|
| 122 | CALL stp ( istp ) |
---|
| 123 | istp = istp + 1 |
---|
[7646] | 124 | END DO |
---|
[9213] | 125 | ! |
---|
| 126 | ELSE !== diurnal SST time-steeping only ==! |
---|
| 127 | ! |
---|
| 128 | DO WHILE( istp <= nitend .AND. nstop == 0 ) |
---|
| 129 | CALL stp_diurnal( istp ) ! time step only the diurnal SST |
---|
| 130 | istp = istp + 1 |
---|
| 131 | END DO |
---|
| 132 | ! |
---|
| 133 | ENDIF |
---|
[5407] | 134 | ! |
---|
[9213] | 135 | #endif |
---|
| 136 | ! |
---|
[5407] | 137 | IF( ln_icebergs ) CALL icb_end( nitend ) |
---|
| 138 | |
---|
[3324] | 139 | ! !------------------------! |
---|
| 140 | ! !== finalize the run ==! |
---|
| 141 | ! !------------------------! |
---|
[7646] | 142 | IF(lwp) WRITE(numout,cform_aaa) ! Flag AAAAAAA |
---|
[3324] | 143 | ! |
---|
[7646] | 144 | IF( nstop /= 0 .AND. lwp ) THEN ! error print |
---|
[3324] | 145 | WRITE(numout,cform_err) |
---|
[9213] | 146 | WRITE(numout,*) ' ==>>> nemo_gcm: a total of ', nstop, ' errors have been found' |
---|
| 147 | WRITE(numout,*) |
---|
[3324] | 148 | ENDIF |
---|
| 149 | ! |
---|
[9019] | 150 | IF( ln_timing ) CALL timing_finalize |
---|
[3324] | 151 | ! |
---|
| 152 | CALL nemo_closefile |
---|
[5407] | 153 | ! |
---|
[3769] | 154 | #if defined key_iomput |
---|
[9213] | 155 | CALL xios_finalize ! end mpp communications with xios |
---|
| 156 | IF( lk_oasis ) CALL cpl_finalize ! end coupling and mpp communications with OASIS |
---|
[3769] | 157 | #else |
---|
[9213] | 158 | IF ( lk_oasis ) THEN ; CALL cpl_finalize ! end coupling and mpp communications with OASIS |
---|
| 159 | ELSEIF( lk_mpp ) THEN ; CALL mppstop ! end mpp communications |
---|
[5407] | 160 | ENDIF |
---|
[3769] | 161 | #endif |
---|
[3324] | 162 | ! |
---|
| 163 | END SUBROUTINE nemo_gcm |
---|
| 164 | |
---|
| 165 | |
---|
| 166 | SUBROUTINE nemo_init |
---|
| 167 | !!---------------------------------------------------------------------- |
---|
| 168 | !! *** ROUTINE nemo_init *** |
---|
| 169 | !! |
---|
| 170 | !! ** Purpose : initialization of the NEMO GCM |
---|
| 171 | !!---------------------------------------------------------------------- |
---|
[9213] | 172 | INTEGER :: ji ! dummy loop indices |
---|
| 173 | INTEGER :: ios, ilocal_comm ! local integers |
---|
[7646] | 174 | CHARACTER(len=120), DIMENSION(30) :: cltxt, cltxt2, clnam |
---|
| 175 | CHARACTER(len=80) :: clname |
---|
[9213] | 176 | !! |
---|
[7646] | 177 | NAMELIST/namctl/ ln_ctl , nn_print, nn_ictls, nn_ictle, & |
---|
| 178 | & nn_isplt , nn_jsplt, nn_jctls, nn_jctle, & |
---|
[9019] | 179 | & ln_timing, ln_diacfl |
---|
[9213] | 180 | NAMELIST/namcfg/ ln_read_cfg, cn_domcfg, ln_closea, ln_write_cfg, cn_domcfg_out, ln_use_jattr |
---|
[3324] | 181 | !!---------------------------------------------------------------------- |
---|
[5407] | 182 | ! |
---|
[7646] | 183 | cltxt = '' |
---|
| 184 | cltxt2 = '' |
---|
| 185 | clnam = '' |
---|
| 186 | cxios_context = 'nemo' |
---|
[3324] | 187 | ! |
---|
[4147] | 188 | ! ! Open reference namelist and configuration namelist files |
---|
[5407] | 189 | IF( lk_oasis ) THEN |
---|
| 190 | CALL ctl_opn( numnam_ref, 'namelist_sas_ref', 'OLD', 'FORMATTED', 'SEQUENTIAL', -1, 6, .FALSE. ) |
---|
| 191 | CALL ctl_opn( numnam_cfg, 'namelist_sas_cfg', 'OLD', 'FORMATTED', 'SEQUENTIAL', -1, 6, .FALSE. ) |
---|
| 192 | cxios_context = 'sas' |
---|
| 193 | clname = 'output.namelist_sas.dyn' |
---|
| 194 | ELSE |
---|
| 195 | CALL ctl_opn( numnam_ref, 'namelist_ref', 'OLD', 'FORMATTED', 'SEQUENTIAL', -1, 6, .FALSE. ) |
---|
| 196 | CALL ctl_opn( numnam_cfg, 'namelist_cfg', 'OLD', 'FORMATTED', 'SEQUENTIAL', -1, 6, .FALSE. ) |
---|
| 197 | cxios_context = 'nemo' |
---|
| 198 | clname = 'output.namelist.dyn' |
---|
| 199 | ENDIF |
---|
[3324] | 200 | ! |
---|
[9213] | 201 | REWIND( numnam_ref ) ! Namelist namctl in reference namelist |
---|
[4147] | 202 | READ ( numnam_ref, namctl, IOSTAT = ios, ERR = 901 ) |
---|
[9169] | 203 | 901 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namctl in reference namelist', .TRUE. ) |
---|
[7646] | 204 | REWIND( numnam_cfg ) ! Namelist namctl in confguration namelist |
---|
[4147] | 205 | READ ( numnam_cfg, namctl, IOSTAT = ios, ERR = 902 ) |
---|
[9169] | 206 | 902 IF( ios > 0 ) CALL ctl_nam ( ios , 'namctl in configuration namelist', .TRUE. ) |
---|
[3324] | 207 | ! |
---|
[9213] | 208 | REWIND( numnam_ref ) ! Namelist namcfg in reference namelist |
---|
[4147] | 209 | READ ( numnam_ref, namcfg, IOSTAT = ios, ERR = 903 ) |
---|
[9169] | 210 | 903 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namcfg in reference namelist', .TRUE. ) |
---|
[9213] | 211 | REWIND( numnam_cfg ) ! Namelist namcfg in confguration namelist |
---|
[4147] | 212 | READ ( numnam_cfg, namcfg, IOSTAT = ios, ERR = 904 ) |
---|
[9169] | 213 | 904 IF( ios > 0 ) CALL ctl_nam ( ios , 'namcfg in configuration namelist', .TRUE. ) |
---|
[4290] | 214 | |
---|
[7646] | 215 | ! !--------------------------! |
---|
| 216 | ! ! Set global domain size ! (control print return in cltxt2) |
---|
| 217 | ! !--------------------------! |
---|
| 218 | IF( ln_read_cfg ) THEN ! Read sizes in domain configuration file |
---|
| 219 | CALL domain_cfg ( cltxt2, cn_cfg, nn_cfg, jpiglo, jpjglo, jpkglo, jperio ) |
---|
| 220 | ! |
---|
| 221 | ELSE ! user-defined namelist |
---|
| 222 | CALL usr_def_nam( cltxt2, clnam, cn_cfg, nn_cfg, jpiglo, jpjglo, jpkglo, jperio ) |
---|
| 223 | ENDIF |
---|
| 224 | ! |
---|
| 225 | ! |
---|
[3324] | 226 | ! !--------------------------------------------! |
---|
| 227 | ! ! set communicator & select the local node ! |
---|
[4624] | 228 | ! ! NB: mynode also opens output.namelist.dyn ! |
---|
| 229 | ! ! on unit number numond on first proc ! |
---|
[3324] | 230 | ! !--------------------------------------------! |
---|
| 231 | #if defined key_iomput |
---|
| 232 | IF( Agrif_Root() ) THEN |
---|
[5407] | 233 | IF( lk_oasis ) THEN |
---|
| 234 | CALL cpl_init( "sas", ilocal_comm ) ! nemo local communicator given by oasis |
---|
| 235 | CALL xios_initialize( "not used",local_comm=ilocal_comm ) ! send nemo communicator to xios |
---|
| 236 | ELSE |
---|
[7646] | 237 | CALL xios_initialize( "for_xios_mpi_id",return_comm=ilocal_comm ) ! nemo local communicator given by xios |
---|
[5407] | 238 | ENDIF |
---|
[3324] | 239 | ENDIF |
---|
[5407] | 240 | narea = mynode ( cltxt, clname, numnam_ref, numnam_cfg, numond , nstop, ilocal_comm ) ! Nodes selection |
---|
[3324] | 241 | #else |
---|
[5407] | 242 | IF( lk_oasis ) THEN |
---|
| 243 | IF( Agrif_Root() ) THEN |
---|
| 244 | CALL cpl_init( "sas", ilocal_comm ) ! nemo local communicator given by oasis |
---|
| 245 | ENDIF |
---|
| 246 | narea = mynode( cltxt, clname, numnam_ref, numnam_cfg, numond , nstop, ilocal_comm ) ! Nodes selection (control print return in cltxt) |
---|
| 247 | ELSE |
---|
| 248 | ilocal_comm = 0 |
---|
| 249 | narea = mynode( cltxt, clname, numnam_ref, numnam_cfg, numond , nstop ) ! Nodes selection (control print return in cltxt) |
---|
| 250 | ENDIF |
---|
[3324] | 251 | #endif |
---|
[7646] | 252 | |
---|
[3324] | 253 | narea = narea + 1 ! mynode return the rank of proc (0 --> jpnij -1 ) |
---|
| 254 | |
---|
[4624] | 255 | lwm = (narea == 1) ! control of output namelists |
---|
[3324] | 256 | lwp = (narea == 1) .OR. ln_ctl ! control of all listing output print |
---|
| 257 | |
---|
[7646] | 258 | IF(lwm) THEN ! write merged namelists from earlier to output namelist |
---|
| 259 | ! ! now that the file has been opened in call to mynode. |
---|
| 260 | ! ! NB: nammpp has already been written in mynode (if lk_mpp_mpi) |
---|
[4624] | 261 | WRITE( numond, namctl ) |
---|
| 262 | WRITE( numond, namcfg ) |
---|
[7646] | 263 | IF( .NOT.ln_read_cfg ) THEN |
---|
| 264 | DO ji = 1, SIZE(clnam) |
---|
| 265 | IF( TRIM(clnam(ji)) /= '' ) WRITE(numond, * ) clnam(ji) ! namusr_def print |
---|
| 266 | END DO |
---|
| 267 | ENDIF |
---|
[4624] | 268 | ENDIF |
---|
| 269 | |
---|
[3324] | 270 | IF(lwp) THEN ! open listing units |
---|
| 271 | ! |
---|
[9213] | 272 | IF( lk_oasis ) THEN ; CALL ctl_opn( numout, 'sas.output', 'REPLACE','FORMATTED','SEQUENTIAL', -1, 6, .FALSE., narea ) |
---|
| 273 | ELSE ; CALL ctl_opn( numout, 'ocean.output', 'REPLACE','FORMATTED','SEQUENTIAL', -1, 6, .FALSE., narea ) |
---|
[5407] | 274 | ENDIF |
---|
[3324] | 275 | ! |
---|
| 276 | WRITE(numout,*) |
---|
| 277 | WRITE(numout,*) ' CNRS - NERC - Met OFFICE - MERCATOR-ocean - INGV - CMCC' |
---|
| 278 | WRITE(numout,*) ' NEMO team' |
---|
| 279 | WRITE(numout,*) ' Ocean General Circulation Model' |
---|
[9213] | 280 | WRITE(numout,*) ' NEMO version 4.0 (2017) ' |
---|
[3331] | 281 | WRITE(numout,*) ' StandAlone Surface version (SAS) ' |
---|
[3324] | 282 | WRITE(numout,*) |
---|
| 283 | WRITE(numout,*) |
---|
[7646] | 284 | DO ji = 1, SIZE(cltxt) |
---|
| 285 | IF( TRIM(cltxt (ji)) /= '' ) WRITE(numout,*) cltxt(ji) ! control print of mynode |
---|
[3324] | 286 | END DO |
---|
[7646] | 287 | WRITE(numout,*) |
---|
| 288 | WRITE(numout,*) |
---|
| 289 | DO ji = 1, SIZE(cltxt2) |
---|
| 290 | IF( TRIM(cltxt2(ji)) /= '' ) WRITE(numout,*) cltxt2(ji) ! control print of domain size |
---|
| 291 | END DO |
---|
[3324] | 292 | ! |
---|
[7646] | 293 | WRITE(numout,cform_aaa) ! Flag AAAAAAA |
---|
| 294 | ! |
---|
[3324] | 295 | ENDIF |
---|
[9436] | 296 | ! ! Domain decomposition |
---|
| 297 | CALL mpp_init ! MPP |
---|
[3324] | 298 | |
---|
[7646] | 299 | ! Now we know the dimensions of the grid and numout has been set: we can allocate arrays |
---|
[3324] | 300 | CALL nemo_alloc() |
---|
[9213] | 301 | |
---|
[3324] | 302 | ! !-------------------------------! |
---|
| 303 | ! ! NEMO general initialization ! |
---|
| 304 | ! !-------------------------------! |
---|
| 305 | |
---|
[7646] | 306 | CALL nemo_ctl ! Control prints |
---|
[3324] | 307 | ! |
---|
[9213] | 308 | ! ! General initialization |
---|
| 309 | IF( ln_timing ) CALL timing_init ! timing |
---|
| 310 | IF( ln_timing ) CALL timing_start( 'nemo_init') |
---|
[3324] | 311 | |
---|
[9213] | 312 | CALL phy_cst ! Physical constants |
---|
| 313 | CALL eos_init ! Equation of seawater |
---|
[9367] | 314 | CALL dom_init('SAS') ! Domain |
---|
[9213] | 315 | IF( ln_ctl ) CALL prt_ctl_init ! Print control |
---|
| 316 | |
---|
| 317 | CALL day_init ! model calendar (using both namelist and restart infos) |
---|
| 318 | IF( ln_rstart ) CALL rst_read_open |
---|
[3324] | 319 | |
---|
[9213] | 320 | ! ! external forcing |
---|
| 321 | CALL sbc_init ! Forcings : surface module |
---|
[3324] | 322 | |
---|
[9019] | 323 | ! ==> clem: open boundaries init. is mandatory for sea-ice because ice BDY is not decoupled from |
---|
[5510] | 324 | ! the environment of ocean BDY. Therefore bdy is called in both OPA and SAS modules. |
---|
| 325 | ! This is not clean and should be changed in the future. |
---|
[9019] | 326 | CALL bdy_init |
---|
[5510] | 327 | ! ==> |
---|
[9019] | 328 | CALL icb_init( rdt, nit000) ! initialise icebergs instance |
---|
[3324] | 329 | ! |
---|
[9213] | 330 | IF(lwp) WRITE(numout,cform_aaa) ! Flag AAAAAAA |
---|
| 331 | ! |
---|
| 332 | IF( ln_timing ) CALL timing_stop( 'nemo_init') |
---|
| 333 | ! |
---|
[3324] | 334 | END SUBROUTINE nemo_init |
---|
| 335 | |
---|
| 336 | |
---|
| 337 | SUBROUTINE nemo_ctl |
---|
| 338 | !!---------------------------------------------------------------------- |
---|
| 339 | !! *** ROUTINE nemo_ctl *** |
---|
| 340 | !! |
---|
[9213] | 341 | !! ** Purpose : control print setting |
---|
[3324] | 342 | !! |
---|
| 343 | !! ** Method : - print namctl information and check some consistencies |
---|
| 344 | !!---------------------------------------------------------------------- |
---|
| 345 | ! |
---|
| 346 | IF(lwp) THEN ! control print |
---|
| 347 | WRITE(numout,*) |
---|
[7646] | 348 | WRITE(numout,*) 'nemo_ctl: Control prints' |
---|
[9213] | 349 | WRITE(numout,*) '~~~~~~~~' |
---|
[3324] | 350 | WRITE(numout,*) ' Namelist namctl' |
---|
| 351 | WRITE(numout,*) ' run control (for debugging) ln_ctl = ', ln_ctl |
---|
| 352 | WRITE(numout,*) ' level of print nn_print = ', nn_print |
---|
| 353 | WRITE(numout,*) ' Start i indice for SUM control nn_ictls = ', nn_ictls |
---|
| 354 | WRITE(numout,*) ' End i indice for SUM control nn_ictle = ', nn_ictle |
---|
| 355 | WRITE(numout,*) ' Start j indice for SUM control nn_jctls = ', nn_jctls |
---|
| 356 | WRITE(numout,*) ' End j indice for SUM control nn_jctle = ', nn_jctle |
---|
| 357 | WRITE(numout,*) ' number of proc. following i nn_isplt = ', nn_isplt |
---|
| 358 | WRITE(numout,*) ' number of proc. following j nn_jsplt = ', nn_jsplt |
---|
[9019] | 359 | WRITE(numout,*) ' timing by routine ln_timing = ', ln_timing |
---|
| 360 | WRITE(numout,*) ' CFL diagnostics ln_diacfl = ', ln_diacfl |
---|
[3324] | 361 | ENDIF |
---|
| 362 | ! |
---|
| 363 | nprint = nn_print ! convert DOCTOR namelist names into OLD names |
---|
| 364 | nictls = nn_ictls |
---|
| 365 | nictle = nn_ictle |
---|
| 366 | njctls = nn_jctls |
---|
| 367 | njctle = nn_jctle |
---|
| 368 | isplt = nn_isplt |
---|
| 369 | jsplt = nn_jsplt |
---|
[4147] | 370 | |
---|
| 371 | IF(lwp) THEN ! control print |
---|
| 372 | WRITE(numout,*) |
---|
| 373 | WRITE(numout,*) ' Namelist namcfg' |
---|
[9213] | 374 | WRITE(numout,*) ' read domain configuration file ln_read_cfg = ', ln_read_cfg |
---|
[7646] | 375 | WRITE(numout,*) ' filename to be read cn_domcfg = ', TRIM(cn_domcfg) |
---|
[9213] | 376 | WRITE(numout,*) ' keep closed seas in the domain (if exist) ln_closea = ', ln_closea |
---|
| 377 | WRITE(numout,*) ' create a configuration definition file ln_write_cfg = ', ln_write_cfg |
---|
[7646] | 378 | WRITE(numout,*) ' filename to be written cn_domcfg_out = ', TRIM(cn_domcfg_out) |
---|
| 379 | WRITE(numout,*) ' use file attribute if exists as i/p j-start ln_use_jattr = ', ln_use_jattr |
---|
[4147] | 380 | ENDIF |
---|
[9213] | 381 | IF( .NOT.ln_read_cfg ) ln_closea = .false. ! dealing possible only with a domcfg file |
---|
| 382 | ! |
---|
[3324] | 383 | ! ! Parameter control |
---|
| 384 | ! |
---|
| 385 | IF( ln_ctl ) THEN ! sub-domain area indices for the control prints |
---|
| 386 | IF( lk_mpp .AND. jpnij > 1 ) THEN |
---|
| 387 | isplt = jpni ; jsplt = jpnj ; ijsplt = jpni*jpnj ! the domain is forced to the real split domain |
---|
| 388 | ELSE |
---|
| 389 | IF( isplt == 1 .AND. jsplt == 1 ) THEN |
---|
| 390 | CALL ctl_warn( ' - isplt & jsplt are equal to 1', & |
---|
| 391 | & ' - the print control will be done over the whole domain' ) |
---|
| 392 | ENDIF |
---|
| 393 | ijsplt = isplt * jsplt ! total number of processors ijsplt |
---|
| 394 | ENDIF |
---|
| 395 | IF(lwp) WRITE(numout,*)' - The total number of processors over which the' |
---|
| 396 | IF(lwp) WRITE(numout,*)' print control will be done is ijsplt : ', ijsplt |
---|
| 397 | ! |
---|
| 398 | ! ! indices used for the SUM control |
---|
| 399 | IF( nictls+nictle+njctls+njctle == 0 ) THEN ! print control done over the default area |
---|
[7646] | 400 | lsp_area = .FALSE. |
---|
[3324] | 401 | ELSE ! print control done over a specific area |
---|
| 402 | lsp_area = .TRUE. |
---|
| 403 | IF( nictls < 1 .OR. nictls > jpiglo ) THEN |
---|
| 404 | CALL ctl_warn( ' - nictls must be 1<=nictls>=jpiglo, it is forced to 1' ) |
---|
| 405 | nictls = 1 |
---|
| 406 | ENDIF |
---|
| 407 | IF( nictle < 1 .OR. nictle > jpiglo ) THEN |
---|
| 408 | CALL ctl_warn( ' - nictle must be 1<=nictle>=jpiglo, it is forced to jpiglo' ) |
---|
| 409 | nictle = jpiglo |
---|
| 410 | ENDIF |
---|
| 411 | IF( njctls < 1 .OR. njctls > jpjglo ) THEN |
---|
| 412 | CALL ctl_warn( ' - njctls must be 1<=njctls>=jpjglo, it is forced to 1' ) |
---|
| 413 | njctls = 1 |
---|
| 414 | ENDIF |
---|
| 415 | IF( njctle < 1 .OR. njctle > jpjglo ) THEN |
---|
| 416 | CALL ctl_warn( ' - njctle must be 1<=njctle>=jpjglo, it is forced to jpjglo' ) |
---|
| 417 | njctle = jpjglo |
---|
| 418 | ENDIF |
---|
| 419 | ENDIF |
---|
| 420 | ENDIF |
---|
| 421 | ! |
---|
[9213] | 422 | IF( 1._wp /= SIGN(1._wp,-0._wp) ) CALL ctl_stop( 'nemo_ctl: The intrinsec SIGN function follows f2003 standard.', & |
---|
| 423 | & 'Compile with key_nosignedzero enabled' ) |
---|
[5407] | 424 | ! |
---|
[9213] | 425 | #if defined key_agrif |
---|
| 426 | IF( ln_timing ) CALL ctl_stop( 'AGRIF not implemented with ln_timing = true') |
---|
| 427 | #endif |
---|
| 428 | ! |
---|
[3324] | 429 | END SUBROUTINE nemo_ctl |
---|
| 430 | |
---|
| 431 | |
---|
| 432 | SUBROUTINE nemo_closefile |
---|
| 433 | !!---------------------------------------------------------------------- |
---|
| 434 | !! *** ROUTINE nemo_closefile *** |
---|
| 435 | !! |
---|
| 436 | !! ** Purpose : Close the files |
---|
| 437 | !!---------------------------------------------------------------------- |
---|
| 438 | ! |
---|
| 439 | IF( lk_mpp ) CALL mppsync |
---|
| 440 | ! |
---|
| 441 | CALL iom_close ! close all input/output files managed by iom_* |
---|
| 442 | ! |
---|
[9213] | 443 | IF( numstp /= -1 ) CLOSE( numstp ) ! time-step file |
---|
[9267] | 444 | IF( numrun /= -1 ) CLOSE( numrun ) ! run statistics file |
---|
[4147] | 445 | IF( numnam_ref /= -1 ) CLOSE( numnam_ref ) ! oce reference namelist |
---|
| 446 | IF( numnam_cfg /= -1 ) CLOSE( numnam_cfg ) ! oce configuration namelist |
---|
[4624] | 447 | IF( lwm.AND.numond /= -1 ) CLOSE( numond ) ! oce output namelist |
---|
[4147] | 448 | IF( numnam_ice_ref /= -1 ) CLOSE( numnam_ice_ref ) ! ice reference namelist |
---|
| 449 | IF( numnam_ice_cfg /= -1 ) CLOSE( numnam_ice_cfg ) ! ice configuration namelist |
---|
[4624] | 450 | IF( lwm.AND.numoni /= -1 ) CLOSE( numoni ) ! ice output namelist |
---|
[9213] | 451 | IF( numevo_ice /= -1 ) CLOSE( numevo_ice ) ! ice variables (temp. evolution) |
---|
| 452 | IF( numout /= 6 ) CLOSE( numout ) ! standard model output file |
---|
[3324] | 453 | ! |
---|
| 454 | numout = 6 ! redefine numout in case it is used after this point... |
---|
| 455 | ! |
---|
| 456 | END SUBROUTINE nemo_closefile |
---|
| 457 | |
---|
| 458 | |
---|
| 459 | SUBROUTINE nemo_alloc |
---|
| 460 | !!---------------------------------------------------------------------- |
---|
| 461 | !! *** ROUTINE nemo_alloc *** |
---|
| 462 | !! |
---|
| 463 | !! ** Purpose : Allocate all the dynamic arrays of the OPA modules |
---|
| 464 | !! |
---|
| 465 | !! ** Method : |
---|
| 466 | !!---------------------------------------------------------------------- |
---|
[9213] | 467 | USE diawri , ONLY : dia_wri_alloc |
---|
| 468 | USE dom_oce , ONLY : dom_oce_alloc |
---|
| 469 | USE bdy_oce , ONLY : ln_bdy, bdy_oce_alloc |
---|
[9019] | 470 | USE oce ! mandatory for sea-ice because needed for bdy arrays |
---|
[3324] | 471 | ! |
---|
[7646] | 472 | INTEGER :: ierr |
---|
[3324] | 473 | !!---------------------------------------------------------------------- |
---|
| 474 | ! |
---|
[9213] | 475 | ierr = dia_wri_alloc() |
---|
| 476 | ierr = ierr + dom_oce_alloc() ! ocean domain |
---|
| 477 | ierr = ierr + oce_alloc () ! (tsn...) needed for agrif and/or ESIM and bdy |
---|
| 478 | ierr = ierr + bdy_oce_alloc() ! bdy masks (incl. initialization) |
---|
[3324] | 479 | ! |
---|
| 480 | IF( lk_mpp ) CALL mpp_sum( ierr ) |
---|
[9213] | 481 | IF( ierr /= 0 ) CALL ctl_stop( 'STOP', 'nemo_alloc: unable to allocate standard ocean arrays' ) |
---|
[3324] | 482 | ! |
---|
| 483 | END SUBROUTINE nemo_alloc |
---|
| 484 | |
---|
| 485 | !!====================================================================== |
---|
| 486 | END MODULE nemogcm |
---|
[9213] | 487 | |
---|