<p><b>ringler@lanl.gov</b> 2012-04-27 15:53:55 -0600 (Fri, 27 Apr 2012)</p><p><br>
first cut at adding monthly forcing. indices need to be flipped to be consistent with MPAS convention<br>
</p><hr noshade><pre><font color="gray">Modified: branches/ocean_projects/basin/src/Makefile
===================================================================
--- branches/ocean_projects/basin/src/Makefile        2012-04-27 21:47:38 UTC (rev 1833)
+++ branches/ocean_projects/basin/src/Makefile        2012-04-27 21:53:55 UTC (rev 1834)
@@ -46,12 +46,13 @@
module_read_netcdf.o \
module_read_topo.o \
module_read_TS.o \
+ module_read_MONTHLY.o \
module_cullLoops.o \
module_write_netcdf.o
all: map
-basin.o: utilities.o module_write_netcdf.o module_read_netcdf.o module_read_topo.o module_read_TS.o module_cullLoops.o
+basin.o: utilities.o module_write_netcdf.o module_read_netcdf.o module_read_topo.o module_read_TS.o module_read_monthly.o module_cullLoops.o
map: $(OBJS)
        $(FC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
Modified: branches/ocean_projects/basin/src/basin.F
===================================================================
--- branches/ocean_projects/basin/src/basin.F        2012-04-27 21:47:38 UTC (rev 1833)
+++ branches/ocean_projects/basin/src/basin.F        2012-04-27 21:53:55 UTC (rev 1834)
@@ -3,6 +3,7 @@
use read_netcdf
use read_topo
use read_TS
+use read_MONTHLY
use write_netcdf
use utilities
use cullLoops
@@ -58,7 +59,11 @@
real(kind=4), allocatable, dimension(:,:,:) :: TEMP, SALT
real(kind=4), allocatable, dimension(:,:) :: TAUX, TAUY
+real(kind=4), allocatable, dimension(:,:,:) :: SST_MONTHLY, SSS_MONTHLY
+real(kind=4), allocatable, dimension(:,:,:) :: TAUX_MONTHLY, TAUY_MONTHLY
+
real, dimension(40) :: dz
+integer, parameter :: nMonths = 12
! Step 1: Set the number of Vertical levels
integer, parameter :: nVertLevelsMOD = 40
@@ -118,9 +123,11 @@
real, allocatable, dimension(:) :: fEdgeNew, fVertexNew, h_sNew, hZLevel, referenceBottomDepth
real, allocatable, dimension(:,:) :: u_srcNew
+real, allocatable, dimension(:,:) :: windStressMonthlyNew
real, allocatable, dimension(:,:,:) :: uNew, vNew, hNew
real, allocatable, dimension(:,:,:) :: rhoNew, temperatureNew, salinityNew, tracer1New
real, allocatable, dimension(:) :: temperatureRestoreNew, salinityRestoreNew
+real, allocatable, dimension(:,:) :: temperatureRestoreMonthlyNew, salinityRestoreMonthlyNew
! mapping variables
integer, allocatable, dimension(:) :: kmt, maxLevelCellNew
@@ -133,6 +140,12 @@
integer :: iCellNew, iEdgeNew, iVertexNew, ndata, jCell1, jCell2, jCell, iter
real :: xin, yin, zin, ulon, ulat, ux, uy, uz, rlon, rlat, temp_t, temp_s
+integer :: iMonth
+character(len=80) :: fileNameT, fileNameS, fileNameU
+fileNameT = 'TS/woce_t_ann.3600x2431x42interp.r4.nc'
+fileNameS = 'TS/woce_s_ann.3600x2431x42interp.r4.nc'
+fileNameU = 'TS/ws.old_ncep_1958-2000avg.interp3600x2431.nc'
+
! get to work
write(6,*) ' starting'
write(6,*)
@@ -176,13 +189,127 @@
call error_checking
write(6,*) ' getting woce t and s '
-call read_TS_init(nlon, nlat, ndepth)
+
+call read_TS_init(nlon, nlat, ndepth,fileNameT, fileNameS, fileNameU)
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()
+
+allocate(SST_MONTHLY(nlon,nlat,12), SSS_MONTHLY(nlon,nlat,12))
+allocate(TAUX_MONTHLY(nlon,nlat,12), TAUY_MONTHLY(nlon,nlat,12))
+SST_MONTHLY=0; SSS_MONTHLY=0; TAUX_MONTHLY=0; TAUY_MONTHLY=0
+
+iMonth=1
+fileNameT='TS/SST.shf.normal_year+Hurrell.monthly.01.interp3600x2431.nc'
+fileNameS='TS/SSS.sfwf.CORE_SSS+precip.monthly01.interp3600x2431.nc'
+fileNameU='TS/TAUIJ.ws.old_ncep_1958-2000avg.mon.01.interp3600x2431.nc'
+call read_MONTHLY_init(nlon, nlat, ndepth,fileNameT, fileNameS, fileNameU)
+write(6,*) nlon,nlat,ndepth
+call read_MONTHLY_fields(SST_MONTHLY(:,:,iMonth), SSS_MONTHLY(:,:,iMonth), TAUX_MONTHLY(:,:,iMonth), TAUY_MONTHLY(:,:,iMonth))
+call read_MONTHLY_finalize()
+
+iMonth=2
+fileNameT='TS/SST.shf.normal_year+Hurrell.monthly.02.interp3600x2431.nc'
+fileNameS='TS/SSS.sfwf.CORE_SSS+precip.monthly02.interp3600x2431.nc'
+fileNameU='TS/TAUIJ.ws.old_ncep_1958-2000avg.mon.02.interp3600x2431.nc'
+call read_MONTHLY_init(nlon, nlat, ndepth,fileNameT, fileNameS, fileNameU)
+write(6,*) nlon,nlat,ndepth
+call read_MONTHLY_fields(SST_MONTHLY(:,:,iMonth), SSS_MONTHLY(:,:,iMonth), TAUX_MONTHLY(:,:,iMonth), TAUY_MONTHLY(:,:,iMonth))
+call read_MONTHLY_finalize()
+
+iMonth=3
+fileNameT='TS/SST.shf.normal_year+Hurrell.monthly.03.interp3600x2431.nc'
+fileNameS='TS/SSS.sfwf.CORE_SSS+precip.monthly03.interp3600x2431.nc'
+fileNameU='TS/TAUIJ.ws.old_ncep_1958-2000avg.mon.03.interp3600x2431.nc'
+call read_MONTHLY_init(nlon, nlat, ndepth,fileNameT, fileNameS, fileNameU)
+write(6,*) nlon,nlat,ndepth
+call read_MONTHLY_fields(SST_MONTHLY(:,:,iMonth), SSS_MONTHLY(:,:,iMonth), TAUX_MONTHLY(:,:,iMonth), TAUY_MONTHLY(:,:,iMonth))
+call read_MONTHLY_finalize()
+
+iMonth=4
+fileNameT='TS/SST.shf.normal_year+Hurrell.monthly.04.interp3600x2431.nc'
+fileNameS='TS/SSS.sfwf.CORE_SSS+precip.monthly04.interp3600x2431.nc'
+fileNameU='TS/TAUIJ.ws.old_ncep_1958-2000avg.mon.04.interp3600x2431.nc'
+call read_MONTHLY_init(nlon, nlat, ndepth,fileNameT, fileNameS, fileNameU)
+write(6,*) nlon,nlat,ndepth
+call read_MONTHLY_fields(SST_MONTHLY(:,:,iMonth), SSS_MONTHLY(:,:,iMonth), TAUX_MONTHLY(:,:,iMonth), TAUY_MONTHLY(:,:,iMonth))
+call read_MONTHLY_finalize()
+
+iMonth=5
+fileNameT='TS/SST.shf.normal_year+Hurrell.monthly.05.interp3600x2431.nc'
+fileNameS='TS/SSS.sfwf.CORE_SSS+precip.monthly05.interp3600x2431.nc'
+fileNameU='TS/TAUIJ.ws.old_ncep_1958-2000avg.mon.05.interp3600x2431.nc'
+call read_MONTHLY_init(nlon, nlat, ndepth,fileNameT, fileNameS, fileNameU)
+write(6,*) nlon,nlat,ndepth
+call read_MONTHLY_fields(SST_MONTHLY(:,:,iMonth), SSS_MONTHLY(:,:,iMonth), TAUX_MONTHLY(:,:,iMonth), TAUY_MONTHLY(:,:,iMonth))
+call read_MONTHLY_finalize()
+
+iMonth=6
+fileNameT='TS/SST.shf.normal_year+Hurrell.monthly.06.interp3600x2431.nc'
+fileNameS='TS/SSS.sfwf.CORE_SSS+precip.monthly06.interp3600x2431.nc'
+fileNameU='TS/TAUIJ.ws.old_ncep_1958-2000avg.mon.06.interp3600x2431.nc'
+call read_MONTHLY_init(nlon, nlat, ndepth,fileNameT, fileNameS, fileNameU)
+write(6,*) nlon,nlat,ndepth
+call read_MONTHLY_fields(SST_MONTHLY(:,:,iMonth), SSS_MONTHLY(:,:,iMonth), TAUX_MONTHLY(:,:,iMonth), TAUY_MONTHLY(:,:,iMonth))
+call read_MONTHLY_finalize()
+
+iMonth=7
+fileNameT='TS/SST.shf.normal_year+Hurrell.monthly.07.interp3600x2431.nc'
+fileNameS='TS/SSS.sfwf.CORE_SSS+precip.monthly07.interp3600x2431.nc'
+fileNameU='TS/TAUIJ.ws.old_ncep_1958-2000avg.mon.07.interp3600x2431.nc'
+call read_MONTHLY_init(nlon, nlat, ndepth,fileNameT, fileNameS, fileNameU)
+write(6,*) nlon,nlat,ndepth
+call read_MONTHLY_fields(SST_MONTHLY(:,:,iMonth), SSS_MONTHLY(:,:,iMonth), TAUX_MONTHLY(:,:,iMonth), TAUY_MONTHLY(:,:,iMonth))
+call read_MONTHLY_finalize()
+
+iMonth=8
+fileNameT='TS/SST.shf.normal_year+Hurrell.monthly.08.interp3600x2431.nc'
+fileNameS='TS/SSS.sfwf.CORE_SSS+precip.monthly08.interp3600x2431.nc'
+fileNameU='TS/TAUIJ.ws.old_ncep_1958-2000avg.mon.08.interp3600x2431.nc'
+call read_MONTHLY_init(nlon, nlat, ndepth,fileNameT, fileNameS, fileNameU)
+write(6,*) nlon,nlat,ndepth
+call read_MONTHLY_fields(SST_MONTHLY(:,:,iMonth), SSS_MONTHLY(:,:,iMonth), TAUX_MONTHLY(:,:,iMonth), TAUY_MONTHLY(:,:,iMonth))
+call read_MONTHLY_finalize()
+
+iMonth=9
+fileNameT='TS/SST.shf.normal_year+Hurrell.monthly.09.interp3600x2431.nc'
+fileNameS='TS/SSS.sfwf.CORE_SSS+precip.monthly09.interp3600x2431.nc'
+fileNameU='TS/TAUIJ.ws.old_ncep_1958-2000avg.mon.09.interp3600x2431.nc'
+call read_MONTHLY_init(nlon, nlat, ndepth,fileNameT, fileNameS, fileNameU)
+write(6,*) nlon,nlat,ndepth
+call read_MONTHLY_fields(SST_MONTHLY(:,:,iMonth), SSS_MONTHLY(:,:,iMonth), TAUX_MONTHLY(:,:,iMonth), TAUY_MONTHLY(:,:,iMonth))
+call read_MONTHLY_finalize()
+
+iMonth=10
+fileNameT='TS/SST.shf.normal_year+Hurrell.monthly.10.interp3600x2431.nc'
+fileNameS='TS/SSS.sfwf.CORE_SSS+precip.monthly10.interp3600x2431.nc'
+fileNameU='TS/TAUIJ.ws.old_ncep_1958-2000avg.mon.10.interp3600x2431.nc'
+call read_MONTHLY_init(nlon, nlat, ndepth,fileNameT, fileNameS, fileNameU)
+write(6,*) nlon,nlat,ndepth
+call read_MONTHLY_fields(SST_MONTHLY(:,:,iMonth), SSS_MONTHLY(:,:,iMonth), TAUX_MONTHLY(:,:,iMonth), TAUY_MONTHLY(:,:,iMonth))
+call read_MONTHLY_finalize()
+
+iMonth=11
+fileNameT='TS/SST.shf.normal_year+Hurrell.monthly.11.interp3600x2431.nc'
+fileNameS='TS/SSS.sfwf.CORE_SSS+precip.monthly11.interp3600x2431.nc'
+fileNameU='TS/TAUIJ.ws.old_ncep_1958-2000avg.mon.11.interp3600x2431.nc'
+call read_MONTHLY_init(nlon, nlat, ndepth,fileNameT, fileNameS, fileNameU)
+write(6,*) nlon,nlat,ndepth
+call read_MONTHLY_fields(SST_MONTHLY(:,:,iMonth), SSS_MONTHLY(:,:,iMonth), TAUX_MONTHLY(:,:,iMonth), TAUY_MONTHLY(:,:,iMonth))
+call read_MONTHLY_finalize()
+
+iMonth=12
+fileNameT='TS/SST.shf.normal_year+Hurrell.monthly.12.interp3600x2431.nc'
+fileNameS='TS/SSS.sfwf.CORE_SSS+precip.monthly12.interp3600x2431.nc'
+fileNameU='TS/TAUIJ.ws.old_ncep_1958-2000avg.mon.12.interp3600x2431.nc'
+call read_MONTHLY_init(nlon, nlat, ndepth,fileNameT, fileNameS, fileNameU)
+write(6,*) nlon,nlat,ndepth
+call read_MONTHLY_fields(SST_MONTHLY(:,:,iMonth), SSS_MONTHLY(:,:,iMonth), TAUX_MONTHLY(:,:,iMonth), TAUY_MONTHLY(:,:,iMonth))
+call read_MONTHLY_finalize()
+
do k=1,ndepth
ndata = 0; temp_t=0; temp_s=0
do j=1,nlat
@@ -290,7 +417,7 @@
implicit none
real :: halfwidth, dtr, pi, p(3), q(3), xin, yin, zin, ulon, ulat, stress, n1, n2, distance, r, temp_t, temp_s
real :: dotProd
-integer :: iTracer, ix, iy, ndata, i, j, k, ixt, iyt, ncull, jcount, iNoData, kdata(nVertLevelsMod)
+integer :: iTracer, ix, iy, ndata, i, j, k, ixt, iyt, ncull, jcount, iNoData, kdata(nVertLevelsMod), iMonth
logical :: flag_lat
pi = 4.0*atan(1.0)
@@ -500,6 +627,7 @@
if(real_bathymetry) then
u_srcNew = 0.0
+windStressMonthlyNew = 0.0
do iEdge=1,nEdgesNew
xin = xEdgeNew(iEdge)
yin = yEdgeNew(iEdge)
@@ -515,9 +643,6 @@
exit
endif
enddo
- !stress = -0.1*cos(3.0*latEdgeNew(iEdge))
- !ulon = stress
- !ulat = 0.0
ulon = TAUX(ix,iy)
ulat = TAUY(ix,iy)
write(6,*) rlon, t_lon(ix), rlat, t_lat(iy)
@@ -533,6 +658,23 @@
call unit_vector_in_3space(q)
u_srcNew(1,iEdge) = ux*q(1) + uy*q(2) + uz*q(3)
endif
+
+ do iMonth=1,12
+ ulon = TAUX_MONTHLY(ix,iy,iMonth)
+ ulat = TAUY_MONTHLY(ix,iy,iMonth)
+ call transform_from_lonlat_to_xyz(xin,yin,zin,ulon,ulat,ux,uy,uz)
+ if(boundaryEdgeNew(1,iEdge).eq.1) then
+ windStressMonthlyNew(iEdge,iMonth) = 0.0
+ else
+ iCell1 = cellsOnEdgeNew(1,iEdge)
+ iCell2 = cellsOnEdgeNew(2,iEdge)
+ p(1) = xCellNew(iCell1); p(2) = yCellNew(iCell1); p(3) = zCellNew(iCell1)
+ q(1) = xCellNew(iCell2); q(2) = yCellNew(iCell2); q(3) = zCellNew(iCell2)
+ q = q - p
+ call unit_vector_in_3space(q)
+ windStressMonthlyNew(iEdge,iMonth) = ux*q(1) + uy*q(2) + uz*q(3)
+ endif
+ enddo
enddo
@@ -632,10 +774,82 @@
temperatureRestoreNew(:) = temperatureNew(1,1,:)
salinityRestoreNew(:) = salinityNew(1,1,:)
-endif
+do iMonth=1,12
+iNoData = 0
+do iCell=1,nCellsNew
+ if(mod(iCell,100).eq.0) write(6,*) 'l_woce t and s RESTORE',iCell
+ rlon = lonCellNew(iCell)/dtr
+ rlat = latCellNew(iCell)/dtr
+ ix = nint(rlon/0.1 - 0.05) + nlon + 1
+ ix = mod(ix,nlon)+1
+ iy = nlat
+ do j=1,nlat
+ if(t_lat(j).gt.rlat) then
+ iy = j
+ exit
+ endif
+ enddo ! j
+ k=1
+ ndata = 0; temp_t = 0; temp_s = 0
+ 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=-15,15
+ iyt = iy + 8*j
+ flag_lat = .true.
+ if(iyt.lt.1.or.iyt.gt.nlat) then
+ iyt = 1
+ flag_lat = .false.
+ endif
+ if(SST_MONTHLY(ixt,iyt,iMonth).gt.-10.0.and.flag_lat) then
+ ndata = ndata + 1
+ temp_t = temp_t + SST_MONTHLY(ixt,iyt,iMonth)
+ temp_s = temp_s + SSS_MONTHLY(ixt,iyt,iMonth)
+ endif
+ enddo !j
+ enddo !i
-endif
+ if(ndata.gt.0) then
+ temperatureRestoreMonthlyNew(iCell,iMonth) = temp_t / float(ndata)
+ salinityRestoreMonthlyNew(iCell,iMonth) = temp_s / float(ndata)
+ else
+ temperatureRestoreMonthlyNew(iCell,iMonth) = temperatureNew(1,1,iCell)
+ salinityRestoreMonthlyNew(iCell,iMonth) = salinityNew(1,1,iCell)
+ endif
+ enddo ! iCell
+enddo ! iMonth
+
+! do a couple of smoothing passes
+do iter=1,5
+do iCell=1,nCellsNew
+ k=1
+ ndata=1
+ temp_t = temperatureRestoreMonthlyNew(iCell,iMonth)
+ temp_s = salinityRestoreMonthlyNew(iCell,iMonth)
+ do j=1,nEdgesOnCellNew(iCell)
+ jCell = cellsOnCellNew(j,iCell)
+ if(jCell.gt.0) then
+ if(maxLevelCellNew(jCell).ge.k) then
+ temp_t = temp_t + temperatureRestoreMonthlyNew(iCell,iMonth)
+ temp_s = temp_s + salinityRestoreMonthlyNew(iCell,iMonth)
+ ndata = ndata + 1
+ endif
+ endif
+ enddo ! j
+ temperatureRestoreMonthlyNew(iCell,iMonth) = temp_t / ndata
+ salinityRestoreMonthlyNew(iCell,iMonth) = temp_s / ndata
+enddo ! iCell
+enddo ! iter
+
+endif ! l_woce
+
+endif ! real_bathymetry
+
write(6,*) ' done get_init_conditions'
end subroutine get_init_conditions
@@ -1003,6 +1217,7 @@
maxEdgesNew, &
nVertLevelsNew, &
vertexDegreeNew, &
+ nMonths, &
sphere_radius, &
on_a_sphere &
)
@@ -1052,6 +1267,7 @@
boundaryEdgeNew, &
boundaryVertexNew, &
u_srcNew, &
+ windStressMonthlyNew, &
uNew, &
vNew, &
hNew, &
@@ -1061,6 +1277,8 @@
tracer1New, &
temperatureRestoreNew, &
salinityRestoreNew, &
+ temperatureRestoreMonthlyNew, &
+ salinityRestoreMonthlyNew, &
hZLevel, &
referenceBottomDepth &
)
@@ -1337,6 +1555,7 @@
allocate(fVertexNew(nVerticesNew))
allocate(h_sNew(nCellsNew))
allocate(u_srcNew(nVertLevelsNew,nEdgesNew))
+allocate(windStressMonthlyNew(nEdgesNew,12))
allocate(uNew(1,nVertLevelsNew,nEdgesNew))
allocate(vNew(1,nVertLevelsNew,nEdgesNew))
allocate(hNew(1,nVertLevelsNew,nCellsNew))
@@ -1350,18 +1569,25 @@
allocate(temperatureRestoreNew(nCellsNew))
allocate(salinityRestoreNew(nCellsNew))
+allocate(temperatureRestoreMonthlyNew(nCellsNew,12))
+allocate(salinityRestoreMonthlyNew(nCellsNew,12))
+
+
xCellNew=0; yCellNew=0; zCellNew=0; latCellNew=0; lonCellNew=0; meshDensityNew=1.0; meshSpacingNew=0.0
xEdgeNew=0; yEdgeNew=0; zEdgeNew=0; latEdgeNew=0; lonEdgeNew=0
xVertexNew=0; yVertexNew=0; zVertexNew=0; latVertexNew=0; lonVertexNew=0
-fEdgeNew=0; fVertexNew=0; h_sNew=0; u_srcNew=0
+fEdgeNew=0; fVertexNew=0; h_sNew=0; u_srcNew=0; windStressMonthlyNew = 0
uNew=0; vNew=0; hNew=0; rhoNew=0
temperatureNew=0; salinityNew=0; tracer1New=0;
temperatureRestoreNew = 0.0
salinityRestoreNew = 0.0
+temperatureRestoreMonthlyNew = 0.0
+salinityRestoreMonthlyNew = 0.0
+
do i=1,nCells
jNew = cellMap(i)
if(jNew.ne.0) then
Modified: branches/ocean_projects/basin/src/module_read_TS.F
===================================================================
--- branches/ocean_projects/basin/src/module_read_TS.F        2012-04-27 21:47:38 UTC (rev 1833)
+++ branches/ocean_projects/basin/src/module_read_TS.F        2012-04-27 21:53:55 UTC (rev 1834)
@@ -18,17 +18,18 @@
contains
- subroutine read_TS_init(nx, ny, nz)
+ subroutine read_TS_init(nx, ny, nz, fileNameT, fileNameS, fileNameU)
implicit none
include 'netcdf.inc'
+ character(len=80), intent(in) :: fileNameT, fileNameS, fileNameU
integer, intent(out) :: nx, ny, nz
integer :: nferr, nferrs, nferru
- nferr = nf_open('TS/woce_t_ann.3600x2431x42interp.r4.nc', NF_SHARE, rd_ncid)
+ nferr = nf_open(fileNameT, NF_SHARE, rd_ncid)
write(6,*) ' nferr ', nferr, rd_ncid
!
@@ -65,11 +66,11 @@
nferr = nf_inq_varid(rd_ncid, 'TEMP', rdVarIDTEMP)
write(6,*) ' nferr ', nferr, rdVarIDTEMP
- nferrs = nf_open('TS/woce_s_ann.3600x2431x42interp.r4.nc', NF_SHARE, rd_ncids)
+ nferrs = nf_open(fileNameS, NF_SHARE, rd_ncids)
nferrs = nf_inq_varid(rd_ncids, 'SALT', rdVarIDSALT)
write(6,*) ' nferrs ', nferrs, rdVarIDSALT
- nferru = nf_open('TS/ws.old_ncep_1958-2000avg.interp3600x2431.nc', NF_SHARE, rd_ncidu)
+ nferru = nf_open(fileNameU, NF_SHARE, rd_ncidu)
nferru = nf_inq_varid(rd_ncidu, 'TAUX', rdVarIDTAUX)
nferru = nf_inq_varid(rd_ncidu, 'TAUY', rdVarIDTAUY)
write(6,*) ' nferru ', nferru, rdVarIDTAUX, rdVarIDTAUY
Modified: branches/ocean_projects/basin/src/module_write_netcdf.F
===================================================================
--- branches/ocean_projects/basin/src/module_write_netcdf.F        2012-04-27 21:47:38 UTC (rev 1833)
+++ branches/ocean_projects/basin/src/module_write_netcdf.F        2012-04-27 21:53:55 UTC (rev 1834)
@@ -10,6 +10,7 @@
integer :: wrDimIDTWO
integer :: wrDimIDvertexDegree
integer :: wrDimIDnVertLevels
+ integer :: wrDimIDnMonths
integer :: wrVarIDlatCell
integer :: wrVarIDlonCell
integer :: wrVarIDmeshDensity
@@ -54,6 +55,7 @@
integer :: wrVarIDboundaryEdge
integer :: wrVarIDboundaryVertex
integer :: wrVarIDu_src
+ integer :: wrVarIDwindStressMonthly
integer :: wrVarIDv
integer :: wrVarIDh
integer :: wrVarIDrho
@@ -62,6 +64,8 @@
integer :: wrVarIDtracer1
integer :: wrVarIDtemperatureRestore
integer :: wrVarIDsalinityRestore
+ integer :: wrVarIDtemperatureRestoreMonthly
+ integer :: wrVarIDsalinityRestoreMonthly
integer :: wrVarIDhZLevel
integer :: wrVarIDreferenceBottomDepth
@@ -71,6 +75,7 @@
integer :: wrLocalmaxEdges
integer :: wrLocalnVertLevels
integer :: wrLocalvertexDegree
+ integer :: wrLocalnMonths
contains
@@ -81,6 +86,7 @@
maxEdges, &
nVertLevels, &
vertexDegree, &
+ nMonths, &
sphere_radius, &
on_a_sphere &
)
@@ -95,6 +101,7 @@
integer, intent(in) :: maxEdges
integer, intent(in) :: nVertLevels
integer, intent(in) :: vertexDegree
+ integer, intent(in) :: nMonths
character (len=16) :: on_a_sphere
double precision :: sphere_radius
@@ -109,6 +116,7 @@
wrLocalmaxEdges = maxEdges
wrLocalnVertLevels = nVertLevels
wrLocalvertexDegree = vertexDegree
+ wrLocalnMonths = nMonths
nferr = nf_create('ocean.nc', IOR(NF_CLOBBER,NF_64BIT_OFFSET), wr_ncid)
@@ -123,6 +131,7 @@
nferr = nf_def_dim(wr_ncid, 'TWO', 2, wrDimIDTWO)
nferr = nf_def_dim(wr_ncid, 'vertexDegree', vertexDegree, wrDimIDvertexDegree)
nferr = nf_def_dim(wr_ncid, 'nVertLevels', nVertLevels, wrDimIDnVertLevels)
+ nferr = nf_def_dim(wr_ncid, 'nMonths', 12, wrDimIDnMonths)
nferr = nf_def_dim(wr_ncid, 'Time', NF_UNLIMITED, wrDimIDTime)
!
@@ -222,6 +231,14 @@
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) = wrDimIDnCells
+ dimlist( 2) = wrDimIDnMonths
+ nferr = nf_def_var(wr_ncid, 'temperatureRestoreMonthly', NF_DOUBLE, 2, dimlist, wrVarIDtemperatureRestoreMonthly)
+ dimlist( 1) = wrDimIDnCells
+ dimlist( 2) = wrDimIDnMonths
+ nferr = nf_def_var(wr_ncid, 'salinityRestoreMonthly', NF_DOUBLE, 2, dimlist, wrVarIDsalinityRestoreMonthly)
+
dimlist( 1) = wrDimIDnVertLevels
nferr = nf_def_var(wr_ncid, 'hZLevel', NF_DOUBLE, 1, dimlist, wrVarIDhZLevel)
dimlist( 1) = wrDimIDnVertLevels
@@ -239,6 +256,11 @@
dimlist( 1) = wrDimIDnVertLevels
dimlist( 2) = wrDimIDnEdges
nferr = nf_def_var(wr_ncid, 'u_src', NF_DOUBLE, 2, dimlist, wrVarIDu_src)
+
+ dimlist( 1) = wrDimIDnEdges
+ dimlist( 2) = wrDimIDnMonths
+ nferr = nf_def_var(wr_ncid, 'windStressMonthly', NF_DOUBLE, 2, dimlist, wrVarIDwindStressMonthly)
+
dimlist( 1) = wrDimIDnVertLevels
dimlist( 2) = wrDimIDnEdges
dimlist( 3) = wrDimIDTime
@@ -319,6 +341,7 @@
boundaryEdge, &
boundaryVertex, &
u_src, &
+ windStressMonthly, &
u, &
v, &
h, &
@@ -328,6 +351,8 @@
tracer1, &
temperatureRestore, &
salinityRestore, &
+ temperatureRestoreMonthly, &
+ salinityRestoreMonthly, &
hZLevel, &
referenceBottomDepth &
)
@@ -380,6 +405,7 @@
integer, dimension(:,:), intent(in) :: boundaryEdge
integer, dimension(:,:), intent(in) :: boundaryVertex
real (kind=8), dimension(:,:), intent(in) :: u_src
+ real (kind=8), dimension(:,:), intent(in) :: windStressMonthly
real (kind=8), dimension(:,:,:), intent(in) :: u
real (kind=8), dimension(:,:,:), intent(in) :: v
real (kind=8), dimension(:,:,:), intent(in) :: h
@@ -389,6 +415,8 @@
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) :: temperatureRestoreMonthly
+ real (kind=8), dimension(:,:), intent(in) :: salinityRestoreMonthly
real (kind=8), dimension(:), intent(in) :: hZLevel
real (kind=8), dimension(:), intent(in) :: referenceBottomDepth
@@ -598,6 +626,13 @@
count2( 2) = wrLocalnEdges
nferr = nf_put_vara_double(wr_ncid, wrVarIDu_src, start2, count2, u_src)
+
+ start2(2) = 1
+ count2( 1) = wrLocalnEdges
+ count2( 2) = wrLocalnMonths
+ nferr = nf_put_vara_double(wr_ncid, wrVarIDwindStressMonthly, start2, count2, windStressMonthly)
+
+
start1(1) = 1
count1( 1) = wrLocalnCells
nferr = nf_put_vara_double(wr_ncid, wrVarIDtemperatureRestore, start1, count1, temperatureRestore)
@@ -605,6 +640,21 @@
start1(1) = 1
count1( 1) = wrLocalnCells
nferr = nf_put_vara_double(wr_ncid, wrVarIDsalinityRestore, start1, count1, salinityRestore)
+
+
+
+
+ start2(2) = 1
+ count2( 1) = wrLocalnCells
+ count2( 2) = wrLocalnMonths
+ nferr = nf_put_vara_double(wr_ncid, wrVarIDtemperatureRestoreMonthly, start2, count2, temperatureRestoreMonthly)
+
+ start2(2) = 1
+ count2( 1) = wrLocalnCells
+ count2( 2) = wrLocalnMonths
+ nferr = nf_put_vara_double(wr_ncid, wrVarIDsalinityRestoreMonthly, start2, count2, salinityRestoreMonthly)
+
+
start1(1) = 1
count1( 1) = wrLocalnVertLevels
</font>
</pre>