Skip to content

Commit

Permalink
Merge pull request #76 from NCAR/develop
Browse files Browse the repository at this point in the history
Bug fix and parameter table update for Urban physics
  • Loading branch information
cenlinhe authored Jun 10, 2023
2 parents 20be331 + ca4a0b9 commit 8732faf
Show file tree
Hide file tree
Showing 13 changed files with 120 additions and 91 deletions.
59 changes: 34 additions & 25 deletions hrldas/IO_code/module_NoahMP_hrldas_driver.F
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ subroutine land_driver_ini(NTIME_out,wrfits,wrfite,wrfjts,wrfjte)
implicit none

integer :: NTIME_out
real :: max_utype_urb2d
real :: max_landtype2d
type(domain) :: grid
! initilization for stand alone parallel code.
integer, optional, intent(in) :: wrfits,wrfite,wrfjts,wrfjte
Expand Down Expand Up @@ -180,9 +180,9 @@ subroutine land_driver_ini(NTIME_out,wrfits,wrfite,wrfjts,wrfjte)
NoahmpIO%kme = 2

if ( (NoahmpIO%sf_urban_physics == 2) .or. (NoahmpIO%sf_urban_physics == 3) ) then
NoahmpIO%kde = NoahmpIO%num_urban_atmosphere
NoahmpIO%kde = NoahmpIO%num_urban_atmosphere + 1 ! to be consistent with kme
NoahmpIO%kme = NoahmpIO%num_urban_atmosphere + 1 ! bug fix for dimension of urban cell interfaces
NoahmpIO%kte = NoahmpIO%num_urban_atmosphere
NoahmpIO%kme = NoahmpIO%num_urban_atmosphere
endif

!---------------------------------------------------------------------
Expand Down Expand Up @@ -555,12 +555,11 @@ subroutine land_driver_ini(NTIME_out,wrfits,wrfite,wrfjts,wrfjte)
NoahmpIO%DL_U_BEP, NoahmpIO%SF_BEP, NoahmpIO%VL_BEP, & !multi-layer urban
NoahmpIO%FRC_URB2D, NoahmpIO%UTYPE_URB2D, NoahmpIO%use_wudapt_lcz) !urban

max_utype_urb2d = maxval(NoahmpIO%UTYPE_URB2D)*1.0

if ( (NoahmpIO%use_wudapt_lcz == 0) .and. (max_utype_urb2d > 3.0) ) then !new LCZ
max_landtype2d = maxval(NoahmpIO%IVGTYP)*1.0
if ( (NoahmpIO%use_wudapt_lcz == 0) .and. (max_landtype2d > 50.0) ) then ! LCZ number: 51~61
stop "USING 10 WUDAPT LCZ WITHOUT URBPARM_LCZ.TBL. SET USE_WUDAPT_LCZ=1"
endif
if ( (NoahmpIO%use_wudapt_lcz == 1) .and. (max_utype_urb2d <= 3.0) ) then ! new LCZ
if ( (NoahmpIO%use_wudapt_lcz == 1) .and. (max_landtype2d <= 50.0) ) then ! LCZ number: 51~61
stop "USING URBPARM_LCZ.TBL WITH OLD 3 URBAN CLASSES. SET USE_WUDAPT_LCZ=0"
endif

Expand Down Expand Up @@ -694,14 +693,14 @@ subroutine land_driver_ini(NTIME_out,wrfits,wrfite,wrfjts,wrfjte)
NoahmpIO%DL_U_BEP, NoahmpIO%SF_BEP, NoahmpIO%VL_BEP, & !multi-layer urban
NoahmpIO%FRC_URB2D, NoahmpIO%UTYPE_URB2D, NoahmpIO%use_wudapt_lcz) !urban

max_utype_urb2d = maxval(NoahmpIO%UTYPE_URB2D)*1.0

if ( (NoahmpIO%use_wudapt_lcz == 0) .and. (max_utype_urb2d > 3.0) ) then !new LCZ
max_landtype2d = maxval(NoahmpIO%IVGTYP)*1.0
if ( (NoahmpIO%use_wudapt_lcz == 0) .and. (max_landtype2d > 50.0) ) then ! LCZ number: 51~61
stop "USING 10 WUDAPT LCZ WITHOUT URBPARM_LCZ.TBL. SET USE_WUDAPT_LCZ=1"
endif
if ( (NoahmpIO%use_wudapt_lcz == 1) .and. (max_utype_urb2d <= 3.0) ) then ! new LCZ
if ( (NoahmpIO%use_wudapt_lcz == 1) .and. (max_landtype2d <= 50.0) ) then ! LCZ number: 51~61
stop "USING URBPARM_LCZ.TBL WITH OLD 3 URBAN CLASSES. SET USE_WUDAPT_LCZ=0"
endif

endif !urban

if ( NoahmpIO%SF_URBAN_PHYSICS > 1 ) then !urban
Expand Down Expand Up @@ -874,27 +873,37 @@ subroutine land_driver_exe(itime)
NoahmpIO%SWDDIF = NoahmpIO%SWDOWN * 0.3 ! following noahmplsm ATM 30% diffuse radiation
IF(NoahmpIO%SF_URBAN_PHYSICS == 2 .or. NoahmpIO%SF_URBAN_PHYSICS == 3) THEN ! BEP or BEM urban models
where(NoahmpIO%XLAND < 1.5) NoahmpIO%p_urban(:,NoahmpIO%kde,:) = NoahmpIO%p8w(:,1,:)
where(NoahmpIO%XLAND < 1.5) NoahmpIO%rho_urban(:,NoahmpIO%kde,:) = NoahmpIO%p8w(:,1,:) /287.04/NoahmpIO%t_phy(:,1,:)
where(NoahmpIO%XLAND < 1.5) NoahmpIO%p_urban (:,NoahmpIO%kde,:) = NoahmpIO%p8w(:,1,:)
where(NoahmpIO%XLAND < 1.5) NoahmpIO%rho_urban (:,NoahmpIO%kde,:) = NoahmpIO%p8w(:,1,:) /287.04/NoahmpIO%t_phy(:,1,:)
where(NoahmpIO%XLAND < 1.5) NoahmpIO%theta_urban(:,NoahmpIO%kde,:) = NoahmpIO%t_phy(:,1,:)*&
(100000.0/NoahmpIO%p8w(:,1,:))**(0.285714)
where(NoahmpIO%XLAND < 1.5) NoahmpIO%u_urban(:,NoahmpIO%kde,:) = NoahmpIO%u_phy(:,1,:)
where(NoahmpIO%XLAND < 1.5) NoahmpIO%v_urban(:,NoahmpIO%kde,:) = NoahmpIO%v_phy(:,1,:)
(100000.0/NoahmpIO%p8w(:,1,:))**(0.285714)
where(NoahmpIO%XLAND < 1.5) NoahmpIO%u_urban (:,NoahmpIO%kde,:) = NoahmpIO%u_phy(:,1,:)
where(NoahmpIO%XLAND < 1.5) NoahmpIO%v_urban (:,NoahmpIO%kde,:) = NoahmpIO%v_phy(:,1,:)
! allow one more dummy layer at the top to be consistent with cell interface array dimension
NoahmpIO%p_urban (:,NoahmpIO%kde-1,:) = NoahmpIO%p_urban(:,NoahmpIO%kde,:)
NoahmpIO%rho_urban (:,NoahmpIO%kde-1,:) = NoahmpIO%rho_urban(:,NoahmpIO%kde,:)
NoahmpIO%theta_urban(:,NoahmpIO%kde-1,:) = NoahmpIO%theta_urban(:,NoahmpIO%kde,:)
NoahmpIO%u_urban (:,NoahmpIO%kde-1,:) = NoahmpIO%u_urban(:,NoahmpIO%kde,:)
NoahmpIO%v_urban (:,NoahmpIO%kde-1,:) = NoahmpIO%v_urban(:,NoahmpIO%kde,:)
NoahmpIO%height_urban = 0.5*(NoahmpIO%dz_urban(1,NoahmpIO%kde-1,1) + &
NoahmpIO%dz_urban(1,NoahmpIO%kde-2,1))
NoahmpIO%height_urban = 0.5*(NoahmpIO%dz_urban(1,NoahmpIO%kde,1) + &
NoahmpIO%dz_urban(1,NoahmpIO%kde-1,1))
do i = 3, NoahmpIO%kde
where(NoahmpIO%XLAND < 1.5) NoahmpIO%QV_CURR(:,i,:) = NoahmpIO%QV_CURR(:,1,:)
enddo
DO I = NoahmpIO%KDE-1, NoahmpIO%KDS, -1
DO I = NoahmpIO%kde-2, NoahmpIO%kds, -1
where(NoahmpIO%XLAND < 1.5) NoahmpIO%p_urban(:,i,:) = NoahmpIO%p8w(:,1,:)* &
exp(9.8*NoahmpIO%height_urban/287.04/NoahmpIO%t_phy(:,1,:))
where(NoahmpIO%XLAND < 1.5) NoahmpIO%rho_urban(:,i,:) = NoahmpIO%p_urban(:,i,:)/287.04/ &
NoahmpIO%t_phy(:,1,:)
exp(9.8*NoahmpIO%height_urban/287.04/NoahmpIO%t_phy(:,1,:))
where(NoahmpIO%XLAND < 1.5) NoahmpIO%rho_urban(:,i,:) = NoahmpIO%p_urban(:,i,:)/287.04/NoahmpIO%t_phy(:,1,:)
where(NoahmpIO%XLAND < 1.5) NoahmpIO%theta_urban(:,i,:) = NoahmpIO%t_phy(:,1,:)* &
(100000.0/NoahmpIO%p_urban(:,i,:))**(0.285714)
(100000.0/NoahmpIO%p_urban(:,i,:))**(0.285714)
where(NoahmpIO%XLAND < 1.5) NoahmpIO%u_urban(:,i,:) = NoahmpIO%u_urban(:,NoahmpIO%kde,:)* &
log(NoahmpIO%zlvl-NoahmpIO%height_urban)/log(NoahmpIO%zlvl)
log(max(NoahmpIO%zlvl-NoahmpIO%height_urban,1.001))/log(NoahmpIO%zlvl)
where(NoahmpIO%XLAND < 1.5) NoahmpIO%v_urban(:,i,:) = NoahmpIO%v_urban(:,NoahmpIO%kde,:)* &
log(NoahmpIO%zlvl-NoahmpIO%height_urban)/log(NoahmpIO%zlvl)
log(max(NoahmpIO%zlvl-NoahmpIO%height_urban,1.001))/log(NoahmpIO%zlvl)
NoahmpIO%height_urban = NoahmpIO%height_urban + NoahmpIO%urban_atmosphere_thickness
END DO
ENDIF
Expand Down
4 changes: 2 additions & 2 deletions hrldas/arch/user_build_options.gfortran.mpi
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
NETCDFMOD = -I/glade/u/apps/ch/opt/netcdf/4.8.1/gnu/10.1.0/include
NETCDFLIB = -L/glade/u/apps/ch/opt/netcdf/4.8.1/gnu/10.1.0/lib -lnetcdf -lnetcdff
BZIP2 = NO
BZIP2_INCLUDE = -I/usr/include
BZIP2_LIB = -L/usr/lib64 -lbz2
# BZIP2_INCLUDE = -I/usr/include
# BZIP2_LIB = -L/usr/lib64 -lbz2
RM = rm -f
CC = cc
4 changes: 2 additions & 2 deletions hrldas/arch/user_build_options.gfortran.serial
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
NETCDFMOD = -I/glade/u/apps/ch/opt/netcdf/4.8.1/gnu/10.1.0/include
NETCDFLIB = -L/glade/u/apps/ch/opt/netcdf/4.8.1/gnu/10.1.0/lib -lnetcdf -lnetcdff
BZIP2 = NO
BZIP2_INCLUDE = -I/usr/include
BZIP2_LIB = -L/usr/lib64 -lbz2
# BZIP2_INCLUDE = -I/usr/include
# BZIP2_LIB = -L/usr/lib64 -lbz2
RM = rm -f
CC = cc
8 changes: 4 additions & 4 deletions hrldas/arch/user_build_options.gfortran.serial2
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@
CPP = cpp
CPPFLAGS = -P -traditional -D_GFORTRAN_
LIBS =
LIBJASPER = -L/home/xue/Build_WRF/LIBRARIES/grib2/lib -ljasper -ljpeg
INCJASPER = -I/home/xue/Build_WRF/LIBRARIES/grib2/include
LIBJASPER = -L/home/xxxxx/Build_WRF/LIBRARIES/grib2/lib -ljasper -ljpeg
INCJASPER = -I/home/xxxxx/Build_WRF/LIBRARIES/grib2/include
NETCDFMOD = -I/usr/include/
NETCDFLIB = -L/usr/lib -lnetcdf -lnetcdff
BZIP2 = NO
BZIP2_INCLUDE = -I/usr/include
BZIP2_LIB = -L/usr/x86_64-linux-gnu -lbz2
# BZIP2_INCLUDE = -I/usr/include
# BZIP2_LIB = -L/usr/x86_64-linux-gnu -lbz2
RM = rm -f
CC = cc
6 changes: 3 additions & 3 deletions hrldas/arch/user_build_options.ifort.mpi
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
COMPILERF90 = mpif90
MPPFLAG = YES
FREESOURCE = -free
F90FLAGS = -convert big_endian -g -O0 -fpe0
F90FLAGS = -convert big_endian -g -O0 -fpe0 # -traceback
MODFLAG = -I ../MPP
HYDRO_LIB = ../MPP/mpp_land.o ../MPP/CPL_WRF.o
LDFLAGS =
Expand All @@ -18,7 +18,7 @@
NETCDFMOD = -I/glade/u/apps/ch/opt/netcdf/4.8.1/intel/19.1.1/include
NETCDFLIB = -L/glade/u/apps/ch/opt/netcdf/4.8.1/intel/19.1.1/lib -lnetcdf -lnetcdff
BZIP2 = NO
BZIP2_INCLUDE = -I/usr/include
BZIP2_LIB = -L/usr/lib64 -lbz2
# BZIP2_INCLUDE = -I/usr/include
# BZIP2_LIB = -L/usr/lib64 -lbz2
RM = rm -f
CC = cc
6 changes: 3 additions & 3 deletions hrldas/arch/user_build_options.ifort.serial
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

COMPILERF90 = ifort
FREESOURCE = -free
F90FLAGS = -convert big_endian -g -O0 -fpe0
F90FLAGS = -convert big_endian -g -O0 -fpe0 # -traceback
MODFLAG = -I
LDFLAGS =
CPP = cpp
Expand All @@ -16,7 +16,7 @@
NETCDFMOD = -I/glade/u/apps/ch/opt/netcdf/4.8.1/intel/19.1.1/include
NETCDFLIB = -L/glade/u/apps/ch/opt/netcdf/4.8.1/intel/19.1.1/lib -lnetcdf -lnetcdff
BZIP2 = NO
BZIP2_INCLUDE = -I/usr/include
BZIP2_LIB = -L/usr/lib64 -lbz2
# BZIP2_INCLUDE = -I/usr/include
# BZIP2_LIB = -L/usr/lib64 -lbz2
RM = rm -f
CC = cc
22 changes: 22 additions & 0 deletions hrldas/arch/user_build_options.ifort.serial2
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

#=============================================================================================
# Options for Linux with Intel Fortran
#=============================================================================================

COMPILERF90 = ifort
FREESOURCE = -free
F90FLAGS = -convert big_endian -g -O0 -fpe0 -traceback
MODFLAG = -I
LDFLAGS =
CPP = cpp
CPPFLAGS = -P -traditional
LIBS =
LIBJASPER = -L/usr/local/jasper-1.701.0/lib -ljasper
INCJASPER = -I/usr/local/jasper-1.701.0/include
NETCDFMOD = -I/work/xxxxx/env/netcdf-c4.7.4-f4.5.3/include
NETCDFLIB = -L/work/xxxxx/env/netcdf-c4.7.4-f4.5.3/lib -lnetcdf -lnetcdff
BZIP2 = NO
#BZIP2_INCLUDE = -I/usr/include
#BZIP2_LIB = -L/usr/lib64 -lbz2
RM = rm -f
CC = gcc
4 changes: 2 additions & 2 deletions hrldas/arch/user_build_options.pgi.mpi
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
NETCDFMOD = -I/glade/u/apps/ch/opt/netcdf/4.7.4/pgi/20.4/include
NETCDFLIB = -L/glade/u/apps/ch/opt/netcdf/4.7.4/pgi/20.4/lib -lnetcdf -lnetcdff
BZIP2 = NO
BZIP2_LIB = -L/usr/lib64 -lbz2
BZIP2_INCLUDE = -I/usr/include
# BZIP2_LIB = -L/usr/lib64 -lbz2
# BZIP2_INCLUDE = -I/usr/include
RM = rm -f
CC = cc

4 changes: 2 additions & 2 deletions hrldas/arch/user_build_options.pgi.serial
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
NETCDFMOD = -I/glade/u/apps/ch/opt/netcdf/4.7.4/pgi/20.4/include
NETCDFLIB = -L/glade/u/apps/ch/opt/netcdf/4.7.4/pgi/20.4/lib -lnetcdf -lnetcdff
BZIP2 = NO
BZIP2_LIB = -lbz2
BZIP2_INCLUDE = -I/usr/include
# BZIP2_LIB = -lbz2
# BZIP2_INCLUDE = -I/usr/include
RM = rm -f
CC = cc
6 changes: 3 additions & 3 deletions hrldas/user_build_options
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
COMPILERF90 = mpif90
MPPFLAG = YES
FREESOURCE = -free
F90FLAGS = -convert big_endian -g -O0 -fpe0
F90FLAGS = -convert big_endian -g -O0 -fpe0 # -traceback
MODFLAG = -I ../MPP
HYDRO_LIB = ../MPP/mpp_land.o ../MPP/CPL_WRF.o
LDFLAGS =
Expand All @@ -18,7 +18,7 @@
NETCDFMOD = -I/glade/u/apps/ch/opt/netcdf/4.8.1/intel/19.1.1/include
NETCDFLIB = -L/glade/u/apps/ch/opt/netcdf/4.8.1/intel/19.1.1/lib -lnetcdf -lnetcdff
BZIP2 = NO
BZIP2_INCLUDE = -I/usr/include
BZIP2_LIB = -L/usr/lib64 -lbz2
# BZIP2_INCLUDE = -I/usr/include
# BZIP2_LIB = -L/usr/lib64 -lbz2
RM = rm -f
CC = cc
2 changes: 1 addition & 1 deletion urban/wrf/NoahmpUrbanDriverMainMod.F
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@ SUBROUTINE noahmp_urban( NoahmpIO,sf_urban_physics, NSOIL, IVGTYP,IT
tsk(i,j) = (max(0., (-1.*rl_up_tot-(1.-emiss(i,j))*glw(i,j) )/emiss(i,j)/sigma_sb))**.25
rs_abs_tot = (1.-frc_urb2d(i,j))*swdown(i,j)*(1.-albedo(i,j))+frc_urb2d(i,j)*rs_abs_urb(i,j)

if(swdown(i,j) > 0.)then
if((swdown(i,j) > 0.0) .and. (cosz_urb2d(i,j)>0.0))then
albedo(i,j) = 1.-rs_abs_tot/swdown(i,j)
else
albedo(i,j) = alb_rural(i,j)
Expand Down
Loading

0 comments on commit 8732faf

Please sign in to comment.