<p><b>mpetersen@lanl.gov</b> 2011-05-31 08:42:34 -0600 (Tue, 31 May 2011)</p><p>BRANCH COMMIT: Change Stage 1 Baroclinic from computing G at each level and Gbar = avg(G) to computing a provisional u and Gbar = avg(u)/dt.<br>
</p><hr noshade><pre><font color="gray">Modified: branches/ocean_projects/timesplitting_mrp/src/core_ocean/module_time_integration.F
===================================================================
--- branches/ocean_projects/timesplitting_mrp/src/core_ocean/module_time_integration.F        2011-05-31 13:00:42 UTC (rev 861)
+++ branches/ocean_projects/timesplitting_mrp/src/core_ocean/module_time_integration.F        2011-05-31 14:42:34 UTC (rev 862)
@@ -379,12 +379,11 @@
       real (kind=RKIND), dimension(:,:,:), pointer :: tracers
       integer, dimension(:), pointer :: &amp; 
         maxLevelCell, maxLevelEdgeTop
-      real (kind=RKIND), dimension(:), allocatable:: A,C,uTemp, G, aBtrSumCoef,bBtrSumCoef, tend_ssh, tend_uBtr
+      real (kind=RKIND), dimension(:), allocatable:: A,C,uTemp, aBtrSumCoef,bBtrSumCoef, tend_ssh, tend_uBtr
       real (kind=RKIND), dimension(:,:), allocatable:: tracersTemp
 
 !print *, '1'
 
-
       !
       !  Prep variables before first iteration
       !
@@ -527,7 +526,7 @@
 
          block =&gt; domain % blocklist
          do while (associated(block))
-           allocate(G(block % mesh % nVertLevels))
+           allocate(uTemp(block % mesh % nVertLevels))
 
            ! Put f*uBcl^{perp} in uNew as a work variable
            call compute_f_uperp(block % state % time_levs(2) % state , block % mesh)
@@ -536,7 +535,7 @@
               cell1 = block % mesh % cellsOnEdge % array(1,iEdge)
               cell2 = block % mesh % cellsOnEdge % array(2,iEdge)
 
-              G = 0.0  ! could put this after with G(maxleveledgetop+1:nvertlevels)=0
+              uTemp = 0.0  ! could put this after with uTemp(maxleveledgetop+1:nvertlevels)=0
               do k=1,block % mesh % maxLevelEdgeTop % array(iEdge)
                  !{\bf G}_k = -f{\bf u}_{k,n+1}^{'\;\perp} + {\bf T}({\bf u}_k^*,w_k^*,p_k^*) +\frac{g}{\rho_0}</font>
<font color="gray">abla \ssh^*
 
@@ -544,12 +543,14 @@
 !                G(k) = tend_u(k,iEdge) -fEdge(iEdge)*uBclPerp(k,iEdge) - g/rho0 grad (h_1^*)
                  ! Here uNew is a work variable containing -fEdge(iEdge)*uBclPerp(k,iEdge)
 ! mrp temp new one:
-                 G(k) = block % tend % u % array (k,iEdge) &amp;
+                 uTemp(k) &amp;
+                 = block % state % time_levs(1) % state % uBcl % array(k,iEdge) &amp;
+                 + dt * (block % tend % u % array (k,iEdge) &amp;
                       + block % state % time_levs(2) % state % u % array (k,iEdge) &amp;
                       + split*grav_rho0Inv &amp;
                         *(  block % state % time_levs(2) % state % h % array(1,cell2) &amp;
                           - block % state % time_levs(2) % state % h % array(1,cell1) ) &amp;
-                          /block % mesh % dcEdge % array(iEdge)
+                          /block % mesh % dcEdge % array(iEdge) )
 
 ! mrp old one:
 !                 G(k) = block % tend % u % array (k,iEdge)
@@ -558,30 +559,28 @@
 
               enddo
 
-
               GSum = 0.0
               hSum = 0.0
               ! 110518 mrp efficiency note:
               ! in a z-level model, could change hSum to use sum of hZLevel, or have another
               ! 1-D z array which is total thickness between the surface and that level.
               do k=1,block % mesh % maxLevelEdgeTop % array(iEdge)
-                 GSum = GSum + G(k)
-                 hSum = hSum + block % state % time_levs(1) % state % h_edge % array(k,iEdge)
+                 GSum = GSum + block % state % time_levs(2) % state % h_edge % array(k,iEdge)*uTemp(k)
+                 hSum = hSum + block % state % time_levs(2) % state % h_edge % array(k,iEdge)
               enddo
-              block % state % time_levs(1) % state % GBtrForcing % array(iEdge) = split*GSum/hSum
+              block % state % time_levs(1) % state % GBtrForcing % array(iEdge) = split*GSum/hSum/dt
 
-
-
               do k=1,block % mesh % maxLevelEdgeTop % array(iEdge)
                  !{\bf u}'_{k,n+1} = {\bf u}'_{k,n} + \Delta t \left({\bf G}_k - {\overline {\bf G}}\right)
-                   block % state % time_levs(2) % state % uBcl % array(k,iEdge) &amp;
-                 = block % state % time_levs(1) % state % uBcl % array(k,iEdge) &amp;
-                 + dt * (G(k) - block % state % time_levs(1) % state % GBtrForcing % array(iEdge))
+                 block % state % time_levs(2) % state % uBcl % array(k,iEdge) &amp;
+                 = uTemp(k) &amp;
+                 - dt * block % state % time_levs(1) % state % GBtrForcing % array(iEdge)
               enddo
-           enddo
 
-           deallocate(G)
+           enddo ! iEdge
 
+           deallocate(uTemp)
+
            block =&gt; block % next
          end do
 

</font>
</pre>