<p><b>duda</b> 2011-07-22 15:57:54 -0600 (Fri, 22 Jul 2011)</p><p>BRANCH COMMIT<br>
<br>
Add code in non-hydrostatic core to enable updates of fields marked with<br>
an 's' I/O stream in the Registry. By default, only sst will be updated,<br>
but in principle, other fields such as vegetation fraction could be<br>
added to the stream as well. The interval between updates is controlled<br>
by the namelist parameter config_sfc_update_interval (in &amp;nhyd_model); a<br>
value of 0 means no updates will be performed, while an interger &gt;0<br>
gives the number of time steps between updates. The first update will be<br>
performed before the first model time step; thereafter, fields on the 's'<br>
stream are updated at the end of any time step evenly divisible by the<br>
interval. <br>
<br>
The name of the file containing fields to be updated through the 's'<br>
stream is specified by the namelist variable config_sfc_update_name (in &amp;io); <br>
the default value is &quot;sfc_update.nc&quot;. When providing an SST update file,<br>
the sfc_update.nc file should contain the same dimensions and attributes<br>
as a typical MPAS IC file, but the only field needed in the file is (in<br>
ncdump syntax)<br>
<br>
        double sst(Time, nCells) ;<br>
<br>
<br>
M    src/core_nhyd_atmos/module_mpas_core.F<br>
M    src/core_nhyd_atmos/Registry<br>
M    namelist.input.nhyd_atmos<br>
</p><hr noshade><pre><font color="gray">Modified: branches/atmos_physics/namelist.input.nhyd_atmos
===================================================================
--- branches/atmos_physics/namelist.input.nhyd_atmos        2011-07-22 17:42:55 UTC (rev 927)
+++ branches/atmos_physics/namelist.input.nhyd_atmos        2011-07-22 21:57:54 UTC (rev 928)
@@ -4,6 +4,7 @@
    config_dt = 1800
    config_ntimesteps = 480
    config_output_interval = 48
+   config_sfc_update_interval = 0
    config_number_of_sub_steps = 6
    config_h_mom_eddy_visc2 = 0000.
    config_h_mom_eddy_visc4 = 0.
@@ -26,6 +27,7 @@
 
 &amp;io
    config_input_name = 'grid.nc'
+   config_sfc_update_name = 'sfc_update.nc'
    config_output_name = 'output.nc'
    config_restart_name = 'restart.nc'
 /

Modified: branches/atmos_physics/src/core_nhyd_atmos/Registry
===================================================================
--- branches/atmos_physics/src/core_nhyd_atmos/Registry        2011-07-22 17:42:55 UTC (rev 927)
+++ branches/atmos_physics/src/core_nhyd_atmos/Registry        2011-07-22 21:57:54 UTC (rev 928)
@@ -5,6 +5,7 @@
 namelist character nhyd_model config_time_integration     SRK3
 namelist real      nhyd_model config_dt                   172.8
 namelist integer   nhyd_model config_ntimesteps           7500
+namelist integer   nhyd_model config_sfc_update_interval  0
 namelist integer   nhyd_model config_output_interval      500
 namelist character nhyd_model config_horiz_mixing         2d_smagorinsky
 namelist real      nhyd_model config_h_mom_eddy_visc2     0.0
@@ -34,6 +35,7 @@
 namelist logical   nhyd_model config_h_ScaleWithMesh      false
 namelist integer   dimensions config_nvertlevels        26
 namelist character io       config_input_name           grid.nc
+namelist character io       config_sfc_update_name      sfc_update.nc
 namelist character io       config_output_name          output.nc
 namelist character io       config_restart_name         restart.nc
 namelist character io       config_decomp_file_prefix   graph.info.part.
@@ -666,7 +668,7 @@
 var persistent real    skintemp   ( nCells Time              ) 1 iro skintemp      sfc_input    - -
 var persistent real    snow       ( nCells Time              ) 1 iro snow          sfc_input    - -
 var persistent real    snowc      ( nCells Time              ) 1 iro snowc         sfc_input    - -
-var persistent real    sst        ( nCells Time              ) 1 iro sst           sfc_input    - -
+var persistent real    sst        ( nCells Time              ) 1 isro sst          sfc_input    - -
 var persistent real    tmn        ( nCells Time              ) 1 iro tmn           sfc_input    - -
 var persistent real    vegfra     ( nCells Time              ) 1 iro vegfra        sfc_input    - -   
 var persistent real    xice       ( nCells Time              ) 1 iro xice          sfc_input    - -

Modified: branches/atmos_physics/src/core_nhyd_atmos/module_mpas_core.F
===================================================================
--- branches/atmos_physics/src/core_nhyd_atmos/module_mpas_core.F        2011-07-22 17:42:55 UTC (rev 927)
+++ branches/atmos_physics/src/core_nhyd_atmos/module_mpas_core.F        2011-07-22 21:57:54 UTC (rev 928)
@@ -3,6 +3,7 @@
    use mpas_framework
 
    type (io_output_object) :: restart_obj
+   type (io_input_object) :: sfc_update_obj
    integer :: restart_frame
 
 
@@ -37,6 +38,13 @@
 
       restart_frame = 1
 
+!MGD TODO: this should pick up at the right frame when doing a restart
+      sfc_update_obj % time = 1
+      sfc_update_obj % filename = trim(config_sfc_update_name)
+      sfc_update_obj % stream = STREAM_SFC
+
+      call io_input_init(sfc_update_obj, domain % dminfo)
+
    end subroutine mpas_core_init
 
 
@@ -142,8 +150,16 @@
       dt = config_dt
       ntimesteps = config_ntimesteps
    
+      if (config_sfc_update_interval &gt; 0) then
+         call read_and_distribute_fields(domain % dminfo, sfc_update_obj, domain % blocklist, &amp;
+                                         readCellStart, nReadCells, readEdgeStart, nReadEdges, readVertexStart, nReadVertices, &amp;
+                                         readVertLevelStart, nReadVertLevels, &amp;
+                                         sendCellList, recvCellList, sendEdgeList, recvEdgeList, sendVertexList, recvVertexList, &amp;
+                                         sendVertLevelList, recvVertLevelList)
+      end if
+   
       call write_output_frame(output_obj, output_frame, domain)
-   
+
       ! During integration, time level 1 stores the model state at the beginning of the
       !   time step, and time level 2 stores the state advanced dt in time by timestep(...)
       do itimestep = 1,ntimesteps
@@ -163,6 +179,16 @@
             call output_state_for_domain(restart_obj, domain, restart_frame)
             restart_frame = restart_frame + 1
          end if
+         if (config_sfc_update_interval &gt; 0) then
+            if (mod(itimestep, config_sfc_update_interval) == 0) then
+               sfc_update_obj % time = sfc_update_obj % time + 1
+               call read_and_distribute_fields(domain % dminfo, sfc_update_obj, domain % blocklist, &amp;
+                                         readCellStart, nReadCells, readEdgeStart, nReadEdges, readVertexStart, nReadVertices, &amp;
+                                         readVertLevelStart, nReadVertLevels, &amp;
+                                         sendCellList, recvCellList, sendEdgeList, recvEdgeList, sendVertexList, recvVertexList, &amp;
+                                         sendVertLevelList, recvVertLevelList)
+            end if
+         end if
       end do
    
    end subroutine mpas_core_run
@@ -268,6 +294,8 @@
       type (domain_type), intent(inout) :: domain 
 
       if (restart_frame &gt; 1) call output_state_finalize(restart_obj, domain % dminfo)
+
+      call io_input_finalize(sfc_update_obj, domain % dminfo)
    
    end subroutine mpas_core_finalize
 

</font>
</pre>