<p><b>laura@ucar.edu</b> 2011-07-07 16:11:56 -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/physics_wrf/module_cu_kfeta.F
===================================================================
--- branches/atmos_physics/src/core_physics/physics_wrf/module_cu_kfeta.F        2011-07-04 19:59:41 UTC (rev 912)
+++ branches/atmos_physics/src/core_physics/physics_wrf/module_cu_kfeta.F        2011-07-07 22:11:56 UTC (rev 913)
@@ -15,11 +15,29 @@
CONTAINS
+#if (defined(non_hydrostatic_core) || defined(hydrostatic_core))
+ SUBROUTINE KF_eta_CPS( &
+ ids,ide, jds,jde, kds,kde &
+ ,ims,ime, jms,jme, kms,kme &
+ ,its,ite, jts,jte, kts,kte &
+ ,DT,KTAU, areaCell,CUDT,CURR_SECS,ADAPT_STEP_FLAG &
+ ,rho,RAINCV,PRATEC,NCA &
+ ,U,V,TH,T,W,dz8w,Pcps,pi &
+ ,W0AVG,XLV0,XLV1,XLS0,XLS1,CP,R,G,EP1 &
+ ,EP2,SVP1,SVP2,SVP3,SVPT0 &
+ ,STEPCU,CU_ACT_FLAG,warm_rain,CUTOP,CUBOT &
+ ,QV &
+ ! optionals
+ ,F_QV ,F_QC ,F_QR ,F_QI ,F_QS &
+ ,RTHCUTEN,RQVCUTEN,RQCCUTEN,RQRCUTEN &
+ ,RQICUTEN,RQSCUTEN &
+ )
+#else
SUBROUTINE KF_eta_CPS( &
ids,ide, jds,jde, kds,kde &
,ims,ime, jms,jme, kms,kme &
,its,ite, jts,jte, kts,kte &
- ,DT,KTAU,DX,CUDT,CURR_SECS,ADAPT_STEP_FLAG &
+ ,DT,KTAU,CUDT,CURR_SECS,ADAPT_STEP_FLAG &
,rho,RAINCV,PRATEC,NCA &
,U,V,TH,T,W,dz8w,Pcps,pi &
,W0AVG,XLV0,XLV1,XLS0,XLS1,CP,R,G,EP1 &
@@ -31,6 +49,8 @@
,RTHCUTEN,RQVCUTEN,RQCCUTEN,RQRCUTEN &
,RQICUTEN,RQSCUTEN &
)
+#endif
+
!
!-------------------------------------------------------------
IMPLICIT NONE
@@ -66,7 +86,17 @@
INTENT(INOUT) :: &
W0AVG
+!In MPAS and unlike WRF, individual grid-cells do not always have the same area.
+!This is particularly important when using global variable-mesh resolution. Here
+!we define dx as the area of the grid-cell (note that in wrf, dx is actually the
+!west-east length of the grid-cell.)
+#if (defined(non_hydrostatic_core) || defined(hydrostatic_core))
+ real,intent(in):: dt
+ real,intent(in),dimension(ims:ime,jms:jme):: areaCell
+#else
REAL, INTENT(IN ) :: DT, DX
+#endif
+
REAL, INTENT(IN ) :: CUDT
REAL, INTENT(IN ) :: CURR_SECS
LOGICAL,INTENT(IN ) :: ADAPT_STEP_FLAG
@@ -138,7 +168,11 @@
DQSDT, &
DTDT
+#if (defined(non_hydrostatic_core) || defined(hydrostatic_core))
+ real:: tst,tv,prs,rhoe,w0,scr1,dx,dxsq,tmp
+#else
REAL :: TST,tv,PRS,RHOE,W0,SCR1,DXSQ,tmp
+#endif
INTEGER :: i,j,k,NTST
REAL :: lastdt = -1.0
@@ -146,8 +180,12 @@
LOGICAL :: run_param
!
+#if !(defined(non_hydrostatic_core) || defined(hydrostatic_core))
DXSQ=DX*DX
+#endif
+write(0,*) 'max areaCell=',maxval(areaCell(its:ite,jts:jte))
+
!----------------------
NTST=STEPCU
TST=float(NTST*2)
@@ -235,6 +273,12 @@
CU_ACT_FLAG(i,j) = .false.
ELSE
+#if (defined(non_hydrostatic_core) || defined(hydrostatic_core))
+ dxsq = areaCell(i,j)
+ dx = sqrt(dxsq)
+! write(0,201) j,i,dxsq,dx
+! 201 format(i3,i8,2(1x,e15.8))
+#endif
DO k=kts,kte
DQDT(k)=0.
DQIDT(k)=0.
Modified: branches/atmos_physics/src/core_physics/physics_wrf/module_sf_sfclay.F
===================================================================
--- branches/atmos_physics/src/core_physics/physics_wrf/module_sf_sfclay.F        2011-07-04 19:59:41 UTC (rev 912)
+++ branches/atmos_physics/src/core_physics/physics_wrf/module_sf_sfclay.F        2011-07-07 22:11:56 UTC (rev 913)
@@ -23,7 +23,7 @@
ids,ide, jds,jde, kds,kde, &
ims,ime, jms,jme, kms,kme, &
its,ite, jts,jte, kts,kte, &
- ustm,ck,cka,cd,cda,isftcflx,iz0tlnd )
+ ustm,ck,cka,cd,cda,isftcflx,iz0tlnd,areaCell )
!-------------------------------------------------------------------
IMPLICIT NONE
!-------------------------------------------------------------------
@@ -175,13 +175,13 @@
REAL, INTENT(IN ) :: CP,G,ROVCP,R,XLV,DX
-!ldf (11-08-2010): changed intent(out) to intent(inout) to avoid "warning" at
-!compilation time:
+!MPAS specific (Laura D. Fowler):
! REAL, OPTIONAL, DIMENSION( ims:ime, jms:jme ) , &
! INTENT(OUT) :: ck,cka,cd,cda,ustm
real, optional, dimension( ims:ime, jms:jme ) , &
intent(inout) :: ck,cka,cd,cda,ustm
-!ldf end.
+ real,intent(in),dimension(ims:ime,jms:jme),optional:: areaCell
+!MPAS specific end.
INTEGER, OPTIONAL, INTENT(IN ) :: ISFTCFLX, IZ0TLND
@@ -232,7 +232,7 @@
!MPAS specific (Laura D. Fowler):
,isftcflx,iz0tlnd, &
USTM(ims,j),CK(ims,j),CKA(ims,j), &
- CD(ims,j),CDA(ims,j) &
+ CD(ims,j),CDA(ims,j),areaCell(ims,j) &
!#elseif ( EM_CORE == 1 )
! ,isftcflx,iz0tlnd, &
! USTM(ims,j),CK(ims,j),CKA(ims,j), &
@@ -259,7 +259,8 @@
ims,ime, jms,jme, kms,kme, &
its,ite, jts,jte, kts,kte, &
isftcflx, iz0tlnd, &
- ustm,ck,cka,cd,cda )
+ ustm,ck,cka,cd,cda, &
+ areaCell)
!-------------------------------------------------------------------
IMPLICIT NONE
!-------------------------------------------------------------------
@@ -334,6 +335,11 @@
INTEGER, OPTIONAL, INTENT(IN ) :: ISFTCFLX, IZ0TLND
+!MPAS specific (Laura D. Fowler): We take into accound the actual size of individual
+!grid-boxes:
+ real,intent(in),dimension(ims:ime),optional:: areaCell
+!MPAS specific end.
+
! LOCAL VARS
REAL, DIMENSION( its:ite ) :: ZA, &
@@ -498,7 +504,16 @@
VCONV = 2.*SQRT(DTHVM)
endif
! Mahrt and Sun low-res correction
- VSGD = 0.32 * (max(dx/5000.-1.,0.))**.33
+!MPAS specific (Laura D. Fowler): We take into accound the actual size of individual
+!grid-boxes:
+ if(present(areaCell)) then
+ vsgd = 0.32 * (max(sqrt(areaCell(i))/5000.-1.,0.))**.33
+ else
+ VSGD = 0.32 * (max(dx/5000.-1.,0.))**.33
+ endif
+! write(0,201) i,areaCell(i),vsgd
+! 201 format(i8,2(1x,e15.8))
+!MPAS specific end.
WSPD(I)=SQRT(WSPD(I)*WSPD(I)+VCONV*VCONV+vsgd*vsgd)
WSPD(I)=AMAX1(WSPD(I),0.1)
BR(I)=GOVRTH(I)*ZA(I)*DTHVDZ/(WSPD(I)*WSPD(I))
@@ -508,7 +523,7 @@
RMOL(I)=-GOVRTH(I)*DTHVDZ*ZA(I)*KARMAN
!jdf
- 260 CONTINUE
+ 260 CONTINUE
!
!-----DIAGNOSE BASIC PARAMETERS FOR THE APPROPRIATED STABILITY CLASS:
</font>
</pre>