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