Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix time dimension in restart files #349

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
118 changes: 56 additions & 62 deletions io/FV3GFS_io.F90
Original file line number Diff line number Diff line change
Expand Up @@ -784,15 +784,15 @@ subroutine sfc_prop_restart_read (Sfcprop, Atm_block, Model, fv_domain, warm_sta
sfc_name2(31) = 'snoalb'
!--- variables below here are optional
sfc_name2(32) = 'sncovr'
sfc_name2(33) = 'tsfcl' !temp on land portion of a cell
sfc_name2(34) = 'zorll' !zorl on land portion of a cell
sfc_name2(35) = 'zorli' !zorl on ice portion of a cell
sfc_name2(36) = 'snodl' !snowd on land portion of a cell
sfc_name2(37) = 'tsfc' !tsfc composite
sfc_name2(38) = 'zorl' !zorl composite
sfc_name2(39) = 'weasdl'!weasd on land portion of a cell
sfc_name2(33) = 'snodl' !snowd on land portion of a cell
sfc_name2(34) = 'weasdl'!weasd on land portion of a cell
sfc_name2(35) = 'tsfc' !tsfc composite
sfc_name2(36) = 'tsfcl' !temp on land portion of a cell
sfc_name2(37) = 'zorlw' !zorl on water portion of a cell
sfc_name2(38) = 'zorll' !zorl on land portion of a cell
sfc_name2(39) = 'zorli' !zorl on ice portion of a cell
if(Model%cplwav) then
sfc_name2(nvar_s2m) = 'zorlwav' !zorl on land portion of a cell
sfc_name2(nvar_s2m) = 'zorlwav' !zorl from wave component
endif

!--- NSSTM inputs only needed when (nstf_name(1) > 0) .and. (nstf_name(2)) == 0)
Expand Down Expand Up @@ -889,7 +889,7 @@ subroutine sfc_prop_restart_read (Sfcprop, Atm_block, Model, fv_domain, warm_sta
if (trim(sfc_name2(num)) == 'sncovr'.or. trim(sfc_name2(num)) == 'tsfcl' .or. trim(sfc_name2(num)) == 'zorll' &
.or. trim(sfc_name2(num)) == 'zorli' .or. trim(sfc_name2(num)) == 'zorlwav' &
.or. trim(sfc_name2(num)) == 'snodl' .or. trim(sfc_name2(num)) == 'weasdl' &
.or. trim(sfc_name2(num)) == 'tsfc' .or. trim(sfc_name2(num)) == 'zorl') then
.or. trim(sfc_name2(num)) == 'tsfc' .or. trim(sfc_name2(num)) == 'zorlw') then
id_restart = register_restart_field(Sfc_restart, fn_srf, sfc_name2(num), var2_p, domain=fv_domain, mandatory=.false.)
else
id_restart = register_restart_field(Sfc_restart, fn_srf, sfc_name2(num), var2_p, domain=fv_domain)
Expand Down Expand Up @@ -1006,7 +1006,7 @@ subroutine sfc_prop_restart_read (Sfcprop, Atm_block, Model, fv_domain, warm_sta
Sfcprop(nb)%tsfco(ix) = sfc_var2(i,j,2) !--- tsfc (tsea in sfc file)
Sfcprop(nb)%weasd(ix) = sfc_var2(i,j,3) !--- weasd (sheleg in sfc file)
Sfcprop(nb)%tg3(ix) = sfc_var2(i,j,4) !--- tg3
Sfcprop(nb)%zorlw(ix) = sfc_var2(i,j,5) !--- zorl on water
Sfcprop(nb)%zorl(ix) = sfc_var2(i,j,5) !--- zorl composite
Sfcprop(nb)%alvsf(ix) = sfc_var2(i,j,6) !--- alvsf
Sfcprop(nb)%alvwf(ix) = sfc_var2(i,j,7) !--- alvwf
Sfcprop(nb)%alnsf(ix) = sfc_var2(i,j,8) !--- alnsf
Expand Down Expand Up @@ -1034,17 +1034,17 @@ subroutine sfc_prop_restart_read (Sfcprop, Atm_block, Model, fv_domain, warm_sta
Sfcprop(nb)%slope(ix) = sfc_var2(i,j,30) !--- slope
Sfcprop(nb)%snoalb(ix) = sfc_var2(i,j,31) !--- snoalb
Sfcprop(nb)%sncovr(ix) = sfc_var2(i,j,32) !--- sncovr
Sfcprop(nb)%tsfcl(ix) = sfc_var2(i,j,33) !--- sfcl (temp on land portion of a cell)
Sfcprop(nb)%zorll(ix) = sfc_var2(i,j,34) !--- zorll (zorl on land portion of a cell)
Sfcprop(nb)%zorli(ix) = sfc_var2(i,j,35) !--- zorli (zorl on ice portion of a cell)
Sfcprop(nb)%snodl(ix) = sfc_var2(i,j,36) !--- snodl (snowd on land portion of a cell)
Sfcprop(nb)%tsfc(ix) = sfc_var2(i,j,37) !--- tsfc composite
Sfcprop(nb)%zorl(ix) = sfc_var2(i,j,38) !--- zorl composite
Sfcprop(nb)%weasdl(ix) = sfc_var2(i,j,39) !--- weasdl (weasd on land portion of a cell)
Sfcprop(nb)%snodl(ix) = sfc_var2(i,j,33) !--- snodl (snowd on land portion of a cell)
Sfcprop(nb)%weasdl(ix) = sfc_var2(i,j,34) !--- weasdl (weasd on land portion of a cell)
Sfcprop(nb)%tsfc(ix) = sfc_var2(i,j,35) !--- tsfc composite
Sfcprop(nb)%tsfcl(ix) = sfc_var2(i,j,36) !--- tsfcl (temp on land portion of a cell)
Sfcprop(nb)%zorlw(ix) = sfc_var2(i,j,37) !--- zorlw (zorl on water portion of a cell)
Sfcprop(nb)%zorll(ix) = sfc_var2(i,j,38) !--- zorll (zorl on land portion of a cell)
Sfcprop(nb)%zorli(ix) = sfc_var2(i,j,39) !--- zorli (zorl on ice portion of a cell)
if(Model%cplwav) then
Sfcprop(nb)%zorlwav(ix) = sfc_var2(i,j,nvar_s2m) !--- (zorw from wave model)
else
Sfcprop(nb)%zorlwav(ix) = Sfcprop(nb)%zorlw(ix)
Sfcprop(nb)%zorlwav(ix) = Sfcprop(nb)%zorl(ix)
endif

if (Model%frac_grid) then
Expand Down Expand Up @@ -1327,7 +1327,7 @@ subroutine sfc_prop_restart_read (Sfcprop, Atm_block, Model, fv_domain, warm_sta
!$omp parallel do default(shared) private(nb, ix)
do nb = 1, Atm_block%nblks
do ix = 1, Atm_block%blksz(nb)
Sfcprop(nb)%zorll(ix) = Sfcprop(nb)%zorlw(ix) !--- compute zorll from existing variables
Sfcprop(nb)%zorll(ix) = Sfcprop(nb)%zorl(ix) !--- compute zorll from existing variables
enddo
enddo
endif
Expand All @@ -1337,7 +1337,17 @@ subroutine sfc_prop_restart_read (Sfcprop, Atm_block, Model, fv_domain, warm_sta
!$omp parallel do default(shared) private(nb, ix)
do nb = 1, Atm_block%nblks
do ix = 1, Atm_block%blksz(nb)
Sfcprop(nb)%zorli(ix) = Sfcprop(nb)%zorlw(ix) !--- compute zorli from existing variables
Sfcprop(nb)%zorli(ix) = Sfcprop(nb)%zorl(ix) !--- compute zorli from existing variables
enddo
enddo
endif

if (sfc_var2(i,j,38) < -9990.0_r8) then
if (Model%me == Model%master ) call mpp_error(NOTE, 'gfs_driver::surface_props_input - computing zorlw')
!$omp parallel do default(shared) private(nb, ix)
do nb = 1, Atm_block%nblks
do ix = 1, Atm_block%blksz(nb)
Sfcprop(nb)%zorlw(ix) = Sfcprop(nb)%zorl(ix) !--- compute zorlw from existing variables
enddo
enddo
endif
Expand All @@ -1359,20 +1369,16 @@ subroutine sfc_prop_restart_read (Sfcprop, Atm_block, Model, fv_domain, warm_sta
enddo
endif

! Fill in composite tsfc and zorl for coldstart runs
compute_tsfc_zorl_for_colstart: if (.not. warm_start) then
! Fill in composite tsfc for coldstart runs
compute_tsfc_for_colstart: if (.not. warm_start) then
if(Model%frac_grid) then ! 3-way composite
if (Model%me == Model%master ) call mpp_error(NOTE, 'gfs_driver::surface_props_input - computing composite tsfc and zorl')
if (Model%me == Model%master ) call mpp_error(NOTE, 'gfs_driver::surface_props_input - computing composite tsfc')
!$omp parallel do default(shared) private(nb, ix, tem, tem1)
do nb = 1, Atm_block%nblks
do ix = 1, Atm_block%blksz(nb)
Sfcprop(nb)%tsfco(ix) = max(con_tice, Sfcprop(nb)%tsfco(ix)) ! this may break restart reproducibility
tem1 = one - Sfcprop(nb)%landfrac(ix)
tem = tem1 * Sfcprop(nb)%fice(ix) ! tem = ice fraction wrt whole cell
Sfcprop(nb)%zorl(ix) = Sfcprop(nb)%zorll(ix) * Sfcprop(nb)%landfrac(ix) &
+ Sfcprop(nb)%zorli(ix) * tem &
+ Sfcprop(nb)%zorlw(ix) * (tem1-tem)

Sfcprop(nb)%tsfc(ix) = Sfcprop(nb)%tsfcl(ix) * Sfcprop(nb)%landfrac(ix) &
+ Sfcprop(nb)%tisfc(ix) * tem &
+ Sfcprop(nb)%tsfco(ix) * (tem1-tem)
Expand All @@ -1382,28 +1388,24 @@ subroutine sfc_prop_restart_read (Sfcprop, Atm_block, Model, fv_domain, warm_sta
!$omp parallel do default(shared) private(nb, ix, tem)
do nb = 1, Atm_block%nblks
do ix = 1, Atm_block%blksz(nb)
!--- specify tsfcl/zorll/zorli from existing variable tsfco/zorlw
if (Sfcprop(nb)%slmsk(ix) == 1) then
Sfcprop(nb)%zorl(ix) = Sfcprop(nb)%zorll(ix)
Sfcprop(nb)%tsfc(ix) = Sfcprop(nb)%tsfcl(ix)
else
tem = one - Sfcprop(nb)%fice(ix)
Sfcprop(nb)%zorl(ix) = Sfcprop(nb)%zorli(ix) * Sfcprop(nb)%fice(ix) &
+ Sfcprop(nb)%zorlw(ix) * tem
Sfcprop(nb)%tsfc(ix) = Sfcprop(nb)%tisfc(ix) * Sfcprop(nb)%fice(ix) &
+ Sfcprop(nb)%tsfco(ix) * tem
endif
enddo
enddo
endif
endif compute_tsfc_zorl_for_colstart
endif compute_tsfc_for_colstart

if (sfc_var2(i,j,nvar_s2m) < -9990.0_r8) then
if (Model%me == Model%master ) call mpp_error(NOTE, 'gfs_driver::surface_props_input - computing zorlwav')
!$omp parallel do default(shared) private(nb, ix)
do nb = 1, Atm_block%nblks
do ix = 1, Atm_block%blksz(nb)
Sfcprop(nb)%zorlwav(ix) = Sfcprop(nb)%zorlw(ix) !--- compute zorlwav from existing variables
Sfcprop(nb)%zorlwav(ix) = Sfcprop(nb)%zorl(ix) !--- compute zorlwav from existing variables
enddo
enddo
endif
Expand Down Expand Up @@ -1556,21 +1558,19 @@ subroutine sfc_prop_restart_write (Sfcprop, Atm_block, Model, fv_domain, timesta
sfc_name2(29) = 'shdmax'
sfc_name2(30) = 'slope'
sfc_name2(31) = 'snoalb'
!--- variables below here are optional
!--- variables below here are optional
sfc_name2(32) = 'sncovr'
! if (Model%frac_grid) then
sfc_name2(33) = 'tsfcl' !temp on land portion of a cell
sfc_name2(34) = 'zorll' !zorl on land portion of a cell
sfc_name2(35) = 'zorli' !zorl on ice portion of a cell
sfc_name2(36) = 'snodl' !snowd on land portion of a cell
sfc_name2(37) = 'tsfc' !tsfc composite
sfc_name2(38) = 'zorl' !zorl composite
sfc_name2(39) = 'weasd' !weasd on land portion of a cell
! endif
sfc_name2(33) = 'snodl' !snowd on land portion of a cell
sfc_name2(34) = 'weasdl'!weasd on land portion of a cell
sfc_name2(35) = 'tsfc' !tsfc composite
sfc_name2(36) = 'tsfcl' !temp on land portion of a cell
sfc_name2(37) = 'zorlw' !zorl on water portion of a cell
sfc_name2(38) = 'zorll' !zorl on land portion of a cell
sfc_name2(39) = 'zorli' !zorl on ice portion of a cell
if (Model%cplwav) then
sfc_name2(nvar2m) = 'zorlwav' !zorl on land portion of a cell
sfc_name2(nvar2m) = 'zorlwav' !zorl from wave component
endif
!--- NSSTM inputs only needed when (nstf_name(1) > 0) .and. (nstf_name(2)) == 0)
!--- NSSTM inputs only needed when (nstf_name(1) > 0) .and. (nstf_name(2)) == 0)
sfc_name2(nvar2m+1) = 'tref'
sfc_name2(nvar2m+2) = 'z_c'
sfc_name2(nvar2m+3) = 'c_0'
Expand Down Expand Up @@ -1655,7 +1655,7 @@ subroutine sfc_prop_restart_write (Sfcprop, Atm_block, Model, fv_domain, timesta
if (trim(sfc_name2(num)) == 'sncovr' .or. trim(sfc_name2(num)) == 'tsfcl' .or.trim(sfc_name2(num)) == 'zorll' &
.or. trim(sfc_name2(num)) == 'zorli' .or.trim(sfc_name2(num)) == 'zorlwav' &
.or. trim(sfc_name2(num)) == 'snodl' .or. trim(sfc_name2(num)) == 'weasdl' &
.or. trim(sfc_name2(num)) == 'tsfc' .or. trim(sfc_name2(num)) == 'zorl') then
.or. trim(sfc_name2(num)) == 'tsfc' .or. trim(sfc_name2(num)) == 'zorlw') then
id_restart = register_restart_field(Sfc_restart, fn_srf, sfc_name2(num), var2_p, domain=fv_domain, mandatory=.false.)
else
id_restart = register_restart_field(Sfc_restart, fn_srf, sfc_name2(num), var2_p, domain=fv_domain)
Expand Down Expand Up @@ -1745,16 +1745,10 @@ subroutine sfc_prop_restart_write (Sfcprop, Atm_block, Model, fv_domain, timesta
i = Atm_block%index(nb)%ii(ix) - isc + 1
j = Atm_block%index(nb)%jj(ix) - jsc + 1
sfc_var2(i,j,1) = Sfcprop(nb)%slmsk(ix) !--- slmsk
! if (Model%frac_grid) then
sfc_var2(i,j,2) = Sfcprop(nb)%tsfco(ix) !--- tsfc (tsea in sfc file)
sfc_var2(i,j,5) = Sfcprop(nb)%zorlw(ix) !--- zorlw
! else
! sfc_var2(i,j,2) = Sfcprop(nb)%tsfc(ix) !--- tsfc (tsea in sfc file)
! sfc_var2(i,j,5) = Sfcprop(nb)%zorl(ix) !--- zorl
! endif
sfc_var2(i,j,2) = Sfcprop(nb)%tsfco(ix) !--- tsfc (tsea in sfc file)
sfc_var2(i,j,3) = Sfcprop(nb)%weasd(ix) !--- weasd (sheleg in sfc file)
sfc_var2(i,j,4) = Sfcprop(nb)%tg3(ix) !--- tg3
! sfc_var2(i,j,5) = Sfcprop(nb)%zorl(ix) !--- zorl
sfc_var2(i,j,5) = Sfcprop(nb)%zorl(ix) !--- zorl
sfc_var2(i,j,6) = Sfcprop(nb)%alvsf(ix) !--- alvsf
sfc_var2(i,j,7) = Sfcprop(nb)%alvwf(ix) !--- alvwf
sfc_var2(i,j,8) = Sfcprop(nb)%alnsf(ix) !--- alnsf
Expand All @@ -1781,14 +1775,14 @@ subroutine sfc_prop_restart_write (Sfcprop, Atm_block, Model, fv_domain, timesta
sfc_var2(i,j,29) = Sfcprop(nb)%shdmax(ix)!--- shdmax
sfc_var2(i,j,30) = Sfcprop(nb)%slope(ix) !--- slope
sfc_var2(i,j,31) = Sfcprop(nb)%snoalb(ix)!--- snoalb
sfc_var2(i,j,32) = Sfcprop(nb)%sncovr(ix)!--- sncovr
sfc_var2(i,j,33) = Sfcprop(nb)%tsfcl(ix) !--- tsfcl (temp on land)
sfc_var2(i,j,34) = Sfcprop(nb)%zorll(ix) !--- zorll (zorl on land)
sfc_var2(i,j,35) = Sfcprop(nb)%zorli(ix) !--- zorli (zorl on ice)
sfc_var2(i,j,36) = Sfcprop(nb)%snodl(ix) !--- snodl (snowd on land)
sfc_var2(i,j,37) = Sfcprop(nb)%tsfc(ix) !--- tsfc composite
sfc_var2(i,j,38) = Sfcprop(nb)%zorl(ix) !--- zorl composite
sfc_var2(i,j,39) = Sfcprop(nb)%weasdl(ix) !--- weasdl (weasd on land)
sfc_var2(i,j,32) = Sfcprop(nb)%sncovr(ix) !--- sncovr
sfc_var2(i,j,33) = Sfcprop(nb)%snodl(ix) !--- snodl (snowd on land)
sfc_var2(i,j,34) = Sfcprop(nb)%weasdl(ix) !--- weasdl (weasd on land)
sfc_var2(i,j,35) = Sfcprop(nb)%tsfc(ix) !--- tsfc composite
sfc_var2(i,j,36) = Sfcprop(nb)%tsfcl(ix) !--- tsfcl (temp on land)
sfc_var2(i,j,37) = Sfcprop(nb)%zorlw(ix) !--- zorl (zorl on water)
sfc_var2(i,j,38) = Sfcprop(nb)%zorll(ix) !--- zorll (zorl on land)
sfc_var2(i,j,39) = Sfcprop(nb)%zorli(ix) !--- zorli (zorl on ice)
if (Model%cplwav) then
sfc_var2(i,j,nvar2m) = Sfcprop(nb)%zorlwav(ix) !--- zorlwav (zorl from wav)
endif
Expand Down