<p><b>laura@ucar.edu</b> 2011-07-07 16:13:45 -0600 (Thu, 07 Jul 2011)</p><p>includes actual area of individual grid cells instead of constant (max) value<br>
</p><hr noshade><pre><font color="gray">Modified: branches/atmos_physics/src/core_physics/module_driver_convection_deep.F
===================================================================
--- branches/atmos_physics/src/core_physics/module_driver_convection_deep.F        2011-07-07 22:11:56 UTC (rev 913)
+++ branches/atmos_physics/src/core_physics/module_driver_convection_deep.F        2011-07-07 22:13:45 UTC (rev 914)
@@ -37,6 +37,7 @@
  convection_select: select case(conv_deep_scheme)
 
     case (&quot;kain_fritsch&quot;)
+       if(.not.allocated(area_p) ) allocate(area_p(ims:ime,jms:jme)         )
        if(.not.allocated(nca_p)  ) allocate(nca_p(ims:ime,jms:jme)          )
        if(.not.allocated(w0avg_p)) allocate(w0avg_p(ims:ime,kms:kme,jms:jme))
 
@@ -65,6 +66,7 @@
  convection_select: select case(conv_deep_scheme)
 
     case (&quot;kain_fritsch&quot;)
+       if(allocated(area_p) ) deallocate(area_p )
        if(allocated(nca_p)  ) deallocate(nca_p  )
        if(allocated(w0avg_p)) deallocate(w0avg_p)
 
@@ -137,13 +139,13 @@
 !initialize instantaneous precipitation, and copy convective tendencies from the dynamics to
 !the physics grid:
 
- call convection_from_MPAS(dt_dyn,diag_physics,tend_physics)
+ call convection_from_MPAS(dt_dyn,mesh,diag_physics,tend_physics)
 
 !... convert the convection time-step to minutes:
  cudt = dt_cu/60.
 
 !... call to convection schemes:
- dx = sqrt(maxval(mesh % areaCell % array))
+!dx = sqrt(maxval(mesh % areaCell % array))
 
  do j = jts, jte
  do i = its, ite
@@ -158,33 +160,11 @@
        !initialization:
        curr_secs = -1
        adapt_step_flag = .false.
-
-!      write(0,*) 'max val nca=',maxval(nca_p(:,:))
-!      write(0,*) 'min val nca=',minval(nca_p(:,:))
-!      write(0,*)
-!      write(0,*) '--- deep convection:'
-!      do j = jts,jte
-!      do i = its,ite
-!         if(nca_p(i,j).gt.0. .and. raincv_p(i,j).gt.0.) then
-!            write(0,201) j,i,cu_act_flag(i,j),nca_p(i,j),raincv_p(i,j), &amp;
-!                         raincv_p(i,j)/dt_dyn,pratec_p(i,j)
-!         endif
-!      enddo
-!      enddo
-!      write(0,*) '--- shallow convection:'
-!      do j = jts,jte
-!      do i = its,ite
-!         if(nca_p(i,j).gt.0. .and. raincv_p(i,j).eq.0.) then
-!            write(0,201) j,i,cu_act_flag(i,j),nca_p(i,j),raincv_p(i,j), &amp;
-!                         raincv_p(i,j)/dt_dyn,pratec_p(i,j)
-!         endif
-!      enddo
-!      enddo
-!      write(0,*)
        write(0,*) '--- enter subroutine kf_eta_cps:'
        call  kf_eta_cps ( &amp;
              dt        = dt_dyn     , ktau            = itimestep       ,            &amp;
-             dx        = dx         , cudt            = dt_cu           ,            &amp;
+!            dx        = dx         , cudt            = dt_cu           ,            &amp;
+             areaCell  = area_p     , cudt            = dt_cu           ,            &amp;
              curr_secs = curr_secs  , adapt_step_flag = adapt_step_flag ,            &amp;
              rho       = rho_p      , raincv          = raincv_p        ,            &amp;
              pratec    = pratec_p   , nca             = nca_p           ,            &amp;
@@ -212,18 +192,19 @@
              ims = ims , ime = ime , jms = jms , jme = jme , kms = kds , kme = kme , &amp;
              its = its , ite = ite , jts = jts , jte = jte , kts = kts , kte = kte   &amp;
                     )
+       write(0,*) 'max raincv=',maxval(raincv_p(its:ite,jts:jte))
        201 format(i3,i6,1x,l1,5(1x,e15.8))
        write(0,*) '--- end subroutine kf_eta_cps:'
 !      write(0,*)
-!      write(0,*) '--- deep convection:'
-!      do j = jts,jte
-!      do i = its,ite
-!         if(nca_p(i,j).gt.0. .and. raincv_p(i,j).gt.0.) then
-!            write(0,201) j,i,cu_act_flag(i,j),nca_p(i,j),raincv_p(i,j), &amp;
-!                         raincv_p(i,j)/dt_dyn,pratec_p(i,j)
-!         endif
-!      enddo
-!      enddo
+       write(0,*) '--- deep convection:'
+       do j = jts,jte
+       do i = its,ite
+          if(nca_p(i,j).gt.0. .and. raincv_p(i,j).gt.0.) then
+             write(0,201) j,i,cu_act_flag(i,j),nca_p(i,j),raincv_p(i,j), &amp;
+                          raincv_p(i,j)/dt_dyn,pratec_p(i,j)
+          endif
+       enddo
+       enddo
 !      write(0,*) '--- shallow convection:'
 !      do j = jts,jte
 !      do i = its,ite
@@ -248,9 +229,10 @@
  end subroutine driver_convection_deep
 
 !=============================================================================================
- subroutine convection_from_MPAS(dt_dyn,diag_physics,tend_physics)
+ subroutine convection_from_MPAS(dt_dyn,mesh,diag_physics,tend_physics)
 !=============================================================================================
 !input arguments:
+ type(mesh_type),intent(in):: mesh
  type(diag_physics_type),intent(in):: diag_physics
  type(tend_physics_type),intent(in):: tend_physics
  real(kind=RKIND),intent(in):: dt_dyn
@@ -280,11 +262,14 @@
  
        do j = jts,jte
        do i = its,ite
-          nca_p(i,j) = diag_physics % nca % array(i)
+          !area of grid-cell:       
+          area_p(i,j) = mesh % areaCell % array(i)
 
           !decreases the characteristic time period that convection remains active. When nca_p
           !becomes less than the convective timestep, convective tendencies and precipitation
           !are reset to zero (note that this is also done in subroutine kf_eta_cps).
+          nca_p(i,j) = diag_physics % nca % array(i)
+
           if(nca_p(i,j) .gt. 0.) then
              nca_p(i,j) = nca_p(i,j) - dt_dyn
              

Modified: branches/atmos_physics/src/core_physics/module_driver_sfclayer.F
===================================================================
--- branches/atmos_physics/src/core_physics/module_driver_sfclayer.F        2011-07-07 22:11:56 UTC (rev 913)
+++ branches/atmos_physics/src/core_physics/module_driver_sfclayer.F        2011-07-07 22:13:45 UTC (rev 914)
@@ -27,6 +27,7 @@
  subroutine allocate_sfclayer
 !=============================================================================================
 
+ if(.not.allocated(area_p)   ) allocate(area_p(ims:ime,jms:jme)   )
  if(.not.allocated(br_p)     ) allocate(br_p(ims:ime,jms:jme)     )
  if(.not.allocated(cd_p)     ) allocate(cd_p(ims:ime,jms:jme)     )
  if(.not.allocated(cda_p)    ) allocate(cda_p(ims:ime,jms:jme)    )
@@ -70,6 +71,7 @@
  subroutine deallocate_sfclayer
 !=============================================================================================
 
+ if(allocated(area_p)   ) deallocate(area_p   )
  if(allocated(br_p)     ) deallocate(br_p     )
  if(allocated(cd_p)     ) deallocate(cd_p     )
  if(allocated(cda_p)    ) deallocate(cda_p    )
@@ -110,13 +112,12 @@
  end subroutine deallocate_sfclayer
 
 !=============================================================================================
- subroutine sfclayer_from_MPAS(diag_physics,sfc_input)
+ subroutine sfclayer_from_MPAS(mesh,diag_physics,sfc_input)
 !=============================================================================================
 
 !input arguments:
- type(sfc_input_type)   ,intent(in)   :: sfc_input
-
-!inout arguments:
+ type(mesh_type),intent(in):: mesh
+ type(sfc_input_type),intent(in):: sfc_input
  type(diag_physics_type),intent(inout):: diag_physics
 
 !---------------------------------------------------------------------------------------------
@@ -124,6 +125,7 @@
  do j = jts,jte
  do i = its,ite
     !input variables:
+    area_p(i,j)   = mesh % areaCell % array(i)
     hpbl_p(i,j)   = diag_physics % hpbl   % array(i)
     mavail_p(i,j) = diag_physics % mavail % array(i)
     xland_p(i,j)  = diag_physics % xland  % array(i)       
@@ -257,34 +259,34 @@
  write(0,*) '--- enter sfclayer_driver:'
 
 !copy all MPAS arrays to rectanguler grid:
- call sfclayer_from_MPAS(diag_physics,sfc_input)
+ call sfclayer_from_MPAS(mesh,diag_physics,sfc_input)
 
  sfclayer_select: select case (trim(sfclayer_scheme))
 
     case(&quot;monin_obukhov&quot;)
        dx = sqrt(maxval(mesh % areaCell % array))
        call sfclay( &amp;
-                   u3d      = u_p      , v3d     = v_p      , t3d    = t_p     , &amp;
-                   qv3d     = qv_p     , p3d     = pres_p   , dz8w   = dz_p    , &amp;
-                   cp       = cp       , g       = g        , rovcp  = rcp     , &amp;
-                   R        = R_d      , xlv     = xlv      , psfc   = psfc_p  , &amp;
-                   chs      = chs_p    , chs2    = chs2_p   , cqs2   = cqs2_p  , &amp;
-                   cpm      = cpm_p    , znt     = znt_p    , ust    = ust_p   , &amp;
-                   pblh     = hpbl_p   , mavail  = mavail_p , zol    = zol_p   , &amp;
-                   mol      = mol_p    , regime  = regime_p , psim   = psim_p  , &amp;
-                   psih     = psih_p   , xland   = xland_p  , hfx    = hfx_p   , &amp;
-                   qfx      = qfx_p    , lh      = lh_p     , tsk    = tsk_p   , &amp;
-                   flhc     = flhc_p   , flqc    = flqc_p   , qgh    = qgh_p   , &amp;
-                   qsfc     = qsfc_p   , rmol    = rmol_p   , u10    = u10_p   , &amp;
-                   v10      = v10_p    , th2     = th2m_p   , t2     = t2m_p   , &amp;
-                   q2       = q2_p     , gz1oz0  = gz1oz0_p , wspd   = wspd_p  , &amp;
-                   br       = br_p     , isfflx  = isfflx   , dx     = dx      , &amp;
-                   svp1     = svp1     , svp2    = svp2     , svp3   = svp3    , &amp;
-                   svpt0    = svpt0    , ep1     = ep_1     , ep2    = ep_2    , &amp;
-                   karman   = karman   , eomeg   = eomeg    , stbolt = stbolt  , &amp;
-                   P1000mb  = P0       , ustm    = ustm_p   , ck     = ck_p    , &amp;
-                   cka      = cka_p    , cd      = cd_p     , cda    = cda_p   , &amp;
-                   isftcflx = isftcflx , iz0tlnd = iz0tlnd  ,                    &amp; 
+                   u3d      = u_p      , v3d     = v_p      , t3d      = t_p     , &amp;
+                   qv3d     = qv_p     , p3d     = pres_p   , dz8w     = dz_p    , &amp;
+                   cp       = cp       , g       = g        , rovcp    = rcp     , &amp;
+                   R        = R_d      , xlv     = xlv      , psfc     = psfc_p  , &amp;
+                   chs      = chs_p    , chs2    = chs2_p   , cqs2     = cqs2_p  , &amp;
+                   cpm      = cpm_p    , znt     = znt_p    , ust      = ust_p   , &amp;
+                   pblh     = hpbl_p   , mavail  = mavail_p , zol      = zol_p   , &amp;
+                   mol      = mol_p    , regime  = regime_p , psim     = psim_p  , &amp;
+                   psih     = psih_p   , xland   = xland_p  , hfx      = hfx_p   , &amp;
+                   qfx      = qfx_p    , lh      = lh_p     , tsk      = tsk_p   , &amp;
+                   flhc     = flhc_p   , flqc    = flqc_p   , qgh      = qgh_p   , &amp;
+                   qsfc     = qsfc_p   , rmol    = rmol_p   , u10      = u10_p   , &amp;
+                   v10      = v10_p    , th2     = th2m_p   , t2       = t2m_p   , &amp;
+                   q2       = q2_p     , gz1oz0  = gz1oz0_p , wspd     = wspd_p  , &amp;
+                   br       = br_p     , isfflx  = isfflx   , dx       = dx      , &amp;
+                   svp1     = svp1     , svp2    = svp2     , svp3     = svp3    , &amp;
+                   svpt0    = svpt0    , ep1     = ep_1     , ep2      = ep_2    , &amp;
+                   karman   = karman   , eomeg   = eomeg    , stbolt   = stbolt  , &amp;
+                   P1000mb  = P0       , ustm    = ustm_p   , ck       = ck_p    , &amp;
+                   cka      = cka_p    , cd      = cd_p     , cda      = cda_p   , &amp;
+                   isftcflx = isftcflx , iz0tlnd = iz0tlnd  , areaCell = area_p  , &amp; 
                    ids = ids , ide = ide , jds = jds , jde = jde , kds = kds , kde = kde , &amp;
                    ims = ims , ime = ime , jms = jms , jme = jme , kms = kms , kme = kme , &amp;
                    its = its , ite = ite , jts = jts , jte = jte , kts = kts , kte = kte   &amp;

Modified: branches/atmos_physics/src/core_physics/module_physics_vars.F
===================================================================
--- branches/atmos_physics/src/core_physics/module_physics_vars.F        2011-07-07 22:11:56 UTC (rev 913)
+++ branches/atmos_physics/src/core_physics/module_physics_vars.F        2011-07-07 22:13:45 UTC (rev 914)
@@ -40,6 +40,9 @@
  
  real(kind=RKIND),public:: xice_threshold
 
+ real(kind=RKIND),dimension(:,:),allocatable:: &amp;
+    area_p             !grid cell area                                                     [m2]
+
 !... arrays related to surface:
  real(kind=RKIND),dimension(:,:),allocatable:: &amp;
     psfc_p,           &amp;!surface pressure                                                  [Pa]

</font>
</pre>