Changeset 5512
- Timestamp:
- Jan 28, 2025, 7:07:51 PM (2 days ago)
- Location:
- LMDZ6/trunk/libf/phylmd
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
LMDZ6/trunk/libf/phylmd/acama_gwd_rando_m.f90
r5309 r5512 5 5 6 6 USE clesphys_mod_h 7 implicit none 7 IMPLICIT NONE 8 LOGICAL, SAVE :: gwd_reproductibilite_mpiomp=.true. 9 LOGICAL, SAVE :: firstcall = .TRUE. 10 !$OMP THREADPRIVATE(firstcall,gwd_reproductibilite_mpiomp) 11 12 INTEGER, PARAMETER:: NK = 2, NP = 2, NO = 2, NW = NK * NP * NO 13 INTEGER, PARAMETER:: NA = 5 !number of realizations to get the phase speed 14 8 15 9 16 contains 10 11 SUBROUTINE ACAMA_GWD_rando(DTIME, pp, plat, tt, uu, vv, rot, & 12 zustr, zvstr, d_u, d_v,east_gwstress,west_gwstress) 13 14 ! Parametrization of the momentum flux deposition due to a discrete 15 ! number of gravity waves. 16 ! Author: F. Lott, A. de la Camara 17 ! July, 24th, 2014 18 ! Gaussian distribution of the source, source is vorticity squared 19 ! Reference: de la Camara and Lott (GRL, 2015, vol 42, 2071-2078 ) 20 ! Lott et al (JAS, 2010, vol 67, page 157-170) 21 ! Lott et al (JAS, 2012, vol 69, page 2134-2151) 22 23 ! ONLINE: 24 USE yoegwd_mod_h 25 USE yomcst_mod_h 26 use dimphy, only: klon, klev 27 use assert_m, only: assert 28 USE ioipsl_getin_p_mod, ONLY : getin_p 29 USE vertical_layers_mod, ONLY : presnivs 30 31 32 ! OFFLINE: 33 ! include "dimensions_mod.f90" 34 ! include "dimphy.h" 35 !END DIFFERENCE 36 37 ! 0. DECLARATIONS: 38 39 ! 0.1 INPUTS 40 REAL, intent(in)::DTIME ! Time step of the Physics 41 REAL, intent(in):: PP(:, :) ! (KLON, KLEV) Pressure at full levels 42 REAL, intent(in):: ROT(:,:) ! Relative vorticity 43 REAL, intent(in):: TT(:, :) ! (KLON, KLEV) Temp at full levels 44 REAL, intent(in):: UU(:, :) ! (KLON, KLEV) Zonal wind at full levels 45 REAL, intent(in):: VV(:, :) ! (KLON, KLEV) Merid wind at full levels 46 REAL, intent(in):: PLAT(:) ! (KLON) LATITUDE 47 48 ! 0.2 OUTPUTS 49 REAL, intent(out):: zustr(:), zvstr(:) ! (KLON) Surface Stresses 50 51 REAL, intent(inout):: d_u(:, :), d_v(:, :) 52 REAL, intent(inout):: east_gwstress(:, :) ! Profile of eastward stress 53 REAL, intent(inout):: west_gwstress(:, :) ! Profile of westward stress 54 ! (KLON, KLEV) tendencies on winds 55 56 ! O.3 INTERNAL ARRAYS 57 REAL BVLOW(klon) ! LOW LEVEL BV FREQUENCY 58 REAL ROTBA(KLON),CORIO(KLON) ! BAROTROPIC REL. VORTICITY AND PLANETARY 59 REAL UZ(KLON, KLEV + 1) 60 61 INTEGER II, JJ, LL 62 63 ! 0.3.0 TIME SCALE OF THE LIFE CYCLE OF THE WAVES PARAMETERIZED 64 65 REAL DELTAT 66 67 ! 0.3.1 GRAVITY-WAVES SPECIFICATIONS 68 69 INTEGER, PARAMETER:: NK = 2, NP = 2, NO = 2, NW = NK * NP * NO 70 INTEGER JK, JP, JO, JW 71 INTEGER, PARAMETER:: NA = 5 !number of realizations to get the phase speed 72 REAL KMIN, KMAX ! Min and Max horizontal wavenumbers 73 REAL CMIN, CMAX ! Min and Max absolute ph. vel. 74 REAL CPHA ! absolute PHASE VELOCITY frequency 75 REAL ZK(NW, KLON) ! Horizontal wavenumber amplitude 76 REAL ZP(NW, KLON) ! Horizontal wavenumber angle 77 REAL ZO(NW, KLON) ! Absolute frequency ! 78 79 ! Waves Intr. freq. at the 1/2 lev surrounding the full level 80 REAL ZOM(NW, KLON), ZOP(NW, KLON) 81 82 ! Wave EP-fluxes at the 2 semi levels surrounding the full level 83 REAL WWM(NW, KLON), WWP(NW, KLON) 84 85 REAL RUW0(NW, KLON) ! Fluxes at launching level 86 87 REAL RUWP(NW, KLON), RVWP(NW, KLON) 88 ! Fluxes X and Y for each waves at 1/2 Levels 89 90 INTEGER LAUNCH, LTROP ! Launching altitude and tropo altitude 91 92 REAL XLAUNCH ! Controle the launching altitude 93 REAL XTROP ! SORT of Tropopause altitude 94 REAL RUW(KLON, KLEV + 1) ! Flux x at semi levels 95 REAL RVW(KLON, KLEV + 1) ! Flux y at semi levels 96 97 REAL PRMAX ! Maximum value of PREC, and for which our linear formula 98 ! for GWs parameterisation apply 99 100 ! 0.3.2 PARAMETERS OF WAVES DISSIPATIONS 101 102 REAL RDISS, ZOISEC ! COEFF DE DISSIPATION, SECURITY FOR INTRINSIC FREQ 103 REAL CORSEC ! SECURITY FOR INTRINSIC CORIOLIS 104 REAL RUWFRT,SATFRT 105 106 ! 0.3.3 BACKGROUND FLOW AT 1/2 LEVELS AND VERTICAL COORDINATE 107 108 REAL H0 ! Characteristic Height of the atmosphere 109 REAL DZ ! Characteristic depth of the source! 110 REAL PR, TR ! Reference Pressure and Temperature 111 112 REAL ZH(KLON, KLEV + 1) ! Log-pressure altitude 113 114 REAL UH(KLON, KLEV + 1), VH(KLON, KLEV + 1) ! Winds at 1/2 levels 115 REAL PH(KLON, KLEV + 1) ! Pressure at 1/2 levels 116 REAL PSEC ! Security to avoid division by 0 pressure 117 REAL PHM1(KLON, KLEV + 1) ! 1/Press at 1/2 levels 118 REAL BV(KLON, KLEV + 1) ! Brunt Vaisala freq. (BVF) at 1/2 levels 119 REAL BVSEC ! Security to avoid negative BVF 120 121 REAL, DIMENSION(klev+1) ::HREF 122 LOGICAL, SAVE :: gwd_reproductibilite_mpiomp=.true. 123 LOGICAL, SAVE :: firstcall = .TRUE. 124 !$OMP THREADPRIVATE(firstcall,gwd_reproductibilite_mpiomp) 125 126 CHARACTER (LEN=20) :: modname='acama_gwd_rando_m' 17 18 SUBROUTINE ACAMA_GWD_rando_first 19 use dimphy, only: klev 20 USE ioipsl_getin_p_mod, ONLY : getin_p 21 IMPLICIT NONE 22 CHARACTER (LEN=20),PARAMETER :: modname='acama_gwd_rando_m' 127 23 CHARACTER (LEN=80) :: abort_message 128 129 130 131 IF (firstcall) THEN 24 25 IF (firstcall) THEN 132 26 ! Cle introduite pour resoudre un probleme de non reproductibilite 133 27 ! Le but est de pouvoir tester de revenir a la version precedenete … … 140 34 firstcall=.false. 141 35 ! CALL iophys_ini(dtime) 142 ENDIF 36 ENDIF 37 END SUBROUTINE ACAMA_GWD_rando_first 38 39 SUBROUTINE ACAMA_GWD_rando(DTIME, pp, plat, tt, uu, vv, rot, & 40 zustr, zvstr, d_u, d_v,east_gwstress,west_gwstress) 41 42 ! Parametrization of the momentum flux deposition due to a discrete 43 ! number of gravity waves. 44 ! Author: F. Lott, A. de la Camara 45 ! July, 24th, 2014 46 ! Gaussian distribution of the source, source is vorticity squared 47 ! Reference: de la Camara and Lott (GRL, 2015, vol 42, 2071-2078 ) 48 ! Lott et al (JAS, 2010, vol 67, page 157-170) 49 ! Lott et al (JAS, 2012, vol 69, page 2134-2151) 50 51 ! ONLINE: 52 USE yoegwd_mod_h 53 USE yomcst_mod_h 54 use dimphy, only: klon, klev 55 use assert_m, only: assert 56 USE vertical_layers_mod, ONLY : presnivs 57 USE lmdz_fake_call, ONLY : fake_call 58 59 ! OFFLINE: 60 ! include "dimensions_mod.f90" 61 ! include "dimphy.h" 62 !END DIFFERENCE 63 64 ! 0. DECLARATIONS: 65 66 ! 0.1 INPUTS 67 REAL, intent(in)::DTIME ! Time step of the Physics 68 REAL, intent(in):: PP(KLON, KLEV) ! (KLON, KLEV) Pressure at full levels 69 REAL, intent(in):: ROT(KLON,KLEV) ! Relative vorticity 70 REAL, intent(in):: TT(KLON, KLEV) ! (KLON, KLEV) Temp at full levels 71 REAL, intent(in):: UU(KLON, KLEV) ! (KLON, KLEV) Zonal wind at full levels 72 REAL, intent(in):: VV(KLON, KLEV) ! (KLON, KLEV) Merid wind at full levels 73 REAL, intent(in):: PLAT(KLON) ! (KLON) LATITUDE 74 75 ! 0.2 OUTPUTS 76 REAL, intent(out):: zustr(KLON), zvstr(KLON) ! (KLON) Surface Stresses 77 78 REAL, intent(inout):: d_u(KLON, KLEV), d_v(KLON, KLEV) 79 REAL, intent(inout):: east_gwstress(KLON, KLEV) ! Profile of eastward stress 80 REAL, intent(inout):: west_gwstress(KLON, KLEV) ! Profile of westward stress 81 ! (KLON, KLEV) tendencies on winds 82 83 ! O.3 INTERNAL ARRAYS 84 REAL BVLOW(klon) ! LOW LEVEL BV FREQUENCY 85 REAL ROTBA(KLON),CORIO(KLON) ! BAROTROPIC REL. VORTICITY AND PLANETARY 86 REAL UZ(KLON, KLEV + 1) 87 88 INTEGER II, JJ, LL 89 90 ! 0.3.0 TIME SCALE OF THE LIFE CYCLE OF THE WAVES PARAMETERIZED 91 92 REAL DELTAT 93 94 ! 0.3.1 GRAVITY-WAVES SPECIFICATIONS 95 96 INTEGER JK, JP, JO, JW 97 REAL KMIN, KMAX ! Min and Max horizontal wavenumbers 98 REAL CMIN, CMAX ! Min and Max absolute ph. vel. 99 REAL CPHA ! absolute PHASE VELOCITY frequency 100 REAL ZK(KLON, NW) ! Horizontal wavenumber amplitude 101 REAL ZP(KLON, NW) ! Horizontal wavenumber angle 102 REAL ZO(KLON,NW) ! Absolute frequency ! 103 104 ! Waves Intr. freq. at the 1/2 lev surrounding the full level 105 REAL ZOM(KLON, NW), ZOP(KLON, NW) 106 107 ! Wave EP-fluxes at the 2 semi levels surrounding the full level 108 REAL WWM(KLON, NW), WWP(KLON, NW) 109 110 REAL RUW0(KLON, NW) ! Fluxes at launching level 111 112 REAL RUWP(KLON, NW), RVWP(KLON, NW) 113 ! Fluxes X and Y for each waves at 1/2 Levels 114 115 INTEGER LAUNCH, LTROP ! Launching altitude and tropo altitude 116 117 REAL XLAUNCH ! Controle the launching altitude 118 REAL XTROP ! SORT of Tropopause altitude 119 REAL RUW(KLON, KLEV + 1) ! Flux x at semi levels 120 REAL RVW(KLON, KLEV + 1) ! Flux y at semi levels 121 122 REAL PRMAX ! Maximum value of PREC, and for which our linear formula 123 ! for GWs parameterisation apply 124 125 ! 0.3.2 PARAMETERS OF WAVES DISSIPATIONS 126 127 REAL RDISS, ZOISEC ! COEFF DE DISSIPATION, SECURITY FOR INTRINSIC FREQ 128 REAL CORSEC ! SECURITY FOR INTRINSIC CORIOLIS 129 REAL RUWFRT,SATFRT 130 131 ! 0.3.3 BACKGROUND FLOW AT 1/2 LEVELS AND VERTICAL COORDINATE 132 133 REAL H0 ! Characteristic Height of the atmosphere 134 REAL DZ ! Characteristic depth of the source! 135 REAL PR, TR ! Reference Pressure and Temperature 136 137 REAL ZH(KLON, KLEV + 1) ! Log-pressure altitude 138 139 REAL UH(KLON, KLEV + 1), VH(KLON, KLEV + 1) ! Winds at 1/2 levels 140 REAL PH(KLON, KLEV + 1) ! Pressure at 1/2 levels 141 REAL PSEC ! Security to avoid division by 0 pressure 142 REAL PHM1(KLON, KLEV + 1) ! 1/Press at 1/2 levels 143 REAL BV(KLON, KLEV + 1) ! Brunt Vaisala freq. (BVF) at 1/2 levels 144 REAL BVSEC ! Security to avoid negative BVF 145 146 REAL, DIMENSION(klev+1) ::HREF 147 148 CHARACTER (LEN=20),PARAMETER :: modname='acama_gwd_rando_m' 149 CHARACTER (LEN=80) :: abort_message 150 143 151 144 152 !----------------------------------------------------------------- … … 211 219 ! END ONLINE 212 220 221 CALL FAKE_CALL(BVLOW) ! to be suppress in future 222 CALL FAKE_CALL(CORIO) ! to be suppress in future 223 CALL FAKE_CALL(ROTBA) ! to be suppress in future 224 213 225 IF(DELTAT < DTIME)THEN 214 226 ! PRINT *, 'flott_gwd_rando: deltat < dtime!' … … 276 288 - TT(:, LL - 1)) / (ZH(:, LL) - ZH(:, LL - 1)) * RD / H0 277 289 end DO 278 BVLOW = 0.5 * (TT(:, LTROP )+ TT(:, LAUNCH)) &290 BVLOW(:) = 0.5 * (TT(:, LTROP )+ TT(:, LAUNCH)) & 279 291 * RD**2 / RCPD / H0**2 + (TT(:, LTROP ) & 280 292 - TT(:, LAUNCH))/(ZH(:, LTROP )- ZH(:, LAUNCH)) * RD / H0 … … 345 357 DO II = 1, KLON 346 358 ! Angle (0 or PI so far) 347 ! ZP( JW, II) = (SIGN(1., 0.5 - MOD(TT(II, JW) * 10., 1.)) + 1.) &359 ! ZP(II,JW) = (SIGN(1., 0.5 - MOD(TT(II, JW) * 10., 1.)) + 1.) & 348 360 ! * RPI / 2. 349 361 ! Angle between 0 and pi 350 ZP( JW, II) = MOD(TT(II, JW) * 10., 1.) * RPI362 ZP(II,JW) = MOD(TT(II, JW) * 10., 1.) * RPI 351 363 ! TEST WITH POSITIVE WAVES ONLY (Part I/II) 352 ! ZP( JW, II) = 0.364 ! ZP(II,JW) = 0. 353 365 ! Horizontal wavenumber amplitude 354 ZK( JW, II) = KMIN + (KMAX - KMIN) * MOD(TT(II, JW) * 100., 1.)366 ZK(II,JW) = KMIN + (KMAX - KMIN) * MOD(TT(II, JW) * 100., 1.) 355 367 ! Horizontal phase speed 356 368 CPHA = 0. … … 361 373 IF (CPHA.LT.0.) THEN 362 374 CPHA = -1.*CPHA 363 ZP( JW,II) = ZP(JW,II) + RPI375 ZP(II,JW) = ZP(II,JW) + RPI 364 376 ! TEST WITH POSITIVE WAVES ONLY (Part II/II) 365 ! ZP( JW, II) = 0.377 ! ZP(II,JW) = 0. 366 378 ENDIF 367 379 CPHA = CPHA + CMIN !we dont allow |c|<1m/s 368 380 ! Absolute frequency is imposed 369 ZO( JW, II) = CPHA * ZK(JW, II)381 ZO(II, JW) = CPHA * ZK(II,JW) 370 382 ! Intrinsic frequency is imposed 371 ZO( JW, II) = ZO(JW, II) &372 + ZK( JW, II) * COS(ZP(JW, II)) * UH(II, LAUNCH) &373 + ZK( JW, II) * SIN(ZP(JW, II)) * VH(II, LAUNCH)383 ZO(II, JW) = ZO(II, JW) & 384 + ZK(II,JW) * COS(ZP(II,JW)) * UH(II, LAUNCH) & 385 + ZK(II,JW) * SIN(ZP(II,JW)) * VH(II, LAUNCH) 374 386 ! Momentum flux at launch lev 375 387 ! LAUNCHED RANDOM WAVES WITH LOG-NORMAL AMPLITUDE 376 388 ! RIGHT IN THE SH (GWD4 after 1990) 377 RUW0( JW, II) = 0.389 RUW0(II, JW) = 0. 378 390 DO JJ = 1, NA 379 RUW0( JW, II) = RUW0(JW,II) + &391 RUW0(II, JW) = RUW0(II, JW) + & 380 392 2.*(MOD(TT(II, JW+4*(JJ-1)+JJ)**2, 1.)-0.5)*SQRT(3.)/SQRT(NA*1.) 381 393 END DO 382 RUW0( JW, II) = RUWFRT &383 * EXP(RUW0( JW,II))/1250. & ! 2 mpa at south pole394 RUW0(II,JW) = RUWFRT & 395 * EXP(RUW0(II,JW))/1250. & ! 2 mpa at south pole 384 396 *((1.05+SIN(PLAT(II)*RPI/180.))/(1.01+SIN(PLAT(II)*RPI/180.))-2.05/2.01) 385 ! RUW0( JW, II) = RUWFRT397 ! RUW0(II,JW) = RUWFRT 386 398 ENDDO 387 399 end DO … … 397 409 398 410 ! Evaluate intrinsic frequency at launching altitude: 399 ZOP( JW, :) = ZO(JW, :) &400 - ZK( JW, :) * COS(ZP(JW, :)) * UH(:, LAUNCH) &401 - ZK( JW, :) * SIN(ZP(JW, :)) * VH(:, LAUNCH)411 ZOP(:, JW) = ZO(:, JW) & 412 - ZK(:,JW) * COS(ZP(:,JW)) * UH(:, LAUNCH) & 413 - ZK(:,JW) * SIN(ZP(:,JW)) * VH(:, LAUNCH) 402 414 403 415 ! VERSION WITH FRONTAL SOURCES … … 406 418 407 419 ! tanh limitation for values above CORIO (inertial instability). 408 ! WWP( JW, :) = RUW0(JW, :) &409 WWP( JW, :) = RUWFRT &420 ! WWP(:,JW) = RUW0(:,JW) & 421 WWP(:,JW) = RUWFRT & 410 422 ! * (CORIO(:)*TANH(ROTBA(:)/CORIO(:)))**2 & 411 423 ! * ABS((CORIO(:)*TANH(ROTBA(:)/CORIO(:)))*CORIO(:)) & … … 413 425 ! * (CORIO(:)*CORIO(:)) & 414 426 ! MODERATION BY THE DEPTH OF THE SOURCE (DZ HERE) 415 ! *EXP(-BVLOW(:)**2/MAX(ABS(ZOP( JW, :)),ZOISEC)**2 &416 ! *ZK( JW, :)**2*DZ**2) &427 ! *EXP(-BVLOW(:)**2/MAX(ABS(ZOP(:,JW)),ZOISEC)**2 & 428 ! *ZK(:,JW)**2*DZ**2) & 417 429 ! COMPLETE FORMULA: 418 430 !* CORIO(:)**2*TANH(ROTBA(:)/CORIO(:)**2) & … … 420 432 ! RESTORE DIMENSION OF A FLUX 421 433 ! *RD*TR/PR 422 ! *1. + RUW0( JW, :)434 ! *1. + RUW0(:,JW) 423 435 *1. 424 436 … … 429 441 ! Put the stress in the right direction: 430 442 431 RUWP( JW, :) = SIGN(1., ZOP(JW, :))*COS(ZP(JW, :)) * WWP(JW, :)432 RVWP( JW, :) = SIGN(1., ZOP(JW, :))*SIN(ZP(JW, :)) * WWP(JW, :)443 RUWP(:,JW) = SIGN(1., ZOP(:,JW))*COS(ZP(:,JW)) * WWP(:,JW) 444 RVWP(:,JW) = SIGN(1., ZOP(:,JW))*SIN(ZP(:,JW)) * WWP(:,JW) 433 445 434 446 end DO … … 440 452 RVW(:, LL) = 0 441 453 DO JW = 1, NW 442 RUW(:, LL) = RUW(:, LL) + RUWP( JW, :)443 RVW(:, LL) = RVW(:, LL) + RVWP( JW, :)454 RUW(:, LL) = RUW(:, LL) + RUWP(:,JW) 455 RVW(:, LL) = RVW(:, LL) + RVWP(:,JW) 444 456 end DO 445 457 end DO … … 453 465 ! to the next) 454 466 DO JW = 1, NW 455 ZOM( JW, :) = ZOP(JW, :)456 WWM( JW, :) = WWP(JW, :)467 ZOM(:, JW) = ZOP(:,JW) 468 WWM(:,JW) = WWP(:,JW) 457 469 ! Intrinsic Frequency 458 ZOP( JW, :) = ZO(JW, :) - ZK(JW, :) * COS(ZP(JW, :)) * UH(:, LL + 1) &459 - ZK( JW, :) * SIN(ZP(JW, :)) * VH(:, LL + 1)470 ZOP(:,JW) = ZO(:, JW) - ZK(:,JW) * COS(ZP(:,JW)) * UH(:, LL + 1) & 471 - ZK(:,JW) * SIN(ZP(:,JW)) * VH(:, LL + 1) 460 472 461 473 ! No breaking (Eq.6) 462 474 ! Dissipation (Eq. 8) 463 WWP( JW, :) = WWM(JW, :) * EXP(- 4. * RDISS * PR / (PH(:, LL + 1) &475 WWP(:,JW) = WWM(:,JW) * EXP(- 4. * RDISS * PR / (PH(:, LL + 1) & 464 476 + PH(:, LL)) * ((BV(:, LL + 1) + BV(:, LL)) / 2.)**3 & 465 / MAX(ABS(ZOP( JW, :) + ZOM(JW, :)) / 2., ZOISEC)**4 &466 * ZK( JW, :)**3 * (ZH(:, LL + 1) - ZH(:, LL)))477 / MAX(ABS(ZOP(:,JW) + ZOM(:, JW)) / 2., ZOISEC)**4 & 478 * ZK(:,JW)**3 * (ZH(:, LL + 1) - ZH(:, LL))) 467 479 468 480 ! Critical levels (forced to zero if intrinsic frequency changes sign) 469 481 ! Saturation (Eq. 12) 470 WWP( JW, :) = min(WWP(JW, :), MAX(0., &471 SIGN(1., ZOP( JW, :) * ZOM(JW, :))) * ABS(ZOP(JW, :))**3 &482 WWP(:,JW) = min(WWP(:,JW), MAX(0., & 483 SIGN(1., ZOP(:,JW) * ZOM(:, JW))) * ABS(ZOP(:,JW))**3 & 472 484 ! / BV(:, LL + 1) * EXP(- ZH(:, LL + 1) / H0) * SATFRT**2 * KMIN**2 & 473 485 / BV(:, LL + 1) * EXP(- ZH(:, LL + 1) / H0) * KMIN**2 & 474 486 ! *(SATFRT*(2.5+1.5*TANH((ZH(:,LL+1)/H0-8.)/2.)))**2 & 475 487 *SATFRT**2 & 476 / ZK( JW, :)**4)488 / ZK(:,JW)**4) 477 489 end DO 478 490 … … 481 493 482 494 DO JW = 1, NW 483 RUWP( JW, :) = SIGN(1., ZOP(JW, :))*COS(ZP(JW, :)) * WWP(JW, :)484 RVWP( JW, :) = SIGN(1., ZOP(JW, :))*SIN(ZP(JW, :)) * WWP(JW, :)495 RUWP(:,JW) = SIGN(1., ZOP(:,JW))*COS(ZP(:,JW)) * WWP(:,JW) 496 RVWP(:,JW) = SIGN(1., ZOP(:,JW))*SIN(ZP(:,JW)) * WWP(:,JW) 485 497 end DO 486 498 … … 489 501 490 502 DO JW = 1, NW 491 RUW(:, LL + 1) = RUW(:, LL + 1) + RUWP( JW, :)492 RVW(:, LL + 1) = RVW(:, LL + 1) + RVWP( JW, :)493 EAST_GWSTRESS(:, LL)=EAST_GWSTRESS(:, LL)+MAX(0.,RUWP( JW,:))/FLOAT(NW)494 WEST_GWSTRESS(:, LL)=WEST_GWSTRESS(:, LL)+MIN(0.,RUWP( JW,:))/FLOAT(NW)503 RUW(:, LL + 1) = RUW(:, LL + 1) + RUWP(:,JW) 504 RVW(:, LL + 1) = RVW(:, LL + 1) + RVWP(:,JW) 505 EAST_GWSTRESS(:, LL)=EAST_GWSTRESS(:, LL)+MAX(0.,RUWP(:,JW))/REAL(NW) 506 WEST_GWSTRESS(:, LL)=WEST_GWSTRESS(:, LL)+MIN(0.,RUWP(:,JW))/REAL(NW) 495 507 end DO 496 508 end DO -
LMDZ6/trunk/libf/phylmd/flott_gwd_rando_m.f90
r5309 r5512 6 6 USE clesphys_mod_h 7 7 implicit none 8 9 contains10 11 SUBROUTINE FLOTT_GWD_rando(DTIME, pp, tt, uu, vv, prec, zustr, zvstr, d_u, &12 d_v,east_gwstress,west_gwstress)13 14 ! Parametrization of the momentum flux deposition due to a discrete15 ! number of gravity waves.16 ! Author: F. Lott17 ! July, 12th, 201218 ! Gaussian distribution of the source, source is precipitation19 ! Reference: Lott (JGR, vol 118, page 8897, 2013)20 21 !ONLINE:22 USE yomcst_mod_h23 use dimphy, only: klon, klev24 use assert_m, only: assert25 USE ioipsl_getin_p_mod, ONLY : getin_p26 USE vertical_layers_mod, ONLY : presnivs27 USE yoegwd_mod_h28 CHARACTER (LEN=20) :: modname='flott_gwd_rando'29 CHARACTER (LEN=80) :: abort_message30 31 ! OFFLINE:32 ! include "dimensions_mod.f90"33 ! include "dimphy.h"34 ! END OF DIFFERENCE ONLINE-OFFLINE35 36 ! 0. DECLARATIONS:37 38 ! 0.1 INPUTS39 REAL, intent(in)::DTIME ! Time step of the Physics40 REAL, intent(in):: pp(:, :) ! (KLON, KLEV) Pressure at full levels41 REAL, intent(in):: prec(:) ! (klon) Precipitation (kg/m^2/s)42 REAL, intent(in):: TT(:, :) ! (KLON, KLEV) Temp at full levels43 REAL, intent(in):: UU(:, :) ! (KLON, KLEV) Zonal wind at full levels44 REAL, intent(in):: VV(:, :) ! (KLON, KLEV) Merid wind at full levels45 46 ! 0.2 OUTPUTS47 REAL, intent(out):: zustr(:), zvstr(:) ! (KLON) Surface Stresses48 49 REAL, intent(inout):: d_u(:, :), d_v(:, :)50 REAL, intent(inout):: east_gwstress(:, :) ! Profile of eastward stress51 REAL, intent(inout):: west_gwstress(:, :) ! Profile of westward stress52 53 ! (KLON, KLEV) tendencies on winds54 55 ! O.3 INTERNAL ARRAYS56 REAL BVLOW(klon)57 REAL DZ ! Characteristic depth of the Source58 59 INTEGER II, JJ, LL60 61 ! 0.3.0 TIME SCALE OF THE LIFE CYCLE OF THE WAVES PARAMETERIZED62 63 REAL DELTAT64 65 ! 0.3.1 GRAVITY-WAVES SPECIFICATIONS66 67 8 INTEGER, PARAMETER:: NK = 2, NP = 2, NO = 2, NW = NK * NP * NO 68 INTEGER JK, JP, JO, JW69 9 INTEGER, PARAMETER:: NA = 5 !number of realizations to get the phase speed 70 REAL KMIN, KMAX ! Min and Max horizontal wavenumbers71 REAL CMAX ! standard deviation of the phase speed distribution72 REAL RUWMAX,SAT ! ONLINE SPECIFIED IN run.def73 REAL CPHA ! absolute PHASE VELOCITY frequency74 REAL ZK(NW, KLON) ! Horizontal wavenumber amplitude75 REAL ZP(NW, KLON) ! Horizontal wavenumber angle76 REAL ZO(NW, KLON) ! Absolute frequency !77 78 ! Waves Intr. freq. at the 1/2 lev surrounding the full level79 REAL ZOM(NW, KLON), ZOP(NW, KLON)80 81 ! Wave EP-fluxes at the 2 semi levels surrounding the full level82 REAL WWM(NW, KLON), WWP(NW, KLON)83 84 REAL RUW0(NW, KLON) ! Fluxes at launching level85 86 REAL RUWP(NW, KLON), RVWP(NW, KLON)87 ! Fluxes X and Y for each waves at 1/2 Levels88 89 INTEGER LAUNCH, LTROP ! Launching altitude and tropo altitude90 91 REAL XLAUNCH ! Controle the launching altitude92 REAL XTROP ! SORT of Tropopause altitude93 REAL RUW(KLON, KLEV + 1) ! Flux x at semi levels94 REAL RVW(KLON, KLEV + 1) ! Flux y at semi levels95 96 REAL PRMAX ! Maximum value of PREC, and for which our linear formula97 ! for GWs parameterisation apply98 99 ! 0.3.2 PARAMETERS OF WAVES DISSIPATIONS100 101 REAL RDISS, ZOISEC ! COEFF DE DISSIPATION, SECURITY FOR INTRINSIC FREQ102 103 ! 0.3.3 BACKGROUND FLOW AT 1/2 LEVELS AND VERTICAL COORDINATE104 105 REAL H0 ! Characteristic Height of the atmosphere106 REAL PR, TR ! Reference Pressure and Temperature107 108 REAL ZH(KLON, KLEV + 1) ! Log-pressure altitude109 110 REAL UH(KLON, KLEV + 1), VH(KLON, KLEV + 1) ! Winds at 1/2 levels111 REAL PH(KLON, KLEV + 1) ! Pressure at 1/2 levels112 REAL PSEC ! Security to avoid division by 0 pressure113 REAL BV(KLON, KLEV + 1) ! Brunt Vaisala freq. (BVF) at 1/2 levels114 REAL BVSEC ! Security to avoid negative BVF115 REAL RAN_NUM_1,RAN_NUM_2,RAN_NUM_3116 117 REAL, DIMENSION(klev+1) ::HREF118 119 10 LOGICAL, SAVE :: gwd_reproductibilite_mpiomp=.true. 120 11 LOGICAL, SAVE :: firstcall = .TRUE. 121 !$OMP THREADPRIVATE(firstcall,gwd_reproductibilite_mpiomp) 122 123 124 IF (firstcall) THEN 12 !$OMP THREADPRIVATE(firstcall,gwd_reproductibilite_mpiomp) 13 14 contains 15 16 SUBROUTINE FLOTT_GWD_rando_first 17 use dimphy, only: klev 18 USE ioipsl_getin_p_mod, ONLY : getin_p 19 IMPLICIT NONE 20 CHARACTER (LEN=20),PARAMETER :: modname='acama_gwd_rando_m' 21 CHARACTER (LEN=80) :: abort_message 22 23 IF (firstcall) THEN 125 24 ! Cle introduite pour resoudre un probleme de non reproductibilite 126 25 ! Le but est de pouvoir tester de revenir a la version precedenete … … 133 32 firstcall=.false. 134 33 ENDIF 34 END SUBROUTINE FLOTT_GWD_rando_first 35 36 37 SUBROUTINE FLOTT_GWD_rando(DTIME, PP, tt, uu, vv, prec, zustr, zvstr, d_u, & 38 d_v,east_gwstress,west_gwstress) 39 40 ! Parametrization of the momentum flux deposition due to a discrete 41 ! number of gravity waves. 42 ! Author: F. Lott 43 ! July, 12th, 2012 44 ! Gaussian distribution of the source, source is precipitation 45 ! Reference: Lott (JGR, vol 118, page 8897, 2013) 46 47 !ONLINE: 48 USE yomcst_mod_h 49 use dimphy, only: klon, klev 50 use assert_m, only: assert 51 USE ioipsl_getin_p_mod, ONLY : getin_p 52 USE vertical_layers_mod, ONLY : presnivs 53 USE yoegwd_mod_h 54 USE lmdz_fake_call, ONLY : fake_call 55 56 CHARACTER (LEN=20),PARAMETER :: modname='flott_gwd_rando' 57 CHARACTER (LEN=80) :: abort_message 58 59 ! OFFLINE: 60 ! include "dimensions_mod.f90" 61 ! include "dimphy.h" 62 ! END OF DIFFERENCE ONLINE-OFFLINE 63 64 ! 0. DECLARATIONS: 65 66 ! 0.1 INPUTS 67 REAL, intent(in)::DTIME ! Time step of the Physics 68 REAL, intent(in):: pp(KLON, KLEV) ! (KLON, KLEV) Pressure at full levels 69 REAL, intent(in):: prec(KLON) ! (klon) Precipitation (kg/m^2/s) 70 REAL, intent(in):: TT(KLON, KLEV) ! (KLON, KLEV) Temp at full levels 71 REAL, intent(in):: UU(KLON, KLEV) ! (KLON, KLEV) Zonal wind at full levels 72 REAL, intent(in):: VV(KLON, KLEV) ! (KLON, KLEV) Merid wind at full levels 73 74 ! 0.2 OUTPUTS 75 REAL, intent(out):: zustr(KLON), zvstr(KLON) ! (KLON) Surface Stresses 76 77 REAL, intent(inout):: d_u(KLON, KLEV), d_v(KLON, KLEV) 78 REAL, intent(inout):: east_gwstress(KLON, KLEV) ! Profile of eastward stress 79 REAL, intent(inout):: west_gwstress(KLON, KLEV) ! Profile of westward stress 80 81 ! (KLON, KLEV) tendencies on winds 82 83 ! O.3 INTERNAL ARRAYS 84 REAL BVLOW(klon) 85 REAL DZ ! Characteristic depth of the Source 86 87 INTEGER II, JJ, LL 88 89 ! 0.3.0 TIME SCALE OF THE LIFE CYCLE OF THE WAVES PARAMETERIZED 90 91 REAL DELTAT 92 93 ! 0.3.1 GRAVITY-WAVES SPECIFICATIONS 94 95 INTEGER JK, JP, JO, JW 96 REAL KMIN, KMAX ! Min and Max horizontal wavenumbers 97 REAL CMAX ! standard deviation of the phase speed distribution 98 REAL RUWMAX,SAT ! ONLINE SPECIFIED IN run.def 99 REAL CPHA ! absolute PHASE VELOCITY frequency 100 REAL ZK(KLON, NW) ! Horizontal wavenumber amplitude 101 REAL ZP(KLON, NW) ! Horizontal wavenumber angle 102 REAL ZO(KLON, NW) ! Absolute frequency ! 103 104 ! Waves Intr. freq. at the 1/2 lev surrounding the full level 105 REAL ZOM(KLON, NW), ZOP(KLON, NW) 106 107 ! Wave EP-fluxes at the 2 semi levels surrounding the full level 108 REAL WWM(KLON, NW), WWP(KLON, NW) 109 110 REAL RUW0(KLON, NW) ! Fluxes at launching level 111 112 REAL RUWP(KLON, NW), RVWP(KLON, NW) 113 ! Fluxes X and Y for each waves at 1/2 Levels 114 115 INTEGER LAUNCH, LTROP ! Launching altitude and tropo altitude 116 117 REAL XLAUNCH ! Controle the launching altitude 118 REAL XTROP ! SORT of Tropopause altitude 119 REAL RUW(KLON, KLEV + 1) ! Flux x at semi levels 120 REAL RVW(KLON, KLEV + 1) ! Flux y at semi levels 121 122 REAL PRMAX ! Maximum value of PREC, and for which our linear formula 123 ! for GWs parameterisation apply 124 125 ! 0.3.2 PARAMETERS OF WAVES DISSIPATIONS 126 127 REAL RDISS, ZOISEC ! COEFF DE DISSIPATION, SECURITY FOR INTRINSIC FREQ 128 129 ! 0.3.3 BACKGROUND FLOW AT 1/2 LEVELS AND VERTICAL COORDINATE 130 131 REAL H0 ! Characteristic Height of the atmosphere 132 REAL PR, TR ! Reference Pressure and Temperature 133 134 REAL ZH(KLON, KLEV + 1) ! Log-pressure altitude 135 136 REAL UH(KLON, KLEV + 1), VH(KLON, KLEV + 1) ! Winds at 1/2 levels 137 REAL PH(KLON, KLEV + 1) ! Pressure at 1/2 levels 138 REAL PSEC ! Security to avoid division by 0 pressure 139 REAL BV(KLON, KLEV + 1) ! Brunt Vaisala freq. (BVF) at 1/2 levels 140 REAL BVSEC ! Security to avoid negative BVF 141 REAL RAN_NUM_1,RAN_NUM_2,RAN_NUM_3 142 143 REAL, DIMENSION(klev+1) ::HREF 135 144 136 145 … … 197 206 !END ONLINE 198 207 ENDIF 199 208 200 209 IF(DELTAT < DTIME)THEN 201 210 abort_message='flott_gwd_rando: deltat < dtime!' … … 207 216 CALL abort_physic(modname,abort_message,1) 208 217 ENDIF 209 218 219 CALL FAKE_CALL(BVLOW) ! to be suppress in future 220 210 221 ! 2. EVALUATION OF THE BACKGROUND FLOW AT SEMI-LEVELS 211 222 … … 292 303 RAN_NUM_1=MOD(TT(II, JW) * 10., 1.) 293 304 RAN_NUM_2= MOD(TT(II, JW) * 100., 1.) 294 ZP( JW, II) = (SIGN(1., 0.5 - RAN_NUM_1) + 1.) &305 ZP(II, JW) = (SIGN(1., 0.5 - RAN_NUM_1) + 1.) & 295 306 * RPI / 2. 296 307 ! Horizontal wavenumber amplitude 297 ZK( JW, II) = KMIN + (KMAX - KMIN) *RAN_NUM_2308 ZK(II, JW) = KMIN + (KMAX - KMIN) *RAN_NUM_2 298 309 ! Horizontal phase speed 299 310 CPHA = 0. … … 305 316 IF (CPHA.LT.0.) THEN 306 317 CPHA = -1.*CPHA 307 ZP( JW,II) = ZP(JW,II) + RPI318 ZP(II, JW) = ZP(II, JW) + RPI 308 319 ENDIF 309 320 ! Absolute frequency is imposed 310 ZO( JW, II) = CPHA * ZK(JW, II)321 ZO(II, JW) = CPHA * ZK(II, JW) 311 322 ! Intrinsic frequency is imposed 312 ZO( JW, II) = ZO(JW, II) &313 + ZK( JW, II) * COS(ZP(JW, II)) * UH(II, LAUNCH) &314 + ZK( JW, II) * SIN(ZP(JW, II)) * VH(II, LAUNCH)323 ZO(II, JW) = ZO(II, JW) & 324 + ZK(II, JW) * COS(ZP(II, JW)) * UH(II, LAUNCH) & 325 + ZK(II, JW) * SIN(ZP(II, JW)) * VH(II, LAUNCH) 315 326 ! Momentum flux at launch lev 316 RUW0( JW, II) = RUWMAX327 RUW0(II, JW) = RUWMAX 317 328 ENDDO 318 329 ENDDO … … 326 337 327 338 ! Evaluate intrinsic frequency at launching altitude: 328 ZOP( JW, :) = ZO(JW, :) &329 - ZK( JW, :) * COS(ZP(JW, :)) * UH(:, LAUNCH) &330 - ZK( JW, :) * SIN(ZP(JW, :)) * VH(:, LAUNCH)339 ZOP(:,JW) = ZO(:, JW) & 340 - ZK(:, JW) * COS(ZP(:, JW)) * UH(:, LAUNCH) & 341 - ZK(:, JW) * SIN(ZP(:, JW)) * VH(:, LAUNCH) 331 342 332 343 ! VERSION WITH CONVECTIVE SOURCE … … 337 348 338 349 ! tanh limitation to values above prmax: 339 WWP( JW, :) = RUW0(JW, :) &350 WWP(:, JW) = RUW0(:, JW) & 340 351 * (RD / RCPD / H0 * RLVTT * PRMAX * TANH(PREC(:) / PRMAX))**2 341 352 342 353 ! Factor related to the characteristics of the waves: 343 WWP( JW, :) = WWP(JW, :) * ZK(JW, :)**3 / KMIN / BVLOW(:) &344 / MAX(ABS(ZOP( JW, :)), ZOISEC)**3354 WWP(:, JW) = WWP(:, JW) * ZK(:, JW)**3 / KMIN / BVLOW(:) & 355 / MAX(ABS(ZOP(:, JW)), ZOISEC)**3 345 356 346 357 ! Moderation by the depth of the source (dz here): 347 WWP( JW, :) = WWP(JW, :) &348 * EXP(- BVLOW(:)**2 / MAX(ABS(ZOP( JW, :)), ZOISEC)**2 * ZK(JW, :)**2 &358 WWP(:, JW) = WWP(:, JW) & 359 * EXP(- BVLOW(:)**2 / MAX(ABS(ZOP(:, JW)), ZOISEC)**2 * ZK(:, JW)**2 & 349 360 * DZ**2) 350 361 351 362 ! Put the stress in the right direction: 352 RUWP( JW, :) = ZOP(JW, :) / MAX(ABS(ZOP(JW, :)), ZOISEC)**2 &353 * BV(:, LAUNCH) * COS(ZP( JW, :)) * WWP(JW, :)**2354 RVWP( JW, :) = ZOP(JW, :) / MAX(ABS(ZOP(JW, :)), ZOISEC)**2 &355 * BV(:, LAUNCH) * SIN(ZP( JW, :)) * WWP(JW, :)**2363 RUWP(:, JW) = ZOP(:, JW) / MAX(ABS(ZOP(:, JW)), ZOISEC)**2 & 364 * BV(:, LAUNCH) * COS(ZP(:, JW)) * WWP(:, JW)**2 365 RVWP(:, JW) = ZOP(:, JW) / MAX(ABS(ZOP(:, JW)), ZOISEC)**2 & 366 * BV(:, LAUNCH) * SIN(ZP(:, JW)) * WWP(:, JW)**2 356 367 end DO 357 368 … … 363 374 RVW(:, LL) = 0 364 375 DO JW = 1, NW 365 RUW(:, LL) = RUW(:, LL) + RUWP( JW, :)366 RVW(:, LL) = RVW(:, LL) + RVWP( JW, :)376 RUW(:, LL) = RUW(:, LL) + RUWP(:, JW) 377 RVW(:, LL) = RVW(:, LL) + RVWP(:, JW) 367 378 end DO 368 379 end DO … … 376 387 ! to the next) 377 388 DO JW = 1, NW 378 ZOM( JW, :) = ZOP(JW, :)379 WWM( JW, :) = WWP(JW, :)389 ZOM(:, JW) = ZOP(:,JW) 390 WWM(:, JW) = WWP(:, JW) 380 391 ! Intrinsic Frequency 381 ZOP( JW, :) = ZO(JW, :) - ZK(JW, :) * COS(ZP(JW, :)) * UH(:, LL + 1) &382 - ZK( JW, :) * SIN(ZP(JW, :)) * VH(:, LL + 1)392 ZOP(:, JW) = ZO(:, JW) - ZK(:, JW) * COS(ZP(:, JW)) * UH(:, LL + 1) & 393 - ZK(:, JW) * SIN(ZP(:, JW)) * VH(:, LL + 1) 383 394 384 395 ! No breaking (Eq.6) 385 396 ! Dissipation (Eq. 8) 386 WWP( JW, :) = WWM(JW, :) * EXP(- 4. * RDISS * PR / (PH(:, LL + 1) &397 WWP(:, JW) = WWM(:, JW) * EXP(- 4. * RDISS * PR / (PH(:, LL + 1) & 387 398 + PH(:, LL)) * ((BV(:, LL + 1) + BV(:, LL)) / 2.)**3 & 388 / MAX(ABS(ZOP( JW, :) + ZOM(JW, :)) / 2., ZOISEC)**4 &389 * ZK( JW, :)**3 * (ZH(:, LL + 1) - ZH(:, LL)))399 / MAX(ABS(ZOP(:, JW) + ZOM(:, JW)) / 2., ZOISEC)**4 & 400 * ZK(:, JW)**3 * (ZH(:, LL + 1) - ZH(:, LL))) 390 401 391 402 ! Critical levels (forced to zero if intrinsic frequency changes sign) 392 403 ! Saturation (Eq. 12) 393 WWP( JW, :) = min(WWP(JW, :), MAX(0., &394 SIGN(1., ZOP( JW, :) * ZOM(JW, :))) * ABS(ZOP(JW, :))**3 &404 WWP(:, JW) = min(WWP(:, JW), MAX(0., & 405 SIGN(1., ZOP(:, JW) * ZOM(:, JW))) * ABS(ZOP(:, JW))**3 & 395 406 / BV(:, LL + 1) * EXP(- ZH(:, LL + 1) / H0) * KMIN**2 & 396 * SAT**2 / ZK( JW, :)**4)407 * SAT**2 / ZK(:, JW)**4) 397 408 end DO 398 409 … … 401 412 402 413 DO JW = 1, NW 403 RUWP( JW, :) = SIGN(1., ZOP(JW, :))*COS(ZP(JW, :)) * WWP(JW, :)404 RVWP( JW, :) = SIGN(1., ZOP(JW, :))*SIN(ZP(JW, :)) * WWP(JW, :)414 RUWP(:, JW) = SIGN(1., ZOP(:, JW))*COS(ZP(:, JW)) * WWP(:, JW) 415 RVWP(:, JW) = SIGN(1., ZOP(:, JW))*SIN(ZP(:, JW)) * WWP(:, JW) 405 416 end DO 406 417 … … 409 420 410 421 DO JW = 1, NW 411 RUW(:, LL + 1) = RUW(:, LL + 1) + RUWP( JW, :)412 RVW(:, LL + 1) = RVW(:, LL + 1) + RVWP( JW, :)413 EAST_GWSTRESS(:, LL)=EAST_GWSTRESS(:, LL)+MAX(0.,RUWP( JW,:))/FLOAT(NW)414 WEST_GWSTRESS(:, LL)=WEST_GWSTRESS(:, LL)+MIN(0.,RUWP( JW,:))/FLOAT(NW)422 RUW(:, LL + 1) = RUW(:, LL + 1) + RUWP(:, JW) 423 RVW(:, LL + 1) = RVW(:, LL + 1) + RVWP(:, JW) 424 EAST_GWSTRESS(:, LL)=EAST_GWSTRESS(:, LL)+MAX(0.,RUWP(:, JW))/REAL(NW) 425 WEST_GWSTRESS(:, LL)=WEST_GWSTRESS(:, LL)+MIN(0.,RUWP(:, JW))/REAL(NW) 415 426 end DO 416 427 end DO -
LMDZ6/trunk/libf/phylmd/lmdz_thermcell_down.f90
r5390 r5512 43 43 integer ig,ilay 44 44 real, dimension(ngrid,nlay):: s1,s2,num !coefficients pour la resolution implicite 45 integer :: iflag_impl =1! 0 pour explicite, 1 pour implicite "classique", 2 pour implicite avec entrainement et detrainement46 45 integer :: iflag_impl ! 0 pour explicite, 1 pour implicite "classique", 2 pour implicite avec entrainement et detrainement 46 47 47 fdn(:,:)=0. 48 48 fup(:,:)=0. … … 59 59 s2(:,:)=0. 60 60 num(:,:)=1. 61 62 iflag_impl=1 ! 0 pour explicite, 1 pour implicite "classique", 2 pour implicite avec entrainement et detrainement 61 63 62 64 if ( iflag_thermals_down < 10 ) then -
LMDZ6/trunk/libf/phylmd/lmdz_thermcell_dq.f90
r5434 r5512 38 38 39 39 integer niter,iter 40 CHARACTER (LEN=20) :: modname='thermcell_dq'40 CHARACTER (LEN=20), PARAMETER :: modname='thermcell_dq' 41 41 CHARACTER (LEN=80) :: abort_message 42 42 … … 190 190 real ztimestep 191 191 integer niter,iter 192 CHARACTER (LEN=20) :: modname='thermcell_dq'192 CHARACTER (LEN=20), PARAMETER :: modname='thermcell_dq' 193 193 CHARACTER (LEN=80) :: abort_message 194 194 -
LMDZ6/trunk/libf/phylmd/lmdz_thermcell_dry.f90
r5390 r5512 33 33 REAL linter(ngrid),zlevinter(ngrid) 34 34 INTEGER lmix(ngrid),lmax(ngrid),lmin(ngrid) 35 CHARACTER (LEN=20):: modname='thermcell_dry'36 CHARACTER (LEN=80) :: abort_message35 CHARACTER (LEN=20), PARAMETER :: modname='thermcell_dry' 36 CHARACTER (LEN=80) :: abort_message 37 37 INTEGER l,ig 38 38 -
LMDZ6/trunk/libf/phylmd/lmdz_thermcell_env.f90
r5390 r5512 51 51 ! Calcul de l'humidite a saturation et de la condensation 52 52 53 call thermcell_qsat(ngrid *nlay,mask,pplev,pt,po,pqsat)53 call thermcell_qsat(ngrid, nlay,mask,pplev,pt,po,pqsat) 54 54 do ll=1,nlay 55 55 do ig=1,ngrid -
LMDZ6/trunk/libf/phylmd/lmdz_thermcell_flux2.f90
r5390 r5512 16 16 !--------------------------------------------------------------------------- 17 17 18 USE lmdz_thermcell_ini, ONLY : prt_level,iflag_thermals_optflux 18 USE lmdz_thermcell_ini, ONLY : prt_level,iflag_thermals_optflux, thermals_fomass_max, thermals_alphamax 19 19 IMPLICIT NONE 20 20 … … 48 48 REAL f_old,ddd0,eee0,ddd,eee,zzz 49 49 50 REAL,SAVE :: fomass_max=0.551 REAL,SAVE :: alphamax=0.752 !$OMP THREADPRIVATE(fomass_max,alphamax)53 54 50 logical check_debug,labort_physic 55 51 56 character (len=20) :: modname='thermcell_flux2'52 character (len=20), PARAMETER :: modname='thermcell_flux2' 57 53 character (len=80) :: abort_message 58 54 … … 391 387 do ig=1,ngrid 392 388 if (zw2(ig,l+1).gt.1.e-10) then 393 zfm=rhobarz(ig,l+1)*zw2(ig,l+1)* alphamax389 zfm=rhobarz(ig,l+1)*zw2(ig,l+1)*thermals_alphamax 394 390 if ( fm(ig,l+1) .gt. zfm) then 395 391 f_old=fm(ig,l+1) … … 430 426 eee0=entr(ig,l) 431 427 ddd0=detr(ig,l) 432 eee=entr(ig,l)-masse(ig,l)* fomass_max/ptimestep428 eee=entr(ig,l)-masse(ig,l)*thermals_fomass_max/ptimestep 433 429 ddd=detr(ig,l)-eee 434 430 if (eee.gt.0.) then … … 470 466 print*,'detr',detr(ig,l) 471 467 print*,'masse',masse(ig,l) 472 print*,' fomass_max',fomass_max473 print*,'masse(ig,l)*fomass_max/ptimestep',masse(ig,l)* fomass_max/ptimestep468 print*,'thermal_fomass_max',thermals_fomass_max 469 print*,'masse(ig,l)*fomass_max/ptimestep',masse(ig,l)*thermals_fomass_max/ptimestep 474 470 print*,'ptimestep',ptimestep 475 471 print*,'lmax(ig)',lmax(ig) -
LMDZ6/trunk/libf/phylmd/lmdz_thermcell_ini.f90
r5434 r5512 1 1 MODULE lmdz_thermcell_ini 2 USE strings_mod, ONLY : maxlen 2 3 3 4 IMPLICIT NONE … … 34 35 integer, protected :: thermals_flag_alim=0 ! 35 36 integer, protected :: iflag_thermals_tenv=0 ! 37 real, protected :: thermals_fomass_max=0.5 ! Limitation du "vidage" des mailles sur un pas de temps 'thermcell_flux2' 38 real, protected :: thermals_alphamax=0.7 ! fraction max des thermiques dans 'thermcell_flux2' 36 39 37 40 ! WARNING !!! fact_epsilon is not protected. It can be modified in thermcell_plume* … … 47 50 !$OMP THREADPRIVATE(detr_min, entr_min, detr_q_coef, detr_q_power) 48 51 !$OMP THREADPRIVATE( mix0, thermals_flag_alim) 49 !$OMP THREADPRIVATE(iflag_thermals_tenv) 52 !$OMP THREADPRIVATE(thermals_fomass_max) 53 !$OMP THREADPRIVATE(thermals_alphamax) 50 54 51 55 integer, protected :: thermals_subsid_advect_more_than_one=1 52 character *6, protected :: thermals_subsid_advect_scheme = 'upwind' ! or 'center'56 character(LEN=maxlen), protected :: thermals_subsid_advect_scheme = 'upwind' ! or 'center' 53 57 54 58 !$OMP THREADPRIVATE(thermals_subsid_advect_scheme,thermals_subsid_advect_more_than_one) -
LMDZ6/trunk/libf/phylmd/lmdz_thermcell_main.F90
r5390 r5512 140 140 141 141 142 integer,save :: igout=1 143 !$OMP THREADPRIVATE(igout) 144 integer,save :: lunout1=6 145 !$OMP THREADPRIVATE(lunout1) 146 integer,save :: lev_out=10 147 !$OMP THREADPRIVATE(lev_out) 142 integer, parameter :: igout=1 143 integer, parameter :: lunout1=6 144 integer, parameter :: lev_out=10 148 145 149 146 real lambda, zf,zf2,var,vardiff,CHI … … 166 163 logical, dimension(ngrid,nlay) :: mask 167 164 168 character (len=20) :: modname='thermcell_main'165 character (len=20), parameter :: modname='thermcell_main' 169 166 character (len=80) :: abort_message 170 167 … … 191 188 sorties=.true. 192 189 IF(ngrid.NE.ngrid) THEN 193 PRINT*194 190 PRINT*,'STOP dans convadj' 195 191 PRINT*,'ngrid =',ngrid … … 240 236 ! SUBROUTINE thermcell_env(ngrid,nlay,po,pt,pu,pv,pplay, & 241 237 ! & pplev,zo,zh,zl,ztv,zthl,zu,zv,zpspsk,pqsat,lev_out) 242 ! contenu thermcell_env : call thermcell_qsat(ngrid *nlay,mask,pplev,pt,po,pqsat)238 ! contenu thermcell_env : call thermcell_qsat(ngrid, nlay,mask,pplev,pt,po,pqsat) 243 239 ! contenu thermcell_env : do ll=1,nlay 244 240 ! contenu thermcell_env : do ig=1,ngrid … … 272 268 enddo 273 269 enddo 274 call thermcell_qsat(ngrid *nlay,mask,pplev,ptemp_env,p_o,zqsat)270 call thermcell_qsat(ngrid, nlay, mask,pplev,ptemp_env,p_o,zqsat) 275 271 276 272 endif -
LMDZ6/trunk/libf/phylmd/lmdz_thermcell_plume.f90
r5434 r5512 218 218 219 219 ztemp(:)=zpspsk(:,l)*ztla(:,l-1) 220 call thermcell_qsat(ngrid, active,pplev(:,l),ztemp,zqta(:,l-1),zqsat(:))220 call thermcell_qsat(ngrid, 1, active,pplev(:,l),ztemp,zqta(:,l-1),zqsat(:)) 221 221 do ig=1,ngrid 222 222 ! print*,'active',active(ig),ig,l … … 351 351 352 352 ztemp(:)=zpspsk(:,l)*ztla(:,l) 353 call thermcell_qsat(ngrid, activetmp,pplev(:,l),ztemp,zqta(:,l),zqsatth(:,l))353 call thermcell_qsat(ngrid, 1, activetmp,pplev(:,l),ztemp,zqta(:,l),zqsatth(:,l)) 354 354 do ig=1,ngrid 355 355 if (activetmp(ig)) then -
LMDZ6/trunk/libf/phylmd/lmdz_thermcell_plume_6A.f90
r5434 r5512 216 216 217 217 ztemp(:)=zpspsk(:,l)*ztla(:,l-1) 218 call thermcell_qsat(ngrid, active,pplev(:,l),ztemp,zqta(:,l-1),zqsat(:))218 call thermcell_qsat(ngrid, 1, active,pplev(:,l),ztemp,zqta(:,l-1),zqsat(:)) 219 219 do ig=1,ngrid 220 220 ! print*,'active',active(ig),ig,l … … 556 556 557 557 ztemp(:)=zpspsk(:,l)*ztla(:,l) 558 call thermcell_qsat(ngrid, activetmp,pplev(:,l),ztemp,zqta(:,l),zqsatth(:,l))558 call thermcell_qsat(ngrid, 1, activetmp,pplev(:,l),ztemp,zqta(:,l),zqsatth(:,l)) 559 559 do ig=1,ngrid 560 560 if (activetmp(ig)) then … … 917 917 918 918 ztemp(:)=zpspsk(:,l)*ztla(:,l-1) 919 call thermcell_qsat(ngrid, active,pplev(:,l),ztemp,zqta(:,l-1),zqsat(:))919 call thermcell_qsat(ngrid, 1, active,pplev(:,l),ztemp,zqta(:,l-1),zqsat(:)) 920 920 921 921 do ig=1,ngrid … … 1005 1005 1006 1006 ztemp(:)=zpspsk(:,l)*ztla(:,l) 1007 call thermcell_qsat(ngrid, activetmp,pplev(:,l),ztemp,zqta(:,l),zqsatth(:,l))1007 call thermcell_qsat(ngrid, 1, activetmp,pplev(:,l),ztemp,zqta(:,l),zqsatth(:,l)) 1008 1008 1009 1009 do ig=1,ngrid -
LMDZ6/trunk/libf/phylmd/lmdz_thermcell_qsat.f90
r5390 r5512 1 1 MODULE lmdz_thermcell_qsat 2 3 REAL, PARAMETER :: DDT0=.01 4 2 5 CONTAINS 3 6 4 subroutine thermcell_qsat(klon, active,pplev,ztemp,zqta,zqsat)7 subroutine thermcell_qsat(klon, nlev, active,pplev,ztemp,zqta,zqsat) 5 8 USE yoethf_mod_h 6 9 USE yomcst_mod_h 10 11 7 12 implicit none 8 13 … … 16 21 17 22 ! Arguments 18 INTEGER klon 19 REAL zpspsk(klon),pplev(klon) 20 REAL ztemp(klon),zqta(klon),zqsat(klon) 21 LOGICAL active(klon) 23 INTEGER, INTENT(IN) :: klon 24 INTEGER, INTENT(IN) :: nlev ! number of vertical to apply qsat 25 REAL zpspsk(klon, nlev),pplev(klon, nlev) 26 REAL ztemp(klon, nlev),zqta(klon,nlev),zqsat(klon,nlev) 27 LOGICAL active(klon, nlev) 22 28 23 29 ! Variables locales 24 30 INTEGER ig,iter 25 REAL Tbef(klon ),DT(klon)31 REAL Tbef(klon,nlev),DT(klon,nlev) 26 32 REAL tdelta,qsatbef,zcor,qlbef,zdelta,zcvm5,dqsat,num,denom,dqsat_dT 27 33 logical Zsat 28 34 REAL RLvCp 29 35 30 REAL, SAVE :: DDT0=.01 31 !$OMP THREADPRIVATE(DDT0) 32 33 LOGICAL afaire(klon),tout_converge 34 36 LOGICAL afaire(klon, nlev),tout_converge 37 INTEGER :: l 35 38 !==================================================================== 36 39 ! INITIALISATIONS … … 39 42 RLvCp = RLVTT/RCPD 40 43 tout_converge=.false. 41 afaire(: )=.false.42 DT(: )=0.44 afaire(:,:)=.false. 45 DT(:,:)=0. 43 46 44 47 … … 48 51 ! converge= false des que la convergence est atteinte. 49 52 !==================================================================== 50 51 do ig=1,klon52 if (active(ig)) then53 Tbef(ig )=ztemp(ig)54 zdelta=MAX(0.,SIGN(1.,RTT-Tbef(ig )))55 qsatbef= R2ES * FOEEW(Tbef(ig ),zdelta)/pplev(ig)53 do l=1,nlev 54 do ig=1,klon 55 if (active(ig,l)) then 56 Tbef(ig,l)=ztemp(ig,l) 57 zdelta=MAX(0.,SIGN(1.,RTT-Tbef(ig,l))) 58 qsatbef= R2ES * FOEEW(Tbef(ig,l),zdelta)/pplev(ig,l) 56 59 qsatbef=MIN(0.5,qsatbef) 57 60 zcor=1./(1.-retv*qsatbef) 58 61 qsatbef=qsatbef*zcor 59 qlbef=max(0.,zqta(ig )-qsatbef)62 qlbef=max(0.,zqta(ig,l)-qsatbef) 60 63 DT(ig) = 0.5*RLvCp*qlbef 61 zqsat(ig )=qsatbef64 zqsat(ig,l)=qsatbef 62 65 endif 66 enddo 63 67 enddo 64 65 68 ! Traitement du cas ou il y a condensation mais faible 66 69 ! On ne condense pas mais on dit que le qsat est le qta 67 do ig=1,klon 68 if (active(ig)) then 69 if (0.<abs(DT(ig)).and.abs(DT(ig))<=DDT0) then 70 zqsat(ig)=zqta(ig) 71 endif 72 endif 70 do l=1,nlev 71 do ig=1,klon 72 if (active(ig,l)) then 73 if (0.<abs(DT(ig,l)).and.abs(DT(ig,l))<=DDT0) then 74 zqsat(ig,l)=zqta(ig,l) 75 endif 76 endif 77 enddo 73 78 enddo 74 79 75 80 do iter=1,10 76 afaire(:)=abs(DT(:)).gt.DDT0 77 do ig=1,klon 78 if (afaire(ig)) then 79 Tbef(ig)=Tbef(ig)+DT(ig) 80 zdelta=MAX(0.,SIGN(1.,RTT-Tbef(ig))) 81 qsatbef= R2ES * FOEEW(Tbef(ig),zdelta)/pplev(ig) 81 do l=1,nlev 82 afaire(:,l)=abs(DT(:,l)).gt.DDT0 83 do ig=1,klon 84 if (afaire(ig,l)) then 85 Tbef(ig,l)=Tbef(ig,l)+DT(ig,l) 86 zdelta=MAX(0.,SIGN(1.,RTT-Tbef(ig,l))) 87 qsatbef= R2ES * FOEEW(Tbef(ig,l),zdelta)/pplev(ig,l) 82 88 qsatbef=MIN(0.5,qsatbef) 83 89 zcor=1./(1.-retv*qsatbef) 84 90 qsatbef=qsatbef*zcor 85 qlbef=zqta(ig )-qsatbef86 zdelta=MAX(0.,SIGN(1.,RTT-Tbef(ig )))91 qlbef=zqta(ig,l)-qsatbef 92 zdelta=MAX(0.,SIGN(1.,RTT-Tbef(ig,l))) 87 93 zcvm5=R5LES*(1.-zdelta) + R5IES*zdelta 88 94 zcor=1./(1.-retv*qsatbef) 89 dqsat_dT=FOEDE(Tbef(ig ),zdelta,zcvm5,qsatbef,zcor)90 num=-Tbef(ig )+ztemp(ig)+RLvCp*qlbef95 dqsat_dT=FOEDE(Tbef(ig,l),zdelta,zcvm5,qsatbef,zcor) 96 num=-Tbef(ig,l)+ztemp(ig,l)+RLvCp*qlbef 91 97 denom=1.+RLvCp*dqsat_dT 92 zqsat(ig ) = qsatbef93 DT(ig )=num/denom98 zqsat(ig,l) = qsatbef 99 DT(ig,l)=num/denom 94 100 endif 101 enddo 95 102 enddo 96 103 enddo -
LMDZ6/trunk/libf/phylmd/phys_local_var_mod.F90
r5491 r5512 928 928 ALLOCATE(dv_gwd_rando(klon,klev),dv_gwd_front(klon,klev)) 929 929 ALLOCATE(east_gwstress(klon,klev),west_gwstress(klon,klev)) 930 east_gwstress(:,:)=0 !ym missing init931 west_gwstress(:,:)=0 !ym missing init930 east_gwstress(:,:)=0. !ym missing init 931 west_gwstress(:,:)=0. !ym missing init 932 932 ALLOCATE(d_t_hin(klon,klev)) 933 933 ALLOCATE(d_q_ch4(klon,klev)) -
LMDZ6/trunk/libf/phylmd/physiq_mod.F90
r5506 r5512 20 20 ! PLEASE try to follow this rule 21 21 22 USE ACAMA_GWD_rando_m, only: ACAMA_GWD_rando 22 USE ACAMA_GWD_rando_m, only: ACAMA_GWD_rando, ACAMA_GWD_rando_first 23 23 USE aero_mod 24 24 USE add_phys_tend_mod, only : add_pbl_tend, add_phys_tend, diag_phys_tend, prt_enerbil, & … … 32 32 USE dimphy 33 33 USE etat0_limit_unstruct_mod 34 USE FLOTT_GWD_rando_m, only: FLOTT_GWD_rando 34 USE FLOTT_GWD_rando_m, only: FLOTT_GWD_rando, FLOTT_GWD_rando_first 35 35 USE fonte_neige_mod, ONLY : fonte_neige_get_vars 36 36 USE geometry_mod, ONLY: cell_area, latitude_deg, longitude_deg … … 86 86 USE lmdz_atke_turbulence_ini, ONLY : atke_ini 87 87 USE lmdz_thermcell_ini, ONLY : thermcell_ini, iflag_thermals_tenv 88 USE calltherm_mod, ONLY : calltherm 88 89 USE lmdz_thermcell_dtke, ONLY : thermcell_dtke 89 90 USE lmdz_blowing_snow_ini, ONLY : blowing_snow_ini , qbst_bs … … 3688 3689 ENDIF 3689 3690 !>jyg 3690 CALL calltherm( pdtphys &3691 CALL calltherm(itap, pdtphys & 3691 3692 ,pplay,paprs,pphi,weak_inversion & 3692 3693 ! ,u_seri,v_seri,t_seri,q_seri,zqsat,debut & !jyg … … 4969 4970 IF (.not. ok_hines .and. ok_gwd_rando) then 4970 4971 ! ym missing init for east_gwstress & west_gwstress -> added in phys_local_var_mod 4972 CALL acama_GWD_rando_first() 4971 4973 CALL acama_GWD_rando(PHYS_TSTEP, pplay, latitude_deg, t_seri, u_seri, & 4972 4974 v_seri, rot, zustr_gwd_front, zvstr_gwd_front, du_gwd_front, & … … 4987 4989 4988 4990 IF (ok_gwd_rando) THEN 4991 CALL FLOTT_GWD_rando_first() 4989 4992 CALL FLOTT_GWD_rando(PHYS_TSTEP, pplay, t_seri, u_seri, v_seri, & 4990 4993 rain_fall + snow_fall, zustr_gwd_rando, zvstr_gwd_rando, &
Note: See TracChangeset
for help on using the changeset viewer.