diff --git a/include/define.h b/include/define.h index 7c2ba202..2913f9e8 100755 --- a/include/define.h +++ b/include/define.h @@ -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 @@ -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 diff --git a/main/LULCC/MOD_Lulcc_Driver.F90 b/main/LULCC/MOD_Lulcc_Driver.F90 index 29c30816..268c8e4a 100644 --- a/main/LULCC/MOD_Lulcc_Driver.F90 +++ b/main/LULCC/MOD_Lulcc_Driver.F90 @@ -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 diff --git a/main/MOD_Vars_TimeInvariants.F90 b/main/MOD_Vars_TimeInvariants.F90 index 556e2ba5..1c68499c 100644 --- a/main/MOD_Vars_TimeInvariants.F90 +++ b/main/MOD_Vars_TimeInvariants.F90 @@ -364,17 +364,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 diff --git a/mkinidata/MOD_UrbanReadin.F90 b/mkinidata/MOD_UrbanReadin.F90 index 3178a6f2..2743dde6 100644 --- a/mkinidata/MOD_UrbanReadin.F90 +++ b/mkinidata/MOD_UrbanReadin.F90 @@ -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' diff --git a/mksrfdata/Aggregation_Urban.F90 b/mksrfdata/Aggregation_Urban.F90 index 5ed49b34..f078e39b 100644 --- a/mksrfdata/Aggregation_Urban.F90 +++ b/mksrfdata/Aggregation_Urban.F90 @@ -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, & @@ -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 diff --git a/mksrfdata/MOD_SingleSrfdata.F90 b/mksrfdata/MOD_SingleSrfdata.F90 index cedd1cb6..353cd6d3 100644 --- a/mksrfdata/MOD_SingleSrfdata.F90 +++ b/mksrfdata/MOD_SingleSrfdata.F90 @@ -378,8 +378,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 diff --git a/share/MOD_Namelist.F90 b/share/MOD_Namelist.F90 index 31f7bab9..d697a399 100644 --- a/share/MOD_Namelist.F90 +++ b/share/MOD_Namelist.F90 @@ -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. @@ -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 @@ -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, & @@ -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(*,*) ' ***** ' @@ -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 @@ -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) @@ -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) @@ -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)