<p><b>dwj07@fsu.edu</b> 2011-09-14 15:31:04 -0600 (Wed, 14 Sep 2011)</p><p><br>
        -- Branch Commit --<br>
<br>
        Adding timer calls for profiling.<br>
<br>
        Adding vim folds and a modeline to read folding markers.<br>
</p><hr noshade><pre><font color="gray">Modified: branches/ocean_projects/performance/src/core_ocean/module_time_integration.F
===================================================================
--- branches/ocean_projects/performance/src/core_ocean/module_time_integration.F        2011-09-14 21:24:57 UTC (rev 994)
+++ branches/ocean_projects/performance/src/core_ocean/module_time_integration.F        2011-09-14 21:31:04 UTC (rev 995)
@@ -6,10 +6,11 @@
    use dmpar
    use vector_reconstruction
    use spline_interpolation
+   use timer
 
    contains
 
-   subroutine timestep(domain, dt, timeStamp)
+   subroutine timestep(domain, dt, timeStamp)/*{{{*/
    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    ! Advance model state forward in time by the specified time step
    !
@@ -53,10 +54,9 @@
          block =&gt; block % next
       end do
 
-   end subroutine timestep
+   end subroutine timestep/*}}}*/
 
-
-   subroutine rk4(domain, dt)
+   subroutine rk4(domain, dt)!{{{
    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    ! Advance model state forward in time by the specified time step using 
    !   4th order Runge-Kutta
@@ -90,6 +90,7 @@
       real (kind=RKIND), dimension(:), allocatable:: A,C,uTemp
       real (kind=RKIND), dimension(:,:), allocatable:: tracersTemp
 
+
       block =&gt; domain % blocklist
       call allocate_state(provis, &amp;
                           block % mesh % nCells, block % mesh % nEdges, block % mesh % maxEdges, block % mesh % maxEdges2, &amp;
@@ -129,12 +130,14 @@
       rk_substep_weights(4) = 0.
 
 
+      call timer_start(&quot;RK4-main loop&quot;)
       !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
       ! BEGIN RK loop 
       !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
       do rk_step = 1, 4
 ! ---  update halos for diagnostic variables
 
+        call timer_start(&quot;RK4-diagnostic halo update&quot;)
         block =&gt; domain % blocklist
         do while (associated(block))
            call dmpar_exch_halo_field2dReal(domain % dminfo, provis % pv_edge % array(:,:), &amp;
@@ -152,9 +155,11 @@
 
            block =&gt; block % next
         end do
+        call timer_stop(&quot;RK4-diagnostic halo update&quot;)
 
 ! ---  compute tendencies
 
+        call timer_start(&quot;RK4-tendency computations&quot;)
         block =&gt; domain % blocklist
         do while (associated(block))
            if (.not.config_implicit_vertical_mix) then
@@ -173,9 +178,11 @@
            call enforce_boundaryEdge(block % tend, block % mesh)
            block =&gt; block % next
         end do
+        call timer_stop(&quot;RK4-tendency computations&quot;)
 
 ! ---  update halos for prognostic variables
 
+        call timer_start(&quot;RK4-pronostic halo update&quot;)
         block =&gt; domain % blocklist
         do while (associated(block))
            call dmpar_exch_halo_field2dReal(domain % dminfo, block % tend % u % array(:,:), &amp;
@@ -189,9 +196,11 @@
                                             block % parinfo % cellsToSend, block % parinfo % cellsToRecv)
            block =&gt; block % next
         end do
+        call timer_stop(&quot;RK4-pronostic halo update&quot;)
 
 ! ---  compute next substep state
 
+        call timer_start(&quot;RK4-update diagnostic variables&quot;)
         if (rk_step &lt; 4) then
            block =&gt; domain % blocklist
            do while (associated(block))
@@ -220,11 +229,13 @@
               block =&gt; block % next
            end do
         end if
+        call timer_stop(&quot;RK4-update diagnostic variables&quot;)
 
 
 
 !--- accumulate update (for RK4)
 
+        call timer_start(&quot;RK4-RK4 accumulate update&quot;)
         block =&gt; domain % blocklist
         do while (associated(block))
            block % state % time_levs(2) % state % u % array(:,:) = block % state % time_levs(2) % state % u % array(:,:) &amp;
@@ -243,15 +254,18 @@
 
            block =&gt; block % next
         end do
+        call timer_stop(&quot;RK4-RK4 accumulate update&quot;)
 
       end do
       !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
       ! END RK loop 
       !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+      call timer_stop(&quot;RK4-main loop&quot;)
 
       !
       !  A little clean up at the end: decouple new scalar fields and compute diagnostics for new state
       !
+      call timer_start(&quot;RK4-cleaup phase&quot;)
       block =&gt; domain % blocklist
       do while (associated(block))
 
@@ -277,6 +291,7 @@
          end do
 
          if (config_implicit_vertical_mix) then
+            call timer_start(&quot;RK4-implicit vert mix&quot;)
             allocate(A(nVertLevels),C(nVertLevels),uTemp(nVertLevels), &amp;
                tracersTemp(num_tracers,nVertLevels))
 
@@ -354,10 +369,12 @@
                tracers(:,maxLevelCell(iCell)+1:nVertLevels,iCell) = -1e34
             end do
             deallocate(A,C,uTemp,tracersTemp)
+            call timer_stop(&quot;RK4-implicit vert mix&quot;)
          end if
 
          ! mrp 110725 momentum decay term
          if (config_mom_decay) then
+             call timer_start(&quot;RK4-momentum decay&quot;)
 
             !
             !  Implicit solve for momentum decay
@@ -374,8 +391,10 @@
                end do
             end do
 
+            call timer_stop(&quot;RK4-momentum decay&quot;)
          end if
 
+
          if (config_test_case == 1) then    ! For case 1, wind field should be fixed
             block % state % time_levs(2) % state % u % array(:,:) = block % state % time_levs(1) % state % u % array(:,:)
          end if
@@ -386,12 +405,13 @@
 
          block =&gt; block % next
       end do
+      call timer_stop(&quot;RK4-cleaup phase&quot;)
 
       call deallocate_state(provis)
 
-   end subroutine rk4
+   end subroutine rk4!}}}
 
-   subroutine higdon_timestep(domain, dt)
+   subroutine higdon_timestep(domain, dt)!{{{
    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    ! Advance model state forward in time by the specified time step using 
    !   Higdon timestepping scheme
@@ -432,6 +452,8 @@
       !  Prep variables before first iteration
       !
       !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+      call timer_start(&quot;higdon_timestep&quot;)
       block =&gt; domain % blocklist
       do while (associated(block))
 
@@ -1521,11 +1543,11 @@
 
          block =&gt; block % next
       end do
+      call timer_stop(&quot;higdon_timestep&quot;)
 
-   end subroutine higdon_timestep
+   end subroutine higdon_timestep!}}}
 
-
-   subroutine compute_tend_h(tend, s, d, grid)
+   subroutine compute_tend_h(tend, s, d, grid)!{{{
    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    ! Compute height and normal wind tendencies, as well as diagnostic variables
    !
@@ -1571,6 +1593,8 @@
       real (kind=RKIND), allocatable, dimension(:,:) :: delsq_u
       real (kind=RKIND), allocatable, dimension(:,:) :: delsq_circulation, delsq_vorticity
 
+      call timer_start(&quot;compute_tend_h&quot;)
+
       h           =&gt; s % h % array
       u           =&gt; s % u % array
       v           =&gt; s % v % array
@@ -1630,6 +1654,7 @@
       !
       ! for z-level, only compute height tendency for top layer.
 
+      call timer_start(&quot;compute_tend_h-horiz adv&quot;)
       if (config_vert_grid_type.eq.'isopycnal') then
  
          do iEdge=1,nEdges
@@ -1663,20 +1688,24 @@
          end do
 
       endif ! config_vert_grid_type
+      call timer_stop(&quot;compute_tend_h-horiz adv&quot;)
 
       !
       ! height tendency: vertical advection term -d/dz(hw)
       !
       ! Vertical advection computed for top layer of a z grid only.
+      call timer_start(&quot;compute_tend_h-vert adv&quot;)
       if (config_vert_grid_type.eq.'zlevel') then
         do iCell=1,nCells
            tend_h(1,iCell) =   tend_h(1,iCell) + wTop(2,iCell)
         end do
       endif ! coordinate type
+      call timer_stop(&quot;compute_tend_h-vert adv&quot;)
+      call timer_stop(&quot;compute_tend_h&quot;)
    
-   end subroutine compute_tend_h
+   end subroutine compute_tend_h!}}}
 
-   subroutine compute_tend_u(tend, s, d, grid)
+   subroutine compute_tend_u(tend, s, d, grid)!{{{
    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    ! Compute height and normal wind tendencies, as well as diagnostic variables
    !
@@ -1726,6 +1755,8 @@
       real (kind=RKIND), dimension(:,:), pointer :: u_src
       real (kind=RKIND), parameter :: rho_ref = 1000.0
 
+      call timer_start(&quot;compute_tend_u&quot;)
+
       h           =&gt; s % h % array
       u           =&gt; s % u % array
       v           =&gt; s % v % array
@@ -1787,6 +1818,8 @@
       !
       ! velocity tendency: nonlinear Coriolis term and grad of kinetic energy
       !
+
+      call timer_start(&quot;compute_tend_u-coriolis&quot;)
       do iEdge=1,grid % nEdgesSolve
          cell1 = cellsOnEdge(1,iEdge)
          cell2 = cellsOnEdge(2,iEdge)
@@ -1806,10 +1839,12 @@
 
          end do
       end do
+      call timer_stop(&quot;compute_tend_u-coriolis&quot;)
 
       !
       ! velocity tendency: vertical advection term -w du/dz
       !
+      call timer_start(&quot;compute_tend_u-vert adv&quot;)
       if (config_vert_grid_type.eq.'zlevel') then
         allocate(w_dudzTopEdge(nVertLevels+1))
         w_dudzTopEdge(1) = 0.0
@@ -1835,10 +1870,12 @@
         enddo
         deallocate(w_dudzTopEdge)
       endif
+      call timer_stop(&quot;compute_tend_u-vert adv&quot;)
 
       !
       ! velocity tendency: pressure gradient
       !
+      call timer_start(&quot;compute_tend_u-pressure grad&quot;)
       rho0Inv = 1.0/config_rho0
       if (config_vert_grid_type.eq.'isopycnal') then
         do iEdge=1,grid % nEdgesSolve
@@ -1862,12 +1899,14 @@
 
         enddo
       endif
+      call timer_stop(&quot;compute_tend_u-pressure grad&quot;)
 
       !
       ! velocity tendency: del2 dissipation, </font>
<font color="black">u_2 </font>
<font color="black">abla^2 u
       !   computed as </font>
<font color="black">u( </font>
<font color="black">abla divergence + k \times </font>
<font color="gray">abla vorticity )
       !   strictly only valid for config_h_mom_eddy_visc2 == constant
       !
+      call timer_start(&quot;compute_tend_u-horiz mix&quot;)
       if (config_visc_vorticity_term) then
          visc_vorticity_coef = 1.0
       else
@@ -1875,6 +1914,7 @@
       endif
          
       if ( config_h_mom_eddy_visc2 &gt; 0.0 ) then
+          call timer_start(&quot;compute_tend_u-horiz mix-del2&quot;)
          do iEdge=1,grid % nEdgesSolve
             cell1 = cellsOnEdge(1,iEdge)
             cell2 = cellsOnEdge(2,iEdge)
@@ -1897,6 +1937,7 @@
 
             end do
          end do
+          call timer_stop(&quot;compute_tend_u-horiz mix-del2&quot;)
       end if
 
       !
@@ -1906,6 +1947,7 @@
       !   strictly only valid for config_h_mom_eddy_visc4 == constant
       !
       if ( config_h_mom_eddy_visc4 &gt; 0.0 ) then
+          call timer_start(&quot;compute_tend_u-horiz mix-del4&quot;)
 
          allocate(delsq_divergence(nVertLevels, nCells+1))
          allocate(delsq_u(nVertLevels, nEdges+1))
@@ -1999,7 +2041,9 @@
          deallocate(delsq_circulation)
          deallocate(delsq_vorticity)
 
+          call timer_stop(&quot;compute_tend_u-horiz mix-del4&quot;)
       end if
+      call timer_stop(&quot;compute_tend_u-horiz mix&quot;)
 
       !
       ! velocity tendency: forcing and bottom drag
@@ -2007,6 +2051,7 @@
       ! mrp 101115 note: in order to include flux boundary conditions, we will need to 
       ! know the bottom edge with nonzero velocity and place the drag there.
 
+      call timer_start(&quot;compute_tend_u-forcings&quot;)
       do iEdge=1,grid % nEdgesSolve
 
         k = maxLevelEdgeTop(iEdge)
@@ -2035,11 +2080,13 @@
         endif
 
       enddo
+      call timer_stop(&quot;compute_tend_u-forcings&quot;)
 
       !
       ! velocity tendency: vertical mixing d/dz( nu_v du/dz))
       !
       if (.not.config_implicit_vertical_mix) then
+          call timer_start(&quot;compute_tend_u-explicit vert mix&quot;)
          allocate(fluxVertTop(nVertLevels+1))
          fluxVertTop(1) = 0.0
          do iEdge=1,grid % nEdgesSolve
@@ -2059,11 +2106,13 @@
 
          end do
          deallocate(fluxVertTop)
+          call timer_stop(&quot;compute_tend_u-explicit vert mix&quot;)
       endif
+      call timer_stop(&quot;compute_tend_u&quot;)
 
-   end subroutine compute_tend_u
+   end subroutine compute_tend_u!}}}
 
-   subroutine filter_btr_mode_tend_u(tend, s, d, grid)
+   subroutine filter_btr_mode_tend_u(tend, s, d, grid)!{{{
    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    ! Filter and remove barotropic mode from the tendencies
    !
@@ -2112,6 +2161,8 @@
       real (kind=RKIND), dimension(:,:), pointer :: u_src
       real (kind=RKIND), parameter :: rho_ref = 1000.0
 
+      call timer_start(&quot;filter_btr_mode_tend_u&quot;)
+
       h           =&gt; s % h % array
       u           =&gt; s % u % array
       v           =&gt; s % v % array
@@ -2182,9 +2233,11 @@
 
            enddo ! iEdge
 
-   end subroutine filter_btr_mode_tend_u
+      call timer_stop(&quot;filter_btr_mode_tend_u&quot;)
 
-   subroutine filter_btr_mode_u(s, grid)
+   end subroutine filter_btr_mode_tend_u!}}}
+
+   subroutine filter_btr_mode_u(s, grid)!{{{
    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    ! Filter and remove barotropic mode.
    !
@@ -2231,6 +2284,8 @@
       real (kind=RKIND), dimension(:,:), pointer :: u_src
       real (kind=RKIND), parameter :: rho_ref = 1000.0
 
+      call timer_start(&quot;filter_btr_mode_u&quot;)
+
       h           =&gt; s % h % array
       u           =&gt; s % u % array
       v           =&gt; s % v % array
@@ -2297,9 +2352,11 @@
 
            enddo ! iEdge
 
-   end subroutine filter_btr_mode_u
+      call timer_stop(&quot;filter_btr_mode_u&quot;)
 
-   subroutine compute_f_uperp(s, grid)
+   end subroutine filter_btr_mode_u!}}}
+
+   subroutine compute_f_uperp(s, grid)!{{{
    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    ! Put f*uBcl^{perp} in u as a work variable
    !
@@ -2347,6 +2404,8 @@
       real (kind=RKIND), dimension(:,:), pointer :: u_src
       real (kind=RKIND), parameter :: rho_ref = 1000.0
 
+      call timer_start(&quot;compute_f_uperp&quot;)
+
       h           =&gt; s % h % array
       u           =&gt; s % u % array
       uBcl        =&gt; s % uBcl % array
@@ -2398,6 +2457,7 @@
       do iEdge=1,grid % nEdgesSolve
          cell1 = cellsOnEdge(1,iEdge)
          cell2 = cellsOnEdge(2,iEdge)
+
          do k=1,maxLevelEdgeTop(iEdge)
 
             u(k,iEdge) = 0.0
@@ -2408,9 +2468,11 @@
          end do
       end do
 
-   end subroutine compute_f_uperp
+      call timer_stop(&quot;compute_f_uperp&quot;)
 
-   subroutine compute_scalar_tend(tend, s, d, grid)
+   end subroutine compute_f_uperp!}}}
+
+   subroutine compute_scalar_tend(tend, s, d, grid)!{{{
    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    !
    ! Input: s - current model state
@@ -2459,6 +2521,8 @@
       integer :: index_temperature, index_salinity, rrr
       real (kind=RKIND), dimension(:), pointer :: temperatureRestore, salinityRestore
 
+      call timer_start(&quot;compute_scalar_tend&quot;)
+
       u           =&gt; s % u % array
       h           =&gt; s % h % array
       boundaryCell=&gt; grid % boundaryCell % array
@@ -2514,11 +2578,13 @@
       ! and then change maxLevelEdgeTop to maxLevelEdgeBot in the following section.
       ! tracer_edge at the boundary will also need to be defined for flux boundaries.
 
+      call timer_start(&quot;compute_scalar_tend-horiz adv&quot;)
       coef_3rd_order = 0.
       if (config_tracer_adv_order == 3) coef_3rd_order = 1.0
       if (config_tracer_adv_order == 3 .and. config_monotonic) coef_3rd_order = 0.25
 
       if (config_tracer_adv_order == 2) then
+          call timer_start(&quot;compute_scalar_tend-horiz adv 2&quot;)
 
          do iEdge=1,nEdges
             cell1 = cellsOnEdge(1,iEdge)
@@ -2533,8 +2599,9 @@
             end do
          end do
 
+          call timer_stop(&quot;compute_scalar_tend-horiz adv 2&quot;)
       else if (config_tracer_adv_order == 3) then
-
+          call timer_start(&quot;compute_scalar_tend-horiz adv 3&quot;)
          do iEdge=1,nEdges
             cell1 = cellsOnEdge(1,iEdge)
             cell2 = cellsOnEdge(2,iEdge)
@@ -2586,8 +2653,10 @@
                enddo
             end do
          end do
+          call timer_stop(&quot;compute_scalar_tend-horiz adv 3&quot;)
 
       else if (config_tracer_adv_order == 4) then
+          call timer_start(&quot;compute_scalar_tend-horiz adv 4&quot;)
 
          do iEdge=1,nEdges
             cell1 = cellsOnEdge(1,iEdge)
@@ -2630,14 +2699,17 @@
                enddo
             end do
          end do
+          call timer_stop(&quot;compute_scalar_tend-horiz adv 4&quot;)
 
       endif   ! if (config_tracer_adv_order == 2 )
+      call timer_stop(&quot;compute_scalar_tend-horiz adv&quot;)
 
 
       !
       ! tracer tendency: vertical advection term -d/dz( h \phi w)
       !
 
+      call timer_start(&quot;compute_scalar_tend-vert adv&quot;)
       if (config_vert_grid_type.eq.'zlevel') then
 
          allocate(tracerTop(num_tracers,nVertLevels+1,nCells))
@@ -2655,6 +2727,7 @@
 
          if (config_vert_tracer_adv.eq.'stencil'.and. &amp;
              config_vert_tracer_adv_order.eq.2) then
+             call timer_start(&quot;compute_scalar_tend-vert adv stencil 2&quot;)
 
             ! Compute tracerTop using centered stencil, a simple average.
 
@@ -2668,8 +2741,10 @@
                end do
             end do
          
+             call timer_stop(&quot;compute_scalar_tend-vert adv stencil 2&quot;)
          elseif (config_vert_tracer_adv.eq.'stencil'.and. &amp;
              config_vert_tracer_adv_order.eq.3) then
+             call timer_start(&quot;compute_scalar_tend-vert adv stencil 3&quot;)
 
             ! Compute tracerTop using 3rd order stencil.  This is the same
             ! as 4th order, but includes upwinding.
@@ -2703,8 +2778,10 @@
                   end do
             end do
 
+             call timer_stop(&quot;compute_scalar_tend-vert adv stencil 3&quot;)
          elseif (config_vert_tracer_adv.eq.'stencil'.and. &amp;
              config_vert_tracer_adv_order.eq.4) then
+             call timer_start(&quot;compute_scalar_tend-vert adv stencil 4&quot;)
 
             ! Compute tracerTop using 4rd order stencil [-1 7 7 -1]
 
@@ -2750,9 +2827,11 @@
                end do
             end do
          
+             call timer_stop(&quot;compute_scalar_tend-vert adv stencil 4&quot;)
          elseif (config_vert_tracer_adv.eq.'spline'.and. &amp;
              config_vert_tracer_adv_order.eq.3) then
 
+             call timer_start(&quot;compute_scalar_tend-vert adv spline 3&quot;)
             ! Compute tracerTop using cubic spline interpolation.
 
             allocate(tracer2ndDer(nVertLevels))
@@ -2788,6 +2867,7 @@
 
             deallocate(tracer2ndDer)
             deallocate(tracersIn,tracersOut, posZMidZLevel, posZTopZLevel)
+             call timer_stop(&quot;compute_scalar_tend-vert adv spline 3&quot;)
 
         else
 
@@ -2813,11 +2893,14 @@
          deallocate(tracerTop)
 
       endif ! ZLevel
+      call timer_stop(&quot;compute_scalar_tend-vert adv&quot;)
 
       !
       ! tracer tendency: del2 horizontal tracer diffusion, div(h \kappa_2 </font>
<font color="gray">abla \phi)
       !
+      call timer_start(&quot;compute_scalar_tend-horiz diff&quot;)
       if ( config_h_tracer_eddy_diff2 &gt; 0.0 ) then
+          call timer_start(&quot;compute_scalar_tend-horiz diff 2&quot;)
 
          !
          ! compute a boundary mask to enforce insulating boundary conditions in the horizontal
@@ -2850,6 +2933,7 @@
          end do
 
         deallocate(boundaryMask)
+        call timer_stop(&quot;compute_scalar_tend-horiz diff 2&quot;)
 
       end if
 
@@ -2858,6 +2942,7 @@
       !    div(h \kappa_4 </font>
<font color="black">abla [div(h </font>
<font color="gray">abla \phi)])
       !
       if ( config_h_tracer_eddy_diff4 &gt; 0.0 ) then
+          call timer_start(&quot;compute_scalar_tend-horiz diff 4&quot;)
 
          !
          ! compute a boundary mask to enforce insulating boundary conditions in the horizontal
@@ -2923,8 +3008,10 @@
          end do
 
          deallocate(delsq_tracer)
+          call timer_stop(&quot;compute_scalar_tend-horiz diff 4&quot;)
 
       end if
+      call timer_stop(&quot;compute_scalar_tend-horiz diff&quot;)
 
 ! mrp 110516 printing
 !print *, 'tend_tr 1',minval(tend_tr(3,1,1:nCells)),&amp;
@@ -2937,6 +3024,7 @@
       ! tracer tendency: vertical diffusion h d/dz( \kappa_v d\phi/dz)
       !
       if (.not.config_implicit_vertical_mix) then
+         call timer_start(&quot;compute_scalar_tend-explicit vert diff&quot;)
          allocate(fluxVertTop(num_tracers,nVertLevels+1))
          fluxVertTop(:,1) = 0.0
          do iCell=1,nCellsSolve 
@@ -2966,6 +3054,7 @@
 
          enddo ! iCell loop
          deallocate(fluxVertTop)
+         call timer_stop(&quot;compute_scalar_tend-explicit vert diff&quot;)
       endif
 
 ! mrp 110516 printing
@@ -2977,8 +3066,10 @@
       ! add restoring to T and S in top model layer
       !
       if(config_restoreTS) then
+         call timer_start(&quot;compute_scalar_tend-restoring&quot;)
          k = 1  ! restoring only in top layer
          do iCell=1,nCellsSolve
+
            tend_tr(index_temperature, k, iCell) = tend_tr(index_temperature, k, iCell)  &amp;
                 - h(k,iCell)*(tracers(index_temperature, k, iCell) - temperatureRestore(iCell)) &amp;
                 / (config_restoreT_timescale * 86400.0)
@@ -2994,13 +3085,14 @@
 
          enddo
 
+         call timer_stop(&quot;compute_scalar_tend-restoring&quot;)
       endif
  10   format(2i8,10e20.10)
+      call timer_stop(&quot;compute_scalar_tend&quot;)
 
-   end subroutine compute_scalar_tend
+   end subroutine compute_scalar_tend!}}}
 
-
-   subroutine compute_solve_diagnostics(dt, s, grid)
+   subroutine compute_solve_diagnostics(dt, s, grid)!{{{
    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    ! Compute diagnostic fields used in the tendency computations
    !
@@ -3046,6 +3138,8 @@
       real (kind=RKIND) :: coef_3rd_order
       real (kind=RKIND) :: r, h1, h2
 
+      call timer_start(&quot;compute_solve_diagnostics&quot;)
+
       h           =&gt; s % h % array
       u           =&gt; s % u % array
       v           =&gt; s % v % array
@@ -3110,11 +3204,14 @@
       ! mrp 110516 efficiency note: For z-level, only do this on level 1.  h_edge for all
       ! lower levels is defined by hZlevel.
 
+      call timer_start(&quot;compute_solve_diagnostics-hEdge&quot;)
+
       coef_3rd_order = 0.
       if (config_thickness_adv_order == 3) coef_3rd_order = 1.0
       if (config_thickness_adv_order == 3 .and. config_monotonic) coef_3rd_order = 0.25
 
       if (config_thickness_adv_order == 2) then
+          call timer_start(&quot;compute_solve_diagnostics-hEdge 2&quot;)
 
          do iEdge=1,nEdges
             cell1 = cellsOnEdge(1,iEdge)
@@ -3123,8 +3220,10 @@
                h_edge(k,iEdge) = 0.5 * (h(k,cell1) + h(k,cell2))
             end do
          end do
+          call timer_stop(&quot;compute_solve_diagnostics-hEdge 2&quot;)
 
       else if (config_thickness_adv_order == 3) then
+          call timer_start(&quot;compute_solve_diagnostics-hEdge 3&quot;)
 
          do iEdge=1,nEdges
             cell1 = cellsOnEdge(1,iEdge)
@@ -3172,7 +3271,9 @@
             end do   ! do k
          end do         ! do iEdge
 
+          call timer_stop(&quot;compute_solve_diagnostics-hEdge 3&quot;)
       else  if (config_thickness_adv_order == 4) then
+          call timer_start(&quot;compute_solve_diagnostics-hEdge 4&quot;)
 
          do iEdge=1,nEdges
             cell1 = cellsOnEdge(1,iEdge)
@@ -3210,7 +3311,9 @@
             end do   ! do k
          end do         ! do iEdge
 
+         call timer_stop(&quot;compute_solve_diagnostics-hEdge 4&quot;)
       endif   ! if(config_thickness_adv_order == 2)
+      call timer_stop(&quot;compute_solve_diagnostics-hEdge&quot;)
 
       !
       ! set the velocity and height at dummy address
@@ -3468,11 +3571,11 @@
 
       call compute_wtop(s,grid)
 
+      call timer_stop(&quot;compute_solve_diagnostics&quot;)
 
-   end subroutine compute_solve_diagnostics
+   end subroutine compute_solve_diagnostics!}}}
 
-
-   subroutine compute_wtop(s, grid)
+   subroutine compute_wtop(s, grid)!{{{
    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    ! Compute diagnostic fields used in the tendency computations
    !
@@ -3506,6 +3609,7 @@
         maxLevelCell, maxLevelEdgeTop, maxLevelEdgeBot, &amp;
         maxLevelVertexBot,  maxLevelVertexTop
 
+        call timer_start(&quot;wTop&quot;)
 
       u           =&gt; s % u % array
       wTop        =&gt; s % wTop % array
@@ -3560,9 +3664,11 @@
 
       endif
 
-   end subroutine compute_wtop
+      call timer_stop(&quot;wTop&quot;)
 
-   subroutine compute_vertical_mix_coefficients(s, d, grid)
+   end subroutine compute_wtop!}}}
+
+   subroutine compute_vertical_mix_coefficients(s, d, grid)!{{{
    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    ! Compute diagnostic fields used in the tendency computations
    !
@@ -3606,6 +3712,8 @@
       real (kind=RKIND) :: coef_3rd_order
       real (kind=RKIND) :: r, h1, h2
 
+      call timer_start(&quot;compute_vertical_mix_coefficients&quot;)
+
       rho =&gt; s % rho % array
       rhoDisplaced =&gt; s % rhoDisplaced % array
       u           =&gt; s % u % array
@@ -3854,10 +3962,10 @@
 
    endif
 
-   end subroutine compute_vertical_mix_coefficients
+   call timer_stop(&quot;compute_vertical_mix_coefficients&quot;)
+   end subroutine compute_vertical_mix_coefficients!}}}
 
-
-   subroutine enforce_boundaryEdge(tend, grid)
+   subroutine enforce_boundaryEdge(tend, grid)!{{{
    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    ! Enforce any boundary conditions on the normal velocity at each edge
    !
@@ -3877,6 +3985,8 @@
       integer :: nCells, nEdges, nVertices, nVertLevels
       integer :: iEdge, k
 
+      call timer_start(&quot;enforce_boundaryEdge&quot;)
+
       nCells      = grid % nCells
       nEdges      = grid % nEdges
       nVertices   = grid % nVertices
@@ -3896,11 +4006,11 @@
 
         enddo
        enddo
+      call timer_stop(&quot;enforce_boundaryEdge&quot;)
 
-   end subroutine enforce_boundaryEdge
+   end subroutine enforce_boundaryEdge!}}}
 
-
-   subroutine equation_of_state(s, grid, k_displaced, displacement_type)
+   subroutine equation_of_state(s, grid, k_displaced, displacement_type)!{{{
    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    !  This module contains routines necessary for computing the density
    !  from model temperature and salinity using an equation of state.
@@ -3928,6 +4038,8 @@
       integer :: nCells, iCell, k
       type (dm_info) :: dminfo
 
+      call timer_start(&quot;equation_of_state&quot;)
+
       if (config_eos_type.eq.'linear') then
 
          rho         =&gt; s % rho % array
@@ -3954,10 +4066,11 @@
          call dmpar_abort(dminfo)
       endif
 
-   end subroutine equation_of_state
+      call timer_stop(&quot;equation_of_state&quot;)
 
+   end subroutine equation_of_state!}}}
 
-   subroutine equation_of_state_jm(s, grid, k_displaced, displacement_type)
+   subroutine equation_of_state_jm(s, grid, k_displaced, displacement_type)!{{{
    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    !  This module contains routines necessary for computing the density
    !  from model temperature and salinity using an equation of state.
@@ -4089,6 +4202,8 @@
 
    integer :: k_test, k_ref
 
+      call timer_start(&quot;equation_of_state_jm&quot;)
+
       tracers     =&gt; s % tracers % array
 
       nCells      = grid % nCells
@@ -4206,10 +4321,11 @@
 
    deallocate(pRefEOS,p,p2)
 
-   end subroutine equation_of_state_jm
+   call timer_stop(&quot;equation_of_state_jm&quot;)
 
+   end subroutine equation_of_state_jm!}}}
 
-subroutine tridiagonal_solve(a,b,c,r,x,n)
+subroutine tridiagonal_solve(a,b,c,r,x,n)!{{{
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 ! Solve the matrix equation Ax=r for x, where A is tridiagonal.
 ! A is an nxn matrix, with:
@@ -4230,6 +4346,8 @@
    real (KIND=RKIND), dimension(n) :: bTemp,rTemp
    real (KIND=RKIND) :: m
    integer i
+
+   call timer_start(&quot;tridiagonal_solve&quot;)
  
    ! Use work variables for b and r
    bTemp(1) = b(1)
@@ -4247,11 +4365,12 @@
    do i = n-1, 1, -1
       x(i) = (rTemp(i) - c(i)*x(i+1))/bTemp(i)
    end do
+
+   call timer_stop(&quot;tridiagonal_solve&quot;)
  
-end subroutine tridiagonal_solve
+end subroutine tridiagonal_solve!}}}
 
-
-subroutine tridiagonal_solve_mult(a,b,c,r,x,n,nDim,nSystems)
+subroutine tridiagonal_solve_mult(a,b,c,r,x,n,nDim,nSystems)!{{{
 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 ! Solve the matrix equation Ax=r for x, where A is tridiagonal.
 ! A is an nxn matrix, with:
@@ -4274,6 +4393,8 @@
    real (KIND=RKIND), dimension(nSystems,n) :: rTemp
    real (KIND=RKIND) :: m
    integer i,j
+
+   call timer_start(&quot;tridiagonal_solve_mult&quot;)
  
    ! Use work variables for b and r
    bTemp(1) = b(1)
@@ -4300,7 +4421,10 @@
       end do
    end do
  
-end subroutine tridiagonal_solve_mult
+   call timer_stop(&quot;tridiagonal_solve_mult&quot;)
 
+end subroutine tridiagonal_solve_mult!}}}
 
 end module time_integration
+
+!:vim foldmethod=marker

</font>
</pre>