<p><b>sprice@lanl.gov</b> 2011-08-30 16:18:11 -0600 (Tue, 30 Aug 2011)</p><p>Branch Commit (landice): More clean up of 'icesheet.F' code, for extracting ice sheet vars from regular grid and interpolating onto hex mesh. Ocean model vars are no longer present in resulting .nc output file. Still a bit more tidying up to do.<br>
</p><hr noshade><pre><font color="gray">Modified: branches/land_ice/icesheet/src/icesheet.F
===================================================================
--- branches/land_ice/icesheet/src/icesheet.F        2011-08-30 20:37:08 UTC (rev 967)
+++ branches/land_ice/icesheet/src/icesheet.F        2011-08-30 22:18:11 UTC (rev 968)
@@ -124,7 +124,6 @@
!ice sheet variables
real(kind=8), allocatable, dimension(:,:,:) :: thckNew, topgNew
-!real(kind=4), allocatable, dimension(:,:,:) :: thckNew0, topgNew0 ! temp work variables - figure out how to do w/o these
real(kind=4), allocatable, dimension(:) :: thckdata, topgdata
! mapping variables
@@ -180,32 +179,8 @@
! 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
+!call get_init_conditions
! dump new grid to netCDF
write(6,*) ' calling write_grid'
@@ -299,23 +274,13 @@
pi = 4.0*atan(1.0)
dtr = pi/180.0
-!hNew = 10.0
-!salinityNew = 1.0
-
-hNew(1,:,:) = dble(thckNew(1,:,:))
-salinityNew(1,:,:) = dble(topgNew(1,:,:))
-
+hNew = 10.0
+salinityNew = 1.0
temperatureNew = 1.0
tracer1New = 1.0
uNew = 0
vNew = 0
-! ice sheet vars
-!thckNew(1,:,:) = dble(thckNew0(1,:,:))
-!topgNew(1,:,:) = dble(topgNew0(1,:,:))
-!deallocate( thckNew0 )
-!deallocate( topgNew0 )
-
write(6,*) ' done get_init_conditions'
end subroutine get_init_conditions
@@ -724,21 +689,21 @@
kiteAreasOnVertexNew, &
fEdgeNew, &
fVertexNew, &
- h_sNew, &
+! h_sNew, &
boundaryEdgeNew, &
boundaryVertexNew, &
- u_srcNew, &
- uNew, &
- vNew, &
- hNew, &
- rhoNew, &
- temperatureNew, &
- salinityNew, &
- tracer1New, &
- temperatureRestoreNew, &
- salinityRestoreNew &
-! thckNew, &
-! topgNew &
+! u_srcNew, &
+! uNew, &
+! vNew, &
+! hNew, &
+! rhoNew, &
+! temperatureNew, &
+! salinityNew, &
+! tracer1New, &
+! temperatureRestoreNew, &
+! salinityRestoreNew, &
+ thckNew, &
+ topgNew &
)
call write_netcdf_finalize
@@ -878,15 +843,9 @@
allocate(topgNew(1,1,nNewCells))
thckNew = 0
topgNew = 0
-! allocate(thckNew0(1,1,nNewCells))
-! allocate(topgNew0(1,1,nNewCells))
-! thckNew0 = 0
-! topgNew0 = 0
counter = 1
do iCell=1,nCells
if( kmt(iCell) /= 0 )then
-! thckNew0(1,1,counter) = thckdata(iCell)
-! topgNew0(1,1,counter) = topgdata(iCell)
thckNew(1,1,counter) = thckdata(iCell)
topgNew(1,1,counter) = topgdata(iCell)
counter = counter + 1
@@ -902,7 +861,6 @@
end subroutine define_kmt
-
subroutine define_mapping
implicit none
Modified: branches/land_ice/icesheet/src/module_write_netcdf.F
===================================================================
--- branches/land_ice/icesheet/src/module_write_netcdf.F        2011-08-30 20:37:08 UTC (rev 967)
+++ branches/land_ice/icesheet/src/module_write_netcdf.F        2011-08-30 22:18:11 UTC (rev 968)
@@ -48,23 +48,23 @@
integer :: wrVarIDkiteAreasOnVertex
integer :: wrVarIDfEdge
integer :: wrVarIDfVertex
- integer :: wrVarIDh_s
- integer :: wrVarIDu
+! integer :: wrVarIDh_s
+! integer :: wrVarIDu
integer :: wrVarIDboundaryEdge
integer :: wrVarIDboundaryVertex
- integer :: wrVarIDu_src
- integer :: wrVarIDv
- integer :: wrVarIDh
- integer :: wrVarIDrho
- integer :: wrVarIDtemperature
- integer :: wrVarIDsalinity
- integer :: wrVarIDtracer1
- integer :: wrVarIDtemperatureRestore
- integer :: wrVarIDsalinityRestore
+! integer :: wrVarIDu_src
+! integer :: wrVarIDv
+! integer :: wrVarIDh
+! integer :: wrVarIDrho
+! integer :: wrVarIDtemperature
+! integer :: wrVarIDsalinity
+! integer :: wrVarIDtracer1
+! integer :: wrVarIDtemperatureRestore
+! integer :: wrVarIDsalinityRestore
! ice sheet variables
-! integer :: wrVarIDthck
-! integer :: wrVarIDtopg
+ integer :: wrVarIDthck
+ integer :: wrVarIDtopg
integer :: wrLocalnCells
integer :: wrLocalnEdges
@@ -216,60 +216,60 @@
dimlist( 1) = wrDimIDnVertices
nferr = nf_def_var(wr_ncid, 'fVertex', NF_DOUBLE, 1, dimlist, wrVarIDfVertex)
dimlist( 1) = wrDimIDnCells
- nferr = nf_def_var(wr_ncid, 'h_s', NF_DOUBLE, 1, dimlist, wrVarIDh_s)
- dimlist( 1) = wrDimIDnCells
- nferr = nf_def_var(wr_ncid, 'temperatureRestore', NF_DOUBLE, 1, dimlist, wrVarIDtemperatureRestore)
- dimlist( 1) = wrDimIDnCells
- nferr = nf_def_var(wr_ncid, 'salinityRestore', NF_DOUBLE, 1, dimlist, wrVarIDsalinityRestore)
- dimlist( 1) = wrDimIDnVertLevels
- dimlist( 2) = wrDimIDnEdges
- dimlist( 3) = wrDimIDTime
- nferr = nf_def_var(wr_ncid, 'u', NF_DOUBLE, 3, dimlist, wrVarIDu)
- dimlist( 1) = wrDimIDnVertLevels
- dimlist( 2) = wrDimIDnEdges
+! nferr = nf_def_var(wr_ncid, 'h_s', NF_DOUBLE, 1, dimlist, wrVarIDh_s)
+! dimlist( 1) = wrDimIDnCells
+! nferr = nf_def_var(wr_ncid, 'temperatureRestore', NF_DOUBLE, 1, dimlist, wrVarIDtemperatureRestore)
+! dimlist( 1) = wrDimIDnCells
+! nferr = nf_def_var(wr_ncid, 'salinityRestore', NF_DOUBLE, 1, dimlist, wrVarIDsalinityRestore)
+! dimlist( 1) = wrDimIDnVertLevels
+! dimlist( 2) = wrDimIDnEdges
+! dimlist( 3) = wrDimIDTime
+! nferr = nf_def_var(wr_ncid, 'u', NF_DOUBLE, 3, dimlist, wrVarIDu)
+! dimlist( 1) = wrDimIDnVertLevels
+! dimlist( 2) = wrDimIDnEdges
nferr = nf_def_var(wr_ncid, 'boundaryEdge', NF_INT, 2, dimlist, wrVarIDboundaryEdge)
dimlist( 1) = wrDimIDnVertLevels
dimlist( 2) = wrDimIDnVertices
nferr = nf_def_var(wr_ncid, 'boundaryVertex', NF_INT, 2, dimlist, wrVarIDboundaryVertex)
dimlist( 1) = wrDimIDnVertLevels
dimlist( 2) = wrDimIDnEdges
- nferr = nf_def_var(wr_ncid, 'u_src', NF_DOUBLE, 2, dimlist, wrVarIDu_src)
+! nferr = nf_def_var(wr_ncid, 'u_src', NF_DOUBLE, 2, dimlist, wrVarIDu_src)
+! dimlist( 1) = wrDimIDnVertLevels
+! dimlist( 2) = wrDimIDnEdges
+! dimlist( 3) = wrDimIDTime
+! nferr = nf_def_var(wr_ncid, 'v', NF_DOUBLE, 3, dimlist, wrVarIDv)
+! dimlist( 1) = wrDimIDnVertLevels
+! dimlist( 2) = wrDimIDnCells
+! dimlist( 3) = wrDimIDTime
+! nferr = nf_def_var(wr_ncid, 'h', NF_DOUBLE, 3, dimlist, wrVarIDh)
+! dimlist( 1) = wrDimIDnVertLevels
+! dimlist( 2) = wrDimIDnCells
+! dimlist( 3) = wrDimIDTime
+! nferr = nf_def_var(wr_ncid, 'rho', NF_DOUBLE, 3, dimlist, wrVarIDrho)
+! dimlist( 1) = wrDimIDnVertLevels
+! dimlist( 2) = wrDimIDnCells
+! dimlist( 3) = wrDimIDTime
+! nferr = nf_def_var(wr_ncid, 'temperature', NF_DOUBLE, 3, dimlist, wrVarIDtemperature)
+! dimlist( 1) = wrDimIDnVertLevels
+! dimlist( 2) = wrDimIDnCells
+! dimlist( 3) = wrDimIDTime
+! nferr = nf_def_var(wr_ncid, 'salinity', NF_DOUBLE, 3, dimlist, wrVarIDsalinity)
+! dimlist( 1) = wrDimIDnVertLevels
+! dimlist( 2) = wrDimIDnCells
+! dimlist( 3) = wrDimIDTime
+! ! If you do not want tracer1 in your input file, simply comment out these two lines (one of two)
+! nferr = nf_def_var(wr_ncid, 'tracer1', NF_DOUBLE, 3, dimlist, wrVarIDtracer1)
+
+ ! ice sheet variables (NOTE: for now, we are assuming vert dim of 1, so this works). If nVertLevels > 1, this dimensioning
+ ! won't work, since thickness and topography are only 2d fields)
+ nferr = nf_def_var(wr_ncid, 'thck', NF_DOUBLE, 3, dimlist, wrVarIDthck)
dimlist( 1) = wrDimIDnVertLevels
- dimlist( 2) = wrDimIDnEdges
- dimlist( 3) = wrDimIDTime
- nferr = nf_def_var(wr_ncid, 'v', NF_DOUBLE, 3, dimlist, wrVarIDv)
- dimlist( 1) = wrDimIDnVertLevels
dimlist( 2) = wrDimIDnCells
dimlist( 3) = wrDimIDTime
- nferr = nf_def_var(wr_ncid, 'h', NF_DOUBLE, 3, dimlist, wrVarIDh)
+ nferr = nf_def_var(wr_ncid, 'topg', NF_DOUBLE, 3, dimlist, wrVarIDtopg)
dimlist( 1) = wrDimIDnVertLevels
dimlist( 2) = wrDimIDnCells
dimlist( 3) = wrDimIDTime
- nferr = nf_def_var(wr_ncid, 'rho', NF_DOUBLE, 3, dimlist, wrVarIDrho)
- dimlist( 1) = wrDimIDnVertLevels
- dimlist( 2) = wrDimIDnCells
- dimlist( 3) = wrDimIDTime
- nferr = nf_def_var(wr_ncid, 'temperature', NF_DOUBLE, 3, dimlist, wrVarIDtemperature)
- dimlist( 1) = wrDimIDnVertLevels
- dimlist( 2) = wrDimIDnCells
- dimlist( 3) = wrDimIDTime
- nferr = nf_def_var(wr_ncid, 'salinity', NF_DOUBLE, 3, dimlist, wrVarIDsalinity)
- dimlist( 1) = wrDimIDnVertLevels
- dimlist( 2) = wrDimIDnCells
- dimlist( 3) = wrDimIDTime
- ! If you do not want tracer1 in your input file, simply comment out these two lines (one of two)
- nferr = nf_def_var(wr_ncid, 'tracer1', NF_DOUBLE, 3, dimlist, wrVarIDtracer1)
-
- ! ice sheet variables (NOTE: for now, we are assuming vert dim of 1, so this works). If nVertLevels > 1, this dimensioning
- ! won't work, since thickness and topography are only 2d fields)
-! nferr = nf_def_var(wr_ncid, 'thck', NF_DOUBLE, 3, dimlist, wrVarIDthck)
-! dimlist( 1) = wrDimIDnVertLevels
-! dimlist( 2) = wrDimIDnCells
-! dimlist( 3) = wrDimIDTime
-! nferr = nf_def_var(wr_ncid, 'topg', NF_DOUBLE, 3, dimlist, wrVarIDtopg)
-! dimlist( 1) = wrDimIDnVertLevels
-! dimlist( 2) = wrDimIDnCells
-! dimlist( 3) = wrDimIDTime
nferr = nf_put_att_text(wr_ncid, NF_GLOBAL, 'on_a_sphere', 16, on_a_sphere)
nferr = nf_put_att_double(wr_ncid, NF_GLOBAL, 'sphere_radius', NF_DOUBLE, 1, sphere_radius)
@@ -319,21 +319,21 @@
kiteAreasOnVertex, &
fEdge, &
fVertex, &
- h_s, &
+! h_s, &
boundaryEdge, &
boundaryVertex, &
- u_src, &
- u, &
- v, &
- h, &
- rho, &
- temperature, &
- salinity, &
- tracer1, &
- temperatureRestore, &
- salinityRestore &
-! thck, &
-! topg &
+! u_src, &
+! u, &
+! v, &
+! h, &
+! rho, &
+! temperature, &
+! salinity, &
+! tracer1, &
+! temperatureRestore, &
+! salinityRestore, &
+ thck, &
+ topg &
)
implicit none
@@ -379,23 +379,23 @@
real (kind=8), dimension(:,:), intent(in) :: kiteAreasOnVertex
real (kind=8), dimension(:), intent(in) :: fEdge
real (kind=8), dimension(:), intent(in) :: fVertex
- real (kind=8), dimension(:), intent(in) :: h_s
+! real (kind=8), dimension(:), intent(in) :: h_s
integer, dimension(:,:), intent(in) :: boundaryEdge
integer, dimension(:,:), intent(in) :: boundaryVertex
- real (kind=8), dimension(:,:), intent(in) :: u_src
- 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) :: rho
- real (kind=8), dimension(:,:,:), intent(in) :: temperature
- real (kind=8), dimension(:,:,:), intent(in) :: salinity
- real (kind=8), dimension(:,:,:), intent(in) :: tracer1
- real (kind=8), dimension(:), intent(in) :: temperatureRestore
- real (kind=8), dimension(:), intent(in) :: salinityRestore
+! real (kind=8), dimension(:,:), intent(in) :: u_src
+! 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) :: rho
+! real (kind=8), dimension(:,:,:), intent(in) :: temperature
+! real (kind=8), dimension(:,:,:), intent(in) :: salinity
+! real (kind=8), dimension(:,:,:), intent(in) :: tracer1
+! real (kind=8), dimension(:), intent(in) :: temperatureRestore
+! real (kind=8), dimension(:), intent(in) :: salinityRestore
! ice sheet fields
-! real (kind=8), dimension(:,:,:), intent(in) :: thck
-! real (kind=8), dimension(:,:,:), intent(in) :: topg
+ real (kind=8), dimension(:,:,:), intent(in) :: thck
+ real (kind=8), dimension(:,:,:), intent(in) :: topg
integer :: nferr
integer, dimension(1) :: start1, count1
@@ -579,9 +579,9 @@
count1( 1) = wrLocalnVertices
nferr = nf_put_vara_double(wr_ncid, wrVarIDfVertex, start1, count1, fVertex)
- start1(1) = 1
- count1( 1) = wrLocalnCells
- nferr = nf_put_vara_double(wr_ncid, wrVarIDh_s, start1, count1, h_s)
+! start1(1) = 1
+! count1( 1) = wrLocalnCells
+! nferr = nf_put_vara_double(wr_ncid, wrVarIDh_s, start1, count1, h_s)
start2(2) = 1
count2( 1) = wrLocalnVertLevels
@@ -593,75 +593,75 @@
count2( 2) = wrLocalnVertices
nferr = nf_put_vara_int(wr_ncid, wrVarIDboundaryVertex, start2, count2, boundaryVertex)
- start2(2) = 1
- count2( 1) = wrLocalnVertLevels
- count2( 2) = wrLocalnEdges
- nferr = nf_put_vara_double(wr_ncid, wrVarIDu_src, start2, count2, u_src)
+! start2(2) = 1
+! count2( 1) = wrLocalnVertLevels
+! count2( 2) = wrLocalnEdges
+! nferr = nf_put_vara_double(wr_ncid, wrVarIDu_src, start2, count2, u_src)
- start1(1) = 1
- count1( 1) = wrLocalnCells
- nferr = nf_put_vara_double(wr_ncid, wrVarIDtemperatureRestore, start1, count1, temperatureRestore)
+! start1(1) = 1
+! count1( 1) = wrLocalnCells
+! nferr = nf_put_vara_double(wr_ncid, wrVarIDtemperatureRestore, start1, count1, temperatureRestore)
- start1(1) = 1
- count1( 1) = wrLocalnCells
- nferr = nf_put_vara_double(wr_ncid, wrVarIDsalinityRestore, start1, count1, salinityRestore)
+! start1(1) = 1
+! count1( 1) = wrLocalnCells
+! nferr = nf_put_vara_double(wr_ncid, wrVarIDsalinityRestore, start1, count1, salinityRestore)
- start3(3) = time
- count3( 1) = wrLocalnVertLevels
- count3( 2) = wrLocalnEdges
- count3( 3) = 1
- nferr = nf_put_vara_double(wr_ncid, wrVarIDu, start3, count3, u)
+! start3(3) = time
+! count3( 1) = wrLocalnVertLevels
+! count3( 2) = wrLocalnEdges
+! count3( 3) = 1
+! nferr = nf_put_vara_double(wr_ncid, wrVarIDu, start3, count3, u)
- start3(3) = time
- count3( 1) = wrLocalnVertLevels
- count3( 2) = wrLocalnEdges
- count3( 3) = 1
- nferr = nf_put_vara_double(wr_ncid, wrVarIDv, start3, count3, v)
+! start3(3) = time
+! count3( 1) = wrLocalnVertLevels
+! count3( 2) = wrLocalnEdges
+! count3( 3) = 1
+! nferr = nf_put_vara_double(wr_ncid, wrVarIDv, start3, count3, v)
- start3(3) = time
- count3( 1) = wrLocalnVertLevels
- count3( 2) = wrLocalnCells
- count3( 3) = 1
- nferr = nf_put_vara_double(wr_ncid, wrVarIDh, start3, count3, h)
+! start3(3) = time
+! count3( 1) = wrLocalnVertLevels
+! count3( 2) = wrLocalnCells
+! count3( 3) = 1
+! nferr = nf_put_vara_double(wr_ncid, wrVarIDh, start3, count3, h)
- start3(3) = time
- count3( 1) = wrLocalnVertLevels
- count3( 2) = wrLocalnCells
- count3( 3) = 1
- nferr = nf_put_vara_double(wr_ncid, wrVarIDrho, start3, count3, rho)
+! start3(3) = time
+! count3( 1) = wrLocalnVertLevels
+! count3( 2) = wrLocalnCells
+! count3( 3) = 1
+! nferr = nf_put_vara_double(wr_ncid, wrVarIDrho, start3, count3, rho)
+! start3(3) = time
+! count3( 1) = wrLocalnVertLevels
+! count3( 2) = wrLocalnCells
+! count3( 3) = 1
+! nferr = nf_put_vara_double(wr_ncid, wrVarIDtemperature, start3, count3, temperature)
+
+! start3(3) = time
+! count3( 1) = wrLocalnVertLevels
+! count3( 2) = wrLocalnCells
+! count3( 3) = 1
+! nferr = nf_put_vara_double(wr_ncid, wrVarIDsalinity, start3, count3, salinity)
+
+! start3(3) = time
+! count3( 1) = wrLocalnVertLevels
+! count3( 2) = wrLocalnCells
+! count3( 3) = 1
+! ! If you do not want tracer1 in your input file, simply comment out these two lines (two of two)
+! nferr = nf_put_vara_double(wr_ncid, wrVarIDtracer1, start3, count3, tracer1)
+
+ ! ice sheet fields
start3(3) = time
count3( 1) = wrLocalnVertLevels
count3( 2) = wrLocalnCells
count3( 3) = 1
- nferr = nf_put_vara_double(wr_ncid, wrVarIDtemperature, start3, count3, temperature)
+ nferr = nf_put_vara_double(wr_ncid, wrVarIDthck, start3, count3, thck)
start3(3) = time
count3( 1) = wrLocalnVertLevels
count3( 2) = wrLocalnCells
count3( 3) = 1
- nferr = nf_put_vara_double(wr_ncid, wrVarIDsalinity, start3, count3, salinity)
-
- start3(3) = time
- count3( 1) = wrLocalnVertLevels
- count3( 2) = wrLocalnCells
- count3( 3) = 1
- ! If you do not want tracer1 in your input file, simply comment out these two lines (two of two)
- nferr = nf_put_vara_double(wr_ncid, wrVarIDtracer1, start3, count3, tracer1)
+ nferr = nf_put_vara_double(wr_ncid, wrVarIDtopg, start3, count3, topg)
- ! ice sheet fields
-! start3(3) = time
-! count3( 1) = wrLocalnVertLevels
-! count3( 2) = wrLocalnCells
-! count3( 3) = 1
-! nferr = nf_put_vara_double(wr_ncid, wrVarIDthck, start3, count3, thck)
-!
-! start3(3) = time
-! count3( 1) = wrLocalnVertLevels
-! count3( 2) = wrLocalnCells
-! count3( 3) = 1
-! nferr = nf_put_vara_double(wr_ncid, wrVarIDtopg, start3, count3, topg)
-
end subroutine write_netcdf_fields
</font>
</pre>