<p><b>ringler@lanl.gov</b> 2011-10-24 14:25:34 -0600 (Mon, 24 Oct 2011)</p><p><br>
the mesh density function (that is computed in module_scvt) is propagated into the output (grid.nc)<br>
so as to be used in the solver for the scaling of dissipation, etc.<br>
</p><hr noshade><pre><font color="gray">Modified: trunk/grid_gen/global_scvt/src/module_grid_meta.F
===================================================================
--- trunk/grid_gen/global_scvt/src/module_grid_meta.F        2011-10-24 18:45:30 UTC (rev 1122)
+++ trunk/grid_gen/global_scvt/src/module_grid_meta.F        2011-10-24 20:25:34 UTC (rev 1123)
@@ -13,6 +13,7 @@
       use grid_constants
       use sphere_utilities
       use write_netcdf
+      use scvt
    
       implicit none
    
@@ -46,8 +47,8 @@
                                          areaCell, areaTriangle, fEdge, fVertex, h_s, u_sbr
       real, allocatable, dimension(:,:,:) :: u, v, h, vh, circulation, vorticity, ke
       real, allocatable, dimension(:,:,:,:) :: tracers
-      real, allocatable, dimension(:) :: xCell, yCell, zCell, xEdge, yEdge, zEdge, xVertex, yVertex, zVertex
-      type (geo_point) :: vertex1GP, vertex2GP, cell1GP, cell2GP, cell3GP, edgeGP, edgeGP_prev, edgeGP_next
+      real, allocatable, dimension(:) :: xCell, yCell, zCell, xEdge, yEdge, zEdge, xVertex, yVertex, zVertex, meshDensity
+      type (geo_point) :: vertex1GP, vertex2GP, cell1GP, cell2GP, cell3GP, edgeGP, edgeGP_prev, edgeGP_next, pCell
       type (geo_point) :: center
       type (geo_point), allocatable, dimension(:) :: points
       type (binary_tree), pointer :: treeRoot
@@ -74,6 +75,7 @@
    
       allocate(latCell(nCells)) 
       allocate(lonCell(nCells))
+      allocate(meshDensity(nCells))
       allocate(xCell(nCells))
       allocate(yCell(nCells))
       allocate(zCell(nCells))
@@ -834,6 +836,13 @@
          indexToVertexID(i) = i
       end do
 
+      do i=1,nCells
+        pCell%lat = latCell(i)
+        pCell%lon = lonCell(i)
+        if(pCell%lon.gt. pii) pCell%lon=pCell%lon-2.0*pii
+        if(pCell%lon.ge.-pii) pCell%lon=pCell%lon+2.0*pii
+        meshDensity(i) = density_for_point(pCell)
+      enddo
 
       call write_netcdf_init( &amp;
                               nCells, &amp;
@@ -848,6 +857,7 @@
                                 1, &amp;
                                 latCell, &amp;
                                 lonCell, &amp;
+                                meshDensity, &amp;
                                 xCell, &amp;
                                 yCell, &amp;
                                 zCell, &amp;

Modified: trunk/grid_gen/global_scvt/src/module_write_netcdf.F
===================================================================
--- trunk/grid_gen/global_scvt/src/module_write_netcdf.F        2011-10-24 18:45:30 UTC (rev 1122)
+++ trunk/grid_gen/global_scvt/src/module_write_netcdf.F        2011-10-24 20:25:34 UTC (rev 1123)
@@ -15,6 +15,7 @@
    integer :: wrDimIDnTracers
    integer :: wrVarIDlatCell
    integer :: wrVarIDlonCell
+   integer :: wrVarIDmeshDensity
    integer :: wrVarIDxCell
    integer :: wrVarIDyCell
    integer :: wrVarIDzCell
@@ -148,6 +149,8 @@
       dimlist( 1) = wrDimIDnCells
       nferr = nf_def_var(wr_ncid, 'lonCell', NF_DOUBLE,  1, dimlist, wrVarIDlonCell)
       dimlist( 1) = wrDimIDnCells
+      nferr = nf_def_var(wr_ncid, 'meshDensity', NF_DOUBLE,  1, dimlist, wrVarIDmeshDensity)
+      dimlist( 1) = wrDimIDnCells
       nferr = nf_def_var(wr_ncid, 'xCell', NF_DOUBLE,  1, dimlist, wrVarIDxCell)
       dimlist( 1) = wrDimIDnCells
       nferr = nf_def_var(wr_ncid, 'yCell', NF_DOUBLE,  1, dimlist, wrVarIDyCell)
@@ -276,6 +279,7 @@
                                   time, &amp;
                                   latCell, &amp;
                                   lonCell, &amp;
+                                  meshDensity, &amp;
                                   xCell, &amp;
                                   yCell, &amp;
                                   zCell, &amp;
@@ -331,6 +335,7 @@
       integer, intent(in) :: time
       real (kind=RKIND), dimension(:), intent(in) :: latCell
       real (kind=RKIND), dimension(:), intent(in) :: lonCell
+      real (kind=RKIND), dimension(:), intent(in) :: meshDensity
       real (kind=RKIND), dimension(:), intent(in) :: xCell
       real (kind=RKIND), dimension(:), intent(in) :: yCell
       real (kind=RKIND), dimension(:), intent(in) :: zCell
@@ -408,6 +413,10 @@
  
       start1(1) = 1
       count1( 1) = wrLocalnCells
+      nferr = nf_put_vara_double(wr_ncid, wrVarIDmeshDensity, start1, count1, meshDensity)
+
+      start1(1) = 1
+      count1( 1) = wrLocalnCells
       nferr = nf_put_vara_double(wr_ncid, wrVarIDxCell, start1, count1, xCell)
  
       start1(1) = 1

</font>
</pre>