[3611] | 1 | MODULE nemogcm_tam |
---|
| 2 | #if defined key_tam |
---|
| 3 | !!====================================================================== |
---|
| 4 | !! *** MODULE nemogcm *** |
---|
| 5 | !! Ocean system : NEMO GCM (ocean dynamics, on-line tracers, biochemistry and sea-ice) |
---|
| 6 | !!====================================================================== |
---|
| 7 | !! History : OPA ! 1990-10 (C. Levy, G. Madec) Original code |
---|
| 8 | !! 7.0 ! 1991-11 (M. Imbard, C. Levy, G. Madec) |
---|
| 9 | !! 7.1 ! 1993-03 (M. Imbard, C. Levy, G. Madec, O. Marti, M. Guyon, A. Lazar, |
---|
| 10 | !! P. Delecluse, C. Perigaud, G. Caniaux, B. Colot, C. Maes) release 7.1 |
---|
| 11 | !! - ! 1992-06 (L.Terray) coupling implementation |
---|
| 12 | !! - ! 1993-11 (M.A. Filiberti) IGLOO sea-ice |
---|
| 13 | !! 8.0 ! 1996-03 (M. Imbard, C. Levy, G. Madec, O. Marti, M. Guyon, A. Lazar, |
---|
| 14 | !! P. Delecluse, L.Terray, M.A. Filiberti, J. Vialar, A.M. Treguier, M. Levy) release 8.0 |
---|
| 15 | !! 8.1 ! 1997-06 (M. Imbard, G. Madec) |
---|
| 16 | !! 8.2 ! 1999-11 (M. Imbard, H. Goosse) LIM sea-ice model |
---|
| 17 | !! ! 1999-12 (V. Thierry, A-M. Treguier, M. Imbard, M-A. Foujols) OPEN-MP |
---|
| 18 | !! ! 2000-07 (J-M Molines, M. Imbard) Open Boundary Conditions (CLIPPER) |
---|
| 19 | !! NEMO 1.0 ! 2002-08 (G. Madec) F90: Free form and modules |
---|
| 20 | !! - ! 2004-06 (R. Redler, NEC CCRLE, Germany) add OASIS[3/4] coupled interfaces |
---|
| 21 | !! - ! 2004-08 (C. Talandier) New trends organization |
---|
| 22 | !! - ! 2005-06 (C. Ethe) Add the 1D configuration possibility |
---|
| 23 | !! - ! 2005-11 (V. Garnier) Surface pressure gradient organization |
---|
| 24 | !! - ! 2006-03 (L. Debreu, C. Mazauric) Agrif implementation |
---|
| 25 | !! - ! 2006-04 (G. Madec, R. Benshila) Step reorganization |
---|
| 26 | !! - ! 2007-07 (J. Chanut, A. Sellar) Unstructured open boundaries (BDY) |
---|
| 27 | !! 3.2 ! 2009-08 (S. Masson) open/write in the listing file in mpp |
---|
| 28 | !! 3.3 ! 2010-05 (K. Mogensen, A. Weaver, M. Martin, D. Lea) Assimilation interface |
---|
| 29 | !! - ! 2010-10 (C. Ethe, G. Madec) reorganisation of initialisation phase |
---|
| 30 | !! 3.3.1! 2011-01 (A. R. Porter, STFC Daresbury) dynamical allocation |
---|
| 31 | !! 3.4 ! 2011-11 (C. Harris) decomposition changes for running with CICE |
---|
| 32 | !! History of TAM: |
---|
| 33 | !! 3.4 ! 2012-07 (P.-A. Bouttier) Phasing with 3.4 version |
---|
| 34 | !!---------------------------------------------------------------------- |
---|
| 35 | |
---|
| 36 | !!---------------------------------------------------------------------- |
---|
| 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 |
---|
| 42 | !! nemo_partition : calculate MPP domain decomposition |
---|
| 43 | !! factorise : calculate the factors of the no. of MPI processes |
---|
| 44 | !!---------------------------------------------------------------------- |
---|
| 45 | USE step_oce ! module used in the ocean time stepping module |
---|
| 46 | USE sbc_oce ! surface boundary condition: ocean |
---|
| 47 | USE cla ! cross land advection (tra_cla routine) |
---|
| 48 | USE domcfg ! domain configuration (dom_cfg routine) |
---|
| 49 | USE mppini ! shared/distributed memory setting (mpp_init routine) |
---|
| 50 | USE domain ! domain initialization (dom_init routine) |
---|
| 51 | USE obcini ! open boundary cond. initialization (obc_ini routine) |
---|
| 52 | USE bdyini ! open boundary cond. initialization (bdy_init routine) |
---|
| 53 | USE bdydta ! open boundary cond. initialization (bdy_dta_init routine) |
---|
| 54 | USE bdytides ! open boundary cond. initialization (tide_init routine) |
---|
| 55 | USE istate ! initial state setting (istate_init routine) |
---|
| 56 | USE ldfdyn ! lateral viscosity setting (ldfdyn_init routine) |
---|
| 57 | USE ldftra ! lateral diffusivity setting (ldftra_init routine) |
---|
| 58 | USE zdfini ! vertical physics setting (zdf_init routine) |
---|
| 59 | USE phycst ! physical constant (par_cst routine) |
---|
| 60 | USE trdmod ! momentum/tracers trends (trd_mod_init routine) |
---|
| 61 | USE diaptr ! poleward transports (dia_ptr_init routine) |
---|
| 62 | USE diadct ! sections transports (dia_dct_init routine) |
---|
| 63 | USE diaobs ! Observation diagnostics (dia_obs_init routine) |
---|
| 64 | USE step ! NEMO time-stepping (stp routine) |
---|
| 65 | USE tradmp |
---|
| 66 | USE trabbl |
---|
| 67 | #if defined key_oasis3 |
---|
| 68 | USE cpl_oasis3 ! OASIS3 coupling |
---|
| 69 | #elif defined key_oasis4 |
---|
| 70 | USE cpl_oasis4 ! OASIS4 coupling (not working) |
---|
| 71 | #endif |
---|
| 72 | USE c1d ! 1D configuration |
---|
| 73 | USE step_c1d ! Time stepping loop for the 1D configuration |
---|
| 74 | #if defined key_top |
---|
| 75 | USE trcini ! passive tracer initialisation |
---|
| 76 | #endif |
---|
| 77 | USE lib_mpp ! distributed memory computing |
---|
| 78 | #if defined key_iomput |
---|
| 79 | USE mod_ioclient |
---|
| 80 | #endif |
---|
| 81 | USE nemogcm |
---|
| 82 | USE step_tam |
---|
[3658] | 83 | USE sbcssr_tam |
---|
[3611] | 84 | USE step_oce_tam |
---|
| 85 | USE zdf_oce_tam |
---|
| 86 | USE trabbl_tam |
---|
| 87 | USE tamtst |
---|
| 88 | USE tamctl |
---|
| 89 | USE lib_mpp_tam |
---|
[3641] | 90 | !USE tamtrj |
---|
| 91 | USE trj_tam |
---|
[3611] | 92 | IMPLICIT NONE |
---|
| 93 | PRIVATE |
---|
| 94 | |
---|
| 95 | PUBLIC nemo_gcm_tam ! called by model.F90 |
---|
| 96 | PUBLIC nemo_init_tam ! needed by AGRIF |
---|
| 97 | |
---|
| 98 | CHARACTER(lc) :: cform_aaa="( /, 'AAAAAAAA', / ) " ! flag for output listing |
---|
| 99 | |
---|
| 100 | !!---------------------------------------------------------------------- |
---|
| 101 | !! NEMO/OPA 4.0 , NEMO Consortium (2011) |
---|
| 102 | !! $Id$ |
---|
| 103 | !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) |
---|
| 104 | !!---------------------------------------------------------------------- |
---|
| 105 | CONTAINS |
---|
| 106 | |
---|
| 107 | SUBROUTINE nemo_gcm_tam |
---|
| 108 | !!---------------------------------------------------------------------- |
---|
| 109 | !! *** ROUTINE nemo_gcm_tam *** |
---|
| 110 | !! |
---|
| 111 | !! ** Purpose : NEMO solves the primitive equations on an orthogonal |
---|
| 112 | !! curvilinear mesh on the sphere. |
---|
| 113 | !! |
---|
| 114 | !! ** Method : - model general initialization |
---|
| 115 | !! - launch the time-stepping (stp routine) |
---|
| 116 | !! - finalize the run by closing files and communications |
---|
| 117 | !! |
---|
| 118 | !! References : Madec, Delecluse, Imbard, and Levy, 1997: internal report, IPSL. |
---|
| 119 | !! Madec, 2008, internal report, IPSL. |
---|
| 120 | !!---------------------------------------------------------------------- |
---|
| 121 | INTEGER :: istp ! time step index |
---|
| 122 | !!---------------------------------------------------------------------- |
---|
| 123 | ! !-----------------------! |
---|
| 124 | ! !== Initialisations ==! |
---|
| 125 | CALL nemo_init_tam !-----------------------! |
---|
| 126 | ! |
---|
| 127 | ! check that all process are still there... If some process have an error, |
---|
| 128 | ! they will never enter in step and other processes will wait until the end of the cpu time! |
---|
| 129 | IF( lk_mpp ) CALL mpp_max( nstop ) |
---|
| 130 | |
---|
| 131 | IF(lwp) WRITE(numout,cform_aaa) ! Flag AAAAAAA |
---|
| 132 | |
---|
| 133 | ! !-----------------------! |
---|
| 134 | ! !== time stepping ==! |
---|
| 135 | ! !-----------------------! |
---|
[3641] | 136 | IF (ln_swi_opatam == 2) THEN |
---|
| 137 | istp = nit000 - 1 |
---|
| 138 | CALL trj_rea( istp, 1) |
---|
| 139 | istp = nit000 |
---|
| 140 | CALL istate_init_tan |
---|
| 141 | DO istp = nit000, nitend, 1 |
---|
| 142 | CALL stp_tan( istp ) |
---|
| 143 | END DO |
---|
| 144 | IF (lwp) THEN |
---|
| 145 | WRITE(numout,*) |
---|
| 146 | WRITE(numout,*) ' tamtst: Finished testing operators' |
---|
| 147 | WRITE(numout,*) ' ------' |
---|
| 148 | WRITE(numout,*) |
---|
| 149 | ENDIF |
---|
| 150 | CALL flush(numout) |
---|
| 151 | ELSE |
---|
| 152 | CALL tam_tst |
---|
| 153 | ENDIF |
---|
[3611] | 154 | ! !------------------------! |
---|
| 155 | ! !== finalize the run ==! |
---|
| 156 | ! !------------------------! |
---|
| 157 | IF(lwp) WRITE(numout,cform_aaa) ! Flag AAAAAAA |
---|
| 158 | ! |
---|
| 159 | IF( nstop /= 0 .AND. lwp ) THEN ! error print |
---|
| 160 | WRITE(numout,cform_err) |
---|
| 161 | WRITE(numout,*) nstop, ' error have been found' |
---|
| 162 | ENDIF |
---|
| 163 | ! |
---|
| 164 | IF( nn_timing == 1 ) CALL timing_finalize |
---|
| 165 | !! |
---|
| 166 | CALL nemo_closefile |
---|
| 167 | IF( lk_mpp ) CALL mppstop ! end mpp communications |
---|
| 168 | ! |
---|
| 169 | END SUBROUTINE nemo_gcm_tam |
---|
| 170 | |
---|
| 171 | |
---|
| 172 | SUBROUTINE nemo_init_tam |
---|
| 173 | !!---------------------------------------------------------------------- |
---|
| 174 | !! *** ROUTINE nemo_init *** |
---|
| 175 | !! |
---|
| 176 | !! ** Purpose : initialization of the NEMO GCM |
---|
| 177 | !!---------------------------------------------------------------------- |
---|
| 178 | INTEGER :: ji ! dummy loop indices |
---|
| 179 | INTEGER :: ilocal_comm ! local integer |
---|
| 180 | CHARACTER(len=80), DIMENSION(16) :: cltxt |
---|
| 181 | !! |
---|
| 182 | NAMELIST/namctl/ ln_ctl , nn_print, nn_ictls, nn_ictle, & |
---|
| 183 | & nn_isplt, nn_jsplt, nn_jctls, nn_jctle, & |
---|
| 184 | & nn_bench, nn_timing |
---|
| 185 | !!---------------------------------------------------------------------- |
---|
| 186 | ! |
---|
| 187 | cltxt = '' |
---|
| 188 | ! |
---|
| 189 | ! ! open Namelist file |
---|
| 190 | CALL ctl_opn( numnam, 'namelist', 'OLD', 'FORMATTED', 'SEQUENTIAL', -1, 6, .FALSE. ) |
---|
| 191 | !! |
---|
| 192 | READ( numnam, namctl ) ! Namelist namctl : Control prints & Benchmark |
---|
| 193 | ! |
---|
| 194 | ! !--------------------------------------------! |
---|
| 195 | ! ! set communicator & select the local node ! |
---|
| 196 | ! !--------------------------------------------! |
---|
| 197 | ilocal_comm = 0 |
---|
| 198 | narea = mynode( cltxt, numnam, nstop ) ! Nodes selection (control print return in cltxt) |
---|
| 199 | narea = narea + 1 ! mynode return the rank of proc (0 --> jpnij -1 ) |
---|
| 200 | |
---|
| 201 | lwp = (narea == 1) .OR. ln_ctl ! control of all listing output print |
---|
| 202 | |
---|
| 203 | ! If dimensions of processor grid weren't specified in the namelist file |
---|
| 204 | ! then we calculate them here now that we have our communicator size |
---|
| 205 | IF( (jpni < 1) .OR. (jpnj < 1) )THEN |
---|
| 206 | #if defined key_mpp_mpi |
---|
| 207 | IF( Agrif_Root() ) CALL nemo_partition(mppsize) |
---|
| 208 | #else |
---|
| 209 | jpni = 1 |
---|
| 210 | jpnj = 1 |
---|
| 211 | jpnij = jpni*jpnj |
---|
| 212 | #endif |
---|
| 213 | END IF |
---|
| 214 | |
---|
| 215 | ! Calculate domain dimensions given calculated jpni and jpnj |
---|
| 216 | ! This used to be done in par_oce.F90 when they were parameters rather |
---|
| 217 | ! than variables |
---|
| 218 | IF( Agrif_Root() ) THEN |
---|
| 219 | jpi = ( jpiglo-2*jpreci + (jpni-1) ) / jpni + 2*jpreci ! first dim. |
---|
| 220 | jpj = ( jpjglo-2*jprecj + (jpnj-1) ) / jpnj + 2*jprecj ! second dim. |
---|
| 221 | jpk = jpkdta ! third dim |
---|
| 222 | jpim1 = jpi-1 ! inner domain indices |
---|
| 223 | jpjm1 = jpj-1 ! " " |
---|
| 224 | jpkm1 = jpk-1 ! " " |
---|
| 225 | jpij = jpi*jpj ! jpi x j |
---|
| 226 | ENDIF |
---|
| 227 | |
---|
| 228 | IF(lwp) THEN ! open listing units |
---|
| 229 | ! |
---|
| 230 | CALL ctl_opn( numout, 'ocean.output', 'REPLACE', 'FORMATTED', 'SEQUENTIAL', -1, 6, .FALSE., narea ) |
---|
| 231 | ! |
---|
| 232 | WRITE(numout,*) |
---|
| 233 | WRITE(numout,*) ' CNRS - NERC - Met OFFICE - MERCATOR-ocean - INGV - CMCC' |
---|
| 234 | WRITE(numout,*) ' NEMO team' |
---|
| 235 | WRITE(numout,*) ' Ocean General Circulation Model' |
---|
| 236 | WRITE(numout,*) ' version 3.4 (2011) ' |
---|
| 237 | WRITE(numout,*) ' NEMOTAM ' |
---|
| 238 | WRITE(numout,*) |
---|
| 239 | WRITE(numout,*) |
---|
| 240 | DO ji = 1, SIZE(cltxt) |
---|
| 241 | IF( TRIM(cltxt(ji)) /= '' ) WRITE(numout,*) cltxt(ji) ! control print of mynode |
---|
| 242 | END DO |
---|
| 243 | WRITE(numout,cform_aaa) ! Flag AAAAAAA |
---|
| 244 | ! |
---|
| 245 | ENDIF |
---|
| 246 | |
---|
[3641] | 247 | ! Now we know the dimensions of the grid and numout has been set we canhttp://forge.ipsl.jussieu.fr/nemo/changeset/3640 |
---|
[3611] | 248 | ! allocate arrays |
---|
| 249 | CALL nemo_alloc() |
---|
| 250 | |
---|
| 251 | ! ! Domain decomposition |
---|
| 252 | IF( jpni*jpnj == jpnij ) THEN ; CALL mpp_init ! standard cutting out |
---|
| 253 | ELSE ; CALL mpp_init2 ! eliminate land processors |
---|
| 254 | ENDIF |
---|
| 255 | ! |
---|
| 256 | IF( nn_timing == 1 ) CALL timing_init |
---|
| 257 | ! |
---|
| 258 | ! ! General initialization |
---|
| 259 | CALL phy_cst ! Physical constants |
---|
| 260 | CALL eos_init ! Equation of state |
---|
| 261 | CALL dom_cfg ! Domain configuration |
---|
| 262 | CALL dom_init ! Domain |
---|
| 263 | |
---|
| 264 | IF( ln_nnogather ) CALL nemo_northcomms ! Initialise the northfold neighbour lists (must be done after the masks are defined) |
---|
| 265 | |
---|
| 266 | IF( ln_ctl ) CALL prt_ctl_init ! Print control |
---|
| 267 | |
---|
| 268 | IF( lk_obc ) CALL obc_init ! Open boundaries |
---|
| 269 | IF( lk_bdy ) CALL bdy_init ! Open boundaries initialisation |
---|
| 270 | IF( lk_bdy ) CALL bdy_dta_init ! Open boundaries initialisation of external data arrays |
---|
| 271 | IF( lk_bdy ) CALL tide_init ! Open boundaries initialisation of tidal harmonic forcing |
---|
| 272 | |
---|
| 273 | CALL flush(numout) |
---|
| 274 | CALL dyn_nept_init ! simplified form of Neptune effect |
---|
| 275 | CALL flush(numout) |
---|
| 276 | |
---|
| 277 | CALL istate_init ! ocean initial state (Dynamics and tracers) |
---|
| 278 | |
---|
| 279 | ! ! Ocean physics |
---|
| 280 | CALL sbc_init ! Forcings : surface module |
---|
| 281 | ! ! Vertical physics |
---|
| 282 | CALL zdf_init ! namelist read |
---|
| 283 | CALL zdf_bfr_init ! bottom friction |
---|
| 284 | IF( lk_zdfric ) CALL zdf_ric_init ! Richardson number dependent Kz |
---|
| 285 | IF( lk_zdftke ) CALL zdf_tke_init ! TKE closure scheme |
---|
| 286 | IF( lk_zdfgls ) CALL zdf_gls_init ! GLS closure scheme |
---|
| 287 | IF( lk_zdfkpp ) CALL zdf_kpp_init ! KPP closure scheme |
---|
| 288 | IF( lk_zdftmx ) CALL zdf_tmx_init ! tidal vertical mixing |
---|
| 289 | IF( lk_zdfddm .AND. .NOT. lk_zdfkpp ) & |
---|
| 290 | & CALL zdf_ddm_init ! double diffusive mixing |
---|
| 291 | ! ! Lateral physics |
---|
| 292 | CALL ldf_tra_init ! Lateral ocean tracer physics |
---|
| 293 | CALL ldf_dyn_init ! Lateral ocean momentum physics |
---|
| 294 | IF( lk_ldfslp ) CALL ldf_slp_init ! slope of lateral mixing |
---|
| 295 | |
---|
| 296 | ! ! Active tracers |
---|
| 297 | CALL tra_qsr_init ! penetrative solar radiation qsr |
---|
| 298 | CALL tra_bbc_init ! bottom heat flux |
---|
| 299 | IF( lk_trabbl ) CALL tra_bbl_init ! advective (and/or diffusive) bottom boundary layer scheme |
---|
| 300 | IF( ln_tradmp ) CALL tra_dmp_init ! internal damping trends |
---|
| 301 | CALL tra_adv_init ! horizontal & vertical advection |
---|
| 302 | CALL tra_ldf_init ! lateral mixing |
---|
| 303 | CALL tra_zdf_init ! vertical mixing and after tracer fields |
---|
| 304 | |
---|
| 305 | ! ! Dynamics |
---|
| 306 | CALL dyn_adv_init ! advection (vector or flux form) |
---|
| 307 | CALL dyn_vor_init ! vorticity term including Coriolis |
---|
| 308 | CALL dyn_ldf_init ! lateral mixing |
---|
| 309 | CALL dyn_hpg_init ! horizontal gradient of Hydrostatic pressure |
---|
| 310 | CALL dyn_zdf_init ! vertical diffusion |
---|
| 311 | CALL dyn_spg_init ! surface pressure gradient |
---|
| 312 | |
---|
| 313 | ! ! Misc. options |
---|
| 314 | IF( nn_cla == 1 ) CALL cla_init ! Cross Land Advection |
---|
| 315 | |
---|
| 316 | #if defined key_top |
---|
| 317 | ! ! Passive tracers |
---|
| 318 | CALL trc_init |
---|
| 319 | #endif |
---|
| 320 | ! ! Diagnostics |
---|
| 321 | IF( lk_floats ) CALL flo_init ! drifting Floats |
---|
| 322 | CALL iom_init ! iom_put initialization |
---|
| 323 | IF( lk_diaar5 ) CALL dia_ar5_init ! ar5 diag |
---|
| 324 | CALL dia_ptr_init ! Poleward TRansports initialization |
---|
| 325 | IF( lk_diadct ) CALL dia_dct_init ! Sections tranports |
---|
| 326 | CALL dia_hsb_init ! heat content, salt content and volume budgets |
---|
| 327 | CALL trd_mod_init ! Mixed-layer/Vorticity/Integral constraints trends |
---|
| 328 | IF( lk_diaobs ) THEN ! Observation & model comparison |
---|
| 329 | CALL dia_obs_init ! Initialize observational data |
---|
| 330 | CALL dia_obs( nit000 - 1 ) ! Observation operator for restart |
---|
| 331 | ENDIF |
---|
| 332 | ! ! Assimilation increments |
---|
| 333 | IF( lk_asminc ) CALL asm_inc_init ! Initialize assimilation increments |
---|
| 334 | ! |
---|
[3612] | 335 | IF( ln_rnf ) CALL sbc_rnf_init |
---|
[3611] | 336 | !!!!!!!!!!!!! TAM initialisation !!!!!!!!!!!!!!!!!!!!!!!!!!! |
---|
| 337 | CALL nemo_alloc_tam |
---|
| 338 | CALL nemo_ctl_tam ! Control prints & Benchmark |
---|
| 339 | |
---|
| 340 | CALL istate_init_tan ! ocean initial state (Dynamics and tracers) |
---|
| 341 | CALL istate_init_adj ! ocean initial state (Dynamics and tracers) |
---|
| 342 | ! ! Ocean physics |
---|
| 343 | CALL sbc_init_tam ! Forcings : surface module |
---|
[3658] | 344 | CALL sbc_ssr_ini_tam ! Forcings : surface module |
---|
[3611] | 345 | ! ! Vertical physics |
---|
| 346 | ! CALL zdf_init_tam ! namelist read |
---|
| 347 | !IF( lk_zdfric ) CALL zdf_ric_init ! Richardson number dependent Kz |
---|
| 348 | !IF( lk_zdftke ) CALL zdf_tke_init ! TKE closure scheme |
---|
| 349 | !IF( lk_zdfgls ) CALL zdf_gls_init ! GLS closure scheme |
---|
| 350 | !IF( lk_zdfkpp ) CALL zdf_kpp_init ! KPP closure scheme |
---|
| 351 | !IF( lk_zdftmx ) CALL zdf_tmx_init ! tidal vertical mixing |
---|
| 352 | !IF( lk_zdfddm .AND. .NOT. lk_zdfkpp ) & |
---|
| 353 | !& CALL zdf_ddm_init ! double diffusive mixing |
---|
| 354 | ! ! Lateral physics |
---|
| 355 | !CALL ldf_tra_init ! Lateral ocean tracer physics |
---|
| 356 | !CALL ldf_dyn_init ! Lateral ocean momentum physics |
---|
| 357 | !IF( lk_ldfslp ) CALL ldf_slp_init ! slope of lateral mixing |
---|
| 358 | |
---|
| 359 | ! ! Active tracers |
---|
| 360 | CALL tra_qsr_init_tam ! penetrative solar radiation qsr |
---|
| 361 | IF( lk_trabbl ) CALL tra_bbl_init_tam ! advective (and/or diffusive) bottom boundary layer scheme |
---|
| 362 | IF( ln_tradmp ) CALL tra_dmp_init_tam ! internal damping trends |
---|
| 363 | CALL tra_adv_init_tam ! horizontal & vertical advection |
---|
| 364 | CALL tra_ldf_init_tam ! lateral mixing |
---|
| 365 | CALL tra_zdf_init_tam ! vertical mixing and after tracer fields |
---|
| 366 | |
---|
| 367 | ! ! Dynamics |
---|
| 368 | CALL dyn_adv_init_tam ! advection (vector or flux form) |
---|
| 369 | CALL dyn_vor_init_tam ! vorticity term including Coriolis |
---|
| 370 | CALL dyn_ldf_init_tam ! lateral mixing |
---|
| 371 | CALL dyn_hpg_init_tam ! horizontal gradient of Hydrostatic pressure |
---|
| 372 | CALL dyn_zdf_init_tam ! vertical diffusion |
---|
| 373 | CALL dyn_spg_init_tam ! surface pressure gradient |
---|
| 374 | |
---|
| 375 | ! ! Misc. options |
---|
| 376 | IF( nn_cla == 1 ) CALL cla_init_tam ! Cross Land Advection |
---|
| 377 | CALL sbc_rnf_init_tam |
---|
| 378 | !#if defined key_top |
---|
| 379 | !! ! Passive tracers |
---|
| 380 | !CALL trc_init |
---|
| 381 | !#endif |
---|
| 382 | !! ! Diagnostics |
---|
| 383 | !IF( lk_floats ) CALL flo_init ! drifting Floats |
---|
| 384 | !CALL iom_init ! iom_put initialization |
---|
| 385 | !IF( lk_diaar5 ) CALL dia_ar5_init ! ar5 diag |
---|
| 386 | !CALL dia_ptr_init ! Poleward TRansports initialization |
---|
| 387 | !IF( lk_diadct ) CALL dia_dct_init ! Sections tranports |
---|
| 388 | !CALL dia_hsb_init ! heat content, salt content and volume budgets |
---|
| 389 | !CALL trd_mod_init ! Mixed-layer/Vorticity/Integral constraints trends |
---|
| 390 | !IF( lk_diaobs ) THEN ! Observation & model comparison |
---|
| 391 | !CALL dia_obs_init ! Initialize observational data |
---|
| 392 | !CALL dia_obs( nit000 - 1 ) ! Observation operator for restart |
---|
| 393 | !ENDIF |
---|
| 394 | !! ! Assimilation increments |
---|
| 395 | !IF( lk_asminc ) CALL asm_inc_init ! Initialize assimilation increments |
---|
| 396 | !IF(lwp) WRITE(numout,*) 'Euler time step switch is ', neuler |
---|
| 397 | ! |
---|
| 398 | CALL tam_trj_init |
---|
| 399 | CALL tam_tst_init |
---|
[3641] | 400 | CALL tl_trj_ini |
---|
[3611] | 401 | END SUBROUTINE nemo_init_tam |
---|
| 402 | |
---|
| 403 | |
---|
| 404 | SUBROUTINE nemo_ctl_tam |
---|
| 405 | !!---------------------------------------------------------------------- |
---|
| 406 | !! *** ROUTINE nemo_ctl *** |
---|
| 407 | !! |
---|
| 408 | !! ** Purpose : control print setting |
---|
| 409 | !! |
---|
| 410 | !! ** Method : - print namctl information and check some consistencies |
---|
| 411 | !!---------------------------------------------------------------------- |
---|
| 412 | ! |
---|
| 413 | IF(lwp) THEN ! control print |
---|
| 414 | WRITE(numout,*) |
---|
| 415 | WRITE(numout,*) 'nemo_ctl_tam: Control prints & Benchmark' |
---|
| 416 | WRITE(numout,*) '~~~~~~~ ' |
---|
| 417 | WRITE(numout,*) ' Namelist namctl' |
---|
| 418 | WRITE(numout,*) ' run control (for debugging) ln_ctl = ', ln_ctl |
---|
| 419 | WRITE(numout,*) ' level of print nn_print = ', nn_print |
---|
| 420 | WRITE(numout,*) ' Start i indice for SUM control nn_ictls = ', nn_ictls |
---|
| 421 | WRITE(numout,*) ' End i indice for SUM control nn_ictle = ', nn_ictle |
---|
| 422 | WRITE(numout,*) ' Start j indice for SUM control nn_jctls = ', nn_jctls |
---|
| 423 | WRITE(numout,*) ' End j indice for SUM control nn_jctle = ', nn_jctle |
---|
| 424 | WRITE(numout,*) ' number of proc. following i nn_isplt = ', nn_isplt |
---|
| 425 | WRITE(numout,*) ' number of proc. following j nn_jsplt = ', nn_jsplt |
---|
| 426 | WRITE(numout,*) ' benchmark parameter (0/1) nn_bench = ', nn_bench |
---|
| 427 | ENDIF |
---|
| 428 | ! |
---|
| 429 | nprint = nn_print ! convert DOCTOR namelist names into OLD names |
---|
| 430 | nictls = nn_ictls |
---|
| 431 | nictle = nn_ictle |
---|
| 432 | njctls = nn_jctls |
---|
| 433 | njctle = nn_jctle |
---|
| 434 | isplt = nn_isplt |
---|
| 435 | jsplt = nn_jsplt |
---|
| 436 | nbench = nn_bench |
---|
| 437 | ! ! Parameter control |
---|
| 438 | ! |
---|
| 439 | IF( ln_ctl ) THEN ! sub-domain area indices for the control prints |
---|
| 440 | IF( lk_mpp .AND. jpnij > 1 ) THEN |
---|
| 441 | isplt = jpni ; jsplt = jpnj ; ijsplt = jpni*jpnj ! the domain is forced to the real split domain |
---|
| 442 | ELSE |
---|
| 443 | IF( isplt == 1 .AND. jsplt == 1 ) THEN |
---|
| 444 | CALL ctl_warn( ' - isplt & jsplt are equal to 1', & |
---|
| 445 | & ' - the print control will be done over the whole domain' ) |
---|
| 446 | ENDIF |
---|
| 447 | ijsplt = isplt * jsplt ! total number of processors ijsplt |
---|
| 448 | ENDIF |
---|
| 449 | IF(lwp) WRITE(numout,*)' - The total number of processors over which the' |
---|
| 450 | IF(lwp) WRITE(numout,*)' print control will be done is ijsplt : ', ijsplt |
---|
| 451 | ! |
---|
| 452 | ! ! indices used for the SUM control |
---|
| 453 | IF( nictls+nictle+njctls+njctle == 0 ) THEN ! print control done over the default area |
---|
| 454 | lsp_area = .FALSE. |
---|
| 455 | ELSE ! print control done over a specific area |
---|
| 456 | lsp_area = .TRUE. |
---|
| 457 | IF( nictls < 1 .OR. nictls > jpiglo ) THEN |
---|
| 458 | CALL ctl_warn( ' - nictls must be 1<=nictls>=jpiglo, it is forced to 1' ) |
---|
| 459 | nictls = 1 |
---|
| 460 | ENDIF |
---|
| 461 | IF( nictle < 1 .OR. nictle > jpiglo ) THEN |
---|
| 462 | CALL ctl_warn( ' - nictle must be 1<=nictle>=jpiglo, it is forced to jpiglo' ) |
---|
| 463 | nictle = jpiglo |
---|
| 464 | ENDIF |
---|
| 465 | IF( njctls < 1 .OR. njctls > jpjglo ) THEN |
---|
| 466 | CALL ctl_warn( ' - njctls must be 1<=njctls>=jpjglo, it is forced to 1' ) |
---|
| 467 | njctls = 1 |
---|
| 468 | ENDIF |
---|
| 469 | IF( njctle < 1 .OR. njctle > jpjglo ) THEN |
---|
| 470 | CALL ctl_warn( ' - njctle must be 1<=njctle>=jpjglo, it is forced to jpjglo' ) |
---|
| 471 | njctle = jpjglo |
---|
| 472 | ENDIF |
---|
| 473 | ENDIF |
---|
| 474 | ENDIF |
---|
| 475 | ! |
---|
| 476 | IF( nbench == 1 ) THEN ! Benchmark |
---|
| 477 | SELECT CASE ( cp_cfg ) |
---|
| 478 | CASE ( 'gyre' ) ; CALL ctl_warn( ' The Benchmark is activated ' ) |
---|
| 479 | CASE DEFAULT ; CALL ctl_stop( ' The Benchmark is based on the GYRE configuration:', & |
---|
| 480 | & ' key_gyre must be used or set nbench = 0' ) |
---|
| 481 | END SELECT |
---|
| 482 | ENDIF |
---|
| 483 | ! |
---|
| 484 | IF( lk_c1d .AND. .NOT.lk_iomput ) CALL ctl_stop( 'nemo_ctl_tam: The 1D configuration must be used ', & |
---|
| 485 | & 'with the IOM Input/Output manager. ' , & |
---|
| 486 | & 'Compile with key_iomput enabled' ) |
---|
| 487 | ! |
---|
| 488 | END SUBROUTINE nemo_ctl_tam |
---|
| 489 | |
---|
| 490 | |
---|
| 491 | SUBROUTINE nemo_closefile |
---|
| 492 | !!---------------------------------------------------------------------- |
---|
| 493 | !! *** ROUTINE nemo_closefile *** |
---|
| 494 | !! |
---|
| 495 | !! ** Purpose : Close the files |
---|
| 496 | !!---------------------------------------------------------------------- |
---|
| 497 | ! |
---|
| 498 | IF( lk_mpp ) CALL mppsync |
---|
| 499 | ! |
---|
| 500 | CALL iom_close ! close all input/output files managed by iom_* |
---|
| 501 | ! |
---|
| 502 | IF( numstp /= -1 ) CLOSE( numstp ) ! time-step file |
---|
| 503 | IF( numsol /= -1 ) CLOSE( numsol ) ! solver file |
---|
| 504 | IF( numnam /= -1 ) CLOSE( numnam ) ! oce namelist |
---|
| 505 | IF( numnam_ice /= -1 ) CLOSE( numnam_ice ) ! ice namelist |
---|
| 506 | IF( numevo_ice /= -1 ) CLOSE( numevo_ice ) ! ice variables (temp. evolution) |
---|
| 507 | IF( numout /= 6 ) CLOSE( numout ) ! standard model output file |
---|
| 508 | IF( numdct_vol /= -1 ) CLOSE( numdct_vol ) ! volume transports |
---|
| 509 | IF( numdct_heat /= -1 ) CLOSE( numdct_heat ) ! heat transports |
---|
| 510 | IF( numdct_salt /= -1 ) CLOSE( numdct_salt ) ! salt transports |
---|
| 511 | ! |
---|
| 512 | numout = 6 ! redefine numout in case it is used after this point... |
---|
| 513 | ! |
---|
| 514 | END SUBROUTINE nemo_closefile |
---|
| 515 | |
---|
| 516 | |
---|
| 517 | SUBROUTINE nemo_alloc_tam |
---|
| 518 | !!---------------------------------------------------------------------- |
---|
| 519 | !! *** ROUTINE nemo_alloc *** |
---|
| 520 | !! |
---|
| 521 | !! ** Purpose : Allocate all the dynamic arrays of the OPA modules |
---|
| 522 | !! |
---|
| 523 | !! ** Method : |
---|
| 524 | !!---------------------------------------------------------------------- |
---|
| 525 | ! |
---|
| 526 | INTEGER :: ierr |
---|
| 527 | !!---------------------------------------------------------------------- |
---|
| 528 | ! |
---|
| 529 | ierr = oce_alloc_tam ( 0 ) ! ocean |
---|
| 530 | ierr = ierr + zdf_oce_alloc_tam ( ) ! ocean vertical physics |
---|
| 531 | ! |
---|
| 532 | ierr = ierr + lib_mpp_alloc_adj (numout) ! mpp exchanges |
---|
| 533 | ierr = ierr + trc_oce_alloc_tam ( 0 ) ! shared TRC / TRA arrays |
---|
| 534 | ierr = ierr + sbc_oce_alloc_tam ( 0 ) ! shared TRC / TRA arrays |
---|
| 535 | ierr = ierr + sol_oce_alloc_tam ( 0 ) ! shared TRC / TRA arrays |
---|
| 536 | ! |
---|
| 537 | IF( lk_mpp ) CALL mpp_sum( ierr ) |
---|
| 538 | IF( ierr /= 0 ) CALL ctl_stop( 'STOP', 'nemo_alloc_tam : unable to allocate standard ocean arrays' ) |
---|
| 539 | ! |
---|
| 540 | END SUBROUTINE nemo_alloc_tam |
---|
| 541 | |
---|
| 542 | |
---|
| 543 | SUBROUTINE nemo_partition( num_pes ) |
---|
| 544 | !!---------------------------------------------------------------------- |
---|
| 545 | !! *** ROUTINE nemo_partition *** |
---|
| 546 | !! |
---|
| 547 | !! ** Purpose : |
---|
| 548 | !! |
---|
| 549 | !! ** Method : |
---|
| 550 | !!---------------------------------------------------------------------- |
---|
| 551 | INTEGER, INTENT(in) :: num_pes ! The number of MPI processes we have |
---|
| 552 | ! |
---|
| 553 | INTEGER, PARAMETER :: nfactmax = 20 |
---|
| 554 | INTEGER :: nfact ! The no. of factors returned |
---|
| 555 | INTEGER :: ierr ! Error flag |
---|
| 556 | INTEGER :: ji |
---|
| 557 | INTEGER :: idiff, mindiff, imin ! For choosing pair of factors that are closest in value |
---|
| 558 | INTEGER, DIMENSION(nfactmax) :: ifact ! Array of factors |
---|
| 559 | !!---------------------------------------------------------------------- |
---|
| 560 | |
---|
| 561 | ierr = 0 |
---|
| 562 | |
---|
| 563 | CALL factorise( ifact, nfactmax, nfact, num_pes, ierr ) |
---|
| 564 | |
---|
| 565 | IF( nfact <= 1 ) THEN |
---|
| 566 | WRITE (numout, *) 'WARNING: factorisation of number of PEs failed' |
---|
| 567 | WRITE (numout, *) ' : using grid of ',num_pes,' x 1' |
---|
| 568 | jpnj = 1 |
---|
| 569 | jpni = num_pes |
---|
| 570 | ELSE |
---|
| 571 | ! Search through factors for the pair that are closest in value |
---|
| 572 | mindiff = 1000000 |
---|
| 573 | imin = 1 |
---|
| 574 | DO ji = 1, nfact-1, 2 |
---|
| 575 | idiff = ABS( ifact(ji) - ifact(ji+1) ) |
---|
| 576 | IF( idiff < mindiff ) THEN |
---|
| 577 | mindiff = idiff |
---|
| 578 | imin = ji |
---|
| 579 | ENDIF |
---|
| 580 | END DO |
---|
| 581 | jpnj = ifact(imin) |
---|
| 582 | jpni = ifact(imin + 1) |
---|
| 583 | ENDIF |
---|
| 584 | ! |
---|
| 585 | jpnij = jpni*jpnj |
---|
| 586 | ! |
---|
| 587 | END SUBROUTINE nemo_partition |
---|
| 588 | |
---|
| 589 | |
---|
| 590 | SUBROUTINE factorise( kfax, kmaxfax, knfax, kn, kerr ) |
---|
| 591 | !!---------------------------------------------------------------------- |
---|
| 592 | !! *** ROUTINE factorise *** |
---|
| 593 | !! |
---|
| 594 | !! ** Purpose : return the prime factors of n. |
---|
| 595 | !! knfax factors are returned in array kfax which is of |
---|
| 596 | !! maximum dimension kmaxfax. |
---|
| 597 | !! ** Method : |
---|
| 598 | !!---------------------------------------------------------------------- |
---|
| 599 | INTEGER , INTENT(in ) :: kn, kmaxfax |
---|
| 600 | INTEGER , INTENT( out) :: kerr, knfax |
---|
| 601 | INTEGER, DIMENSION(kmaxfax), INTENT( out) :: kfax |
---|
| 602 | ! |
---|
| 603 | INTEGER :: ifac, jl, inu |
---|
| 604 | INTEGER, PARAMETER :: ntest = 14 |
---|
| 605 | INTEGER :: ilfax(ntest) |
---|
| 606 | |
---|
| 607 | ! lfax contains the set of allowed factors. |
---|
| 608 | data (ilfax(jl),jl=1,ntest) / 16384, 8192, 4096, 2048, 1024, 512, 256, & |
---|
| 609 | & 128, 64, 32, 16, 8, 4, 2 / |
---|
| 610 | !!---------------------------------------------------------------------- |
---|
| 611 | |
---|
| 612 | ! Clear the error flag and initialise output vars |
---|
| 613 | kerr = 0 |
---|
| 614 | kfax = 1 |
---|
| 615 | knfax = 0 |
---|
| 616 | |
---|
| 617 | ! Find the factors of n. |
---|
| 618 | IF( kn == 1 ) GOTO 20 |
---|
| 619 | |
---|
| 620 | ! nu holds the unfactorised part of the number. |
---|
| 621 | ! knfax holds the number of factors found. |
---|
| 622 | ! l points to the allowed factor list. |
---|
| 623 | ! ifac holds the current factor. |
---|
| 624 | |
---|
| 625 | inu = kn |
---|
| 626 | knfax = 0 |
---|
| 627 | |
---|
| 628 | DO jl = ntest, 1, -1 |
---|
| 629 | ! |
---|
| 630 | ifac = ilfax(jl) |
---|
| 631 | IF( ifac > inu ) CYCLE |
---|
| 632 | |
---|
| 633 | ! Test whether the factor will divide. |
---|
| 634 | |
---|
| 635 | IF( MOD(inu,ifac) == 0 ) THEN |
---|
| 636 | ! |
---|
| 637 | knfax = knfax + 1 ! Add the factor to the list |
---|
| 638 | IF( knfax > kmaxfax ) THEN |
---|
| 639 | kerr = 6 |
---|
| 640 | write (*,*) 'FACTOR: insufficient space in factor array ', knfax |
---|
| 641 | return |
---|
| 642 | ENDIF |
---|
| 643 | kfax(knfax) = ifac |
---|
| 644 | ! Store the other factor that goes with this one |
---|
| 645 | knfax = knfax + 1 |
---|
| 646 | kfax(knfax) = inu / ifac |
---|
| 647 | !WRITE (*,*) 'ARPDBG, factors ',knfax-1,' & ',knfax,' are ', kfax(knfax-1),' and ',kfax(knfax) |
---|
| 648 | ENDIF |
---|
| 649 | ! |
---|
| 650 | END DO |
---|
| 651 | |
---|
| 652 | 20 CONTINUE ! Label 20 is the exit point from the factor search loop. |
---|
| 653 | ! |
---|
| 654 | END SUBROUTINE factorise |
---|
| 655 | |
---|
| 656 | #if defined key_mpp_mpi |
---|
| 657 | SUBROUTINE nemo_northcomms |
---|
| 658 | !!====================================================================== |
---|
| 659 | !! *** ROUTINE nemo_northcomms *** |
---|
| 660 | !! nemo_northcomms : Setup for north fold exchanges with explicit peer to peer messaging |
---|
| 661 | !!===================================================================== |
---|
| 662 | !!---------------------------------------------------------------------- |
---|
| 663 | !! |
---|
| 664 | !! ** Purpose : Initialization of the northern neighbours lists. |
---|
| 665 | !!---------------------------------------------------------------------- |
---|
| 666 | !! 1.0 ! 2011-10 (A. C. Coward, NOCS & J. Donners, PRACE) |
---|
| 667 | !!---------------------------------------------------------------------- |
---|
| 668 | |
---|
| 669 | INTEGER :: ji, jj, jk, ij, jtyp ! dummy loop indices |
---|
| 670 | INTEGER :: ijpj ! number of rows involved in north-fold exchange |
---|
| 671 | INTEGER :: northcomms_alloc ! allocate return status |
---|
| 672 | REAL(wp), ALLOCATABLE, DIMENSION ( :,: ) :: znnbrs ! workspace |
---|
| 673 | LOGICAL, ALLOCATABLE, DIMENSION ( : ) :: lrankset ! workspace |
---|
| 674 | |
---|
| 675 | IF(lwp) WRITE(numout,*) |
---|
| 676 | IF(lwp) WRITE(numout,*) 'nemo_northcomms : Initialization of the northern neighbours lists' |
---|
| 677 | IF(lwp) WRITE(numout,*) '~~~~~~~~~~' |
---|
| 678 | |
---|
| 679 | !!---------------------------------------------------------------------- |
---|
| 680 | ALLOCATE( znnbrs(jpi,jpj), stat = northcomms_alloc ) |
---|
| 681 | ALLOCATE( lrankset(jpnij), stat = northcomms_alloc ) |
---|
| 682 | IF( northcomms_alloc /= 0 ) THEN |
---|
| 683 | WRITE(numout,cform_war) |
---|
| 684 | WRITE(numout,*) 'northcomms_alloc : failed to allocate arrays' |
---|
| 685 | CALL ctl_stop( 'STOP', 'nemo_northcomms : unable to allocate temporary arrays' ) |
---|
| 686 | ENDIF |
---|
| 687 | nsndto = 0 |
---|
| 688 | isendto = -1 |
---|
| 689 | ijpj = 4 |
---|
| 690 | ! |
---|
| 691 | ! This routine has been called because ln_nnogather has been set true ( nammpp ) |
---|
| 692 | ! However, these first few exchanges have to use the mpi_allgather method to |
---|
| 693 | ! establish the neighbour lists to use in subsequent peer to peer exchanges. |
---|
| 694 | ! Consequently, set l_north_nogather to be false here and set it true only after |
---|
| 695 | ! the lists have been established. |
---|
| 696 | ! |
---|
| 697 | l_north_nogather = .FALSE. |
---|
| 698 | ! |
---|
| 699 | ! Exchange and store ranks on northern rows |
---|
| 700 | |
---|
| 701 | DO jtyp = 1,4 |
---|
| 702 | |
---|
| 703 | lrankset = .FALSE. |
---|
| 704 | znnbrs = narea |
---|
| 705 | SELECT CASE (jtyp) |
---|
| 706 | CASE(1) |
---|
| 707 | CALL lbc_lnk( znnbrs, 'T', 1. ) ! Type 1: T,W-points |
---|
| 708 | CASE(2) |
---|
| 709 | CALL lbc_lnk( znnbrs, 'U', 1. ) ! Type 2: U-point |
---|
| 710 | CASE(3) |
---|
| 711 | CALL lbc_lnk( znnbrs, 'V', 1. ) ! Type 3: V-point |
---|
| 712 | CASE(4) |
---|
| 713 | CALL lbc_lnk( znnbrs, 'F', 1. ) ! Type 4: F-point |
---|
| 714 | END SELECT |
---|
| 715 | |
---|
| 716 | IF ( njmppt(narea) .EQ. MAXVAL( njmppt ) ) THEN |
---|
| 717 | DO jj = nlcj-ijpj+1, nlcj |
---|
| 718 | ij = jj - nlcj + ijpj |
---|
| 719 | DO ji = 1,jpi |
---|
| 720 | IF ( INT(znnbrs(ji,jj)) .NE. 0 .AND. INT(znnbrs(ji,jj)) .NE. narea ) & |
---|
| 721 | & lrankset(INT(znnbrs(ji,jj))) = .true. |
---|
| 722 | END DO |
---|
| 723 | END DO |
---|
| 724 | |
---|
| 725 | DO jj = 1,jpnij |
---|
| 726 | IF ( lrankset(jj) ) THEN |
---|
| 727 | nsndto(jtyp) = nsndto(jtyp) + 1 |
---|
| 728 | IF ( nsndto(jtyp) .GT. jpmaxngh ) THEN |
---|
| 729 | CALL ctl_stop( ' Too many neighbours in nemo_northcomms ', & |
---|
| 730 | & ' jpmaxngh will need to be increased ') |
---|
| 731 | ENDIF |
---|
| 732 | isendto(nsndto(jtyp),jtyp) = jj-1 ! narea converted to MPI rank |
---|
| 733 | ENDIF |
---|
| 734 | END DO |
---|
| 735 | ENDIF |
---|
| 736 | |
---|
| 737 | END DO |
---|
| 738 | |
---|
| 739 | ! |
---|
| 740 | ! Type 5: I-point |
---|
| 741 | ! |
---|
| 742 | ! ICE point exchanges may involve some averaging. The neighbours list is |
---|
| 743 | ! built up using two exchanges to ensure that the whole stencil is covered. |
---|
| 744 | ! lrankset should not be reset between these 'J' and 'K' point exchanges |
---|
| 745 | |
---|
| 746 | jtyp = 5 |
---|
| 747 | lrankset = .FALSE. |
---|
| 748 | znnbrs = narea |
---|
| 749 | CALL lbc_lnk( znnbrs, 'J', 1. ) ! first ice U-V point |
---|
| 750 | |
---|
| 751 | IF ( njmppt(narea) .EQ. MAXVAL( njmppt ) ) THEN |
---|
| 752 | DO jj = nlcj-ijpj+1, nlcj |
---|
| 753 | ij = jj - nlcj + ijpj |
---|
| 754 | DO ji = 1,jpi |
---|
| 755 | IF ( INT(znnbrs(ji,jj)) .NE. 0 .AND. INT(znnbrs(ji,jj)) .NE. narea ) & |
---|
| 756 | & lrankset(INT(znnbrs(ji,jj))) = .true. |
---|
| 757 | END DO |
---|
| 758 | END DO |
---|
| 759 | ENDIF |
---|
| 760 | |
---|
| 761 | znnbrs = narea |
---|
| 762 | CALL lbc_lnk( znnbrs, 'K', 1. ) ! second ice U-V point |
---|
| 763 | |
---|
| 764 | IF ( njmppt(narea) .EQ. MAXVAL( njmppt )) THEN |
---|
| 765 | DO jj = nlcj-ijpj+1, nlcj |
---|
| 766 | ij = jj - nlcj + ijpj |
---|
| 767 | DO ji = 1,jpi |
---|
| 768 | IF ( INT(znnbrs(ji,jj)) .NE. 0 .AND. INT(znnbrs(ji,jj)) .NE. narea ) & |
---|
| 769 | & lrankset( INT(znnbrs(ji,jj))) = .true. |
---|
| 770 | END DO |
---|
| 771 | END DO |
---|
| 772 | |
---|
| 773 | DO jj = 1,jpnij |
---|
| 774 | IF ( lrankset(jj) ) THEN |
---|
| 775 | nsndto(jtyp) = nsndto(jtyp) + 1 |
---|
| 776 | IF ( nsndto(jtyp) .GT. jpmaxngh ) THEN |
---|
| 777 | CALL ctl_stop( ' Too many neighbours in nemo_northcomms ', & |
---|
| 778 | & ' jpmaxngh will need to be increased ') |
---|
| 779 | ENDIF |
---|
| 780 | isendto(nsndto(jtyp),jtyp) = jj-1 ! narea converted to MPI rank |
---|
| 781 | ENDIF |
---|
| 782 | END DO |
---|
| 783 | ! |
---|
| 784 | ! For northern row areas, set l_north_nogather so that all subsequent exchanges |
---|
| 785 | ! can use peer to peer communications at the north fold |
---|
| 786 | ! |
---|
| 787 | l_north_nogather = .TRUE. |
---|
| 788 | ! |
---|
| 789 | ENDIF |
---|
| 790 | DEALLOCATE( znnbrs ) |
---|
| 791 | DEALLOCATE( lrankset ) |
---|
| 792 | |
---|
| 793 | END SUBROUTINE nemo_northcomms |
---|
| 794 | #else |
---|
| 795 | SUBROUTINE nemo_northcomms ! Dummy routine |
---|
| 796 | WRITE(*,*) 'nemo_northcomms: You should not have seen this print! error?' |
---|
| 797 | END SUBROUTINE nemo_northcomms |
---|
| 798 | #endif |
---|
| 799 | #else |
---|
| 800 | CONTAINS |
---|
| 801 | SUBROUTINE nemo_gcm_tam |
---|
| 802 | WRITE(*,*) 'nemo_gcm_tam: You should not have seen this print! error?' |
---|
| 803 | END SUBROUTINE nemo_gcm_tam |
---|
| 804 | #endif |
---|
| 805 | !!====================================================================== |
---|
| 806 | END MODULE nemogcm_tam |
---|