From c2c91f363808ce8ce1a126940cc694c143b208d8 Mon Sep 17 00:00:00 2001 From: daveh150 Date: Tue, 23 May 2023 16:59:58 -0500 Subject: [PATCH 1/8] updating paths for local nrlssc builds --- configuration/scripts/machines/env.nrlssc_gnu | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configuration/scripts/machines/env.nrlssc_gnu b/configuration/scripts/machines/env.nrlssc_gnu index 1f8dd4441..338727348 100644 --- a/configuration/scripts/machines/env.nrlssc_gnu +++ b/configuration/scripts/machines/env.nrlssc_gnu @@ -5,9 +5,9 @@ setenv ICE_MACHINE_MACHINFO "nrlssc" setenv ICE_MACHINE_ENVNAME gnu setenv ICE_MACHINE_ENVINFO "gnu" setenv ICE_MACHINE_MAKE gmake -setenv ICE_MACHINE_WKDIR /u/data/hebert/CICE_RUNS -setenv ICE_MACHINE_INPUTDATA /u/data/hebert/CICE_RUNS -setenv ICE_MACHINE_BASELINE /u/data/hebert/CICE_BASELINE +setenv ICE_MACHINE_WKDIR /u/hebert/data/CICE_RUNS +setenv ICE_MACHINE_INPUTDATA /u/hebert/data/CICE_RUNS +setenv ICE_MACHINE_BASELINE /u/hebert/data/CICE_BASELINE setenv ICE_MACHINE_SUBMIT "qsub " setenv ICE_MACHINE_ACCT P00000000 setenv ICE_MACHINE_QUEUE "standard" From 87b7fabc55257c4ccccad71edca2743486cdbbe1 Mon Sep 17 00:00:00 2001 From: daveh150 Date: Tue, 23 May 2023 17:00:24 -0500 Subject: [PATCH 2/8] Add jra55do forcing option --- cicecore/cicedyn/general/ice_forcing.F90 | 482 ++++++++++++++++++++++- 1 file changed, 476 insertions(+), 6 deletions(-) diff --git a/cicecore/cicedyn/general/ice_forcing.F90 b/cicecore/cicedyn/general/ice_forcing.F90 index 541efb282..4850497ab 100755 --- a/cicecore/cicedyn/general/ice_forcing.F90 +++ b/cicecore/cicedyn/general/ice_forcing.F90 @@ -281,11 +281,14 @@ subroutine init_forcing_atmo file=__FILE__, line=__LINE__) endif - 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 + 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) /= 'JRA55do_gx1' .and. & + trim(atm_data_type) /= 'JRA55do_gx3' .and. & + trim(atm_data_type) /= 'JRA55do_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' write(nu_diag,*) 'JRA55, default , and box2001 atmospheric data' call abort_ice(error_message=subname, file=__FILE__, line=__LINE__) @@ -308,6 +311,12 @@ subroutine init_forcing_atmo call JRA55_gx3_files(fyear) elseif (trim(atm_data_type) == 'JRA55_tx1') then call JRA55_tx1_files(fyear) + elseif (trim(atm_data_type) == 'JRA55do_gx1') then + call JRA55do_gx1_files(fyear) + elseif (trim(atm_data_type) == 'JRA55do_gx3') then + call JRA55do_gx3_files(fyear) + elseif (trim(atm_data_type) == 'JRA55do_tx1') then + call JRA55do_tx1_files(fyear) elseif (trim(atm_data_type) == 'hadgem') then call hadgem_files(fyear) elseif (trim(atm_data_type) == 'monthly') then @@ -654,6 +663,12 @@ subroutine get_forcing_atmo call JRA55_data elseif (trim(atm_data_type) == 'JRA55_tx1') then call JRA55_data + elseif (trim(atm_data_type) == 'JRA55do_gx1') then + call JRA55do_data + elseif (trim(atm_data_type) == 'JRA55do_gx3') then + call JRA55do_data + elseif (trim(atm_data_type) == 'JRA55do_tx1') then + call JRA55do_data elseif (trim(atm_data_type) == 'hadgem') then call hadgem_data elseif (trim(atm_data_type) == 'monthly') then @@ -1605,6 +1620,18 @@ 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) == 'JRA55do_gx1') then ! netcdf + 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) == 'JRA55do_gx3') then ! netcdf + 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) == 'JRA55do_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 @@ -2314,8 +2341,173 @@ subroutine JRA55_gx3_files(yr) write (nu_diag,*) 'Atmospheric data files:' write (nu_diag,*) trim(uwind_file) endif - end subroutine JRA55_gx3_files + end subroutine JRA55_gx3_files + +!======================================================================= + subroutine JRA55do_gx1_files(yr) +! + integer (kind=int_kind), intent(in) :: & + yr ! current forcing year + + character(len=*), parameter :: subname = '(JRA55do_gx1_files)' + + if (local_debug .and. my_task == master_task) write(nu_diag,*) subname,'fdbg start' + + uwind_file = & + trim(atm_data_dir)//'/8XDAILY/uas_gx1_2005.nc' + call file_year(uwind_file,yr) + + vwind_file = & + trim(atm_data_dir)//'/8XDAILY/vas_gx1_2005.nc' + call file_year(vwind_file,yr) + + tair_file = & + trim(atm_data_dir)//'/8XDAILY/tas_gx1_2005.nc' + call file_year(tair_file,yr) + + humid_file = & + trim(atm_data_dir)//'/8XDAILY/huss_gx1_2005.nc' + call file_year(humid_file,yr) + + rain_file = & + trim(atm_data_dir)//'/8XDAILY/ttlpcp_gx1_2005.nc' + call file_year(rain_file,yr) + + fsw_file = & + trim(atm_data_dir)//'/8XDAILY/rsds_gx1_2005.nc' + call file_year(fsw_file,yr) + + flw_file = & + trim(atm_data_dir)//'/8XDAILY/rlds_gx1_2005.nc' + call file_year(flw_file,yr) + + + if (my_task == master_task) then + write (nu_diag,*) ' ' + write (nu_diag,*) 'Atmospheric data files:' + write (nu_diag,*) trim(uwind_file) + write (nu_diag,*) trim(vwind_file) + write (nu_diag,*) trim(tair_file) + write (nu_diag,*) trim(humid_file) + write (nu_diag,*) trim(rain_file) + write (nu_diag,*) trim(fsw_file) + write (nu_diag,*) trim(flw_file) + endif + + end subroutine JRA55do_gx1_files + +!======================================================================= + + subroutine JRA55do_tx1_files(yr) +! + integer (kind=int_kind), intent(in) :: & + yr ! current forcing year + + character(len=*), parameter :: subname = '(JRA55do_tx1_files)' + + if (local_debug .and. my_task == master_task) write(nu_diag,*) subname,'fdbg start' + + uwind_file = & + trim(atm_data_dir)//'/8XDAILY/uas_tx1_2005.nc' + call file_year(uwind_file,yr) + + vwind_file = & + trim(atm_data_dir)//'/8XDAILY/vas_tx1_2005.nc' + call file_year(vwind_file,yr) + + tair_file = & + trim(atm_data_dir)//'/8XDAILY/tas_tx1_2005.nc' + call file_year(tair_file,yr) + + humid_file = & + trim(atm_data_dir)//'/8XDAILY/huss_tx1_2005.nc' + call file_year(humid_file,yr) + + rain_file = & + trim(atm_data_dir)//'/8XDAILY/ttlpcp_tx1_2005.nc' + call file_year(rain_file,yr) + + fsw_file = & + trim(atm_data_dir)//'/8XDAILY/rsds_tx1_2005.nc' + call file_year(fsw_file,yr) + + flw_file = & + trim(atm_data_dir)//'/8XDAILY/rlds_tx1_2005.nc' + call file_year(flw_file,yr) + + + if (my_task == master_task) then + write (nu_diag,*) ' ' + write (nu_diag,*) 'Atmospheric data files:' + write (nu_diag,*) trim(uwind_file) + write (nu_diag,*) trim(vwind_file) + write (nu_diag,*) trim(tair_file) + write (nu_diag,*) trim(humid_file) + write (nu_diag,*) trim(rain_file) + write (nu_diag,*) trim(fsw_file) + write (nu_diag,*) trim(flw_file) + endif + + end subroutine JRA55do_tx1_files + +!======================================================================= + + subroutine JRA55do_gx3_files(yr) +! + integer (kind=int_kind), intent(in) :: & + yr ! current forcing year + + character(len=*), parameter :: subname = '(JRA55do_gx3_files)' + + if (local_debug .and. my_task == master_task) write(nu_diag,*) subname,'fdbg start' + + uwind_file = & + trim(atm_data_dir)//'/8XDAILY/uas_gx3_2005.nc' + call file_year(uwind_file,yr) + + vwind_file = & + trim(atm_data_dir)//'/8XDAILY/vas_gx3_2005.nc' + call file_year(vwind_file,yr) + + tair_file = & + trim(atm_data_dir)//'/8XDAILY/tas_gx3_2005.nc' + call file_year(tair_file,yr) + + humid_file = & + trim(atm_data_dir)//'/8XDAILY/huss_gx3_2005.nc' + call file_year(humid_file,yr) + + rain_file = & + trim(atm_data_dir)//'/8XDAILY/ttlpcp_gx3_2005.nc' + call file_year(rain_file,yr) + + fsw_file = & + trim(atm_data_dir)//'/8XDAILY/rsds_gx3_2005.nc' + call file_year(fsw_file,yr) + + flw_file = & + trim(atm_data_dir)//'/8XDAILY/rlds_gx3_2005.nc' + call file_year(flw_file,yr) + + + if (my_task == master_task) then + write (nu_diag,*) ' ' + write (nu_diag,*) 'Atmospheric data files:' + write (nu_diag,*) trim(uwind_file) + write (nu_diag,*) trim(vwind_file) + write (nu_diag,*) trim(tair_file) + write (nu_diag,*) trim(humid_file) + write (nu_diag,*) trim(rain_file) + write (nu_diag,*) trim(fsw_file) + write (nu_diag,*) trim(flw_file) + endif + + end subroutine JRA55do_gx3_files + +!======================================================================= + + #ifdef UNDEPRECATE_LYq !======================================================================= ! @@ -2791,6 +2983,284 @@ subroutine JRA55_data end subroutine JRA55_data !======================================================================= + + subroutine JRA55do_data + + use ice_blocks, only: block, get_block + use ice_global_reductions, only: global_minval, global_maxval + use ice_domain, only: nblocks, distrb_info + use ice_flux, only: fsnow, Tair, uatm, vatm, Qa, fsw, flw + use ice_grid, only: hm, tmask, umask + use ice_state, only: aice + use ice_calendar, only: days_per_year + + integer (kind=int_kind) :: & + ncid , & ! netcdf file id + i, j, n1 , & + lfyear , & ! local year value + recnum , & ! record number + maxrec , & ! maximum record number + iblk ! block index + + integer (kind=int_kind), save :: & + frec_info(2,2) = -99 ! remember prior values to reduce reading + ! first dim is yr, recnum + ! second dim is data1 data2 + + real (kind=dbl_kind) :: & + sec3hr , & ! number of seconds in 3 hours + secday , & ! number of seconds in day + eps, tt , & ! for interpolation coefficients + Tffresh , & + vmin, vmax + + character(len=64) :: fieldname !netcdf field name + + character(len=*), parameter :: subname = '(JRA55do_data)' + + if (local_debug .and. my_task == master_task) write(nu_diag,*) subname,'fdbg start' + + call icepack_query_parameters(Tffresh_out=Tffresh) + call icepack_query_parameters(secday_out=secday) + call icepack_warnings_flush(nu_diag) + if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & + file=__FILE__, line=__LINE__) + + sec3hr = secday/c8 ! seconds in 3 hours + maxrec = days_per_year * 8 + + if (local_debug .and. my_task == master_task) then + write(nu_diag,*) subname,'fdbg dpy, maxrec = ',days_per_year,maxrec + endif + + !------------------------------------------------------------------- + ! 3-hourly data. + ! states are instantaneous, 1st record is 00z Jan 1 + ! fluxes are 3 hour averages, 1st record is 00z-03z Jan 1 + ! interpolate states, do not interpolate fluxes + !------------------------------------------------------------------- + ! Individual NETCDF files for each quantity. + ! winds in NORTH and EAST direction (not rotated) + ! file variable names are: + ! rsds (shortwave W/m^2), 3 hr average + ! rlds (longwave W/m^2), 3 hr average + ! ttlpcp (precipitation kg/m s-1), 3 hr average + ! uas (eastward wind m/s), instantaneous + ! vas (northward wind m/s), instantaneous + ! tas (air temperature K), instantaneous + ! huss (specific humidity kg/kg), instantaneous + !------------------------------------------------------------------- + + do n1 = 1, 2 + + lfyear = fyear + if (n1 == 1) then + recnum = 8*int(yday) - 7 + int(real(msec,kind=dbl_kind)/sec3hr) + call file_year(tair_file, lfyear) ! make file name with proper year + call file_year(uwind_file, lfyear) ! make file name with proper year + call file_year(vwind_file, lfyear) ! make file name with proper year + call file_year(humid_file, lfyear) ! make file name with proper year + call file_year(fsw_file, lfyear) ! make file name with proper year + call file_year(flw_file, lfyear) ! make file name with proper year + call file_year(rain_file, lfyear) ! make file name with proper year + + if (my_task == master_task .and. (recnum <= 2 .or. recnum >= maxrec-1)) then + write(nu_diag,*) subname,' reading forcing file 1st ts = ',trim(tair_file) + write(nu_diag,*) subname,' reading forcing file 1st ts = ',trim(uwind_file) + write(nu_diag,*) subname,' reading forcing file 1st ts = ',trim(vwind_file) + write(nu_diag,*) subname,' reading forcing file 1st ts = ',trim(humid_file) + write(nu_diag,*) subname,' reading forcing file 1st ts = ',trim(fsw_file) + write(nu_diag,*) subname,' reading forcing file 1st ts = ',trim(flw_file) + write(nu_diag,*) subname,' reading forcing file 1st ts = ',trim(rain_file) + endif + elseif (n1 == 2) then + recnum = 8*int(yday) - 7 + int(real(msec,kind=dbl_kind)/sec3hr) + 1 + if (recnum > maxrec) then + lfyear = fyear + 1 ! next year + if (lfyear > fyear_final) lfyear = fyear_init + recnum = 1 + call file_year(tair_file, lfyear) ! make file name with proper year + call file_year(uwind_file, lfyear) ! make file name with proper year + call file_year(vwind_file, lfyear) ! make file name with proper year + call file_year(humid_file, lfyear) ! make file name with proper year + call file_year(fsw_file, lfyear) ! make file name with proper year + call file_year(flw_file, lfyear) ! make file name with proper year + call file_year(rain_file, lfyear) ! make file name with proper year + + if (my_task == master_task) then + write(nu_diag,*) subname,' reading forcing file 2nd ts = ',trim(tair_file) + write(nu_diag,*) subname,' reading forcing file 2nd ts = ',trim(uwind_file) + write(nu_diag,*) subname,' reading forcing file 2nd ts = ',trim(vwind_file) + write(nu_diag,*) subname,' reading forcing file 2nd ts = ',trim(humid_file) + write(nu_diag,*) subname,' reading forcing file 2nd ts = ',trim(fsw_file) + write(nu_diag,*) subname,' reading forcing file 2nd ts = ',trim(flw_file) + write(nu_diag,*) subname,' reading forcing file 2nd ts = ',trim(rain_file) + endif + endif + endif + + if (local_debug .and. my_task == master_task) then + write(nu_diag,*) subname,'fdbg read recnum = ',recnum,n1 + endif + + ! to reduce reading, check whether it's the same data as last read + + if (lfyear /= frec_info(1,n1) .or. recnum /= frec_info(2,n1)) then + + ! check whether we can copy values from 2 to 1, should be faster than reading + ! can only do this from 2 to 1 or 1 to 2 without setting up a temporary + ! it's more likely that the values from data2 when time advances are needed in data1 + ! compare n1=1 year/record with data from last timestep at n1=2 + + if (n1 == 1 .and. lfyear == frec_info(1,2) .and. recnum == frec_info(2,2)) then + Tair_data(:,:,1,:) = Tair_data(:,:,2,:) + uatm_data(:,:,1,:) = uatm_data(:,:,2,:) + vatm_data(:,:,1,:) = vatm_data(:,:,2,:) + Qa_data(:,:,1,:) = Qa_data(:,:,2,:) + fsw_data(:,:,1,:) = fsw_data(:,:,2,:) + flw_data(:,:,1,:) = flw_data(:,:,2,:) + fsnow_data(:,:,1,:) = fsnow_data(:,:,2,:) + else + + ! read each variable from individual NetCDFs + fieldname = 'tas' + call ice_open_nc(tair_file,ncid) + call ice_read_nc(ncid,recnum,fieldname,Tair_data(:,:,n1,:),local_debug, & + field_loc=field_loc_center, & + field_type=field_type_scalar) + call ice_close_nc(ncid) + + fieldname = 'uas' + call ice_open_nc(uwind_file,ncid) + call ice_read_nc(ncid,recnum,fieldname,uatm_data(:,:,n1,:),local_debug, & + field_loc=field_loc_center, & + field_type=field_type_scalar) + call ice_close_nc(ncid) + + fieldname = 'vas' + call ice_open_nc(vwind_file,ncid) + call ice_read_nc(ncid,recnum,fieldname,vatm_data(:,:,n1,:),local_debug, & + field_loc=field_loc_center, & + field_type=field_type_scalar) + call ice_close_nc(ncid) + + fieldname = 'huss' + call ice_open_nc(humid_file,ncid) + call ice_read_nc(ncid,recnum,fieldname,Qa_data(:,:,n1,:),local_debug, & + field_loc=field_loc_center, & + field_type=field_type_scalar) + call ice_close_nc(ncid) + + fieldname = 'rsds' + call ice_open_nc(fsw_file,ncid) + call ice_read_nc(ncid,recnum,fieldname,fsw_data(:,:,n1,:),local_debug, & + field_loc=field_loc_center, & + field_type=field_type_scalar) + call ice_close_nc(ncid) + + fieldname = 'rlds' + call ice_open_nc(flw_file,ncid) + call ice_read_nc(ncid,recnum,fieldname,flw_data(:,:,n1,:),local_debug, & + field_loc=field_loc_center, & + field_type=field_type_scalar) + call ice_close_nc(ncid) + + fieldname = 'ttlpcp' + call ice_open_nc(rain_file,ncid) + call ice_read_nc(ncid,recnum,fieldname,fsnow_data(:,:,n1,:),local_debug, & + field_loc=field_loc_center, & + field_type=field_type_scalar) + call ice_close_nc(ncid) + + endif ! copy data from n1=2 from last timestep to n1=1 + endif ! input data is same as last timestep + + frec_info(1,n1) = lfyear + frec_info(2,n1) = recnum + + enddo ! n1 + + ! Compute interpolation coefficients + eps = 1.0e-6 + tt = real(mod(msec,nint(sec3hr)),kind=dbl_kind) + c2intp = tt / sec3hr + if (c2intp < c0 .and. c2intp > c0-eps) c2intp = c0 + if (c2intp > c1 .and. c2intp < c1+eps) c2intp = c1 + c1intp = 1.0_dbl_kind - c2intp + if (c2intp < c0 .or. c2intp > c1) then + write(nu_diag,*) subname,' ERROR: c2intp = ',c2intp + call abort_ice (error_message=subname//' ERROR: c2intp out of range', & + file=__FILE__, line=__LINE__) + endif + if (local_debug .and. my_task == master_task) then + write(nu_diag,*) subname,'fdbg c12intp = ',c1intp,c2intp + endif + + ! Interpolate + call interpolate_data (Tair_data, Tair) + call interpolate_data (uatm_data, uatm) + call interpolate_data (vatm_data, vatm) + call interpolate_data (Qa_data, Qa) + ! use 3 hr average for heat flux and precip fields, no interpolation + ! call interpolate_data (fsw_data, fsw) + ! call interpolate_data (flw_data, flw) + ! call interpolate_data (fsnow_data, fsnow) + fsw(:,:,:) = fsw_data(:,:,1,:) + flw(:,:,:) = flw_data(:,:,1,:) + fsnow(:,:,:) = fsnow_data(:,:,1,:) + + !$OMP PARALLEL DO PRIVATE(iblk,i,j) + do iblk = 1, nblocks + ! limit summer Tair values where ice is present + do j = 1, ny_block + do i = 1, nx_block + if (aice(i,j,iblk) > p1) Tair(i,j,iblk) = min(Tair(i,j,iblk), Tffresh+p1) + enddo + enddo + + do j = 1, ny_block + do i = 1, nx_block + Qa (i,j,iblk) = Qa (i,j,iblk) * hm(i,j,iblk) + Tair(i,j,iblk) = Tair(i,j,iblk) * hm(i,j,iblk) + uatm(i,j,iblk) = uatm(i,j,iblk) * hm(i,j,iblk) + vatm(i,j,iblk) = vatm(i,j,iblk) * hm(i,j,iblk) + fsw (i,j,iblk) = fsw (i,j,iblk) * hm(i,j,iblk) + flw (i,j,iblk) = flw (i,j,iblk) * hm(i,j,iblk) + fsnow(i,j,iblk) = fsnow (i,j,iblk) * hm(i,j,iblk) + enddo + enddo + + enddo ! iblk + !$OMP END PARALLEL DO + + if (debug_forcing .or. local_debug) then + if (my_task.eq.master_task) write (nu_diag,*) subname,'fdbg JRA55do_data' + vmin = global_minval(fsw,distrb_info,tmask) + vmax = global_maxval(fsw,distrb_info,tmask) + if (my_task.eq.master_task) write (nu_diag,*) subname,'fdbg fsw',vmin,vmax + vmin = global_minval(flw,distrb_info,tmask) + vmax = global_maxval(flw,distrb_info,tmask) + if (my_task.eq.master_task) write (nu_diag,*) subname,'fdbg flw',vmin,vmax + vmin =global_minval(fsnow,distrb_info,tmask) + vmax =global_maxval(fsnow,distrb_info,tmask) + if (my_task.eq.master_task) write (nu_diag,*) subname,'fdbg fsnow',vmin,vmax + vmin = global_minval(Tair,distrb_info,tmask) + vmax = global_maxval(Tair,distrb_info,tmask) + if (my_task.eq.master_task) write (nu_diag,*) subname,'fdbg Tair',vmin,vmax + vmin = global_minval(uatm,distrb_info,umask) + vmax = global_maxval(uatm,distrb_info,umask) + if (my_task.eq.master_task) write (nu_diag,*) subname,'fdbg uatm',vmin,vmax + vmin = global_minval(vatm,distrb_info,umask) + vmax = global_maxval(vatm,distrb_info,umask) + if (my_task.eq.master_task) write (nu_diag,*) subname,'fdbg vatm',vmin,vmax + vmin = global_minval(Qa,distrb_info,tmask) + vmax = global_maxval(Qa,distrb_info,tmask) + if (my_task.eq.master_task) write (nu_diag,*) subname,'fdbg Qa',vmin,vmax + endif ! debug_forcing + + end subroutine JRA55do_data + +! ================================================================= ! ! AOMIP shortwave forcing ! standard calculation using solar declination angle From fab42150ad9be90b8cd65eaa14e8970c5fa3e418 Mon Sep 17 00:00:00 2001 From: daveh150 Date: Thu, 25 May 2023 17:52:37 +0000 Subject: [PATCH 3/8] Updated env.nrlssc_gnu for new local directory structure --- configuration/scripts/machines/env.nrlssc_gnu | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configuration/scripts/machines/env.nrlssc_gnu b/configuration/scripts/machines/env.nrlssc_gnu index 338727348..94025ddf9 100644 --- a/configuration/scripts/machines/env.nrlssc_gnu +++ b/configuration/scripts/machines/env.nrlssc_gnu @@ -6,11 +6,11 @@ setenv ICE_MACHINE_ENVNAME gnu setenv ICE_MACHINE_ENVINFO "gnu" setenv ICE_MACHINE_MAKE gmake setenv ICE_MACHINE_WKDIR /u/hebert/data/CICE_RUNS -setenv ICE_MACHINE_INPUTDATA /u/hebert/data/CICE_RUNS +setenv ICE_MACHINE_INPUTDATA /u/hebert/data/ setenv ICE_MACHINE_BASELINE /u/hebert/data/CICE_BASELINE setenv ICE_MACHINE_SUBMIT "qsub " setenv ICE_MACHINE_ACCT P00000000 setenv ICE_MACHINE_QUEUE "standard" -setenv ICE_MACHINE_TPNODE 20 # tasks per node -setenv ICE_MACHINE_BLDTHRDS 1 +setenv ICE_MACHINE_TPNODE 28 # tasks per node +setenv ICE_MACHINE_BLDTHRDS 8 setenv ICE_MACHINE_QSTAT "qstat " From 367f8b3a796079912c15492a2a122a717fb27d0d Mon Sep 17 00:00:00 2001 From: daveh150 Date: Thu, 25 May 2023 15:16:18 -0500 Subject: [PATCH 4/8] Added JRA55do to file names. Added comments for each variable name at top of JRA55do_???_files subroutine --- cicecore/cicedyn/general/ice_forcing.F90 | 84 +++++++++++++++++------- 1 file changed, 62 insertions(+), 22 deletions(-) diff --git a/cicecore/cicedyn/general/ice_forcing.F90 b/cicecore/cicedyn/general/ice_forcing.F90 index 4850497ab..aebea1016 100755 --- a/cicecore/cicedyn/general/ice_forcing.F90 +++ b/cicecore/cicedyn/general/ice_forcing.F90 @@ -2347,6 +2347,19 @@ end subroutine JRA55_gx3_files !======================================================================= subroutine JRA55do_gx1_files(yr) ! + !------------------------------------------------------------------- + ! Individual NETCDF files for each quantity. + ! winds in NORTH and EAST direction (not rotated) + ! file variable names are: + ! rsds (shortwave W/m^2), 3 hr average + ! rlds (longwave W/m^2), 3 hr average + ! ttlpcp (precipitation kg/m s-1), 3 hr average + ! uas (eastward wind m/s), instantaneous + ! vas (northward wind m/s), instantaneous + ! tas (air temperature K), instantaneous + ! huss (specific humidity kg/kg), instantaneous + !------------------------------------------------------------------- + integer (kind=int_kind), intent(in) :: & yr ! current forcing year @@ -2355,31 +2368,31 @@ subroutine JRA55do_gx1_files(yr) if (local_debug .and. my_task == master_task) write(nu_diag,*) subname,'fdbg start' uwind_file = & - trim(atm_data_dir)//'/8XDAILY/uas_gx1_2005.nc' + trim(atm_data_dir)//'/8XDAILY/JRA55do_uas_gx1_2005.nc' call file_year(uwind_file,yr) vwind_file = & - trim(atm_data_dir)//'/8XDAILY/vas_gx1_2005.nc' + trim(atm_data_dir)//'/8XDAILY/JRA55do_vas_gx1_2005.nc' call file_year(vwind_file,yr) tair_file = & - trim(atm_data_dir)//'/8XDAILY/tas_gx1_2005.nc' + trim(atm_data_dir)//'/8XDAILY/JRA55do_tas_gx1_2005.nc' call file_year(tair_file,yr) humid_file = & - trim(atm_data_dir)//'/8XDAILY/huss_gx1_2005.nc' + trim(atm_data_dir)//'/8XDAILY/JRA55do_huss_gx1_2005.nc' call file_year(humid_file,yr) rain_file = & - trim(atm_data_dir)//'/8XDAILY/ttlpcp_gx1_2005.nc' + trim(atm_data_dir)//'/8XDAILY/JRA55do_ttlpcp_gx1_2005.nc' call file_year(rain_file,yr) fsw_file = & - trim(atm_data_dir)//'/8XDAILY/rsds_gx1_2005.nc' + trim(atm_data_dir)//'/8XDAILY/JRA55do_rsds_gx1_2005.nc' call file_year(fsw_file,yr) flw_file = & - trim(atm_data_dir)//'/8XDAILY/rlds_gx1_2005.nc' + trim(atm_data_dir)//'/8XDAILY/JRA55do_rlds_gx1_2005.nc' call file_year(flw_file,yr) @@ -2401,6 +2414,20 @@ end subroutine JRA55do_gx1_files subroutine JRA55do_tx1_files(yr) ! + + !------------------------------------------------------------------- + ! Individual NETCDF files for each quantity. + ! winds in NORTH and EAST direction (not rotated) + ! file variable names are: + ! rsds (shortwave W/m^2), 3 hr average + ! rlds (longwave W/m^2), 3 hr average + ! ttlpcp (precipitation kg/m s-1), 3 hr average + ! uas (eastward wind m/s), instantaneous + ! vas (northward wind m/s), instantaneous + ! tas (air temperature K), instantaneous + ! huss (specific humidity kg/kg), instantaneous + !------------------------------------------------------------------- + integer (kind=int_kind), intent(in) :: & yr ! current forcing year @@ -2409,31 +2436,31 @@ subroutine JRA55do_tx1_files(yr) if (local_debug .and. my_task == master_task) write(nu_diag,*) subname,'fdbg start' uwind_file = & - trim(atm_data_dir)//'/8XDAILY/uas_tx1_2005.nc' + trim(atm_data_dir)//'/8XDAILY/JRA55do_uas_tx1_2005.nc' call file_year(uwind_file,yr) vwind_file = & - trim(atm_data_dir)//'/8XDAILY/vas_tx1_2005.nc' + trim(atm_data_dir)//'/8XDAILY/JRA55do_vas_tx1_2005.nc' call file_year(vwind_file,yr) tair_file = & - trim(atm_data_dir)//'/8XDAILY/tas_tx1_2005.nc' + trim(atm_data_dir)//'/8XDAILY/JRA55do_tas_tx1_2005.nc' call file_year(tair_file,yr) humid_file = & - trim(atm_data_dir)//'/8XDAILY/huss_tx1_2005.nc' + trim(atm_data_dir)//'/8XDAILY/JRA55do_huss_tx1_2005.nc' call file_year(humid_file,yr) rain_file = & - trim(atm_data_dir)//'/8XDAILY/ttlpcp_tx1_2005.nc' + trim(atm_data_dir)//'/8XDAILY/JRA55do_ttlpcp_tx1_2005.nc' call file_year(rain_file,yr) fsw_file = & - trim(atm_data_dir)//'/8XDAILY/rsds_tx1_2005.nc' + trim(atm_data_dir)//'/8XDAILY/JRA55do_rsds_tx1_2005.nc' call file_year(fsw_file,yr) flw_file = & - trim(atm_data_dir)//'/8XDAILY/rlds_tx1_2005.nc' + trim(atm_data_dir)//'/8XDAILY/JRA55do_rlds_tx1_2005.nc' call file_year(flw_file,yr) @@ -2454,7 +2481,20 @@ end subroutine JRA55do_tx1_files !======================================================================= subroutine JRA55do_gx3_files(yr) -! + + !------------------------------------------------------------------- + ! Individual NETCDF files for each quantity. + ! winds in NORTH and EAST direction (not rotated) + ! file variable names are: + ! rsds (shortwave W/m^2), 3 hr average + ! rlds (longwave W/m^2), 3 hr average + ! ttlpcp (precipitation kg/m s-1), 3 hr average + ! uas (eastward wind m/s), instantaneous + ! vas (northward wind m/s), instantaneous + ! tas (air temperature K), instantaneous + ! huss (specific humidity kg/kg), instantaneous + !------------------------------------------------------------------- + integer (kind=int_kind), intent(in) :: & yr ! current forcing year @@ -2463,31 +2503,31 @@ subroutine JRA55do_gx3_files(yr) if (local_debug .and. my_task == master_task) write(nu_diag,*) subname,'fdbg start' uwind_file = & - trim(atm_data_dir)//'/8XDAILY/uas_gx3_2005.nc' + trim(atm_data_dir)//'/8XDAILY/JRA55do_uas_gx3_2005.nc' call file_year(uwind_file,yr) vwind_file = & - trim(atm_data_dir)//'/8XDAILY/vas_gx3_2005.nc' + trim(atm_data_dir)//'/8XDAILY/JRA55do_vas_gx3_2005.nc' call file_year(vwind_file,yr) tair_file = & - trim(atm_data_dir)//'/8XDAILY/tas_gx3_2005.nc' + trim(atm_data_dir)//'/8XDAILY/JRA55do_tas_gx3_2005.nc' call file_year(tair_file,yr) humid_file = & - trim(atm_data_dir)//'/8XDAILY/huss_gx3_2005.nc' + trim(atm_data_dir)//'/8XDAILY/JRA55do_huss_gx3_2005.nc' call file_year(humid_file,yr) rain_file = & - trim(atm_data_dir)//'/8XDAILY/ttlpcp_gx3_2005.nc' + trim(atm_data_dir)//'/8XDAILY/JRA55do_ttlpcp_gx3_2005.nc' call file_year(rain_file,yr) fsw_file = & - trim(atm_data_dir)//'/8XDAILY/rsds_gx3_2005.nc' + trim(atm_data_dir)//'/8XDAILY/JRA55do_rsds_gx3_2005.nc' call file_year(fsw_file,yr) flw_file = & - trim(atm_data_dir)//'/8XDAILY/rlds_gx3_2005.nc' + trim(atm_data_dir)//'/8XDAILY/JRA55do_rlds_gx3_2005.nc' call file_year(flw_file,yr) From 49fede094d405297538ec66167f081d5d9b3547d Mon Sep 17 00:00:00 2001 From: daveh150 Date: Thu, 1 Jun 2023 16:28:00 -0500 Subject: [PATCH 5/8] Make JRA55 forcing to use common subroutines. Search atm_data_type for specific cases --- cicecore/cicedyn/general/ice_forcing.F90 | 606 ++--------------------- 1 file changed, 39 insertions(+), 567 deletions(-) diff --git a/cicecore/cicedyn/general/ice_forcing.F90 b/cicecore/cicedyn/general/ice_forcing.F90 index aebea1016..911a1b8a2 100755 --- a/cicecore/cicedyn/general/ice_forcing.F90 +++ b/cicecore/cicedyn/general/ice_forcing.F90 @@ -305,18 +305,13 @@ subroutine init_forcing_atmo elseif (trim(atm_data_type) == 'LYq') then call LY_files(fyear) #endif - elseif (trim(atm_data_type) == 'JRA55_gx1') then - 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) == 'JRA55do_gx1') then - call JRA55do_gx1_files(fyear) - elseif (trim(atm_data_type) == 'JRA55do_gx3') then - call JRA55do_gx3_files(fyear) - elseif (trim(atm_data_type) == 'JRA55do_tx1') then - call JRA55do_tx1_files(fyear) + elseif ((trim(atm_data_type) == 'JRA55_gx1') .or. & + (trim(atm_data_type) == 'JRA55_gx3') .or. & + (trim(atm_data_type) == 'JRA55_tx1') .or. & + (trim(atm_data_type) == 'JRA55do_gx1') .or. & + (trim(atm_data_type) == 'JRA55do_gx3') .or. & + (trim(atm_data_type) == 'JRA55do_tx1')) then + call JRA55_files(fyear) elseif (trim(atm_data_type) == 'hadgem') then call hadgem_files(fyear) elseif (trim(atm_data_type) == 'monthly') then @@ -657,18 +652,13 @@ subroutine get_forcing_atmo elseif (trim(atm_data_type) == 'LYq') then call LY_data #endif - elseif (trim(atm_data_type) == 'JRA55_gx1') then + elseif ((trim(atm_data_type) == 'JRA55_gx1') .or. & + (trim(atm_data_type) == 'JRA55_gx3') .or. & + (trim(atm_data_type) == 'JRA55_tx1') .or. & + (trim(atm_data_type) == 'JRA55do_gx1') .or. & + (trim(atm_data_type) == 'JRA55do_gx3') .or. & + (trim(atm_data_type) == 'JRA55do_tx1')) then call JRA55_data - elseif (trim(atm_data_type) == 'JRA55_gx3') then - call JRA55_data - elseif (trim(atm_data_type) == 'JRA55_tx1') then - call JRA55_data - elseif (trim(atm_data_type) == 'JRA55do_gx1') then - call JRA55do_data - elseif (trim(atm_data_type) == 'JRA55do_gx3') then - call JRA55do_data - elseif (trim(atm_data_type) == 'JRA55do_tx1') then - call JRA55do_data elseif (trim(atm_data_type) == 'hadgem') then call hadgem_data elseif (trim(atm_data_type) == 'monthly') then @@ -1608,27 +1598,7 @@ 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_gx1') then ! netcdf - 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_gx3') then ! netcdf - 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' - elseif (trim(atm_data_type) == 'JRA55do_gx1') then ! netcdf - 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) == 'JRA55do_gx3') then ! netcdf - 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) == 'JRA55do_tx1') then ! netcdf + elseif (index(trim(atm_data_type),'JRA55') > 0) then ! netcdf i = index(data_file,'.nc') - 5 tmpname = data_file write(data_file,'(a,i4.4,a)') tmpname(1:i), yr, '.nc' @@ -2282,272 +2252,52 @@ end subroutine LY_files #endif !======================================================================= - subroutine JRA55_gx1_files(yr) -! - integer (kind=int_kind), intent(in) :: & - yr ! current forcing year - - character(len=*), parameter :: subname = '(JRA55_gx1_files)' - - if (local_debug .and. my_task == master_task) write(nu_diag,*) subname,'fdbg start' - - uwind_file = & - trim(atm_data_dir)//'/8XDAILY/JRA55_03hr_forcing_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_gx1_files - -!======================================================================= - - subroutine JRA55_tx1_files(yr) -! - integer (kind=int_kind), intent(in) :: & - yr ! current forcing year - - character(len=*), parameter :: subname = '(JRA55_tx1_files)' - - if (local_debug .and. my_task == master_task) write(nu_diag,*) subname,'fdbg start' - - 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) + subroutine JRA55_files(yr) ! integer (kind=int_kind), intent(in) :: & yr ! current forcing year - character(len=*), parameter :: subname = '(JRA55_gx3_files)' - - if (local_debug .and. my_task == master_task) write(nu_diag,*) subname,'fdbg start' - - uwind_file = & - trim(atm_data_dir)//'/8XDAILY/JRA55_gx3_03hr_forcing_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_gx3_files - -!======================================================================= - subroutine JRA55do_gx1_files(yr) -! - !------------------------------------------------------------------- - ! Individual NETCDF files for each quantity. - ! winds in NORTH and EAST direction (not rotated) - ! file variable names are: - ! rsds (shortwave W/m^2), 3 hr average - ! rlds (longwave W/m^2), 3 hr average - ! ttlpcp (precipitation kg/m s-1), 3 hr average - ! uas (eastward wind m/s), instantaneous - ! vas (northward wind m/s), instantaneous - ! tas (air temperature K), instantaneous - ! huss (specific humidity kg/kg), instantaneous - !------------------------------------------------------------------- - - integer (kind=int_kind), intent(in) :: & - yr ! current forcing year - - character(len=*), parameter :: subname = '(JRA55do_gx1_files)' - - if (local_debug .and. my_task == master_task) write(nu_diag,*) subname,'fdbg start' - - uwind_file = & - trim(atm_data_dir)//'/8XDAILY/JRA55do_uas_gx1_2005.nc' - call file_year(uwind_file,yr) - - vwind_file = & - trim(atm_data_dir)//'/8XDAILY/JRA55do_vas_gx1_2005.nc' - call file_year(vwind_file,yr) - - tair_file = & - trim(atm_data_dir)//'/8XDAILY/JRA55do_tas_gx1_2005.nc' - call file_year(tair_file,yr) - - humid_file = & - trim(atm_data_dir)//'/8XDAILY/JRA55do_huss_gx1_2005.nc' - call file_year(humid_file,yr) - - rain_file = & - trim(atm_data_dir)//'/8XDAILY/JRA55do_ttlpcp_gx1_2005.nc' - call file_year(rain_file,yr) - - fsw_file = & - trim(atm_data_dir)//'/8XDAILY/JRA55do_rsds_gx1_2005.nc' - call file_year(fsw_file,yr) + ! local variables + integer (kind=int_kind) :: & + i ! used to check for substring - flw_file = & - trim(atm_data_dir)//'/8XDAILY/JRA55do_rlds_gx1_2005.nc' - call file_year(flw_file,yr) - + character(len=3) :: & + grd ! gx3, gx1, tx1 - if (my_task == master_task) then - write (nu_diag,*) ' ' - write (nu_diag,*) 'Atmospheric data files:' - write (nu_diag,*) trim(uwind_file) - write (nu_diag,*) trim(vwind_file) - write (nu_diag,*) trim(tair_file) - write (nu_diag,*) trim(humid_file) - write (nu_diag,*) trim(rain_file) - write (nu_diag,*) trim(fsw_file) - write (nu_diag,*) trim(flw_file) - endif - - end subroutine JRA55do_gx1_files - -!======================================================================= - - subroutine JRA55do_tx1_files(yr) -! - - !------------------------------------------------------------------- - ! Individual NETCDF files for each quantity. - ! winds in NORTH and EAST direction (not rotated) - ! file variable names are: - ! rsds (shortwave W/m^2), 3 hr average - ! rlds (longwave W/m^2), 3 hr average - ! ttlpcp (precipitation kg/m s-1), 3 hr average - ! uas (eastward wind m/s), instantaneous - ! vas (northward wind m/s), instantaneous - ! tas (air temperature K), instantaneous - ! huss (specific humidity kg/kg), instantaneous - !------------------------------------------------------------------- - - integer (kind=int_kind), intent(in) :: & - yr ! current forcing year - - character(len=*), parameter :: subname = '(JRA55do_tx1_files)' + character(len=*), parameter :: subname = '(JRA55_files)' if (local_debug .and. my_task == master_task) write(nu_diag,*) subname,'fdbg start' - uwind_file = & - trim(atm_data_dir)//'/8XDAILY/JRA55do_uas_tx1_2005.nc' - call file_year(uwind_file,yr) - - vwind_file = & - trim(atm_data_dir)//'/8XDAILY/JRA55do_vas_tx1_2005.nc' - call file_year(vwind_file,yr) - - tair_file = & - trim(atm_data_dir)//'/8XDAILY/JRA55do_tas_tx1_2005.nc' - call file_year(tair_file,yr) - - humid_file = & - trim(atm_data_dir)//'/8XDAILY/JRA55do_huss_tx1_2005.nc' - call file_year(humid_file,yr) - - rain_file = & - trim(atm_data_dir)//'/8XDAILY/JRA55do_ttlpcp_tx1_2005.nc' - call file_year(rain_file,yr) - - fsw_file = & - trim(atm_data_dir)//'/8XDAILY/JRA55do_rsds_tx1_2005.nc' - call file_year(fsw_file,yr) - - flw_file = & - trim(atm_data_dir)//'/8XDAILY/JRA55do_rlds_tx1_2005.nc' - call file_year(flw_file,yr) - + ! check for grid version using fortran INDEX intrinsic + if (index(trim(atm_data_type),'gx1') > 0) then + grd = 'gx1' + else if (index(trim(atm_data_type),'gx3') > 0) then + grd = 'gx3' + else if (index(trim(atm_data_type),'tx1') > 0) then + grd = 'tx1' + else + call abort_ice(error_message=subname//' unknown grid type') + endif - if (my_task == master_task) then - write (nu_diag,*) ' ' - write (nu_diag,*) 'Atmospheric data files:' - write (nu_diag,*) trim(uwind_file) - write (nu_diag,*) trim(vwind_file) - write (nu_diag,*) trim(tair_file) - write (nu_diag,*) trim(humid_file) - write (nu_diag,*) trim(rain_file) - write (nu_diag,*) trim(fsw_file) - write (nu_diag,*) trim(flw_file) + ! check if JRA55 or JRA55do + if (index(trim(atm_data_type),'JRA55do') > 0) then + uwind_file = & + trim(atm_data_dir)//'/8XDAILY/JRA55do_03hr_forcing_'//grd//'_2005.nc' + else ! assumes only other option os JRA55 + uwind_file = & + trim(atm_data_dir)//'/8XDAILY/JRA55_03hr_forcing_'//grd//'_2005.nc' endif - - end subroutine JRA55do_tx1_files - -!======================================================================= - - subroutine JRA55do_gx3_files(yr) - !------------------------------------------------------------------- - ! Individual NETCDF files for each quantity. - ! winds in NORTH and EAST direction (not rotated) - ! file variable names are: - ! rsds (shortwave W/m^2), 3 hr average - ! rlds (longwave W/m^2), 3 hr average - ! ttlpcp (precipitation kg/m s-1), 3 hr average - ! uas (eastward wind m/s), instantaneous - ! vas (northward wind m/s), instantaneous - ! tas (air temperature K), instantaneous - ! huss (specific humidity kg/kg), instantaneous - !------------------------------------------------------------------- - - integer (kind=int_kind), intent(in) :: & - yr ! current forcing year - - character(len=*), parameter :: subname = '(JRA55do_gx3_files)' - - if (local_debug .and. my_task == master_task) write(nu_diag,*) subname,'fdbg start' - - uwind_file = & - trim(atm_data_dir)//'/8XDAILY/JRA55do_uas_gx3_2005.nc' call file_year(uwind_file,yr) - - vwind_file = & - trim(atm_data_dir)//'/8XDAILY/JRA55do_vas_gx3_2005.nc' - call file_year(vwind_file,yr) - - tair_file = & - trim(atm_data_dir)//'/8XDAILY/JRA55do_tas_gx3_2005.nc' - call file_year(tair_file,yr) - - humid_file = & - trim(atm_data_dir)//'/8XDAILY/JRA55do_huss_gx3_2005.nc' - call file_year(humid_file,yr) - - rain_file = & - trim(atm_data_dir)//'/8XDAILY/JRA55do_ttlpcp_gx3_2005.nc' - call file_year(rain_file,yr) - - fsw_file = & - trim(atm_data_dir)//'/8XDAILY/JRA55do_rsds_gx3_2005.nc' - call file_year(fsw_file,yr) - - flw_file = & - trim(atm_data_dir)//'/8XDAILY/JRA55do_rlds_gx3_2005.nc' - call file_year(flw_file,yr) - - if (my_task == master_task) then write (nu_diag,*) ' ' write (nu_diag,*) 'Atmospheric data files:' write (nu_diag,*) trim(uwind_file) - write (nu_diag,*) trim(vwind_file) - write (nu_diag,*) trim(tair_file) - write (nu_diag,*) trim(humid_file) - write (nu_diag,*) trim(rain_file) - write (nu_diag,*) trim(fsw_file) - write (nu_diag,*) trim(flw_file) endif - end subroutine JRA55do_gx3_files + end subroutine JRA55_files !======================================================================= - - #ifdef UNDEPRECATE_LYq !======================================================================= ! @@ -3023,284 +2773,6 @@ subroutine JRA55_data end subroutine JRA55_data !======================================================================= - - subroutine JRA55do_data - - use ice_blocks, only: block, get_block - use ice_global_reductions, only: global_minval, global_maxval - use ice_domain, only: nblocks, distrb_info - use ice_flux, only: fsnow, Tair, uatm, vatm, Qa, fsw, flw - use ice_grid, only: hm, tmask, umask - use ice_state, only: aice - use ice_calendar, only: days_per_year - - integer (kind=int_kind) :: & - ncid , & ! netcdf file id - i, j, n1 , & - lfyear , & ! local year value - recnum , & ! record number - maxrec , & ! maximum record number - iblk ! block index - - integer (kind=int_kind), save :: & - frec_info(2,2) = -99 ! remember prior values to reduce reading - ! first dim is yr, recnum - ! second dim is data1 data2 - - real (kind=dbl_kind) :: & - sec3hr , & ! number of seconds in 3 hours - secday , & ! number of seconds in day - eps, tt , & ! for interpolation coefficients - Tffresh , & - vmin, vmax - - character(len=64) :: fieldname !netcdf field name - - character(len=*), parameter :: subname = '(JRA55do_data)' - - if (local_debug .and. my_task == master_task) write(nu_diag,*) subname,'fdbg start' - - call icepack_query_parameters(Tffresh_out=Tffresh) - call icepack_query_parameters(secday_out=secday) - call icepack_warnings_flush(nu_diag) - if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & - file=__FILE__, line=__LINE__) - - sec3hr = secday/c8 ! seconds in 3 hours - maxrec = days_per_year * 8 - - if (local_debug .and. my_task == master_task) then - write(nu_diag,*) subname,'fdbg dpy, maxrec = ',days_per_year,maxrec - endif - - !------------------------------------------------------------------- - ! 3-hourly data. - ! states are instantaneous, 1st record is 00z Jan 1 - ! fluxes are 3 hour averages, 1st record is 00z-03z Jan 1 - ! interpolate states, do not interpolate fluxes - !------------------------------------------------------------------- - ! Individual NETCDF files for each quantity. - ! winds in NORTH and EAST direction (not rotated) - ! file variable names are: - ! rsds (shortwave W/m^2), 3 hr average - ! rlds (longwave W/m^2), 3 hr average - ! ttlpcp (precipitation kg/m s-1), 3 hr average - ! uas (eastward wind m/s), instantaneous - ! vas (northward wind m/s), instantaneous - ! tas (air temperature K), instantaneous - ! huss (specific humidity kg/kg), instantaneous - !------------------------------------------------------------------- - - do n1 = 1, 2 - - lfyear = fyear - if (n1 == 1) then - recnum = 8*int(yday) - 7 + int(real(msec,kind=dbl_kind)/sec3hr) - call file_year(tair_file, lfyear) ! make file name with proper year - call file_year(uwind_file, lfyear) ! make file name with proper year - call file_year(vwind_file, lfyear) ! make file name with proper year - call file_year(humid_file, lfyear) ! make file name with proper year - call file_year(fsw_file, lfyear) ! make file name with proper year - call file_year(flw_file, lfyear) ! make file name with proper year - call file_year(rain_file, lfyear) ! make file name with proper year - - if (my_task == master_task .and. (recnum <= 2 .or. recnum >= maxrec-1)) then - write(nu_diag,*) subname,' reading forcing file 1st ts = ',trim(tair_file) - write(nu_diag,*) subname,' reading forcing file 1st ts = ',trim(uwind_file) - write(nu_diag,*) subname,' reading forcing file 1st ts = ',trim(vwind_file) - write(nu_diag,*) subname,' reading forcing file 1st ts = ',trim(humid_file) - write(nu_diag,*) subname,' reading forcing file 1st ts = ',trim(fsw_file) - write(nu_diag,*) subname,' reading forcing file 1st ts = ',trim(flw_file) - write(nu_diag,*) subname,' reading forcing file 1st ts = ',trim(rain_file) - endif - elseif (n1 == 2) then - recnum = 8*int(yday) - 7 + int(real(msec,kind=dbl_kind)/sec3hr) + 1 - if (recnum > maxrec) then - lfyear = fyear + 1 ! next year - if (lfyear > fyear_final) lfyear = fyear_init - recnum = 1 - call file_year(tair_file, lfyear) ! make file name with proper year - call file_year(uwind_file, lfyear) ! make file name with proper year - call file_year(vwind_file, lfyear) ! make file name with proper year - call file_year(humid_file, lfyear) ! make file name with proper year - call file_year(fsw_file, lfyear) ! make file name with proper year - call file_year(flw_file, lfyear) ! make file name with proper year - call file_year(rain_file, lfyear) ! make file name with proper year - - if (my_task == master_task) then - write(nu_diag,*) subname,' reading forcing file 2nd ts = ',trim(tair_file) - write(nu_diag,*) subname,' reading forcing file 2nd ts = ',trim(uwind_file) - write(nu_diag,*) subname,' reading forcing file 2nd ts = ',trim(vwind_file) - write(nu_diag,*) subname,' reading forcing file 2nd ts = ',trim(humid_file) - write(nu_diag,*) subname,' reading forcing file 2nd ts = ',trim(fsw_file) - write(nu_diag,*) subname,' reading forcing file 2nd ts = ',trim(flw_file) - write(nu_diag,*) subname,' reading forcing file 2nd ts = ',trim(rain_file) - endif - endif - endif - - if (local_debug .and. my_task == master_task) then - write(nu_diag,*) subname,'fdbg read recnum = ',recnum,n1 - endif - - ! to reduce reading, check whether it's the same data as last read - - if (lfyear /= frec_info(1,n1) .or. recnum /= frec_info(2,n1)) then - - ! check whether we can copy values from 2 to 1, should be faster than reading - ! can only do this from 2 to 1 or 1 to 2 without setting up a temporary - ! it's more likely that the values from data2 when time advances are needed in data1 - ! compare n1=1 year/record with data from last timestep at n1=2 - - if (n1 == 1 .and. lfyear == frec_info(1,2) .and. recnum == frec_info(2,2)) then - Tair_data(:,:,1,:) = Tair_data(:,:,2,:) - uatm_data(:,:,1,:) = uatm_data(:,:,2,:) - vatm_data(:,:,1,:) = vatm_data(:,:,2,:) - Qa_data(:,:,1,:) = Qa_data(:,:,2,:) - fsw_data(:,:,1,:) = fsw_data(:,:,2,:) - flw_data(:,:,1,:) = flw_data(:,:,2,:) - fsnow_data(:,:,1,:) = fsnow_data(:,:,2,:) - else - - ! read each variable from individual NetCDFs - fieldname = 'tas' - call ice_open_nc(tair_file,ncid) - call ice_read_nc(ncid,recnum,fieldname,Tair_data(:,:,n1,:),local_debug, & - field_loc=field_loc_center, & - field_type=field_type_scalar) - call ice_close_nc(ncid) - - fieldname = 'uas' - call ice_open_nc(uwind_file,ncid) - call ice_read_nc(ncid,recnum,fieldname,uatm_data(:,:,n1,:),local_debug, & - field_loc=field_loc_center, & - field_type=field_type_scalar) - call ice_close_nc(ncid) - - fieldname = 'vas' - call ice_open_nc(vwind_file,ncid) - call ice_read_nc(ncid,recnum,fieldname,vatm_data(:,:,n1,:),local_debug, & - field_loc=field_loc_center, & - field_type=field_type_scalar) - call ice_close_nc(ncid) - - fieldname = 'huss' - call ice_open_nc(humid_file,ncid) - call ice_read_nc(ncid,recnum,fieldname,Qa_data(:,:,n1,:),local_debug, & - field_loc=field_loc_center, & - field_type=field_type_scalar) - call ice_close_nc(ncid) - - fieldname = 'rsds' - call ice_open_nc(fsw_file,ncid) - call ice_read_nc(ncid,recnum,fieldname,fsw_data(:,:,n1,:),local_debug, & - field_loc=field_loc_center, & - field_type=field_type_scalar) - call ice_close_nc(ncid) - - fieldname = 'rlds' - call ice_open_nc(flw_file,ncid) - call ice_read_nc(ncid,recnum,fieldname,flw_data(:,:,n1,:),local_debug, & - field_loc=field_loc_center, & - field_type=field_type_scalar) - call ice_close_nc(ncid) - - fieldname = 'ttlpcp' - call ice_open_nc(rain_file,ncid) - call ice_read_nc(ncid,recnum,fieldname,fsnow_data(:,:,n1,:),local_debug, & - field_loc=field_loc_center, & - field_type=field_type_scalar) - call ice_close_nc(ncid) - - endif ! copy data from n1=2 from last timestep to n1=1 - endif ! input data is same as last timestep - - frec_info(1,n1) = lfyear - frec_info(2,n1) = recnum - - enddo ! n1 - - ! Compute interpolation coefficients - eps = 1.0e-6 - tt = real(mod(msec,nint(sec3hr)),kind=dbl_kind) - c2intp = tt / sec3hr - if (c2intp < c0 .and. c2intp > c0-eps) c2intp = c0 - if (c2intp > c1 .and. c2intp < c1+eps) c2intp = c1 - c1intp = 1.0_dbl_kind - c2intp - if (c2intp < c0 .or. c2intp > c1) then - write(nu_diag,*) subname,' ERROR: c2intp = ',c2intp - call abort_ice (error_message=subname//' ERROR: c2intp out of range', & - file=__FILE__, line=__LINE__) - endif - if (local_debug .and. my_task == master_task) then - write(nu_diag,*) subname,'fdbg c12intp = ',c1intp,c2intp - endif - - ! Interpolate - call interpolate_data (Tair_data, Tair) - call interpolate_data (uatm_data, uatm) - call interpolate_data (vatm_data, vatm) - call interpolate_data (Qa_data, Qa) - ! use 3 hr average for heat flux and precip fields, no interpolation - ! call interpolate_data (fsw_data, fsw) - ! call interpolate_data (flw_data, flw) - ! call interpolate_data (fsnow_data, fsnow) - fsw(:,:,:) = fsw_data(:,:,1,:) - flw(:,:,:) = flw_data(:,:,1,:) - fsnow(:,:,:) = fsnow_data(:,:,1,:) - - !$OMP PARALLEL DO PRIVATE(iblk,i,j) - do iblk = 1, nblocks - ! limit summer Tair values where ice is present - do j = 1, ny_block - do i = 1, nx_block - if (aice(i,j,iblk) > p1) Tair(i,j,iblk) = min(Tair(i,j,iblk), Tffresh+p1) - enddo - enddo - - do j = 1, ny_block - do i = 1, nx_block - Qa (i,j,iblk) = Qa (i,j,iblk) * hm(i,j,iblk) - Tair(i,j,iblk) = Tair(i,j,iblk) * hm(i,j,iblk) - uatm(i,j,iblk) = uatm(i,j,iblk) * hm(i,j,iblk) - vatm(i,j,iblk) = vatm(i,j,iblk) * hm(i,j,iblk) - fsw (i,j,iblk) = fsw (i,j,iblk) * hm(i,j,iblk) - flw (i,j,iblk) = flw (i,j,iblk) * hm(i,j,iblk) - fsnow(i,j,iblk) = fsnow (i,j,iblk) * hm(i,j,iblk) - enddo - enddo - - enddo ! iblk - !$OMP END PARALLEL DO - - if (debug_forcing .or. local_debug) then - if (my_task.eq.master_task) write (nu_diag,*) subname,'fdbg JRA55do_data' - vmin = global_minval(fsw,distrb_info,tmask) - vmax = global_maxval(fsw,distrb_info,tmask) - if (my_task.eq.master_task) write (nu_diag,*) subname,'fdbg fsw',vmin,vmax - vmin = global_minval(flw,distrb_info,tmask) - vmax = global_maxval(flw,distrb_info,tmask) - if (my_task.eq.master_task) write (nu_diag,*) subname,'fdbg flw',vmin,vmax - vmin =global_minval(fsnow,distrb_info,tmask) - vmax =global_maxval(fsnow,distrb_info,tmask) - if (my_task.eq.master_task) write (nu_diag,*) subname,'fdbg fsnow',vmin,vmax - vmin = global_minval(Tair,distrb_info,tmask) - vmax = global_maxval(Tair,distrb_info,tmask) - if (my_task.eq.master_task) write (nu_diag,*) subname,'fdbg Tair',vmin,vmax - vmin = global_minval(uatm,distrb_info,umask) - vmax = global_maxval(uatm,distrb_info,umask) - if (my_task.eq.master_task) write (nu_diag,*) subname,'fdbg uatm',vmin,vmax - vmin = global_minval(vatm,distrb_info,umask) - vmax = global_maxval(vatm,distrb_info,umask) - if (my_task.eq.master_task) write (nu_diag,*) subname,'fdbg vatm',vmin,vmax - vmin = global_minval(Qa,distrb_info,tmask) - vmax = global_maxval(Qa,distrb_info,tmask) - if (my_task.eq.master_task) write (nu_diag,*) subname,'fdbg Qa',vmin,vmax - endif ! debug_forcing - - end subroutine JRA55do_data - -! ================================================================= ! ! AOMIP shortwave forcing ! standard calculation using solar declination angle From 2a0c23713882ac349fbc90bd145e76fd34266d11 Mon Sep 17 00:00:00 2001 From: daveh150 Date: Thu, 1 Jun 2023 16:33:48 -0500 Subject: [PATCH 6/8] remove extraneous 'i' variable in JRA55_files --- cicecore/cicedyn/general/ice_forcing.F90 | 3 --- 1 file changed, 3 deletions(-) diff --git a/cicecore/cicedyn/general/ice_forcing.F90 b/cicecore/cicedyn/general/ice_forcing.F90 index 911a1b8a2..3c8858446 100755 --- a/cicecore/cicedyn/general/ice_forcing.F90 +++ b/cicecore/cicedyn/general/ice_forcing.F90 @@ -2258,9 +2258,6 @@ subroutine JRA55_files(yr) yr ! current forcing year ! local variables - integer (kind=int_kind) :: & - i ! used to check for substring - character(len=3) :: & grd ! gx3, gx1, tx1 From 1ec571ff0ae1334cf9213c2ace454f2bd9ad7966 Mon Sep 17 00:00:00 2001 From: daveh150 Date: Fri, 2 Jun 2023 07:33:50 -0500 Subject: [PATCH 7/8] Changed JRA55 filename JRA55_grid instead of grid at end of filename --- cicecore/cicedyn/general/ice_forcing.F90 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cicecore/cicedyn/general/ice_forcing.F90 b/cicecore/cicedyn/general/ice_forcing.F90 index 3c8858446..37535357e 100755 --- a/cicecore/cicedyn/general/ice_forcing.F90 +++ b/cicecore/cicedyn/general/ice_forcing.F90 @@ -2279,10 +2279,10 @@ subroutine JRA55_files(yr) ! check if JRA55 or JRA55do if (index(trim(atm_data_type),'JRA55do') > 0) then uwind_file = & - trim(atm_data_dir)//'/8XDAILY/JRA55do_03hr_forcing_'//grd//'_2005.nc' + trim(atm_data_dir)//'/8XDAILY/JRA55do_'//grd//'_03hr_forcing_2005.nc' else ! assumes only other option os JRA55 uwind_file = & - trim(atm_data_dir)//'/8XDAILY/JRA55_03hr_forcing_'//grd//'_2005.nc' + trim(atm_data_dir)//'/8XDAILY/JRA55_'//grd//'_03hr_forcing_2005.nc' endif call file_year(uwind_file,yr) From d2ead53cde91d69d5a516167c2c923e7c492a2c5 Mon Sep 17 00:00:00 2001 From: daveh150 Date: Thu, 6 Jul 2023 16:08:33 -0500 Subject: [PATCH 8/8] Add jra55do tests to base_suite and quick_suite. This is done via set_nml options. --- configuration/scripts/options/set_nml.jra55do_gx1 | 3 +++ configuration/scripts/options/set_nml.jra55do_gx3 | 3 +++ configuration/scripts/options/set_nml.jra55do_tx1 | 3 +++ configuration/scripts/tests/base_suite.ts | 3 +++ configuration/scripts/tests/quick_suite.ts | 1 + 5 files changed, 13 insertions(+) create mode 100644 configuration/scripts/options/set_nml.jra55do_gx1 create mode 100644 configuration/scripts/options/set_nml.jra55do_gx3 create mode 100644 configuration/scripts/options/set_nml.jra55do_tx1 diff --git a/configuration/scripts/options/set_nml.jra55do_gx1 b/configuration/scripts/options/set_nml.jra55do_gx1 new file mode 100644 index 000000000..658b4c239 --- /dev/null +++ b/configuration/scripts/options/set_nml.jra55do_gx1 @@ -0,0 +1,3 @@ +atm_data_format = 'nc' +atm_data_type = 'JRA55do_gx1' +atm_data_dir = 'ICE_MACHINE_INPUTDATA/CICE_data/forcing/gx1/JRA55do' diff --git a/configuration/scripts/options/set_nml.jra55do_gx3 b/configuration/scripts/options/set_nml.jra55do_gx3 new file mode 100644 index 000000000..4eb2bda84 --- /dev/null +++ b/configuration/scripts/options/set_nml.jra55do_gx3 @@ -0,0 +1,3 @@ +atm_data_format = 'nc' +atm_data_type = 'JRA55do_gx3' +atm_data_dir = 'ICE_MACHINE_INPUTDATA/CICE_data/forcing/gx3/JRA55do' diff --git a/configuration/scripts/options/set_nml.jra55do_tx1 b/configuration/scripts/options/set_nml.jra55do_tx1 new file mode 100644 index 000000000..3815632fb --- /dev/null +++ b/configuration/scripts/options/set_nml.jra55do_tx1 @@ -0,0 +1,3 @@ +atm_data_format = 'nc' +atm_data_type = 'JRA55do_tx1' +atm_data_dir = 'ICE_MACHINE_INPUTDATA/CICE_data/forcing/tx1/JRA55do' diff --git a/configuration/scripts/tests/base_suite.ts b/configuration/scripts/tests/base_suite.ts index 8685ab9a8..72eef9777 100644 --- a/configuration/scripts/tests/base_suite.ts +++ b/configuration/scripts/tests/base_suite.ts @@ -12,6 +12,7 @@ smoke gx3 4x1 diag1,run5day,thread smoke_gx3_8x2_diag1_ smoke gx3 1x8 diag1,run5day,evp1d restart gx1 40x4 droundrobin,medium restart tx1 40x4 dsectrobin,medium +restart tx1 40x4 dsectrobin,medium,jra55do_tx1 restart gx3 4x4 none restart gx3 10x4 maskhalo restart gx3 6x2 alt01 @@ -46,12 +47,14 @@ smoke gbox80 1x1 boxslotcyl smoke gbox12 1x1x12x12x1 boxchan,diag1,debug restart gx3 8x2 modal smoke gx3 8x2 bgcz +smoke gx3 8x2 jra55do_gx3 smoke gx3 8x2 bgczm,debug smoke gx3 8x1 bgcskl,debug #smoke gx3 4x1 bgcz,thread smoke_gx3_8x2_bgcz restart gx1 4x2 bgcsklclim,medium restart gx1 8x1 bgczclim,medium smoke gx1 24x1 medium,run90day,yi2008 +smoke gx1 24x1 medium,run90day,yi2008,jra55do_gx1 smoke gx3 8x1 medium,run90day,yi2008 restart gx1 24x1 short restart gx1 16x2 seabedLKD,gx1apr,short,debug diff --git a/configuration/scripts/tests/quick_suite.ts b/configuration/scripts/tests/quick_suite.ts index 48646673d..25974cb4e 100644 --- a/configuration/scripts/tests/quick_suite.ts +++ b/configuration/scripts/tests/quick_suite.ts @@ -1,5 +1,6 @@ # Test Grid PEs Sets BFB-compare smoke gx3 8x2 diag1,run5day +smoke gx3 8x2 diag1,run5day,jra55do_gx3 smoke gx3 1x1 diag1,run1day restart gbox128 8x1 diag1 restart gx3 4x2 debug,diag1