<p><b>dwj07@fsu.edu</b> 2013-01-23 14:31:39 -0700 (Wed, 23 Jan 2013)</p><p><br>
        -- BRANCH COMMIT --<br>
<br>
        General cleanup, and some small bug fixes for CESM coupled ocean core.<br>
</p><hr noshade><pre><font color="gray">Modified: branches/ocean_projects/generic_forcing/src/core_ocean/Registry
===================================================================
--- branches/ocean_projects/generic_forcing/src/core_ocean/Registry        2013-01-23 16:28:12 UTC (rev 2391)
+++ branches/ocean_projects/generic_forcing/src/core_ocean/Registry        2013-01-23 21:31:39 UTC (rev 2392)
@@ -337,31 +337,31 @@
 
 #ifdef MPAS_CESM
 % Coupler input fields, for coupled runs
-var persistent real    meridionalWindStress ( nCells Time ) 2 - meridionalWindStress state - -
-var persistent real    zonalWindStress ( nCells Time ) 2 - zonalWindStress state - -
-var persistent real    latentHeatFlux ( nCells Time ) 2 - latentHeatFlux state - -
-var persistent real    sensibleHeatFlux ( nCells Time ) 2 - sensibleHeatFlux state - -
-var persistent real    longWaveHeatFluxUp ( nCells Time ) 2 - longWaveHeatFluxUp state - -
-var persistent real    longWaveHeatFluxDown ( nCells Time ) 2 - longWaveHeatFluxDown state - -
-var persistent real    evaporationFlux ( nCells Time ) 2 - evaporationFlux state - -
-var persistent real    seaIceHeatFlux ( nCells Time ) 2 - seaIceHeatFlux state - -
-var persistent real    snowFlux ( nCells Time ) 2 - snowFlux state - -
-var persistent real    seaIceFreshWaterFlux ( nCells Time ) 2 - seaIceFreshWaterFlux state - -
-var persistent real    seaIceSalinityFlux ( nCells Time ) 2 - seaIceSalinityFlux state - -
-var persistent real    riverRunoffFlux ( nCells Time ) 2 - riverRunoffFlux state - -
-var persistent real    iceRunoffFlux ( nCells Time ) 2 - iceRunoffFlux state - -
-var persistent real    shortWaveHeatFlux ( nCells Time ) 2 - shortWaveHeatFlux state - -
-var persistent real    rainFlux ( nCells Time ) 2 - rainFlux state - -
-var persistent real    iceFraction ( nCells Time ) 2 - iceFraction state - -
-var persistent real    prognosticCO2 ( nCells Time ) 2 - prognosticCO2 state - -
-var persistent real    diagnosticCO2 ( nCells Time ) 2 - diagnosticCO2 state - -
-var persistent real    squaredWindSpeed10Meter ( nCells Time ) 2 - squaredWindSpeed10Meter state - -
+var persistent real    meridionalWindStress ( nCells Time ) 2 o meridionalWindStress state - -
+var persistent real    zonalWindStress ( nCells Time ) 2 o zonalWindStress state - -
+var persistent real    latentHeatFlux ( nCells Time ) 2 o latentHeatFlux state - -
+var persistent real    sensibleHeatFlux ( nCells Time ) 2 o sensibleHeatFlux state - -
+var persistent real    longWaveHeatFluxUp ( nCells Time ) 2 o longWaveHeatFluxUp state - -
+var persistent real    longWaveHeatFluxDown ( nCells Time ) 2 o longWaveHeatFluxDown state - -
+var persistent real    evaporationFlux ( nCells Time ) 2 o evaporationFlux state - -
+var persistent real    seaIceHeatFlux ( nCells Time ) 2 o seaIceHeatFlux state - -
+var persistent real    snowFlux ( nCells Time ) 2 o snowFlux state - -
+var persistent real    seaIceFreshWaterFlux ( nCells Time ) 2 o seaIceFreshWaterFlux state - -
+var persistent real    seaIceSalinityFlux ( nCells Time ) 2 o seaIceSalinityFlux state - -
+var persistent real    riverRunoffFlux ( nCells Time ) 2 o riverRunoffFlux state - -
+var persistent real    iceRunoffFlux ( nCells Time ) 2 o iceRunoffFlux state - -
+var persistent real    shortWaveHeatFlux ( nCells Time ) 2 o shortWaveHeatFlux state - -
+var persistent real    rainFlux ( nCells Time ) 2 o rainFlux state - -
+var persistent real    iceFraction ( nCells Time ) 2 o iceFraction state - -
+var persistent real    prognosticCO2 ( nCells Time ) 2 o prognosticCO2 state - -
+var persistent real    diagnosticCO2 ( nCells Time ) 2 o diagnosticCO2 state - -
+var persistent real    squaredWindSpeed10Meter ( nCells Time ) 2 o squaredWindSpeed10Meter state - -
 
 % Coupler output fields, for coupled runs
 var persistent real    nAccumulateCoupled ( Time ) 2 o nAccumulateCoupled state - -
-var persistent real    surfaceMeltHeatFlux ( nCells Time ) 2 - surfaceMeltHeatFlux state - -
-var persistent real    temperatureState ( nCells Time ) 2 - temperatureState state - -
-var persistent real    salinityState ( nCells Time ) 2 - salinityState state - -
+var persistent real    surfaceMeltHeatFlux ( nCells Time ) 2 o surfaceMeltHeatFlux state - -
+var persistent real    temperatureState ( nCells Time ) 2 o temperatureState state - -
+var persistent real    salinityState ( nCells Time ) 2 o salinityState state - -
 var persistent real    zonalVelocityState ( nCells Time ) 2 - zonalVelocityState state - -
 var persistent real    meridionalVelocityState ( nCells Time ) 2 - meridionalVelocityState state - -
 var persistent real    zonalSSHGradientState ( nCells Time ) 2 - zonalSSHGradientState state - -

Modified: branches/ocean_projects/generic_forcing/src/core_ocean/mpas_ocn_time_average_coupled.F
===================================================================
--- branches/ocean_projects/generic_forcing/src/core_ocean/mpas_ocn_time_average_coupled.F        2013-01-23 16:28:12 UTC (rev 2391)
+++ branches/ocean_projects/generic_forcing/src/core_ocean/mpas_ocn_time_average_coupled.F        2013-01-23 21:31:39 UTC (rev 2392)
@@ -28,6 +28,9 @@
 
         nAccumulateCoupled = 0
 
+!       temperatureState = state % tracers % array(state % index_temperature, 1, :) + T0_Kelvin
+!       salinityState = state % tracers % array(state % index_salinity, 1, :)
+
         temperatureState = 0.0_RKIND
         salinityState = 0.0_RKIND
         meridionalVelocityState = 0.0_RKIND
@@ -80,7 +83,7 @@
         old_meridionalSSHGradientState =&gt; old_state % meridionalSSHGradientState % array
         old_zonalSSHGradientState =&gt; old_state % zonalSSHGradientState % array
 
-        temperatureState = old_temperatureState + (tracers(index_temperature, 1, :) + T0_Kelvin)
+        temperatureState = old_temperatureState + tracers(index_temperature, 1, :) + T0_Kelvin
         salinityState = old_salinityState + tracers(index_salinity, 1, :)
         meridionalVelocityState = old_meridionalVelocityState + uReconstructMeridional(1,:)
         zonalVelocityState = old_zonalVelocityState + uReconstructZonal(1,:)

Modified: branches/ocean_projects/generic_forcing/src/ocean_cesm_driver/ocn_comp_mct.F
===================================================================
--- branches/ocean_projects/generic_forcing/src/ocean_cesm_driver/ocn_comp_mct.F        2013-01-23 16:28:12 UTC (rev 2391)
+++ branches/ocean_projects/generic_forcing/src/ocean_cesm_driver/ocn_comp_mct.F        2013-01-23 21:31:39 UTC (rev 2392)
@@ -97,8 +97,10 @@
   subroutine ocn_init_mct( EClock, cdata_o, x2o_o, o2x_o, NLFilename )!{{{
 !
 ! !DESCRIPTION:
-! Initialize POP 
+! Initialize MPAS-O 
 !
+
+    use ocn_time_average_coupled
 ! !INPUT/OUTPUT PARAMETERS:
 
     type(ESMF_Clock), intent(in) :: EClock
@@ -297,6 +299,13 @@
     alarmStartTime = currTime
     call mpas_add_clock_alarm(clock, coupleAlarmID, alarmStartTime, alarmTimeStep, ierr=ierr)
 
+    block_ptr =&gt; domain % blocklist
+    do while(associated(block_ptr))
+      call ocn_time_average_coupled_init(block_ptr % state % time_levs(1) % state)
+      call ocn_time_average_coupled_accumulate(block_ptr % state % time_levs(1) % state, block_ptr % state % time_levs(1) % state)
+      block_ptr =&gt; block_ptr % next
+    end do
+
 !-----------------------------------------------------------------------
 !
 !  send intial state to driver
@@ -308,6 +317,8 @@
 !     call seq_infodata_PutData( infodata, precip_fact=precadj)
 !  end if
 
+!  call seq_infodata_PutData(infodata, precip_fact=1.0e6_R8)
+!  call seq_infodata_PutData(infodata, flux_epbalfact=1.0)
    call ocn_export_mct(o2x_o, errorCode)  
    if (errorCode /= 0) then
       call mpas_dmpar_global_abort('ERROR in ocn_export_mct')
@@ -324,10 +335,10 @@
 !
 !-----------------------------------------------------------------------
 
-   call ocn_import_mct(x2o_o, errorCode)  
-   if (errorCode /= 0) then
-      call mpas_dmpar_global_abort('ERROR in ocn_import_mct')
-   endif
+!  call ocn_import_mct(x2o_o, errorCode)  
+!  if (errorCode /= 0) then
+!     call mpas_dmpar_global_abort('ERROR in ocn_import_mct')
+!  endif
 
 !----------------------------------------------------------------------------
 !
@@ -407,7 +418,7 @@
     use mpas_grid_types
     use mpas_io_output
     use mpas_timer
-    use mpas_ocn_time_average_coupled
+    use ocn_time_average_coupled
 
     implicit none
 !
@@ -474,12 +485,13 @@
 
       ! Eventually, dt should be domain specific
       dt = config_dt
+      call mpas_reset_clock_alarm(clock, coupleAlarmID, ierr=ierr)
 
       currTime = mpas_get_clock_time(clock, MPAS_NOW, ierr)
 
       block_ptr =&gt; domain % blocklist
       do while(associated(block_ptr))
-        call ocn_time_average_init_coupled(block_ptr % state % time_levs(1) % state)
+        call ocn_time_average_coupled_init(block_ptr % state % time_levs(1) % state)
         block_ptr =&gt; block_ptr % next
       end do
 
@@ -545,10 +557,16 @@
          end if
       end do
 
-      if (mpas_is_alarm_ringing(clock, coupleAlarmID, ierr=ierr)) then
+      block_ptr =&gt; domain % blocklist
+      do while(associated(block_ptr))
+        call ocn_time_average_coupled_normalize(block_ptr % state % time_levs(1) % state)
+        block_ptr =&gt; block_ptr % next
+      end do
+
+!     if (mpas_is_alarm_ringing(clock, coupleAlarmID, ierr=ierr)) then
          call ocn_export_mct(o2x_o, ierr)
-         call mpas_reset_clock_alarm(clock, coupleAlarmID, ierr=ierr)
-      end if
+!        call mpas_reset_clock_alarm(clock, coupleAlarmID, ierr=ierr)
+!     end if
 
       currTime = mpas_get_clock_time(clock, MPAS_NOW, ierr)
       call mpas_get_time(curr_time=currTime, YYYY=iyear, MM=imonth, DD=iday, H=ihour, M=iminute, S=isecond, ierr=ierr)
@@ -562,27 +580,6 @@
          write(0,*) 'Internal mpas clock not in sync with sync clock'
       end if
 
-
-
-!!--------------------------------------------------------------------
-!!
-!! check that internal clock is in sync with master clock
-!!
-!!--------------------------------------------------------------------
-!
-!    ymd = iyear*10000 + imonth*100 + iday
-!    tod = ihour*seconds_in_hour + iminute*seconds_in_minute + isecond
-!    if ( .not. seq_timemgr_EClockDateInSync( EClock, ymd, tod ) )then
-!       call seq_timemgr_EClockGetData( EClock, curr_ymd=ymd_sync, &amp;
-!          curr_tod=tod_sync )
-!       write(stdout,*)' pop2 ymd=',ymd     ,'  pop2 tod= ',tod
-!       write(stdout,*)' sync ymd=',ymd_sync,'  sync tod= ',tod_sync
-!       write(stdout,*)' Internal pop2 clock not in sync with Sync Clock'
-!       call shr_sys_abort( SubName// &amp;
-!          &quot;:: Internal pop2 clock not in sync with Sync Clock&quot;)
-!    end if
-!   
-
 !-----------------------------------------------------------------------
 !EOC
 
@@ -957,9 +954,29 @@
             call shr_sys_abort ('Error: incoming IOFF_F is negative')
         end if
       end do
+
+!  write(0,*) 'MWS MIN MAX', minval(block_ptr % state % time_levs(1) % state % meridionalWindStress % array), maxval(block_ptr % state % time_levs(1) % state % meridionalWindStress % array)
+!  write(0,*) 'ZWS MIN MAX', minval(block_ptr % state % time_levs(1) % state % zonalWindStress % array), maxval(block_ptr % state % time_levs(1) % state % zonalWindStress % array)
+!  write(0,*) 'LHF MIN MAX', minval(block_ptr % state % time_levs(1) % state % latentHeatFlux % array), maxval(block_ptr % state % time_levs(1) % state % latentHeatFlux % array)
+!  write(0,*) 'SHF MIN MAX', minval(block_ptr % state % time_levs(1) % state % sensibleHeatFlux % array), maxval(block_ptr % state % time_levs(1) % state % sensibleHeatFlux % array)
+!  write(0,*) 'LWU MIN MAX', minval(block_ptr % state % time_levs(1) % state % longWaveHeatFluxUp % array), maxval(block_ptr % state % time_levs(1) % state % longWaveHeatFluxUp % array)
+!  write(0,*) 'LWD MIN MAX', minval(block_ptr % state % time_levs(1) % state % longWaveHeatFluxDown % array), maxval(block_ptr % state % time_levs(1) % state % longWaveHeatFluxDown % array)
+!  write(0,*) 'EVP MIN MAX', minval(block_ptr % state % time_levs(1) % state % evaporationFlux % array), maxval(block_ptr % state % time_levs(1) % state % evaporationFlux % array)
+!  write(0,*) 'SIH MIN MAX', minval(block_ptr % state % time_levs(1) % state % seaIceHeatFlux % array), maxval(block_ptr % state % time_levs(1) % state % seaIceHeatFlux % array)
+!  write(0,*) 'SNF MIN MAX', minval(block_ptr % state % time_levs(1) % state % snowFlux % array), maxval(block_ptr % state % time_levs(1) % state % snowFlux % array)
+!  write(0,*) 'SIF MIN MAX', minval(block_ptr % state % time_levs(1) % state % seaIceFreshWaterFlux % array), maxval(block_ptr % state % time_levs(1) % state % seaIceFreshWaterFlux % array)
+!  write(0,*) 'SIS MIN MAX', minval(block_ptr % state % time_levs(1) % state % seaIceSalinityFlux % array), maxval(block_ptr % state % time_levs(1) % state % seaIceSalinityFlux % array)
+!  write(0,*) 'RRF MIN MAX', minval(block_ptr % state % time_levs(1) % state % riverRunoffFlux % array), maxval(block_ptr % state % time_levs(1) % state % riverRunoffFlux % array)
+!  write(0,*) 'IRF MIN MAX', minval(block_ptr % state % time_levs(1) % state % iceRunoffFlux % array), maxval(block_ptr % state % time_levs(1) % state % iceRunoffFlux % array)
+!  write(0,*) 'SWF MIN MAX', minval(block_ptr % state % time_levs(1) % state % shortWaveHeatFlux % array), maxval(block_ptr % state % time_levs(1) % state % shortWaveHeatFlux % array)
+!  write(0,*) 'RAF MIN MAX', minval(block_ptr % state % time_levs(1) % state % rainFlux % array), maxval(block_ptr % state % time_levs(1) % state % rainFlux % array)
+!  write(0,*) 'SLP MIN MAX', minval(block_ptr % state % time_levs(1) % state % seaLevelPressure % array), maxval(block_ptr % state % time_levs(1) % state % seaLevelPressure % array)
+!  write(0,*) 'IFC MIN MAX', minval(block_ptr % state % time_levs(1) % state % iceFraction % array), maxval(block_ptr % state % time_levs(1) % state % iceFraction % array)
+
       block_ptr =&gt; block_ptr % next
    end do
 
+
    call mpas_dmpar_exch_halo_field(domain % blocklist % state % time_levs(1) % state % meridionalWindStress)
    call mpas_dmpar_exch_halo_field(domain % blocklist % state % time_levs(1) % state % zonalWindStress)
    call mpas_dmpar_exch_halo_field(domain % blocklist % state % time_levs(1) % state % latentHeatFlux)
@@ -981,6 +998,39 @@
    call mpas_dmpar_exch_halo_field(domain % blocklist % state % time_levs(1) % state % diagnosticCO2)
    call mpas_dmpar_exch_halo_field(domain % blocklist % state % time_levs(1) % state % squaredWindSpeed10Meter)
 
+   block_ptr =&gt; domain % blocklist
+   do while(associated(block_ptr))
+      do i = 1, block_ptr % mesh % nCellsSolve
+        block_ptr % state % time_levs(2) % state % zonalWindStress % array(i) = block_ptr % state % time_levs(1) % state % zonalWindStress % array(i) 
+        block_ptr % state % time_levs(2) % state % meridionalWindStress % array(i) = block_ptr % state % time_levs(1) % state % meridionalWindStress % array(i) 
+
+        block_ptr % state % time_levs(2) % state % latentHeatFlux % array(i) = block_ptr % state % time_levs(1) % state % latentHeatFlux % array(i) 
+        block_ptr % state % time_levs(2) % state % sensibleHeatFlux % array(i) = block_ptr % state % time_levs(1) % state % sensibleHeatFlux % array(i) 
+        block_ptr % state % time_levs(2) % state % longWaveHeatFluxUp % array(i) = block_ptr % state % time_levs(1) % state % longWaveHeatFluxUp % array(i) 
+        block_ptr % state % time_levs(2) % state % longWaveHeatFluxDown % array(i) = block_ptr % state % time_levs(1) % state % longWaveHeatFluxDown % array(i) 
+        block_ptr % state % time_levs(2) % state % evaporationFlux % array(i) = block_ptr % state % time_levs(1) % state % evaporationFlux % array(i) 
+        block_ptr % state % time_levs(2) % state % seaIceHeatFlux % array(i) = block_ptr % state % time_levs(1) % state % seaIceHeatFlux % array(i) 
+        block_ptr % state % time_levs(2) % state % snowFlux % array(i) = block_ptr % state % time_levs(1) % state % snowFlux % array(i) 
+
+        block_ptr % state % time_levs(2) % state % seaIceFreshWaterFlux % array(i) = block_ptr % state % time_levs(1) % state % seaIceFreshWaterFlux % array(i) 
+        block_ptr % state % time_levs(2) % state % seaIceSalinityFlux % array(i) = block_ptr % state % time_levs(1) % state % seaIceSalinityFlux % array(i) 
+        block_ptr % state % time_levs(2) % state % riverRunoffFlux % array(i) = block_ptr % state % time_levs(1) % state % riverRunoffFlux % array(i) 
+        block_ptr % state % time_levs(2) % state % iceRunoffFlux % array(i) = block_ptr % state % time_levs(1) % state % iceRunoffFlux % array(i) 
+
+        block_ptr % state % time_levs(2) % state % shortWaveHeatFlux % array(i) = block_ptr % state % time_levs(1) % state % shortWaveHeatFlux % array(i) 
+
+        block_ptr % state % time_levs(2) % state % rainFlux % array(i) = block_ptr % state % time_levs(1) % state % rainFlux % array(i) 
+        block_ptr % state % time_levs(2) % state % seaLevelPressure % array(i) = block_ptr % state % time_levs(1) % state % seaLevelPressure % array(i) 
+        block_ptr % state % time_levs(2) % state % iceFraction % array(i) = block_ptr % state % time_levs(1) % state % iceFraction % array(i) 
+
+        block_ptr % state % time_levs(2) % state % prognosticCO2 % array(i) = block_ptr % state % time_levs(1) % state % prognosticCO2 % array(i) 
+        block_ptr % state % time_levs(2) % state % diagnosticCO2 % array(i) = block_ptr % state % time_levs(1) % state % diagnosticCO2 % array(i) 
+        block_ptr % state % time_levs(2) % state % squaredWindSpeed10Meter % array(i) = block_ptr % state % time_levs(1) % state % squaredWindSpeed10Meter % array(i) 
+      end do
+      block_ptr =&gt; block_ptr % next
+   end do
+
+
 !-----------------------------------------------------------------------
 !EOC
 

</font>
</pre>