Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/CICE-Consortium/CICE into…
Browse files Browse the repository at this point in the history
… nuopc
  • Loading branch information
dabail10 committed May 19, 2020
2 parents 8f0b5ee + bce31c2 commit 80c9e6e
Show file tree
Hide file tree
Showing 27 changed files with 867 additions and 166 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ doc/build
# Ignore macOS cache files
.DS_Store


# Ignore testsuite file/directories
testsuite*
caselist*
15 changes: 11 additions & 4 deletions cice.setup
Original file line number Diff line number Diff line change
Expand Up @@ -504,11 +504,18 @@ EOF0
cat >! ${tsdir}/report_codecov.csh << EOF0
#!/bin/csh -f
#setenv CODECOV_TOKEN "1d09241f-ed9e-47d8-847c-038bab024b53" # consortium cice
#setenv CODECOV_TOKEN "f3236008-0b92-4707-9ad5-ad906f5d2ba7" # apcraig cice
setenv CODECOV_TOKEN "0dcc6066-fdce-47b6-b84a-c55e2a0af4c0" # apcraig test_cice_icepack
set report_name = "${shhash}:${branch}:${machine} ${testsuite}"
# define CODECOV_TOKEN env variable
if !(\$?CODECOV_TOKEN) then
if (-e ~/.codecov_cice_token) then
source ~/.codecov_cice_token
endif
if !(\$?CODECOV_TOKEN) then
echo "\${0}: ERROR, CODECOV_TOKEN env variable not defined"
exit 2
endif
endif
set report_name = "${shhash}:${branch}:${machine} ${testsuite}"
set use_curl = 1
EOF0
Expand Down
27 changes: 26 additions & 1 deletion cicecore/cicedynB/general/ice_forcing.F90
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ module ice_forcing
ocn_data_format, & ! 'bin'=binary or 'nc'=netcdf
atm_data_type, & ! 'default', 'monthly', 'ncar',
! 'LYq' or 'hadgem' or 'oned' or
! 'JRA55_gx1' or 'JRA55_gx3'
! 'JRA55_gx1' or 'JRA55_gx3' or 'JRA55_tx1'
bgc_data_type, & ! 'default', 'clim'
ocn_data_type, & ! 'default', 'clim', 'ncar', 'oned',
! 'hadgem_sst' or 'hadgem_sst_uvocn'
Expand Down Expand Up @@ -241,6 +241,7 @@ subroutine init_forcing_atmo

if (use_leap_years .and. (trim(atm_data_type) /= 'JRA55_gx1' .and. &
trim(atm_data_type) /= 'JRA55_gx3' .and. &
trim(atm_data_type) /= 'JRA55_tx1' .and. &
trim(atm_data_type) /= 'hycom' .and. &
trim(atm_data_type) /= 'box2001')) then
write(nu_diag,*) 'use_leap_years option is currently only supported for'
Expand All @@ -261,6 +262,8 @@ subroutine init_forcing_atmo
call JRA55_gx1_files(fyear)
elseif (trim(atm_data_type) == 'JRA55_gx3') then
call JRA55_gx3_files(fyear)
elseif (trim(atm_data_type) == 'JRA55_tx1') then
call JRA55_tx1_files(fyear)
elseif (trim(atm_data_type) == 'hadgem') then
call hadgem_files(fyear)
elseif (trim(atm_data_type) == 'monthly') then
Expand Down Expand Up @@ -560,6 +563,8 @@ subroutine get_forcing_atmo
call JRA55_data(fyear)
elseif (trim(atm_data_type) == 'JRA55_gx3') then
call JRA55_data(fyear)
elseif (trim(atm_data_type) == 'JRA55_tx1') then
call JRA55_data(fyear)
elseif (trim(atm_data_type) == 'hadgem') then
call hadgem_data
elseif (trim(atm_data_type) == 'monthly') then
Expand Down Expand Up @@ -1405,6 +1410,10 @@ subroutine file_year (data_file, yr)
i = index(data_file,'.nc') - 5
tmpname = data_file
write(data_file,'(a,i4.4,a)') tmpname(1:i), yr, '.nc'
elseif (trim(atm_data_type) == 'JRA55_tx1') then ! netcdf
i = index(data_file,'.nc') - 5
tmpname = data_file
write(data_file,'(a,i4.4,a)') tmpname(1:i), yr, '.nc'
else ! LANL/NCAR naming convention
i = index(data_file,'.dat') - 5
tmpname = data_file
Expand Down Expand Up @@ -2047,6 +2056,22 @@ subroutine JRA55_gx1_files(yr)
write (nu_diag,*) trim(uwind_file)
endif
end subroutine JRA55_gx1_files
subroutine JRA55_tx1_files(yr)
!
integer (kind=int_kind), intent(in) :: &
yr ! current forcing year

character(len=*), parameter :: subname = '(JRA55_tx1_files)'

uwind_file = &
trim(atm_data_dir)//'/8XDAILY/JRA55_03hr_forcing_tx1_2005.nc'
call file_year(uwind_file,yr)
if (my_task == master_task) then
write (nu_diag,*) ' '
write (nu_diag,*) 'Atmospheric data files:'
write (nu_diag,*) trim(uwind_file)
endif
end subroutine JRA55_tx1_files
subroutine JRA55_gx3_files(yr)
!
integer (kind=int_kind), intent(in) :: &
Expand Down
150 changes: 140 additions & 10 deletions cicecore/cicedynB/infrastructure/io/io_pio/ice_history_write.F90
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ subroutine ice_write_hist (ns)
dxu, dxt, dyu, dyt, HTN, HTE, ANGLE, ANGLET, tmask, &
lont_bounds, latt_bounds, lonu_bounds, latu_bounds
use ice_history_shared
use ice_arrays_column, only: hin_max
use ice_arrays_column, only: hin_max, floe_rad_c
use ice_restart_shared, only: runid, lcdf64
use netcdf
#endif
Expand All @@ -67,13 +67,13 @@ subroutine ice_write_hist (ns)
#ifdef ncdf
integer (kind=int_kind) :: i,j,k,ic,n,nn, &
ncid,status,imtid,jmtid,kmtidi,kmtids,kmtidb, cmtid,timid, &
length,nvertexid,ivertex,kmtida
length,nvertexid,ivertex,kmtida,fmtid
integer (kind=int_kind), dimension(2) :: dimid2
integer (kind=int_kind), dimension(3) :: dimid3
integer (kind=int_kind), dimension(4) :: dimidz
integer (kind=int_kind), dimension(5) :: dimidcz
integer (kind=int_kind), dimension(3) :: dimid_nverts
integer (kind=int_kind), dimension(5) :: dimidex
integer (kind=int_kind), dimension(6) :: dimidex
real (kind=real_kind) :: ltime
real (kind= dbl_kind) :: ltime2
character (char_len) :: title
Expand All @@ -89,7 +89,8 @@ subroutine ice_write_hist (ns)
type(file_desc_t) :: File
type(io_desc_t) :: iodesc2d, &
iodesc3dc, iodesc3dv, iodesc3di, iodesc3db, iodesc3da, &
iodesc4di, iodesc4ds
iodesc3df, &
iodesc4di, iodesc4ds, iodesc4df
type(var_desc_t) :: varid

! 4 coordinate variables: TLON, TLAT, ULON, ULAT
Expand Down Expand Up @@ -168,9 +169,11 @@ subroutine ice_write_hist (ns)
call ice_pio_initdecomp(ndim3=nzilyr, iodesc=iodesc3di)
call ice_pio_initdecomp(ndim3=nzblyr, iodesc=iodesc3db)
call ice_pio_initdecomp(ndim3=nzalyr, iodesc=iodesc3da)
call ice_pio_initdecomp(ndim3=nfsd_hist, iodesc=iodesc3df)
call ice_pio_initdecomp(ndim3=nverts, inner_dim=.true., iodesc=iodesc3dv)
call ice_pio_initdecomp(ndim3=nzilyr, ndim4=ncat_hist, iodesc=iodesc4di)
call ice_pio_initdecomp(ndim3=nzslyr, ndim4=ncat_hist, iodesc=iodesc4ds)
call ice_pio_initdecomp(ndim3=nzslyr, ndim4=nfsd_hist, iodesc=iodesc4df)

ltime2 = time/int(secday)
ltime = real(time/int(secday),kind=real_kind)
Expand All @@ -192,6 +195,7 @@ subroutine ice_write_hist (ns)
status = pio_def_dim(File,'nkaer',nzalyr,kmtida)
status = pio_def_dim(File,'time',PIO_UNLIMITED,timid)
status = pio_def_dim(File,'nvertices',nverts,nvertexid)
status = pio_def_dim(File,'nf',nfsd_hist,fmtid)

!-----------------------------------------------------------------
! define coordinate variables: time, time_bounds
Expand Down Expand Up @@ -261,6 +265,7 @@ subroutine ice_write_hist (ns)
var_nz(3) = coord_attributes('VGRDs', 'vertical snow levels', '1')
var_nz(4) = coord_attributes('VGRDb', 'vertical ice-bio levels', '1')
var_nz(5) = coord_attributes('VGRDa', 'vertical snow-ice-bio levels', '1')
var_nz(6) = coord_attributes('NFSD', 'category floe size (center)', 'm')

!-----------------------------------------------------------------
! define information for optional time-invariant variables
Expand Down Expand Up @@ -342,12 +347,13 @@ subroutine ice_write_hist (ns)
endif
enddo

! Extra dimensions (NCAT, NZILYR, NZSLYR, NZBLYR, NZALYR)
! Extra dimensions (NCAT, NZILYR, NZSLYR, NZBLYR, NZALYR, NFSD)
dimidex(1)=cmtid
dimidex(2)=kmtidi
dimidex(3)=kmtids
dimidex(4)=kmtidb
dimidex(5)=kmtida
dimidex(6)=fmtid

do i = 1, nvarz
if (igrdz(i)) then
Expand Down Expand Up @@ -605,6 +611,43 @@ subroutine ice_write_hist (ns)
endif
enddo ! num_avail_hist_fields_3Da

!-----------------------------------------------------------------
! 3D (fsd)
!-----------------------------------------------------------------

dimidz(1) = imtid
dimidz(2) = jmtid
dimidz(3) = fmtid
dimidz(4) = timid

do n = n3Dacum + 1, n3Dfcum
if (avail_hist_fields(n)%vhistfreq == histfreq(ns) .or. write_ic) then
status = pio_def_var(File, trim(avail_hist_fields(n)%vname), &
pio_real, dimidz, varid)
status = pio_put_att(File,varid,'units', &
trim(avail_hist_fields(n)%vunit))
status = pio_put_att(File,varid, 'long_name', &
trim(avail_hist_fields(n)%vdesc))
status = pio_put_att(File,varid,'coordinates', &
trim(avail_hist_fields(n)%vcoord))
status = pio_put_att(File,varid,'cell_measures', &
trim(avail_hist_fields(n)%vcellmeas))
status = pio_put_att(File,varid,'missing_value',spval)
status = pio_put_att(File,varid,'_FillValue',spval)

! Add cell_methods attribute to variables if averaged
if (hist_avg .and. histfreq(ns) /= '1') then
status = pio_put_att(File,varid,'cell_methods','time: mean')
endif

if (histfreq(ns) == '1' .or. .not. hist_avg) then
status = pio_put_att(File,varid,'time_rep','instantaneous')
else
status = pio_put_att(File,varid,'time_rep','averaged')
endif
endif
enddo ! num_avail_hist_fields_3Df

!-----------------------------------------------------------------
! define attributes for 4D variables
! time coordinate is dropped
Expand All @@ -620,7 +663,7 @@ subroutine ice_write_hist (ns)
dimidcz(4) = cmtid
dimidcz(5) = timid

do n = n3Dacum + 1, n4Dicum
do n = n3Dfcum + 1, n4Dicum
if (avail_hist_fields(n)%vhistfreq == histfreq(ns) .or. write_ic) then
status = pio_def_var(File, trim(avail_hist_fields(n)%vname), &
pio_real, dimidcz, varid)
Expand Down Expand Up @@ -686,6 +729,45 @@ subroutine ice_write_hist (ns)
endif
enddo ! num_avail_hist_fields_4Ds


!-----------------------------------------------------------------
! 4D (fsd layers)
!-----------------------------------------------------------------

dimidcz(1) = imtid
dimidcz(2) = jmtid
dimidcz(3) = fmtid
dimidcz(4) = cmtid
dimidcz(5) = timid

do n = n4Dscum + 1, n4Dfcum
if (avail_hist_fields(n)%vhistfreq == histfreq(ns) .or. write_ic) then
status = pio_def_var(File, trim(avail_hist_fields(n)%vname), &
pio_real, dimidcz, varid)
status = pio_put_att(File,varid,'units', &
trim(avail_hist_fields(n)%vunit))
status = pio_put_att(File,varid, 'long_name', &
trim(avail_hist_fields(n)%vdesc))
status = pio_put_att(File,varid,'coordinates', &
trim(avail_hist_fields(n)%vcoord))
status = pio_put_att(File,varid,'cell_measures', &
trim(avail_hist_fields(n)%vcellmeas))
status = pio_put_att(File,varid,'missing_value',spval)
status = pio_put_att(File,varid,'_FillValue',spval)

! Add cell_methods attribute to variables if averaged
if (hist_avg .and. histfreq(ns) /= '1') then
status = pio_put_att(File,varid,'cell_methods','time: mean')
endif

if (histfreq(ns) == '1' .or. .not. hist_avg) then
status = pio_put_att(File,varid,'time_rep','instantaneous')
else
status = pio_put_att(File,varid,'time_rep','averaged')
endif
endif
enddo ! num_avail_hist_fields_4Df

!-----------------------------------------------------------------
! global attributes
!-----------------------------------------------------------------
Expand Down Expand Up @@ -780,14 +862,16 @@ subroutine ice_write_hist (ns)
workr2, status, fillval=spval_dbl)
enddo

! Extra dimensions (NCAT, VGRD*)
! Extra dimensions (NCAT, NFSD, VGRD*)

do i = 1, nvarz
if (igrdz(i)) then
status = pio_inq_varid(File, var_nz(i)%short_name, varid)
SELECT CASE (var_nz(i)%short_name)
CASE ('NCAT')
status = pio_put_var(File, varid, hin_max(1:ncat_hist))
CASE ('NFSD')
status = pio_put_var(File, varid, floe_rad_c(1:nfsd_hist))
CASE ('VGRDi')
status = pio_put_var(File, varid, (/(k, k=1,nzilyr)/))
CASE ('VGRDs')
Expand Down Expand Up @@ -984,10 +1068,31 @@ subroutine ice_write_hist (ns)
enddo ! num_avail_hist_fields_3Db
deallocate(workr3)

allocate(workr4(nx_block,ny_block,nblocks,ncat_hist,nzilyr))
! 4D (categories, vertical ice)
do n = n3Dacum+1, n4Dicum
! 3D (fsd)
allocate(workr3(nx_block,ny_block,nblocks,nfsd_hist))
do n = n3Dacum+1, n3Dfcum
nn = n - n3Dacum
if (avail_hist_fields(n)%vhistfreq == histfreq(ns) .or. write_ic) then
status = pio_inq_varid(File,avail_hist_fields(n)%vname,varid)
if (status /= pio_noerr) call abort_ice(subname// &
'ERROR: getting varid for '//avail_hist_fields(n)%vname)
do j = 1, nblocks
do i = 1, nfsd_hist
workr3(:,:,j,i) = a3Df(:,:,i,nn,j)
enddo
enddo
call pio_setframe(varid, int(1,kind=PIO_OFFSET))
! call pio_setframe(File, varid, int(1,kind=PIO_OFFSET_KIND))
call pio_write_darray(File, varid, iodesc3df,&
workr3, status, fillval=spval_dbl)
endif
enddo ! num_avail_hist_fields_3Df
deallocate(workr3)

allocate(workr4(nx_block,ny_block,nblocks,ncat_hist,nzilyr))
! 4D (categories, fsd)
do n = n3Dfcum+1, n4Dicum
nn = n - n3Dfcum
if (avail_hist_fields(n)%vhistfreq == histfreq(ns) .or. write_ic) then
status = pio_inq_varid(File,avail_hist_fields(n)%vname,varid)
if (status /= pio_noerr) call abort_ice(subname// &
Expand Down Expand Up @@ -1029,6 +1134,29 @@ subroutine ice_write_hist (ns)
enddo ! num_avail_hist_fields_4Di
deallocate(workr4)

allocate(workr4(nx_block,ny_block,nblocks,ncat_hist,nfsd_hist))
! 4D (categories, vertical ice)
do n = n4Dscum+1, n4Dfcum
nn = n - n4Dscum
if (avail_hist_fields(n)%vhistfreq == histfreq(ns) .or. write_ic) then
status = pio_inq_varid(File,avail_hist_fields(n)%vname,varid)
if (status /= pio_noerr) call abort_ice(subname// &
'ERROR: getting varid for '//avail_hist_fields(n)%vname)
do j = 1, nblocks
do i = 1, ncat_hist
do k = 1, nfsd_hist
workr4(:,:,j,i,k) = a4Ds(:,:,k,i,nn,j)
enddo ! k
enddo ! i
enddo ! j
call pio_setframe(varid, int(1,kind=PIO_OFFSET))
! call pio_setframe(File, varid, int(1,kind=PIO_OFFSET_KIND))
call pio_write_darray(File, varid, iodesc4df,&
workr4, status, fillval=spval_dbl)
endif
enddo ! num_avail_hist_fields_4Di
deallocate(workr4)

! similarly for num_avail_hist_fields_4Db (define workr4b, iodesc4db)


Expand All @@ -1042,8 +1170,10 @@ subroutine ice_write_hist (ns)
call pio_freedecomp(File,iodesc3di)
call pio_freedecomp(File,iodesc3db)
call pio_freedecomp(File,iodesc3da)
call pio_freedecomp(File,iodesc3df)
call pio_freedecomp(File,iodesc4di)
call pio_freedecomp(File,iodesc4ds)
call pio_freedecomp(File,iodesc4df)

!-----------------------------------------------------------------
! close output dataset
Expand Down
Loading

0 comments on commit 80c9e6e

Please sign in to comment.