<p><b>dwj07@fsu.edu</b> 2012-04-25 11:27:34 -0600 (Wed, 25 Apr 2012)</p><p><br>
        -- BRANCH COMMIT --<br>
<br>
        Implementing a base module to support monthly forcing arrays.<br>
</p><hr noshade><pre><font color="gray">Modified: branches/ocean_projects/monthly_forcing/src/core_ocean/Makefile
===================================================================
--- branches/ocean_projects/monthly_forcing/src/core_ocean/Makefile        2012-04-25 16:55:59 UTC (rev 1811)
+++ branches/ocean_projects/monthly_forcing/src/core_ocean/Makefile        2012-04-25 17:27:34 UTC (rev 1812)
@@ -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: branches/ocean_projects/monthly_forcing/src/core_ocean/Registry
===================================================================
--- branches/ocean_projects/monthly_forcing/src/core_ocean/Registry        2012-04-25 16:55:59 UTC (rev 1811)
+++ branches/ocean_projects/monthly_forcing/src/core_ocean/Registry        2012-04-25 17:27:34 UTC (rev 1812)
@@ -82,9 +82,10 @@
 namelist real      advection config_coef_3rd_order      0.25
 namelist logical   advection config_monotonic           false
 namelist logical   advection config_check_monotonicity  false
-namelist logical   restore   config_restoreTS           false
-namelist real      restore   config_restoreT_timescale  90.0
-namelist real      restore   config_restoreS_timescale  90.0
+namelist logical   forcing   config_restoreTS           false
+namelist real      forcing   config_restoreT_timescale  90.0
+namelist real      forcing   config_restoreS_timescale  90.0
+namelist logical   forcing   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
@@ -203,6 +205,9 @@
 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_monthly ( nVertLevels nEdges nMonths ) 0 ir u_src_monthly mesh - -
+var persistent real    temperatureRestoreMonthly ( nCells nMonths ) 0 ir temperatureRestoreMonthly mesh - -
+var persistent real    salinityRestoreMonthly ( nCells nMonths ) 0 ir 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 - -

Added: branches/ocean_projects/monthly_forcing/src/core_ocean/mpas_ocn_monthly_forcing.F
===================================================================
--- branches/ocean_projects/monthly_forcing/src/core_ocean/mpas_ocn_monthly_forcing.F                                (rev 0)
+++ branches/ocean_projects/monthly_forcing/src/core_ocean/mpas_ocn_monthly_forcing.F        2012-04-25 17:27:34 UTC (rev 1812)
@@ -0,0 +1,175 @@
+!|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
+!
+!  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 :: windStress 
+      integer :: iCell, iEdge, nCells, nEdges, nMonths, k
+      integer :: iMonth, iMonthP1, iDayInMonth, ierr
+
+      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
+      windStress =&gt; grid % u_src % array
+
+      temperatureRestoreMonthly =&gt; grid % temperatureRestoreMonthly % array
+      salinityRestoreMonthly =&gt; grid % salinityRestoreMonthly % array
+      windStressMonthly =&gt; grid % u_src_monthly % array
+
+      call mpas_get_time(timeStamp, MM = iMonth, DD = iDayInMonth, ierr = ierr)
+
+      err = ierr
+
+      iMonthP1 = mod(iMonth + 1, nMonths) + 1
+
+      do iCell=1,nCells
+        ! Interpolate between iMonth and iMonthP1 records, using iDayInMonth
+      end do
+
+      do iEdge=1,nEdges
+        ! Interpolate between iMonth and iMonthP1 records, using iDayInMonth
+      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
+
+      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: branches/ocean_projects/monthly_forcing/src/core_ocean/mpas_ocn_mpas_core.F
===================================================================
--- branches/ocean_projects/monthly_forcing/src/core_ocean/mpas_ocn_mpas_core.F        2012-04-25 16:55:59 UTC (rev 1811)
+++ branches/ocean_projects/monthly_forcing/src/core_ocean/mpas_ocn_mpas_core.F        2012-04-25 17:27:34 UTC (rev 1812)
@@ -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
@@ -354,6 +359,11 @@
          currTime = mpas_get_clock_time(clock, MPAS_NOW, ierr)
          call mpas_get_time(curr_time=currTime, dateTimeString=timeStamp, ierr=ierr)
          write(0,*) 'Doing timestep ', timeStamp
+   
+         block_ptr =&gt; domain % blocklist
+         do while(associated(block_ptr))
+           call ocn_build_forcing_arrays(currTime, block_ptr % mesh, ierr)
+         end do
 
          call mpas_timer_start(&quot;time integration&quot;, .false., timeIntTimer)
          call mpas_timestep(domain, itimestep, dt, timeStamp)

Modified: branches/ocean_projects/monthly_forcing/src/core_ocean/mpas_ocn_time_integration_rk4.F
===================================================================
--- branches/ocean_projects/monthly_forcing/src/core_ocean/mpas_ocn_time_integration_rk4.F        2012-04-25 16:55:59 UTC (rev 1811)
+++ branches/ocean_projects/monthly_forcing/src/core_ocean/mpas_ocn_time_integration_rk4.F        2012-04-25 17:27:34 UTC (rev 1812)
@@ -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)

</font>
</pre>