<p><b>ringler@lanl.gov</b> 2011-06-09 14:46:23 -0600 (Thu, 09 Jun 2011)</p><p><br>
removed some unused variables (e.g. circulation)<br>
<br>
fixed bug related to the specification of the initial ocean layer thickness field<br>
</p><hr noshade><pre><font color="gray">Modified: branches/ocean_projects/basin/src/basin.F
===================================================================
--- branches/ocean_projects/basin/src/basin.F        2011-06-09 18:30:13 UTC (rev 891)
+++ branches/ocean_projects/basin/src/basin.F        2011-06-09 20:46:23 UTC (rev 892)
@@ -45,8 +45,8 @@
 
 real, allocatable, dimension(:) :: fEdge, fVertex, h_s, work1
 real, allocatable, dimension(:,:) :: u_src
-real, allocatable, dimension(:,:,:) :: u, v, h, vh
-real, allocatable, dimension(:,:,:) :: circulation, vorticity, ke, rho
+real, allocatable, dimension(:,:,:) :: u, v, h
+real, allocatable, dimension(:,:,:) :: rho
 real, allocatable, dimension(:,:,:,:) :: tracers
 
 integer nlon, nlat, ndepth
@@ -95,7 +95,6 @@
 
    real (kind=8) :: ymid, ytmp, ymax, xmid, xloc, yloc, pert, ymin, distance, r, c1(3), c2(3)
    real (kind=8) :: latmid, lattmp, latmax, latmin
-   real (kind=8), allocatable, dimension(:,:,:) :: utmp
    integer :: cell1, cell2
 
 
@@ -116,8 +115,8 @@
 
 real, allocatable, dimension(:) :: fEdgeNew, fVertexNew, h_sNew
 real, allocatable, dimension(:,:) :: u_srcNew
-real, allocatable, dimension(:,:,:) :: uNew, vNew, hNew, vhNew
-real, allocatable, dimension(:,:,:) :: circulationNew, vorticityNew, keNew, rhoNew, temperatureNew, salinityNew
+real, allocatable, dimension(:,:,:) :: uNew, vNew, hNew
+real, allocatable, dimension(:,:,:) :: rhoNew, temperatureNew, salinityNew
 real, allocatable, dimension(:) :: temperatureRestoreNew, salinityRestoreNew
 real, allocatable, dimension(:,:,:,:) :: tracersNew
 
@@ -136,30 +135,6 @@
 write(6,*) ' starting'
 write(6,*)
 
-write(6,*) ' getting woce t and s '
-call read_TS_init(nlon, nlat, ndepth)
-write(6,*) ' TS INIT ', nlon, nlat, ndepth
-allocate(t_lon(nlon), t_lat(nlat), depth_t(ndepth), TEMP(nlon,nlat,ndepth), SALT(nlon,nlat,ndepth))
-allocate(TAUX(nlon,nlat), TAUY(nlon,nlat))
-allocate(mTEMP(nlat,ndepth), mSALT(nlat,ndepth))
-call read_TS_fields(t_lon, t_lat, depth_t, TEMP, SALT, TAUX, TAUY)
-call read_TS_finalize()
-do k=1,ndepth
-     ndata = 0; temp_t=0; temp_s=0
-     do j=1,nlat
-     do i=1,nlon
-       if(TEMP(i,j,k).gt.-10.0) then
-         ndata = ndata + 1
-         temp_t = temp_t + TEMP(i,j,k)
-         temp_s = temp_s + SALT(i,j,k)
-       endif
-     enddo
-     enddo
-     mTEMP(:,k) = temp_t / float(ndata)
-     mSALT(:,k) = temp_s / float(ndata)
-     write(6,*) ndata,mTemp(1,k),mSalt(1,k)
-enddo
-
 ! get depth profile for later
 call get_dz
 
@@ -198,6 +173,30 @@
 ! check the mesh
 call error_checking
 
+write(6,*) ' getting woce t and s '
+call read_TS_init(nlon, nlat, ndepth)
+write(6,*) ' TS INIT ', nlon, nlat, ndepth
+allocate(t_lon(nlon), t_lat(nlat), depth_t(ndepth), TEMP(nlon,nlat,ndepth), SALT(nlon,nlat,ndepth))
+allocate(TAUX(nlon,nlat), TAUY(nlon,nlat))
+allocate(mTEMP(nlat,ndepth), mSALT(nlat,ndepth))
+call read_TS_fields(t_lon, t_lat, depth_t, TEMP, SALT, TAUX, TAUY)
+call read_TS_finalize()
+do k=1,ndepth
+     ndata = 0; temp_t=0; temp_s=0
+     do j=1,nlat
+     do i=1,nlon
+       if(TEMP(i,j,k).gt.-10.0) then
+         ndata = ndata + 1
+         temp_t = temp_t + TEMP(i,j,k)
+         temp_s = temp_s + SALT(i,j,k)
+       endif
+     enddo
+     enddo
+     mTEMP(:,k) = temp_t / float(ndata)
+     mSALT(:,k) = temp_s / float(ndata)
+     write(6,*) ndata,mTemp(1,k),mSalt(1,k)
+enddo
+
 ! generate initial conditions
 call get_init_conditions
 
@@ -299,10 +298,6 @@
 salinityNew = 1.0
 uNew = 0
 vNew = 0
-vorticityNew = 0
-circulationNew = 0
-keNew = 0
-vhNew = 0
 
 if(.not.real_bathymetry) then
 
@@ -313,10 +308,6 @@
    h_sNew(:) = 0.0
    uNew(:,:,:) = 0.0
    vNew(:,:,:) = 0.0
-   vhNew(:,:,:) = 0.0
-   circulationNew(:,:,:) = 0.0
-   vorticityNew(:,:,:) = 0.0
-   keNew(:,:,:) = 0.0
    tracersNew(:,:,:,:) = 0.0
 
  ! basin-mod
@@ -551,6 +542,7 @@
 if(l_woce) then
 iNoData = 0
 do iCell=1,nCellsNew
+  hNew(1,:,iCell) = dz(:)
   if(mod(iCell,100).eq.0) write(6,*) 'l_woce t and s',iCell
   rlon = lonCellNew(iCell)/dtr
   rlat = latCellNew(iCell)/dtr
@@ -565,14 +557,14 @@
   enddo
   do k=1,maxLevelCellNew(iCell)
     ndata = 0; temp_t = 0; temp_s = 0; kdata(:) = 0
-    do i=-50,50
+    do i=-15,15
       ixt = ix + 8*i
       if(ixt.lt.1) then
         ixt = ixt + nlon
       elseif(ixt.gt.nlon) then
         ixt = ixt - nlon
       endif
-      do j=-50,50
+      do j=-15,15
         iyt = iy + 8*j
         flag_lat = .true.
         if(iyt.lt.1.or.iyt.gt.nlat) then
@@ -603,7 +595,7 @@
 enddo
 
 ! do a couple of smoothing passes
-do iter=1,3
+do iter=1,5
 do iCell=1,nCellsNew
 do k=1,maxLevelCellNew(iCell)
   ndata=1
@@ -611,11 +603,13 @@
   temp_s = salinityNew(1,k,iCell)
   do j=1,nEdgesOnCellNew(iCell)
     jCell = cellsOnCellNew(j,iCell)
+    if(jCell.gt.0) then
     if(maxLevelCellNew(jCell).ge.k) then
       temp_t = temp_t + temperatureNew(1,k,jCell)
       temp_s = temp_s + salinityNew(1,k,jCell)
       ndata = ndata + 1
     endif
+    endif
   enddo
   temperatureNew(1,k,iCell) = temp_t / ndata
   salinityNew(1,k,iCell) = temp_s / ndata
@@ -865,10 +859,6 @@
 allocate(u(1,nVertLevels,nEdges))
 allocate(v(1,nVertLevels,nEdges))
 allocate(h(1,nVertLevels,nCells))
-allocate(vh(1,nVertLevels,nEdges))
-allocate(circulation(1,nVertLevels,nVertices))
-allocate(vorticity(1,nVertLevels,nVertices))
-allocate(ke(1,nVertLevels,nCells))
 allocate(rho(1,nVertLevels,nCells))
 allocate(tracers(1,nTracers,nVertLevels,nCells))
 
@@ -884,8 +874,7 @@
 edgesOnVertex=0; cellsOnVertex=0; kiteAreasOnVertex=0
 
 fEdge=0; fVertex=0; h_s=0; u_src=0; work1=0
-u=0; v=0; h=0; vh=0; circulation=0; ke=0; rho=0
-vorticity=0
+u=0; v=0; h=0; rho=0
 tracers=0
 
 
@@ -932,10 +921,6 @@
                     u, &amp;
                     v, &amp;
                     h, &amp;
-                    vh, &amp;
-                    circulation, &amp;
-                    vorticity, &amp;
-                    ke, &amp;
                     tracers &amp;
                    )
 
@@ -981,10 +966,6 @@
 write(6,*) ' u : ', minval(u), maxval(u)
 write(6,*) ' v : ', minval(v), maxval(v)
 write(6,*) ' h : ', minval(h), maxval(h)
-write(6,*) ' vh : ', minval(vh), maxval(vh)
-write(6,*) ' circulation : ', minval(circulation), maxval(circulation)
-write(6,*) ' vorticity : ', minval(vorticity), maxval(vorticity)
-write(6,*) ' ke : ', minval(ke), maxval(ke)
 write(6,*) ' tracers : ', minval(tracers), maxval(tracers)
 
 end subroutine read_grid
@@ -1069,10 +1050,6 @@
                     uNew, &amp;
                     vNew, &amp;
                     hNew, &amp;
-                    vhNew, &amp;
-                    circulationNew, &amp;
-                    vorticityNew, &amp;
-                    keNew, &amp;
                     rhoNew, &amp;
                     tracersNew, &amp;
                     temperatureNew, &amp;
@@ -1097,7 +1074,7 @@
    dvEdgeNew = dvEdgeNew / sphere_radius
    areaCellNew = areaCellNew / (sphere_radius)**2
    areaTriangleNew = areaTriangleNew / (sphere_radius)**2
-   kiteAreasOnVertex = kiteAreasOnVertex / (sphere_radius)**2
+   kiteAreasOnVertexNew = kiteAreasOnVertexNew / (sphere_radius)**2
 endif
 
 end subroutine write_grid
@@ -1338,10 +1315,6 @@
 allocate(uNew(1,nVertLevelsNew,nEdgesNew))
 allocate(vNew(1,nVertLevelsNew,nEdgesNew))
 allocate(hNew(1,nVertLevelsNew,nCellsNew))
-allocate(vhNew(1,nVertLevelsNew,nEdgesNew))
-allocate(circulationNew(1,nVertLevelsNew,nVerticesNew))
-allocate(vorticityNew(1,nVertLevelsNew,nVerticesNew))
-allocate(keNew(1,nVertLevelsNew,nCellsNew))
 allocate(rhoNew(1,nVertLevelsNew,nCellsNew))
 allocate(tracersNew(1,nTracersNew,nVertLevelsNew,nCellsNew))
 allocate(temperatureNew(1,nVertLevelsNew,nCellsNew))
@@ -1355,8 +1328,7 @@
 xVertexNew=0; yVertexNew=0; zVertexNew=0; latVertexNew=0; lonVertexNew=0
 
 fEdgeNew=0; fVertexNew=0; h_sNew=0; u_srcNew=0
-uNew=0; vNew=0; hNew=0; vhNew=0; circulationNew=0; keNew=0; rhoNew=0
-vorticityNew=0
+uNew=0; vNew=0; hNew=0; rhoNew=0
 tracersNew=0; temperatureNew=0; salinityNew=0
 
 temperatureRestoreNew = 0.0
@@ -1405,6 +1377,24 @@
 endif
 enddo
 
+deallocate(xCell)
+deallocate(yCell)
+deallocate(zCell)
+deallocate(latCell)
+deallocate(lonCell)
+deallocate(xEdge)
+deallocate(yEdge)
+deallocate(zEdge)
+deallocate(latEdge)
+deallocate(lonEdge)
+deallocate(xVertex)
+deallocate(yVertex)
+deallocate(zVertex)
+deallocate(latVertex)
+deallocate(lonVertex)
+deallocate(dcEdge)
+deallocate(dvEdge)
+
 end subroutine map_vectors
 
 
@@ -1435,6 +1425,7 @@
     flipVerticesOnEdgeOrdering(iEdgeNew) = 1
 endif
 enddo
+deallocate(cellsOnEdge)
 
 allocate(verticesOnEdgeNew(TWONew,nEdgesNew))
 allocate(boundaryVertexNew(nVertLevelsNew,nVerticesNew))
@@ -1460,6 +1451,7 @@
     boundaryVertexNew(:,iVertex2New)=1
 endif
 enddo
+deallocate(verticesOnEdge)
 
 allocate(nEdgesOnEdgeNew(nEdgesNew))
 allocate(edgesOnEdgeNew(maxEdges2,nEdgesNew))
@@ -1485,6 +1477,9 @@
     enddo
 endif
 enddo
+deallocate(nEdgesOnEdge)
+deallocate(edgesOnEdge)
+deallocate(weightsOnEdge)
 
 allocate(cellsOnCellNew(maxEdges,nCellsNew))
 allocate(nEdgesOnCellNew(nCellsNew))
@@ -1500,6 +1495,8 @@
 cellsOnCellNew(i,iCellNew) = jNew
 enddo
 enddo
+deallocate(cellsOnCell)
+deallocate(nEdgesOnCell)
 
 allocate(edgesOnCellNew(maxEdgesNew,nCellsNew))
 edgesOnCellNew(:,:) = 0
@@ -1513,6 +1510,7 @@
 edgesOnCellNew(i,iCellNew) = jNew
 enddo
 enddo
+deallocate(edgesOnCell)
 
 allocate(verticesOnCellNew(maxEdgesNew,nCellsNew))
 verticesOnCellNew(:,:)=0
@@ -1526,6 +1524,7 @@
 verticesOnCellNew(i,iCellNew) = jNew
 enddo
 enddo
+deallocate(verticesOnCell)
 
 allocate(cellsOnVertexNew(vertexDegreeNew,nVerticesNew))
 allocate(kiteAreasOnVertexNew(vertexDegreeNew,nVerticesNew))
@@ -1545,6 +1544,8 @@
 cellsOnVertexNew(i,iVertexNew)=jNew
 enddo
 enddo
+deallocate(cellsOnVertex)
+deallocate(kiteAreasOnVertex)
 
 areaTriangleNew = 0
 do iVertex=1,nVerticesNew
@@ -1564,6 +1565,7 @@
 edgesOnVertexNew(i,iVertexNew)=jNew
 enddo
 enddo
+deallocate(edgesOnVertex)
 
 ! find normals
 normalsNew = 0.0

Modified: branches/ocean_projects/basin/src/module_read_netcdf.F
===================================================================
--- branches/ocean_projects/basin/src/module_read_netcdf.F        2011-06-09 18:30:13 UTC (rev 891)
+++ branches/ocean_projects/basin/src/module_read_netcdf.F        2011-06-09 20:46:23 UTC (rev 892)
@@ -52,10 +52,6 @@
    integer :: rdVarIDu
    integer :: rdVarIDv
    integer :: rdVarIDh
-   integer :: rdVarIDvh
-   integer :: rdVarIDcirculation
-   integer :: rdVarIDvorticity
-   integer :: rdVarIDke
    integer :: rdVarIDtracers
  
    integer :: rdLocalnCells
@@ -179,10 +175,6 @@
       nferr = nf_inq_varid(rd_ncid, 'u', rdVarIDu)
       nferr = nf_inq_varid(rd_ncid, 'v', rdVarIDv)
       nferr = nf_inq_varid(rd_ncid, 'h', rdVarIDh)
-      nferr = nf_inq_varid(rd_ncid, 'vh', rdVarIDvh)
-      nferr = nf_inq_varid(rd_ncid, 'circulation', rdVarIDcirculation)
-      nferr = nf_inq_varid(rd_ncid, 'vorticity', rdVarIDvorticity)
-      nferr = nf_inq_varid(rd_ncid, 'ke', rdVarIDke)
       nferr = nf_inq_varid(rd_ncid, 'tracers', rdVarIDtracers)
  
    end subroutine read_netcdf_init
@@ -231,10 +223,6 @@
                                   u, &amp;
                                   v, &amp;
                                   h, &amp;
-                                  vh, &amp;
-                                  circulation, &amp;
-                                  vorticity, &amp;
-                                  ke, &amp;
                                   tracers &amp;
                                  )
  
@@ -284,10 +272,6 @@
       real (kind=8), dimension(:,:,:), intent(out) :: u
       real (kind=8), dimension(:,:,:), intent(out) :: v
       real (kind=8), dimension(:,:,:), intent(out) :: h
-      real (kind=8), dimension(:,:,:), intent(out) :: vh
-      real (kind=8), dimension(:,:,:), intent(out) :: circulation
-      real (kind=8), dimension(:,:,:), intent(out) :: vorticity
-      real (kind=8), dimension(:,:,:), intent(out) :: ke
       real (kind=8), dimension(:,:,:,:), intent(out) :: tracers
  
       integer :: nferr
@@ -513,30 +497,6 @@
       count3( 3) = 1
       nferr = nf_get_vara_double(rd_ncid, rdVarIDh, start3, count3, h)
  
-      start3(3) = time
-      count3( 1) = rdLocalnVertLevels
-      count3( 2) = rdLocalnEdges
-      count3( 3) = 1
-      nferr = nf_get_vara_double(rd_ncid, rdVarIDvh, start3, count3, vh)

-      start3(3) = time
-      count3( 1) = rdLocalnVertLevels
-      count3( 2) = rdLocalnVertices
-      count3( 3) = 1
-      nferr = nf_get_vara_double(rd_ncid, rdVarIDcirculation, start3, count3, circulation)

-      start3(3) = time
-      count3( 1) = rdLocalnVertLevels
-      count3( 2) = rdLocalnVertices
-      count3( 3) = 1
-      nferr = nf_get_vara_double(rd_ncid, rdVarIDvorticity, start3, count3, vorticity)

-      start3(3) = time
-      count3( 1) = rdLocalnVertLevels
-      count3( 2) = rdLocalnCells
-      count3( 3) = 1
-      nferr = nf_get_vara_double(rd_ncid, rdVarIDke, start3, count3, ke)

       start4(4) = time
       count4( 1) = rdLocalnTracers
       count4( 2) = rdLocalnVertLevels

Modified: branches/ocean_projects/basin/src/module_write_netcdf.F
===================================================================
--- branches/ocean_projects/basin/src/module_write_netcdf.F        2011-06-09 18:30:13 UTC (rev 891)
+++ branches/ocean_projects/basin/src/module_write_netcdf.F        2011-06-09 20:46:23 UTC (rev 892)
@@ -56,10 +56,6 @@
    integer :: wrVarIDu_src
    integer :: wrVarIDv
    integer :: wrVarIDh
-   integer :: wrVarIDvh
-   integer :: wrVarIDcirculation
-   integer :: wrVarIDvorticity
-   integer :: wrVarIDke
    integer :: wrVarIDrho
    integer :: wrVarIDtracers
    integer :: wrVarIDtemperature
@@ -249,24 +245,8 @@
       dimlist( 3) = wrDimIDTime
       nferr = nf_def_var(wr_ncid, 'h', NF_DOUBLE,  3, dimlist, wrVarIDh)
       dimlist( 1) = wrDimIDnVertLevels
-      dimlist( 2) = wrDimIDnEdges
-      dimlist( 3) = wrDimIDTime
-      nferr = nf_def_var(wr_ncid, 'vh', NF_DOUBLE,  3, dimlist, wrVarIDvh)
-      dimlist( 1) = wrDimIDnVertLevels
-      dimlist( 2) = wrDimIDnVertices
-      dimlist( 3) = wrDimIDTime
-      nferr = nf_def_var(wr_ncid, 'circulation', NF_DOUBLE,  3, dimlist, wrVarIDcirculation)
-      dimlist( 1) = wrDimIDnVertLevels
-      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, 'ke', NF_DOUBLE,  3, dimlist, wrVarIDke)
-      dimlist( 1) = wrDimIDnVertLevels
-      dimlist( 2) = wrDimIDnCells
-      dimlist( 3) = wrDimIDTime
       nferr = nf_def_var(wr_ncid, 'rho', NF_DOUBLE,  3, dimlist, wrVarIDrho)
       dimlist( 1) = wrDimIDnTracers
       dimlist( 2) = wrDimIDnVertLevels
@@ -338,10 +318,6 @@
                                   u, &amp;
                                   v, &amp;
                                   h, &amp;
-                                  vh, &amp;
-                                  circulation, &amp;
-                                  vorticity, &amp;
-                                  ke, &amp;
                                   rho, &amp;
                                   tracers, &amp;
                                   temperature, &amp;
@@ -400,10 +376,6 @@
       real (kind=8), dimension(:,:,:), intent(in) :: u
       real (kind=8), dimension(:,:,:), intent(in) :: v
       real (kind=8), dimension(:,:,:), intent(in) :: h
-      real (kind=8), dimension(:,:,:), intent(in) :: vh
-      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) :: rho
       real (kind=8), dimension(:,:,:,:), intent(in) :: tracers
       real (kind=8), dimension(:,:,:), intent(in) :: temperature
@@ -641,32 +613,8 @@
  
       start3(3) = time
       count3( 1) = wrLocalnVertLevels
-      count3( 2) = wrLocalnEdges
-      count3( 3) = 1
-      nferr = nf_put_vara_double(wr_ncid, wrVarIDvh, start3, count3, vh)

-      start3(3) = time
-      count3( 1) = wrLocalnVertLevels
-      count3( 2) = wrLocalnVertices
-      count3( 3) = 1
-      nferr = nf_put_vara_double(wr_ncid, wrVarIDcirculation, start3, count3, circulation)

-      start3(3) = time
-      count3( 1) = wrLocalnVertLevels
-      count3( 2) = wrLocalnVertices
-      count3( 3) = 1
-      nferr = nf_put_vara_double(wr_ncid, wrVarIDvorticity, start3, count3, vorticity)

-      start3(3) = time
-      count3( 1) = wrLocalnVertLevels
       count3( 2) = wrLocalnCells
       count3( 3) = 1
-      nferr = nf_put_vara_double(wr_ncid, wrVarIDke, start3, count3, ke)
-
-      start3(3) = time
-      count3( 1) = wrLocalnVertLevels
-      count3( 2) = wrLocalnCells
-      count3( 3) = 1
       nferr = nf_put_vara_double(wr_ncid, wrVarIDrho, start3, count3, rho)
  
       start4(4) = time

</font>
</pre>