[3531] | 1 | ! |
---|
| 2 | ! $Id: alpale_th.f90 5390 2024-12-05 16:09:25Z aborella $ |
---|
| 3 | ! |
---|
[2558] | 4 | SUBROUTINE alpale_th ( dtime, lmax_th, t_seri, cell_area, & |
---|
[4843] | 5 | cin, s2, n2, strig, & |
---|
[2513] | 6 | ale_bl_trig, ale_bl_stat, ale_bl, & |
---|
[2556] | 7 | alp_bl, alp_bl_stat, & |
---|
[3209] | 8 | proba_notrig, random_notrig, birth_rate) |
---|
[2513] | 9 | |
---|
| 10 | ! ************************************************************** |
---|
| 11 | ! * |
---|
| 12 | ! ALPALE_TH * |
---|
| 13 | ! * |
---|
| 14 | ! * |
---|
| 15 | ! written by : Jean-Yves Grandpeix, 11/05/2016 * |
---|
| 16 | ! modified by : * |
---|
| 17 | ! ************************************************************** |
---|
| 18 | |
---|
| 19 | USE dimphy |
---|
| 20 | USE ioipsl_getin_p_mod, ONLY : getin_p |
---|
| 21 | USE print_control_mod, ONLY: mydebug=>debug , lunout, prt_level |
---|
[5284] | 22 | USE alpale_mod |
---|
[2513] | 23 | IMPLICIT NONE |
---|
| 24 | |
---|
| 25 | !================================================================ |
---|
| 26 | ! Auteur(s) : Jean-Yves Grandpeix, 11/05/2016 |
---|
| 27 | ! Objet : Contribution of the thermal scheme to Ale and Alp |
---|
| 28 | !================================================================ |
---|
| 29 | |
---|
| 30 | ! Input arguments |
---|
| 31 | !---------------- |
---|
| 32 | REAL, INTENT(IN) :: dtime |
---|
[2558] | 33 | REAL, DIMENSION(klon), INTENT(IN) :: cell_area |
---|
[2513] | 34 | INTEGER, DIMENSION(klon), INTENT(IN) :: lmax_th |
---|
| 35 | REAL, DIMENSION(klon,klev), INTENT(IN) :: t_seri |
---|
| 36 | REAL, DIMENSION(klon), INTENT(IN) :: ale_bl_stat |
---|
| 37 | REAL, DIMENSION(klon), INTENT(IN) :: cin |
---|
[4843] | 38 | REAL, DIMENSION(klon), INTENT(IN) :: s2, n2, strig |
---|
[2513] | 39 | |
---|
| 40 | REAL, DIMENSION(klon), INTENT(INOUT) :: ale_bl_trig, ale_bl |
---|
| 41 | REAL, DIMENSION(klon), INTENT(INOUT) :: alp_bl |
---|
| 42 | REAL, DIMENSION(klon), INTENT(INOUT) :: alp_bl_stat |
---|
[2730] | 43 | REAL, DIMENSION(klon), INTENT(INOUT) :: proba_notrig |
---|
[2513] | 44 | |
---|
[2730] | 45 | REAL, DIMENSION(klon), INTENT(OUT) :: random_notrig |
---|
[2556] | 46 | |
---|
[3208] | 47 | REAL, DIMENSION(klon), INTENT(OUT) :: birth_rate |
---|
| 48 | |
---|
[2513] | 49 | ! Local variables |
---|
| 50 | !---------------- |
---|
| 51 | INTEGER :: i |
---|
| 52 | LOGICAL, SAVE :: first = .TRUE. |
---|
[4826] | 53 | LOGICAL, SAVE :: multiply_proba_notrig = .FALSE. |
---|
[2513] | 54 | REAL, SAVE :: random_notrig_max=1. |
---|
[2558] | 55 | REAL, SAVE :: cv_feed_area |
---|
| 56 | REAL :: birth_number |
---|
| 57 | REAL, DIMENSION(klon) :: ale_bl_ref |
---|
[2556] | 58 | REAL, DIMENSION(klon) :: tau_trig |
---|
[2513] | 59 | ! |
---|
[4826] | 60 | !$OMP THREADPRIVATE(multiply_proba_notrig) |
---|
[2513] | 61 | !$OMP THREADPRIVATE(random_notrig_max) |
---|
[2558] | 62 | !$OMP THREADPRIVATE(cv_feed_area) |
---|
[2513] | 63 | !$OMP THREADPRIVATE(first) |
---|
| 64 | ! |
---|
[2558] | 65 | REAL umexp ! expression of (1.-exp(-x))/x valid for all x, especially when x->0 |
---|
| 66 | REAL x |
---|
[4826] | 67 | ! |
---|
[3531] | 68 | CHARACTER (LEN=20) :: modname='alpale_th' |
---|
| 69 | CHARACTER (LEN=80) :: abort_message |
---|
| 70 | |
---|
[2558] | 71 | umexp(x) = max(sign(1.,x-1.e-3),0.)*(1.-exp(-x))/max(x,1.e-3) + & |
---|
[3073] | 72 | (1.-max(sign(1.,x-1.e-3),0.))*(1.-0.5*x*(1.-x/3.*(1.-0.25*x))) !!! correct formula (jyg) |
---|
| 73 | !!! (1.-max(sign(1.,x-1.e-3),0.))*(-0.5*x*(1.-x/3.*(1.-0.25*x))) !!! bug introduced by mistake (jyg) |
---|
| 74 | !!! (1.-max(sign(1.,x-1.e-3),0.))*(1.-0.5*x*(1.-x/3.*(1.-0.25*x))) !!! initial correct formula (jyg) |
---|
[2558] | 75 | ! |
---|
| 76 | !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
---|
| 77 | ! JYG, 20160513 : Introduction of the Effective Lifting Power (ELP), which |
---|
| 78 | ! takes into account the area (cv_feed_area) covered by thermals contributing |
---|
| 79 | ! to each cumulonimbus. |
---|
| 80 | ! The use of ELP prevents singularities when the trigger probability tends to |
---|
| 81 | ! zero. It is activated by iflag_clos_bl = 3. |
---|
| 82 | ! The ELP values are stored in the ALP_bl variable. |
---|
| 83 | ! |
---|
| 84 | !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
---|
| 85 | ! |
---|
[4826] | 86 | |
---|
| 87 | IF (first) THEN |
---|
| 88 | CALL getin_p('multiply_proba_notrig',multiply_proba_notrig) |
---|
| 89 | IF (iflag_clos_bl .LT. 3) THEN |
---|
| 90 | random_notrig_max=1. |
---|
| 91 | CALL getin_p('random_notrig_max',random_notrig_max) |
---|
| 92 | ELSEIF (iflag_clos_bl .EQ. 3) THEN ! (iflag_clos_bl .LT. 3) |
---|
| 93 | cv_feed_area = 1.e10 ! m2 |
---|
| 94 | CALL getin_p('cv_feed_area', cv_feed_area) |
---|
| 95 | ENDIF !! (iflag_clos_bl .LT. 3) |
---|
| 96 | first=.FALSE. |
---|
| 97 | ENDIF |
---|
| 98 | |
---|
[2730] | 99 | !! |
---|
[4827] | 100 | !! Control of the multiplication of no-trigger probabilities between calls |
---|
| 101 | !! to the convection scheme. If multiply_proba_notrig is .false., then |
---|
| 102 | !! proba_notrig is set to 1 at each call to alpale_th, so that only the last call |
---|
| 103 | !! plays a role in the triggering of convection. If it is .true., then propa_notrig |
---|
| 104 | !! is saved between calls to convection and is reset to 1 only after calling the |
---|
| 105 | !! convection scheme. |
---|
| 106 | !! For instance, if the probability of no_trigger is 0.9 at each call, and if |
---|
| 107 | !! there are 3 calls to alpale_th between calls to the convection scheme, then the |
---|
| 108 | !! probability of triggering convection will be 0.1 (= 1.-0.9) if |
---|
| 109 | !! multiply_proba_notrig is .false. and 0.271 (= 1.-0.9^3) if multiply_proba_notrig |
---|
| 110 | !! is .true. |
---|
[2730] | 111 | !! |
---|
[4826] | 112 | IF (.NOT.multiply_proba_notrig) THEN |
---|
| 113 | DO i=1,klon |
---|
[2730] | 114 | proba_notrig(i)=1. |
---|
[4826] | 115 | ENDDO |
---|
| 116 | ENDIF !! (.NOT.multiply_proba_notrig) |
---|
[2730] | 117 | !! |
---|
| 118 | !! |
---|
[2558] | 119 | !--------------------------------------- |
---|
| 120 | IF (iflag_clos_bl .LT. 3) THEN |
---|
| 121 | !--------------------------------------- |
---|
| 122 | ! |
---|
| 123 | ! Original code (Nicolas Rochetin) |
---|
| 124 | ! -------------------------------- |
---|
[2513] | 125 | !cc nrlmd le 10/04/2012 |
---|
| 126 | !-----------Stochastic triggering----------- |
---|
| 127 | if (iflag_trig_bl.ge.1) then |
---|
| 128 | ! |
---|
| 129 | IF (prt_level .GE. 10) THEN |
---|
[3531] | 130 | WRITE(lunout,*)'cin, ale_bl_stat, alp_bl, alp_bl_stat ', & |
---|
[3208] | 131 | cin, ale_bl_stat, alp_bl, alp_bl_stat |
---|
[2513] | 132 | ENDIF |
---|
| 133 | |
---|
| 134 | |
---|
| 135 | !----Initialisations |
---|
| 136 | do i=1,klon |
---|
[2730] | 137 | !!jyg proba_notrig(i)=1. |
---|
[2513] | 138 | random_notrig(i)=1e6*ale_bl_stat(i)-int(1e6*ale_bl_stat(i)) |
---|
| 139 | if ( random_notrig(i) > random_notrig_max ) random_notrig(i)=0. |
---|
| 140 | if ( ale_bl_trig(i) .lt. abs(cin(i))+1.e-10 ) then |
---|
| 141 | tau_trig(i)=tau_trig_shallow |
---|
| 142 | else |
---|
| 143 | tau_trig(i)=tau_trig_deep |
---|
| 144 | endif |
---|
| 145 | enddo |
---|
| 146 | ! |
---|
| 147 | IF (prt_level .GE. 10) THEN |
---|
[3531] | 148 | WRITE(lunout,*)'random_notrig, tau_trig ', & |
---|
[2513] | 149 | random_notrig, tau_trig |
---|
[3531] | 150 | WRITE(lunout,*)'s_trig,s2,n2 ', & |
---|
[2513] | 151 | s_trig,s2,n2 |
---|
| 152 | ENDIF |
---|
| 153 | |
---|
| 154 | !Option pour re-activer l'ancien calcul de Ale_bl (iflag_trig_bl=2) |
---|
| 155 | IF (iflag_trig_bl.eq.1) then |
---|
| 156 | |
---|
| 157 | !----Tirage al\'eatoire et calcul de ale_bl_trig |
---|
| 158 | do i=1,klon |
---|
| 159 | if ( (ale_bl_stat(i) .gt. abs(cin(i))+1.e-10) ) then |
---|
[2730] | 160 | proba_notrig(i)=proba_notrig(i)* & |
---|
[4843] | 161 | (1.-exp(-strig(i)/s2(i)))**(n2(i)*dtime/tau_trig(i)) |
---|
[2513] | 162 | ! print *, 'proba_notrig(i) ',proba_notrig(i) |
---|
| 163 | if (random_notrig(i) .ge. proba_notrig(i)) then |
---|
| 164 | ale_bl_trig(i)=ale_bl_stat(i) |
---|
| 165 | else |
---|
| 166 | ale_bl_trig(i)=0. |
---|
| 167 | endif |
---|
[4843] | 168 | birth_rate(i) = n2(i)*exp(-strig(i)/s2(i))/(tau_trig(i)*cell_area(i)) |
---|
[3208] | 169 | !!! birth_rate(i) = max(birth_rate(i),1.e-18) |
---|
[2513] | 170 | else |
---|
[2730] | 171 | !!jyg proba_notrig(i)=1. |
---|
[3208] | 172 | birth_rate(i) = 0. |
---|
[2513] | 173 | random_notrig(i)=0. |
---|
| 174 | ale_bl_trig(i)=0. |
---|
| 175 | endif |
---|
| 176 | enddo |
---|
| 177 | |
---|
| 178 | ELSE IF (iflag_trig_bl.ge.2) then |
---|
| 179 | |
---|
| 180 | do i=1,klon |
---|
| 181 | if ( (Ale_bl(i) .gt. abs(cin(i))+1.e-10) ) then |
---|
[2730] | 182 | proba_notrig(i)=proba_notrig(i)* & |
---|
[4843] | 183 | (1.-exp(-strig(i)/s2(i)))**(n2(i)*dtime/tau_trig(i)) |
---|
[2513] | 184 | ! print *, 'proba_notrig(i) ',proba_notrig(i) |
---|
| 185 | if (random_notrig(i) .ge. proba_notrig(i)) then |
---|
| 186 | ale_bl_trig(i)=Ale_bl(i) |
---|
| 187 | else |
---|
| 188 | ale_bl_trig(i)=0. |
---|
| 189 | endif |
---|
[4843] | 190 | birth_rate(i) = n2(i)*exp(-strig(i)/s2(i))/(tau_trig(i)*cell_area(i)) |
---|
[3208] | 191 | !!! birth_rate(i) = max(birth_rate(i),1.e-18) |
---|
[2513] | 192 | else |
---|
[2730] | 193 | !!jyg proba_notrig(i)=1. |
---|
[3208] | 194 | birth_rate(i) = 0. |
---|
[2513] | 195 | random_notrig(i)=0. |
---|
| 196 | ale_bl_trig(i)=0. |
---|
| 197 | endif |
---|
| 198 | enddo |
---|
| 199 | |
---|
| 200 | ENDIF |
---|
| 201 | |
---|
| 202 | ! |
---|
| 203 | IF (prt_level .GE. 10) THEN |
---|
[3531] | 204 | WRITE(lunout,*)'proba_notrig, ale_bl_trig ', & |
---|
[2513] | 205 | proba_notrig, ale_bl_trig |
---|
| 206 | ENDIF |
---|
| 207 | |
---|
| 208 | endif !(iflag_trig_bl) |
---|
| 209 | |
---|
| 210 | !-----------Statistical closure----------- |
---|
| 211 | if (iflag_clos_bl.eq.1) then |
---|
| 212 | |
---|
| 213 | do i=1,klon |
---|
| 214 | !CR: alp probabiliste |
---|
| 215 | if (ale_bl_trig(i).gt.0.) then |
---|
| 216 | alp_bl(i)=alp_bl(i)/(1.-min(proba_notrig(i),0.999)) |
---|
| 217 | endif |
---|
| 218 | enddo |
---|
| 219 | |
---|
| 220 | else if (iflag_clos_bl.eq.2) then |
---|
| 221 | |
---|
| 222 | !CR: alp calculee dans thermcell_main |
---|
| 223 | do i=1,klon |
---|
| 224 | alp_bl(i)=alp_bl_stat(i) |
---|
| 225 | enddo |
---|
| 226 | |
---|
| 227 | else |
---|
| 228 | |
---|
| 229 | alp_bl_stat(:)=0. |
---|
| 230 | |
---|
| 231 | endif !(iflag_clos_bl) |
---|
| 232 | |
---|
[2558] | 233 | ! |
---|
| 234 | !--------------------------------------- |
---|
| 235 | ELSEIF (iflag_clos_bl .EQ. 3) THEN ! (iflag_clos_bl .LT. 3) |
---|
| 236 | !--------------------------------------- |
---|
| 237 | ! |
---|
| 238 | ! New code with Effective Lifting Power |
---|
| 239 | ! ------------------------------------- |
---|
| 240 | |
---|
| 241 | !-----------Stochastic triggering----------- |
---|
| 242 | if (iflag_trig_bl.ge.1) then |
---|
| 243 | ! |
---|
| 244 | IF (prt_level .GE. 10) THEN |
---|
[3531] | 245 | WRITE(lunout,*)'cin, ale_bl_stat, alp_bl_stat ', & |
---|
[2558] | 246 | cin, ale_bl_stat, alp_bl_stat |
---|
| 247 | ENDIF |
---|
| 248 | |
---|
| 249 | ! Use ale_bl_stat (Rochetin's code) or ale_bl (old code) according to |
---|
| 250 | ! iflag_trig_bl value. |
---|
| 251 | IF (iflag_trig_bl.eq.1) then ! use ale_bl_stat (Rochetin computation) |
---|
| 252 | do i=1,klon |
---|
| 253 | ale_bl_ref(i)=ale_bl_stat(i) |
---|
| 254 | enddo |
---|
| 255 | ELSE IF (iflag_trig_bl.ge.2) then ! use ale_bl (old computation) |
---|
| 256 | do i=1,klon |
---|
| 257 | ale_bl_ref(i)=Ale_bl(i) |
---|
| 258 | enddo |
---|
| 259 | ENDIF ! (iflag_trig_bl.eq.1) |
---|
| 260 | |
---|
| 261 | |
---|
| 262 | !----Initializations and random number generation |
---|
| 263 | do i=1,klon |
---|
[2730] | 264 | !!jyg proba_notrig(i)=1. |
---|
[2558] | 265 | random_notrig(i)=1e6*ale_bl_stat(i)-int(1e6*ale_bl_stat(i)) |
---|
| 266 | if ( ale_bl_trig(i) .lt. abs(cin(i))+1.e-10 ) then |
---|
| 267 | tau_trig(i)=tau_trig_shallow |
---|
| 268 | else |
---|
| 269 | tau_trig(i)=tau_trig_deep |
---|
| 270 | endif |
---|
| 271 | enddo |
---|
| 272 | ! |
---|
| 273 | IF (prt_level .GE. 10) THEN |
---|
[3531] | 274 | WRITE(lunout,*)'random_notrig, tau_trig ', & |
---|
[2558] | 275 | random_notrig, tau_trig |
---|
[3531] | 276 | WRITE(lunout,*)'s_trig,s2,n2 ', & |
---|
[2558] | 277 | s_trig,s2,n2 |
---|
| 278 | ENDIF |
---|
| 279 | |
---|
| 280 | !----alp_bl computation |
---|
| 281 | do i=1,klon |
---|
| 282 | if ( (ale_bl_ref(i) .gt. abs(cin(i))+1.e-10) ) then |
---|
[4843] | 283 | birth_number = n2(i)*exp(-strig(i)/s2(i)) |
---|
[2558] | 284 | birth_rate(i) = birth_number/(tau_trig(i)*cell_area(i)) |
---|
[3208] | 285 | !!! birth_rate(i) = max(birth_rate(i),1.e-18) |
---|
[2730] | 286 | proba_notrig(i)=proba_notrig(i)*exp(-birth_number*dtime/tau_trig(i)) |
---|
[2558] | 287 | Alp_bl(i) = Alp_bl(i)* & |
---|
| 288 | umexp(-birth_number*cv_feed_area/cell_area(i))/ & |
---|
| 289 | umexp(-birth_number*dtime/tau_trig(i))* & |
---|
| 290 | tau_trig(i)*cv_feed_area/(dtime*cell_area(i)) |
---|
| 291 | else |
---|
[2730] | 292 | !!jyg proba_notrig(i)=1. |
---|
[3208] | 293 | birth_rate(i)=0. |
---|
[2558] | 294 | random_notrig(i)=0. |
---|
| 295 | alp_bl(i)=0. |
---|
| 296 | endif |
---|
| 297 | enddo |
---|
| 298 | |
---|
| 299 | !----ale_bl_trig computation |
---|
| 300 | do i=1,klon |
---|
| 301 | if (random_notrig(i) .ge. proba_notrig(i)) then |
---|
| 302 | ale_bl_trig(i)=ale_bl_ref(i) |
---|
| 303 | else |
---|
| 304 | ale_bl_trig(i)=0. |
---|
| 305 | endif |
---|
| 306 | enddo |
---|
| 307 | |
---|
| 308 | ! |
---|
| 309 | IF (prt_level .GE. 10) THEN |
---|
[3531] | 310 | WRITE(lunout,*)'proba_notrig, ale_bl_trig ', & |
---|
[2558] | 311 | proba_notrig, ale_bl_trig |
---|
| 312 | ENDIF |
---|
| 313 | |
---|
| 314 | endif !(iflag_trig_bl .ge. 1) |
---|
| 315 | |
---|
| 316 | !--------------------------------------- |
---|
| 317 | ENDIF ! (iflag_clos_bl .LT. 3) |
---|
| 318 | !--------------------------------------- |
---|
| 319 | |
---|
[2513] | 320 | IF (prt_level .GE. 10) THEN |
---|
[3531] | 321 | WRITE(lunout,*)'alpale_th: ale_bl_trig, alp_bl_stat, birth_rate ', & |
---|
[3209] | 322 | ale_bl_trig(1), alp_bl_stat(1), birth_rate(1) |
---|
[2513] | 323 | ENDIF |
---|
| 324 | |
---|
| 325 | !cc fin nrlmd le 10/04/2012 |
---|
[2554] | 326 | ! |
---|
[2513] | 327 | !IM/FH: 2011/02/23 |
---|
| 328 | ! Couplage Thermiques/Emanuel seulement si T<0 |
---|
| 329 | if (iflag_coupl==2) then |
---|
| 330 | IF (prt_level .GE. 10) THEN |
---|
[3531] | 331 | WRITE(lunout,*)'Couplage Thermiques/Emanuel seulement si T<0' |
---|
[2513] | 332 | ENDIF |
---|
| 333 | do i=1,klon |
---|
| 334 | if (t_seri(i,lmax_th(i))>273.) then |
---|
| 335 | Ale_bl(i)=0. |
---|
| 336 | endif |
---|
| 337 | enddo |
---|
[3531] | 338 | ! print *,'In order to run with iflag_coupl=2, you have to comment out the following stop' |
---|
| 339 | ! STOP |
---|
| 340 | abort_message='In order to run with iflag_coupl=2, you have to comment out the following abort' |
---|
| 341 | CALL abort_physic(modname,abort_message,1) |
---|
[2513] | 342 | endif |
---|
| 343 | RETURN |
---|
[5390] | 344 | END SUBROUTINE alpale_th |
---|
[2513] | 345 | |
---|