diff --git a/cice/drivers/cesm/CICE_RunMod.F90 b/cice/drivers/cesm/CICE_RunMod.F90 index c5731ed..627bb43 100644 --- a/cice/drivers/cesm/CICE_RunMod.F90 +++ b/cice/drivers/cesm/CICE_RunMod.F90 @@ -197,7 +197,7 @@ subroutine ice_step ! dynamics, transport, ridging !----------------------------------------------------------------- - if (.not.prescribed_ice) then + if (.not.prescribed_ice .and. kdyn>0) then do k = 1, ndtd call step_dynamics (dt_dyn, ndtd) enddo @@ -281,17 +281,18 @@ subroutine coupling_prep (iblk) use ice_constants, only: c0, c1, puny, rhofresh use ice_domain_size, only: ncat use ice_flux, only: alvdf, alidf, alvdr, alidr, albice, albsno, & - albpnd, albcnt, apeff_ai, coszen, fpond, fresh, & + albpnd, albcnt, apeff_ai, coszen, fpond, fresh, l_mpond_fresh, & alvdf_ai, alidf_ai, alvdr_ai, alidr_ai, fhocn_ai, & fresh_ai, fsalt_ai, fsalt, & fswthru_ai, fhocn, fswthru, scale_factor, & swvdr, swidr, swvdf, swidf, Tf, Tair, Qa, strairxT, strairyt, & fsens, flat, fswabs, flwout, evap, Tref, Qref, Uref, faero_ocn, & - fsurfn_f, flatn_f, scale_fluxes, frzmlt_init, frzmlt, wind + fsurfn_f, flatn_f, scale_fluxes, frzmlt_init, frzmlt, wind, & + snowfrac use ice_grid, only: tmask use ice_ocean, only: oceanmixed_ice, ocean_mixed_layer use ice_shortwave, only: alvdfn, alidfn, alvdrn, alidrn, & - albicen, albsnon, albpndn, apeffn + albicen, albsnon, albpndn, apeffn, snowfracn use ice_state, only: aicen, aice, aice_init, nbtrcr use ice_therm_shared, only: calc_Tsfc use ice_timers, only: timer_couple, ice_timer_start, ice_timer_stop @@ -307,8 +308,10 @@ subroutine coupling_prep (iblk) i,j , & ! horizontal indices k ! tracer index - real (kind=dbl_kind) :: cszn ! counter for history averaging - + real (kind=dbl_kind) :: & + cszn , & ! counter for history averaging + netsw ! flag for shortwave radiation presence + !----------------------------------------------------------------- ! Save current value of frzmlt for diagnostics. ! Update mixed layer with heat and radiation from ice. @@ -340,10 +343,12 @@ subroutine coupling_prep (iblk) albsno(i,j,iblk) = c0 albpnd(i,j,iblk) = c0 apeff_ai(i,j,iblk) = c0 + snowfrac(i,j,iblk) = c0 ! for history averaging cszn = c0 - if (coszen(i,j,iblk) > puny) cszn = c1 + netsw = swvdr(i,j,iblk)+swidr(i,j,iblk)+swvdf(i,j,iblk)+swidf(i,j,iblk) + if (netsw > puny) cszn = c1 do n = 1, nstreams albcnt(i,j,iblk,n) = albcnt(i,j,iblk,n) + cszn enddo @@ -372,6 +377,8 @@ subroutine coupling_prep (iblk) apeff_ai(i,j,iblk) = apeff_ai(i,j,iblk) & ! for history + apeffn(i,j,n,iblk)*aicen(i,j,n,iblk) + snowfrac(i,j,iblk) = snowfrac(i,j,iblk) & ! for history + + snowfracn(i,j,n,iblk)*aicen(i,j,n,iblk) enddo enddo enddo @@ -383,8 +390,10 @@ subroutine coupling_prep (iblk) ! reduce fresh by fpond for coupling !----------------------------------------------------------------- - fpond(i,j,iblk) = fpond(i,j,iblk) * rhofresh/dt - fresh(i,j,iblk) = fresh(i,j,iblk) - fpond(i,j,iblk) + if (l_mpond_fresh) then + fpond(i,j,iblk) = fpond(i,j,iblk) * rhofresh/dt + fresh(i,j,iblk) = fresh(i,j,iblk) - fpond(i,j,iblk) + endif !---------------------------------------------------------------- ! Store grid box mean albedos and fluxes before scaling by aice diff --git a/cice/drivers/cesm/ice_comp_esmf.F90 b/cice/drivers/cesm/ice_comp_esmf.F90 index a91cbd3..27d6526 100644 --- a/cice/drivers/cesm/ice_comp_esmf.F90 +++ b/cice/drivers/cesm/ice_comp_esmf.F90 @@ -48,7 +48,7 @@ module ice_comp_esmf use ice_constants, only : c0, c1, spval_dbl, rad_to_deg, radius, secday use ice_communicate, only : my_task, master_task, MPI_COMM_ICE use ice_calendar, only : istep, istep1, force_restart_now, write_ic,& - idate, mday, time, month, daycal, & + idate, idate0, mday, time, month, daycal, & sec, dt, dt_dyn, calendar, & calendar_type, nextsw_cday, days_per_year, & nyr, new_year, time2sec, year_init @@ -354,7 +354,9 @@ subroutine ice_init_esmf(comp, import_state, export_state, EClock, rc) write(nu_diag,*) trim(subname)//' resetting idate to match sync clock' end if - idate = curr_ymd - (year_init*10000) ! adjust for year_init + idate0 = curr_ymd + idate = curr_ymd + if (idate < 0) then write(nu_diag,*) trim(subname),' ERROR curr_ymd,year_init =',curr_ymd,year_init write(nu_diag,*) trim(subname),' ERROR idate lt zero',idate diff --git a/cice/drivers/cesm/ice_comp_mct.F90 b/cice/drivers/cesm/ice_comp_mct.F90 index e339c26..5ca9340 100644 --- a/cice/drivers/cesm/ice_comp_mct.F90 +++ b/cice/drivers/cesm/ice_comp_mct.F90 @@ -45,7 +45,7 @@ module ice_comp_mct use ice_constants, only : c0, c1, spval_dbl, rad_to_deg, radius, secday use ice_communicate, only : my_task, master_task, MPI_COMM_ICE use ice_calendar, only : istep, istep1, force_restart_now, write_ic,& - idate, mday, time, month, daycal, & + idate, idate0, mday, time, month, daycal, & sec, dt, dt_dyn, calendar, & calendar_type, nextsw_cday, days_per_year, & nyr, new_year, time2sec, year_init @@ -291,7 +291,9 @@ subroutine ice_init_mct( EClock, cdata_i, x2i_i, i2x_i, NLFilename ) trim(subname),' resetting idate to match sync clock' end if - idate = curr_ymd - (year_init*10000) ! adjust for year_init + idate0 = curr_ymd + idate = curr_ymd + if (idate < 0) then write(nu_diag,*) trim(subname),' ERROR curr_ymd,year_init =',curr_ymd,year_init write(nu_diag,*) trim(subname),' ERROR idate lt zero',idate @@ -789,6 +791,7 @@ subroutine ice_domain_mct( lsize, gsMap_i, dom_i ) allocate(work_dom(lsize)) work_dom(:) = 0.0_dbl_kind + data(:) = -9999.0_R8 n=0 do iblk = 1, nblocks this_block = get_block(blocks_ice(iblk),iblk) @@ -806,6 +809,7 @@ subroutine ice_domain_mct( lsize, gsMap_i, dom_i ) enddo !iblk call mct_gGrid_importRattr(dom_i,"lon",data,lsize) + data(:) = -9999.0_R8 n=0 do iblk = 1, nblocks this_block = get_block(blocks_ice(iblk),iblk) @@ -823,6 +827,7 @@ subroutine ice_domain_mct( lsize, gsMap_i, dom_i ) enddo !iblk call mct_gGrid_importRattr(dom_i,"lat",data,lsize) + data(:) = -9999.0_R8 n=0 do iblk = 1, nblocks this_block = get_block(blocks_ice(iblk),iblk) @@ -840,6 +845,7 @@ subroutine ice_domain_mct( lsize, gsMap_i, dom_i ) enddo !iblk call mct_gGrid_importRattr(dom_i,"area",data,lsize) + data(:) = 0.0_R8 n=0 do iblk = 1, nblocks this_block = get_block(blocks_ice(iblk),iblk) @@ -857,6 +863,7 @@ subroutine ice_domain_mct( lsize, gsMap_i, dom_i ) enddo !iblk call mct_gGrid_importRattr(dom_i,"mask",data,lsize) + data(:) = 0.0_R8 n=0 do iblk = 1, nblocks this_block = get_block(blocks_ice(iblk),iblk) diff --git a/cice/drivers/cice/CICE_RunMod.F90 b/cice/drivers/cice/CICE_RunMod.F90 index e78db85..663617d 100644 --- a/cice/drivers/cice/CICE_RunMod.F90 +++ b/cice/drivers/cice/CICE_RunMod.F90 @@ -279,11 +279,11 @@ subroutine coupling_prep (iblk) fswthru_ai, fhocn, fswthru, scale_factor, & swvdr, swidr, swvdf, swidf, Tf, Tair, Qa, strairxT, strairyt, & fsens, flat, fswabs, flwout, evap, Tref, Qref, faero_ocn, & - fsurfn_f, flatn_f, scale_fluxes, frzmlt_init, frzmlt + fsurfn_f, flatn_f, scale_fluxes, frzmlt_init, frzmlt, snowfrac use ice_grid, only: tmask use ice_ocean, only: oceanmixed_ice, ocean_mixed_layer use ice_shortwave, only: alvdfn, alidfn, alvdrn, alidrn, & - albicen, albsnon, albpndn, apeffn + albicen, albsnon, albpndn, apeffn, snowfracn use ice_state, only: aicen, aice, aice_init, nbtrcr use ice_therm_shared, only: calc_Tsfc use ice_timers, only: timer_couple, ice_timer_start, ice_timer_stop @@ -299,7 +299,9 @@ subroutine coupling_prep (iblk) i,j , & ! horizontal indices k ! tracer index - real (kind=dbl_kind) :: cszn ! counter for history averaging + real (kind=dbl_kind) :: & + cszn , & ! counter for history averaging + netsw ! flag for shortwave radiation presence !----------------------------------------------------------------- ! Save current value of frzmlt for diagnostics. @@ -332,10 +334,12 @@ subroutine coupling_prep (iblk) albsno(i,j,iblk) = c0 albpnd(i,j,iblk) = c0 apeff_ai(i,j,iblk) = c0 + snowfrac(i,j,iblk) = c0 ! for history averaging cszn = c0 - if (coszen(i,j,iblk) > puny) cszn = c1 + netsw = swvdr(i,j,iblk)+swidr(i,j,iblk)+swvdf(i,j,iblk)+swidf(i,j,iblk) + if (netsw > puny) cszn = c1 do n = 1, nstreams albcnt(i,j,iblk,n) = albcnt(i,j,iblk,n) + cszn enddo @@ -364,6 +368,8 @@ subroutine coupling_prep (iblk) apeff_ai(i,j,iblk) = apeff_ai(i,j,iblk) & ! for history + apeffn(i,j,n,iblk)*aicen(i,j,n,iblk) + snowfrac(i,j,iblk) = snowfrac(i,j,iblk) & ! for history + + snowfracn(i,j,n,iblk)*aicen(i,j,n,iblk) enddo enddo enddo diff --git a/cice/drivers/cice/CICE_RunMod.F90_debug b/cice/drivers/cice/CICE_RunMod.F90_debug index 0ddeffe..23219e3 100644 --- a/cice/drivers/cice/CICE_RunMod.F90_debug +++ b/cice/drivers/cice/CICE_RunMod.F90_debug @@ -312,11 +312,11 @@ fswthru_ai, fhocn, fswthru, scale_factor, & swvdr, swidr, swvdf, swidf, Tf, Tair, Qa, strairxT, strairyt, & fsens, flat, fswabs, flwout, evap, Tref, Qref, faero_ocn, & - fsurfn_f, flatn_f, scale_fluxes, frzmlt_init, frzmlt + fsurfn_f, flatn_f, scale_fluxes, frzmlt_init, frzmlt, snowfrac use ice_grid, only: tmask use ice_ocean, only: oceanmixed_ice, ocean_mixed_layer use ice_shortwave, only: alvdfn, alidfn, alvdrn, alidrn, & - albicen, albsnon, albpndn, apeffn + albicen, albsnon, albpndn, apeffn, snowfracn use ice_state, only: aicen, aice, aice_init, nbtrcr use ice_therm_shared, only: calc_Tsfc use ice_timers, only: timer_couple, ice_timer_start, ice_timer_stop @@ -332,7 +332,9 @@ i,j , & ! horizontal indices k ! tracer index - real (kind=dbl_kind) :: cszn ! counter for history averaging + real (kind=dbl_kind) :: & + cszn , & ! counter for history averaging + netsw ! flag for shortwave radiation presence !----------------------------------------------------------------- ! Save current value of frzmlt for diagnostics. @@ -365,10 +367,12 @@ albsno(i,j,iblk) = c0 albpnd(i,j,iblk) = c0 apeff_ai(i,j,iblk) = c0 + snowfrac(i,j,iblk) = c0 ! for history averaging cszn = c0 - if (coszen(i,j,iblk) > puny) cszn = c1 + netsw = swvdr(i,j,iblk)+swidr(i,j,iblk)+swvdf(i,j,iblk)+swidf(i,j,iblk) + if (netsw > puny) cszn = c1 do n = 1, nstreams albcnt(i,j,iblk,n) = albcnt(i,j,iblk,n) + cszn enddo @@ -397,6 +401,8 @@ apeff_ai(i,j,iblk) = apeff_ai(i,j,iblk) & ! for history + apeffn(i,j,n,iblk)*aicen(i,j,n,iblk) + snowfrac(i,j,iblk) = snowfrac(i,j,iblk) & ! for history + + snowfracn(i,j,n,iblk)*aicen(i,j,n,iblk) enddo enddo enddo diff --git a/cice/drivers/hadgem3/CICE_RunMod.F90 b/cice/drivers/hadgem3/CICE_RunMod.F90 index 744f9d6..39453c9 100644 --- a/cice/drivers/hadgem3/CICE_RunMod.F90 +++ b/cice/drivers/hadgem3/CICE_RunMod.F90 @@ -286,11 +286,11 @@ subroutine coupling_prep (iblk) fswthru_ai, fhocn, fswthru, scale_factor, & swvdr, swidr, swvdf, swidf, Tf, Tair, Qa, strairxT, strairyt, & fsens, flat, fswabs, flwout, evap, Tref, Qref, faero_ocn, & - fsurfn_f, flatn_f, scale_fluxes, frzmlt_init, frzmlt + fsurfn_f, flatn_f, scale_fluxes, frzmlt_init, frzmlt, snowfrac use ice_grid, only: tmask use ice_ocean, only: oceanmixed_ice, ocean_mixed_layer use ice_shortwave, only: alvdfn, alidfn, alvdrn, alidrn, & - albicen, albsnon, albpndn, apeffn + albicen, albsnon, albpndn, apeffn, snowfracn use ice_state, only: aicen, aice, aice_init, nbtrcr use ice_therm_shared, only: calc_Tsfc use ice_timers, only: timer_couple, ice_timer_start, ice_timer_stop @@ -309,7 +309,9 @@ subroutine coupling_prep (iblk) k , & ! tracer index ilo,ihi,jlo,jhi ! beginning and end of physical domain - real (kind=dbl_kind) :: cszn ! counter for history averaging + real (kind=dbl_kind) :: & + cszn , & ! counter for history averaging + netsw ! flag for shortwave radiation presence !----------------------------------------------------------------- ! Save current value of frzmlt for diagnostics. @@ -342,10 +344,12 @@ subroutine coupling_prep (iblk) albsno(i,j,iblk) = c0 albpnd(i,j,iblk) = c0 apeff_ai(i,j,iblk) = c0 + snowfrac(i,j,iblk) = c0 ! for history averaging cszn = c0 - if (coszen(i,j,iblk) > puny) cszn = c1 + netsw = swvdr(i,j,iblk)+swidr(i,j,iblk)+swvdf(i,j,iblk)+swidf(i,j,iblk) + if (netsw > puny) cszn = c1 do n = 1, nstreams albcnt(i,j,iblk,n) = albcnt(i,j,iblk,n) + cszn enddo @@ -374,6 +378,8 @@ subroutine coupling_prep (iblk) apeff_ai(i,j,iblk) = apeff_ai(i,j,iblk) & ! for history + apeffn(i,j,n,iblk)*aicen(i,j,n,iblk) + snowfrac(i,j,iblk) = snowfrac(i,j,iblk) & ! for history + + snowfracn(i,j,n,iblk)*aicen(i,j,n,iblk) enddo enddo enddo diff --git a/cice/input_templates/col/ice_in b/cice/input_templates/col/ice_in index 8c57b15..88c76fa 100644 --- a/cice/input_templates/col/ice_in +++ b/cice/input_templates/col/ice_in @@ -207,6 +207,7 @@ , f_vatm = 'm' , f_fswdn = 'm' , f_flwdn = 'm' + , f_snowfrac = 'x' , f_snow = 'x' , f_snow_ai = 'm' , f_rain = 'x' @@ -225,6 +226,10 @@ , f_alidr = 'x' , f_alvdf = 'x' , f_alidf = 'x' + , f_alvdr_ai = 'x' + , f_alidr_ai = 'x' + , f_alvdf_ai = 'x' + , f_alidf_ai = 'x' , f_albice = 'x' , f_albsno = 'x' , f_albpnd = 'x' @@ -233,6 +238,7 @@ , f_flat_ai = 'm' , f_fsens = 'x' , f_fsens_ai = 'm' + , f_fswup = 'x' , f_flwup = 'x' , f_flwup_ai = 'm' , f_evap = 'x' @@ -291,6 +297,7 @@ , f_aicen = 'm' , f_vicen = 'm' , f_vsnon = 'x' + , f_snowfracn = 'x' , f_keffn_top = 'x' , f_Tinz = 'm' , f_Sinz = 'm' diff --git a/cice/input_templates/gx1/ice_in b/cice/input_templates/gx1/ice_in index 208dbde..fbe83d7 100644 --- a/cice/input_templates/gx1/ice_in +++ b/cice/input_templates/gx1/ice_in @@ -207,6 +207,7 @@ , f_vatm = 'm' , f_fswdn = 'm' , f_flwdn = 'm' + , f_snowfrac = 'x' , f_snow = 'x' , f_snow_ai = 'm' , f_rain = 'x' @@ -225,6 +226,10 @@ , f_alidr = 'x' , f_alvdf = 'x' , f_alidf = 'x' + , f_alvdr_ai = 'x' + , f_alidr_ai = 'x' + , f_alvdf_ai = 'x' + , f_alidf_ai = 'x' , f_albice = 'x' , f_albsno = 'x' , f_albpnd = 'x' @@ -233,6 +238,7 @@ , f_flat_ai = 'm' , f_fsens = 'x' , f_fsens_ai = 'm' + , f_fswup = 'x' , f_flwup = 'x' , f_flwup_ai = 'm' , f_evap = 'x' @@ -291,6 +297,7 @@ , f_aicen = 'x' , f_vicen = 'x' , f_vsnon = 'x' + , f_snowfracn = 'x' , f_keffn_top = 'x' , f_Tinz = 'x' , f_Sinz = 'x' diff --git a/cice/input_templates/gx3/ice_in b/cice/input_templates/gx3/ice_in index adea168..6381fa3 100644 --- a/cice/input_templates/gx3/ice_in +++ b/cice/input_templates/gx3/ice_in @@ -207,6 +207,7 @@ , f_vatm = 'm' , f_fswdn = 'm' , f_flwdn = 'm' + , f_snowfrac = 'x' , f_snow = 'x' , f_snow_ai = 'm' , f_rain = 'x' @@ -225,6 +226,10 @@ , f_alidr = 'x' , f_alvdf = 'x' , f_alidf = 'x' + , f_alvdr_ai = 'x' + , f_alidr_ai = 'x' + , f_alvdf_ai = 'x' + , f_alidf_ai = 'x' , f_albice = 'x' , f_albsno = 'x' , f_albpnd = 'x' @@ -233,6 +238,7 @@ , f_flat_ai = 'm' , f_fsens = 'x' , f_fsens_ai = 'm' + , f_fswup = 'x' , f_flwup = 'x' , f_flwup_ai = 'm' , f_evap = 'x' @@ -291,6 +297,7 @@ , f_aicen = 'x' , f_vicen = 'x' , f_vsnon = 'x' + , f_snowfracn = 'x' , f_keffn_top = 'x' , f_Tinz = 'x' , f_Sinz = 'x' diff --git a/cice/io_pio/ice_history_write.F90 b/cice/io_pio/ice_history_write.F90 index 52c874b..2c43d7d 100644 --- a/cice/io_pio/ice_history_write.F90 +++ b/cice/io_pio/ice_history_write.F90 @@ -43,7 +43,7 @@ subroutine ice_write_hist (ns) use ice_blocks, only: nx_block, ny_block use ice_broadcast, only: broadcast_scalar use ice_calendar, only: time, sec, idate, idate0, write_ic, & - histfreq, dayyr, days_per_year, use_leap_years + histfreq, histfreq_n, dayyr, days_per_year, use_leap_years use ice_communicate, only: my_task, master_task use ice_constants, only: c0, c360, secday, spval, spval_dbl, rad_to_deg use ice_domain, only: distrb_info, nblocks @@ -78,6 +78,7 @@ subroutine ice_write_hist (ns) integer (kind=int_kind), dimension(4) :: dimidex real (kind=real_kind) :: ltime character (char_len) :: title + character (char_len) :: time_period_freq character (char_len_long) :: ncfile(max_nstrm) integer (kind=int_kind) :: iyear, imonth, iday @@ -90,7 +91,7 @@ subroutine ice_write_hist (ns) type(file_desc_t) :: File type(io_desc_t) :: iodesc2d, & iodesc3dc, iodesc3dv, iodesc3di, iodesc3db, & - iodesc4di + iodesc4di, iodesc4ds type(var_desc_t) :: varid ! 4 coordinate variables: TLON, TLAT, ULON, ULAT @@ -156,10 +157,11 @@ subroutine ice_write_hist (ns) call ice_pio_initdecomp(iodesc=iodesc2d) call ice_pio_initdecomp(ndim3=ncat_hist, iodesc=iodesc3dc) - call ice_pio_initdecomp(ndim3=nzlyr, iodesc=iodesc3di) + call ice_pio_initdecomp(ndim3=nzilyr, iodesc=iodesc3di) call ice_pio_initdecomp(ndim3=nzlyrb, iodesc=iodesc3db) call ice_pio_initdecomp(ndim3=nverts, inner_dim=.true., iodesc=iodesc3dv) - call ice_pio_initdecomp(ndim3=nzlyr, ndim4=ncat_hist, iodesc=iodesc4di) + call ice_pio_initdecomp(ndim3=nzilyr, ndim4=ncat_hist, iodesc=iodesc4di) + call ice_pio_initdecomp(ndim3=nzslyr, ndim4=ncat_hist, iodesc=iodesc4ds) ! ltime = time/int(secday) ltime = real(time/int(secday),kind=real_kind) @@ -684,6 +686,21 @@ subroutine ice_write_hist (ns) title = 'Los Alamos Sea Ice Model (CICE) Version 5' status = pio_put_att(File,pio_global,'source',trim(title)) + select case (histfreq(ns)) + case ("y", "Y") + write(time_period_freq,'(a,i0)') 'year_',histfreq_n(ns) + case ("m", "M") + write(time_period_freq,'(a,i0)') 'month_',histfreq_n(ns) + case ("d", "D") + write(time_period_freq,'(a,i0)') 'day_',histfreq_n(ns) + case ("h", "H") + write(time_period_freq,'(a,i0)') 'hour_',histfreq_n(ns) + case ("1") + write(time_period_freq,'(a,i0)') 'step_',histfreq_n(ns) + end select + + status = pio_put_att(File,pio_global,'time_period_freq',trim(time_period_freq)) + if (use_leap_years) then write(title,'(a,i3,a)') 'This year has ',int(dayyr),' days' else @@ -701,7 +718,11 @@ subroutine ice_write_hist (ns) status = & pio_put_att(File,pio_global,'conventions',trim(title)) - call date_and_time(date=current_date, time=current_time) + if (my_task == master_task) then + call date_and_time(date=current_date, time=current_time) + endif + call broadcast_scalar(current_date, master_task) + call broadcast_scalar(current_time, master_task) write(start_time,1000) current_date(1:4), current_date(5:6), & current_date(7:8), current_time(1:2), & current_time(3:4) @@ -902,7 +923,7 @@ subroutine ice_write_hist (ns) deallocate(workr3) ! 3D (vertical ice) - allocate(workr3(nx_block,ny_block,nblocks,nzlyr)) + allocate(workr3(nx_block,ny_block,nblocks,nzilyr)) do n = n3Dccum+1, n3Dzcum nn = n - n3Dccum if (avail_hist_fields(n)%vhistfreq == histfreq(ns) .or. write_ic) then @@ -910,7 +931,7 @@ subroutine ice_write_hist (ns) if (status /= pio_noerr) call abort_ice( & 'ice: Error getting varid for '//avail_hist_fields(n)%vname) do j = 1, nblocks - do i = 1, nzlyr + do i = 1, nzilyr workr3(:,:,j,i) = a3Dz(:,:,i,nn,j) enddo enddo @@ -941,7 +962,7 @@ subroutine ice_write_hist (ns) enddo ! num_avail_hist_fields_3Db deallocate(workr3) - allocate(workr4(nx_block,ny_block,nblocks,ncat_hist,nzlyr)) + allocate(workr4(nx_block,ny_block,nblocks,ncat_hist,nzilyr)) ! 4D (categories, vertical ice) do n = n3Dbcum+1, n4Dicum nn = n - n3Dbcum @@ -963,7 +984,28 @@ subroutine ice_write_hist (ns) enddo ! num_avail_hist_fields_4Di deallocate(workr4) -! similarly for num_avail_hist_fields_4Ds (define workr4s, iodesc4ds) + allocate(workr4(nx_block,ny_block,nblocks,ncat_hist,nzslyr)) + ! 4D (categories, vertical ice) + do n = n4Dicum+1, n4Dscum + nn = n - n4Dicum + 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( & + 'ice: Error getting varid for '//avail_hist_fields(n)%vname) + do j = 1, nblocks + do i = 1, ncat_hist + do k = 1, nzslyr + 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_write_darray(File, varid, iodesc4ds,& + workr4, status, fillval=spval_dbl) + endif + enddo ! num_avail_hist_fields_4Ds + deallocate(workr4) + ! similarly for num_avail_hist_fields_4Db (define workr4b, iodesc4db) diff --git a/cice/mpi/ice_boundary.F90 b/cice/mpi/ice_boundary.F90 index 64ed130..da2ee9c 100644 --- a/cice/mpi/ice_boundary.F90 +++ b/cice/mpi/ice_boundary.F90 @@ -36,7 +36,6 @@ module ice_boundary implicit none private - save include 'mpif.h' diff --git a/cice/mpi/ice_global_reductions.F90 b/cice/mpi/ice_global_reductions.F90 index feaf681..8123763 100644 --- a/cice/mpi/ice_global_reductions.F90 +++ b/cice/mpi/ice_global_reductions.F90 @@ -24,7 +24,6 @@ module ice_global_reductions implicit none private - save include 'mpif.h' diff --git a/cice/source/ice_aerosol.F90 b/cice/source/ice_aerosol.F90 index 44f1bca..7288c35 100644 --- a/cice/source/ice_aerosol.F90 +++ b/cice/source/ice_aerosol.F90 @@ -280,23 +280,18 @@ subroutine update_aerosol (nx_block, ny_block, & ar = c1/aicen(i,j) hs = vsnon(i,j)*ar hi = vicen(i,j)*ar - dhs_melts = -melts(i,j)*ar - dhi_snoice = snoice(i,j)*ar - dhs_snoice = dhi_snoice*rhoi/rhos - dhi_meltt = -meltt(i,j)*ar - dhi_meltb = -meltb(i,j)*ar - dhi_congel = congel(i,j)*ar else ! ice disappeared during time step hs = vsnon(i,j)/aice_old(i,j) hi = vicen(i,j)/aice_old(i,j) - dhs_melts = -melts(i,j)/aice_old(i,j) - dhi_snoice = snoice(i,j)/aice_old(i,j) - dhs_snoice = dhi_snoice*rhoi/rhos - dhi_meltt = -meltt(i,j)/aice_old(i,j) - dhi_meltb = -meltb(i,j)/aice_old(i,j) - dhi_congel = congel(i,j)/aice_old(i,j) endif + dhs_melts = -melts(i,j) + dhi_snoice = snoice(i,j) + dhs_snoice = dhi_snoice*rhoi/rhos + dhi_meltt = -meltt(i,j) + dhi_meltb = -meltb(i,j) + dhi_congel = congel(i,j) + dhs_evap = hs - (hs_old + dhs_melts - dhs_snoice & + fsnow(i,j)/rhos*dt) dhi_evap = hi - (hi_old + dhi_meltt + dhi_meltb & diff --git a/cice/source/ice_calendar.F90 b/cice/source/ice_calendar.F90 index 167d050..a6d2e9d 100644 --- a/cice/source/ice_calendar.F90 +++ b/cice/source/ice_calendar.F90 @@ -232,8 +232,10 @@ subroutine calendar(ttime) idate = (nyr+year_init-1)*10000 + month*100 + mday ! date (yyyymmdd) +#ifndef CCSMCOUPLED if (istep >= npt+1) stop_now = 1 if (istep == npt .and. dump_last) write_restart = 1 ! last timestep +#endif if (nyr /= nyrp) new_year = .true. if (month /= monthp) new_month = .true. if (mday /= mdayp) new_day = .true. diff --git a/cice/source/ice_diagnostics.F90 b/cice/source/ice_diagnostics.F90 index 7cb8d9a..c51f9e6 100644 --- a/cice/source/ice_diagnostics.F90 +++ b/cice/source/ice_diagnostics.F90 @@ -269,7 +269,7 @@ subroutine runtime_diags (dt) + alidr(i,j,iblk)*awtidr & + alvdf(i,j,iblk)*awtvdf & + alidf(i,j,iblk)*awtidf - if (coszen(i,j,iblk) > puny) then + if (work1(i,j,iblk) > puny) then work2(i,j,iblk) = tarean(i,j,iblk) else work2(i,j,iblk) = c0 @@ -294,7 +294,7 @@ subroutine runtime_diags (dt) do iblk = 1, nblocks do j = 1, ny_block do i = 1, nx_block - if (coszen(i,j,iblk) > puny) then + if (work1(i,j,iblk) > puny) then work2(i,j,iblk) = tareas(i,j,iblk) else work2(i,j,iblk) = c0 diff --git a/cice/source/ice_domain.F90 b/cice/source/ice_domain.F90 index f4f64d0..6fa155f 100644 --- a/cice/source/ice_domain.F90 +++ b/cice/source/ice_domain.F90 @@ -374,7 +374,7 @@ subroutine init_domain_distribution(KMTG,ULATG) !---------------------------------------------------------------------- if (distribution_wght == 'latitude') then - flat = NINT(abs(ULATG*rad_to_deg), int_kind) ! linear function + flat = NINT(abs(ULATG*rad_to_deg), int_kind) + 1 ! linear function else flat = 1 endif diff --git a/cice/source/ice_flux.F90 b/cice/source/ice_flux.F90 index 99c61ce..102043c 100644 --- a/cice/source/ice_flux.F90 +++ b/cice/source/ice_flux.F90 @@ -191,7 +191,8 @@ module ice_flux albice , & ! bare ice albedo albsno , & ! snow albedo albpnd , & ! melt pond albedo - apeff_ai ! effective pond area used for radiation calculation + apeff_ai , & ! effective pond area used for radiation calculation + snowfrac ! snow fraction used in radiation real (kind=dbl_kind), & dimension(nx_block,ny_block,max_blocks,max_nstrm), public :: & @@ -339,9 +340,15 @@ subroutine init_coupler_flux integer (kind=int_kind) :: n +#ifdef CCSMCOUPLED + logical (kind=log_kind), parameter :: & + l_winter = .false. , & ! winter/summer default switch + l_spring = .false. ! spring example +#else logical (kind=log_kind), parameter :: & l_winter = .true. , & ! winter/summer default switch l_spring = .false. ! spring example +#endif real (kind=dbl_kind) :: fcondtopn_d(6), fsurfn_d(6) @@ -591,6 +598,8 @@ subroutine init_history_therm albice (:,:,:) = c0 albsno (:,:,:) = c0 albpnd (:,:,:) = c0 + apeff_ai (:,:,:) = c0 + snowfrac (:,:,:) = c0 ! drag coefficients are computed prior to the atmo_boundary call, ! during the thermodynamics section diff --git a/cice/source/ice_history.F90 b/cice/source/ice_history.F90 index 8c3c6ed..729fb7f 100644 --- a/cice/source/ice_history.F90 +++ b/cice/source/ice_history.F90 @@ -203,6 +203,8 @@ subroutine init_hist (dt) ! call broadcast_scalar (f_example, master_task) call broadcast_scalar (f_hi, master_task) call broadcast_scalar (f_hs, master_task) + call broadcast_scalar (f_snowfrac, master_task) + call broadcast_scalar (f_snowfracn, master_task) call broadcast_scalar (f_Tsfc, master_task) call broadcast_scalar (f_aice, master_task) call broadcast_scalar (f_uvel, master_task) @@ -211,6 +213,7 @@ subroutine init_hist (dt) call broadcast_scalar (f_vatm, master_task) call broadcast_scalar (f_sice, master_task) call broadcast_scalar (f_fswdn, master_task) + call broadcast_scalar (f_fswup, master_task) call broadcast_scalar (f_flwdn, master_task) call broadcast_scalar (f_snow, master_task) call broadcast_scalar (f_snow_ai, master_task) @@ -230,6 +233,10 @@ subroutine init_hist (dt) call broadcast_scalar (f_alidr, master_task) call broadcast_scalar (f_alvdf, master_task) call broadcast_scalar (f_alidf, master_task) + call broadcast_scalar (f_alvdr_ai, master_task) + call broadcast_scalar (f_alidr_ai, master_task) + call broadcast_scalar (f_alvdf_ai, master_task) + call broadcast_scalar (f_alidf_ai, master_task) call broadcast_scalar (f_albice, master_task) call broadcast_scalar (f_albsno, master_task) call broadcast_scalar (f_albpnd, master_task) @@ -342,6 +349,11 @@ subroutine init_hist (dt) "snow volume per unit grid cell area", c1, c0, & ns1, f_hs) + call define_hist_field(n_snowfrac,"snowfrac","1",tstr2D, tcstr, & + "grid cell mean snow fraction", & + "snow fraction per unit grid cell area", c1, c0, & + ns1, f_snowfrac) + call define_hist_field(n_Tsfc,"Tsfc","C",tstr2D, tcstr, & "snow/ice surface temperature", & "averaged with Tf if no ice is present", c1, c0, & @@ -382,6 +394,11 @@ subroutine init_hist (dt) "positive downward", c1, c0, & ns1, f_fswdn) + call define_hist_field(n_fswup,"fswup","W/m^2",tstr2D, tcstr, & + "upward solar flux", & + "positive upward", c1, c0, & + ns1, f_fswup) + call define_hist_field(n_flwdn,"flwdn","W/m^2",tstr2D, tcstr, & "down longwave flux", & "positive downward", c1, c0, & @@ -452,11 +469,6 @@ subroutine init_hist (dt) "weighted by ice area", c1, c0, & ns1, f_fswabs_ai) -! call define_hist_field(n_albsni,"albsni","%",tstr2D, tcstr, & -! "snow/ice broad band albedo", & -! "scaled (divided) by aice", c100, c0, & -! ns1, f_albsni) - call define_hist_field(n_albsni,"albsni","%",tstr2D, tcstr, & "snow/ice broad band albedo", & "averaged for coszen>0, weighted by aice", c100, c0, & @@ -482,6 +494,26 @@ subroutine init_hist (dt) "scaled (divided) by aice", c100, c0, & ns1, f_alidf) + call define_hist_field(n_alvdr_ai,"alvdr_ai","%",tstr2D, tcstr, & + "visible direct albedo", & + " ", c100, c0, & + ns1, f_alvdr_ai) + + call define_hist_field(n_alidr_ai,"alidr_ai","%",tstr2D, tcstr, & + "near IR direct albedo", & + " ", c100, c0, & + ns1, f_alidr_ai) + + call define_hist_field(n_alvdf_ai,"alvdf_ai","%",tstr2D, tcstr, & + "visible diffuse albedo", & + " ", c100, c0, & + ns1, f_alvdf_ai) + + call define_hist_field(n_alidf_ai,"alidf_ai","%",tstr2D, tcstr, & + "near IR diffuse albedo", & + " ", c100, c0, & + ns1, f_alidf_ai) + call define_hist_field(n_albice,"albice","%",tstr2D, tcstr, & "bare ice albedo", & "averaged for coszen>0, weighted by aice", c100, c0, & @@ -892,6 +924,11 @@ subroutine init_hist (dt) "snow depth on ice, categories","volume per unit area of snow", c1, c0, & ns1, f_vsnon) + call define_hist_field(n_snowfracn,"snowfracn","1",tstr3Dc, tcstr, & + "category mean snow fraction", & + "snow fraction per unit grid cell area", c1, c0, & + ns1, f_snowfracn) + call define_hist_field(n_fsurfn_ai,"fsurfn_ai","W/m^2",tstr3Dc, tcstr, & "net surface heat flux, categories","weighted by ice area", c1, c0, & ns1, f_fsurfn_ai) @@ -989,10 +1026,6 @@ subroutine init_hist (dt) if (allocated(Tsnz4d)) deallocate(Tsnz4d) allocate(Tsnz4d(nx_block,ny_block,nzslyr,ncat_hist)) endif - if (f_Sinz (1:1) /= 'x') then - if (allocated(Sinz4d)) deallocate(Sinz4d) - allocate(Sinz4d(nx_block,ny_block,nzilyr,ncat_hist)) - endif ! other 4D history variables @@ -1116,8 +1149,9 @@ end subroutine init_hist subroutine accum_hist (dt) use ice_blocks, only: block, get_block, nx_block, ny_block + use ice_fileunits, only: nu_diag use ice_constants, only: c0, c1, p25, puny, secday, depressT, & - awtvdr, awtidr, awtvdf, awtidf, Lfresh, rhos, cp_ice, spval + awtvdr, awtidr, awtvdf, awtidf, Lfresh, rhos, cp_ice, spval, hs_min use ice_domain, only: blocks_ice, nblocks use ice_grid, only: tmask, lmask_n, lmask_s use ice_calendar, only: new_year, write_history, & @@ -1139,8 +1173,10 @@ subroutine accum_hist (dt) stressp_2, stressm_2, stress12_2, & stressp_3, stressm_3, stress12_3, & stressp_4, stressm_4, stress12_4, sig1, sig2, & - mlt_onset, frz_onset, dagedtt, dagedtd, fswint_ai, keffn_top + mlt_onset, frz_onset, dagedtt, dagedtd, fswint_ai, keffn_top, & + snowfrac, alvdr_ai, alvdf_ai, alidr_ai, alidf_ai use ice_atmo, only: formdrag + use ice_meltpond_cesm, only: hs0 use ice_history_shared ! almost everything use ice_history_write, only: ice_write_hist use ice_history_bgc, only: accum_hist_bgc @@ -1148,6 +1184,7 @@ subroutine accum_hist (dt) use ice_history_pond, only: accum_hist_pond use ice_history_drag, only: accum_hist_drag use ice_state ! almost everything + use ice_shortwave, only: snowfracn use ice_therm_shared, only: calculate_Tin_from_qin, Tmlt, ktherm use ice_therm_mushy, only: temperature_mush, temperature_snow use ice_timers, only: ice_timer_start, ice_timer_stop, timer_readwrite @@ -1170,6 +1207,7 @@ subroutine accum_hist (dt) real (kind=dbl_kind) :: & qn , & ! temporary variable for enthalpy + hs , & ! temporary variable for snow depth Tmlts ! temporary variable for melting temperature real (kind=dbl_kind), dimension (nx_block,ny_block) :: & @@ -1242,7 +1280,7 @@ subroutine accum_hist (dt) !--------------------------------------------------------------- !$OMP PARALLEL DO PRIVATE(iblk,i,j,ilo,ihi,jlo,jhi,this_block, & - !$OMP k,n,qn,ns,worka,workb) + !$OMP k,n,qn,ns,hs,worka,workb,Tinz4d,Sinz4d,Tsnz4d) do iblk = 1, nblocks this_block = get_block(blocks_ice(iblk),iblk) ilo = this_block%ilo @@ -1250,14 +1288,14 @@ subroutine accum_hist (dt) jlo = this_block%jlo jhi = this_block%jhi - workb(:,:) = aice_init(:,:,iblk) - ! if (f_example(1:1) /= 'x') & ! call accum_hist_field(n_example,iblk, vice(:,:,iblk), a2D) if (f_hi (1:1) /= 'x') & call accum_hist_field(n_hi, iblk, vice(:,:,iblk), a2D) if (f_hs (1:1) /= 'x') & call accum_hist_field(n_hs, iblk, vsno(:,:,iblk), a2D) + if (f_snowfrac(1:1) /= 'x') & + call accum_hist_field(n_snowfrac, iblk, snowfrac(:,:,iblk), a2D) if (f_Tsfc (1:1) /= 'x') & call accum_hist_field(n_Tsfc, iblk, trcr(:,:,nt_Tsfc,iblk), a2D) if (f_aice (1:1) /= 'x') & @@ -1286,6 +1324,12 @@ subroutine accum_hist (dt) if (f_fswdn (1:1) /= 'x') & call accum_hist_field(n_fswdn, iblk, fsw(:,:,iblk), a2D) + + workb(:,:) = aice_init(:,:,iblk) + + if (f_fswup(1:1) /= 'x') & + call accum_hist_field(n_fswup, iblk, & + (fsw(:,:,iblk)-fswabs(:,:,iblk)*workb(:,:)), a2D) if (f_flwdn (1:1) /= 'x') & call accum_hist_field(n_flwdn, iblk, flw(:,:,iblk), a2D) if (f_snow (1:1) /= 'x') & @@ -1324,11 +1368,7 @@ subroutine accum_hist (dt) (awtvdr*alvdr(:,:,iblk) & + awtidr*alidr(:,:,iblk) & + awtvdf*alvdf(:,:,iblk) & - + awtidf*alidf(:,:,iblk))*aice(:,:,iblk), a2D) -! awtvdr*alvdr(:,:,iblk) & -! + awtidr*alidr(:,:,iblk) & -! + awtvdf*alvdf(:,:,iblk) & -! + awtidf*alidf(:,:,iblk), a2D) + + awtidf*alidf(:,:,iblk))*workb(:,:), a2D) if (f_alvdr (1:1) /= 'x') & call accum_hist_field(n_alvdr, iblk, alvdr(:,:,iblk), a2D) if (f_alidr (1:1) /= 'x') & @@ -1337,6 +1377,14 @@ subroutine accum_hist (dt) call accum_hist_field(n_alvdf, iblk, alvdf(:,:,iblk), a2D) if (f_alidf (1:1) /= 'x') & call accum_hist_field(n_alidf, iblk, alidf(:,:,iblk), a2D) + if (f_alvdr_ai (1:1) /= 'x') & + call accum_hist_field(n_alvdr_ai, iblk, alvdr_ai(:,:,iblk), a2D) + if (f_alidr_ai (1:1) /= 'x') & + call accum_hist_field(n_alidr_ai, iblk, alidr_ai(:,:,iblk), a2D) + if (f_alvdf_ai (1:1) /= 'x') & + call accum_hist_field(n_alvdf_ai, iblk, alvdf_ai(:,:,iblk), a2D) + if (f_alidf_ai (1:1) /= 'x') & + call accum_hist_field(n_alidf_ai, iblk, alidf_ai(:,:,iblk), a2D) if (f_albice (1:1) /= 'x') & call accum_hist_field(n_albice, iblk, albice(:,:,iblk), a2D) @@ -1482,6 +1530,9 @@ subroutine accum_hist (dt) if (f_vsnon (1:1) /= 'x') & call accum_hist_field(n_vsnon-n2D, iblk, ncat_hist, & vsnon(:,:,1:ncat_hist,iblk), a3Dc) + if (f_snowfracn(1:1) /= 'x') & + call accum_hist_field(n_snowfracn-n2D, iblk, ncat_hist, & + snowfracn(:,:,1:ncat_hist,iblk), a3Dc) if (f_keffn_top (1:1) /= 'x') & call accum_hist_field(n_keffn_top-n2D, iblk, ncat_hist, & keffn_top(:,:,1:ncat_hist,iblk), a3Dc) @@ -1563,7 +1614,7 @@ subroutine accum_hist (dt) do i = ilo, ihi do k = 1, nzslyr qn = trcrn(i,j,nt_qsno+k-1,n,iblk) - Tsnz4d(i,j,k,n) = temperature_snow(trcrn(i,j,nt_qsno+k-1,n,iblk)) + Tsnz4d(i,j,k,n) = temperature_snow(qn) enddo enddo enddo @@ -1666,6 +1717,7 @@ subroutine accum_hist (dt) do i = ilo, ihi if (tmask(i,j,iblk)) then ravgctz = c0 + write(nu_diag,*) 'albcnt',albcnt(i,j,iblk,ns) if (albcnt(i,j,iblk,ns) > puny) & ravgctz = c1/albcnt(i,j,iblk,ns) if (f_albice (1:1) /= 'x' .and. n_albice(ns) /= 0) & @@ -1695,6 +1747,29 @@ subroutine accum_hist (dt) enddo ! i enddo ! j endif + if (avail_hist_fields(n)%vname(1:8) == 'alvdr_ai') then + do j = jlo, jhi + do i = ilo, ihi + if (tmask(i,j,iblk)) then + ravgctz = c0 + if (albcnt(i,j,iblk,ns) > puny) & + ravgctz = c1/albcnt(i,j,iblk,ns) + if (f_alvdr_ai (1:1) /= 'x' .and. n_alvdr_ai(ns) /= 0) & + a2D(i,j,n_alvdr_ai(ns),iblk) = & + a2D(i,j,n_alvdr_ai(ns),iblk)*avgct(ns)*ravgctz + if (f_alvdf_ai (1:1) /= 'x' .and. n_alvdf_ai(ns) /= 0) & + a2D(i,j,n_alvdf_ai(ns),iblk) = & + a2D(i,j,n_alvdf_ai(ns),iblk)*avgct(ns)*ravgctz + if (f_alidr_ai (1:1) /= 'x' .and. n_alidr_ai(ns) /= 0) & + a2D(i,j,n_alidr_ai(ns),iblk) = & + a2D(i,j,n_alidr_ai(ns),iblk)*avgct(ns)*ravgctz + if (f_alidf_ai (1:1) /= 'x' .and. n_alidf_ai(ns) /= 0) & + a2D(i,j,n_alidf_ai(ns),iblk) = & + a2D(i,j,n_alidf_ai(ns),iblk)*avgct(ns)*ravgctz + endif + enddo ! i + enddo ! j + endif endif enddo ! n diff --git a/cice/source/ice_history_pond.F90 b/cice/source/ice_history_pond.F90 index 1408c39..3b22ce2 100644 --- a/cice/source/ice_history_pond.F90 +++ b/cice/source/ice_history_pond.F90 @@ -136,7 +136,7 @@ subroutine init_hist_pond_2D call define_hist_field(n_apond_ai,"apond_ai","1",tstr2D, tcstr, & "melt pond fraction of grid cell", & "weighted by ice area", c1, c0, & - ns, f_apond) + ns, f_apond_ai) if (f_hpond(1:1) /= 'x') & call define_hist_field(n_hpond,"hpond","m",tstr2D, tcstr, & diff --git a/cice/source/ice_history_shared.F90 b/cice/source/ice_history_shared.F90 index 809f4ab..76d3b8b 100644 --- a/cice/source/ice_history_shared.F90 +++ b/cice/source/ice_history_shared.F90 @@ -144,10 +144,10 @@ module ice_history_shared ucstr = 'area: uarea' , & ! vcellmeas for U cell quantities tstr2D = 'TLON TLAT time' , & ! vcoord for T cell quantities, 2D ustr2D = 'ULON ULAT time' , & ! vcoord for U cell quantities, 2D - tstr3Dz = 'TLON TLAT VGRD time', & ! vcoord for T cell quantities, 3D - ustr3Dz = 'ULON ULAT VGRD time', & ! vcoord for U cell quantities, 3D - tstr3Dc = 'TLON TLAT NCAT time', & ! vcoord for T cell quantities, 3D - ustr3Dc = 'ULON ULAT NCAT time', & ! vcoord for U cell quantities, 3D + tstr3Dz = 'TLON TLAT VGRDi time', & ! vcoord for T cell quantities, 3D + ustr3Dz = 'ULON ULAT VGRDi time', & ! vcoord for U cell quantities, 3D + tstr3Dc = 'TLON TLAT NCAT time', & ! vcoord for T cell quantities, 3D + ustr3Dc = 'ULON ULAT NCAT time', & ! vcoord for U cell quantities, 3D tstr3Db = 'TLON TLAT VGRDb time', & ! vcoord for T cell quantities, 3D ustr3Db = 'ULON ULAT VGRDb time', & ! vcoord for U cell quantities, 3D @@ -184,10 +184,12 @@ module ice_history_shared character (len=max_nstrm), public :: & ! f_example = 'md', & f_hi = 'm', f_hs = 'm', & + f_snowfrac = 'x', f_snowfracn = 'x', & f_Tsfc = 'm', f_aice = 'm', & f_uvel = 'm', f_vvel = 'm', & f_uatm = 'm', f_vatm = 'm', & f_fswdn = 'm', f_flwdn = 'm', & + f_fswup = 'm', & f_snow = 'm', f_snow_ai = 'm', & f_rain = 'm', f_rain_ai = 'm', & f_sst = 'm', f_sss = 'm', & @@ -196,8 +198,10 @@ module ice_history_shared f_fswfac = 'm', f_fswint_ai = 'x', & f_fswabs = 'm', f_fswabs_ai = 'm', & f_albsni = 'm', & - f_alvdr = 'm', f_alidr = 'm', & - f_alvdf = 'm', f_alidf = 'm', & + f_alvdr = 'x', f_alidr = 'x', & + f_alvdf = 'x', f_alidf = 'x', & + f_alvdr_ai = 'm', f_alidr_ai = 'm', & + f_alvdf_ai = 'm', f_alidf_ai = 'm', & f_albice = 'm', f_albsno = 'm', & f_albpnd = 'm', f_coszen = 'm', & f_flat = 'm', f_flat_ai = 'm', & @@ -229,25 +233,25 @@ module ice_history_shared f_iage = 'm', f_FY = 'm', & f_hisnap = 'm', f_aisnap = 'm', & f_aicen = 'x', f_vicen = 'x', & - f_vsnon = 'x', & + f_vsnon = 'x', & f_trsig = 'm', f_icepresent = 'm', & f_fsurf_ai = 'm', f_fcondtop_ai= 'm', & f_fmeltt_ai = 'm', & f_fsurfn_ai = 'x' ,f_fcondtopn_ai='x', & f_fmelttn_ai= 'x', f_flatn_ai = 'x', & - f_fsensn_ai = 'x', & -! f_field3dz = 'x', & + f_fsensn_ai = 'x', & +! f_field3dz = 'x', & f_keffn_top = 'x', & f_Tinz = 'x', f_Sinz = 'x', & f_Tsnz = 'x', & f_a11 = 'x', f_a12 = 'x', & f_e11 = 'x', f_e12 = 'x', & - f_e22 = 'x', & + f_e22 = 'x', & f_s11 = 'x', f_s12 = 'x', & - f_s22 = 'x', & - f_yieldstress11 = 'x', & - f_yieldstress12 = 'x', & - f_yieldstress22 = 'x' + f_s22 = 'x', & + f_yieldstress11 = 'x', & + f_yieldstress12 = 'x', & + f_yieldstress22 = 'x' !--------------------------------------------------------------- ! namelist variables @@ -265,10 +269,12 @@ module ice_history_shared f_VGRDb , & ! f_example , & f_hi, f_hs , & + f_snowfrac, f_snowfracn, & f_Tsfc, f_aice , & f_uvel, f_vvel , & f_uatm, f_vatm , & f_fswdn, f_flwdn , & + f_fswup, & f_snow, f_snow_ai , & f_rain, f_rain_ai , & f_sst, f_sss , & @@ -276,16 +282,18 @@ module ice_history_shared f_sice, f_frzmlt , & f_fswfac, f_fswint_ai, & f_fswabs, f_fswabs_ai, & - f_albsni , & + f_albsni, & f_alvdr, f_alidr , & f_alvdf, f_alidf , & + f_alvdr_ai, f_alidr_ai , & + f_alvdf_ai, f_alidf_ai , & f_albice, f_albsno , & f_albpnd, f_coszen , & f_flat, f_flat_ai , & f_fsens, f_fsens_ai , & f_flwup, f_flwup_ai , & f_evap, f_evap_ai , & - f_Tair , & + f_Tair, & f_Tref, f_Qref , & f_congel, f_frazil , & f_snoice, f_dsnow , & @@ -310,24 +318,24 @@ module ice_history_shared f_iage, f_FY , & f_hisnap, f_aisnap , & f_aicen, f_vicen , & - f_vsnon, & + f_vsnon, & f_trsig, f_icepresent,& f_fsurf_ai, f_fcondtop_ai,& f_fmeltt_ai, & f_fsurfn_ai,f_fcondtopn_ai,& f_fmelttn_ai,f_flatn_ai, & - f_fsensn_ai, & + f_fsensn_ai, & ! f_field3dz, & f_keffn_top, & f_Tinz, f_Sinz, & - f_Tsnz, & - f_a11, f_a12 , & - f_e11, f_e12 , & - f_e22 , & - f_s11, f_s12 , & - f_s22 , & - f_yieldstress11 , & - f_yieldstress12 , & + f_Tsnz, & + f_a11, f_a12, & + f_e11, f_e12, & + f_e22, & + f_s11, f_s12, & + f_s22, & + f_yieldstress11, & + f_yieldstress12, & f_yieldstress22 !--------------------------------------------------------------- @@ -361,21 +369,25 @@ module ice_history_shared integer (kind=int_kind), dimension(max_nstrm), public :: & ! n_example , & n_hi , n_hs , & + n_snowfrac , n_snowfracn , & n_Tsfc , n_aice , & n_uvel , n_vvel , & n_uatm , n_vatm , & n_sice , & n_fswdn , n_flwdn , & + n_fswup , & n_snow , n_snow_ai , & n_rain , n_rain_ai , & n_sst , n_sss , & n_uocn , n_vocn , & n_frzmlt , n_fswfac , & - n_fswint_ai, & + n_fswint_ai , & n_fswabs , n_fswabs_ai , & n_albsni , & n_alvdr , n_alidr , & n_alvdf , n_alidf , & + n_alvdr_ai , n_alidr_ai , & + n_alvdf_ai , n_alidf_ai , & n_albice , n_albsno , & n_albpnd , n_coszen , & n_flat , n_flat_ai , & @@ -390,7 +402,7 @@ module ice_history_shared n_meltb , n_meltl , & n_fresh , n_fresh_ai , & n_fsalt , n_fsalt_ai , & - n_vsnon, & + n_vsnon , & n_fhocn , n_fhocn_ai , & n_fswthru , n_fswthru_ai , & n_strairx , n_strairy , & @@ -419,13 +431,13 @@ module ice_history_shared ! n_field3dz , & n_keffn_top , & n_Tinz , n_Sinz , & - n_Tsnz, & - n_a11 , n_a12 , & - n_e11 , n_e12 , & - n_e22 , & - n_s11 , n_s12 , & - n_s22 , & - n_yieldstress11, n_yieldstress12, & + n_Tsnz , & + n_a11 , n_a12 , & + n_e11 , n_e12 , & + n_e22 , & + n_s11 , n_s12 , & + n_s22 , & + n_yieldstress11, n_yieldstress12, & n_yieldstress22 interface accum_hist_field ! generic interface @@ -453,6 +465,7 @@ subroutine construct_filename(ncfile,suffix,ns) integer (kind=int_kind), intent(in) :: ns integer (kind=int_kind) :: iyear, imonth, iday, isec + character (len=1) :: cstream iyear = nyr + year_init - 1 ! set year_init=1 in ice_in to get iyear=nyr imonth = month @@ -484,28 +497,34 @@ subroutine construct_filename(ncfile,suffix,ns) endif endif + cstream = '' +!echmod ! this was implemented for CESM but it breaks post-processing software +!echmod ! of other groups (including RASM which uses CCSMCOUPLED) +!echmod if (ns > 1) write(cstream,'(i1.1)') ns-1 + if (histfreq(ns) == '1') then ! instantaneous, write every dt write(ncfile,'(a,a,i4.4,a,i2.2,a,i2.2,a,i5.5,a,a)') & - history_file(1:lenstr(history_file)),'_inst.', & + history_file(1:lenstr(history_file))//trim(cstream),'_inst.', & iyear,'-',imonth,'-',iday,'-',sec,'.',suffix elseif (hist_avg) then ! write averaged data if (histfreq(ns) == 'd'.or.histfreq(ns) == 'D') then ! daily write(ncfile,'(a,a,i4.4,a,i2.2,a,i2.2,a,a)') & - history_file(1:lenstr(history_file)), & + history_file(1:lenstr(history_file))//trim(cstream), & '.',iyear,'-',imonth,'-',iday,'.',suffix elseif (histfreq(ns) == 'h'.or.histfreq(ns) == 'H') then ! hourly write(ncfile,'(a,a,i2.2,a,i4.4,a,i2.2,a,i2.2,a,i5.5,a,a)') & - history_file(1:lenstr(history_file)),'_',histfreq_n(ns),'h.', & - iyear,'-',imonth,'-',iday,'-',sec,'.',suffix + history_file(1:lenstr(history_file))//trim(cstream),'_', & + histfreq_n(ns),'h.',iyear,'-',imonth,'-',iday,'-',sec,'.',suffix elseif (histfreq(ns) == 'm'.or.histfreq(ns) == 'M') then ! monthly write(ncfile,'(a,a,i4.4,a,i2.2,a,a)') & - history_file(1:lenstr(history_file)),'.', & + history_file(1:lenstr(history_file))//trim(cstream),'.', & iyear,'-',imonth,'.',suffix elseif (histfreq(ns) == 'y'.or.histfreq(ns) == 'Y') then ! yearly write(ncfile,'(a,a,i4.4,a,a)') & - history_file(1:lenstr(history_file)),'.', iyear,'.',suffix + history_file(1:lenstr(history_file))//trim(cstream),'.', & + iyear,'.',suffix endif else ! instantaneous with histfreq > dt @@ -576,7 +595,7 @@ subroutine define_hist_field(id, vname, vunit, vcoord, vcellmeas, & num_avail_hist_fields_2D = num_avail_hist_fields_2D + 1 elseif (vcoord(11:14) == 'NCAT' .and. vcoord(16:19) == 'time') then num_avail_hist_fields_3Dc = num_avail_hist_fields_3Dc + 1 - elseif (vcoord(11:15) == 'VGRDi' .and. vcoord(17:20) == 'time') then + elseif (vcoord(11:14) == 'VGRDi' .and. vcoord(16:19) == 'time') then num_avail_hist_fields_3Dz = num_avail_hist_fields_3Dz + 1 elseif (vcoord(11:15) == 'VGRDb' .and. vcoord(17:20) == 'time') then num_avail_hist_fields_3Db = num_avail_hist_fields_3Db + 1 diff --git a/cice/source/ice_init.F90 b/cice/source/ice_init.F90 index ad48473..aba38c7 100644 --- a/cice/source/ice_init.F90 +++ b/cice/source/ice_init.F90 @@ -1060,6 +1060,7 @@ subroutine input_data write(nu_diag,1020)'nt_qsno = ', nt_qsno write(nu_diag,*)' ' write(nu_diag,1020)'nilyr', nilyr + write(nu_diag,1020)'nslyr', nslyr write(nu_diag,*)' ' 1000 format (a30,2x,f9.2) ! a30 to align formatted, unformatted statements diff --git a/cice/source/ice_itd.F90 b/cice/source/ice_itd.F90 index 3357405..e80c269 100644 --- a/cice/source/ice_itd.F90 +++ b/cice/source/ice_itd.F90 @@ -151,7 +151,9 @@ subroutine init_itd hin_max(0) = c0 ! minimum ice thickness, m else ! delta function itd category limits +#ifndef CCSMCOUPLED hi_min = p1 ! minimum ice thickness allowed (m) for thermo +#endif cc1 = max(1.1_dbl_kind/rncat,c1*hi_min) cc2 = c25*cc1 cc3 = 2.25_dbl_kind @@ -445,7 +447,7 @@ subroutine aggregate (nx_block, ny_block, & call compute_tracers (nx_block, ny_block, & icells, indxi, indxj, & ntrcr, trcr_depend, & - atrcr(:,:), aice(:,:), & + atrcr, aice(:,:), & vice (:,:), vsno(:,:), & trcr(:,:,:)) diff --git a/cice/source/ice_restart_shared.F90 b/cice/source/ice_restart_shared.F90 index 93061f2..38bdf4b 100644 --- a/cice/source/ice_restart_shared.F90 +++ b/cice/source/ice_restart_shared.F90 @@ -14,10 +14,10 @@ module ice_restart_shared use_restart_time ! if true, use time written in core restart file character (len=char_len), public :: & - restart_file , & ! output file for restart dump runtype ! initial, continue, hybrid, branch character (len=char_len_long), public :: & + restart_file , & ! output file for restart dump restart_dir , & ! directory name for restart dump runid ! identifier for CESM coupled run or bering diff --git a/cice/source/ice_shortwave.F90 b/cice/source/ice_shortwave.F90 index 5d51418..3fc6d7b 100644 --- a/cice/source/ice_shortwave.F90 +++ b/cice/source/ice_shortwave.F90 @@ -103,6 +103,10 @@ module ice_shortwave public, save :: & fswpenln ! visible SW entering ice layers (W m-2) + real (kind=dbl_kind), dimension (nx_block,ny_block,ncat,max_blocks), & + public, save :: & + snowfracn ! Category snow fraction used in radiation + ! dEdd tuning parameters, set in namelist real (kind=dbl_kind), public :: & R_ice , & ! sea ice tuning parameter; +1 > 1sig increase in albedo @@ -121,7 +125,8 @@ module ice_shortwave hp0 = 0.200_dbl_kind ! pond depth below which transition to bare ice real (kind=dbl_kind) :: & - exp_min ! minimum exponential value + exp_min, & ! minimum exponential value + netsw !======================================================================= @@ -138,7 +143,8 @@ subroutine init_shortwave use ice_flux, only: alvdf, alidf, alvdr, alidr, & alvdr_ai, alidr_ai, alvdf_ai, alidf_ai, & swvdr, swvdf, swidr, swidf, & - albice, albsno, albpnd, apeff_ai, albcnt, coszen, fsnow + albice, albsno, albpnd, albcnt, coszen, fsnow, & + apeff_ai, snowfrac use ice_orbital, only: init_orbit use ice_state, only: aicen, vicen, vsnon, trcrn, nt_Tsfc use ice_blocks, only: block, get_block @@ -230,6 +236,7 @@ subroutine init_shortwave Sswabsn(:,:,:,:,iblk), Iswabsn(:,:,:,:,iblk), & albicen(:,:,:,iblk), albsnon(:,:,:,iblk), & albpndn(:,:,:,iblk), apeffn(:,:,:,iblk), & + snowfracn(:,:,:,iblk), & dhsn(:,:,:,iblk), ffracn(:,:,:,iblk), & initonly = .true. ) @@ -307,7 +314,8 @@ subroutine init_shortwave alidr(i,j,iblk) = alidr(i,j,iblk) & + alidrn(i,j,n,iblk)*aicen(i,j,n,iblk) - if (coszen(i,j,iblk) > puny) then ! sun above horizon + netsw = swvdr(i,j,iblk)+swidr(i,j,iblk)+swvdf(i,j,iblk)+swidf(i,j,iblk) + if (netsw > puny) then ! sun above horizon albice(i,j,iblk) = albice(i,j,iblk) & + albicen(i,j,n,iblk)*aicen(i,j,n,iblk) albsno(i,j,iblk) = albsno(i,j,iblk) & @@ -318,6 +326,8 @@ subroutine init_shortwave apeff_ai(i,j,iblk) = apeff_ai(i,j,iblk) & + apeffn(i,j,n,iblk)*aicen(i,j,n,iblk) + snowfrac(i,j,iblk) = snowfrac(i,j,iblk) & + + snowfracn(i,j,n,iblk)*aicen(i,j,n,iblk) enddo enddo ! ncat @@ -332,13 +342,6 @@ subroutine init_shortwave alidf_ai (i,j,iblk) = alidf (i,j,iblk) alvdr_ai (i,j,iblk) = alvdr (i,j,iblk) alidr_ai (i,j,iblk) = alidr (i,j,iblk) - - ! for history averaging - cszn = c0 - if (coszen(i,j,iblk) > puny) cszn = c1 - do n = 1, nstreams - albcnt(i,j,iblk,n) = albcnt(i,j,iblk,n) + cszn - enddo enddo enddo @@ -1087,6 +1090,7 @@ subroutine run_dEdd(ilo,ihi,jlo,jhi, & Sswabsn, Iswabsn, & albicen, albsnon, & albpndn, apeffn, & + snowfracn, & dhsn, ffracn, & initonly ) @@ -1140,7 +1144,8 @@ subroutine run_dEdd(ilo,ihi,jlo,jhi, & albicen, & ! albedo bare ice albsnon, & ! albedo snow albpndn, & ! albedo pond - apeffn ! effective pond area used for radiation calculation + apeffn, & ! effective pond area used for radiation calculation + snowfracn ! Snow fraction used in radiation real(kind=dbl_kind), dimension(nx_block,ny_block,nslyr,ncat), intent(inout) :: & Sswabsn ! SW radiation absorbed in snow layers (W m-2) @@ -1247,9 +1252,11 @@ subroutine run_dEdd(ilo,ihi,jlo,jhi, & trcrn(:,:,nt_Tsfc,n), fsn, hsn, & rhosnwn, rsnwn) + apeffn(:,:,n) = c0 ! for history + snowfracn(:,:,n) = c0 ! for history + ! set pond properties if (tr_pond_cesm) then - apeffn(:,:,n) = c0 ! for history do ij = 1, icells i = indxi(ij) j = indxj(ij) @@ -1268,7 +1275,6 @@ subroutine run_dEdd(ilo,ihi,jlo,jhi, & enddo elseif (tr_pond_lvl) then - apeffn(:,:,n) = c0 ! for history do ij = 1, icells i = indxi(ij) j = indxj(ij) @@ -1332,7 +1338,6 @@ subroutine run_dEdd(ilo,ihi,jlo,jhi, & enddo ! ij elseif (tr_pond_topo) then - apeffn(:,:,n) = c0 ! for history do ij = 1, icells i = indxi(ij) j = indxj(ij) @@ -1368,6 +1373,8 @@ subroutine run_dEdd(ilo,ihi,jlo,jhi, & hpn = c0 endif + snowfracn(:,:,n) = fsn(:,:) ! for history + call shortwave_dEdd(nx_block, ny_block, & ntrcr, icells, & indxi, indxj, & @@ -1455,7 +1462,6 @@ subroutine shortwave_dEdd (nx_block, ny_block, & real (kind=dbl_kind), dimension (nx_block,ny_block), & intent(in) :: & - coszen , & ! cosine of solar zenith angle aice , & ! concentration of ice vice , & ! volume of ice hs , & ! snow depth @@ -1481,6 +1487,7 @@ subroutine shortwave_dEdd (nx_block, ny_block, & real (kind=dbl_kind), dimension (nx_block,ny_block), & intent(inout) :: & + coszen , & ! cosine of solar zenith angle alvdr , & ! visible, direct, albedo (fraction) alvdf , & ! visible, diffuse, albedo (fraction) alidr , & ! near-ir, direct, albedo (fraction) @@ -1603,12 +1610,13 @@ subroutine shortwave_dEdd (nx_block, ny_block, & i = indxi(ij) j = indxj(ij) vsno = hs(i,j) * aice(i,j) - if (coszen(i,j) > puny) then ! sun above horizon + netsw = swvdr(i,j)+swidr(i,j)+swvdf(i,j)+swidf(i,j) + if (netsw > puny) then ! sun above horizon aero_mp(i,j,na ) = trcr(i,j,nt_aero-1+na )*vsno aero_mp(i,j,na+1) = trcr(i,j,nt_aero-1+na+1)*vsno aero_mp(i,j,na+2) = trcr(i,j,nt_aero-1+na+2)*vice(i,j) aero_mp(i,j,na+3) = trcr(i,j,nt_aero-1+na+3)*vice(i,j) - endif ! aice > 0 and coszen > 0 + endif ! aice > 0 and netsw > 0 enddo ! ij enddo ! na endif ! if aerosols @@ -1625,7 +1633,9 @@ subroutine shortwave_dEdd (nx_block, ny_block, & i = indxi(ij) j = indxj(ij) ! sea ice points with sun above horizon - if (coszen(i,j) > puny) then + netsw = swvdr(i,j)+swidr(i,j)+swvdf(i,j)+swidf(i,j) + if (netsw > puny) then + coszen(i,j) = max(puny,coszen(i,j)) ! evaluate sea ice thickness and fraction hi(i,j) = vice(i,j) / aice(i,j) fi(i,j) = c1 - fs(i,j) - fp(i,j) @@ -1636,7 +1646,7 @@ subroutine shortwave_dEdd (nx_block, ny_block, & indxj_DE(icells_DE) = j ! bare ice endif ! fi > 0 - endif ! coszen > 0 + endif ! netsw > 0 enddo ! ij ! calculate bare sea ice @@ -1678,7 +1688,9 @@ subroutine shortwave_dEdd (nx_block, ny_block, & i = indxi(ij) j = indxj(ij) ! sea ice points with sun above horizon - if (coszen(i,j) > puny) then + netsw = swvdr(i,j)+swidr(i,j)+swvdf(i,j)+swidf(i,j) + if (netsw > puny) then + coszen(i,j) = max(puny,coszen(i,j)) ! snow-covered sea ice points if(fs(i,j) > c0) then icells_DE = icells_DE + 1 @@ -1686,7 +1698,7 @@ subroutine shortwave_dEdd (nx_block, ny_block, & indxj_DE(icells_DE) = j ! snow-covered ice endif ! fs > 0 - endif ! coszen > 0 + endif ! netsw > 0 enddo ! ij ! calculate snow covered sea ice @@ -1729,7 +1741,9 @@ subroutine shortwave_dEdd (nx_block, ny_block, & j = indxj(ij) hi(i,j) = c0 ! sea ice points with sun above horizon - if (coszen(i,j) > puny) then + netsw = swvdr(i,j)+swidr(i,j)+swvdf(i,j)+swidf(i,j) + if (netsw > puny) then + coszen(i,j) = max(puny,coszen(i,j)) hi(i,j) = vice(i,j) / aice(i,j) ! if non-zero pond fraction and sufficient pond depth if( fp(i,j) > puny .and. hp(i,j) > hpmin ) then @@ -1738,7 +1752,7 @@ subroutine shortwave_dEdd (nx_block, ny_block, & indxj_DE(icells_DE) = j ! ponded ice endif - endif ! coszen > puny + endif ! netsw > puny enddo ! ij ! calculate ponded ice @@ -3033,7 +3047,6 @@ subroutine compute_dEdd & i = indxi_DE(ij) j = indxj_DE(ij) Iswabs(i,j,k) = Iswabs(i,j,k) + Iabs(ij,k)*fi(i,j) - ! bgc layer fswpenl(i,j,k) = fswpenl(i,j,k) + fthrul(ij,k)* fi(i,j) if (k == nilyr) then diff --git a/cice/source/ice_step_mod.F90 b/cice/source/ice_step_mod.F90 index 163a0cf..71c0959 100644 --- a/cice/source/ice_step_mod.F90 +++ b/cice/source/ice_step_mod.F90 @@ -1361,7 +1361,8 @@ subroutine step_radiation (dt, iblk) Sswabsn, Iswabsn, shortwave, & albicen, albsnon, albpndn, & alvdrn, alidrn, alvdfn, alidfn, & - run_dedd, shortwave_ccsm3, apeffn + run_dedd, shortwave_ccsm3, apeffn, & + snowfracn use ice_state, only: aicen, vicen, vsnon, trcrn, nt_Tsfc, & nt_apnd, nt_ipnd, nt_hpnd, tr_pond_topo use ice_timers, only: ice_timer_start, ice_timer_stop, timer_sw @@ -1428,6 +1429,7 @@ subroutine step_radiation (dt, iblk) Sswabsn(:,:,:,:,iblk), Iswabsn(:,:,:,:,iblk), & albicen(:,:,:,iblk), albsnon(:,:,:,iblk), & albpndn(:,:,:,iblk), apeffn(:,:,:,iblk), & + snowfracn(:,:,:,iblk), & dhsn(:,:,:,iblk), ffracn(:,:,:,iblk)) else ! .not. dEdd diff --git a/cice/source/ice_therm_bl99.F90 b/cice/source/ice_therm_bl99.F90 index a75cda4..f99973e 100644 --- a/cice/source/ice_therm_bl99.F90 +++ b/cice/source/ice_therm_bl99.F90 @@ -17,7 +17,6 @@ module ice_therm_bl99 use ice_constants use ice_fileunits, only: nu_diag use ice_therm_shared, only: conduct, calc_Tsfc, ferrmax, l_brine, hfrazilmin - implicit none save @@ -300,14 +299,20 @@ subroutine temperature_changes (nx_block, ny_block, & !----------------------------------------------------------------- !mclaren: Should there be an if calc_Tsfc statement here then?? - frac = 0.9 +#ifdef CCSMCOUPLED + frac = c1 + dTemp = p01 +#else + frac = 0.9_dbl_kind dTemp = 0.02_dbl_kind +#endif do k = 1, nilyr do ij = 1, icells i = indxi(ij) j = indxj(ij) Iswabs_tmp = c0 ! all Iswabs is moved into fswsfc + if (Tin_init(ij,k) <= Tmlts(ij,k) - dTemp) then if (l_brine) then ci = cp_ice - Lfresh * Tmlts(ij,k) / (Tin_init(ij,k)**2) @@ -330,6 +335,9 @@ subroutine temperature_changes (nx_block, ny_block, & enddo enddo +#ifdef CCSMCOUPLED + frac = 0.9_dbl_kind +#endif do k = 1, nslyr do ij = 1, icells if (l_snow(ij)) then