[1673] | 1 | ! $Id: leapfrog_loc.f90 5195 2024-09-16 13:18:00Z fhourdin $ |
---|
[5099] | 2 | |
---|
[5101] | 3 | SUBROUTINE leapfrog_loc(ucov0, vcov0, teta0, ps0, & |
---|
| 4 | masse0, phis0, q0, time_0) |
---|
[1632] | 5 | |
---|
[5101] | 6 | USE misc_mod |
---|
| 7 | USE parallel_lmdz |
---|
| 8 | USE times |
---|
| 9 | USE mod_hallo |
---|
| 10 | USE Bands |
---|
[5117] | 11 | USE lmdz_strings, ONLY: int2str |
---|
[5101] | 12 | USE Write_Field_p |
---|
[5117] | 13 | USE lmdz_vampir |
---|
[5107] | 14 | USE lmdz_timer_filtre, ONLY: print_filtre_timer |
---|
[5182] | 15 | USE lmdz_infotrac |
---|
[5101] | 16 | USE guide_loc_mod, ONLY: guide_main |
---|
| 17 | USE getparam |
---|
| 18 | USE control_mod |
---|
[5106] | 19 | USE lmdz_filtreg_p |
---|
[5101] | 20 | USE write_field_loc |
---|
| 21 | USE allocate_field_mod |
---|
| 22 | USE call_dissip_mod, ONLY: call_dissip |
---|
| 23 | USE lmdz_call_calfis, ONLY: call_calfis |
---|
| 24 | USE leapfrog_mod, ONLY: ucov, vcov, teta, ps, masse, phis, q, dq & |
---|
| 25 | , ucovm1, vcovm1, tetam1, massem1, psm1, p, pks, pk, pkf, flxw & |
---|
| 26 | , pbaru, pbarv, du, dv, dteta, phi, dp, w & |
---|
| 27 | , leapfrog_allocate, leapfrog_switch_caldyn, leapfrog_switch_dissip |
---|
[1632] | 28 | |
---|
[5117] | 29 | USE exner_hyb_loc_m, ONLY: exner_hyb_loc |
---|
| 30 | USE exner_milieu_loc_m, ONLY: exner_milieu_loc |
---|
[5101] | 31 | USE comconst_mod, ONLY: cpp, dtvr, ihf |
---|
| 32 | USE comvert_mod, ONLY: ap, bp, pressure_exner |
---|
| 33 | USE logic_mod, ONLY: iflag_phys, ok_guide, forward, leapf, apphys, & |
---|
| 34 | statcl, conser, apdiss, purmats, ok_strato |
---|
| 35 | USE temps_mod, ONLY: itaufin, jD_ref, jH_ref, day_ini, & |
---|
| 36 | day_ref, start_time, dt |
---|
| 37 | USE mod_xios_dyn3dmem, ONLY: dyn3d_ctx_handle |
---|
| 38 | USE lmdz_xios, ONLY: xios_update_calendar, & |
---|
| 39 | xios_set_current_context, & |
---|
| 40 | using_xios |
---|
[5185] | 41 | USE lmdz_cppkeys_wrapper, ONLY: CPPKEY_DEBUGIO, CPPKEY_REPROBUS |
---|
[5118] | 42 | USE lmdz_iniprint, ONLY: lunout, prt_level |
---|
[5134] | 43 | USE lmdz_academic, ONLY: tetarappel, knewt_t, kfrict, knewt_g, clat4 |
---|
| 44 | USE lmdz_comdissnew, ONLY: lstardis, nitergdiv, nitergrot, niterh, tetagdiv, & |
---|
| 45 | tetagrot, tetatemp, coefdis, vert_prof_dissip |
---|
[5136] | 46 | USE lmdz_comgeom |
---|
[1632] | 47 | |
---|
[5159] | 48 | USE lmdz_dimensions, ONLY: iim, jjm, llm, ndm |
---|
| 49 | USE lmdz_paramet |
---|
[5101] | 50 | IMPLICIT NONE |
---|
[3583] | 51 | |
---|
[5101] | 52 | ! ...... Version du 10/01/98 .......... |
---|
[1632] | 53 | |
---|
[5101] | 54 | ! avec coordonnees verticales hybrides |
---|
| 55 | ! avec nouveaux operat. dissipation * ( gradiv2,divgrad2,nxgraro2 ) |
---|
[1632] | 56 | |
---|
[5101] | 57 | !======================================================================= |
---|
[5159] | 58 | |
---|
[5101] | 59 | ! Auteur: P. Le Van /L. Fairhead/F.Hourdin |
---|
| 60 | ! ------- |
---|
[5159] | 61 | |
---|
[5101] | 62 | ! Objet: |
---|
| 63 | ! ------ |
---|
[5159] | 64 | |
---|
[5101] | 65 | ! GCM LMD nouvelle grille |
---|
[5159] | 66 | |
---|
[5101] | 67 | !======================================================================= |
---|
[5159] | 68 | |
---|
[5101] | 69 | ! ... Dans inigeom , nouveaux calculs pour les elongations cu , cv |
---|
| 70 | ! et possibilite d'appeler une fonction f(y) a derivee tangente |
---|
| 71 | ! hyperbolique a la place de la fonction a derivee sinusoidale. |
---|
[1632] | 72 | |
---|
[5101] | 73 | ! ... Possibilite de choisir le shema pour l'advection de |
---|
| 74 | ! q , en modifiant iadv dans traceur.def (10/02) . |
---|
[5159] | 75 | |
---|
[5101] | 76 | ! Pour Van-Leer + Vapeur d'eau saturee, iadv(1)=4. (F.Codron,10/99) |
---|
| 77 | ! Pour Van-Leer iadv=10 |
---|
[5159] | 78 | |
---|
[5101] | 79 | !----------------------------------------------------------------------- |
---|
| 80 | ! Declarations: |
---|
| 81 | ! ------------- |
---|
[1632] | 82 | |
---|
[5101] | 83 | REAL, INTENT(IN) :: time_0 ! not used |
---|
[1632] | 84 | |
---|
[5101] | 85 | ! dynamical variables: |
---|
| 86 | REAL, INTENT(IN) :: ucov0(ijb_u:ije_u, llm) ! zonal covariant wind |
---|
| 87 | REAL, INTENT(IN) :: vcov0(ijb_v:ije_v, llm) ! meridional covariant wind |
---|
| 88 | REAL, INTENT(IN) :: teta0(ijb_u:ije_u, llm) ! potential temperature |
---|
| 89 | REAL, INTENT(IN) :: q0(ijb_u:ije_u, llm, nqtot) ! advected tracers |
---|
| 90 | REAL, INTENT(IN) :: ps0(ijb_u:ije_u) ! surface pressure (Pa) |
---|
| 91 | REAL, INTENT(IN) :: masse0(ijb_u:ije_u, llm) ! air mass |
---|
| 92 | REAL, INTENT(IN) :: phis0(ijb_u:ije_u) ! geopotentiat at the surface |
---|
[1987] | 93 | |
---|
[5116] | 94 | REAL :: zqmin, zqmax |
---|
[1632] | 95 | |
---|
[5101] | 96 | ! REAL,SAVE,ALLOCATABLE :: p (:,: ) ! pression aux interfac.des couches |
---|
| 97 | ! REAL,SAVE,ALLOCATABLE :: pks(:) ! exner au sol |
---|
| 98 | ! REAL,SAVE,ALLOCATABLE :: pk(:,:) ! exner au milieu des couches |
---|
| 99 | ! REAL,SAVE,ALLOCATABLE :: pkf(:,:) ! exner filt.au milieu des couches |
---|
| 100 | ! REAL,SAVE,ALLOCATABLE :: phi(:,:) ! geopotentiel |
---|
| 101 | ! REAL,SAVE,ALLOCATABLE :: w(:,:) ! vitesse verticale |
---|
[1632] | 102 | |
---|
[5101] | 103 | ! variables dynamiques intermediaire pour le transport |
---|
| 104 | ! REAL,SAVE,ALLOCATABLE :: pbaru(:,:),pbarv(:,:) !flux de masse |
---|
[1632] | 105 | |
---|
[5101] | 106 | ! variables dynamiques au pas -1 |
---|
| 107 | ! REAL,SAVE,ALLOCATABLE :: vcovm1(:,:),ucovm1(:,:) |
---|
| 108 | ! REAL,SAVE,ALLOCATABLE :: tetam1(:,:),psm1(:) |
---|
| 109 | ! REAL,SAVE,ALLOCATABLE :: massem1(:,:) |
---|
[1632] | 110 | |
---|
[5101] | 111 | ! tendances dynamiques |
---|
| 112 | ! REAL,SAVE,ALLOCATABLE :: dv(:,:),du(:,:) |
---|
| 113 | ! REAL,SAVE,ALLOCATABLE :: dteta(:,:),dp(:) |
---|
| 114 | ! REAL,DIMENSION(:,:,:), ALLOCATABLE, SAVE :: dq |
---|
[1632] | 115 | |
---|
[5101] | 116 | ! tendances de la dissipation |
---|
| 117 | ! REAL,SAVE,ALLOCATABLE :: dvdis(:,:),dudis(:,:) |
---|
| 118 | ! REAL,SAVE,ALLOCATABLE :: dtetadis(:,:) |
---|
[1632] | 119 | |
---|
[5101] | 120 | ! tendances physiques |
---|
| 121 | REAL, SAVE, ALLOCATABLE :: dvfi(:, :), dufi(:, :) |
---|
| 122 | REAL, SAVE, ALLOCATABLE :: dtetafi(:, :) |
---|
| 123 | REAL, SAVE, ALLOCATABLE :: dpfi(:) |
---|
| 124 | REAL, DIMENSION(:, :, :), ALLOCATABLE, SAVE :: dqfi |
---|
[1632] | 125 | |
---|
[5101] | 126 | ! variables pour le fichier histoire |
---|
| 127 | REAL :: dtav ! intervalle de temps elementaire |
---|
[1632] | 128 | |
---|
[5101] | 129 | REAL :: tppn(iim), tpps(iim), tpn, tps |
---|
[5159] | 130 | |
---|
[5101] | 131 | INTEGER :: itau, itaufinp1, iav |
---|
| 132 | ! INTEGER iday ! jour julien |
---|
| 133 | REAL :: time |
---|
[1632] | 134 | |
---|
[5101] | 135 | ! REAL,SAVE,ALLOCATABLE :: finvmaold(:,:) |
---|
[1632] | 136 | |
---|
[5101] | 137 | !ym LOGICAL lafin |
---|
| 138 | LOGICAL :: lafin |
---|
| 139 | INTEGER :: ij, iq, l |
---|
| 140 | INTEGER :: ik |
---|
[1632] | 141 | |
---|
[5116] | 142 | REAL :: time_step, t_wrt, t_ops |
---|
[1632] | 143 | |
---|
[5101] | 144 | ! jD_cur: jour julien courant |
---|
| 145 | ! jH_cur: heure julienne courante |
---|
| 146 | REAL :: jD_cur, jH_cur |
---|
| 147 | INTEGER :: an, mois, jour |
---|
| 148 | REAL :: secondes |
---|
[1632] | 149 | |
---|
[5117] | 150 | LOGICAL :: physic |
---|
[5101] | 151 | LOGICAL :: first, callinigrads |
---|
[1632] | 152 | |
---|
[5103] | 153 | data callinigrads/.TRUE./ |
---|
[5116] | 154 | CHARACTER(LEN = 10) :: string10 |
---|
[1632] | 155 | |
---|
[5101] | 156 | ! REAL,SAVE,ALLOCATABLE :: flxw(:,:) ! flux de masse verticale |
---|
[1632] | 157 | |
---|
[5101] | 158 | !+jld variables test conservation energie |
---|
| 159 | ! REAL,SAVE,ALLOCATABLE :: ecin(:,:),ecin0(:,:) |
---|
| 160 | ! Tendance de la temp. potentiel d (theta)/ d t due a la |
---|
| 161 | ! tansformation d'energie cinetique en energie thermique |
---|
| 162 | ! cree par la dissipation |
---|
| 163 | ! REAL,SAVE,ALLOCATABLE :: dtetaecdt(:,:) |
---|
| 164 | ! REAL,SAVE,ALLOCATABLE :: vcont(:,:),ucont(:,:) |
---|
| 165 | ! REAL,SAVE,ALLOCATABLE :: vnat(:,:),unat(:,:) |
---|
| 166 | REAL :: d_h_vcol, d_qt, d_qw, d_ql, d_ec |
---|
| 167 | CHARACTER(len = 15) :: ztit |
---|
| 168 | !! INTEGER ip_ebil_dyn ! PRINT level for energy conserv. diag. |
---|
| 169 | ! SAVE ip_ebil_dyn |
---|
| 170 | ! DATA ip_ebil_dyn/0/ |
---|
| 171 | !-jld |
---|
[1632] | 172 | |
---|
[5116] | 173 | CHARACTER(LEN = 80) :: dynhist_file, dynhistave_file |
---|
| 174 | CHARACTER(LEN = *), parameter :: modname = "leapfrog_loc" |
---|
| 175 | CHARACTER(LEN = 80) :: abort_message |
---|
[1632] | 176 | |
---|
[5101] | 177 | logical, PARAMETER :: dissip_conservative = .TRUE. |
---|
[1632] | 178 | |
---|
[5101] | 179 | INTEGER :: testita |
---|
| 180 | PARAMETER (testita = 9) |
---|
[1632] | 181 | |
---|
[5103] | 182 | logical, parameter :: flag_verif = .FALSE. |
---|
[1632] | 183 | |
---|
[5101] | 184 | ! declaration liees au parallelisme |
---|
| 185 | INTEGER :: ierr |
---|
| 186 | LOGICAL :: FirstCaldyn |
---|
| 187 | LOGICAL :: FirstPhysic |
---|
| 188 | INTEGER :: ijb, ije, j, i |
---|
| 189 | type(Request) :: TestRequest |
---|
| 190 | type(Request) :: Request_Dissip |
---|
| 191 | type(Request) :: Request_physic |
---|
[2270] | 192 | |
---|
[5101] | 193 | INTEGER :: true_itau |
---|
| 194 | INTEGER :: iapptrac |
---|
| 195 | INTEGER :: AdjustCount |
---|
| 196 | ! INTEGER :: var_time |
---|
| 197 | LOGICAL :: ok_start_timer = .FALSE. |
---|
| 198 | LOGICAL, SAVE :: firstcall = .TRUE. |
---|
| 199 | TYPE(distrib), SAVE :: new_dist |
---|
[2038] | 200 | |
---|
[5101] | 201 | CALL check_isotopes(q0, ijb_u, ije_u, 'leapfrog204: debut') |
---|
[1632] | 202 | |
---|
[5101] | 203 | !$OMP MASTER |
---|
| 204 | ItCount = 0 |
---|
| 205 | !$OMP END MASTER |
---|
| 206 | true_itau = 0 |
---|
| 207 | FirstCaldyn = .TRUE. |
---|
| 208 | FirstPhysic = .TRUE. |
---|
| 209 | iapptrac = 0 |
---|
| 210 | AdjustCount = 0 |
---|
[5103] | 211 | lafin = .FALSE. |
---|
[2270] | 212 | |
---|
[5117] | 213 | IF (nday>=0) THEN |
---|
[5101] | 214 | itaufin = nday * day_step |
---|
| 215 | else |
---|
| 216 | itaufin = -nday |
---|
[5117] | 217 | ENDIF |
---|
[2270] | 218 | |
---|
[5101] | 219 | itaufinp1 = itaufin + 1 |
---|
[1632] | 220 | |
---|
[5101] | 221 | CALL check_isotopes(q0, ijb_u, ije_u, 'leapfrog 226') |
---|
[5099] | 222 | |
---|
[5101] | 223 | itau = 0 |
---|
[5103] | 224 | physic = .TRUE. |
---|
[5117] | 225 | IF (iflag_phys==0.OR.iflag_phys==2) physic = .FALSE. |
---|
[5101] | 226 | CALL init_nan |
---|
| 227 | CALL leapfrog_allocate |
---|
| 228 | ucov = ucov0 |
---|
| 229 | vcov = vcov0 |
---|
| 230 | teta = teta0 |
---|
| 231 | ps = ps0 |
---|
| 232 | masse = masse0 |
---|
| 233 | phis = phis0 |
---|
| 234 | q = q0 |
---|
[1632] | 235 | |
---|
[5101] | 236 | CALL check_isotopes(q, ijb_u, ije_u, 'leapfrog 239') |
---|
[1632] | 237 | |
---|
[5101] | 238 | ! iday = day_ini+itau/day_step |
---|
| 239 | ! time = REAL(itau-(iday-day_ini)*day_step)/day_step+time_0 |
---|
| 240 | ! IF(time.GT.1.) THEN |
---|
| 241 | ! time = time-1. |
---|
| 242 | ! iday = iday+1 |
---|
| 243 | ! ENDIF |
---|
[1632] | 244 | |
---|
[5101] | 245 | ! Allocate variables depending on dynamic variable nqtot |
---|
| 246 | !$OMP MASTER |
---|
[5117] | 247 | IF (firstcall) THEN |
---|
[5101] | 248 | ! ALLOCATE(p(ijb_u:ije_u,llmp1)) |
---|
| 249 | ! ALLOCATE(pks(ijb_u:ije_u)) |
---|
| 250 | ! ALLOCATE(pk(ijb_u:ije_u,llm)) |
---|
| 251 | ! ALLOCATE(pkf(ijb_u:ije_u,llm)) |
---|
| 252 | ! ALLOCATE(phi(ijb_u:ije_u,llm)) |
---|
| 253 | ! ALLOCATE(w(ijb_u:ije_u,llm)) |
---|
| 254 | ! ALLOCATE(pbaru(ip1jmp1,llm),pbarv(ip1jm,llm)) |
---|
| 255 | ! ALLOCATE(vcovm1(ijb_v:ije_v,llm),ucovm1(ijb_u:ije_u,llm)) |
---|
| 256 | ! ALLOCATE(tetam1(ijb_u:ije_u,llm),psm1(ijb_u:ije_u)) |
---|
| 257 | ! ALLOCATE(massem1(ijb_u:ije_u,llm)) |
---|
| 258 | ! ALLOCATE(dv(ijb_v:ije_v,llm),du(ijb_u:ije_u,llm)) |
---|
| 259 | ! ALLOCATE(dteta(ijb_u:ije_u,llm),dp(ijb_u:ije_u)) |
---|
| 260 | ! ALLOCATE(dvdis(ijb_v:ije_v,llm),dudis(ijb_u:ije_u,llm)) |
---|
| 261 | ! ALLOCATE(dtetadis(ijb_u:ije_u,llm)) |
---|
| 262 | ALLOCATE(dvfi(ijb_v:ije_v, llm), dufi(ijb_u:ije_u, llm)) |
---|
| 263 | ALLOCATE(dtetafi(ijb_u:ije_u, llm)) |
---|
| 264 | ALLOCATE(dpfi(ijb_u:ije_u)) |
---|
| 265 | ! ALLOCATE(dq(ijb_u:ije_u,llm,nqtot)) |
---|
| 266 | ALLOCATE(dqfi(ijb_u:ije_u, llm, nqtot)) |
---|
| 267 | ! ALLOCATE(dqfi_tmp(iip1,llm,nqtot)) |
---|
| 268 | ! ALLOCATE(finvmaold(ijb_u:ije_u,llm)) |
---|
| 269 | ! ALLOCATE(flxw(ijb_u:ije_u,llm)) |
---|
| 270 | ! ALLOCATE(ecin(ijb_u:ije_u,llm),ecin0(ijb_u:ije_u,llm)) |
---|
| 271 | ! ALLOCATE(dtetaecdt(ijb_u:ije_u,llm)) |
---|
| 272 | ! ALLOCATE(vcont(ijb_v:ije_v,llm),ucont(ijb_u:ije_u,llm)) |
---|
| 273 | ! ALLOCATE(vnat(ijb_v:ije_v,llm),unat(ijb_u:ije_u,llm)) |
---|
[5117] | 274 | ENDIF |
---|
[5101] | 275 | !$OMP END MASTER |
---|
| 276 | !$OMP BARRIER |
---|
[1632] | 277 | |
---|
[5101] | 278 | ! CALL dynredem1_loc("restart.nc",0.0, |
---|
| 279 | ! & vcov,ucov,teta,q,masse,ps) |
---|
[2375] | 280 | |
---|
| 281 | |
---|
[5101] | 282 | !----------------------------------------------------------------------- |
---|
| 283 | ! On initialise la pression et la fonction d'Exner : |
---|
| 284 | ! -------------------------------------------------- |
---|
[1632] | 285 | |
---|
[5101] | 286 | !$OMP MASTER |
---|
| 287 | dq(:, :, :) = 0. |
---|
| 288 | CALL pression (ijnb_u, ap, bp, ps, p) |
---|
| 289 | !$OMP END MASTER |
---|
[5117] | 290 | IF (pressure_exner) THEN |
---|
[5101] | 291 | CALL exner_hyb_loc(ijnb_u, ps, p, pks, pk, pkf) |
---|
| 292 | else |
---|
| 293 | CALL exner_milieu_loc(ijnb_u, ps, p, pks, pk, pkf) |
---|
[5117] | 294 | ENDIF |
---|
[5101] | 295 | !----------------------------------------------------------------------- |
---|
| 296 | ! Debut de l'integration temporelle: |
---|
| 297 | ! ---------------------------------- |
---|
| 298 | ! et du parallelisme !! |
---|
[1673] | 299 | |
---|
[5101] | 300 | 1 CONTINUE ! Matsuno Forward step begins here |
---|
[1632] | 301 | |
---|
[5101] | 302 | ! date: (NB: date remains unchanged for Backward step) |
---|
| 303 | ! ----- |
---|
[1632] | 304 | |
---|
[5101] | 305 | jD_cur = jD_ref + day_ini - day_ref + & |
---|
| 306 | (itau + 1) / day_step |
---|
| 307 | jH_cur = jH_ref + start_time + & |
---|
| 308 | mod(itau + 1, day_step) / float(day_step) |
---|
[5117] | 309 | IF (jH_cur > 1.0) THEN |
---|
[5101] | 310 | jD_cur = jD_cur + 1. |
---|
| 311 | jH_cur = jH_cur - 1. |
---|
[5117] | 312 | ENDIF |
---|
[1632] | 313 | |
---|
[5101] | 314 | CALL check_isotopes(q, ijb_u, ije_u, 'leapfrog 321') |
---|
[1632] | 315 | |
---|
[5117] | 316 | IF (ok_guide) THEN |
---|
[5185] | 317 | CALL guide_main(itau, ucov, vcov, teta, q, masse, ps) |
---|
| 318 | !$OMP BARRIER |
---|
[5117] | 319 | ENDIF |
---|
[1632] | 320 | |
---|
| 321 | |
---|
[5159] | 322 | |
---|
[5101] | 323 | ! IF( MOD( itau, 10* day_step ).EQ.0 ) THEN |
---|
| 324 | ! CALL test_period ( ucov,vcov,teta,q,p,phis ) |
---|
| 325 | ! PRINT *,' ---- Test_period apres continue OK ! -----', itau |
---|
| 326 | ! ENDIF |
---|
[5159] | 327 | |
---|
[5101] | 328 | !ym CALL SCOPY( ijmllm ,vcov , 1, vcovm1 , 1 ) |
---|
| 329 | !ym CALL SCOPY( ijp1llm,ucov , 1, ucovm1 , 1 ) |
---|
| 330 | !ym CALL SCOPY( ijp1llm,teta , 1, tetam1 , 1 ) |
---|
| 331 | !ym CALL SCOPY( ijp1llm,masse, 1, massem1, 1 ) |
---|
| 332 | !ym CALL SCOPY( ip1jmp1, ps , 1, psm1 , 1 ) |
---|
[1632] | 333 | |
---|
[5117] | 334 | IF (FirstCaldyn) THEN |
---|
[5101] | 335 | !$OMP MASTER |
---|
| 336 | ucovm1 = ucov |
---|
| 337 | vcovm1 = vcov |
---|
| 338 | tetam1 = teta |
---|
| 339 | massem1 = masse |
---|
| 340 | psm1 = ps |
---|
[1632] | 341 | |
---|
[5101] | 342 | ! Ehouarn: finvmaold is actually not used |
---|
| 343 | ! finvmaold = masse |
---|
| 344 | !$OMP END MASTER |
---|
| 345 | !$OMP BARRIER |
---|
| 346 | ! CALL filtreg_p ( finvmaold ,jjb_u,jje_u,jjb_u,jje_u,jjp1, llm, |
---|
| 347 | ! & -2,2, .TRUE., 1 ) |
---|
| 348 | else |
---|
| 349 | ! Save fields obtained at previous time step as '...m1' |
---|
| 350 | ijb = ij_begin |
---|
| 351 | ije = ij_end |
---|
[1632] | 352 | |
---|
[5101] | 353 | !$OMP MASTER |
---|
| 354 | psm1 (ijb:ije) = ps (ijb:ije) |
---|
| 355 | !$OMP END MASTER |
---|
[1632] | 356 | |
---|
[5101] | 357 | !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
| 358 | DO l = 1, llm |
---|
| 359 | ije = ij_end |
---|
| 360 | ucovm1 (ijb:ije, l) = ucov (ijb:ije, l) |
---|
| 361 | tetam1 (ijb:ije, l) = teta (ijb:ije, l) |
---|
| 362 | massem1 (ijb:ije, l) = masse (ijb:ije, l) |
---|
| 363 | ! finvmaold(ijb:ije,l)=masse(ijb:ije,l) |
---|
[1632] | 364 | |
---|
[5117] | 365 | IF (pole_sud) ije = ij_end - iip1 |
---|
[5101] | 366 | vcovm1(ijb:ije, l) = vcov (ijb:ije, l) |
---|
[1632] | 367 | |
---|
[5101] | 368 | ENDDO |
---|
| 369 | !$OMP ENDDO |
---|
[1632] | 370 | |
---|
[2270] | 371 | |
---|
[5101] | 372 | ! Ehouarn: finvmaold not used |
---|
| 373 | ! CALL filtreg_p(finvmaold ,jjb_u,jje_u,jj_begin,jj_end,jjp1, |
---|
| 374 | ! . llm, -2,2, .TRUE., 1 ) |
---|
[2270] | 375 | |
---|
[5117] | 376 | ENDIF ! of if (FirstCaldyn) |
---|
[1632] | 377 | |
---|
[5101] | 378 | forward = .TRUE. |
---|
| 379 | leapf = .FALSE. |
---|
| 380 | dt = dtvr |
---|
[2270] | 381 | |
---|
[5101] | 382 | ! ... P.Le Van .26/04/94 .... |
---|
[2270] | 383 | |
---|
[5101] | 384 | !ym CALL SCOPY ( ijp1llm, masse, 1, finvmaold, 1 ) |
---|
| 385 | !ym CALL filtreg ( finvmaold ,jjp1, llm, -2,2, .TRUE., 1 ) |
---|
[1632] | 386 | |
---|
[5101] | 387 | !ym ne sert a rien |
---|
| 388 | !ym CALL minmax(ijp1llm,q(:,:,3),zqmin,zqmax) |
---|
[1632] | 389 | |
---|
[5101] | 390 | CALL check_isotopes(q, ijb_u, ije_u, 'leapfrog 400') |
---|
[1632] | 391 | |
---|
[5101] | 392 | 2 CONTINUE ! Matsuno backward or leapfrog step begins here |
---|
[1632] | 393 | |
---|
[5101] | 394 | CALL check_isotopes(q, ijb_u, ije_u, 'leapfrog 402') |
---|
[1632] | 395 | |
---|
[5101] | 396 | !$OMP MASTER |
---|
| 397 | ItCount = ItCount + 1 |
---|
[5117] | 398 | IF (MOD(ItCount, 1)==1) THEN |
---|
[5103] | 399 | debug = .TRUE. |
---|
[5101] | 400 | else |
---|
[5103] | 401 | debug = .FALSE. |
---|
[5117] | 402 | ENDIF |
---|
[5101] | 403 | !$OMP END MASTER |
---|
| 404 | !----------------------------------------------------------------------- |
---|
[1632] | 405 | |
---|
[5101] | 406 | ! date: (NB: only leapfrog step requires recomputing date) |
---|
| 407 | ! ----- |
---|
[1657] | 408 | |
---|
[5101] | 409 | IF (leapf) THEN |
---|
| 410 | jD_cur = jD_ref + day_ini - day_ref + & |
---|
| 411 | (itau + 1) / day_step |
---|
| 412 | jH_cur = jH_ref + start_time + & |
---|
| 413 | mod(itau + 1, day_step) / float(day_step) |
---|
[5117] | 414 | IF (jH_cur > 1.0) THEN |
---|
[5101] | 415 | jD_cur = jD_cur + 1. |
---|
| 416 | jH_cur = jH_cur - 1. |
---|
| 417 | endif |
---|
| 418 | ENDIF |
---|
[1632] | 419 | |
---|
[5101] | 420 | ! gestion des appels de la physique et des dissipations: |
---|
| 421 | ! ------------------------------------------------------ |
---|
[5159] | 422 | |
---|
[5101] | 423 | ! ... P.Le Van ( 6/02/95 ) .... |
---|
[1632] | 424 | |
---|
[5101] | 425 | apphys = .FALSE. |
---|
| 426 | statcl = .FALSE. |
---|
| 427 | conser = .FALSE. |
---|
| 428 | apdiss = .FALSE. |
---|
[1632] | 429 | |
---|
[5101] | 430 | IF(purmats) THEN |
---|
[5113] | 431 | ! Purely Matsuno time stepping |
---|
[5101] | 432 | IF(MOD(itau, iconser) ==0.AND. forward) conser = .TRUE. |
---|
| 433 | IF(MOD(itau, dissip_period)==0.AND..NOT.forward) & |
---|
| 434 | apdiss = .TRUE. |
---|
| 435 | IF(MOD(itau, iphysiq)==0.AND..NOT.forward & |
---|
[5117] | 436 | .AND. physic) apphys = .TRUE. |
---|
[5101] | 437 | ELSE |
---|
[5113] | 438 | ! Leapfrog/Matsuno time stepping |
---|
[5101] | 439 | IF(MOD(itau, iconser) == 0) conser = .TRUE. |
---|
| 440 | IF(MOD(itau + 1, dissip_period)==0 .AND. .NOT. forward) & |
---|
| 441 | apdiss = .TRUE. |
---|
| 442 | IF(MOD(itau + 1, iphysiq)==0.AND.physic) apphys = .TRUE. |
---|
| 443 | END IF |
---|
[2270] | 444 | |
---|
[5101] | 445 | ! Ehouarn: for Shallow Water case (ie: 1 vertical layer), |
---|
| 446 | ! supress dissipation step |
---|
[5117] | 447 | IF (llm==1) THEN |
---|
[5103] | 448 | apdiss = .FALSE. |
---|
[5117] | 449 | ENDIF |
---|
[1673] | 450 | |
---|
[5101] | 451 | !ym ---> Pour le moment |
---|
| 452 | !ym apphys = .FALSE. |
---|
| 453 | statcl = .FALSE. |
---|
| 454 | ! conser = .FALSE. ! ie: no output of control variables to stdout in // |
---|
[1632] | 455 | |
---|
[5117] | 456 | IF (firstCaldyn) THEN |
---|
[5101] | 457 | !$OMP MASTER |
---|
| 458 | CALL Set_Distrib(distrib_caldyn) |
---|
| 459 | !$OMP END MASTER |
---|
| 460 | !$OMP BARRIER |
---|
| 461 | firstCaldyn = .FALSE. |
---|
| 462 | !ym CALL InitTime |
---|
| 463 | !$OMP MASTER |
---|
| 464 | CALL Init_timer |
---|
| 465 | !$OMP END MASTER |
---|
[5117] | 466 | ENDIF |
---|
[1632] | 467 | |
---|
[5101] | 468 | !$OMP MASTER |
---|
| 469 | IF (ok_start_timer) THEN |
---|
| 470 | CALL InitTime |
---|
| 471 | ok_start_timer = .FALSE. |
---|
| 472 | ENDIF |
---|
| 473 | !$OMP END MASTER |
---|
[5099] | 474 | |
---|
[5101] | 475 | CALL check_isotopes(q, ijb_u, ije_u, 'leapfrog 471') |
---|
[5099] | 476 | |
---|
[5101] | 477 | !ym PAS D'AJUSTEMENT POUR LE MOMENT |
---|
[5117] | 478 | IF (Adjust) THEN |
---|
[5101] | 479 | AdjustCount = AdjustCount + 1 |
---|
[5117] | 480 | ! if (iapptrac==iapp_tracvl .AND. (forward .OR. leapf) |
---|
| 481 | ! & .AND. itau/iphysiq>2 .AND. Adjustcount>30) THEN |
---|
| 482 | IF (Adjustcount>1) THEN |
---|
[5101] | 483 | AdjustCount = 0 |
---|
| 484 | !$OMP MASTER |
---|
| 485 | CALL allgather_timer_average |
---|
[1632] | 486 | |
---|
[5117] | 487 | IF (prt_level > 9) THEN |
---|
[5160] | 488 | PRINT *, '*********************************' |
---|
| 489 | PRINT *, '****** TIMER CALDYN ******' |
---|
[5158] | 490 | DO i = 0, mpi_size - 1 |
---|
[5160] | 491 | PRINT *, 'proc', i, ' : Nb Bandes :', jj_nb_caldyn(i), & |
---|
[5101] | 492 | ' : temps moyen :', & |
---|
| 493 | timer_average(jj_nb_caldyn(i), timer_caldyn, i), & |
---|
| 494 | '+-', timer_delta(jj_nb_caldyn(i), timer_caldyn, i) |
---|
| 495 | enddo |
---|
[1632] | 496 | |
---|
[5160] | 497 | PRINT *, '*********************************' |
---|
| 498 | PRINT *, '****** TIMER VANLEER ******' |
---|
[5158] | 499 | DO i = 0, mpi_size - 1 |
---|
[5160] | 500 | PRINT *, 'proc', i, ' : Nb Bandes :', jj_nb_vanleer(i), & |
---|
[5101] | 501 | ' : temps moyen :', & |
---|
| 502 | timer_average(jj_nb_vanleer(i), timer_vanleer, i), & |
---|
| 503 | '+-', timer_delta(jj_nb_vanleer(i), timer_vanleer, i) |
---|
| 504 | enddo |
---|
[1632] | 505 | |
---|
[5160] | 506 | PRINT *, '*********************************' |
---|
| 507 | PRINT *, '****** TIMER DISSIP ******' |
---|
[5158] | 508 | DO i = 0, mpi_size - 1 |
---|
[5160] | 509 | PRINT *, 'proc', i, ' : Nb Bandes :', jj_nb_dissip(i), & |
---|
[5101] | 510 | ' : temps moyen :', & |
---|
| 511 | timer_average(jj_nb_dissip(i), timer_dissip, i), & |
---|
| 512 | '+-', timer_delta(jj_nb_dissip(i), timer_dissip, i) |
---|
[1632] | 513 | enddo |
---|
| 514 | |
---|
[5101] | 515 | ! if (mpi_rank==0) CALL WriteBands |
---|
[1632] | 516 | |
---|
| 517 | endif |
---|
| 518 | |
---|
[5101] | 519 | CALL AdjustBands_caldyn(new_dist) |
---|
| 520 | !$OMP END MASTER |
---|
| 521 | !$OMP BARRIER |
---|
| 522 | CALL leapfrog_switch_caldyn(new_dist) |
---|
| 523 | !$OMP BARRIER |
---|
[2270] | 524 | |
---|
[1632] | 525 | |
---|
[5101] | 526 | !$OMP MASTER |
---|
| 527 | distrib_caldyn = new_dist |
---|
| 528 | CALL set_distrib(distrib_caldyn) |
---|
| 529 | !$OMP END MASTER |
---|
| 530 | !$OMP BARRIER |
---|
| 531 | ! CALL Register_SwapFieldHallo(ucov,ucov,ip1jmp1,llm, |
---|
| 532 | ! & jj_Nb_caldyn,0,0,TestRequest) |
---|
| 533 | ! CALL Register_SwapFieldHallo(ucovm1,ucovm1,ip1jmp1,llm, |
---|
| 534 | ! & jj_Nb_caldyn,0,0,TestRequest) |
---|
| 535 | ! CALL Register_SwapFieldHallo(vcov,vcov,ip1jm,llm, |
---|
| 536 | ! & jj_Nb_caldyn,0,0,TestRequest) |
---|
| 537 | ! CALL Register_SwapFieldHallo(vcovm1,vcovm1,ip1jm,llm, |
---|
| 538 | ! & jj_Nb_caldyn,0,0,TestRequest) |
---|
| 539 | ! CALL Register_SwapFieldHallo(teta,teta,ip1jmp1,llm, |
---|
| 540 | ! & jj_Nb_caldyn,0,0,TestRequest) |
---|
| 541 | ! CALL Register_SwapFieldHallo(tetam1,tetam1,ip1jmp1,llm, |
---|
| 542 | ! & jj_Nb_caldyn,0,0,TestRequest) |
---|
| 543 | ! CALL Register_SwapFieldHallo(masse,masse,ip1jmp1,llm, |
---|
| 544 | ! & jj_Nb_caldyn,0,0,TestRequest) |
---|
| 545 | ! CALL Register_SwapFieldHallo(massem1,massem1,ip1jmp1,llm, |
---|
| 546 | ! & jj_Nb_caldyn,0,0,TestRequest) |
---|
| 547 | ! CALL Register_SwapFieldHallo(ps,ps,ip1jmp1,1, |
---|
| 548 | ! & jj_Nb_caldyn,0,0,TestRequest) |
---|
| 549 | ! CALL Register_SwapFieldHallo(psm1,psm1,ip1jmp1,1, |
---|
| 550 | ! & jj_Nb_caldyn,0,0,TestRequest) |
---|
| 551 | ! CALL Register_SwapFieldHallo(pkf,pkf,ip1jmp1,llm, |
---|
| 552 | ! & jj_Nb_caldyn,0,0,TestRequest) |
---|
| 553 | ! CALL Register_SwapFieldHallo(pk,pk,ip1jmp1,llm, |
---|
| 554 | ! & jj_Nb_caldyn,0,0,TestRequest) |
---|
| 555 | ! CALL Register_SwapFieldHallo(pks,pks,ip1jmp1,1, |
---|
| 556 | ! & jj_Nb_caldyn,0,0,TestRequest) |
---|
| 557 | ! CALL Register_SwapFieldHallo(phis,phis,ip1jmp1,1, |
---|
| 558 | ! & jj_Nb_caldyn,0,0,TestRequest) |
---|
| 559 | ! CALL Register_SwapFieldHallo(phi,phi,ip1jmp1,llm, |
---|
| 560 | ! & jj_Nb_caldyn,0,0,TestRequest) |
---|
| 561 | ! CALL Register_SwapFieldHallo(finvmaold,finvmaold,ip1jmp1,llm, |
---|
| 562 | ! & jj_Nb_caldyn,0,0,TestRequest) |
---|
[2270] | 563 | |
---|
[5101] | 564 | ! do j=1,nqtot |
---|
| 565 | ! CALL Register_SwapFieldHallo(q(:,:,j),q(:,:,j),ip1jmp1,llm, |
---|
| 566 | ! & jj_nb_caldyn,0,0,TestRequest) |
---|
| 567 | ! enddo |
---|
[2270] | 568 | |
---|
[5101] | 569 | ! CALL Set_Distrib(distrib_caldyn) |
---|
| 570 | ! CALL SendRequest(TestRequest) |
---|
| 571 | ! CALL WaitRequest(TestRequest) |
---|
[1632] | 572 | |
---|
[5101] | 573 | !$OMP MASTER |
---|
| 574 | CALL AdjustBands_dissip(new_dist) |
---|
| 575 | !$OMP END MASTER |
---|
| 576 | !$OMP BARRIER |
---|
| 577 | CALL leapfrog_switch_dissip(new_dist) |
---|
| 578 | !$OMP BARRIER |
---|
| 579 | !$OMP MASTER |
---|
| 580 | distrib_dissip = new_dist |
---|
| 581 | !$OMP END MASTER |
---|
| 582 | !$OMP BARRIER |
---|
| 583 | ! CALL AdjustBands_physic |
---|
[1632] | 584 | |
---|
[5101] | 585 | !$OMP MASTER |
---|
[5117] | 586 | IF (mpi_rank==0) CALL WriteBands |
---|
[5101] | 587 | !$OMP END MASTER |
---|
[1632] | 588 | |
---|
[5101] | 589 | endif |
---|
[5117] | 590 | ENDIF |
---|
[1632] | 591 | |
---|
[5101] | 592 | CALL check_isotopes(q, ijb_u, ije_u, 'leapfrog 589') |
---|
[1632] | 593 | |
---|
[5101] | 594 | !----------------------------------------------------------------------- |
---|
| 595 | ! calcul des tendances dynamiques: |
---|
| 596 | ! -------------------------------- |
---|
| 597 | !$OMP BARRIER |
---|
| 598 | !$OMP MASTER |
---|
| 599 | CALL VTb(VThallo) |
---|
| 600 | !$OMP END MASTER |
---|
[1632] | 601 | |
---|
[5101] | 602 | CALL Register_Hallo_u(ucov, llm, 1, 1, 1, 1, TestRequest) |
---|
| 603 | CALL Register_Hallo_v(vcov, llm, 1, 1, 1, 1, TestRequest) |
---|
| 604 | CALL Register_Hallo_u(teta, llm, 1, 1, 1, 1, TestRequest) |
---|
| 605 | CALL Register_Hallo_u(ps, 1, 1, 2, 2, 1, TestRequest) |
---|
| 606 | CALL Register_Hallo_u(pkf, llm, 1, 1, 1, 1, TestRequest) |
---|
| 607 | CALL Register_Hallo_u(pk, llm, 1, 1, 1, 1, TestRequest) |
---|
| 608 | CALL Register_Hallo_u(pks, 1, 1, 1, 1, 1, TestRequest) |
---|
| 609 | CALL Register_Hallo_u(p, llmp1, 1, 1, 1, 1, TestRequest) |
---|
[1632] | 610 | |
---|
[5101] | 611 | ! do j=1,nqtot |
---|
| 612 | ! CALL Register_Hallo(q(1,1,j),ip1jmp1,llm,1,1,1,1, |
---|
| 613 | ! * TestRequest) |
---|
| 614 | ! enddo |
---|
[1632] | 615 | |
---|
[5101] | 616 | CALL SendRequest(TestRequest) |
---|
| 617 | !$OMP BARRIER |
---|
| 618 | CALL WaitRequest(TestRequest) |
---|
[1632] | 619 | |
---|
[5101] | 620 | !$OMP MASTER |
---|
| 621 | CALL VTe(VThallo) |
---|
| 622 | !$OMP END MASTER |
---|
| 623 | !$OMP BARRIER |
---|
[1632] | 624 | |
---|
[5117] | 625 | IF (debug) THEN |
---|
[5101] | 626 | CALL WriteField_u('ucov', ucov) |
---|
| 627 | CALL WriteField_v('vcov', vcov) |
---|
| 628 | CALL WriteField_u('teta', teta) |
---|
| 629 | CALL WriteField_u('ps', ps) |
---|
| 630 | CALL WriteField_u('masse', masse) |
---|
| 631 | CALL WriteField_u('pk', pk) |
---|
| 632 | CALL WriteField_u('pks', pks) |
---|
| 633 | CALL WriteField_u('pkf', pkf) |
---|
| 634 | CALL WriteField_u('phis', phis) |
---|
[5158] | 635 | DO iq = 1, nqtot |
---|
[5101] | 636 | CALL WriteField_u('q' // trim(int2str(iq)), & |
---|
| 637 | q(:, :, iq)) |
---|
| 638 | enddo |
---|
[5117] | 639 | ENDIF |
---|
[1632] | 640 | |
---|
[5101] | 641 | True_itau = True_itau + 1 |
---|
[1632] | 642 | |
---|
[5101] | 643 | !$OMP MASTER |
---|
| 644 | IF (prt_level>9) THEN |
---|
| 645 | WRITE(lunout, *)"leapfrog_p: Iteration No", True_itau |
---|
| 646 | ENDIF |
---|
[1632] | 647 | |
---|
[5101] | 648 | CALL start_timer(timer_caldyn) |
---|
[5099] | 649 | |
---|
[5113] | 650 | ! compute geopotential phi() |
---|
[5101] | 651 | CALL geopot_loc (ip1jmp1, teta, pk, pks, phis, phi) |
---|
[1632] | 652 | |
---|
[5101] | 653 | CALL check_isotopes(q, ijb_u, ije_u, 'leapfrog 651') |
---|
[5099] | 654 | |
---|
[5101] | 655 | CALL VTb(VTcaldyn) |
---|
| 656 | !$OMP END MASTER |
---|
| 657 | ! var_time=time+iday-day_ini |
---|
[5099] | 658 | |
---|
[5101] | 659 | !$OMP BARRIER |
---|
| 660 | ! CALL FTRACE_REGION_BEGIN("caldyn") |
---|
| 661 | time = jD_cur + jH_cur |
---|
[1632] | 662 | |
---|
[5101] | 663 | CALL caldyn_loc & |
---|
| 664 | (itau, ucov, vcov, teta, ps, masse, pk, pkf, phis, & |
---|
| 665 | phi, conser, du, dv, dteta, dp, w, pbaru, pbarv, time) |
---|
[5099] | 666 | |
---|
[5101] | 667 | ! CALL FTRACE_REGION_END("caldyn") |
---|
[1632] | 668 | |
---|
[5101] | 669 | !$OMP MASTER |
---|
[5117] | 670 | IF (mpi_rank==0.AND.conser) THEN |
---|
[5101] | 671 | WRITE(lunout, *) 'leapfrog_loc, Time step: ', itau, ' Day:', time |
---|
| 672 | ENDIF |
---|
| 673 | CALL VTe(VTcaldyn) |
---|
| 674 | !$OMP END MASTER |
---|
[5099] | 675 | |
---|
[5101] | 676 | IF (CPPKEY_DEBUGIO) THEN |
---|
| 677 | CALL WriteField_u('du', du) |
---|
| 678 | CALL WriteField_v('dv', dv) |
---|
| 679 | CALL WriteField_u('dteta', dteta) |
---|
| 680 | CALL WriteField_u('dp', dp) |
---|
| 681 | CALL WriteField_u('w', w) |
---|
| 682 | CALL WriteField_u('pbaru', pbaru) |
---|
| 683 | CALL WriteField_v('pbarv', pbarv) |
---|
| 684 | CALL WriteField_u('p', p) |
---|
| 685 | CALL WriteField_u('masse', masse) |
---|
| 686 | CALL WriteField_u('pk', pk) |
---|
| 687 | END IF |
---|
| 688 | !----------------------------------------------------------------------- |
---|
| 689 | ! calcul des tendances advection des traceurs (dont l'humidite) |
---|
| 690 | ! ------------------------------------------------------------- |
---|
[5099] | 691 | |
---|
[5101] | 692 | CALL check_isotopes(q, ijb_u, ije_u, & |
---|
| 693 | 'leapfrog 686: avant caladvtrac') |
---|
[5099] | 694 | |
---|
[5101] | 695 | IF(forward .OR. leapf) THEN |
---|
| 696 | ! Ehouarn: NB: fields sent to advtrac are those at the beginning of the time step |
---|
[5116] | 697 | !WRITE(*,*) 'leapfrog 679: avant CALL caladvtrac_loc' |
---|
[5101] | 698 | CALL caladvtrac_loc(q, pbaru, pbarv, & |
---|
| 699 | p, masse, dq, teta, & |
---|
| 700 | flxw, pk, iapptrac) |
---|
[5099] | 701 | |
---|
[5101] | 702 | ! CALL creation of mass flux |
---|
| 703 | IF (offline .AND. .NOT. adjust) THEN |
---|
| 704 | CALL fluxstokenc_p(pbaru, pbarv, masse, teta, phi) |
---|
| 705 | ENDIF |
---|
[5099] | 706 | |
---|
[5116] | 707 | !WRITE(*,*) 'leapfrog 719' |
---|
[5101] | 708 | CALL check_isotopes(q, ijb_u, ije_u, & |
---|
| 709 | 'leapfrog 698: apres caladvtrac') |
---|
[1632] | 710 | |
---|
[5101] | 711 | ! do j=1,nqtot |
---|
| 712 | ! CALL WriteField_u('qadv'//trim(int2str(j)),q(:,:,j)) |
---|
| 713 | ! enddo |
---|
[5099] | 714 | |
---|
[5101] | 715 | ! Ehouarn: Storage of mass flux for off-line tracers... not implemented... |
---|
[1632] | 716 | |
---|
[5101] | 717 | ENDIF ! of IF( forward .OR. leapf ) |
---|
[5099] | 718 | |
---|
[1632] | 719 | |
---|
[5101] | 720 | !----------------------------------------------------------------------- |
---|
| 721 | ! integrations dynamique et traceurs: |
---|
| 722 | ! ---------------------------------- |
---|
[1632] | 723 | |
---|
[5101] | 724 | !$OMP MASTER |
---|
| 725 | CALL VTb(VTintegre) |
---|
| 726 | !$OMP END MASTER |
---|
| 727 | IF (CPPKEY_DEBUGIO) THEN |
---|
[5117] | 728 | IF (true_itau>20) THEN |
---|
[5101] | 729 | CALL WriteField_u('ucovm1', ucovm1) |
---|
| 730 | CALL WriteField_v('vcovm1', vcovm1) |
---|
| 731 | CALL WriteField_u('tetam1', tetam1) |
---|
| 732 | CALL WriteField_u('psm1', psm1) |
---|
| 733 | CALL WriteField_u('ucov_int', ucov) |
---|
| 734 | CALL WriteField_v('vcov_int', vcov) |
---|
| 735 | CALL WriteField_u('teta_int', teta) |
---|
| 736 | CALL WriteField_u('ps_int', ps) |
---|
| 737 | endif |
---|
| 738 | END IF |
---|
| 739 | !$OMP BARRIER |
---|
| 740 | ! CALL FTRACE_REGION_BEGIN("integrd") |
---|
[1632] | 741 | |
---|
[5116] | 742 | !WRITE(*,*) 'leapfrog 720' |
---|
[5101] | 743 | CALL check_isotopes(q, ijb_u, ije_u, 'leapfrog 756') |
---|
[1632] | 744 | |
---|
[5113] | 745 | ! CRisi: pourquoi aller jusqu'à 2 et non pas jusqu'à nqtot?? |
---|
[5101] | 746 | CALL integrd_loc (nqtot, vcovm1, ucovm1, tetam1, psm1, massem1, & |
---|
| 747 | dv, du, dteta, dq, dp, vcov, ucov, teta, q, ps, masse, phis) |
---|
| 748 | ! $ finvmaold ) |
---|
[1632] | 749 | |
---|
[5116] | 750 | ! !WRITE(*,*) 'leapfrog 724' |
---|
[5101] | 751 | CALL check_isotopes(q, ijb_u, ije_u, 'leapfrog 762') |
---|
[1632] | 752 | |
---|
[5101] | 753 | ! CALL FTRACE_REGION_END("integrd") |
---|
| 754 | !$OMP BARRIER |
---|
| 755 | IF (CPPKEY_DEBUGIO) THEN |
---|
| 756 | CALL WriteField_u('ucovm1', ucovm1) |
---|
| 757 | CALL WriteField_v('vcovm1', vcovm1) |
---|
| 758 | CALL WriteField_u('tetam1', tetam1) |
---|
| 759 | CALL WriteField_u('psm1', psm1) |
---|
| 760 | CALL WriteField_u('ucov_int', ucov) |
---|
| 761 | CALL WriteField_v('vcov_int', vcov) |
---|
| 762 | CALL WriteField_u('teta_int', teta) |
---|
| 763 | CALL WriteField_u('ps_int', ps) |
---|
| 764 | END IF |
---|
[1632] | 765 | |
---|
[5101] | 766 | CALL check_isotopes(q, ijb_u, ije_u, 'leapfrog 775') |
---|
[1632] | 767 | |
---|
[5101] | 768 | ! do j=1,nqtot |
---|
| 769 | ! CALL WriteField_p('q'//trim(int2str(j)), |
---|
| 770 | ! . reshape(q(:,:,j),(/iip1,jmp1,llm/))) |
---|
| 771 | ! CALL WriteField_p('dq'//trim(int2str(j)), |
---|
| 772 | ! . reshape(dq(:,:,j),(/iip1,jmp1,llm/))) |
---|
| 773 | ! enddo |
---|
[1632] | 774 | |
---|
| 775 | |
---|
[5101] | 776 | !$OMP MASTER |
---|
| 777 | CALL VTe(VTintegre) |
---|
| 778 | !$OMP END MASTER |
---|
| 779 | ! .P.Le Van (26/04/94 ajout de finvpold dans l'appel d'integrd) |
---|
[5159] | 780 | |
---|
[5101] | 781 | !----------------------------------------------------------------------- |
---|
| 782 | ! calcul des tendances physiques: |
---|
| 783 | ! ------------------------------- |
---|
| 784 | ! ######## P.Le Van ( Modif le 6/02/95 ) ########### |
---|
[5159] | 785 | |
---|
[5101] | 786 | IF(purmats) THEN |
---|
| 787 | IF(itau==itaufin.AND..NOT.forward) lafin = .TRUE. |
---|
| 788 | ELSE |
---|
| 789 | IF(itau + 1 == itaufin) lafin = .TRUE. |
---|
| 790 | ENDIF |
---|
[1632] | 791 | |
---|
[5101] | 792 | !c$OMP END PARALLEL |
---|
[1632] | 793 | |
---|
[5101] | 794 | IF(apphys) THEN |
---|
[1632] | 795 | |
---|
[5101] | 796 | CALL call_calfis(itau, lafin, ucov, vcov, teta, masse, ps, phis, q, flxw) |
---|
[5099] | 797 | |
---|
[5101] | 798 | ! c-jld |
---|
| 799 | !$OMP MASTER |
---|
[5117] | 800 | IF (FirstPhysic) THEN |
---|
[5101] | 801 | ok_start_timer = .TRUE. |
---|
[5103] | 802 | FirstPhysic = .FALSE. |
---|
[5101] | 803 | endif |
---|
| 804 | !$OMP END MASTER |
---|
| 805 | ENDIF ! of IF( apphys ) |
---|
[5099] | 806 | |
---|
[5101] | 807 | CALL check_isotopes(q, ijb_u, ije_u, 'leapfrog 1132') |
---|
[5116] | 808 | !WRITE(*,*) 'leapfrog 1134: iflag_phys=',iflag_phys |
---|
[5099] | 809 | |
---|
[5101] | 810 | IF(iflag_phys==2) THEN ! "Newtonian" case |
---|
| 811 | !$OMP MASTER |
---|
[5117] | 812 | IF (FirstPhysic) THEN |
---|
[5101] | 813 | ok_start_timer = .TRUE. |
---|
[5103] | 814 | FirstPhysic = .FALSE. |
---|
[5101] | 815 | endif |
---|
| 816 | !$OMP END MASTER |
---|
[1632] | 817 | |
---|
[5099] | 818 | |
---|
[5101] | 819 | ! Calcul academique de la physique = Rappel Newtonien + fritcion |
---|
| 820 | ! -------------------------------------------------------------- |
---|
| 821 | !ym teta(:,:)=teta(:,:) |
---|
| 822 | !ym s -iphysiq*dtvr*(teta(:,:)-tetarappel(:,:))/taurappel |
---|
| 823 | ijb = ij_begin |
---|
| 824 | ije = ij_end |
---|
| 825 | !LF teta(ijb:ije,:)=teta(ijb:ije,:) |
---|
| 826 | !LF s -iphysiq*dtvr*(teta(ijb:ije,:)-tetarappel(ijb:ije,:))/taurappel |
---|
| 827 | !$OMP DO SCHEDULE(STATIC,OMP_CHUNK) |
---|
[5158] | 828 | DO l = 1, llm |
---|
[5101] | 829 | teta(ijb:ije, l) = teta(ijb:ije, l) - dtvr * & |
---|
| 830 | (teta(ijb:ije, l) - tetarappel(ijb:ije, l)) * & |
---|
| 831 | (knewt_g + knewt_t(l) * clat4(ijb:ije)) |
---|
| 832 | enddo |
---|
| 833 | !$OMP END DO |
---|
[5099] | 834 | |
---|
[5101] | 835 | !$OMP MASTER |
---|
[5117] | 836 | IF (planet_type=="giant") THEN |
---|
[5113] | 837 | ! add an intrinsic heat flux at the base of the atmosphere |
---|
[5101] | 838 | teta(ijb:ije, 1) = teta(ijb:ije, 1) & |
---|
| 839 | + dtvr * aire(ijb:ije) * ihf / cpp / masse(ijb:ije, 1) |
---|
| 840 | endif |
---|
| 841 | !$OMP END MASTER |
---|
| 842 | !$OMP BARRIER |
---|
[5099] | 843 | |
---|
[5101] | 844 | CALL Register_Hallo_u(ucov, llm, 0, 1, 1, 0, Request_Physic) |
---|
| 845 | CALL Register_Hallo_v(vcov, llm, 1, 1, 1, 1, Request_Physic) |
---|
| 846 | CALL SendRequest(Request_Physic) |
---|
| 847 | !$OMP BARRIER |
---|
| 848 | CALL WaitRequest(Request_Physic) |
---|
| 849 | !$OMP BARRIER |
---|
| 850 | CALL friction_loc(ucov, vcov, dtvr) |
---|
| 851 | !$OMP BARRIER |
---|
[5099] | 852 | |
---|
[5113] | 853 | ! Sponge layer (if any) |
---|
[5101] | 854 | IF (ok_strato) THEN |
---|
| 855 | CALL top_bound_loc(vcov, ucov, teta, masse, dtvr) |
---|
| 856 | !$OMP BARRIER |
---|
| 857 | ENDIF ! of IF (ok_strato) |
---|
| 858 | ENDIF ! of IF(iflag_phys.EQ.2) |
---|
[1632] | 859 | |
---|
[5101] | 860 | CALL pression_loc (ip1jmp1, ap, bp, ps, p) |
---|
| 861 | !$OMP BARRIER |
---|
[5117] | 862 | IF (pressure_exner) THEN |
---|
[5101] | 863 | CALL exner_hyb_loc(ijnb_u, ps, p, pks, pk, pkf) |
---|
| 864 | else |
---|
| 865 | CALL exner_milieu_loc(ijnb_u, ps, p, pks, pk, pkf) |
---|
[5117] | 866 | ENDIF |
---|
[5101] | 867 | !$OMP BARRIER |
---|
| 868 | CALL massdair_loc(p, masse) |
---|
| 869 | !$OMP BARRIER |
---|
[5099] | 870 | |
---|
[5101] | 871 | !c$OMP END PARALLEL |
---|
| 872 | CALL check_isotopes(q, ijb_u, ije_u, 'leapfrog 1196') |
---|
[1632] | 873 | |
---|
[5101] | 874 | !----------------------------------------------------------------------- |
---|
| 875 | ! dissipation horizontale et verticale des petites echelles: |
---|
| 876 | ! ---------------------------------------------------------- |
---|
| 877 | IF(apdiss) THEN |
---|
| 878 | CALL call_dissip(ucov, vcov, teta, p, pk, ps) |
---|
| 879 | END IF |
---|
[1632] | 880 | |
---|
[5101] | 881 | CALL check_isotopes(q, ijb_u, ije_u, 'leapfrog 1430') |
---|
[1632] | 882 | |
---|
[5101] | 883 | ! ******************************************************************** |
---|
| 884 | ! .... fin de l'integration dynamique et physique pour le pas itau .. |
---|
| 885 | ! ******************************************************************** |
---|
[1632] | 886 | |
---|
[5101] | 887 | ! preparation du pas d'integration suivant ...... |
---|
| 888 | !$OMP MASTER |
---|
| 889 | CALL stop_timer(timer_caldyn) |
---|
| 890 | !$OMP END MASTER |
---|
[5116] | 891 | IF (itau==itaumax) THEN |
---|
[5101] | 892 | !$OMP MASTER |
---|
| 893 | CALL allgather_timer_average |
---|
| 894 | CALL barrier |
---|
[5117] | 895 | IF (mpi_rank==0) THEN |
---|
[5160] | 896 | PRINT *, '*********************************' |
---|
| 897 | PRINT *, '****** TIMER CALDYN ******' |
---|
[5158] | 898 | DO i = 0, mpi_size - 1 |
---|
[5160] | 899 | PRINT *, 'proc', i, ' : Nb Bandes :', jj_nb_caldyn(i), & |
---|
[5101] | 900 | ' : temps moyen :', & |
---|
| 901 | timer_average(jj_nb_caldyn(i), timer_caldyn, i) |
---|
| 902 | enddo |
---|
[2270] | 903 | |
---|
[5160] | 904 | PRINT *, '*********************************' |
---|
| 905 | PRINT *, '****** TIMER VANLEER ******' |
---|
[5158] | 906 | DO i = 0, mpi_size - 1 |
---|
[5160] | 907 | PRINT *, 'proc', i, ' : Nb Bandes :', jj_nb_vanleer(i), & |
---|
[5101] | 908 | ' : temps moyen :', & |
---|
| 909 | timer_average(jj_nb_vanleer(i), timer_vanleer, i) |
---|
| 910 | enddo |
---|
[1848] | 911 | |
---|
[5160] | 912 | PRINT *, '*********************************' |
---|
| 913 | PRINT *, '****** TIMER DISSIP ******' |
---|
[5158] | 914 | DO i = 0, mpi_size - 1 |
---|
[5160] | 915 | PRINT *, 'proc', i, ' : Nb Bandes :', jj_nb_dissip(i), & |
---|
[5101] | 916 | ' : temps moyen :', & |
---|
| 917 | timer_average(jj_nb_dissip(i), timer_dissip, i) |
---|
| 918 | enddo |
---|
[1848] | 919 | |
---|
[5160] | 920 | PRINT *, '*********************************' |
---|
| 921 | PRINT *, '****** TIMER PHYSIC ******' |
---|
[5158] | 922 | DO i = 0, mpi_size - 1 |
---|
[5160] | 923 | PRINT *, 'proc', i, ' : Nb Bandes :', jj_nb_physic(i), & |
---|
[5101] | 924 | ' : temps moyen :', & |
---|
| 925 | timer_average(jj_nb_physic(i), timer_physic, i) |
---|
| 926 | enddo |
---|
[1632] | 927 | |
---|
[5101] | 928 | endif |
---|
| 929 | CALL barrier |
---|
[5160] | 930 | PRINT *, 'Taille du Buffer MPI (REAL*8)', MaxBufferSize |
---|
| 931 | PRINT *, 'Taille du Buffer MPI utilise (REAL*8)', MaxBufferSize_Used |
---|
| 932 | PRINT *, 'Temps total ecoule sur la parallelisation :', DiffTime() |
---|
| 933 | PRINT *, 'Temps CPU ecoule sur la parallelisation :', DiffCpuTime() |
---|
[5101] | 934 | CALL print_filtre_timer |
---|
| 935 | !$OMP END MASTER |
---|
| 936 | CALL dynredem1_loc("restart.nc", 0.0, & |
---|
| 937 | vcov, ucov, teta, q, masse, ps) |
---|
| 938 | !$OMP MASTER |
---|
| 939 | CALL fin_getparam |
---|
| 940 | !$OMP END MASTER |
---|
[1673] | 941 | |
---|
[5117] | 942 | IF (ok_guide) THEN |
---|
[5113] | 943 | ! set ok_guide to false to avoid extra output |
---|
| 944 | ! in following forward step |
---|
[5103] | 945 | ok_guide = .FALSE. |
---|
[5101] | 946 | endif |
---|
[1673] | 947 | |
---|
[5185] | 948 | IF (ANY(type_trac == ['inca', 'inco'])) THEN |
---|
| 949 | CALL finalize_inca |
---|
| 950 | ! switching back to LMDZDYN context |
---|
| 951 | !$OMP MASTER |
---|
| 952 | IF (ok_dyn_xios) THEN |
---|
| 953 | CALL xios_set_current_context(dyn3d_ctx_handle) |
---|
[5101] | 954 | ENDIF |
---|
[5185] | 955 | !$OMP END MASTER |
---|
| 956 | ENDIF |
---|
| 957 | IF (CPPKEY_REPROBUS) THEN |
---|
| 958 | IF (type_trac == 'repr') CALL finalize_reprobus |
---|
| 959 | END IF |
---|
[1673] | 960 | |
---|
[5101] | 961 | !$OMP MASTER |
---|
| 962 | CALL finalize_parallel |
---|
| 963 | !$OMP END MASTER |
---|
| 964 | !$OMP BARRIER |
---|
| 965 | RETURN |
---|
| 966 | ENDIF |
---|
[1632] | 967 | |
---|
[5101] | 968 | CALL check_isotopes(q, ijb_u, ije_u, 'leapfrog 1509') |
---|
[1632] | 969 | |
---|
[5101] | 970 | IF (.NOT.purmats) THEN |
---|
| 971 | ! ........................................................ |
---|
| 972 | ! .............. schema matsuno + leapfrog .............. |
---|
| 973 | ! ........................................................ |
---|
[1632] | 974 | |
---|
[5101] | 975 | IF(forward .OR. leapf) THEN |
---|
| 976 | itau = itau + 1 |
---|
| 977 | ! iday= day_ini+itau/day_step |
---|
| 978 | ! time= REAL(itau-(iday-day_ini)*day_step)/day_step+time_0 |
---|
| 979 | ! IF(time.GT.1.) THEN |
---|
| 980 | ! time = time-1. |
---|
| 981 | ! iday = iday+1 |
---|
| 982 | ! ENDIF |
---|
| 983 | ENDIF |
---|
[1632] | 984 | |
---|
[5116] | 985 | IF(itau == itaufinp1) THEN |
---|
[5117] | 986 | IF (flag_verif) THEN |
---|
[5116] | 987 | WRITE(79, *) 'ucov', ucov |
---|
| 988 | WRITE(80, *) 'vcov', vcov |
---|
| 989 | WRITE(81, *) 'teta', teta |
---|
| 990 | WRITE(82, *) 'ps', ps |
---|
| 991 | WRITE(83, *) 'q', q |
---|
[5101] | 992 | WRITE(85, *) 'q1 = ', q(:, :, 1) |
---|
| 993 | WRITE(86, *) 'q3 = ', q(:, :, 3) |
---|
| 994 | endif |
---|
[1632] | 995 | |
---|
| 996 | |
---|
[5101] | 997 | !$OMP MASTER |
---|
| 998 | CALL fin_getparam |
---|
| 999 | !$OMP END MASTER |
---|
[1632] | 1000 | |
---|
[5185] | 1001 | IF (ANY(type_trac == ['inca', 'inco'])) THEN |
---|
| 1002 | CALL finalize_inca |
---|
| 1003 | ! switching back to LMDZDYN context |
---|
| 1004 | !$OMP MASTER |
---|
| 1005 | IF (ok_dyn_xios) THEN |
---|
| 1006 | CALL xios_set_current_context(dyn3d_ctx_handle) |
---|
[5101] | 1007 | ENDIF |
---|
[5185] | 1008 | !$OMP END MASTER |
---|
| 1009 | ENDIF |
---|
| 1010 | IF (CPPKEY_REPROBUS) THEN |
---|
| 1011 | IF (type_trac == 'repr') CALL finalize_reprobus |
---|
| 1012 | END IF |
---|
[1632] | 1013 | |
---|
[5101] | 1014 | !$OMP MASTER |
---|
| 1015 | CALL finalize_parallel |
---|
| 1016 | !$OMP END MASTER |
---|
| 1017 | abort_message = 'Simulation finished' |
---|
| 1018 | CALL abort_gcm(modname, abort_message, 0) |
---|
| 1019 | RETURN |
---|
| 1020 | ENDIF |
---|
| 1021 | !----------------------------------------------------------------------- |
---|
| 1022 | ! ecriture du fichier histoire moyenne: |
---|
| 1023 | ! ------------------------------------- |
---|
[1632] | 1024 | |
---|
[5101] | 1025 | IF(MOD(itau, iperiod)==0 .OR. itau==itaufin) THEN |
---|
| 1026 | !$OMP BARRIER |
---|
| 1027 | IF(itau==itaufin) THEN |
---|
| 1028 | iav = 1 |
---|
| 1029 | ELSE |
---|
| 1030 | iav = 0 |
---|
| 1031 | ENDIF |
---|
[1632] | 1032 | |
---|
[5113] | 1033 | ! Ehouarn: re-compute geopotential for outputs |
---|
[5101] | 1034 | !$OMP BARRIER |
---|
| 1035 | !$OMP MASTER |
---|
| 1036 | CALL geopot_loc(ip1jmp1, teta, pk, pks, phis, phi) |
---|
| 1037 | !$OMP END MASTER |
---|
| 1038 | !$OMP BARRIER |
---|
[1632] | 1039 | |
---|
[5185] | 1040 | IF (ok_dynzon) THEN |
---|
[1632] | 1041 | |
---|
[5185] | 1042 | CALL bilan_dyn_loc(2, dtvr * iperiod, dtvr * day_step * periodav, & |
---|
| 1043 | ps, masse, pk, pbaru, pbarv, teta, phi, ucov, vcov, q) |
---|
[1632] | 1044 | |
---|
[5185] | 1045 | ENDIF !ok_dynzon |
---|
[1632] | 1046 | |
---|
[5185] | 1047 | IF (ok_dyn_ave) THEN |
---|
| 1048 | CALL writedynav_loc(itau, vcov, & |
---|
| 1049 | ucov, teta, pk, phi, q, masse, ps, phis) |
---|
| 1050 | ENDIF |
---|
[1632] | 1051 | |
---|
[5101] | 1052 | ENDIF |
---|
[1632] | 1053 | |
---|
[5101] | 1054 | CALL check_isotopes(q, ijb_u, ije_u, 'leapfrog 1584') |
---|
[1632] | 1055 | |
---|
[5101] | 1056 | !----------------------------------------------------------------------- |
---|
| 1057 | ! ecriture de la bande histoire: |
---|
| 1058 | ! ------------------------------ |
---|
[5099] | 1059 | |
---|
[5101] | 1060 | IF(MOD(itau, iecri)==0) THEN |
---|
[5113] | 1061 | ! Ehouarn: output only during LF or Backward Matsuno |
---|
[5117] | 1062 | IF (leapf.OR.(.NOT.leapf.AND.(.NOT.forward))) THEN |
---|
[5101] | 1063 | !$OMP BARRIER |
---|
| 1064 | !$OMP MASTER |
---|
| 1065 | CALL geopot_loc(ip1jmp1, teta, pk, pks, phis, phi) |
---|
| 1066 | !$OMP END MASTER |
---|
| 1067 | !$OMP BARRIER |
---|
[1632] | 1068 | |
---|
[5185] | 1069 | IF (ok_dyn_ins) THEN |
---|
| 1070 | CALL writehist_loc(itau, vcov, ucov, teta, pk, phi, q, & |
---|
| 1071 | masse, ps, phis) |
---|
| 1072 | endif |
---|
[1632] | 1073 | |
---|
[5101] | 1074 | IF (ok_dyn_xios) THEN |
---|
| 1075 | !$OMP MASTER |
---|
| 1076 | CALL xios_update_calendar(itau) |
---|
| 1077 | !$OMP END MASTER |
---|
| 1078 | !$OMP BARRIER |
---|
| 1079 | CALL writedyn_xios(vcov, & |
---|
| 1080 | ucov, teta, pk, phi, q, masse, ps, phis) |
---|
| 1081 | ENDIF |
---|
[1632] | 1082 | |
---|
[5117] | 1083 | endif ! of if (leapf.OR.(.NOT.leapf.AND.(.NOT.forward))) |
---|
[5099] | 1084 | |
---|
[5101] | 1085 | ENDIF ! of IF(MOD(itau,iecri).EQ.0) |
---|
[1632] | 1086 | |
---|
[5101] | 1087 | IF(itau==itaufin) THEN |
---|
[1632] | 1088 | |
---|
[5101] | 1089 | !$OMP BARRIER |
---|
[1632] | 1090 | |
---|
[5117] | 1091 | ! if (planet_type.EQ."earth") THEN |
---|
[5101] | 1092 | ! Write an Earth-format restart file |
---|
| 1093 | CALL dynredem1_loc("restart.nc", 0.0, & |
---|
| 1094 | vcov, ucov, teta, q, masse, ps) |
---|
[5117] | 1095 | ! END IF ! of if (planet_type.EQ."earth") |
---|
| 1096 | IF (ok_guide) THEN |
---|
[5113] | 1097 | ! set ok_guide to false to avoid extra output |
---|
| 1098 | ! in following forward step |
---|
[5103] | 1099 | ok_guide = .FALSE. |
---|
[5101] | 1100 | endif |
---|
[1632] | 1101 | |
---|
[5101] | 1102 | ! CLOSE(99) |
---|
| 1103 | ENDIF ! of IF (itau.EQ.itaufin) |
---|
[5099] | 1104 | |
---|
[5101] | 1105 | CALL check_isotopes(q, ijb_u, ije_u, 'leapfrog 1624') |
---|
[1632] | 1106 | |
---|
[5101] | 1107 | !----------------------------------------------------------------------- |
---|
| 1108 | ! gestion de l'integration temporelle: |
---|
| 1109 | ! ------------------------------------ |
---|
[1632] | 1110 | |
---|
[5101] | 1111 | IF(MOD(itau, iperiod)==0) THEN |
---|
| 1112 | GO TO 1 |
---|
| 1113 | ELSE IF (MOD(itau - 1, iperiod) == 0) THEN |
---|
[5099] | 1114 | |
---|
[5101] | 1115 | IF(forward) THEN |
---|
| 1116 | ! fin du pas forward et debut du pas backward |
---|
[5099] | 1117 | |
---|
[5101] | 1118 | forward = .FALSE. |
---|
| 1119 | leapf = .FALSE. |
---|
| 1120 | GO TO 2 |
---|
[1632] | 1121 | |
---|
[5101] | 1122 | ELSE |
---|
| 1123 | ! fin du pas backward et debut du premier pas leapfrog |
---|
[1632] | 1124 | |
---|
[5101] | 1125 | leapf = .TRUE. |
---|
| 1126 | dt = 2. * dtvr |
---|
| 1127 | GO TO 2 |
---|
| 1128 | END IF |
---|
| 1129 | ELSE |
---|
[5099] | 1130 | |
---|
[5101] | 1131 | ! ...... pas leapfrog ..... |
---|
[1632] | 1132 | |
---|
[5101] | 1133 | leapf = .TRUE. |
---|
| 1134 | dt = 2. * dtvr |
---|
| 1135 | GO TO 2 |
---|
| 1136 | END IF ! of IF (MOD(itau,iperiod).EQ.0) |
---|
[5113] | 1137 | ! ELSEIF (MOD(itau-1,iperiod).EQ.0) |
---|
[1632] | 1138 | |
---|
[5117] | 1139 | ELSE ! of IF (.NOT.purmats) |
---|
[1632] | 1140 | |
---|
[5101] | 1141 | CALL check_isotopes(q, ijb_u, ije_u, 'leapfrog 1664') |
---|
[5099] | 1142 | |
---|
[5101] | 1143 | ! ........................................................ |
---|
| 1144 | ! .............. schema matsuno ............... |
---|
| 1145 | ! ........................................................ |
---|
| 1146 | IF(forward) THEN |
---|
[1632] | 1147 | |
---|
[5101] | 1148 | itau = itau + 1 |
---|
| 1149 | ! iday = day_ini+itau/day_step |
---|
| 1150 | ! time = REAL(itau-(iday-day_ini)*day_step)/day_step+time_0 |
---|
[1632] | 1151 | |
---|
[5101] | 1152 | ! IF(time.GT.1.) THEN |
---|
| 1153 | ! time = time-1. |
---|
| 1154 | ! iday = iday+1 |
---|
| 1155 | ! ENDIF |
---|
[1632] | 1156 | |
---|
[5101] | 1157 | forward = .FALSE. |
---|
[5116] | 1158 | IF(itau == itaufinp1) THEN |
---|
[5101] | 1159 | !$OMP MASTER |
---|
| 1160 | CALL fin_getparam |
---|
| 1161 | !$OMP END MASTER |
---|
[1632] | 1162 | |
---|
[5185] | 1163 | IF (ANY(type_trac == ['inca', 'inco'])) THEN |
---|
| 1164 | CALL finalize_inca |
---|
| 1165 | ! switching back to LMDZDYN context |
---|
| 1166 | !$OMP MASTER |
---|
| 1167 | IF (ok_dyn_xios) THEN |
---|
| 1168 | CALL xios_set_current_context(dyn3d_ctx_handle) |
---|
[5101] | 1169 | ENDIF |
---|
[5185] | 1170 | !$OMP END MASTER |
---|
| 1171 | ENDIF |
---|
| 1172 | IF (CPPKEY_REPROBUS) THEN |
---|
| 1173 | IF (type_trac == 'repr') CALL finalize_reprobus |
---|
| 1174 | END IF |
---|
[2185] | 1175 | |
---|
[5101] | 1176 | !$OMP MASTER |
---|
| 1177 | CALL finalize_parallel |
---|
| 1178 | !$OMP END MASTER |
---|
| 1179 | abort_message = 'Simulation finished' |
---|
| 1180 | CALL abort_gcm(modname, abort_message, 0) |
---|
| 1181 | RETURN |
---|
[1632] | 1182 | ENDIF |
---|
[5101] | 1183 | GO TO 2 |
---|
[2270] | 1184 | |
---|
[5101] | 1185 | ELSE ! of IF(forward) i.e. backward step |
---|
[1632] | 1186 | |
---|
[5101] | 1187 | CALL check_isotopes(q, ijb_u, ije_u, 'leapfrog 1698') |
---|
[1632] | 1188 | |
---|
[5101] | 1189 | IF(MOD(itau, iperiod)==0 .OR. itau==itaufin) THEN |
---|
| 1190 | IF(itau==itaufin) THEN |
---|
| 1191 | iav = 1 |
---|
| 1192 | ELSE |
---|
| 1193 | iav = 0 |
---|
| 1194 | ENDIF |
---|
[1632] | 1195 | |
---|
[5185] | 1196 | ! Ehouarn: re-compute geopotential for outputs |
---|
| 1197 | !$OMP BARRIER |
---|
| 1198 | !$OMP MASTER |
---|
| 1199 | CALL geopot_loc(ip1jmp1, teta, pk, pks, phis, phi) |
---|
| 1200 | !$OMP END MASTER |
---|
| 1201 | !$OMP BARRIER |
---|
[4607] | 1202 | |
---|
[5185] | 1203 | IF (ok_dynzon) THEN |
---|
| 1204 | CALL bilan_dyn_loc(2, dtvr * iperiod, dtvr * day_step * periodav, & |
---|
| 1205 | ps, masse, pk, pbaru, pbarv, teta, phi, ucov, vcov, q) |
---|
| 1206 | ENDIF |
---|
[2180] | 1207 | |
---|
[5185] | 1208 | IF (ok_dyn_ave) THEN |
---|
| 1209 | CALL writedynav_loc(itau, vcov, & |
---|
| 1210 | ucov, teta, pk, phi, q, masse, ps, phis) |
---|
| 1211 | ENDIF |
---|
[4146] | 1212 | |
---|
[5101] | 1213 | ENDIF ! of IF(MOD(itau,iperiod).EQ.0 .OR. itau.EQ.itaufin) |
---|
[1632] | 1214 | |
---|
[5101] | 1215 | IF(MOD(itau, iecri)==0) THEN |
---|
[1632] | 1216 | |
---|
[5101] | 1217 | !$OMP BARRIER |
---|
| 1218 | !$OMP MASTER |
---|
| 1219 | CALL geopot_loc(ip1jmp1, teta, pk, pks, phis, phi) |
---|
| 1220 | !$OMP END MASTER |
---|
| 1221 | !$OMP BARRIER |
---|
[1632] | 1222 | |
---|
[5185] | 1223 | IF (ok_dyn_ins) THEN |
---|
| 1224 | CALL writehist_loc(itau, vcov, ucov, teta, pk, phi, q, & |
---|
| 1225 | masse, ps, phis) |
---|
| 1226 | endif ! of if (ok_dyn_ins) |
---|
[1632] | 1227 | |
---|
[5101] | 1228 | IF (ok_dyn_xios) THEN |
---|
| 1229 | !$OMP MASTER |
---|
| 1230 | CALL xios_update_calendar(itau) |
---|
| 1231 | !$OMP END MASTER |
---|
| 1232 | !$OMP BARRIER |
---|
| 1233 | CALL writedyn_xios(vcov, & |
---|
| 1234 | ucov, teta, pk, phi, q, masse, ps, phis) |
---|
| 1235 | ENDIF |
---|
[1632] | 1236 | |
---|
[5101] | 1237 | ENDIF ! of IF(MOD(itau,iecri).EQ.0) |
---|
[3947] | 1238 | |
---|
[5101] | 1239 | IF(itau==itaufin) THEN |
---|
[5117] | 1240 | ! if (planet_type.EQ."earth") THEN |
---|
[5101] | 1241 | CALL dynredem1_loc("restart.nc", 0.0, & |
---|
| 1242 | vcov, ucov, teta, q, masse, ps) |
---|
[5117] | 1243 | ! END IF ! of if (planet_type.EQ."earth") |
---|
| 1244 | IF (ok_guide) THEN |
---|
[5113] | 1245 | ! set ok_guide to false to avoid extra output |
---|
| 1246 | ! in following forward step |
---|
[5103] | 1247 | ok_guide = .FALSE. |
---|
[5101] | 1248 | endif |
---|
[1632] | 1249 | |
---|
[5101] | 1250 | ENDIF ! of IF(itau.EQ.itaufin) |
---|
[1632] | 1251 | |
---|
[5101] | 1252 | forward = .TRUE. |
---|
| 1253 | GO TO 1 |
---|
[1632] | 1254 | |
---|
[5101] | 1255 | ENDIF ! of IF (forward) |
---|
[2270] | 1256 | |
---|
[5101] | 1257 | CALL check_isotopes(q, ijb_u, ije_u, 'leapfrog 1750') |
---|
[2270] | 1258 | |
---|
[5117] | 1259 | END IF ! of IF(.NOT.purmats) |
---|
[5101] | 1260 | !$OMP MASTER |
---|
| 1261 | CALL fin_getparam |
---|
| 1262 | !$OMP END MASTER |
---|
[2185] | 1263 | |
---|
[5185] | 1264 | IF (ANY(type_trac == ['inca', 'inco'])) THEN |
---|
| 1265 | CALL finalize_inca |
---|
| 1266 | ! switching back to LMDZDYN context |
---|
| 1267 | !$OMP MASTER |
---|
| 1268 | IF (ok_dyn_xios) THEN |
---|
| 1269 | CALL xios_set_current_context(dyn3d_ctx_handle) |
---|
[5101] | 1270 | ENDIF |
---|
[5185] | 1271 | !$OMP END MASTER |
---|
| 1272 | ENDIF |
---|
| 1273 | IF (CPPKEY_REPROBUS) THEN |
---|
| 1274 | IF (type_trac == 'repr') CALL finalize_reprobus |
---|
| 1275 | END IF |
---|
[2185] | 1276 | |
---|
[5101] | 1277 | !$OMP MASTER |
---|
| 1278 | CALL finalize_parallel |
---|
| 1279 | !$OMP END MASTER |
---|
| 1280 | abort_message = 'Simulation finished' |
---|
| 1281 | CALL abort_gcm(modname, abort_message, 0) |
---|
[5105] | 1282 | |
---|
[5101] | 1283 | END SUBROUTINE leapfrog_loc |
---|