<p><b>ringler@lanl.gov</b> 2011-04-21 13:55:42 -0600 (Thu, 21 Apr 2011)</p><p><br>
edit to the periodic_hex generator that resides on this branch<br>
</p><hr noshade><pre><font color="gray">Modified: branches/pv_based_swm/grid_gen/periodic_hex/Makefile
===================================================================
--- branches/pv_based_swm/grid_gen/periodic_hex/Makefile        2011-04-21 19:54:24 UTC (rev 799)
+++ branches/pv_based_swm/grid_gen/periodic_hex/Makefile        2011-04-21 19:55:42 UTC (rev 800)
@@ -6,19 +6,19 @@
 #LDFLAGS = -g -C
 
 # pgf90
-FC = pgf90
-CC = pgcc
-FFLAGS = -r8 -O3
+#FC = pgf90
+#CC = pgcc
+#FFLAGS = -r8 -O3
+#CFLAGS = -O3
+#LDFLAGS = -O3
+
+# ifort
+FC = ifort
+CC = icc
+FFLAGS = -real-size 64 -O3
 CFLAGS = -O3
 LDFLAGS = -O3
 
-# ifort
-#FC = ifort
-#CC = icc
-#FFLAGS = -real-size 64 -O3
-#CFLAGS = -O3
-#LDFLAGS = -O3
-
 # absoft
 #FC = f90
 #CC = gcc

Modified: branches/pv_based_swm/grid_gen/periodic_hex/module_write_netcdf.F
===================================================================
--- branches/pv_based_swm/grid_gen/periodic_hex/module_write_netcdf.F        2011-04-21 19:54:24 UTC (rev 799)
+++ branches/pv_based_swm/grid_gen/periodic_hex/module_write_netcdf.F        2011-04-21 19:55:42 UTC (rev 800)
@@ -47,6 +47,7 @@
    integer :: wrVarIDcellsOnVertex
    integer :: wrVarIDkiteAreasOnVertex
    integer :: wrVarIDfEdge
+   integer :: wrVarIDfCell
    integer :: wrVarIDfVertex
    integer :: wrVarIDh_s
    integer :: wrVarIDu
@@ -57,6 +58,13 @@
    integer :: wrVarIDcirculation
    integer :: wrVarIDvorticity
    integer :: wrVarIDke
+
+   integer :: wrVarIDpv
+   integer :: wrVarIDvor
+   integer :: wrVarIDdiv
+   integer :: wrVarIDpsi
+   integer :: wrVarIDchi
+
    integer :: wrVarIDtracers
  
    integer :: wrLocalnCells
@@ -215,6 +223,8 @@
       nferr = nf_def_var(wr_ncid, 'kiteAreasOnVertex', NF_DOUBLE,  2, dimlist, wrVarIDkiteAreasOnVertex)
       dimlist( 1) = wrDimIDnEdges
       nferr = nf_def_var(wr_ncid, 'fEdge', NF_DOUBLE,  1, dimlist, wrVarIDfEdge)
+      dimlist( 1) = wrDimIDnCells
+      nferr = nf_def_var(wr_ncid, 'fCell', NF_DOUBLE,  1, dimlist, wrVarIDfCell)
       dimlist( 1) = wrDimIDnVertices
       nferr = nf_def_var(wr_ncid, 'fVertex', NF_DOUBLE,  1, dimlist, wrVarIDfVertex)
       dimlist( 1) = wrDimIDnCells
@@ -246,9 +256,31 @@
       dimlist( 2) = wrDimIDnVertices
       dimlist( 3) = wrDimIDTime
       nferr = nf_def_var(wr_ncid, 'vorticity', NF_DOUBLE,  3, dimlist, wrVarIDvorticity)
+
       dimlist( 1) = wrDimIDnVertLevels
       dimlist( 2) = wrDimIDnCells
       dimlist( 3) = wrDimIDTime
+      nferr = nf_def_var(wr_ncid, 'pv', NF_DOUBLE,  3, dimlist, wrVarIDpv)
+      dimlist( 1) = wrDimIDnVertLevels
+      dimlist( 2) = wrDimIDnCells
+      dimlist( 3) = wrDimIDTime
+      nferr = nf_def_var(wr_ncid, 'vor', NF_DOUBLE,  3, dimlist, wrVarIDvor)
+      dimlist( 1) = wrDimIDnVertLevels
+      dimlist( 2) = wrDimIDnCells
+      dimlist( 3) = wrDimIDTime
+      nferr = nf_def_var(wr_ncid, 'div', NF_DOUBLE,  3, dimlist, wrVarIDdiv)
+      dimlist( 1) = wrDimIDnVertLevels
+      dimlist( 2) = wrDimIDnCells
+      dimlist( 3) = wrDimIDTime
+      nferr = nf_def_var(wr_ncid, 'psi', NF_DOUBLE,  3, dimlist, wrVarIDpsi)
+      dimlist( 1) = wrDimIDnVertLevels
+      dimlist( 2) = wrDimIDnCells
+      dimlist( 3) = wrDimIDTime
+      nferr = nf_def_var(wr_ncid, 'chi', NF_DOUBLE,  3, dimlist, wrVarIDchi)
+
+      dimlist( 1) = wrDimIDnVertLevels
+      dimlist( 2) = wrDimIDnCells
+      dimlist( 3) = wrDimIDTime
       nferr = nf_def_var(wr_ncid, 'ke', NF_DOUBLE,  3, dimlist, wrVarIDke)
       dimlist( 1) = wrDimIDnTracers
       dimlist( 2) = wrDimIDnVertLevels
@@ -298,6 +330,7 @@
                                   edgesOnVertex, &amp;
                                   cellsOnVertex, &amp;
                                   kiteAreasOnVertex, &amp;
+                                  fCell, &amp;
                                   fEdge, &amp;
                                   fVertex, &amp;
                                   h_s, &amp;
@@ -308,6 +341,7 @@
                                   vh, &amp;
                                   circulation, &amp;
                                   vorticity, &amp;
+                                  pv, vor, div, psi, chi, &amp;
                                   ke, &amp;
                                   tracers &amp;
                                  )
@@ -352,6 +386,7 @@
       integer, dimension(:,:), intent(in) :: edgesOnVertex
       integer, dimension(:,:), intent(in) :: cellsOnVertex
       real (kind=8), dimension(:,:), intent(in) :: kiteAreasOnVertex
+      real (kind=8), dimension(:), intent(in) :: fCell
       real (kind=8), dimension(:), intent(in) :: fEdge
       real (kind=8), dimension(:), intent(in) :: fVertex
       real (kind=8), dimension(:), intent(in) :: h_s
@@ -363,6 +398,11 @@
       real (kind=8), dimension(:,:,:), intent(in) :: circulation
       real (kind=8), dimension(:,:,:), intent(in) :: vorticity
       real (kind=8), dimension(:,:,:), intent(in) :: ke
+      real (kind=8), dimension(:,:,:), intent(in) :: pv
+      real (kind=8), dimension(:,:,:), intent(in) :: vor
+      real (kind=8), dimension(:,:,:), intent(in) :: div
+      real (kind=8), dimension(:,:,:), intent(in) :: psi
+      real (kind=8), dimension(:,:,:), intent(in) :: chi
       real (kind=8), dimension(:,:,:,:), intent(in) :: tracers
  
       integer :: nferr
@@ -538,6 +578,10 @@
       start1(1) = 1
       count1( 1) = wrLocalnEdges
       nferr = nf_put_vara_double(wr_ncid, wrVarIDfEdge, start1, count1, fEdge)
+
+      start1(1) = 1
+      count1( 1) = wrLocalnCells
+      nferr = nf_put_vara_double(wr_ncid, wrVarIDfCell, start1, count1, fCell)
  
       start1(1) = 1
       count1( 1) = wrLocalnVertices
@@ -592,6 +636,36 @@
       count3( 1) = wrLocalnVertLevels
       count3( 2) = wrLocalnCells
       count3( 3) = 1
+      nferr = nf_put_vara_double(wr_ncid, wrVarIDpv, start3, count3, pv)
+
+      start3(3) = time
+      count3( 1) = wrLocalnVertLevels
+      count3( 2) = wrLocalnCells
+      count3( 3) = 1
+      nferr = nf_put_vara_double(wr_ncid, wrVarIDvor, start3, count3, vor)
+
+      start3(3) = time
+      count3( 1) = wrLocalnVertLevels
+      count3( 2) = wrLocalnCells
+      count3( 3) = 1
+      nferr = nf_put_vara_double(wr_ncid, wrVarIDdiv, start3, count3, div)
+
+      start3(3) = time
+      count3( 1) = wrLocalnVertLevels
+      count3( 2) = wrLocalnCells
+      count3( 3) = 1
+      nferr = nf_put_vara_double(wr_ncid, wrVarIDpsi, start3, count3, psi)
+
+      start3(3) = time
+      count3( 1) = wrLocalnVertLevels
+      count3( 2) = wrLocalnCells
+      count3( 3) = 1
+      nferr = nf_put_vara_double(wr_ncid, wrVarIDchi, start3, count3, chi)
+
+      start3(3) = time
+      count3( 1) = wrLocalnVertLevels
+      count3( 2) = wrLocalnCells
+      count3( 3) = 1
       nferr = nf_put_vara_double(wr_ncid, wrVarIDke, start3, count3, ke)
  
       start4(4) = time

Modified: branches/pv_based_swm/grid_gen/periodic_hex/namelist.input
===================================================================
--- branches/pv_based_swm/grid_gen/periodic_hex/namelist.input        2011-04-21 19:54:24 UTC (rev 799)
+++ branches/pv_based_swm/grid_gen/periodic_hex/namelist.input        2011-04-21 19:55:42 UTC (rev 800)
@@ -1,8 +1,8 @@
 &amp;periodic_grid
-   nx = 500,
-   ny = 500,
+   nx = 246,
+   ny = 284,
    dc = 10000.,
    nVertLevels = 1,
    nTracers = 1,
-   nproc = 2, 4, 8,
+   nproc = 2, 4, 8, 12, 16, 32
 /

Modified: branches/pv_based_swm/grid_gen/periodic_hex/periodic_grid.F
===================================================================
--- branches/pv_based_swm/grid_gen/periodic_hex/periodic_grid.F        2011-04-21 19:54:24 UTC (rev 799)
+++ branches/pv_based_swm/grid_gen/periodic_hex/periodic_grid.F        2011-04-21 19:55:42 UTC (rev 800)
@@ -23,17 +23,23 @@
    real (kind=8), allocatable, dimension(:) :: latEdge, lonEdge, xEdge, yEdge, zEdge
    real (kind=8), allocatable, dimension(:) :: latVertex, lonVertex, xVertex, yVertex, zVertex
    real (kind=8), allocatable, dimension(:,:) :: weightsOnEdge, kiteAreasOnVertex
-   real (kind=8), allocatable, dimension(:) :: fEdge, fVertex, h_s
+   real (kind=8), allocatable, dimension(:) :: fEdge, fVertex, h_s, fCell
    real (kind=8), allocatable, dimension(:,:,:) :: u, v, h, vh, circulation, vorticity, ke
+   real (kind=8), allocatable, dimension(:,:,:) :: pv, vor, div, psi, chi
    real (kind=8), allocatable, dimension(:,:,:,:) :: tracers
 
    integer :: i, j, np, iCell
    integer :: nCells, nEdges, nVertices
    integer :: iRow, iCol, ii, jj
    integer :: nprocx, nprocy
-   real (kind=8) :: r
+   real (kind=8) :: r, s, t, q
    character (len=32) :: decomp_fname
 
+   integer, dimension(3) :: kx, ky
+   integer :: jCell
+   real (kind=8), dimension(3) :: phix, phiy
+   real (kind=8) :: amplitude, x, y, ndx, ndy
+
    call cell_indexing_read_nl()
 
    nCells = nx*ny
@@ -82,6 +88,7 @@
    allocate(yVertex(nVertices))
    allocate(zVertex(nVertices))
 
+   allocate(fCell(nCells))
    allocate(fEdge(nEdges))
    allocate(fVertex(nVertices))
    allocate(h_s(nCells))
@@ -96,6 +103,13 @@
    allocate(ke(nVertLevels,nCells,1))
    allocate(tracers(nTracers,nVertLevels,nCells,1))
 
+   allocate(pv(nVertLevels,nCells,1))
+   allocate(vor(nVertLevels,nCells,1))
+   allocate(div(nVertLevels,nCells,1))
+   allocate(psi(nVertLevels,nCells,1))
+   allocate(chi(nVertLevels,nCells,1))
+
+
    do iRow = 1, ny
    do iCol = 1, nx
       iCell = cellIdx(iCol,iRow)
@@ -212,7 +226,7 @@
    do iCol = 1, nx
       iCell = cellIdx(iCol, iRow)
       indexToCellID(iCell) = iCell
-      areaCell = dc*dc*sqrt(THREE) / TWO
+      areaCell(iCell) = dc*dc*sqrt(THREE) / TWO
       latCell(iCell) = 0.0
       lonCell(iCell) = 0.0
 
@@ -279,8 +293,9 @@
    ! Initialize fields in grid
    !
 
-   fEdge(:) = 1.0e-4
-   fVertex(:) = 1.0e-4
+   fCell(:) = 0.0
+   fEdge(:) = 0.0
+   fVertex(:) = 0.0
 
    h_s(:) = 0.0
    u(:,:,:) = 0.0
@@ -290,19 +305,84 @@
    vorticity(:,:,:) = 0.0
    ke(:,:,:) = 0.0
    tracers(:,:,:,:) = 0.0
-   h(:,:,:) = 1.0
 
-   do i=1,nCells
-      r = sqrt((xCell(i) - (nx/2)*(10.0*dc))**2.0 + (yCell(i) - (ny/2)*(10.0*dc))**2.0)
-      if (r &lt; 10.0*10.0*dc) then
-         tracers(1,1,i,1) = (20.0 / 2.0) * (1.0 + cos(pi*r/(10.0*10.0*dc))) + 0.0
-         h(1,i,1) = 1.0 + 0.1*cos(pi*r/(20.0*10.0*dc))
-      else
-         tracers(1,1,i,1) = 0.0
-         h(1,i,1) = 1.0
-      end if
+   h(:,:,:) = 100.0
+   pv(:,:,:) = 0.0
+   vor(:,:,:) = 0.0
+   div(:,:,:) = 0.0
+   psi(:,:,:) = 0.0
+   chi(:,:,:) = 0.0
+
+   amplitude = 18000.0
+   ndx = 2.0*pi / (nx*dc)
+   ndy = 2.0*pi / (ny*dc*sqrt(3.0)/2.0)
+   kx(1)=6; kx(2)=6; kx(3)=2
+   ky(1)=5; ky(2)=4; ky(3)=5
+   phix(1)=4.0; phix(2)=2.0; phix(3)=1.2
+   phiy(1)=0.1; phiy(2)=4.5; phiy(3)=5.0
+   write(6,*) ndx, ndy
+   write(6,*) kx
+   write(6,*) ky
+   write(6,*) phix
+   write(6,*) phiy
+
+!  s = 0
+!  do iCell=1,nCells
+!   x = xCell(iCell)
+!   y = yCell(iCell)
+!   psi(1,iCell,1) = cos( kx(1)*ndx*x + phix(1) ) * cos( ky(1)*ndy*y + phiy(1) ) + &amp;
+!                    cos( kx(2)*ndx*x + phix(2) ) * cos( ky(2)*ndy*y + phiy(2) ) + &amp;
+!                    cos( kx(3)*ndx*x + phix(3) ) * cos( ky(3)*ndy*y + phiy(3) )
+!   psi(1,iCell,1) = psi(1,iCell,1) * amplitude
+!   s = s + psi(1,iCell,1)
+!  end do
+!  psi(1,:,1) = psi(1,:,1) - s/nCells
+!  write(6,*) ' minval/maxval psi',minval(psi),maxval(psi)
+
+   s = 0
+   do iCell=1,nCells
+    x = xCell(iCell)
+    y = yCell(iCell)
+
+    vor(1,iCell,1) = -(kx(1)*ndx)**2 * cos( kx(1)*ndx*x + phix(1) ) * cos( ky(1)*ndy*y + phiy(1) ) + &amp;
+                     -(kx(2)*ndx)**2 * cos( kx(2)*ndx*x + phix(2) ) * cos( ky(2)*ndy*y + phiy(2) ) + &amp;
+                     -(kx(3)*ndx)**2 * cos( kx(3)*ndx*x + phix(3) ) * cos( ky(3)*ndy*y + phiy(3) ) + &amp;
+                     -(ky(1)*ndy)**2 * cos( kx(1)*ndx*x + phix(1) ) * cos( ky(1)*ndy*y + phiy(1) ) + &amp;
+                     -(ky(2)*ndy)**2 * cos( kx(2)*ndx*x + phix(2) ) * cos( ky(2)*ndy*y + phiy(2) ) + &amp;
+                     -(ky(3)*ndy)**2 * cos( kx(3)*ndx*x + phix(3) ) * cos( ky(3)*ndy*y + phiy(3) )
+
+    vor(1,iCell,1) = vor(1,iCell,1) * amplitude
+    s = s + vor(1,iCell,1)
    end do
+   vor(1,:,1) = vor(1,:,1) - s/nCells
+   write(6,*) ' minval/maxval vor',minval(vor),maxval(vor)
 
+
+
+!  do iCell=1,nCells
+!    do j=1,nEdgesOnCell(iCell)
+!       jCell = cellsOnCell(j,iCell)
+!       vor(1,iCell,1) = vor(1,iCell,1) + (sqrt(3.0)/3.0)*(psi(1,jCell,1)-psi(1,iCell,1))
+!       if(iCell.eq.50.or.iCell.eq.302) then
+!         write(6,21) iCell,jCell
+!         write(6,20) vor(1,iCell,1),psi(1,jCell,1),psi(1,iCell,1),areaCell(iCell)
+!       endif
+!    enddo
+!    vor(1,iCell,1) = vor(1,iCell,1) / areaCell(iCell)
+!    if(iCell.eq.50.or.iCell.eq.302) then
+!       write(6,20) xCell(iCell),yCell(iCell)
+!       write(6,21) cellsOnCell(:,iCell)
+!       write(6,20) vor(1,iCell,1),psi(1,iCell,1)
+!    endif
+!20  format(8e23.10)
+!21  format(10i8)
+!  enddo
+
+   tracers(1,1,:,1) = (vor(1,:,1) + fCell(:))/h(1,:,1)
+   pv(1,:,1) = tracers(1,1,:,1)
+   write(6,*) ' minval/maxval vor',minval(vor),maxval(vor)
+
+
    !
    ! Write grid to grid.nc file
    !
@@ -329,6 +409,7 @@
                              edgesOnVertex, &amp;
                              cellsOnVertex, &amp;
                              kiteAreasOnVertex, &amp;
+                             fCell, &amp;
                              fEdge, &amp;
                              fVertex, &amp;
                              h_s, &amp;
@@ -339,6 +420,7 @@
                              vh, &amp;
                              circulation, &amp;
                              vorticity, &amp;
+                             pv, vor, div, psi, chi, &amp;
                              ke, &amp;
                              tracers &amp;
                             )

</font>
</pre>