[161] | 1 | ! |
---|
| 2 | ! AC 2011-01-05 |
---|
| 3 | ! |
---|
[695] | 4 | SUBROUTINE calltherm_interface (firstcall, & |
---|
[652] | 5 | & zzlev,zzlay, & |
---|
[161] | 6 | & ptimestep,pu,pv,pt,pq,pdu,pdv,pdt,pdq,q2, & |
---|
[185] | 7 | & pplay,pplev,pphi,zpopsk, & |
---|
[660] | 8 | & pdu_th,pdv_th,pdt_th,pdq_th,lmax,zmaxth,pbl_dtke, & |
---|
| 9 | & pdhdif,hfmax,wstar,sensibFlux) |
---|
[161] | 10 | |
---|
[342] | 11 | USE ioipsl_getincom |
---|
[161] | 12 | |
---|
| 13 | implicit none |
---|
| 14 | #include "callkeys.h" |
---|
[185] | 15 | #include "dimensions.h" |
---|
| 16 | #include "dimphys.h" |
---|
[342] | 17 | #include "comcstfi.h" |
---|
[508] | 18 | #include "tracer.h" |
---|
[185] | 19 | |
---|
[161] | 20 | !-------------------------------------------------------- |
---|
[342] | 21 | ! Input Variables |
---|
[161] | 22 | !-------------------------------------------------------- |
---|
| 23 | |
---|
[652] | 24 | ! REAL, INTENT(IN) :: long(ngridmx),lati(ngridmx) |
---|
[161] | 25 | REAL, INTENT(IN) :: ptimestep |
---|
[695] | 26 | REAL, INTENT(IN) :: pplev(ngridmx,nlayermx+1) |
---|
| 27 | REAL, INTENT(IN) :: pplay(ngridmx,nlayermx) |
---|
[185] | 28 | REAL, INTENT(IN) :: pphi(ngridmx,nlayermx) |
---|
| 29 | REAL, INTENT(IN) :: pu(ngridmx,nlayermx),pv(ngridmx,nlayermx) |
---|
| 30 | REAL, INTENT(IN) :: pt(ngridmx,nlayermx),pq(ngridmx,nlayermx,nqmx) |
---|
| 31 | REAL, INTENT(IN) :: zzlay(ngridmx,nlayermx) |
---|
| 32 | REAL, INTENT(IN) :: zzlev(ngridmx,nlayermx+1) |
---|
[161] | 33 | LOGICAL, INTENT(IN) :: firstcall |
---|
[185] | 34 | REAL, INTENT(IN) :: pdu(ngridmx,nlayermx),pdv(ngridmx,nlayermx) |
---|
[695] | 35 | REAL, INTENT(IN) :: pdq(ngridmx,nlayermx,nqmx) |
---|
| 36 | REAL, INTENT(IN) :: pdt(ngridmx,nlayermx) |
---|
[185] | 37 | REAL, INTENT(IN) :: q2(ngridmx,nlayermx+1) |
---|
| 38 | REAL, INTENT(IN) :: zpopsk(ngridmx,nlayermx) |
---|
[660] | 39 | REAL, INTENT(IN) :: pdhdif(ngridmx,nlayermx) |
---|
| 40 | REAL, INTENT(IN) :: sensibFlux(ngridmx) |
---|
[161] | 41 | |
---|
| 42 | !-------------------------------------------------------- |
---|
[342] | 43 | ! Output Variables |
---|
[161] | 44 | !-------------------------------------------------------- |
---|
| 45 | |
---|
[342] | 46 | REAL, INTENT(OUT) :: pdu_th(ngridmx,nlayermx) |
---|
| 47 | REAL, INTENT(OUT) :: pdv_th(ngridmx,nlayermx) |
---|
| 48 | REAL, INTENT(OUT) :: pdt_th(ngridmx,nlayermx) |
---|
| 49 | REAL, INTENT(OUT) :: pdq_th(ngridmx,nlayermx,nqmx) |
---|
| 50 | INTEGER, INTENT(OUT) :: lmax(ngridmx) |
---|
| 51 | REAL, INTENT(OUT) :: zmaxth(ngridmx) |
---|
| 52 | REAL, INTENT(OUT) :: pbl_dtke(ngridmx,nlayermx+1) |
---|
[499] | 53 | REAL, INTENT(OUT) :: wstar(ngridmx) |
---|
[161] | 54 | |
---|
| 55 | !-------------------------------------------------------- |
---|
[342] | 56 | ! Thermals local variables |
---|
[161] | 57 | !-------------------------------------------------------- |
---|
[342] | 58 | REAL zu(ngridmx,nlayermx), zv(ngridmx,nlayermx) |
---|
| 59 | REAL zt(ngridmx,nlayermx) |
---|
[185] | 60 | REAL d_t_ajs(ngridmx,nlayermx) |
---|
| 61 | REAL d_u_ajs(ngridmx,nlayermx), d_q_ajs(ngridmx,nlayermx,nqmx) |
---|
| 62 | REAL d_v_ajs(ngridmx,nlayermx) |
---|
| 63 | REAL fm_therm(ngridmx,nlayermx+1), entr_therm(ngridmx,nlayermx) |
---|
[628] | 64 | REAL detr_therm(ngridmx,nlayermx),detrmod(ngridmx,nlayermx) |
---|
[185] | 65 | REAL zw2(ngridmx,nlayermx+1) |
---|
[512] | 66 | REAL fraca(ngridmx,nlayermx+1),zfraca(ngridmx,nlayermx+1) |
---|
[185] | 67 | REAL ztla(ngridmx,nlayermx) |
---|
| 68 | REAL q_therm(ngridmx,nlayermx), pq_therm(ngridmx,nlayermx,nqmx) |
---|
| 69 | REAL q2_therm(ngridmx,nlayermx), dq2_therm(ngridmx,nlayermx) |
---|
[342] | 70 | REAL lmax_real(ngridmx) |
---|
| 71 | REAL masse(ngridmx,nlayermx) |
---|
[161] | 72 | LOGICAL qtransport_thermals,dtke_thermals |
---|
[660] | 73 | INTEGER l,ig,iq,ii(1),k |
---|
[628] | 74 | CHARACTER (LEN=20) modname |
---|
[161] | 75 | |
---|
[342] | 76 | !-------------------------------------------------------- |
---|
| 77 | ! Local variables for sub-timestep |
---|
| 78 | !-------------------------------------------------------- |
---|
[161] | 79 | |
---|
[342] | 80 | REAL d_t_the(ngridmx,nlayermx), d_q_the(ngridmx,nlayermx,nqmx) |
---|
| 81 | REAL d_u_the(ngridmx,nlayermx),d_v_the(ngridmx,nlayermx) |
---|
| 82 | REAL dq2_the(ngridmx,nlayermx) |
---|
[561] | 83 | INTEGER isplit |
---|
| 84 | INTEGER,SAVE :: nsplit_thermals |
---|
| 85 | REAL, SAVE :: r_aspect_thermals |
---|
[342] | 86 | REAL fact |
---|
| 87 | REAL zfm_therm(ngridmx,nlayermx+1),zdt |
---|
| 88 | REAL zentr_therm(ngridmx,nlayermx),zdetr_therm(ngridmx,nlayermx) |
---|
| 89 | REAL zheatFlux(ngridmx,nlayermx) |
---|
| 90 | REAL zheatFlux_down(ngridmx,nlayermx) |
---|
| 91 | REAL zbuoyancyOut(ngridmx,nlayermx) |
---|
| 92 | REAL zbuoyancyEst(ngridmx,nlayermx) |
---|
| 93 | REAL zzw2(ngridmx,nlayermx+1) |
---|
| 94 | REAL zmax(ngridmx) |
---|
[628] | 95 | INTEGER ndt,zlmax |
---|
[342] | 96 | |
---|
| 97 | !-------------------------------------------------------- |
---|
| 98 | ! Diagnostics |
---|
| 99 | !-------------------------------------------------------- |
---|
| 100 | |
---|
[185] | 101 | REAL heatFlux(ngridmx,nlayermx) |
---|
| 102 | REAL heatFlux_down(ngridmx,nlayermx) |
---|
| 103 | REAL buoyancyOut(ngridmx,nlayermx) |
---|
| 104 | REAL buoyancyEst(ngridmx,nlayermx) |
---|
| 105 | REAL hfmax(ngridmx),wmax(ngridmx) |
---|
[499] | 106 | REAL pbl_teta(ngridmx),dteta(ngridmx,nlayermx) |
---|
[660] | 107 | REAL rpdhd(ngridmx,nlayermx) |
---|
| 108 | REAL wtdif(ngridmx,nlayermx),rho(ngridmx,nlayermx) |
---|
| 109 | REAL wtth(ngridmx,nlayermx) |
---|
[161] | 110 | |
---|
[508] | 111 | !-------------------------------------------------------- |
---|
| 112 | ! Theta_m |
---|
| 113 | !-------------------------------------------------------- |
---|
[342] | 114 | |
---|
[508] | 115 | INTEGER ico2 |
---|
| 116 | SAVE ico2 |
---|
[342] | 117 | |
---|
[161] | 118 | ! ********************************************************************** |
---|
[342] | 119 | ! Initialization |
---|
[161] | 120 | ! ********************************************************************** |
---|
| 121 | |
---|
[621] | 122 | lmax(:)=0 |
---|
[161] | 123 | pdu_th(:,:)=0. |
---|
| 124 | pdv_th(:,:)=0. |
---|
| 125 | pdt_th(:,:)=0. |
---|
| 126 | entr_therm(:,:)=0. |
---|
| 127 | detr_therm(:,:)=0. |
---|
| 128 | q2_therm(:,:)=0. |
---|
| 129 | dq2_therm(:,:)=0. |
---|
| 130 | ztla(:,:)=0. |
---|
| 131 | pbl_dtke(:,:)=0. |
---|
| 132 | fm_therm(:,:)=0. |
---|
| 133 | zw2(:,:)=0. |
---|
| 134 | fraca(:,:)=0. |
---|
[512] | 135 | zfraca(:,:)=0. |
---|
[161] | 136 | if (tracer) then |
---|
| 137 | pdq_th(:,:,:)=0. |
---|
| 138 | end if |
---|
[342] | 139 | d_t_ajs(:,:)=0. |
---|
| 140 | d_u_ajs(:,:)=0. |
---|
| 141 | d_v_ajs(:,:)=0. |
---|
| 142 | d_q_ajs(:,:,:)=0. |
---|
| 143 | heatFlux(:,:)=0. |
---|
| 144 | heatFlux_down(:,:)=0. |
---|
| 145 | buoyancyOut(:,:)=0. |
---|
| 146 | buoyancyEst(:,:)=0. |
---|
| 147 | zmaxth(:)=0. |
---|
| 148 | lmax_real(:)=0. |
---|
[161] | 149 | |
---|
| 150 | |
---|
[342] | 151 | ! ********************************************************************** |
---|
| 152 | ! Preparing inputs for the thermals |
---|
| 153 | ! ********************************************************************** |
---|
[161] | 154 | |
---|
[342] | 155 | zu(:,:)=pu(:,:)+pdu(:,:)*ptimestep |
---|
| 156 | zv(:,:)=pv(:,:)+pdv(:,:)*ptimestep |
---|
| 157 | zt(:,:)=pt(:,:)+pdt(:,:)*ptimestep |
---|
[161] | 158 | |
---|
[342] | 159 | pq_therm(:,:,:)=0. |
---|
| 160 | qtransport_thermals=.true. !! default setting |
---|
| 161 | !call getin("qtransport_thermals",qtransport_thermals) |
---|
[161] | 162 | |
---|
[342] | 163 | if(qtransport_thermals) then |
---|
| 164 | if(tracer) then |
---|
| 165 | pq_therm(:,:,:)=pq(:,:,:)+pdq(:,:,:)*ptimestep |
---|
| 166 | endif |
---|
| 167 | endif |
---|
[161] | 168 | |
---|
[544] | 169 | dtke_thermals=.false. !! default setting |
---|
| 170 | call getin("dtke_thermals",dtke_thermals) |
---|
| 171 | IF(dtke_thermals) THEN |
---|
| 172 | DO l=1,nlayermx |
---|
| 173 | q2_therm(:,l)=0.5*(q2(:,l)+q2(:,l+1)) |
---|
| 174 | ENDDO |
---|
| 175 | ENDIF |
---|
[342] | 176 | |
---|
| 177 | ! ********************************************************************** |
---|
[508] | 178 | ! Polar night mixing : theta_m |
---|
[342] | 179 | ! ********************************************************************** |
---|
[508] | 180 | |
---|
| 181 | if(firstcall) then |
---|
| 182 | ico2=0 |
---|
| 183 | if (tracer) then |
---|
| 184 | ! Prepare Special treatment if one of the tracers is CO2 gas |
---|
| 185 | do iq=1,nqmx |
---|
| 186 | if (noms(iq).eq."co2") then |
---|
| 187 | ico2=iq |
---|
| 188 | end if |
---|
| 189 | enddo |
---|
| 190 | endif |
---|
| 191 | endif !of if firstcall |
---|
| 192 | |
---|
| 193 | |
---|
[342] | 194 | ! ********************************************************************** |
---|
[508] | 195 | ! ********************************************************************** |
---|
| 196 | ! ********************************************************************** |
---|
[342] | 197 | ! CALLTHERM |
---|
| 198 | ! ********************************************************************** |
---|
| 199 | ! ********************************************************************** |
---|
| 200 | ! ********************************************************************** |
---|
| 201 | |
---|
[561] | 202 | ! r_aspect_thermals ! Mainly control the shape of the temperature profile |
---|
| 203 | ! in the surface layer. Decreasing it goes toward |
---|
| 204 | ! a convective-adjustment like profile. |
---|
| 205 | ! nsplit_thermals ! Sub-timestep for the thermals. Very dependant on the |
---|
| 206 | ! chosen timestep for the radiative transfer. |
---|
| 207 | ! It is recommended to run with 96 timestep per day and |
---|
| 208 | ! iradia = 1., configuration in which thermals can run |
---|
| 209 | ! very well with a sub-timestep of 10. |
---|
| 210 | IF (firstcall) THEN |
---|
[342] | 211 | #ifdef MESOSCALE |
---|
[561] | 212 | !! valid for timesteps < 200s |
---|
| 213 | nsplit_thermals=4 |
---|
| 214 | r_aspect_thermals=0.7 |
---|
[342] | 215 | #else |
---|
[592] | 216 | IF ((ptimestep .le. 3699.*24./96.) .and. (iradia .eq. 1)) THEN |
---|
[561] | 217 | nsplit_thermals=10 |
---|
| 218 | ELSE |
---|
| 219 | nsplit_thermals=35 |
---|
| 220 | ENDIF |
---|
[592] | 221 | r_aspect_thermals=1. |
---|
[342] | 222 | #endif |
---|
[561] | 223 | call getin("nsplit_thermals",nsplit_thermals) |
---|
| 224 | call getin("r_aspect_thermals",r_aspect_thermals) |
---|
| 225 | ENDIF |
---|
[342] | 226 | |
---|
| 227 | ! ********************************************************************** |
---|
| 228 | ! SUB-TIMESTEP LOOP |
---|
| 229 | ! ********************************************************************** |
---|
| 230 | |
---|
| 231 | zdt=ptimestep/REAL(nsplit_thermals) |
---|
| 232 | |
---|
| 233 | DO isplit=1,nsplit_thermals |
---|
| 234 | |
---|
| 235 | ! Initialization of intermediary variables |
---|
| 236 | |
---|
[628] | 237 | ! zfm_therm(:,:)=0. !init is done inside |
---|
| 238 | ! zentr_therm(:,:)=0. |
---|
| 239 | ! zdetr_therm(:,:)=0. |
---|
| 240 | ! zheatFlux(:,:)=0. |
---|
| 241 | ! zheatFlux_down(:,:)=0. |
---|
| 242 | ! zbuoyancyOut(:,:)=0. |
---|
| 243 | ! zbuoyancyEst(:,:)=0. |
---|
[342] | 244 | zzw2(:,:)=0. |
---|
| 245 | zmax(:)=0. |
---|
[621] | 246 | lmax(:)=0 |
---|
[628] | 247 | ! d_t_the(:,:)=0. !init is done inside |
---|
| 248 | |
---|
| 249 | ! d_u_the(:,:)=0. !transported outside |
---|
| 250 | ! d_v_the(:,:)=0. |
---|
[342] | 251 | dq2_the(:,:)=0. |
---|
[628] | 252 | |
---|
| 253 | if (nqmx .ne. 0 .and. ico2 .ne. 0) then |
---|
| 254 | d_q_the(:,:,ico2)=0. |
---|
[161] | 255 | endif |
---|
| 256 | |
---|
[342] | 257 | CALL thermcell_main_mars(zdt & |
---|
| 258 | & ,pplay,pplev,pphi,zzlev,zzlay & |
---|
| 259 | & ,zu,zv,zt,pq_therm,q2_therm & |
---|
| 260 | & ,d_u_the,d_v_the,d_t_the,d_q_the,dq2_the & |
---|
| 261 | & ,zfm_therm,zentr_therm,zdetr_therm,lmax,zmax & |
---|
| 262 | & ,r_aspect_thermals & |
---|
| 263 | & ,zzw2,fraca,zpopsk & |
---|
| 264 | & ,ztla,zheatFlux,zheatFlux_down & |
---|
| 265 | & ,zbuoyancyOut,zbuoyancyEst) |
---|
[161] | 266 | |
---|
[342] | 267 | fact=1./REAL(nsplit_thermals) |
---|
[161] | 268 | |
---|
[342] | 269 | d_t_the(:,:)=d_t_the(:,:)*ptimestep*fact |
---|
[628] | 270 | ! d_u_the(:,:)=d_u_the(:,:)*ptimestep*fact |
---|
| 271 | ! d_v_the(:,:)=d_v_the(:,:)*ptimestep*fact |
---|
| 272 | dq2_the(:,:)=dq2_the(:,:)*fact |
---|
[508] | 273 | if (ico2 .ne. 0) then |
---|
[624] | 274 | d_q_the(:,:,ico2)=d_q_the(:,:,ico2)*ptimestep*fact |
---|
[508] | 275 | endif |
---|
[161] | 276 | |
---|
[628] | 277 | zmaxth(:)=zmaxth(:)+zmax(:)*fact |
---|
| 278 | lmax_real(:)=lmax_real(:)+float(lmax(:))*fact |
---|
[342] | 279 | fm_therm(:,:)=fm_therm(:,:) & |
---|
| 280 | & +zfm_therm(:,:)*fact |
---|
| 281 | entr_therm(:,:)=entr_therm(:,:) & |
---|
| 282 | & +zentr_therm(:,:)*fact |
---|
| 283 | detr_therm(:,:)=detr_therm(:,:) & |
---|
| 284 | & +zdetr_therm(:,:)*fact |
---|
[512] | 285 | zfraca(:,:)=zfraca(:,:) + fraca(:,:)*fact |
---|
[342] | 286 | |
---|
| 287 | heatFlux(:,:)=heatFlux(:,:) & |
---|
| 288 | & +zheatFlux(:,:)*fact |
---|
| 289 | heatFlux_down(:,:)=heatFlux_down(:,:) & |
---|
| 290 | & +zheatFlux_down(:,:)*fact |
---|
[508] | 291 | buoyancyOut(:,:)=buoyancyOut(:,:) & |
---|
| 292 | & +zbuoyancyOut(:,:)*fact |
---|
| 293 | buoyancyEst(:,:)=buoyancyEst(:,:) & |
---|
| 294 | & +zbuoyancyEst(:,:)*fact |
---|
[512] | 295 | |
---|
[342] | 296 | |
---|
| 297 | zw2(:,:)=zw2(:,:) + zzw2(:,:)*fact |
---|
| 298 | |
---|
| 299 | ! accumulation de la tendance |
---|
| 300 | |
---|
[624] | 301 | d_t_ajs(:,:)=d_t_ajs(:,:)+d_t_the(:,:) |
---|
[628] | 302 | ! d_u_ajs(:,:)=d_u_ajs(:,:)+d_u_the(:,:) |
---|
| 303 | ! d_v_ajs(:,:)=d_v_ajs(:,:)+d_v_the(:,:) |
---|
[508] | 304 | if (ico2 .ne. 0) then |
---|
| 305 | d_q_ajs(:,:,ico2)=d_q_ajs(:,:,ico2)+d_q_the(:,:,ico2) |
---|
| 306 | endif |
---|
[342] | 307 | ! dq2_therm(:,:)=dq2_therm(:,:)+dq2_the(:,:) |
---|
| 308 | ! incrementation des variables meteo |
---|
| 309 | |
---|
| 310 | zt(:,:) = zt(:,:) + d_t_the(:,:) |
---|
[628] | 311 | ! zu(:,:) = zu(:,:) + d_u_the(:,:) |
---|
| 312 | ! zv(:,:) = zv(:,:) + d_v_the(:,:) |
---|
[508] | 313 | if (ico2 .ne. 0) then |
---|
| 314 | pq_therm(:,:,ico2) = & |
---|
[624] | 315 | & pq_therm(:,:,ico2) + d_q_the(:,:,ico2) |
---|
[508] | 316 | endif |
---|
[342] | 317 | ! q2_therm(:,:) = q2_therm(:,:) + dq2_therm(:,:) |
---|
| 318 | |
---|
| 319 | |
---|
| 320 | ENDDO ! isplit |
---|
| 321 | !**************************************************************** |
---|
| 322 | |
---|
[621] | 323 | lmax(:)=nint(lmax_real(:)) |
---|
[628] | 324 | zlmax=MAXVAL(lmax(:))+2 |
---|
| 325 | if (zlmax .ge. nlayermx) then |
---|
| 326 | print*,'thermals have reached last layer of the model' |
---|
| 327 | print*,'this is not good !' |
---|
| 328 | endif |
---|
[621] | 329 | |
---|
[628] | 330 | |
---|
[342] | 331 | ! Now that we have computed total entrainment and detrainment, we can |
---|
| 332 | ! advect u, v, and q in thermals. (theta already advected). We can do |
---|
| 333 | ! that separatly because u,v,and q are not used in thermcell_main for |
---|
| 334 | ! any thermals-related computation : they are purely passive. |
---|
| 335 | |
---|
| 336 | ! mass of cells |
---|
| 337 | do l=1,nlayermx |
---|
| 338 | masse(:,l)=(pplev(:,l)-pplev(:,l+1))/g |
---|
| 339 | enddo |
---|
| 340 | |
---|
[628] | 341 | detrmod(:,:)=0. |
---|
| 342 | do l=1,zlmax |
---|
| 343 | do ig=1,ngridmx |
---|
| 344 | detrmod(ig,l)=fm_therm(ig,l)-fm_therm(ig,l+1) & |
---|
| 345 | & +entr_therm(ig,l) |
---|
| 346 | if (detrmod(ig,l).lt.0.) then |
---|
| 347 | entr_therm(ig,l)=entr_therm(ig,l)-detrmod(ig,l) |
---|
| 348 | detrmod(ig,l)=0. |
---|
| 349 | endif |
---|
| 350 | enddo |
---|
| 351 | enddo |
---|
| 352 | ndt=10 |
---|
| 353 | call thermcell_dqup(ngridmx,nlayermx,ptimestep & |
---|
| 354 | & ,fm_therm,entr_therm,detrmod, & |
---|
| 355 | & masse,zu,d_u_ajs,ndt,zlmax) |
---|
[342] | 356 | |
---|
[628] | 357 | call thermcell_dqup(ngridmx,nlayermx,ptimestep & |
---|
| 358 | & ,fm_therm,entr_therm,detrmod, & |
---|
| 359 | & masse,zv,d_v_ajs,ndt,zlmax) |
---|
| 360 | |
---|
[342] | 361 | if (nqmx .ne. 0.) then |
---|
| 362 | DO iq=1,nqmx |
---|
[508] | 363 | if (iq .ne. ico2) then |
---|
[342] | 364 | call thermcell_dqup(ngridmx,nlayermx,ptimestep & |
---|
[628] | 365 | & ,fm_therm,entr_therm,detrmod, & |
---|
| 366 | & masse,pq_therm(:,:,iq),d_q_ajs(:,:,iq),ndt,zlmax) |
---|
[508] | 367 | endif |
---|
[342] | 368 | ENDDO |
---|
| 369 | endif |
---|
| 370 | |
---|
[544] | 371 | if (dtke_thermals) then |
---|
[628] | 372 | detrmod(:,:)=0. |
---|
[652] | 373 | ndt=10 |
---|
[628] | 374 | do l=1,zlmax |
---|
| 375 | do ig=1,ngridmx |
---|
| 376 | detrmod(ig,l)=fm_therm(ig,l)-fm_therm(ig,l+1) & |
---|
| 377 | & +entr_therm(ig,l) |
---|
| 378 | if (detrmod(ig,l).lt.0.) then |
---|
| 379 | entr_therm(ig,l)=entr_therm(ig,l)-detrmod(ig,l) |
---|
| 380 | detrmod(ig,l)=0. |
---|
| 381 | endif |
---|
| 382 | enddo |
---|
| 383 | enddo |
---|
[544] | 384 | call thermcell_dqup(ngridmx,nlayermx,ptimestep & |
---|
[628] | 385 | & ,fm_therm,entr_therm,detrmod, & |
---|
| 386 | & masse,q2_therm,dq2_therm,ndt,zlmax) |
---|
[544] | 387 | endif |
---|
| 388 | |
---|
[342] | 389 | DO ig=1,ngridmx |
---|
| 390 | wmax(ig)=MAXVAL(zw2(ig,:)) |
---|
| 391 | ENDDO |
---|
| 392 | |
---|
| 393 | ! ********************************************************************** |
---|
| 394 | ! ********************************************************************** |
---|
| 395 | ! ********************************************************************** |
---|
| 396 | ! CALLTHERM END |
---|
| 397 | ! ********************************************************************** |
---|
| 398 | ! ********************************************************************** |
---|
| 399 | ! ********************************************************************** |
---|
| 400 | |
---|
| 401 | |
---|
| 402 | ! ********************************************************************** |
---|
| 403 | ! Preparing outputs |
---|
| 404 | ! ********************************************************************** |
---|
| 405 | |
---|
[628] | 406 | do l=1,zlmax |
---|
| 407 | pdu_th(:,l)=d_u_ajs(:,l) |
---|
| 408 | pdv_th(:,l)=d_v_ajs(:,l) |
---|
| 409 | enddo |
---|
[342] | 410 | |
---|
[161] | 411 | if(qtransport_thermals) then |
---|
[342] | 412 | if(tracer) then |
---|
[625] | 413 | do iq=1,nqmx |
---|
| 414 | if (iq .ne. ico2) then |
---|
[628] | 415 | do l=1,zlmax |
---|
| 416 | pdq_th(:,l,iq)=d_q_ajs(:,l,iq) |
---|
| 417 | enddo |
---|
[625] | 418 | else |
---|
[628] | 419 | do l=1,zlmax |
---|
| 420 | pdq_th(:,l,iq)=d_q_ajs(:,l,iq)/ptimestep |
---|
| 421 | enddo |
---|
[625] | 422 | endif |
---|
| 423 | enddo |
---|
[342] | 424 | endif |
---|
[161] | 425 | endif |
---|
| 426 | |
---|
[544] | 427 | IF(dtke_thermals) THEN |
---|
| 428 | DO l=2,nlayermx |
---|
| 429 | pbl_dtke(:,l)=0.5*(dq2_therm(:,l-1)+dq2_therm(:,l)) |
---|
| 430 | ENDDO |
---|
| 431 | |
---|
| 432 | pbl_dtke(:,1)=0.5*dq2_therm(:,1) |
---|
| 433 | pbl_dtke(:,nlayermx+1)=0. |
---|
| 434 | ENDIF |
---|
[161] | 435 | |
---|
[628] | 436 | do l=1,zlmax |
---|
| 437 | pdt_th(:,l)=d_t_ajs(:,l)/ptimestep |
---|
| 438 | enddo |
---|
[342] | 439 | |
---|
[499] | 440 | |
---|
[342] | 441 | ! ********************************************************************** |
---|
[499] | 442 | ! Compute the free convection velocity scale for vdifc |
---|
| 443 | ! ********************************************************************** |
---|
| 444 | |
---|
| 445 | |
---|
| 446 | ! Potential temperature gradient |
---|
| 447 | |
---|
| 448 | dteta(:,nlayermx)=0. |
---|
| 449 | DO l=1,nlayermx-1 |
---|
| 450 | DO ig=1, ngridmx |
---|
| 451 | dteta(ig,l) = ((zt(ig,l+1)-zt(ig,l))/zpopsk(ig,l)) & |
---|
| 452 | & /(zzlay(ig,l+1)-zzlay(ig,l)) |
---|
| 453 | ENDDO |
---|
| 454 | ENDDO |
---|
| 455 | |
---|
| 456 | ! Computation of the pbl mixed layer temperature |
---|
| 457 | |
---|
| 458 | DO ig=1, ngridmx |
---|
| 459 | ii=MINLOC(abs(dteta(ig,1:lmax(ig)))) |
---|
| 460 | pbl_teta(ig) = zt(ig,ii(1))/zpopsk(ig,ii(1)) |
---|
| 461 | ENDDO |
---|
| 462 | |
---|
[660] | 463 | ! we must add the heat flux from the diffusion scheme to hfmax |
---|
| 464 | |
---|
| 465 | ! compute rho as it is after the diffusion |
---|
| 466 | |
---|
| 467 | rho(:,:)=pplay(:,:) & |
---|
| 468 | & /(r*(pt(:,:)+pdhdif(:,:)*zpopsk(:,:)*ptimestep)) |
---|
| 469 | |
---|
| 470 | ! integrate -rho*pdhdif |
---|
| 471 | |
---|
| 472 | rpdhd(:,:)=0. |
---|
| 473 | |
---|
| 474 | DO ig=1,ngridmx |
---|
| 475 | DO l=1,lmax(ig) |
---|
| 476 | rpdhd(ig,l)=0. |
---|
| 477 | DO k=1,l |
---|
| 478 | rpdhd(ig,l)=rpdhd(ig,l)-rho(ig,k)*pdhdif(ig,k)* & |
---|
| 479 | & (zzlev(ig,k+1)-zzlev(ig,k)) |
---|
| 480 | ENDDO |
---|
| 481 | rpdhd(ig,l)=rpdhd(ig,l)-sensibFlux(ig)/cpp |
---|
| 482 | ENDDO |
---|
| 483 | ENDDO |
---|
| 484 | |
---|
| 485 | ! compute w'teta' from diffusion |
---|
| 486 | |
---|
| 487 | wtdif(:,:)=rpdhd(:,:)/rho(:,:) |
---|
| 488 | |
---|
| 489 | ! compute rho as it is after the thermals |
---|
| 490 | |
---|
| 491 | rho(:,:)=pplay(:,:)/(r*(zt(:,:))) |
---|
| 492 | ! integrate -rho*pdhdif |
---|
| 493 | |
---|
| 494 | DO ig=1,ngridmx |
---|
| 495 | DO l=1,lmax(ig) |
---|
| 496 | rpdhd(ig,l)=0. |
---|
| 497 | DO k=1,l |
---|
| 498 | rpdhd(ig,l)=rpdhd(ig,l)-rho(ig,k)*(pdt_th(ig,k)/zpopsk(ig,k))* & |
---|
| 499 | & (zzlev(ig,k+1)-zzlev(ig,k)) |
---|
| 500 | ENDDO |
---|
| 501 | rpdhd(ig,l)=rpdhd(ig,l)+ & |
---|
| 502 | & rho(ig,1)*(heatFlux(ig,1)+heatFlux_down(ig,1)) |
---|
| 503 | ENDDO |
---|
| 504 | ENDDO |
---|
| 505 | rpdhd(:,nlayermx)=0. |
---|
| 506 | |
---|
| 507 | ! compute w'teta' from thermals |
---|
| 508 | |
---|
| 509 | wtth(:,:)=rpdhd(:,:)/rho(:,:) |
---|
| 510 | |
---|
| 511 | ! We get the max heat flux from thermals and add the contribution from the diffusion |
---|
| 512 | |
---|
| 513 | DO ig=1,ngridmx |
---|
| 514 | hfmax(ig)=MAXVAL(wtth(ig,:)+wtdif(ig,:)) |
---|
| 515 | ENDDO |
---|
[499] | 516 | ! We follow Spiga et. al 2010 (QJRMS) |
---|
| 517 | ! ------------ |
---|
| 518 | |
---|
| 519 | DO ig=1, ngridmx |
---|
| 520 | IF (zmax(ig) .gt. 0.) THEN |
---|
| 521 | wstar(ig)=(g*zmaxth(ig)*hfmax(ig)/pbl_teta(ig))**(1./3.) |
---|
| 522 | ELSE |
---|
| 523 | wstar(ig)=0. |
---|
| 524 | ENDIF |
---|
| 525 | ENDDO |
---|
| 526 | |
---|
| 527 | |
---|
| 528 | |
---|
| 529 | ! ********************************************************************** |
---|
[342] | 530 | ! Diagnostics |
---|
| 531 | ! ********************************************************************** |
---|
[161] | 532 | |
---|
| 533 | if(outptherm) then |
---|
[185] | 534 | if (ngridmx .eq. 1) then |
---|
| 535 | call WRITEDIAGFI(ngridmx,'entr_therm','entrainement thermique',& |
---|
[161] | 536 | & 'kg/m-2',1,entr_therm) |
---|
[185] | 537 | call WRITEDIAGFI(ngridmx,'detr_therm','detrainement thermique',& |
---|
[161] | 538 | & 'kg/m-2',1,detr_therm) |
---|
[185] | 539 | call WRITEDIAGFI(ngridmx,'fm_therm','flux masse thermique',& |
---|
[161] | 540 | & 'kg/m-2',1,fm_therm) |
---|
[185] | 541 | call WRITEDIAGFI(ngridmx,'zw2','vitesse verticale thermique',& |
---|
[161] | 542 | & 'm/s',1,zw2) |
---|
[185] | 543 | call WRITEDIAGFI(ngridmx,'heatFlux_up','heatFlux_updraft',& |
---|
[161] | 544 | & 'SI',1,heatFlux) |
---|
[185] | 545 | call WRITEDIAGFI(ngridmx,'heatFlux_down','heatFlux_downdraft',& |
---|
[161] | 546 | & 'SI',1,heatFlux_down) |
---|
[185] | 547 | call WRITEDIAGFI(ngridmx,'fraca','fraction coverage',& |
---|
[161] | 548 | & 'percent',1,fraca) |
---|
[185] | 549 | call WRITEDIAGFI(ngridmx,'buoyancyOut','buoyancyOut',& |
---|
[161] | 550 | & 'm.s-2',1,buoyancyOut) |
---|
[185] | 551 | call WRITEDIAGFI(ngridmx,'buoyancyEst','buoyancyEst',& |
---|
[161] | 552 | & 'm.s-2',1,buoyancyEst) |
---|
[185] | 553 | call WRITEDIAGFI(ngridmx,'d_t_th', & |
---|
[161] | 554 | & 'tendance temp TH','K',1,d_t_ajs) |
---|
[619] | 555 | call WRITEDIAGFI(ngridmx,'d_q_th', & |
---|
| 556 | & 'tendance traceur TH','kg/kg',1,d_q_ajs) |
---|
[185] | 557 | call WRITEDIAGFI(ngridmx,'zmax', & |
---|
[342] | 558 | & 'pbl height','m',0,zmaxth) |
---|
[624] | 559 | call WRITEDIAGFI(ngridmx,'d_u_th', & |
---|
| 560 | & 'tendance moment','m/s',1,pdu_th) |
---|
[660] | 561 | call WRITEDIAGFI(ngridmx,'wtdif', & |
---|
| 562 | & 'heat flux from diffusion','K.m/s',1,wtdif) |
---|
| 563 | call WRITEDIAGFI(ngridmx,'wtth', & |
---|
| 564 | & 'heat flux from thermals','K.m/s',1,wtth) |
---|
| 565 | call WRITEDIAGFI(ngridmx,'wttot', & |
---|
| 566 | & 'heat flux PBL','K.m/s',1,wtdif(:,:)+wtth(:,:)) |
---|
| 567 | |
---|
[161] | 568 | else |
---|
| 569 | |
---|
[185] | 570 | call WRITEDIAGFI(ngridmx,'entr_therm','entrainement thermique',& |
---|
[161] | 571 | & 'kg/m-2',3,entr_therm) |
---|
[185] | 572 | call WRITEDIAGFI(ngridmx,'detr_therm','detrainement thermique',& |
---|
[161] | 573 | & 'kg/m-2',3,detr_therm) |
---|
[185] | 574 | call WRITEDIAGFI(ngridmx,'fm_therm','flux masse thermique',& |
---|
[161] | 575 | & 'kg/m-2',3,fm_therm) |
---|
[185] | 576 | call WRITEDIAGFI(ngridmx,'zw2','vitesse verticale thermique',& |
---|
[161] | 577 | & 'm/s',3,zw2) |
---|
[185] | 578 | call WRITEDIAGFI(ngridmx,'heatFlux','heatFlux',& |
---|
[161] | 579 | & 'SI',3,heatFlux) |
---|
[185] | 580 | call WRITEDIAGFI(ngridmx,'buoyancyOut','buoyancyOut',& |
---|
[161] | 581 | & 'SI',3,buoyancyOut) |
---|
[185] | 582 | call WRITEDIAGFI(ngridmx,'d_t_th', & |
---|
[161] | 583 | & 'tendance temp TH','K',3,d_t_ajs) |
---|
| 584 | |
---|
| 585 | endif |
---|
| 586 | endif |
---|
| 587 | |
---|
| 588 | END |
---|