Changeset 628
- Timestamp:
- Apr 20, 2012, 12:11:47 PM (13 years ago)
- Location:
- trunk/LMDZ.MARS/libf/phymars
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.MARS/libf/phymars/calltherm_interface.F90
r625 r628 57 57 REAL d_v_ajs(ngridmx,nlayermx) 58 58 REAL fm_therm(ngridmx,nlayermx+1), entr_therm(ngridmx,nlayermx) 59 REAL detr_therm(ngridmx,nlayermx) 59 REAL detr_therm(ngridmx,nlayermx),detrmod(ngridmx,nlayermx) 60 60 REAL zw2(ngridmx,nlayermx+1) 61 61 REAL fraca(ngridmx,nlayermx+1),zfraca(ngridmx,nlayermx+1) … … 67 67 LOGICAL qtransport_thermals,dtke_thermals 68 68 INTEGER l,ig,iq,ii(1) 69 CHARACTER (LEN=20) modname 69 70 70 71 !-------------------------------------------------------- … … 87 88 REAL zzw2(ngridmx,nlayermx+1) 88 89 REAL zmax(ngridmx) 90 INTEGER ndt,zlmax 89 91 90 92 !-------------------------------------------------------- … … 225 227 ! Initialization of intermediary variables 226 228 227 zfm_therm(:,:)=0. 228 zentr_therm(:,:)=0.229 zdetr_therm(:,:)=0.230 zheatFlux(:,:)=0. 231 zheatFlux_down(:,:)=0.232 zbuoyancyOut(:,:)=0.233 zbuoyancyEst(:,:)=0.229 ! zfm_therm(:,:)=0. !init is done inside 230 ! zentr_therm(:,:)=0. 231 ! zdetr_therm(:,:)=0. 232 ! zheatFlux(:,:)=0. 233 ! zheatFlux_down(:,:)=0. 234 ! zbuoyancyOut(:,:)=0. 235 ! zbuoyancyEst(:,:)=0. 234 236 zzw2(:,:)=0. 235 237 zmax(:)=0. 236 238 lmax(:)=0 237 d_t_the(:,:)=0. 238 d_u_the(:,:)=0. 239 d_v_the(:,:)=0. 239 ! d_t_the(:,:)=0. !init is done inside 240 241 ! d_u_the(:,:)=0. !transported outside 242 ! d_v_the(:,:)=0. 240 243 dq2_the(:,:)=0. 241 if (nqmx .ne. 0) then 242 d_q_the(:,:,:)=0. 244 245 if (nqmx .ne. 0 .and. ico2 .ne. 0) then 246 d_q_the(:,:,ico2)=0. 243 247 endif 244 248 … … 256 260 257 261 d_t_the(:,:)=d_t_the(:,:)*ptimestep*fact 258 d_u_the(:,:)=d_u_the(:,:)*ptimestep*fact259 d_v_the(:,:)=d_v_the(:,:)*ptimestep*fact260 !dq2_the(:,:)=dq2_the(:,:)*fact262 ! d_u_the(:,:)=d_u_the(:,:)*ptimestep*fact 263 ! d_v_the(:,:)=d_v_the(:,:)*ptimestep*fact 264 dq2_the(:,:)=dq2_the(:,:)*fact 261 265 if (ico2 .ne. 0) then 262 266 d_q_the(:,:,ico2)=d_q_the(:,:,ico2)*ptimestep*fact 263 267 endif 264 268 265 266 269 zmaxth(:)=zmaxth(:)+zmax(:)*fact 270 lmax_real(:)=lmax_real(:)+float(lmax(:))*fact 267 271 fm_therm(:,:)=fm_therm(:,:) & 268 272 & +zfm_therm(:,:)*fact … … 288 292 289 293 d_t_ajs(:,:)=d_t_ajs(:,:)+d_t_the(:,:) 290 d_u_ajs(:,:)=d_u_ajs(:,:)+d_u_the(:,:)291 d_v_ajs(:,:)=d_v_ajs(:,:)+d_v_the(:,:)294 ! d_u_ajs(:,:)=d_u_ajs(:,:)+d_u_the(:,:) 295 ! d_v_ajs(:,:)=d_v_ajs(:,:)+d_v_the(:,:) 292 296 if (ico2 .ne. 0) then 293 297 d_q_ajs(:,:,ico2)=d_q_ajs(:,:,ico2)+d_q_the(:,:,ico2) … … 297 301 298 302 zt(:,:) = zt(:,:) + d_t_the(:,:) 299 zu(:,:) = zu(:,:) + d_u_the(:,:)300 zv(:,:) = zv(:,:) + d_v_the(:,:)303 ! zu(:,:) = zu(:,:) + d_u_the(:,:) 304 ! zv(:,:) = zv(:,:) + d_v_the(:,:) 301 305 if (ico2 .ne. 0) then 302 306 pq_therm(:,:,ico2) = & … … 310 314 311 315 lmax(:)=nint(lmax_real(:)) 316 zlmax=MAXVAL(lmax(:))+2 317 if (zlmax .ge. nlayermx) then 318 print*,'thermals have reached last layer of the model' 319 print*,'this is not good !' 320 endif 321 312 322 313 323 ! Now that we have computed total entrainment and detrainment, we can … … 321 331 enddo 322 332 323 ! call thermcell_dqup(ngridmx,nlayermx,ptimestep & 324 ! & ,fm_therm,entr_therm, & 325 ! & masse,zu,d_u_ajs) 326 ! 327 ! call thermcell_dqup(ngridmx,nlayermx,ptimestep & 328 ! & ,fm_therm,entr_therm, & 329 ! & masse,zv,d_v_ajs) 333 detrmod(:,:)=0. 334 do l=1,zlmax 335 do ig=1,ngridmx 336 detrmod(ig,l)=fm_therm(ig,l)-fm_therm(ig,l+1) & 337 & +entr_therm(ig,l) 338 if (detrmod(ig,l).lt.0.) then 339 entr_therm(ig,l)=entr_therm(ig,l)-detrmod(ig,l) 340 detrmod(ig,l)=0. 341 endif 342 enddo 343 enddo 344 ndt=10 345 call thermcell_dqup(ngridmx,nlayermx,ptimestep & 346 & ,fm_therm,entr_therm,detrmod, & 347 & masse,zu,d_u_ajs,ndt,zlmax) 348 349 call thermcell_dqup(ngridmx,nlayermx,ptimestep & 350 & ,fm_therm,entr_therm,detrmod, & 351 & masse,zv,d_v_ajs,ndt,zlmax) 330 352 331 353 if (nqmx .ne. 0.) then … … 333 355 if (iq .ne. ico2) then 334 356 call thermcell_dqup(ngridmx,nlayermx,ptimestep & 335 & ,fm_therm,entr_therm, &336 & masse,pq_therm(:,:,iq),d_q_ajs(:,:,iq) )357 & ,fm_therm,entr_therm,detrmod, & 358 & masse,pq_therm(:,:,iq),d_q_ajs(:,:,iq),ndt,zlmax) 337 359 endif 338 360 ENDDO … … 340 362 341 363 if (dtke_thermals) then 364 detrmod(:,:)=0. 365 ndt=1 366 do l=1,zlmax 367 do ig=1,ngridmx 368 detrmod(ig,l)=fm_therm(ig,l)-fm_therm(ig,l+1) & 369 & +entr_therm(ig,l) 370 if (detrmod(ig,l).lt.0.) then 371 entr_therm(ig,l)=entr_therm(ig,l)-detrmod(ig,l) 372 detrmod(ig,l)=0. 373 endif 374 enddo 375 enddo 342 376 call thermcell_dqup(ngridmx,nlayermx,ptimestep & 343 & ,fm_therm,entr_therm, &344 & masse,q2_therm,dq2_therm )377 & ,fm_therm,entr_therm,detrmod, & 378 & masse,q2_therm,dq2_therm,ndt,zlmax) 345 379 endif 346 380 … … 363 397 ! ********************************************************************** 364 398 365 pdu_th(:,:)=d_u_ajs(:,:)/ptimestep 366 pdv_th(:,:)=d_v_ajs(:,:)/ptimestep 399 do l=1,zlmax 400 pdu_th(:,l)=d_u_ajs(:,l) 401 pdv_th(:,l)=d_v_ajs(:,l) 402 enddo 367 403 368 404 if(qtransport_thermals) then … … 370 406 do iq=1,nqmx 371 407 if (iq .ne. ico2) then 372 pdq_th(:,:,iq)=d_q_ajs(:,:,iq) 408 do l=1,zlmax 409 pdq_th(:,l,iq)=d_q_ajs(:,l,iq) 410 enddo 373 411 else 374 pdq_th(:,:,iq)=d_q_ajs(:,:,iq)/ptimestep 412 do l=1,zlmax 413 pdq_th(:,l,iq)=d_q_ajs(:,l,iq)/ptimestep 414 enddo 375 415 endif 376 416 enddo … … 387 427 ENDIF 388 428 389 pdt_th(:,:)=d_t_ajs(:,:)/ptimestep 429 do l=1,zlmax 430 pdt_th(:,l)=d_t_ajs(:,l)/ptimestep 431 enddo 390 432 391 433 -
trunk/LMDZ.MARS/libf/phymars/thermcell_dqup.F90
r621 r628 1 subroutine thermcell_dqup(ngrid,nlayer,ptimestep,fm 0,entr0, &2 & masse0,q_therm,dq_therm )1 subroutine thermcell_dqup(ngrid,nlayer,ptimestep,fm,entr,detr, & 2 & masse0,q_therm,dq_therm,ndt,zlmax) 3 3 implicit none 4 4 5 ! #include "iniprint.h"6 5 !======================================================================= 7 6 ! … … 11 10 ! Version modifiee pour prendre les downdrafts a la place de la 12 11 ! subsidence compensatoire 12 ! 13 ! Version with sub-timestep for Martian thin layers 14 ! 13 15 !======================================================================= 14 16 … … 20 22 INTEGER, INTENT(IN) :: ngrid,nlayer 21 23 REAL, INTENT(IN) :: ptimestep 22 REAL, INTENT(IN) :: fm0(ngridmx,nlayermx+1) 23 REAL, INTENT(IN) ::entr0(ngridmx,nlayermx) 24 REAL, INTENT(IN) :: fm(ngridmx,nlayermx+1) 25 REAL, INTENT(IN) :: entr(ngridmx,nlayermx) 26 REAL, INTENT(IN) :: detr(ngridmx,nlayermx) 24 27 REAL, INTENT(IN) :: q_therm(ngridmx,nlayermx) 25 28 REAL, INTENT(IN) :: masse0(ngridmx,nlayermx) 29 INTEGER, INTENT(IN) :: ndt 30 INTEGER, INTENT(IN) :: zlmax 26 31 27 32 ! ============================ OUTPUTS =========================== … … 33 38 REAL q(ngridmx,nlayermx) 34 39 REAL qa(ngridmx,nlayermx) 35 INTEGER ig,k 36 REAL detr(ngridmx,nlayermx),entr(ngridmx,nlayermx) 37 REAL wqd(ngridmx,nlayermx+1) 38 REAL zzm 40 INTEGER ig,k,i 41 REAL invflux0(ngridmx,nlayermx) 42 REAL ztimestep 39 43 40 44 ! =========== Init ============================================== … … 42 46 qa(:,:)=q_therm(:,:) 43 47 q(:,:)=q_therm(:,:) 44 entr(:,:)=entr0(:,:)45 detr(:,:)=0.46 48 47 do k=1,nlayermx 48 do ig=1,ngridmx 49 detr(ig,k)=fm0(ig,k)-fm0(ig,k+1)+entr(ig,k) 50 if (detr(ig,k).lt.0.) then 51 entr(ig,k)=entr(ig,k)-detr(ig,k) 52 detr(ig,k)=0. 53 endif 54 enddo 55 enddo 49 ! ====== Computing q ============================================ 56 50 57 ! =========== Updraft ============================================ 51 dq_therm(:,:)=0. 52 ztimestep=ptimestep/real(ndt) 53 invflux0(:,:)=ztimestep/masse0(:,:) 54 55 do i=1,ndt 58 56 59 57 do ig=1,ngrid … … 61 59 enddo 62 60 63 do k=2, nlayermx61 do k=2,zlmax 64 62 do ig=1,ngridmx 65 if ((fm 0(ig,k+1)+detr(ig,k))*ptimestep.gt. &63 if ((fm(ig,k+1)+detr(ig,k))*ptimestep.gt. & 66 64 & 1.e-5*masse0(ig,k)) then 67 qa(ig,k)=(fm 0(ig,k)*qa(ig,k-1)+entr(ig,k)*q(ig,k)) &68 & /(fm 0(ig,k+1)+detr(ig,k))65 qa(ig,k)=(fm(ig,k)*qa(ig,k-1)+entr(ig,k)*q(ig,k)) & 66 & /(fm(ig,k+1)+detr(ig,k)) 69 67 else 70 68 qa(ig,k)=q(ig,k) … … 73 71 enddo 74 72 75 ! =========== Subsidence ========================================== 76 77 do k=2,nlayermx 78 do ig=1,ngridmx 79 80 ! Schema avec advection sur plus qu'une maille. 81 zzm=masse0(ig,k)/ptimestep 82 if (fm0(ig,k)>zzm) then 83 wqd(ig,k)=(zzm*q(ig,k)+(fm0(ig,k)-zzm)*q(ig,k+1)) 84 else 85 wqd(ig,k)=fm0(ig,k)*q(ig,k) 86 endif 87 enddo 88 enddo 89 do ig=1,ngrid 90 wqd(ig,1)=0. 91 wqd(ig,nlayermx+1)=0. 73 do k=1,zlmax 74 q(:,k)=q(:,k)+ & 75 & (detr(:,k)*qa(:,k)-entr(:,k)*q(:,k) & 76 & -fm(:,k)*q(:,k)+fm(:,k+1)*q(:,k+1)) & 77 & *invflux0(:,k) 92 78 enddo 93 79 80 enddo !of do i=1,ndt 94 81 95 ! ====== dq ======================================================82 ! ====== Derivative ============================================== 96 83 97 dq_therm(:,:)=0.98 84 99 do k=1,nlayermx-1 100 q(:,k)=q(:,k)+ & 101 & (detr(:,k)*qa(:,k)-entr(:,k)*q(:,k) & 102 & -wqd(:,k)+wqd(:,k+1)) & 103 & *ptimestep/masse0(:,k) 104 enddo 105 106 do k=1,nlayermx-1 85 do k=1,zlmax 107 86 dq_therm(:,k)=(q(:,k)-q_therm(:,k))/ptimestep 108 87 enddo 109 88 89 ! ============== 90 110 91 return 111 92 end 93 -
trunk/LMDZ.MARS/libf/phymars/thermcell_main_mars.F90
r624 r628 99 99 REAL f(ngridmx) 100 100 101 REAL detrmod(ngridmx,nlayermx) 102 101 103 REAL teta_th_int(ngridmx,nlayermx) 102 104 REAL teta_env_int(ngridmx,nlayermx) 103 105 REAL teta_down_int(ngridmx,nlayermx) 104 106 105 CHARACTER (LEN=20) :: modname106 107 CHARACTER (LEN=80) :: abort_message 108 INTEGER ndt 107 109 108 110 ! ============= PLUME VARIABLES ============ … … 123 125 REAL denom(ngridmx) 124 126 REAL zlevinter(ngridmx) 127 INTEGER zlmax 125 128 126 129 ! ========================================= … … 186 189 detr(:,:)=0. 187 190 fm(:,:)=0. 188 zu(:,:)=pu(:,:)189 zv(:,:)=pv(:,:)191 ! zu(:,:)=pu(:,:) 192 ! zv(:,:)=pv(:,:) 190 193 zhc(:,:)=pt(:,:)/zpopsk(:,:) 194 ndt=1 191 195 192 196 ! ********************************************************************** … … 888 892 ! =========================================================================== 889 893 894 zlmax=MAXVAL(lmax(:))+2 895 if (zlmax .ge. nlayermx) then 896 print*,'thermals have reached last layer of the model' 897 print*,'this is not good !' 898 endif 899 890 900 ! Choix de la fonction d'alimentation utilisee pour la fermeture. 891 901 … … 968 978 !------------------------------------------------------------------------- 969 979 970 do l=1, nlayermx980 do l=1,zlmax 971 981 entr(:,l)=f(:)*(entr_star(:,l)+alim_star(:,l)) 972 982 detr(:,l)=f(:)*detr_star(:,l) 973 983 enddo 974 984 975 do l=1, nlayermx985 do l=1,zlmax 976 986 do ig=1,ngridmx 977 987 if (l.lt.lmax(ig)) then … … 1007 1017 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 1008 1018 1009 do l=1, nlayermx1019 do l=1,zlmax 1010 1020 1011 1021 do ig=1,ngridmx … … 1156 1166 !----------------------------------------------------------------------- 1157 1167 1158 do l=1, nlayermx-11168 do l=1,zlmax 1159 1169 do ig=1,ngridmx 1160 1170 eee0=entr(ig,l) … … 1347 1357 ! Calcul de la fraction de l'ascendance 1348 1358 !------------------------------------------------------------------ 1349 do ig=1,ngridmx 1350 fraca(ig,1)=0. 1351 fraca(ig,nlayermx+1)=0. 1352 enddo 1353 do l=2,nlayermx 1359 fraca(:,:)=0. 1360 do l=2,zlmax 1354 1361 do ig=1,ngridmx 1355 1362 if (zw2(ig,l).gt.1.e-10) then … … 1520 1527 1521 1528 else 1522 1523 call thermcell_dqup(ngridmx,nlayermx,ptimestep & 1524 & ,fm,entr, & 1525 & masse,zu,pduadj) 1526 1527 call thermcell_dqup(ngridmx,nlayermx,ptimestep & 1528 & ,fm,entr, & 1529 & masse,zv,pdvadj) 1529 ! detrmod(:,:)=0. 1530 ! do k=1,zlmax 1531 ! do ig=1,ngridmx 1532 ! detrmod(ig,k)=fm(ig,k)-fm(ig,k+1) & 1533 ! & +entr(ig,k) 1534 ! if (detrmod(ig,k).lt.0.) then 1535 ! entr(ig,k)=entr(ig,k)-detrmod(ig,k) 1536 ! detrmod(ig,k)=0. 1537 ! endif 1538 ! enddo 1539 ! enddo 1540 ! 1541 ! 1542 ! call thermcell_dqup(ngridmx,nlayermx,ptimestep & 1543 ! & ,fm,entr,detrmod, & 1544 ! & masse,zu,pduadj,ndt,zlmax) 1545 ! 1546 ! call thermcell_dqup(ngridmx,nlayermx,ptimestep & 1547 ! & ,fm,entr,detrmod, & 1548 ! & masse,zv,pdvadj,ndt,zlmax) 1530 1549 1531 1550 endif … … 1538 1557 ! The rest is transported outside the sub-timestep loop 1539 1558 1559 ratiom(:,:)=1. 1560 1540 1561 if (ico2.ne.0) then 1541 ! if (nqmx .ne. 0.) then 1562 detrmod(:,:)=0. 1563 do k=1,zlmax 1564 do ig=1,ngridmx 1565 detrmod(ig,k)=fm(ig,k)-fm(ig,k+1) & 1566 & +entr(ig,k) 1567 if (detrmod(ig,k).lt.0.) then 1568 entr(ig,k)=entr(ig,k)-detrmod(ig,k) 1569 detrmod(ig,k)=0. 1570 endif 1571 enddo 1572 enddo 1573 1542 1574 call thermcell_dqup(ngridmx,nlayermx,ptimestep & 1543 & ,fm,entr, & 1544 & masse,pq(:,:,ico2),pdqadj(:,:,ico2)) 1545 ! endif 1575 & ,fm,entr,detrmod, & 1576 & masse,pq(:,:,ico2),pdqadj(:,:,ico2),ndt,zlmax) 1546 1577 1547 1578 ! Compute the ratio between theta and theta_m 1548 1579 1549 do l=1, nlayermx1580 do l=1,zlmax 1550 1581 do ig=1,ngridmx 1551 1582 ratiom(ig,l)=1./(A*(pq(ig,l,ico2)+pdqadj(ig,l,ico2)*ptimestep)+B) 1552 1583 enddo 1553 1584 enddo 1554 else 1555 ratiom(:,:)=1. 1585 1556 1586 endif 1557 1558 1587 1559 1588 !------------------------------------------------------------------ … … 1561 1590 !------------------------------------------------------------------ 1562 1591 1563 do l=1,nlayermx 1592 pdtadj(:,:)=0. 1593 do l=1,zlmax 1564 1594 do ig=1,ngridmx 1565 1595 pdtadj(ig,l)=(zdthladj(ig,l)+zdthladj_down(ig,l))*zpopsk(ig,l)*ratiom(ig,l) … … 1601 1631 teta_down_int(ig,nlayermx)=teta_down_int(ig,nlayermx-1) 1602 1632 enddo 1603 do l=1,nlayermx 1633 heatFlux(:,:)=0. 1634 buoyancyOut(:,:)=0. 1635 buoyancyEst(:,:)=0. 1636 heatFlux_down(:,:)=0. 1637 do l=1,zlmax 1604 1638 do ig=1,ngridmx 1605 1639 heatFlux(ig,l)=fm(ig,l)*(teta_th_int(ig,l)-teta_env_int(ig,l))/(rhobarz(ig,l))
Note: See TracChangeset
for help on using the changeset viewer.