<p><b>laura@ucar.edu</b> 2012-01-03 16:12:09 -0700 (Tue, 03 Jan 2012)</p><p>added the calculation of the surface pressure in the subroutine microphysics_to_MPAS. added the calculation of zmid_p which is the height in the middle of layers<br>
</p><hr noshade><pre><font color="gray">Modified: branches/atmos_physics/src/core_physics/module_physics_interface_nhyd.F
===================================================================
--- branches/atmos_physics/src/core_physics/module_physics_interface_nhyd.F        2012-01-03 23:07:50 UTC (rev 1289)
+++ branches/atmos_physics/src/core_physics/module_physics_interface_nhyd.F        2012-01-03 23:12:09 UTC (rev 1290)
@@ -32,6 +32,7 @@
  if(.not.allocated(pres_p) )  allocate(pres_p(ims:ime,kms:kme,jms:jme)  )
  if(.not.allocated(pi_p)   )  allocate(pi_p(ims:ime,kms:kme,jms:jme)    )
  if(.not.allocated(z_p)    )  allocate(z_p(ims:ime,kms:kme,jms:jme)     )
+ if(.not.allocated(zmid_p) )  allocate(zmid_p(ims:ime,kms:kme,jms:jme)  )
  if(.not.allocated(dz_p)   )  allocate(dz_p(ims:ime,kms:kme,jms:jme)    )
  if(.not.allocated(t_p)    )  allocate(t_p(ims:ime,kms:kme,jms:jme)     )
  if(.not.allocated(th_p)   )  allocate(th_p(ims:ime,kms:kme,jms:jme)    )
@@ -62,6 +63,7 @@
     pres_p(i,k,j)  = 0.
     pi_p(i,k,j)    = 0.
     z_p(i,k,j)     = 0.
+    zmid_p(i,k,j)  = 0.
     dz_p(i,k,j)    = 0.
     t_p(i,k,j)     = 0.
     th_p(i,k,j)    = 0.
@@ -103,6 +105,7 @@
  if(allocated(pres_p)  ) deallocate(pres_p  )
  if(allocated(pi_p)    ) deallocate(pi_p    )
  if(allocated(z_p)     ) deallocate(z_p     )
+ if(allocated(zmid_p)  ) deallocate(zmid_p  )
  if(allocated(dz_p)    ) deallocate(dz_p    )
  if(allocated(t_p)     ) deallocate(t_p     )
  if(allocated(th_p)    ) deallocate(th_p    )
@@ -215,11 +218,18 @@
     pi_p(i,k,j)   = exner(k,i)
     pres_p(i,k,j) = pressure_p(k,i) + pressure_b(k,i)
 
-    dz_p(i,k,j) = zgrid(k+1,i)-zgrid(k,i)
+    zmid_p(i,k,j) = 0.5*(zgrid(k+1,i)+zgrid(k,i))
+    dz_p(i,k,j)   = zgrid(k+1,i)-zgrid(k,i)
 
-    !arrays located at w points:
+ enddo
+ enddo
+ enddo
+
+ do j = jts, jte
+ do k = kts,kte+1
+ do i = its,ite
     w_p(i,k,j) = w(k,i)
-   
+    z_p(i,k,j) = zgrid(k,i)
  enddo
  enddo
  enddo
@@ -480,6 +490,13 @@
  real(kind=RKIND),dimension(:,:),pointer:: rho_zz,theta_m,pressure_p
  real(kind=RKIND),dimension(:,:),pointer:: rt_diabatic_tend
 
+!ldf(2011-11-12): surface pressure.
+ real(kind=RKIND):: temp1,temp2
+ real(kind=RKIND),dimension(:),pointer:: rdzw
+ real(kind=RKIND),dimension(:),pointer:: sfc_pressure
+ real(kind=RKIND),dimension(:,:),pointer:: zgrid
+!ldf end.
+
 !---------------------------------------------------------------------------------------------
 
  write(0,*)
@@ -487,6 +504,7 @@
 
 !initialization:
  zz         =&gt; mesh % zz % array
+ zgrid      =&gt; mesh % zgrid % array
  exner      =&gt; diag % exner % array
  exner_b    =&gt; diag % exner_base % array
  pressure_b =&gt; diag % pressure_base % array
@@ -499,6 +517,11 @@
 
  rt_diabatic_tend =&gt; tend % rt_diabatic_tend % array
 
+!ldf (2011-11-12): update surface pressure.
+ rdzw =&gt; mesh % rdzw % array
+ sfc_pressure =&gt; diag % surface_pressure % array
+!ldf end.
+
 !variables common to all cloud microphysics schemes:
 
  do j = jts, jte
@@ -529,7 +552,17 @@
  enddo
  enddo
  enddo

+
+!updates the surface pressure.
+ do j = jts,jte
+ do i = its,ite
+    sfc_pressure(i) = 0.5*g*(zgrid(2,i)-zgrid(1,i)) &amp;
+                    * (1.25 * rho_zz(1,i) * zz(1,i) * (1. + qv_p(i,1,j))  &amp;
+                    -  0.25 * rho_zz(2,i) * zz(2,i) * (1. + qv_p(i,2,j)))
+    sfc_pressure(i) = sfc_pressure(i) + pressure_p(1,i) + pressure_b(1,i)
+ enddo
+ enddo
+
 !variables specific to different cloud microphysics schemes:
 
  microp_select_init: select case(microp_scheme)

</font>
</pre>