<p><b>duda</b> 2011-11-08 15:59:25 -0700 (Tue, 08 Nov 2011)</p><p>BRANCH COMMIT<br>
<br>
Add hard-wired calls to write h field using PIO in shallow water model.<br>
<br>
<br>
M    src/framework/module_io_output.F<br>
</p><hr noshade><pre><font color="gray">Modified: branches/pio/src/framework/module_io_output.F
===================================================================
--- branches/pio/src/framework/module_io_output.F        2011-11-08 18:03:39 UTC (rev 1180)
+++ branches/pio/src/framework/module_io_output.F        2011-11-08 22:59:25 UTC (rev 1181)
@@ -14,6 +14,7 @@
    type io_output_object
       type (iosystem_desc_t) :: pio_iosystem
       type (file_desc_t) :: pio_file
+      type (io_desc_t) :: iodesc_nVertLevels_nCells
 
       integer :: wr_ncid
       character (len=1024) :: filename
@@ -25,6 +26,14 @@
       integer :: wrDimIDStrLen
 #include &quot;io_output_obj_decls.inc&quot;
 
+      ! MGD currently hard-wired for testing
+      integer :: pioDimIDTime
+      integer :: pioDimIDnCells
+      integer :: pioDimIDnVertLevels
+
+      ! MGD currently hard-wired for testing
+      type (var_desc_t) :: pioVarIDh
+
       logical :: validExchangeLists
       type (exchange_list), pointer :: sendCellsList, recvCellsList
       type (exchange_list), pointer :: sendEdgesList, recvEdgesList
@@ -156,6 +165,11 @@
       integer :: nEdgesGlobal
       integer :: nVerticesGlobal
       integer :: nVertLevelsGlobal
+
+!MGD hard-wired for initial PIO testing
+      integer, dimension(:), pointer :: compdof
+      integer, dimension(2) :: dimids2
+
       integer, dimension(:), pointer :: neededCellList
       integer, dimension(:), pointer :: neededEdgeList
       integer, dimension(:), pointer :: neededVertexList
@@ -288,6 +302,26 @@
       end if
 
       if (.not. output_obj % validExchangeLists) then
+
+write(0,*) 'MGD PIO_initdecomp'
+         
+         allocate(compdof(domain % blocklist % mesh % nVertLevelsSolve * domain % blocklist % mesh % nCellsSolve))
+         do i=1,domain % blocklist % mesh % nCellsSolve
+         do j=1,domain % blocklist % mesh % nVertLevelsSolve
+            compdof((i-1)*domain % blocklist % mesh % nVertLevels + j) = &amp;
+                    (domain % blocklist % mesh % indexToCellID % array(i)-1) * &amp;
+                    domain % blocklist % mesh % nVertLevels + j
+         end do
+         end do
+
+         dimids2(1) = nVertLevelsGlobal
+         dimids2(2) = nCellsGlobal
+
+         call PIO_initdecomp(output_obj % pio_iosystem, PIO_DOUBLE, &amp;
+                             dimids2, compdof, output_obj % iodesc_nVertLevels_nCells)
+         deallocate(compdof)
+!MGD end PIO_initdecomp call
+
          call dmpar_get_owner_list(domain % dminfo, &amp;
                                    domain % blocklist % mesh % nCellsSolve, size(neededCellList), &amp;
                                    domain % blocklist % mesh % indexToCellID % array, neededCellList, &amp;
@@ -335,6 +369,10 @@
 
 #include &quot;io_output_fields.inc&quot;
 
+write(0,*) 'MGD PIO_write_darray'
+      call PIO_write_darray(output_obj % pio_file, output_obj % pioVarIDh, output_obj % iodesc_nVertLevels_nCells, &amp;
+           domain % blocklist % state % time_levs(1) % state % h % array(:,1:domain%blocklist%mesh%nCellsSolve), i1)
+
       domain % blocklist % mesh % cellsOnCell % array =&gt; cellsOnCell_save
       domain % blocklist % mesh % edgesOnCell % array =&gt; edgesOnCell_save
       domain % blocklist % mesh % verticesOnCell % array =&gt; verticesOnCell_save
@@ -416,8 +454,17 @@
       end if
 
 write(0,*) 'MGD PIO_def_dim'
-      nferr = PIO_def_dim(output_obj % pio_file, 'test', 100, dimlist(1))
+      nferr = PIO_def_dim(output_obj % pio_file, 'Time', PIO_UNLIMITED, output_obj % pioDimIDTime)
+      nferr = PIO_def_dim(output_obj % pio_file, 'nCells', nCells, output_obj % pioDimIDnCells)
+      nferr = PIO_def_dim(output_obj % pio_file, 'nVertLevels', nVertLevels, output_obj % pioDimIDnVertLevels)
 
+write(0,*) 'MGD PIO_def_var'
+      dimlist(1) = output_obj % pioDimIDnVertLevels
+      dimlist(2) = output_obj % pioDimIDnCells
+      dimlist(3) = output_obj % pioDimIDTime
+      nferr = PIO_def_var(output_obj % pio_file, 'h', PIO_DOUBLE, dimlist(1:2), output_obj % pioVarIDh)
+
+
 write(0,*) 'MGD PIO_enddef'
       nferr = PIO_enddef(output_obj % pio_file)
  
@@ -877,6 +924,9 @@
 write(0,*) 'MGD PIO_closefile'
       call PIO_closefile(output_obj % pio_file)
 
+write(0,*) 'MGD PIO_freedecomp'
+      call PIO_freedecomp(output_obj % pio_iosystem, output_obj % iodesc_nVertLevels_nCells)
+
 write(0,*) 'MGD PIO_finalize'
       call PIO_finalize(output_obj % pio_iosystem, nferr)
  

</font>
</pre>