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

1) add urban geometric data options and standardize data file and var names [by @Wenzong Dong]; 2) refine urban model dependence; 3) add descriptions for LULCC adding variables [by @Wanyi Lin]. #348

Merged
merged 18 commits into from
Jan 3, 2025
Merged
Show file tree
Hide file tree
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
16 changes: 12 additions & 4 deletions include/define.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@

! 2.1 3D Urban model (put it temporarily here):
#undef URBAN_MODEL
! Dependence: only LULC_IGBP subgrid type for
! single point URBAN_MODEL right now.
#if (defined URBAN_MODEL && defined SinglePoint)
#define LULC_IGBP
#undef LULC_USGS
#undef LULC_IGBP_PFT
#undef LULC_IGBP_PC
#endif

! 3. If defined, debug information is output.
#define CoLMDEBUG
Expand Down Expand Up @@ -64,10 +72,10 @@
#undef DataAssimilation

! 10. Vector write model.
! 1) "VectorInOneFileP" : write vector data in one file in parallel mode;
! 2) "VectorInOneFileS" : write vector data in one file in serial mode;
! 3) Neither "VectorInOneFileS" nor "VectorInOneFileP" is defined :
! write vector data in separate files.
! 1) "VectorInOneFileP" : write vector data in one file in parallel mode;
! 2) "VectorInOneFileS" : write vector data in one file in serial mode;
! 3) Neither "VectorInOneFileS" nor "VectorInOneFileP" is defined :
! write vector data in separate files.
#undef VectorInOneFileP
! Conflict
#ifdef VectorInOneFileP
Expand Down
32 changes: 32 additions & 0 deletions main/LULCC/MOD_Lulcc_Driver.F90
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,38 @@ SUBROUTINE LulccDriver (casename,dir_landdata,dir_restart,&
! 07/2023, Wenzong Dong: porting to MPI version.
! 08/2023, Wanyi Lin: add interface for Mass&Energy conserved scheme.
!
! Extra processes when adding a new variable and #define LULCC:
!
! 1. Save a copy of new variable (if called "var", save it to "var_") with 2 steps:
! 1.1 main/LULCC/MOD_Lulcc_Vars_TimeVariables.F90's subroutine "allocate_LulccTimeVariables":
! allocate (var_(dimension))
! 1.2 main/LULCC/MOD_Lulcc_Vars_TimeVariables.F90's subroutine "SAVE_LulccTimeVariables":
! var_ = var
!
! 2. Reassignment for the next year
! 2.1 if used Same Type Assignment (SAT) scheme for variable recovery
! main/LULCC/MOD_Lulcc_Vars_TimeVariables.F90's subroutine "REST_LulccTimeVariables"
! var(np) = var_(np_)
!
! 2.2 if using Mass and Energy conservation (MEC) scheme for variable recovery
! 2.2.1 main/LULCC/MOD_Lulcc_Vars_TimeVariables.F90's subroutine "REST_LulccTimeVariables":
! var(np) = var_(np_)
!
! 2.2.2 [No need for PFT/PC scheme] Mass and Energy conserve adjustment, add after line 519
! of MOD_Lulcc_MassEnergyConserve.F90.
!
! o if variable should be mass conserved:
! var(:,np) = var(:,np) + var(:,frnp_(k))*lccpct_np(patchclass_(frnp_(k)))/sum_lccpct_np
!
! o if variable should be energy conserved, take soil temperature "t_soisno" as an example: [May neeed extra calculation]
! t_soisno (1:nl_soil,np) = t_soisno (1:nl_soil,np) + &
! t_soisno_(1:nl_soil,frnp_(k))*cvsoil_(1:nl_soil,k)*lccpct_np(patchclass_(frnp_(k)))/wgt(1:nl_soil)
! where cvsoil_ is the heat capacity, wgt is the sum of cvsoil_(1:nl_soil,k)*lccpct_np(patchclass_(frnp_(k))),
! which need to be calculated in advance.
!
! 3. Deallocate the copy of new variable in MOD_Lulcc_Vars_TimeVariables.F90's subroutine "deallocate_LulccTimeVariables":
! deallocate (var_)
!
!-----------------------------------------------------------------------

USE MOD_Precision
Expand Down
18 changes: 10 additions & 8 deletions main/MOD_Vars_TimeInvariants.F90
Original file line number Diff line number Diff line change
Expand Up @@ -361,17 +361,19 @@ SUBROUTINE allocate_TimeInvariants ()
allocate (topoelv (numpatch))
allocate (topostd (numpatch))

! Used for downscaling
allocate (svf_patches (numpatch))
allocate (asp_type_patches (num_slope_type,numpatch))
allocate (slp_type_patches (num_slope_type,numpatch))
allocate (area_type_patches (num_slope_type,numpatch))
allocate (cur_patches (numpatch))
IF (DEF_USE_Forcing_Downscaling) THEN
! Used for downscaling
allocate (svf_patches (numpatch))
allocate (asp_type_patches (num_slope_type,numpatch))
allocate (slp_type_patches (num_slope_type,numpatch))
allocate (area_type_patches (num_slope_type,numpatch))
allocate (cur_patches (numpatch))
#ifdef SinglePoint
allocate (sf_lut_patches (num_azimuth,num_zenith,numpatch))
allocate (sf_lut_patches (num_azimuth,num_zenith,numpatch))
#else
allocate (sf_curve_patches (num_azimuth,num_zenith_parameter,numpatch))
allocate (sf_curve_patches (num_azimuth,num_zenith_parameter,numpatch))
#endif
ENDIF
ENDIF
ENDIF

Expand Down
2 changes: 1 addition & 1 deletion mkinidata/MOD_UrbanReadin.F90
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ SUBROUTINE Urban_readin (dir_landdata, lc_year)
lndname = trim(dir_landdata)//'/urban/'//trim(cyear)//'/POP.nc'
CALL ncio_read_vector (lndname, 'POP_DEN' , landurban, pop_den )

lndname = trim(dir_landdata)//'/urban/'//trim(cyear)//'/LUCY_country_id.nc'
lndname = trim(dir_landdata)//'/urban/'//trim(cyear)//'/LUCY_region_id.nc'
CALL ncio_read_vector (lndname, 'LUCY_id' , landurban, lucyid )

lndname = trim(dir_landdata)//'/urban/'//trim(cyear)//'/WT_ROOF.nc'
Expand Down
16 changes: 9 additions & 7 deletions mksrfdata/Aggregation_Urban.F90
Original file line number Diff line number Diff line change
Expand Up @@ -511,11 +511,13 @@ SUBROUTINE Aggregation_Urban (dir_rawdata, dir_srfdata, lc_year, &

landdir = TRIM(dir_rawdata)//'/urban/'
suffix = 'URBSRF'//trim(c5year)
CALL read_5x5_data (landdir, suffix, grid_urban_500m, "PCT_ROOF", wtrf)

landdir = TRIM(dir_rawdata)//'/urban/'
suffix = 'URBSRF'//trim(c5year)
CALL read_5x5_data (landdir, suffix, grid_urban_500m, "HT_ROOF", htrf)
IF (DEF_Urban_geom_data == 1) THEN
CALL read_5x5_data (landdir, suffix, grid_urban_500m, "PCT_ROOF_GHSL", wtrf)
CALL read_5x5_data (landdir, suffix, grid_urban_500m, "HT_ROOF_GHSL" , htrf)
ELSE
CALL read_5x5_data (landdir, suffix, grid_urban_500m, "PCT_ROOF_Li", wtrf)
CALL read_5x5_data (landdir, suffix, grid_urban_500m, "HT_ROOF_Li" , htrf)
ENDIF

#ifdef USEMPI
CALL aggregation_data_daemon (grid_urban_500m, data_i4_2d_in1 = reg_typid, &
Expand Down Expand Up @@ -667,8 +669,8 @@ SUBROUTINE Aggregation_Urban (dir_rawdata, dir_srfdata, lc_year, &
CALL system('mkdir -p ' // trim(adjustl(landsrfdir)))

! allocate and read grided LSAI raw data
landdir = trim(dir_rawdata)//'/urban_lai_5x5/'
suffix = 'UrbLAI_'//trim(iyear)
landdir = trim(dir_rawdata)//'/urban_lai_500m/'
suffix = 'URBLAI_'//trim(iyear)
! loop for month
DO imonth = 1, 12

Expand Down
2 changes: 1 addition & 1 deletion mksrfdata/MOD_SingleSrfdata.F90
Original file line number Diff line number Diff line change
Expand Up @@ -375,8 +375,8 @@ SUBROUTINE read_urban_surface_data_single (fsrfdata, mksrfdata, mkrun)
CALL ncio_read_serial (fsrfdata, 'wall_to_plan_area_ratio' , SITE_lambdaw )
SITE_hlr = SITE_lambdaw/4/SITE_froof
ENDIF

SITE_fgper = 1 - (SITE_fgimp-SITE_froof)/(1-SITE_froof-SITE_flake_urb)
SITE_froof = SITE_froof/(1-SITE_flake_urb)
SITE_fveg_urb = SITE_fveg_urb * 100
SITE_flake_urb = SITE_flake_urb * 100
ENDIF
Expand Down
24 changes: 16 additions & 8 deletions share/MOD_Namelist.F90
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ MODULE MOD_Namelist
! 1: NCAR Urban Classification, 3 urban type with Tall Building, High Density and Medium Density
! 2: LCZ Classification, 10 urban type with LCZ 1-10
integer :: DEF_URBAN_type_scheme = 1
integer :: DEF_URBAN_geom_data = 1
logical :: DEF_URBAN_ONLY = .false.
logical :: DEF_URBAN_RUN = .false.
logical :: DEF_URBAN_BEM = .true.
Expand Down Expand Up @@ -938,6 +939,7 @@ SUBROUTINE read_namelist (nlfile)
DEF_LULCC_SCHEME, &

DEF_URBAN_type_scheme, &
DEF_URBAN_geom_data, &
DEF_URBAN_ONLY, &
DEF_URBAN_RUN, & !add by hua yuan, open urban model or not
DEF_URBAN_BEM, & !add by hua yuan, open urban BEM model or not
Expand Down Expand Up @@ -1016,7 +1018,7 @@ SUBROUTINE read_namelist (nlfile)
DEF_Forcing_Interp_Method, &

DEF_USE_Forcing_Downscaling, &
DEF_DS_HiresTopographyDataDir, &
DEF_DS_HiresTopographyDataDir, &
DEF_DS_precipitation_adjust_scheme, &
DEF_DS_longwave_adjust_scheme, &

Expand Down Expand Up @@ -1240,10 +1242,15 @@ SUBROUTINE read_namelist (nlfile)
#ifdef URBAN_MODEL
DEF_URBAN_RUN = .true.

IF (DEF_USE_SNICAR) THEN
write(*,*) ' ***** '
write(*,*) 'Note: SNICAR is not applied for URBAN model, but for other land covers. '
ENDIF
write(*,*) ' ***** '
write(*,*) 'When URBAN model is opened, WUEST/SUPERCOOL_WATER/PLANTHYDRAULICS/OZONESTRESS/SOILSNOW'
write(*,*) 'will be set to false automatically for simplicity.'
DEF_USE_WUEST = .false.
DEF_USE_SUPERCOOL_WATER = .false.
DEF_USE_PLANTHYDRAULICS = .false.
DEF_USE_OZONESTRESS = .false.
DEF_USE_OZONEDATA = .false.
DEF_SPLIT_SOILSNOW = .false.
#else
IF (DEF_URBAN_RUN) THEN
write(*,*) ' ***** '
Expand Down Expand Up @@ -1323,7 +1330,7 @@ SUBROUTINE read_namelist (nlfile)
write(*,*) 'If both DEF_USE_SoilInit and DEF_USE_WaterTableInit are .TRUE., '
write(*,*) 'initial value of water table depth is read from DEF_file_SoilInit,'
write(*,*) 'instead of DEF_file_WaterTable (which is useless in this CASE). '
ENDIF
ENDIF

! ----- dynamic lake run ----- Macros&Namelist conflicts and dependency management

Expand Down Expand Up @@ -1434,6 +1441,7 @@ SUBROUTINE read_namelist (nlfile)
CALL mpi_bcast (DEF_LULCC_SCHEME ,1 ,mpi_integer ,p_address_master ,p_comm_glb ,p_err)

CALL mpi_bcast (DEF_URBAN_type_scheme ,1 ,mpi_integer ,p_address_master ,p_comm_glb ,p_err)
CALL mpi_bcast (DEF_URBAN_geom_data ,1 ,mpi_integer ,p_address_master ,p_comm_glb ,p_err)
! 05/2023, added by yuan
CALL mpi_bcast (DEF_URBAN_ONLY ,1 ,mpi_logical ,p_address_master ,p_comm_glb ,p_err)
CALL mpi_bcast (DEF_URBAN_RUN ,1 ,mpi_logical ,p_address_master ,p_comm_glb ,p_err)
Expand Down Expand Up @@ -1505,7 +1513,7 @@ SUBROUTINE read_namelist (nlfile)
CALL mpi_bcast (DEF_file_snowaging ,256 ,mpi_character ,p_address_master ,p_comm_glb ,p_err)

CALL mpi_bcast (DEF_CaMa_Namelist ,256 ,mpi_character ,p_address_master ,p_comm_glb ,p_err)

CALL mpi_bcast (DEF_ElementNeighbour_file ,256 ,mpi_character ,p_address_master ,p_comm_glb ,p_err)

CALL mpi_bcast (DEF_DA_obsdir ,256 ,mpi_character ,p_address_master ,p_comm_glb ,p_err)
Expand Down Expand Up @@ -1937,7 +1945,7 @@ SUBROUTINE sync_hist_vars (set_defaults)
CALL sync_hist_vars_one (DEF_hist_vars%deadcrootn_xferCap , set_defaults)
CALL sync_hist_vars_one (DEF_hist_vars%t_scalar , set_defaults)
CALL sync_hist_vars_one (DEF_hist_vars%w_scalar , set_defaults)

CALL sync_hist_vars_one (DEF_hist_vars%litr1cCap_vr , set_defaults)
CALL sync_hist_vars_one (DEF_hist_vars%litr2cCap_vr , set_defaults)
CALL sync_hist_vars_one (DEF_hist_vars%litr3cCap_vr , set_defaults)
Expand Down
Loading