diff --git a/.gitmodules b/.gitmodules index 4297194eb..bf6fa93d7 100644 --- a/.gitmodules +++ b/.gitmodules @@ -8,8 +8,8 @@ branch = main [submodule "ccpp/physics"] path = ccpp/physics - url = https://github.com/HelinWei-NOAA/ccpp-physics - branch = flake.baseline + url = https://github.com/AnilKumar-NOAA/ccpp-physics + branch = new_flake_var [submodule "upp"] path = upp url = https://github.com/NOAA-EMC/UPP diff --git a/ccpp/data/GFS_typedefs.F90 b/ccpp/data/GFS_typedefs.F90 index 41741d236..6ec0ec7b9 100644 --- a/ccpp/data/GFS_typedefs.F90 +++ b/ccpp/data/GFS_typedefs.F90 @@ -356,8 +356,19 @@ module GFS_typedefs real (kind=kind_phys), pointer :: d_conv (:) => null() !< nst_fld%d_conv thickness of Free Convection Layer (FCL) real (kind=kind_phys), pointer :: ifd (:) => null() !< nst_fld%ifd index to start DTM run or not real (kind=kind_phys), pointer :: dt_cool(:) => null() !< nst_fld%dt_cool Sub layer cooling amount - real (kind=kind_phys), pointer :: qrain (:) => null() !< nst_fld%qrain sensible heat flux due to rainfall (watts) - + real (kind=kind_phys), pointer :: qrain (:) => null() !< nst_fld%qrain sensible heat flux due to rainfall (watts) + ! Flake model 10 variables + integer, pointer :: use_flake (:) => null()!Flag for flake + real (kind=kind_phys), pointer :: h_ML (:) => null() !< lake_model_option%h_ML - depth of lake mixing layer (m) + real (kind=kind_phys), pointer :: t_ML (:) => null() !< lake_model_option%t_ML - temperature of lake mixing layer(K) + real (kind=kind_phys), pointer :: t_mnw (:) => null() !< lake_model_option%t_mnw - thee mean temperature of the water column(K) + real (kind=kind_phys), pointer :: h_talb (:) => null() !< lake_model_option%h_talb - the depth of the thermally active layer of the bottom sediment(m) + real (kind=kind_phys), pointer :: t_talb (:) => null() !< lake_model_option%t_talb - the temperature at the bottom of the sediment upper layer (K) + real (kind=kind_phys), pointer :: t_bot1 (:) => null() !< lake_model_option%t_bot1 - the temperature at the water-bottom sediment interface (K) + real (kind=kind_phys), pointer :: t_bot2 (:) => null() !< lake_model_option%t_bot2 - the temperature at the lake bottom layer water (K) + real (kind=kind_phys), pointer :: c_t (:) => null() !< lake_model_option%c_t - the shape factor of water temperature vertical profile + real (kind=kind_phys), pointer :: T_snow (:) => null() !< lake_model_option%T_snow - temperature of snow on a lake(K) + real (kind=kind_phys), pointer :: T_ice (:) => null() !< lake_model_option%T_ice - temperature of ice on a lake(K) ! Soil properties for RUC LSM (number of levels different from NOAH 4-layer model) real (kind=kind_phys), pointer :: wetness(:) => null() !< normalized soil wetness for lsm real (kind=kind_phys), pointer :: sh2o(:,:) => null() !< volume fraction of unfrozen soil moisture for lsm @@ -961,7 +972,7 @@ module GFS_typedefs real(kind=kind_phys) :: sfenth !< enthalpy flux factor 0 zot via charnock ..>0 zot enhanced>15m/s !--- flake model parameters - integer :: lkm !< flag for flake model + integer :: lake_model_option !< flag for flake model !--- tuning parameters for physical parameterizations logical :: ras !< flag for ras convection scheme @@ -2283,6 +2294,31 @@ subroutine sfcprop_create (Sfcprop, IM, Model) Sfcprop%dt_cool = zero Sfcprop%qrain = zero endif +! Flake parameter allocation + allocate (Sfcprop%use_flake(IM)) + allocate (Sfcprop%h_ML (IM)) + allocate (Sfcprop%t_ML (IM)) + allocate (Sfcprop%t_mnw (IM)) + allocate (Sfcprop%h_talb (IM)) + allocate (Sfcprop%t_talb (IM)) + allocate (Sfcprop%t_bot1 (IM)) + allocate (Sfcprop%t_bot2 (IM)) + allocate (Sfcprop%c_t (IM)) + allocate (Sfcprop%T_snow (IM)) + allocate (Sfcprop%T_ice (IM)) + + Sfcprop%use_flake = clear_val + Sfcprop%h_ML = clear_val + Sfcprop%t_ML = clear_val + Sfcprop%t_mnw = clear_val + Sfcprop%h_talb = clear_val + Sfcprop%t_talb = clear_val + Sfcprop%t_bot1 = clear_val + Sfcprop%t_bot2 = clear_val + Sfcprop%c_t = clear_val + Sfcprop%T_snow = clear_val + Sfcprop%T_ice = clear_val + if (Model%lsm == Model%lsm_noah) then allocate (Sfcprop%xlaixy (IM)) allocate (Sfcprop%rca (IM)) @@ -3147,7 +3183,7 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & real(kind=kind_phys) :: sfenth = 0.0 !< enthalpy flux factor 0 zot via charnock ..>0 zot enhanced>15m/s !--- flake model parameters - integer :: lkm = 0 !< flag for flake model - default no flake + integer :: lake_model_option = 0 !< flag for flake model - default no flake !--- tuning parameters for physical parameterizations logical :: ras = .false. !< flag for ras convection scheme @@ -3516,7 +3552,7 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & ! GFDL surface layer options lcurr_sf, pert_cd, ntsflg, sfenth, & !--- lake model control - lkm, & + lake_model_option, & !--- physical parameterizations ras, trans_trac, old_monin, cnvgwd, mstrat, moist_adj, & cscnv, cal_pre, do_aw, do_shoc, shocaftcnv, shoc_cld, & @@ -4161,7 +4197,7 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & Model%sfenth = sfenth !--- flake model parameters - Model%lkm = lkm + Model%lake_model_option = lake_model_option ! Noah MP options from namelist ! @@ -5086,7 +5122,7 @@ subroutine control_initialize (Model, nlunit, fn_nml, me, master, & 'min_lake_height=',Model%min_lake_height print *, 'flake model parameters' - print *, 'lkm : ', Model%lkm + print *, 'lake_model_option : ', Model%lake_model_option if (Model%nstf_name(1) > 0 ) then print *,' NSSTM is active ' @@ -5941,7 +5977,7 @@ subroutine control_print(Model) print *, ' sfenth : ', Model%sfenth print *, ' ' print *, 'flake model parameters' - print *, 'lkm : ', Model%lkm + print *, 'lake_model_option : ', Model%lake_model_option print *, ' ' print *, 'tuning parameters for physical parameterizations' print *, ' ras : ', Model%ras diff --git a/ccpp/data/GFS_typedefs.meta b/ccpp/data/GFS_typedefs.meta index 42d5ef29e..e45f9df3c 100644 --- a/ccpp/data/GFS_typedefs.meta +++ b/ccpp/data/GFS_typedefs.meta @@ -4369,7 +4369,7 @@ dimensions = () type = real kind = kind_phys -[lkm] +[lake_model_option] standard_name = control_for_lake_surface_scheme long_name = flag for lake surface model units = flag diff --git a/io/FV3GFS_io.F90 b/io/FV3GFS_io.F90 index f480d179e..a622be5fe 100644 --- a/io/FV3GFS_io.F90 +++ b/io/FV3GFS_io.F90 @@ -204,6 +204,17 @@ subroutine FV3GFS_GFS_checksum (Model, GFS_Data, Atm_block) nsfcprop2d = nsfcprop2d + 16 endif +! Flake (lake_model_option - Control for flake surface schemes) + + if(Model%lake_model_option == 0 ) then ! lake_model_option = 0 (use flake model) + nsfcprop2d = nsfcprop2d + 10 + elseif (Model%lake_model_option == 1 ) then ! lake_model_option = 1 (use NSST flake model) + nsfcprop2d = nsfcprop2d + 10 + elseif (Model%lake_model_option == 2 ) then ! lake_model_option = 2 (use any other like ice lake model) + nsfcprop2d = nsfcprop2d + 10 ! what 10 variables need to be assigned to any other than 0 and 1 options schemes ) + endif + + allocate (temp2d(isc:iec,jsc:jec,nsfcprop2d+Model%ntot2d+Model%nctp)) allocate (temp3d(isc:iec,jsc:jec,1:lev,14+Model%ntot3d+2*ntr)) allocate (temp3dlevsp1(isc:iec,jsc:jec,1:lev+1,3)) @@ -432,6 +443,42 @@ subroutine FV3GFS_GFS_checksum (Model, GFS_Data, Atm_block) temp2d(i,j,idx_opt+13) = GFS_Data(nb)%Sfcprop%ifd(ix) temp2d(i,j,idx_opt+14) = GFS_Data(nb)%Sfcprop%dt_cool(ix) temp2d(i,j,idx_opt+15) = GFS_Data(nb)%Sfcprop%qrain(ix) + idx_opt = idx_opt + 15 + endif + + if (Model%lake_model_option == 0 ) then + temp2d(i,j,idx_opt+ 1) = GFS_Data(nb)%Sfcprop%h_ML(ix) + temp2d(i,j,idx_opt+ 2) = GFS_Data(nb)%Sfcprop%t_ML(ix) + temp2d(i,j,idx_opt+ 3) = GFS_Data(nb)%Sfcprop%t_mnw(ix) + temp2d(i,j,idx_opt+ 4) = GFS_Data(nb)%Sfcprop%h_talb(ix) + temp2d(i,j,idx_opt+ 5) = GFS_Data(nb)%Sfcprop%t_talb(ix) + temp2d(i,j,idx_opt+ 6) = GFS_Data(nb)%Sfcprop%t_bot1(ix) + temp2d(i,j,idx_opt+ 7) = GFS_Data(nb)%Sfcprop%t_bot2(ix) + temp2d(i,j,idx_opt+ 8) = GFS_Data(nb)%Sfcprop%c_t(ix) + temp2d(i,j,idx_opt+ 9) = GFS_Data(nb)%Sfcprop%T_snow(ix) + temp2d(i,j,idx_opt+ 10) = GFS_Data(nb)%Sfcprop%T_ice(ix) + elseif (Model%lake_model_option == 1 ) then + temp2d(i,j,idx_opt+ 1) = GFS_Data(nb)%Sfcprop%h_ML(ix) + temp2d(i,j,idx_opt+ 2) = GFS_Data(nb)%Sfcprop%t_ML(ix) + temp2d(i,j,idx_opt+ 3) = GFS_Data(nb)%Sfcprop%t_mnw(ix) + temp2d(i,j,idx_opt+ 4) = GFS_Data(nb)%Sfcprop%h_talb(ix) + temp2d(i,j,idx_opt+ 5) = GFS_Data(nb)%Sfcprop%t_talb(ix) + temp2d(i,j,idx_opt+ 6) = GFS_Data(nb)%Sfcprop%t_bot1(ix) + temp2d(i,j,idx_opt+ 7) = GFS_Data(nb)%Sfcprop%t_bot2(ix) + temp2d(i,j,idx_opt+ 8) = GFS_Data(nb)%Sfcprop%c_t(ix) + temp2d(i,j,idx_opt+ 9) = GFS_Data(nb)%Sfcprop%T_snow(ix) + temp2d(i,j,idx_opt+ 10) = GFS_Data(nb)%Sfcprop%T_ice(ix) + elseif (Model%lake_model_option == 2 ) then + temp2d(i,j,idx_opt+ 1) = GFS_Data(nb)%Sfcprop%h_ML(ix) + temp2d(i,j,idx_opt+ 2) = GFS_Data(nb)%Sfcprop%t_ML(ix) + temp2d(i,j,idx_opt+ 3) = GFS_Data(nb)%Sfcprop%t_mnw(ix) + temp2d(i,j,idx_opt+ 4) = GFS_Data(nb)%Sfcprop%h_talb(ix) + temp2d(i,j,idx_opt+ 5) = GFS_Data(nb)%Sfcprop%t_talb(ix) + temp2d(i,j,idx_opt+ 6) = GFS_Data(nb)%Sfcprop%t_bot1(ix) + temp2d(i,j,idx_opt+ 7) = GFS_Data(nb)%Sfcprop%t_bot2(ix) + temp2d(i,j,idx_opt+ 8) = GFS_Data(nb)%Sfcprop%c_t(ix) + temp2d(i,j,idx_opt+ 9) = GFS_Data(nb)%Sfcprop%T_snow(ix) + temp2d(i,j,idx_opt+ 10) = GFS_Data(nb)%Sfcprop%T_ice(ix) endif do l = 1,Model%ntot2d @@ -522,6 +569,7 @@ subroutine sfc_prop_restart_read (Sfcprop, Atm_block, Model, fv_domain, warm_sta integer :: isc, iec, jsc, jec, npz, nx, ny integer :: id_restart integer :: nvar_o2, nvar_s2m, nvar_s2o, nvar_s3 + integer :: nvar_s2me, nvar_s2l integer :: nvar_oro_ls_ss integer :: nvar_s2r, nvar_s2mp, nvar_s3mp, isnow integer :: nvar_emi, nvar_dust12m, nvar_gbbepx @@ -673,6 +721,7 @@ subroutine sfc_prop_restart_read (Sfcprop, Atm_block, Model, fv_domain, warm_sta Sfcprop(nb)%landfrac(ix) = -9999.0 Sfcprop(nb)%lakefrac(ix) = -9999.0 + Sfcprop(nb)%lakedepth(ix) = -9999.0 Sfcprop(nb)%landfrac(ix) = oro_var2(i,j,17) !land frac [0:1] Sfcprop(nb)%lakefrac(ix) = oro_var2(i,j,18) !lake frac [0:1] @@ -691,6 +740,19 @@ subroutine sfc_prop_restart_read (Sfcprop, Atm_block, Model, fv_domain, warm_sta nvar_s2m = nvar_s2m + 1 endif +! Flake - restart container for flake model component +! keeping 10 for each flake schemes + + if (Model%lake_model_option == 0 ) then + nvar_s2l = 10 + elseif (Model%lake_model_option == 1 ) then + nvar_s2l = 10 + elseif (Model%lake_model_option == 2 ) then + nvar_s2l = 10 + else + nvar_s2l = 0 + endif + !--- deallocate containers and free restart container deallocate(oro_name2, oro_var2) @@ -944,9 +1006,9 @@ subroutine sfc_prop_restart_read (Sfcprop, Atm_block, Model, fv_domain, warm_sta if (.not. allocated(sfc_name2)) then !--- allocate the various containers needed for restarts - allocate(sfc_name2(nvar_s2m+nvar_s2o+nvar_s2mp+nvar_s2r)) + allocate(sfc_name2(nvar_s2m+nvar_s2o+nvar_s2mp+nvar_s2r+nvar_s2l)) allocate(sfc_name3(0:nvar_s3+nvar_s3mp)) - allocate(sfc_var2(nx,ny,nvar_s2m+nvar_s2o+nvar_s2mp+nvar_s2r)) + allocate(sfc_var2(nx,ny,nvar_s2m+nvar_s2o+nvar_s2mp+nvar_s2r+nvar_s2l)) ! Note that this may cause problems with RUC LSM for coldstart runs from GFS data ! if the initial conditions do contain this variable, because Model%kice is 9 for ! RUC LSM, but tiice in the initial conditions will only have two vertical layers @@ -1053,6 +1115,7 @@ subroutine sfc_prop_restart_read (Sfcprop, Atm_block, Model, fv_domain, warm_sta sfc_name2(nvar_s2m+16) = 'ifd' sfc_name2(nvar_s2m+17) = 'dt_cool' sfc_name2(nvar_s2m+18) = 'qrain' + nvar_s2me = nvar_s2m+18 ! ! Only needed when Noah MP LSM is used - 29 2D ! @@ -1086,6 +1149,7 @@ subroutine sfc_prop_restart_read (Sfcprop, Atm_block, Model, fv_domain, warm_sta sfc_name2(nvar_s2m+45) = 'smcwtdxy' sfc_name2(nvar_s2m+46) = 'deeprechxy' sfc_name2(nvar_s2m+47) = 'rechxy' + nvar_s2me = nvar_s2m+47 else if (Model%lsm == Model%lsm_ruc .and. warm_start) then sfc_name2(nvar_s2m+19) = 'wetness' sfc_name2(nvar_s2m+20) = 'clw_surf_land' @@ -1099,11 +1163,51 @@ subroutine sfc_prop_restart_read (Sfcprop, Atm_block, Model, fv_domain, warm_sta sfc_name2(nvar_s2m+28) = 'sfalb_lnd' sfc_name2(nvar_s2m+29) = 'sfalb_lnd_bck' sfc_name2(nvar_s2m+30) = 'sfalb_ice' + nvar_s2me = nvar_s2m+12 if (Model%rdlai) then sfc_name2(nvar_s2m+31) = 'lai' + nvar_s2me = nvar_s2m+1 endif else if (Model%lsm == Model%lsm_ruc .and. Model%rdlai) then sfc_name2(nvar_s2m+19) = 'lai' + nvar_s2me = nvar_s2m+19 + endif + +!Flake 0,1,2 varios option for flake schemes +! and adjust your parameters here. + if (Model%lake_model_option == 0 ) then + sfc_name2(nvar_s2me+1) = 'h_ML' + sfc_name2(nvar_s2me+2) = 't_ML' + sfc_name2(nvar_s2me+3) = 't_mnw' + sfc_name2(nvar_s2me+4) = 'h_talb' + sfc_name2(nvar_s2me+5) = 't_talb' + sfc_name2(nvar_s2me+6) = 't_bot1' + sfc_name2(nvar_s2me+7) = 't_bot2' + sfc_name2(nvar_s2me+8) = 'c_t' + sfc_name2(nvar_s2me+9) = 'T_snow' + sfc_name2(nvar_s2me+10) = 'T_ice' + elseif (Model%lake_model_option == 1 ) then + sfc_name2(nvar_s2me+1) = 'h_ML' + sfc_name2(nvar_s2me+2) = 't_ML' + sfc_name2(nvar_s2me+3) = 't_mnw' + sfc_name2(nvar_s2me+4) = 'h_talb' + sfc_name2(nvar_s2me+5) = 't_talb' + sfc_name2(nvar_s2me+6) = 't_bot1' + sfc_name2(nvar_s2me+7) = 't_bot2' + sfc_name2(nvar_s2me+8) = 'c_t' + sfc_name2(nvar_s2me+9) = 'T_snow' + sfc_name2(nvar_s2me+10) = 'T_ice' + elseif (Model%lake_model_option == 2 ) then + sfc_name2(nvar_s2me+1) = 'h_ML' + sfc_name2(nvar_s2me+2) = 't_ML' + sfc_name2(nvar_s2me+3) = 't_mnw' + sfc_name2(nvar_s2me+4) = 'h_talb' + sfc_name2(nvar_s2me+5) = 't_talb' + sfc_name2(nvar_s2me+6) = 't_bot1' + sfc_name2(nvar_s2me+7) = 't_bot2' + sfc_name2(nvar_s2me+8) = 'c_t' + sfc_name2(nvar_s2me+9) = 'T_snow' + sfc_name2(nvar_s2me+10) = 'T_ice' endif is_lsoil=.false. @@ -1204,6 +1308,19 @@ subroutine sfc_prop_restart_read (Sfcprop, Atm_block, Model, fv_domain, warm_sta end if enddo endif ! noahmp + +! Flake for all schemes restart fields + if (Model%lake_model_option == 0 .or. Model%lake_model_option == 1 .or. Model%lake_model_option == 2 ) then + mand = .false. + do num = nvar_s2me+1,nvar_s2me+nvar_s2l + var2_p => sfc_var2(:,:,num) + if(is_lsoil) then + call register_restart_field(Sfc_restart,sfc_name2(num),var2_p,dimensions=(/'lat','lon'/), is_optional=.not.mand) + else + call register_restart_field(Sfc_restart,sfc_name2(num),var2_p,dimensions=(/'Time ','yaxis_1','xaxis_1'/),is_optional=.not.mand) + endif + enddo + endif nullify(var2_p) endif ! if not allocated @@ -1360,6 +1477,17 @@ subroutine sfc_prop_restart_read (Sfcprop, Atm_block, Model, fv_domain, warm_sta Sfcprop(nb)%zorlwav(ix) = Sfcprop(nb)%zorlw(ix) endif +! Flake + if(Sfcprop(nb)%lakefrac(ix) < zero) Sfcprop(nb)%lakefrac(ix) =zero + if(Sfcprop(nb)%landfrac(ix) < zero) Sfcprop(nb)%landfrac(ix) =zero + if(Sfcprop(nb)%fice(ix) < zero) Sfcprop(nb)%fice(ix) =zero +! Sfcprop(nb)%oceanfrac(ix)=one-Sfcprop(nb)%landfrac(ix)-Sfcprop(nb)%lakefrac(ix)-Sfcprop(nb)%fice(ix) + Sfcprop(nb)%oceanfrac(ix)=one-Sfcprop(nb)%landfrac(ix)-Sfcprop(nb)%lakefrac(ix) + if(Sfcprop(nb)%oceanfrac(ix) < zero) Sfcprop(nb)%oceanfrac(ix)=zero +! write(35,75) ix, Sfcprop(nb)%fice(ix), Sfcprop(nb)%oceanfrac(ix), & +! & Sfcprop(nb)%landfrac(ix), Sfcprop(nb)%lakefrac(ix) +! end flake + if (Sfcprop(nb)%stype(ix) == 14 .or. Sfcprop(nb)%stype(ix) <= 0) then Sfcprop(nb)%landfrac(ix) = zero Sfcprop(nb)%stype(ix) = 0 @@ -1369,12 +1497,11 @@ subroutine sfc_prop_restart_read (Sfcprop, Atm_block, Model, fv_domain, warm_sta endif if (Model%frac_grid) then - if (Sfcprop(nb)%landfrac(ix) > -999.0_r8) then + if (Sfcprop(nb)%landfrac(ix) > zero) then Sfcprop(nb)%slmsk(ix) = ceiling(Sfcprop(nb)%landfrac(ix)-1.0e-6) - if (Sfcprop(nb)%slmsk(ix) == 1 .and. Sfcprop(nb)%stype(ix) == 14) & - Sfcprop(nb)%slmsk(ix) = 0 + if (Sfcprop(nb)%slmsk(ix) == 1 .and. Sfcprop(nb)%stype(ix) == 14) Sfcprop(nb)%slmsk(ix) = 0 if (Sfcprop(nb)%lakefrac(ix) > zero) then - Sfcprop(nb)%oceanfrac(ix) = zero ! lake & ocean don't coexist in a cell +! Sfcprop(nb)%oceanfrac(ix) = zero ! lake & ocean don't coexist in a cell if (nint(Sfcprop(nb)%slmsk(ix)) /= 1) then if(Sfcprop(nb)%fice(ix) >= Model%min_lakeice) then Sfcprop(nb)%slmsk(ix) = 2 @@ -1398,26 +1525,26 @@ subroutine sfc_prop_restart_read (Sfcprop, Atm_block, Model, fv_domain, warm_sta if (nint(Sfcprop(nb)%slmsk(ix)) == 1) then Sfcprop(nb)%landfrac(ix) = one Sfcprop(nb)%lakefrac(ix) = zero - Sfcprop(nb)%oceanfrac(ix) = zero +! Sfcprop(nb)%oceanfrac(ix) = zero else if (Sfcprop(nb)%slmsk(ix) < 0.1_r8 .or. Sfcprop(nb)%slmsk(ix) > 1.9_r8) then Sfcprop(nb)%landfrac(ix) = zero if (Sfcprop(nb)%oro_uf(ix) > min_lake_orog) then ! lakes Sfcprop(nb)%lakefrac(ix) = one - Sfcprop(nb)%oceanfrac(ix) = zero +! Sfcprop(nb)%oceanfrac(ix) = zero else ! ocean Sfcprop(nb)%lakefrac(ix) = zero - Sfcprop(nb)%oceanfrac(ix) = one + ! Sfcprop(nb)%oceanfrac(ix) = one endif endif endif endif else ! not a fractional grid - if (Sfcprop(nb)%landfrac(ix) > -999.0_r8) then + if (Sfcprop(nb)%landfrac(ix) > zero) then if (Sfcprop(nb)%lakefrac(ix) > zero) then - Sfcprop(nb)%oceanfrac(ix) = zero +! Sfcprop(nb)%oceanfrac(ix) = zero Sfcprop(nb)%landfrac(ix) = zero - Sfcprop(nb)%lakefrac(ix) = one +! Sfcprop(nb)%lakefrac(ix) = one Sfcprop(nb)%slmsk(ix) = zero if (Sfcprop(nb)%fice(ix) >= Model%min_lakeice) Sfcprop(nb)%slmsk(ix) = 2.0 else @@ -1425,32 +1552,32 @@ subroutine sfc_prop_restart_read (Sfcprop, Atm_block, Model, fv_domain, warm_sta if (Sfcprop(nb)%stype(ix) <= 0 .or. Sfcprop(nb)%stype(ix) == 14) & Sfcprop(nb)%slmsk(ix) = zero if (nint(Sfcprop(nb)%slmsk(ix)) == 0) then - Sfcprop(nb)%oceanfrac(ix) = one +! Sfcprop(nb)%oceanfrac(ix) = one Sfcprop(nb)%landfrac(ix) = zero - Sfcprop(nb)%lakefrac(ix) = zero +! Sfcprop(nb)%lakefrac(ix) = zero if (Sfcprop(nb)%fice(ix) >= Model%min_seaice) Sfcprop(nb)%slmsk(ix) = 2.0 else Sfcprop(nb)%landfrac(ix) = one - Sfcprop(nb)%lakefrac(ix) = zero - Sfcprop(nb)%oceanfrac(ix) = zero +! Sfcprop(nb)%lakefrac(ix) = zero +! Sfcprop(nb)%oceanfrac(ix) = zero endif endif else if (nint(Sfcprop(nb)%slmsk(ix)) == 1 .and. Sfcprop(nb)%stype(ix) > 0 & .and. Sfcprop(nb)%stype(ix) /= 14) then Sfcprop(nb)%landfrac(ix) = one - Sfcprop(nb)%lakefrac(ix) = zero - Sfcprop(nb)%oceanfrac(ix) = zero +! Sfcprop(nb)%lakefrac(ix) = zero +! Sfcprop(nb)%oceanfrac(ix) = zero else Sfcprop(nb)%slmsk(ix) = zero Sfcprop(nb)%landfrac(ix) = zero if (Sfcprop(nb)%oro_uf(ix) > min_lake_orog) then ! lakes - Sfcprop(nb)%lakefrac(ix) = one +! Sfcprop(nb)%lakefrac(ix) = one Sfcprop(nb)%oceanfrac(ix) = zero if (Sfcprop(nb)%fice(ix) > Model%min_lakeice) Sfcprop(nb)%slmsk(ix) = 2.0 else ! ocean - Sfcprop(nb)%lakefrac(ix) = zero - Sfcprop(nb)%oceanfrac(ix) = one +! Sfcprop(nb)%lakefrac(ix) = zero +! Sfcprop(nb)%oceanfrac(ix) = one if (Sfcprop(nb)%fice(ix) > Model%min_seaice) Sfcprop(nb)%slmsk(ix) = 2.0 endif endif @@ -1503,6 +1630,7 @@ subroutine sfc_prop_restart_read (Sfcprop, Atm_block, Model, fv_domain, warm_sta Sfcprop(nb)%ifd(ix) = sfc_var2(i,j,nvar_s2m+16) !--- nsstm ifd Sfcprop(nb)%dt_cool(ix) = sfc_var2(i,j,nvar_s2m+17) !--- nsstm dt_cool Sfcprop(nb)%qrain(ix) = sfc_var2(i,j,nvar_s2m+18) !--- nsstm qrain + nvar_s2me = nvar_s2m+18 endif endif @@ -1520,14 +1648,17 @@ subroutine sfc_prop_restart_read (Sfcprop, Atm_block, Model, fv_domain, warm_sta Sfcprop(nb)%sfalb_lnd(ix) = sfc_var2(i,j,nvar_s2m+28) Sfcprop(nb)%sfalb_lnd_bck(ix) = sfc_var2(i,j,nvar_s2m+29) Sfcprop(nb)%sfalb_ice(ix) = sfc_var2(i,j,nvar_s2m+30) + nvar_s2me = nvar_s2m+12 if (Model%rdlai) then Sfcprop(nb)%xlaixy(ix) = sfc_var2(i,j,nvar_s2m+31) + nvar_s2me = nvar_s2m+1 endif else if (Model%lsm == Model%lsm_ruc) then ! Initialize RUC snow cover on ice from snow cover Sfcprop(nb)%sncovr_ice(ix) = Sfcprop(nb)%sncovr(ix) if (Model%rdlai) then Sfcprop(nb)%xlaixy(ix) = sfc_var2(i,j,nvar_s2m+19) + nvar_s2me = nvar_s2m+19 end if elseif (Model%lsm == Model%lsm_noahmp) then !--- Extra Noah MP variables @@ -1560,8 +1691,43 @@ subroutine sfc_prop_restart_read (Sfcprop, Atm_block, Model, fv_domain, warm_sta Sfcprop(nb)%smcwtdxy(ix) = sfc_var2(i,j,nvar_s2m+45) Sfcprop(nb)%deeprechxy(ix) = sfc_var2(i,j,nvar_s2m+46) Sfcprop(nb)%rechxy(ix) = sfc_var2(i,j,nvar_s2m+47) + nvar_s2me = nvar_s2m+47 endif - + !Flake + if (Model%lake_model_option == 0 ) then + Sfcprop(nb)%h_ML(ix) = sfc_var2(i,j,nvar_s2me+1) + Sfcprop(nb)%t_ML(ix) = sfc_var2(i,j,nvar_s2me+2) + Sfcprop(nb)%t_mnw(ix) = sfc_var2(i,j,nvar_s2me+3) + Sfcprop(nb)%h_talb(ix) = sfc_var2(i,j,nvar_s2me+4) + Sfcprop(nb)%t_talb(ix) = sfc_var2(i,j,nvar_s2me+5) + Sfcprop(nb)%t_bot1(ix) = sfc_var2(i,j,nvar_s2me+6) + Sfcprop(nb)%t_bot2(ix) = sfc_var2(i,j,nvar_s2me+7) + Sfcprop(nb)%c_t(ix) = sfc_var2(i,j,nvar_s2me+8) + Sfcprop(nb)%T_snow(ix) = sfc_var2(i,j,nvar_s2me+9) + Sfcprop(nb)%T_ice(ix) = sfc_var2(i,j,nvar_s2me+10) + elseif (Model%lake_model_option == 1 ) then + Sfcprop(nb)%h_ML(ix) = sfc_var2(i,j,nvar_s2me+1) + Sfcprop(nb)%t_ML(ix) = sfc_var2(i,j,nvar_s2me+2) + Sfcprop(nb)%t_mnw(ix) = sfc_var2(i,j,nvar_s2me+3) + Sfcprop(nb)%h_talb(ix) = sfc_var2(i,j,nvar_s2me+4) + Sfcprop(nb)%t_talb(ix) = sfc_var2(i,j,nvar_s2me+5) + Sfcprop(nb)%t_bot1(ix) = sfc_var2(i,j,nvar_s2me+6) + Sfcprop(nb)%t_bot2(ix) = sfc_var2(i,j,nvar_s2me+7) + Sfcprop(nb)%c_t(ix) = sfc_var2(i,j,nvar_s2me+8) + Sfcprop(nb)%T_snow(ix) = sfc_var2(i,j,nvar_s2me+9) + Sfcprop(nb)%T_ice(ix) = sfc_var2(i,j,nvar_s2me+10) + elseif (Model%lake_model_option == 2 ) then + Sfcprop(nb)%h_ML(ix) = sfc_var2(i,j,nvar_s2me+1) + Sfcprop(nb)%t_ML(ix) = sfc_var2(i,j,nvar_s2me+2) + Sfcprop(nb)%t_mnw(ix) = sfc_var2(i,j,nvar_s2me+3) + Sfcprop(nb)%h_talb(ix) = sfc_var2(i,j,nvar_s2me+4) + Sfcprop(nb)%t_talb(ix) = sfc_var2(i,j,nvar_s2me+5) + Sfcprop(nb)%t_bot1(ix) = sfc_var2(i,j,nvar_s2me+6) + Sfcprop(nb)%t_bot2(ix) = sfc_var2(i,j,nvar_s2me+7) + Sfcprop(nb)%c_t(ix) = sfc_var2(i,j,nvar_s2me+8) + Sfcprop(nb)%T_snow(ix) = sfc_var2(i,j,nvar_s2me+9) + Sfcprop(nb)%T_ice(ix) = sfc_var2(i,j,nvar_s2me+10) + endif if (Model%lsm == Model%lsm_noah .or. Model%lsm == Model%lsm_noahmp .or. (.not.warm_start)) then !--- 3D variables do lsoil = 1,Model%lsoil @@ -1839,6 +2005,8 @@ subroutine sfc_prop_restart_write (Sfcprop, Atm_block, Model, fv_domain, timesta integer :: id_restart integer :: nvar2m, nvar2o, nvar3 integer :: nvar2r, nvar2mp, nvar3mp + ! ---for flake + integer :: nvar2me, nvar2l logical :: mand character(len=32) :: fn_srf = 'sfc_data.nc' real(kind=kind_phys), pointer, dimension(:,:) :: var2_p => NULL() @@ -1879,6 +2047,14 @@ subroutine sfc_prop_restart_write (Sfcprop, Atm_block, Model, fv_domain, timesta nvar2mp = 29 nvar3mp = 5 endif +!Flake + if (Model%lake_model_option == 0 .or. Model%lake_model_option == 1 .or. Model%lake_model_option == 2) then + nvar2l = 10 + nvar2me = nvar2m + else + nvar2l = 0 + nvar2me = 0 + endif isc = Atm_block%isc iec = Atm_block%iec @@ -1978,9 +2154,9 @@ subroutine sfc_prop_restart_write (Sfcprop, Atm_block, Model, fv_domain, timesta if (.not. allocated(sfc_name2)) then !--- allocate the various containers needed for restarts - allocate(sfc_name2(nvar2m+nvar2o+nvar2mp+nvar2r)) + allocate(sfc_name2(nvar2m+nvar2o+nvar2mp+nvar2r+nvar2l)) allocate(sfc_name3(0:nvar3+nvar3mp)) - allocate(sfc_var2(nx,ny,nvar2m+nvar2o+nvar2mp+nvar2r)) + allocate(sfc_var2(nx,ny,nvar2m+nvar2o+nvar2mp+nvar2r+nvar2l)) if (Model%lsm == Model%lsm_noah .or. Model%lsm == Model%lsm_noahmp) then allocate(sfc_var3(nx,ny,Model%lsoil,nvar3)) elseif (Model%lsm == Model%lsm_ruc) then @@ -2128,6 +2304,41 @@ subroutine sfc_prop_restart_write (Sfcprop, Atm_block, Model, fv_domain, timesta sfc_name2(nvar2m+46) = 'deeprechxy' sfc_name2(nvar2m+47) = 'rechxy' endif +!Flake + if(Model%lake_model_option == 0 ) then + sfc_name2(nvar2me+1) = 'h_ML' + sfc_name2(nvar2me+2) = 't_ML' + sfc_name2(nvar2me+3) = 't_mnw' + sfc_name2(nvar2me+4) = 'h_talb' + sfc_name2(nvar2me+5) = 't_talb' + sfc_name2(nvar2me+6) = 't_bot1' + sfc_name2(nvar2me+7) = 't_bot2' + sfc_name2(nvar2me+8) = 'c_t' + sfc_name2(nvar2me+9) = 'T_snow' + sfc_name2(nvar2me+10) = 'T_ice' + elseif (Model%lake_model_option == 1 ) then + sfc_name2(nvar2me+1) = 'h_ML' + sfc_name2(nvar2me+2) = 't_ML' + sfc_name2(nvar2me+3) = 't_mnw' + sfc_name2(nvar2me+4) = 'h_talb' + sfc_name2(nvar2me+5) = 't_talb' + sfc_name2(nvar2me+6) = 't_bot1' + sfc_name2(nvar2me+7) = 't_bot2' + sfc_name2(nvar2me+8) = 'c_t' + sfc_name2(nvar2me+9) = 'T_snow' + sfc_name2(nvar2me+10) = 'T_ice' + elseif (Model%lake_model_option == 2 ) then + sfc_name2(nvar2me+1) = 'h_ML' + sfc_name2(nvar2me+2) = 't_ML' + sfc_name2(nvar2me+3) = 't_mnw' + sfc_name2(nvar2me+4) = 'h_talb' + sfc_name2(nvar2me+5) = 't_talb' + sfc_name2(nvar2me+6) = 't_bot1' + sfc_name2(nvar2me+7) = 't_bot2' + sfc_name2(nvar2me+8) = 'c_t' + sfc_name2(nvar2me+9) = 'T_snow' + sfc_name2(nvar2me+10) = 'T_ice' + endif end if !--- register the 2D fields @@ -2172,6 +2383,16 @@ subroutine sfc_prop_restart_write (Sfcprop, Atm_block, Model, fv_domain, timesta &is_optional=.not.mand) enddo endif +!Flake + nvar2me=nvar2m+nvar2o+nvar2r+nvar2mp + if(Model%lake_model_option > 0) then + mand = .false. + do num = nvar2me+1,nvar2me+nvar2l + var2_p => sfc_var2(:,:,num) + call register_restart_field(Sfc_restart,sfc_name2(num),var2_p,dimensions=(/'xaxis_1', 'yaxis_1', 'Time '/),& + &is_optional=.not.mand) + enddo + endif nullify(var2_p) if (Model%lsm == Model%lsm_noah .or. Model%lsm == Model%lsm_noahmp) then @@ -2322,6 +2543,7 @@ subroutine sfc_prop_restart_write (Sfcprop, Atm_block, Model, fv_domain, timesta sfc_var2(i,j,nvar2m+16) = Sfcprop(nb)%ifd(ix) !--- nsstm ifd sfc_var2(i,j,nvar2m+17) = Sfcprop(nb)%dt_cool(ix)!--- nsstm dt_cool sfc_var2(i,j,nvar2m+18) = Sfcprop(nb)%qrain(ix) !--- nsstm qrain + nvar2me = nvar2m + 18 endif if (Model%lsm == Model%lsm_ruc) then @@ -2338,8 +2560,10 @@ subroutine sfc_prop_restart_write (Sfcprop, Atm_block, Model, fv_domain, timesta sfc_var2(i,j,nvar2m+28) = Sfcprop(nb)%sfalb_lnd(ix) sfc_var2(i,j,nvar2m+29) = Sfcprop(nb)%sfalb_lnd_bck(ix) sfc_var2(i,j,nvar2m+30) = Sfcprop(nb)%sfalb_ice(ix) + nvar2me = nvar2m + 12 if (Model%rdlai) then sfc_var2(i,j,nvar2m+31) = Sfcprop(nb)%xlaixy(ix) + nvar2me = nvar2m + 1 endif else if (Model%lsm == Model%lsm_noahmp) then !--- Extra Noah MP variables @@ -2372,6 +2596,46 @@ subroutine sfc_prop_restart_write (Sfcprop, Atm_block, Model, fv_domain, timesta sfc_var2(i,j,nvar2m+45) = Sfcprop(nb)%smcwtdxy(ix) sfc_var2(i,j,nvar2m+46) = Sfcprop(nb)%deeprechxy(ix) sfc_var2(i,j,nvar2m+47) = Sfcprop(nb)%rechxy(ix) + nvar2me = nvar2m + 47 + endif + +!Flake + if(Model%lake_model_option == 0 ) then + sfc_var2(i,j,nvar2me+1) = Sfcprop(nb)%h_ML(ix) + sfc_var2(i,j,nvar2me+2) = Sfcprop(nb)%t_ML(ix) + sfc_var2(i,j,nvar2me+3) = Sfcprop(nb)%t_mnw(ix) + sfc_var2(i,j,nvar2me+4) = Sfcprop(nb)%h_talb(ix) + sfc_var2(i,j,nvar2me+5) = Sfcprop(nb)%t_talb(ix) + sfc_var2(i,j,nvar2me+6) = Sfcprop(nb)%t_bot1(ix) + sfc_var2(i,j,nvar2me+7) = Sfcprop(nb)%t_bot2(ix) + sfc_var2(i,j,nvar2me+8) = Sfcprop(nb)%c_t(ix) + sfc_var2(i,j,nvar2me+9) = Sfcprop(nb)%T_snow(ix) + sfc_var2(i,j,nvar2me+10) = Sfcprop(nb)%T_ice(ix) + nvar2me = nvar2m + 10 + elseif (Model%lake_model_option == 1 ) then + sfc_var2(i,j,nvar2me+1) = Sfcprop(nb)%h_ML(ix) + sfc_var2(i,j,nvar2me+2) = Sfcprop(nb)%t_ML(ix) + sfc_var2(i,j,nvar2me+3) = Sfcprop(nb)%t_mnw(ix) + sfc_var2(i,j,nvar2me+4) = Sfcprop(nb)%h_talb(ix) + sfc_var2(i,j,nvar2me+5) = Sfcprop(nb)%t_talb(ix) + sfc_var2(i,j,nvar2me+6) = Sfcprop(nb)%t_bot1(ix) + sfc_var2(i,j,nvar2me+7) = Sfcprop(nb)%t_bot2(ix) + sfc_var2(i,j,nvar2me+8) = Sfcprop(nb)%c_t(ix) + sfc_var2(i,j,nvar2me+9) = Sfcprop(nb)%T_snow(ix) + sfc_var2(i,j,nvar2me+10) = Sfcprop(nb)%T_ice(ix) + nvar2me = nvar2m + 10 + elseif (Model%lake_model_option == 2 ) then + sfc_var2(i,j,nvar2me+1) = Sfcprop(nb)%h_ML(ix) + sfc_var2(i,j,nvar2me+2) = Sfcprop(nb)%t_ML(ix) + sfc_var2(i,j,nvar2me+3) = Sfcprop(nb)%t_mnw(ix) + sfc_var2(i,j,nvar2me+4) = Sfcprop(nb)%h_talb(ix) + sfc_var2(i,j,nvar2me+5) = Sfcprop(nb)%t_talb(ix) + sfc_var2(i,j,nvar2me+6) = Sfcprop(nb)%t_bot1(ix) + sfc_var2(i,j,nvar2me+7) = Sfcprop(nb)%t_bot2(ix) + sfc_var2(i,j,nvar2me+8) = Sfcprop(nb)%c_t(ix) + sfc_var2(i,j,nvar2me+9) = Sfcprop(nb)%T_snow(ix) + sfc_var2(i,j,nvar2me+10) = Sfcprop(nb)%T_ice(ix) + nvar2me = nvar2m + 10 endif do k = 1,Model%kice