From d09f829d22aa4912aca394a078e62c3649308f87 Mon Sep 17 00:00:00 2001 From: tungwz Date: Mon, 23 Dec 2024 10:59:33 +0800 Subject: [PATCH 1/9] -mod(mksrfdata/*.F90): Data read modification -mod(mkinidata/MOD_UrbanReadin.F90): change name of LUCY data -mod(share/MOD_Namelist.F90): add data option -mod(include/define.h): IGBP classification is mandatory for urban single points --- include/define.h | 26 +++++++++++++++----------- mkinidata/MOD_UrbanReadin.F90 | 2 +- mksrfdata/Aggregation_Urban.F90 | 16 +++++++++------- mksrfdata/MOD_SingleSrfdata.F90 | 2 +- share/MOD_Namelist.F90 | 12 +++++++++++- 5 files changed, 37 insertions(+), 21 deletions(-) diff --git a/include/define.h b/include/define.h index 7c2ba202..14244c6b 100755 --- a/include/define.h +++ b/include/define.h @@ -1,9 +1,9 @@ ! 1. Spatial structure: ! Select one of the following options. -#define GRIDBASED +#undef GRIDBASED #undef CATCHMENT #undef UNSTRUCTURED -#undef SinglePoint +#define SinglePoint ! 2. Land subgrid type classification: ! Select one of the following options. @@ -13,26 +13,30 @@ #undef LULC_IGBP_PC ! 2.1 3D Urban model (put it temporarily here): -#undef URBAN_MODEL +#define URBAN_MODEL ! 3. If defined, debug information is output. #define CoLMDEBUG ! 3.1 If defined, range of variables is checked. #define RangeCheck ! 3.1 If defined, surface data in vector is mapped to gridded data for checking. -#undef SrfdataDiag +#define SrfdataDiag ! 4. If defined, MPI parallelization is enabled. -#define USEMPI +#undef USEMPI ! Conflict: not used when defined SingPoint. #if (defined SinglePoint) #undef USEMPI #endif +#if (defined SinglePoint && defined URBAN_MODEL && undefined LULC_IGBP) +#define LULC_IGBP +#endif + ! 5. Hydrological process options. ! 5.1 Two soil hydraulic models can be used. -#undef Campbell_SOIL_MODEL -#define vanGenuchten_Mualem_SOIL_MODEL +#define Campbell_SOIL_MODEL +#undef vanGenuchten_Mualem_SOIL_MODEL ! 5.2 If defined, lateral flow is modeled. #define CatchLateralFlow ! Conflicts : @@ -64,10 +68,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/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..0261ef9e 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_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 a4acd985..e20be13c 100644 --- a/mksrfdata/MOD_SingleSrfdata.F90 +++ b/mksrfdata/MOD_SingleSrfdata.F90 @@ -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 diff --git a/share/MOD_Namelist.F90 b/share/MOD_Namelist.F90 index 8b191992..bee38d77 100644 --- a/share/MOD_Namelist.F90 +++ b/share/MOD_Namelist.F90 @@ -220,6 +220,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_data = 1 logical :: DEF_URBAN_ONLY = .false. logical :: DEF_URBAN_RUN = .false. logical :: DEF_URBAN_BEM = .true. @@ -871,6 +872,7 @@ SUBROUTINE read_namelist (nlfile) DEF_LULCC_SCHEME, & DEF_URBAN_type_scheme, & + DEF_URBAN_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 @@ -1160,7 +1162,14 @@ SUBROUTINE read_namelist (nlfile) IF (DEF_USE_SNICAR) THEN write(*,*) ' ***** ' - write(*,*) 'Note: SNICAR is not applied for URBAN model, but for other land covers. ' + write(*,*) 'When URBAN model is opened, WUEST/SUPERCOOL_WATER/PLANTHYDRAULICS/OZONESTRESS/SOILSNOW' + write(*,*) 'will be set to false automatically.' + 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. ENDIF #else IF (DEF_URBAN_RUN) THEN @@ -1343,6 +1352,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_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) From 5967b5e9528ce985398cad9e4a3d2f5a38eafd2f Mon Sep 17 00:00:00 2001 From: dongwz <49752101+tungwz@users.noreply.github.com> Date: Mon, 23 Dec 2024 11:03:55 +0800 Subject: [PATCH 2/9] Update define.h --- include/define.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/include/define.h b/include/define.h index 14244c6b..26d9efe5 100755 --- a/include/define.h +++ b/include/define.h @@ -1,9 +1,9 @@ ! 1. Spatial structure: ! Select one of the following options. -#undef GRIDBASED +#define GRIDBASED #undef CATCHMENT #undef UNSTRUCTURED -#define SinglePoint +#undef SinglePoint ! 2. Land subgrid type classification: ! Select one of the following options. @@ -13,17 +13,17 @@ #undef LULC_IGBP_PC ! 2.1 3D Urban model (put it temporarily here): -#define URBAN_MODEL +#undef URBAN_MODEL ! 3. If defined, debug information is output. #define CoLMDEBUG ! 3.1 If defined, range of variables is checked. #define RangeCheck ! 3.1 If defined, surface data in vector is mapped to gridded data for checking. -#define SrfdataDiag +#undef SrfdataDiag ! 4. If defined, MPI parallelization is enabled. -#undef USEMPI +#define USEMPI ! Conflict: not used when defined SingPoint. #if (defined SinglePoint) #undef USEMPI @@ -35,8 +35,8 @@ ! 5. Hydrological process options. ! 5.1 Two soil hydraulic models can be used. -#define Campbell_SOIL_MODEL -#undef vanGenuchten_Mualem_SOIL_MODEL +#undef Campbell_SOIL_MODEL +#define vanGenuchten_Mualem_SOIL_MODEL ! 5.2 If defined, lateral flow is modeled. #define CatchLateralFlow ! Conflicts : From 19177da6b91b3e932af44a74038c10d5cbd66681 Mon Sep 17 00:00:00 2001 From: Hua Yuan Date: Mon, 23 Dec 2024 19:53:34 +0800 Subject: [PATCH 3/9] Add dependences for running URBAN_MODEL. -add(include/define.h): add dependences for URBAN model in define.h. --- include/define.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/include/define.h b/include/define.h index 7c2ba202..d2faac3b 100755 --- a/include/define.h +++ b/include/define.h @@ -14,6 +14,12 @@ ! 2.1 3D Urban model (put it temporarily here): #undef URBAN_MODEL +#if (defined URBAN_MODEL && defined SinglePoint) +#undef LULC_USGS +#define LULC_IGBP +#undef LULC_IGBP_PFT +#undef LULC_IGBP_PC +#endif ! 3. If defined, debug information is output. #define CoLMDEBUG @@ -64,10 +70,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 From 117154ec91dde03687d7fe497afbd49686b8aebb Mon Sep 17 00:00:00 2001 From: Hua Yuan Date: Mon, 23 Dec 2024 20:03:55 +0800 Subject: [PATCH 4/9] Modify dependence for URBAN_MODEL. -mod(include/define.h): modify dependence for urban model. --- include/define.h | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/include/define.h b/include/define.h index e80501d2..b2acca76 100755 --- a/include/define.h +++ b/include/define.h @@ -14,9 +14,10 @@ ! 2.1 3D Urban model (put it temporarily here): #undef URBAN_MODEL +! Dependence: only LULC_IGBP subgrid type for URBAN_MODEL right now. #if (defined URBAN_MODEL && defined SinglePoint) -#undef LULC_USGS #define LULC_IGBP +#undef LULC_USGS #undef LULC_IGBP_PFT #undef LULC_IGBP_PC #endif @@ -35,10 +36,6 @@ #undef USEMPI #endif -#if (defined SinglePoint && defined URBAN_MODEL && undefined LULC_IGBP) -#define LULC_IGBP -#endif - ! 5. Hydrological process options. ! 5.1 Two soil hydraulic models can be used. #undef Campbell_SOIL_MODEL From f73a6750ab3b736524509b79dc598dde17a691a8 Mon Sep 17 00:00:00 2001 From: Hua Yuan Date: Sat, 28 Dec 2024 09:44:35 +0800 Subject: [PATCH 5/9] Refine the URBAN namelist and change DEF_URBAN_data to DEF_URBAN_geom_data. -mod(MOD_Namelist.F90): modify URBAN model dependence and revise the name of DEF_URBAN_data. --- share/MOD_Namelist.F90 | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/share/MOD_Namelist.F90 b/share/MOD_Namelist.F90 index 47b2ddb5..d697a399 100644 --- a/share/MOD_Namelist.F90 +++ b/share/MOD_Namelist.F90 @@ -223,7 +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_data = 1 + integer :: DEF_URBAN_geom_data = 1 logical :: DEF_URBAN_ONLY = .false. logical :: DEF_URBAN_RUN = .false. logical :: DEF_URBAN_BEM = .true. @@ -939,7 +939,7 @@ SUBROUTINE read_namelist (nlfile) DEF_LULCC_SCHEME, & DEF_URBAN_type_scheme, & - DEF_URBAN_data, & + 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 @@ -1018,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, & @@ -1242,17 +1242,15 @@ SUBROUTINE read_namelist (nlfile) #ifdef URBAN_MODEL DEF_URBAN_RUN = .true. - IF (DEF_USE_SNICAR) THEN - write(*,*) ' ***** ' - write(*,*) 'When URBAN model is opened, WUEST/SUPERCOOL_WATER/PLANTHYDRAULICS/OZONESTRESS/SOILSNOW' - write(*,*) 'will be set to false automatically.' - 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. - 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(*,*) ' ***** ' @@ -1332,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 @@ -1443,7 +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_data ,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) @@ -1515,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) @@ -1947,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) From dc8053f2b9795176bd07dd97517b14b19faa8ca6 Mon Sep 17 00:00:00 2001 From: Hua Yuan Date: Sat, 28 Dec 2024 09:49:36 +0800 Subject: [PATCH 6/9] Refine define.h for urban model description. -mod(include/define.h): add notes for run single point urban model. --- include/define.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/define.h b/include/define.h index b2acca76..2913f9e8 100755 --- a/include/define.h +++ b/include/define.h @@ -14,7 +14,8 @@ ! 2.1 3D Urban model (put it temporarily here): #undef URBAN_MODEL -! Dependence: only LULC_IGBP subgrid type for URBAN_MODEL right now. +! 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 From a117d5b6c85e343f08225ca9fdbd416e0107a7c7 Mon Sep 17 00:00:00 2001 From: Hua Yuan Date: Sat, 28 Dec 2024 09:59:02 +0800 Subject: [PATCH 7/9] Change namelist name for urban data. -mod(Aggregation_Urban.F90): change DEF_URBAN_data to DEF_URBAN_geom_data. --- mksrfdata/Aggregation_Urban.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mksrfdata/Aggregation_Urban.F90 b/mksrfdata/Aggregation_Urban.F90 index 0261ef9e..f078e39b 100644 --- a/mksrfdata/Aggregation_Urban.F90 +++ b/mksrfdata/Aggregation_Urban.F90 @@ -511,7 +511,7 @@ SUBROUTINE Aggregation_Urban (dir_rawdata, dir_srfdata, lc_year, & landdir = TRIM(dir_rawdata)//'/urban/' suffix = 'URBSRF'//trim(c5year) -IF (DEF_Urban_data == 1) THEN +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 From 0e6f1b81ff7fe41314166c92bee3879cf127da9a Mon Sep 17 00:00:00 2001 From: linwy20 Date: Sun, 29 Dec 2024 12:17:31 +0800 Subject: [PATCH 8/9] -add(MOD_Vars_TimeInvariants.F90): add IF statement of "Forcing_Downscaling" for allocating related variables to avoild repeatedly allocate when running LULCC. -add(MOD_Lulcc_Driver.F90): description for adding new variable when #define LULCC. --- main/LULCC/MOD_Lulcc_Driver.F90 | 28 +++++++++++++++++++++++++++- main/MOD_Vars_TimeInvariants.F90 | 18 ++++++++++-------- 2 files changed, 37 insertions(+), 9 deletions(-) diff --git a/main/LULCC/MOD_Lulcc_Driver.F90 b/main/LULCC/MOD_Lulcc_Driver.F90 index 29c30816..732e7fe8 100644 --- a/main/LULCC/MOD_Lulcc_Driver.F90 +++ b/main/LULCC/MOD_Lulcc_Driver.F90 @@ -26,7 +26,33 @@ SUBROUTINE LulccDriver (casename,dir_landdata,dir_restart,& ! !REVISIONS: ! 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 used Mass and Energy conservation (MEC) scheme for variable revocery +! 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 +! if variable should be mass conserve: +! var(:,np) = var(:,np) + var(:,frnp_(k))*lccpct_np(patchclass_(frnp_(k)))/sum_lccpct_np +! if variable should be energy conserve, 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 8494298a..5829ead0 100644 --- a/main/MOD_Vars_TimeInvariants.F90 +++ b/main/MOD_Vars_TimeInvariants.F90 @@ -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 From 0c3b23f98c292ad28696f551b064c17bb920e1cd Mon Sep 17 00:00:00 2001 From: Hua Yuan Date: Sun, 29 Dec 2024 16:00:18 +0800 Subject: [PATCH 9/9] Slightly modify the notes for LULCC adding variables. --- main/LULCC/MOD_Lulcc_Driver.F90 | 34 +++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/main/LULCC/MOD_Lulcc_Driver.F90 b/main/LULCC/MOD_Lulcc_Driver.F90 index 732e7fe8..268c8e4a 100644 --- a/main/LULCC/MOD_Lulcc_Driver.F90 +++ b/main/LULCC/MOD_Lulcc_Driver.F90 @@ -26,33 +26,39 @@ SUBROUTINE LulccDriver (casename,dir_landdata,dir_restart,& ! !REVISIONS: ! 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 +! main/LULCC/MOD_Lulcc_Vars_TimeVariables.F90's subroutine "REST_LulccTimeVariables" ! var(np) = var_(np_) - -! 2.2 if used Mass and Energy conservation (MEC) scheme for variable revocery -! 2.2.1 main/LULCC/MOD_Lulcc_Vars_TimeVariables.F90's subroutine “REST_LulccTimeVariables: +! +! 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 -! if variable should be mass conserve: +! 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 -! if variable should be energy conserve, 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": +! +! 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