<p><b>mpetersen@lanl.gov</b> 2012-05-07 11:01:45 -0600 (Mon, 07 May 2012)</p><p>Merged monthly_forcing branch to trunk.  In order to use this, set config_use_monthly_forcing=.true. and fill in values in the grid or restart file of windStressMonthly, temperatureRestoreMonthly, salinityRestoreMonthly.<br>
</p><hr noshade><pre><font color="gray">
Property changes on: trunk/mpas
___________________________________________________________________
Modified: svn:mergeinfo
   - /branches/atmos_physics:1672-1846
/branches/cam_mpas_nh:1260-1270
/branches/ocean_projects/ale_split_exp:1437-1483
/branches/ocean_projects/ale_vert_coord:1225-1383
/branches/ocean_projects/ale_vert_coord_new:1387-1428
/branches/ocean_projects/gmvar:1214-1514,1517-1738
/branches/ocean_projects/imp_vert_mix_mrp:754-986
/branches/ocean_projects/monotonic_advection:1499-1640
/branches/ocean_projects/split_explicit_mrp:1134-1138
/branches/ocean_projects/split_explicit_timestepping:1044-1097
/branches/ocean_projects/vert_adv_mrp:704-745
/branches/ocean_projects/zstar_restart_new:1762-1770
/branches/omp_blocks/block_decomp:1374-1569
/branches/omp_blocks/ddt_reorg:1301-1414
/branches/omp_blocks/halo:1570-1638
/branches/omp_blocks/io:1639-1787
/branches/source_renaming:1082-1113
/branches/time_manager:924-962
   + /branches/atmos_physics:1672-1846
/branches/cam_mpas_nh:1260-1270
/branches/ocean_projects/ale_split_exp:1437-1483
/branches/ocean_projects/ale_vert_coord:1225-1383
/branches/ocean_projects/ale_vert_coord_new:1387-1428
/branches/ocean_projects/gmvar:1214-1514,1517-1738
/branches/ocean_projects/imp_vert_mix_mrp:754-986
/branches/ocean_projects/monotonic_advection:1499-1640
/branches/ocean_projects/monthly_forcing:1810-1867
/branches/ocean_projects/split_explicit_mrp:1134-1138
/branches/ocean_projects/split_explicit_timestepping:1044-1097
/branches/ocean_projects/vert_adv_mrp:704-745
/branches/ocean_projects/zstar_restart_new:1762-1770
/branches/omp_blocks/block_decomp:1374-1569
/branches/omp_blocks/ddt_reorg:1301-1414
/branches/omp_blocks/halo:1570-1638
/branches/omp_blocks/io:1639-1787
/branches/source_renaming:1082-1113
/branches/time_manager:924-962

Modified: trunk/mpas/src/core_ocean/Makefile
===================================================================
--- trunk/mpas/src/core_ocean/Makefile        2012-05-07 16:54:18 UTC (rev 1868)
+++ trunk/mpas/src/core_ocean/Makefile        2012-05-07 17:01:45 UTC (rev 1869)
@@ -53,7 +53,8 @@
            mpas_ocn_equation_of_state_jm.o \
            mpas_ocn_equation_of_state_linear.o \
        mpas_ocn_global_diagnostics.o \
-           mpas_ocn_time_average.o
+           mpas_ocn_time_average.o \
+           mpas_ocn_monthly_forcing.o
 
 all: core_hyd
 
@@ -166,11 +167,13 @@
 
 mpas_ocn_equation_of_state_linear.o:
 
+mpas_ocn_monthly_forcing.o:
+
 mpas_ocn_mpas_core.o: mpas_ocn_mpas_core.o \
                                   mpas_ocn_test_cases.o \
                                           mpas_ocn_advection.o \
                                           mpas_ocn_thick_hadv.o \
-                                          mpas_ocn_gm.o \
+                      mpas_ocn_gm.o \
                                           mpas_ocn_thick_vadv.o \
                                           mpas_ocn_vel_coriolis.o \
                                           mpas_ocn_vel_vadv.o \
@@ -218,7 +221,8 @@
                                           mpas_ocn_equation_of_state_jm.o \
                                           mpas_ocn_equation_of_state_linear.o \
                                           mpas_ocn_global_diagnostics.o \
-                                          mpas_ocn_time_average.o
+                                          mpas_ocn_time_average.o \
+                                          mpas_ocn_monthly_forcing.o
 
 clean:
         $(RM) *.o *.mod *.f90 libdycore.a

Modified: trunk/mpas/src/core_ocean/Registry
===================================================================
--- trunk/mpas/src/core_ocean/Registry        2012-05-07 16:54:18 UTC (rev 1868)
+++ trunk/mpas/src/core_ocean/Registry        2012-05-07 17:01:45 UTC (rev 1869)
@@ -85,6 +85,7 @@
 namelist logical   restore   config_restoreTS           false
 namelist real      restore   config_restoreT_timescale  90.0
 namelist real      restore   config_restoreS_timescale  90.0
+namelist logical   restore   config_use_monthly_forcing false
 
 %
 % dim  type  name_in_file  name_in_code
@@ -102,6 +103,7 @@
 dim vertexDegree vertexDegree
 dim nVertLevels nVertLevels
 dim nVertLevelsP1 nVertLevels+1
+dim nMonths nMonths
 
 %
 % var persistence type  name_in_file  ( dims )  time_levs iro-  name_in_code struct super-array array_class
@@ -201,10 +203,15 @@
 var persistent integer edgeMask ( nVertLevels nEdges ) 0 o edgeMask mesh - -
 var persistent integer vertexMask ( nVertLevels nVertices ) 0 o vertexMask mesh - -
 var persistent integer cellMask ( nVertLevels nCells ) 0 o cellMask mesh - -
-var persistent real    u_src ( nVertLevels nEdges ) 0 ir u_src mesh - -
-var persistent real    temperatureRestore ( nCells ) 0 ir temperatureRestore mesh - -
-var persistent real    salinityRestore ( nCells ) 0 ir salinityRestore mesh - -
+var persistent real    u_src ( nVertLevels nEdges ) 0 iro u_src mesh - -
+var persistent real    temperatureRestore ( nCells ) 0 iro temperatureRestore mesh - -
+var persistent real    salinityRestore ( nCells ) 0 iro salinityRestore mesh - -
 
+% mrp trying to figure out why these do not appear
+var persistent real    windStressMonthly ( nMonths nEdges ) 0 iro windStressMonthly mesh - -
+var persistent real    temperatureRestoreMonthly ( nMonths nCells ) 0 iro temperatureRestoreMonthly mesh - -
+var persistent real    salinityRestoreMonthly ( nMonths nCells ) 0 iro salinityRestoreMonthly mesh - -
+
 % Prognostic variables: read from input, saved in restart, and written to output
 var persistent real    u ( nVertLevels nEdges Time ) 2 ir u state - -
 var persistent real    h ( nVertLevels nCells Time ) 2 iro h state - -
@@ -259,6 +266,11 @@
 var persistent real    uReconstructZ ( nVertLevels nCells Time ) 2 - uReconstructZ state - -
 var persistent real    uReconstructZonal ( nVertLevels nCells Time ) 2 o uReconstructZonal state - -
 var persistent real    uReconstructMeridional ( nVertLevels nCells Time ) 2 o uReconstructMeridional state - -
+var persistent real    uSrcReconstructX ( nVertLevels nCells Time ) 2 - uSrcReconstructX state - -
+var persistent real    uSrcReconstructY ( nVertLevels nCells Time ) 2 - uSrcReconstructY state - -
+var persistent real    uSrcReconstructZ ( nVertLevels nCells Time ) 2 - uSrcReconstructZ state - -
+var persistent real    uSrcReconstructZonal ( nVertLevels nCells Time ) 2 o uSrcReconstructZonal state - -
+var persistent real    uSrcReconstructMeridional ( nVertLevels nCells Time ) 2 o uSrcReconstructMeridional state - -
 var persistent real    MontPot ( nVertLevels nCells Time ) 2 - MontPot state - -
 var persistent real    pressure ( nVertLevels nCells Time ) 2 - pressure state - -
 var persistent real    wTop ( nVertLevelsP1 nCells Time ) 2 - wTop state - -
@@ -292,5 +304,5 @@
 var persistent real    acc_uReconstructMeridional ( nVertLevels nCells Time ) 2 o acc_uReconstructMeridional state - -
 var persistent real    acc_uReconstructZonalVar ( nVertLevels nCells Time ) 2 o acc_uReconstructZonalVar state - -
 var persistent real    acc_uReconstructMeridionalVar ( nVertLevels nCells Time ) 2 o acc_uReconstructMeridionalVar state - -
-var persistent real           acc_u ( nVertLevels nEdges Time ) 2 o acc_u state - -
-var persistent real           acc_uVar ( nVertLevels nEdges Time ) 2 o acc_uVar state - -
+var persistent real    acc_u ( nVertLevels nEdges Time ) 2 o acc_u state - -
+var persistent real    acc_uVar ( nVertLevels nEdges Time ) 2 o acc_uVar state - -

Copied: trunk/mpas/src/core_ocean/mpas_ocn_monthly_forcing.F (from rev 1867, branches/ocean_projects/monthly_forcing/src/core_ocean/mpas_ocn_monthly_forcing.F)
===================================================================
--- trunk/mpas/src/core_ocean/mpas_ocn_monthly_forcing.F                                (rev 0)
+++ trunk/mpas/src/core_ocean/mpas_ocn_monthly_forcing.F        2012-05-07 17:01:45 UTC (rev 1869)
@@ -0,0 +1,190 @@
+!|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
+!
+!  ocn_monthly_forcing
+!
+!&gt; \brief MPAS ocean monthly forcing
+!&gt; \author Doug Jacobsen
+!&gt; \date   04/25/12
+!&gt; \version SVN:$Id:$
+!&gt; \details
+!&gt;  This module contains routines for building the forcing arrays,
+!&gt;  if monthly forcing is used.
+!
+!-----------------------------------------------------------------------
+
+module ocn_monthly_forcing
+
+   use mpas_grid_types
+   use mpas_configure
+   use mpas_timekeeping
+
+   implicit none
+   private
+   save
+
+   !--------------------------------------------------------------------
+   !
+   ! Public parameters
+   !
+   !--------------------------------------------------------------------
+
+   !--------------------------------------------------------------------
+   !
+   ! Public member functions
+   !
+   !--------------------------------------------------------------------
+
+   public :: ocn_build_forcing_arrays, &amp;
+             ocn_monthly_forcing_init
+
+   !--------------------------------------------------------------------
+   !
+   ! Private module variables
+   !
+   !--------------------------------------------------------------------
+
+   logical :: monthlyForcingOn !&lt; Flag to turn on/off resotring
+
+!***********************************************************************
+
+contains
+
+!***********************************************************************
+!
+!  routine ocn_build_forcing_arrays
+!
+!&gt; \brief   Determines the forcing array used for the monthly forcing.
+!&gt; \author  Doug Jacobsen
+!&gt; \date    04/25/12
+!&gt; \version SVN:$Id$
+!&gt; \details 
+!&gt;  This routine computes the forcing arrays used later in MPAS.
+!
+!-----------------------------------------------------------------------
+
+   subroutine ocn_build_forcing_arrays(timeStamp, grid, err)!{{{
+
+      !-----------------------------------------------------------------
+      !
+      ! input variables
+      !
+      !-----------------------------------------------------------------
+
+      type(MPAS_Time_type), intent(in) :: timeStamp
+
+      !-----------------------------------------------------------------
+      !
+      ! input/output variables
+      !
+      !-----------------------------------------------------------------
+
+      type (mesh_type), intent(inout) :: &amp;
+         grid          !&lt; Input: grid information
+
+
+      !-----------------------------------------------------------------
+      !
+      ! output variables
+      !
+      !-----------------------------------------------------------------
+
+      integer, intent(out) :: err !&lt; Output: Error flag
+
+      !-----------------------------------------------------------------
+      !
+      ! local variables
+      !
+      !-----------------------------------------------------------------
+
+
+      real (kind=RKIND), dimension(:,:), pointer :: temperatureRestoreMonthly 
+      real (kind=RKIND), dimension(:,:), pointer :: salinityRestoreMonthly 
+      real (kind=RKIND), dimension(:,:), pointer :: windStressMonthly 
+      real (kind=RKIND), dimension(:), pointer :: temperatureRestore 
+      real (kind=RKIND), dimension(:), pointer :: salinityRestore 
+      real (kind=RKIND), dimension(:,:), pointer :: u_src
+      integer :: iCell, iEdge, nCells, nEdges, nMonths, k
+      integer :: iMonth, iMonthP1, iDayInMonth, ierr
+      real (kind=RKIND) :: data, dataP1, weight, weightP1
+
+      err = 0
+
+      if(.not.monthlyForcingOn) return
+
+      nCells = grid % nCells
+      nEdges = grid % nEdges
+      nMonths = grid % nMonths
+
+      temperatureRestore =&gt; grid % temperatureRestore % array
+      salinityRestore =&gt; grid % salinityRestore % array
+      u_src =&gt; grid % u_src % array
+
+      temperatureRestoreMonthly =&gt; grid % temperatureRestoreMonthly % array
+      salinityRestoreMonthly =&gt; grid % salinityRestoreMonthly % array
+      windStressMonthly =&gt; grid % windStressMonthly % array
+
+      call mpas_get_time(timeStamp, MM = iMonth, DD = iDayInMonth, ierr = ierr)
+
+      err = ierr
+
+      iMonthP1 = mod(iMonth, nMonths) + 1
+
+      weight = 1.0 - (iDayInMonth-1) / 30.0
+      weightP1 = 1.0 - weight
+
+      do iCell=1,nCells
+        ! Interpolate between iMonth and iMonthP1 records, using iDayInMonth
+        data = temperatureRestoreMonthly(iMonth,iCell)
+        dataP1 = temperatureRestoreMonthly(iMonthP1,iCell)
+        temperatureRestore(iCell) = data * weight + dataP1 * weightP1
+        data = salinityRestoreMonthly(iMonth,iCell)
+        dataP1 = salinityRestoreMonthly(iMonthP1,iCell)
+        salinityRestore(iCell) = data * weight + dataP1 * weightP1
+      end do
+
+      do iEdge=1,nEdges
+        ! Interpolate between iMonth and iMonthP1 records, using iDayInMonth
+        data = windStressMonthly(iMonth,iEdge)
+        dataP1 = windStressMonthly(iMonthP1,iEdge)
+        u_src(1,iEdge) = data * weight + dataP1 * weightP1
+      end do
+
+   !--------------------------------------------------------------------
+
+   end subroutine ocn_build_forcing_arrays!}}}
+
+!***********************************************************************
+!
+!  routine ocn_monthly_forcing_init
+!
+!&gt; \brief   Initializes monthly forcing module
+!&gt; \author  Doug Jacobsen
+!&gt; \date    04/25/12
+!&gt; \version SVN:$Id$
+!&gt; \details 
+!&gt;  This routine initializes the monthly forcing module.
+!
+!-----------------------------------------------------------------------
+
+   subroutine ocn_monthly_forcing_init(err)!{{{
+
+      integer, intent(out) :: err !&lt; Output: error flag
+
+      err = 0
+
+      monthlyForcingOn = .false.
+
+      if(config_use_monthly_forcing) then
+        monthlyForcingOn = .true.
+      end if
+
+   !--------------------------------------------------------------------
+
+   end subroutine ocn_monthly_forcing_init!}}}
+
+!***********************************************************************
+
+end module ocn_monthly_forcing
+
+!|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
+! vim: foldmethod=marker

Modified: trunk/mpas/src/core_ocean/mpas_ocn_mpas_core.F
===================================================================
--- trunk/mpas/src/core_ocean/mpas_ocn_mpas_core.F        2012-05-07 16:54:18 UTC (rev 1868)
+++ trunk/mpas/src/core_ocean/mpas_ocn_mpas_core.F        2012-05-07 17:01:45 UTC (rev 1869)
@@ -11,6 +11,8 @@
    use ocn_time_integration
    use ocn_tendency
 
+   use ocn_monthly_forcing
+
    use ocn_vel_pressure_grad
    use ocn_vel_vadv
    use ocn_vel_hmix
@@ -93,6 +95,9 @@
       call mpas_ocn_tracer_advection_init(err_tmp)
       err = ior(err,err_tmp)
 
+      call ocn_monthly_forcing_init(err_tmp)
+      err = ior(err, err_tmp)
+
       call mpas_timer_init(domain)
 
       if(err.eq.1) then
@@ -273,6 +278,16 @@
                        block % state % time_levs(1) % state % uReconstructMeridional % array    &amp;
                       )
 
+!TDR
+      call mpas_reconstruct(mesh, mesh % u_src % array,                  &amp;
+                       block % state % time_levs(1) % state % uSrcReconstructX % array,            &amp;
+                       block % state % time_levs(1) % state % uSrcReconstructY % array,            &amp;
+                       block % state % time_levs(1) % state % uSrcReconstructZ % array,            &amp;
+                       block % state % time_levs(1) % state % uSrcReconstructZonal % array,        &amp;
+                       block % state % time_levs(1) % state % uSrcReconstructMeridional % array    &amp;
+                      )
+!TDR
+
       ! initialize velocities and tracers on land to be -1e34
       ! The reconstructed velocity on land will have values not exactly
       ! -1e34 due to the interpolation of reconstruction.
@@ -355,6 +370,12 @@
          currTime = mpas_get_clock_time(clock, MPAS_NOW, ierr)
          call mpas_get_time(curr_time=currTime, dateTimeString=timeStamp, ierr=ierr)
          write(0,*) 'Doing timestep ', trim(timeStamp)
+   
+         block_ptr =&gt; domain % blocklist
+         do while(associated(block_ptr))
+           call ocn_build_forcing_arrays(currTime, block_ptr % mesh, ierr)
+           block_ptr =&gt; block_ptr % next
+         end do
 
          call mpas_timer_start(&quot;time integration&quot;, .false., timeIntTimer)
          call mpas_timestep(domain, itimestep, dt, timeStamp)

Modified: trunk/mpas/src/core_ocean/mpas_ocn_time_integration_rk4.F
===================================================================
--- trunk/mpas/src/core_ocean/mpas_ocn_time_integration_rk4.F        2012-05-07 16:54:18 UTC (rev 1868)
+++ trunk/mpas/src/core_ocean/mpas_ocn_time_integration_rk4.F        2012-05-07 17:01:45 UTC (rev 1869)
@@ -99,7 +99,7 @@
       block =&gt; domain % blocklist
       call mpas_allocate_state(block, provis, &amp;
                           block % mesh % nCells, block % mesh % nEdges, block % mesh % maxEdges, block % mesh % maxEdges2, &amp;
-                          block % mesh % nVertices, block % mesh % vertexDegree, block % mesh % nVertLevels )
+                          block % mesh % nVertices, block % mesh % vertexDegree, block % mesh % nVertLevels, block % mesh % nMonths )
 
       provis_ptr =&gt; provis
       call mpas_create_state_links(provis_ptr)
@@ -343,6 +343,16 @@
                           block % state % time_levs(2) % state % uReconstructMeridional % array    &amp;
                          )
 
+!TDR
+         call mpas_reconstruct(block % mesh, block % mesh % u_src % array,          &amp;
+                          block % state % time_levs(2) % state % uSrcReconstructX % array,            &amp;
+                          block % state % time_levs(2) % state % uSrcReconstructY % array,            &amp;
+                          block % state % time_levs(2) % state % uSrcReconstructZ % array,            &amp;
+                          block % state % time_levs(2) % state % uSrcReconstructZonal % array,        &amp;
+                          block % state % time_levs(2) % state % uSrcReconstructMeridional % array    &amp;
+                         )
+!TDR
+
          call ocn_time_average_accumulate(block % state % time_levs(2) % state, block % state % time_levs(1) % state)
 
          block =&gt; block % next

Modified: trunk/mpas/src/core_ocean/mpas_ocn_time_integration_split.F
===================================================================
--- trunk/mpas/src/core_ocean/mpas_ocn_time_integration_split.F        2012-05-07 16:54:18 UTC (rev 1868)
+++ trunk/mpas/src/core_ocean/mpas_ocn_time_integration_split.F        2012-05-07 17:01:45 UTC (rev 1869)
@@ -869,6 +869,7 @@
          end if
 
          call ocn_diagnostic_solve(dt, block % state % time_levs(2) % state, block % mesh)
+
          call mpas_reconstruct(block % mesh, block % state % time_levs(2) % state % u % array,          &amp;
             block % state % time_levs(2) % state % uReconstructX % array,            &amp;
             block % state % time_levs(2) % state % uReconstructY % array,            &amp;
@@ -876,6 +877,17 @@
             block % state % time_levs(2) % state % uReconstructZonal % array,        &amp;
             block % state % time_levs(2) % state % uReconstructMeridional % array)
 
+!TDR
+         call mpas_reconstruct(block % mesh, block % mesh % u_src % array,          &amp;
+                          block % state % time_levs(2) % state % uSrcReconstructX % array,            &amp;
+                          block % state % time_levs(2) % state % uSrcReconstructY % array,            &amp;
+                          block % state % time_levs(2) % state % uSrcReconstructZ % array,            &amp;
+                          block % state % time_levs(2) % state % uSrcReconstructZonal % array,        &amp;
+                          block % state % time_levs(2) % state % uSrcReconstructMeridional % array    &amp;
+                         )
+!TDR
+
+
          call ocn_time_average_accumulate(block % state % time_levs(2) % state, block % state % time_levs(1) % state)
 
 

Modified: trunk/mpas/src/framework/mpas_io.F
===================================================================
--- trunk/mpas/src/framework/mpas_io.F        2012-05-07 16:54:18 UTC (rev 1868)
+++ trunk/mpas/src/framework/mpas_io.F        2012-05-07 17:01:45 UTC (rev 1869)
@@ -435,6 +435,7 @@
       do while (associated(dim_cursor))
          if (trim(dimname) == trim(dim_cursor % dimhandle % dimname)) then
             if (dimsize /= dim_cursor % dimhandle % dimsize) then
+ print *, 'dimsize dim_cursor % dimhandle % dimsize',dimsize, dim_cursor % dimhandle % dimsize
                if (present(ierr)) ierr = MPAS_IO_ERR_REDEF_DIM
             end if
             return

</font>
</pre>