Skip to content

Commit

Permalink
The forcing variables names that have been added to namelist.hrldas a…
Browse files Browse the repository at this point in the history
…re now passed around to all other IO functions
  • Loading branch information
scrasmussen committed Mar 22, 2024
1 parent fb6f5a4 commit 42114d7
Show file tree
Hide file tree
Showing 5 changed files with 162 additions and 49 deletions.
14 changes: 14 additions & 0 deletions src/CPL/NoahMP_cpl/hrldas_drv_HYDRO.F
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ end subroutine hrldas_drv_HYDRO_ini

subroutine HYDRO_frocing_drv (indir,forc_typ, snow_assim,olddate, &
ixs, ixe,jxs,jxe, &
forcing_name_T,forcing_name_Q,forcing_name_U,forcing_name_V,forcing_name_P, &
forcing_name_LW,forcing_name_SW,forcing_name_PR,forcing_name_SN, forcing_name_LF,&
T2,Q2X,U,V,PRES,XLONG,SHORT,PRCP1,lai,SNOWBL,fpar,snodep, kt, FORCING_TIMESTEP,pcp_old)

use module_lsm_forcing, only: read_hydro_forcing
Expand All @@ -83,6 +85,16 @@ subroutine HYDRO_frocing_drv (indir,forc_typ, snow_assim,olddate, &
integer ix,jx, kt
character(len=19) :: olddate
character(len=*) :: indir
character(len=256), intent(in) :: forcing_name_T
character(len=256), intent(in) :: forcing_name_Q
character(len=256), intent(in) :: forcing_name_U
character(len=256), intent(in) :: forcing_name_V
character(len=256), intent(in) :: forcing_name_P
character(len=256), intent(in) :: forcing_name_LW
character(len=256), intent(in) :: forcing_name_SW
character(len=256), intent(in) :: forcing_name_PR
character(len=256), intent(in) :: forcing_name_SN
character(len=256), intent(in) :: forcing_name_LF
real, dimension(ixs:ixe,jxs:jxe):: T2,Q2X,U,V,PRES,XLONG,SHORT,PRCP1, &
lai, snowbl, fpar, snodep, pcp_old
integer :: forc_typ, snow_assim, FORCING_TIMESTEP
Expand All @@ -95,6 +107,8 @@ subroutine HYDRO_frocing_drv (indir,forc_typ, snow_assim,olddate, &
indir, olddate, &
nlst(did)%hgrid,&
ix,jx,forc_typ,snow_assim, &
forcing_name_T,forcing_name_Q,forcing_name_U,forcing_name_V,forcing_name_P, &
forcing_name_LW,forcing_name_SW,forcing_name_PR,forcing_name_SN, forcing_name_LF,&
T2,q2x,u,v,pres,xlong,short,prcp1,&
lai,snowbl,fpar,snodep,FORCING_TIMESTEP*1.0,kt, pcp_old)
end subroutine HYDRO_frocing_drv
Expand Down
10 changes: 7 additions & 3 deletions src/Land_models/NoahMP/IO_code/module_NoahMP_hrldas_driver.F
Original file line number Diff line number Diff line change
Expand Up @@ -1187,11 +1187,11 @@ subroutine land_driver_ini(NTIME_out, state, wrfits,wrfite,wrfjts,wrfjte)
!PSNOWAGEXY = undefined_real
! These should probably be kept initialized with an undefined value (above)
! to allow tracking of cells that fall through the cracks in value updates
! to allow tracking of cells that fall through the cracks in value updates
! (also worth noting that 0 is not a valid value for all of these variables).
! However, since restarts are not currently water-masking 2d reals, this makes
! However, since restarts are not currently water-masking 2d reals, this makes
! for odd value ranges in the LSM restarts so leaving as 0s for now.
! On quick tests, the only one of these that changes answers if NOT initialized
! On quick tests, the only one of these that changes answers if NOT initialized
! at 0 is PSNOWHISTXY so making sure that one is covered in value initialization
! loop below in case we go back to undefined_real for these.
PSNOWLIQXY = 0.
Expand Down Expand Up @@ -1739,6 +1739,10 @@ subroutine land_driver_exe(itime, state)
if(olddate == forcDate) then
CALL HYDRO_frocing_drv(trim(noah_lsm%indir), forc_typ, wrf_hydro%snow_assim, olddate, &
xstart, xend, ystart, yend, &
noah_lsm%forcing_name_T ,noah_lsm%forcing_name_Q ,noah_lsm%forcing_name_U , &
noah_lsm%forcing_name_V ,noah_lsm%forcing_name_P ,noah_lsm%forcing_name_LW, &
noah_lsm%forcing_name_SW,noah_lsm%forcing_name_PR,noah_lsm%forcing_name_SN, &
noah_lsm%forcing_name_LF, &
T_PHY(:,1,:), QV_CURR(:,1,:), U_PHY(:,1,:), V_PHY(:,1,:), &
P8W(:,1,:), GLW, SWDOWN, RAINBL_tmp, &
LAI, SNOWBL, VEGFRA, state%SNOWH, &
Expand Down
10 changes: 5 additions & 5 deletions src/Land_models/NoahMP/IO_code/module_hrldas_netcdf_io.F
Original file line number Diff line number Diff line change
Expand Up @@ -2011,19 +2011,19 @@ subroutine READFORC_HRLDAS(flnm_template, forcing_timestep, target_date, xstart,
call get_2d_netcdf(trim(forcing_name_LW), ncid, nextread%lw, units, xstart, xend, ystart, yend, FATAL, ierr)
call get_2d_netcdf(trim(forcing_name_SW), ncid, nextread%sw, units, xstart, xend, ystart, yend, FATAL, ierr)
call get_2d_netcdf(trim(forcing_name_PR), ncid, nextread%pcp, units, xstart, xend, ystart, yend, FATAL, ierr)
nextread%snow = 0.0 ! Assume zero in case not present
if(forcing_name_SN /= "") then
if(trim(forcing_name_SN) /= "") then
call get_2d_netcdf(trim(forcing_name_SN), ncid, nextread%snow, units, xstart, xend, ystart, yend, NOT_FATAL, ierr)
if(ierr == 0) snow_read = .true.
end if
if(forcing_name_LF /= "" .and. .not. snow_read) then ! snow was not read in
if(trim(forcing_name_LF) /= "" .and. .not. snow_read) then ! snow was not read in
liqfrac = 1.0 ! Assume all liquid in case not present
call get_2d_netcdf(trim(forcing_name_LF), ncid, liqfrac, units, xstart, xend, ystart, yend, NOT_FATAL, ierr)
if (ierr == 0) nextread%snow = (1.0 - liqfrac ) * nextread%pcp
end if
if(update_veg) then ! Barlage v3.7: update only if dveg option is appropriate
call get_2d_netcdf("VEGFRA", ncid, nextread%vegfra,units, xstart, xend, ystart, yend, NOT_FATAL, ierr)
Expand Down
Loading

0 comments on commit 42114d7

Please sign in to comment.