Changeset 1212 for trunk/LMDZ.MARS/libf/phymars/thermcell_main_mars.F90
- Timestamp:
- Mar 24, 2014, 9:46:50 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.MARS/libf/phymars/thermcell_main_mars.F90
r1130 r1212 37 37 & ,pu,pv,pt,pq,pq2 & 38 38 & ,pdtadj,pdqadj & 39 & ,fm,entr,detr,lmax,zmax &39 & ,fm,entr,detr,lmax,zmax,limz & 40 40 & ,zw2,fraca & 41 41 & ,zpopsk,heatFlux,heatFlux_down & … … 43 43 44 44 USE comtherm_h 45 #ifndef MESOSCALE 45 46 use planetwide_mod, only: planetwide_maxval 47 #endif 46 48 47 49 IMPLICIT NONE … … 85 87 REAL, INTENT(OUT) :: heatFlux_down(ngrid,nlayer) ! interface heat flux from downdraft 86 88 89 INTEGER, INTENT(OUT) :: limz ! limit vertical index for integration 90 87 91 ! ============== LOCAL ================ 88 92 REAL :: pdqadj(ngrid,nlayer,nq) !tracer change from thermals dq/dt, only for CO2 (the rest can be advected outside of the loop) … … 153 157 REAL denom(ngrid) 154 158 REAL zlevinter(ngrid) 155 INTEGER zlmax156 159 157 160 ! ========================================= … … 765 768 ! =========================================================================== 766 769 767 !zlmax=MAXVAL(lmax(:))+2 ! OK, but in serial mode only; use planet 768 call planetwide_maxval(lmax,zlmax) 769 zlmax=zlmax+2 770 #ifdef MESOSCALE 771 limz= nlayer-5 ! the most important is limz > max(PBLheight)+2 772 ! nlayer-5 is more than enough! 773 #else 774 call planetwide_maxval(lmax,limz) 775 limz=limz+2 776 #endif 770 777 771 if ( zlmax.ge. nlayer) then778 if (limz .ge. nlayer) then 772 779 print*,'thermals have reached last layer of the model' 773 780 print*,'this is not good !' 774 zlmax=nlayer781 limz=nlayer 775 782 endif 776 783 ! alim_star_clos is the source profile used for closure. It consists of the … … 794 801 795 802 ! llmax is the index of the heighest thermal in the simulation domain 796 !llmax=1 797 !do ig=1,ngrid 798 ! if (lalim(ig)>llmax) llmax=lalim(ig) 799 !enddo 803 #ifdef MESOSCALE 804 !! AS: THIS IS PARALLEL SENSITIVE!!!!! to be corrected? 805 llmax=1 806 do ig=1,ngrid 807 if (lalim(ig)>llmax) llmax=lalim(ig) 808 enddo 809 #else 800 810 call planetwide_maxval(lalim,llmax) 811 #endif 801 812 802 813 ! Integral of a**2/(rho* Delta z), see equation 13 of appendix 4.2 in paper … … 856 867 !------------------------------------------------------------------------- 857 868 858 do l=1, zlmax869 do l=1,limz 859 870 entr(:,l)=f(:)*(entr_star(:,l)+alim_star(:,l)) 860 871 detr(:,l)=f(:)*detr_star(:,l) … … 863 874 ! Reconstruct the updraft mass flux everywhere 864 875 865 do l=1, zlmax876 do l=1,limz 866 877 do ig=1,ngrid 867 878 if (l.lt.lmax(ig)) then … … 890 901 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 891 902 892 do l=1, zlmax!loop on the levels903 do l=1,limz !loop on the levels 893 904 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 894 905 … … 992 1003 !----------------------------------------------------------------------- 993 1004 994 do l=1, zlmax1005 do l=1,limz 995 1006 do ig=1,ngrid 996 1007 eee0=entr(ig,l) … … 1140 1151 !------------------------------------------------------------------ 1141 1152 fraca(:,:)=0. 1142 do l=2, zlmax1153 do l=2,limz 1143 1154 do ig=1,ngrid 1144 1155 if (zw2(ig,l).gt.1.e-10) then … … 1161 1172 if (igcm_co2.ne.0) then 1162 1173 detrmod(:,:)=0. 1163 do k=1, zlmax1174 do k=1,limz 1164 1175 do ig=1,ngrid 1165 1176 detrmod(ig,k)=fm(ig,k)-fm(ig,k+1) & … … 1174 1185 call thermcell_dqup(ngrid,nlayer,ptimestep & 1175 1186 & ,fm,entr,detrmod, & 1176 & masse,pq(:,:,igcm_co2),pdqadj(:,:,igcm_co2),ndt, zlmax)1187 & masse,pq(:,:,igcm_co2),pdqadj(:,:,igcm_co2),ndt,limz) 1177 1188 1178 1189 ! Compute the ratio between theta and theta_m 1179 1190 1180 do l=1, zlmax1191 do l=1,limz 1181 1192 do ig=1,ngrid 1182 1193 ratiom(ig,l)=1./(A*(pq(ig,l,igcm_co2)+pdqadj(ig,l,igcm_co2)*ptimestep)+B) … … 1191 1202 1192 1203 pdtadj(:,:)=0. 1193 do l=1, zlmax1204 do l=1,limz 1194 1205 do ig=1,ngrid 1195 1206 pdtadj(ig,l)=(zdthladj(ig,l)+zdthladj_down(ig,l))*zpopsk(ig,l)*ratiom(ig,l) … … 1225 1236 buoyancyEst(:,:)=0. 1226 1237 heatFlux_down(:,:)=0. 1227 do l=1, zlmax1238 do l=1,limz 1228 1239 do ig=1,ngrid 1229 1240 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.