From c54900439f642f0d46c2cecbb6af0dd8ce5f5df4 Mon Sep 17 00:00:00 2001 From: Felicitas Date: Sat, 8 Jun 2024 15:58:53 +0200 Subject: [PATCH 1/8] updated paths to most up to date coupled runs --- scripts/start/projects/project_EAT2p0.R | 4 +- .../start/projects/project_EAT2p0_DeepDive.R | 38 +++++++------------ 2 files changed, 16 insertions(+), 26 deletions(-) diff --git a/scripts/start/projects/project_EAT2p0.R b/scripts/start/projects/project_EAT2p0.R index e94183973..6bd47137e 100644 --- a/scripts/start/projects/project_EAT2p0.R +++ b/scripts/start/projects/project_EAT2p0.R @@ -133,9 +133,9 @@ waste <- function(cfg) { # Reference: Humpenöder, F., Popp, A., Merfort, L., Luderer, G., Weindl, I., Bodirsky, B., Stevanović, M., Klein, D., Rodrigues, R., Bauer, N., Dietrich, J., Lotze-Campen, H., & Rockström, J. (2023). Data repository - Dietary shifts increase the feasibility of 1.5°C pathways (Version 1) [Data set]. Zenodo. https://doi.org/10.5281/zenodo.8328217 miti <- function(cfg) { # Mitigation: consistent with 1.5C considering diet change - cfg$path_to_report_ghgprices <- "/p/projects/magpie/users/beier/EL2_DeepDive/remind/output/C_SSP2EU-DSPkB500-noDS-rem-5/REMIND_generic_C_SSP2EU-DSPkB500-noDS-rem-5.mif" + cfg$path_to_report_ghgprices <- "/p/projects/magpie/users/beier/EL2_DeepDive_default/remind/output/C_SSP2EU-DSPkB650-DS_betax_AgMIP-rem-5/REMIND_generic_C_SSP2EU-DSPkB500-noDS-rem-5.mif" cfg$gms$c56_pollutant_prices <- "coupling" - cfg$path_to_report_bioenergy <- "/p/projects/magpie/users/beier/EL2_DeepDive/remind/output/C_SSP2EU-DSPkB500-noDS-rem-5/REMIND_generic_C_SSP2EU-DSPkB500-noDS-rem-5.mif" + cfg$path_to_report_bioenergy <- "/p/projects/magpie/users/beier/EL2_DeepDive_default/remind/output/C_SSP2EU-DSPkB650-DS_betax_AgMIP-rem-5/REMIND_generic_C_SSP2EU-DSPkB500-noDS-rem-5.mif" cfg$gms$c60_2ndgen_biodem <- "coupling" return(cfg) diff --git a/scripts/start/projects/project_EAT2p0_DeepDive.R b/scripts/start/projects/project_EAT2p0_DeepDive.R index a9a21192e..ced82df46 100644 --- a/scripts/start/projects/project_EAT2p0_DeepDive.R +++ b/scripts/start/projects/project_EAT2p0_DeepDive.R @@ -41,6 +41,10 @@ cfg$output <- c( ) +# Set path to own coupled runs: +path2NPIrun <- "/p/projects/magpie/users/beier/EL2_DeepDive_default/remind/output/C_SSP2EU-NPi-rem-5/REMIND_generic_C_SSP2EU-NPi-rem-5.mif" +path2MitigationRun <- "/p/projects/magpie/users/beier/EL2_DeepDive_default/remind/output/C_SSP2EU-DSPkB650-DS_betax_DeepDive_noNDC-rem-5/REMIND_generic_C_SSP2EU-NPi-rem-5.mif" + ####################### # SCENARIO DEFINITION # ####################### @@ -74,13 +78,13 @@ bau <- function(cfg) { cfg$gms$c70_feed_scen <- "ssp2" # default # Mitigation: no mitigation beyond NPi cfg$gms$c56_emis_policy <- "none" - cfg$path_to_report_ghgprices <- "/p/projects/magpie/users/beier/EL2_DeepDive_new/remind/output/C_SSP2EU-NPi-rem-5/REMIND_generic_C_SSP2EU-NPi-rem-5.mif" + cfg$path_to_report_ghgprices <- path2NPIrun cfg$gms$c56_pollutant_prices <- "coupling" - cfg$path_to_report_bioenergy <- "/p/projects/magpie/users/beier/EL2_DeepDive_new/remind/output/C_SSP2EU-NPi-rem-5/REMIND_generic_C_SSP2EU-NPi-rem-5.mif" + cfg$path_to_report_bioenergy <- path2NPIrun cfg$gms$c60_2ndgen_biodem <- "coupling" # Setting REMIND scenario for blackmagicc - cfg$magicc_emis_scen <- "REMIND_generic_C_SSP2EU-DSPkB650-DS_betax-rem-5.mif" + cfg$magicc_emis_scen <- "REMIND_generic_C_SSP2EU-DSPkB650-DS_betax_DeepDive_noNDC-rem-5.mif" return(cfg) } @@ -124,9 +128,9 @@ waste <- function(cfg) { # starting from 2020 and diet shift. miti <- function(cfg) { # Mitigation: consistent with 1.5C considering Diet change - cfg$path_to_report_ghgprices <- "/p/projects/magpie/users/beier/EL2_DeepDive_new/remind/output/C_SSP2EU-DSPkB650-DS_betax-rem-5/REMIND_generic_C_SSP2EU-DSPkB650-DS_betax-rem-5.mif" + cfg$path_to_report_ghgprices <- path2MitigationRun cfg$gms$c56_pollutant_prices <- "coupling" - cfg$path_to_report_bioenergy <- "/p/projects/magpie/users/beier/EL2_DeepDive_new/remind/output/C_SSP2EU-DSPkB650-DS_betax-rem-5/REMIND_generic_C_SSP2EU-DSPkB650-DS_betax-rem-5.mif" + cfg$path_to_report_bioenergy <- path2MitigationRun cfg$gms$c60_2ndgen_biodem <- "coupling" # ecoSysProtAll: (Above ground CO2 emis from LUC in forest, forestry, natveg; All types of emis from peatland; All CH4 and N2O emis), cfg$gms$c56_emis_policy <- "ecoSysProtAll" @@ -137,7 +141,7 @@ miti <- function(cfg) { # Bioenergy demand only. No carbon price on land included. bioenergy <- function(cfg) { # Mitigation: only Bioenergy demand from coupled REMIND-MAgPIE run where 1.5 is reached with ghg prices on land and considering diet shift - cfg$path_to_report_bioenergy <- "/p/projects/magpie/users/beier/EL2_DeepDive_new/remind/output/C_SSP2EU-DSPkB650-DS_betax-rem-5/REMIND_generic_C_SSP2EU-DSPkB650-DS_betax-rem-5.mif" + cfg$path_to_report_bioenergy <- path2MitigationRun cfg$gms$c60_2ndgen_biodem <- "coupling" return(cfg) @@ -147,7 +151,7 @@ bioenergy <- function(cfg) { priceCO2 <- function(cfg) { # Mitigation: only price land CO2 cfg$gms$c56_pollutant_prices <- "coupling" - cfg$path_to_report_ghgprices <- "/p/projects/magpie/users/beier/EL2_DeepDive_new/remind/output/C_SSP2EU-DSPkB650-DS_betax-rem-5/REMIND_generic_C_SSP2EU-DSPkB650-DS_betax-rem-5.mif" + cfg$path_to_report_ghgprices <- path2MitigationRun cfg$gms$c56_emis_policy <- "ecoSysProtAll_agMgmtOff" #### double-check Florian or Leon return(cfg) @@ -157,7 +161,7 @@ priceCO2 <- function(cfg) { priceNonCO2 <- function(cfg) { # Mitigation: only CH4 and N2O price cfg$gms$c56_pollutant_prices <- "coupling" - cfg$path_to_report_ghgprices <- "/p/projects/magpie/users/beier/EL2_DeepDive_new/remind/output/C_SSP2EU-DSPkB650-DS_betax-rem-5/REMIND_generic_C_SSP2EU-DSPkB650-DS_betax-rem-5.mif" + cfg$path_to_report_ghgprices <- path2MitigationRun cfg$gms$c56_emis_policy <- "ecoSysProtOff" ### double-check Florian or Leon return(cfg) @@ -174,20 +178,6 @@ cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NPI", "EL2_default")) cfg <- bau(cfg = cfg) start_run(cfg, codeCheck = FALSE) -### Composition ### -# Mitigation components: -# (1a) Nationally Determined Contributions (NDCs) -#cfg$title <- "BAU_NDC" -#cfg <- setScenario(cfg, c("nocc_hist", "SSP2", "NDC", "EL2_default")) -#cfg <- bau(cfg = cfg) -# set path to bioenergy and prices to NDC run -#cfg$path_to_report_ghgprices <- "/p/projects/magpie/users/beier/EL2_DeepDive_new/remind/output/C_SSP2EU-NDC-rem-5/REMIND_generic_C_SSP2EU-NDC-rem-5.mif" -#cfg$gms$c56_pollutant_prices <- "coupling" -#cfg$path_to_report_bioenergy <- "/p/projects/magpie/users/beier/EL2_DeepDive_new/remind/output/C_SSP2EU-NDC-rem-5/REMIND_generic_C_SSP2EU-NDC-rem-5.mif" -#cfg$gms$c60_2ndgen_biodem <- "coupling" -#start_run(cfg, codeCheck = FALSE) -# Note: Exclude NDC run for now. Starting point is NPi and we do not look at policies, but only mitigation measures (demand side vs. supply side) - # (1b) BAU + Bioenergy # # Decomposition Scenario. Adds bioenergy demand from coupled run with land-use policies consistent with 1.5C by 2050 to BAU cfg$title <- "BAU_Bioenergy" @@ -233,7 +223,7 @@ cfg <- bau(cfg = cfg) # Mitigation cfg <- miti(cfg = cfg) cfg$gms$c60_2ndgen_biodem <- "coupling" -cfg$path_to_report_bioenergy <- "/p/projects/magpie/users/beier/EL2_DeepDive_new/remind/output/C_SSP2EU-NPi-rem-5/REMIND_generic_C_SSP2EU-NPi-rem-5.mif" +cfg$path_to_report_bioenergy <- path2NPIrun start_run(cfg, codeCheck = FALSE) # BAU_MITI - non-CO2 # @@ -322,7 +312,7 @@ cfg <- bau(cfg = cfg) # Mitigation cfg <- miti(cfg = cfg) cfg$gms$c60_2ndgen_biodem <- "coupling" -cfg$path_to_report_bioenergy <- "/p/projects/magpie/users/beier/EL2_DeepDive_new/remind/output/C_SSP2EU-NPi-rem-5/REMIND_generic_C_SSP2EU-NPi-rem-5.mif" +cfg$path_to_report_bioenergy <- path2NPIrun # PHD cfg <- diet(cfg = cfg) #cfg <- prod(cfg = cfg) From 3ed0d5cc22ade2709753187d444ca84311d7b060 Mon Sep 17 00:00:00 2001 From: Felicitas Date: Sat, 8 Jun 2024 16:41:51 +0200 Subject: [PATCH 2/8] bugfix in path to mitigation run --- scripts/start/projects/project_EAT2p0_DeepDive.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/start/projects/project_EAT2p0_DeepDive.R b/scripts/start/projects/project_EAT2p0_DeepDive.R index ced82df46..e12c14a98 100644 --- a/scripts/start/projects/project_EAT2p0_DeepDive.R +++ b/scripts/start/projects/project_EAT2p0_DeepDive.R @@ -43,7 +43,7 @@ cfg$output <- c( # Set path to own coupled runs: path2NPIrun <- "/p/projects/magpie/users/beier/EL2_DeepDive_default/remind/output/C_SSP2EU-NPi-rem-5/REMIND_generic_C_SSP2EU-NPi-rem-5.mif" -path2MitigationRun <- "/p/projects/magpie/users/beier/EL2_DeepDive_default/remind/output/C_SSP2EU-DSPkB650-DS_betax_DeepDive_noNDC-rem-5/REMIND_generic_C_SSP2EU-NPi-rem-5.mif" +path2MitigationRun <- "/p/projects/magpie/users/beier/EL2_DeepDive_default/remind/output/C_SSP2EU-DSPkB650-DS_betax_DeepDive_noNDC-rem-5/REMIND_generic_C_SSP2EU-DSPkB650-DS_betax_DeepDive_noNDC-rem-5.mif" ####################### # SCENARIO DEFINITION # From 675a093123e9c3b512a70f0cfbbb35092a12b4e2 Mon Sep 17 00:00:00 2001 From: Felicitas Date: Tue, 18 Jun 2024 10:18:17 +0200 Subject: [PATCH 3/8] added entire-year non-ag water demand for PB postprocessing --- config/default.cfg | 6 +-- main.gms | 44 +++++++++---------- .../agr_sector_aug13/declarations.gms | 25 ++++++----- .../agr_sector_aug13/presolve.gms | 4 ++ .../42_water_demand/agr_sector_aug13/sets.gms | 3 ++ .../all_sectors_aug13/declarations.gms | 27 ++++++------ .../all_sectors_aug13/input.gms | 10 ++++- .../all_sectors_aug13/presolve.gms | 8 +++- modules/42_water_demand/input/files | 1 + scripts/start/projects/project_EAT2p0.R | 2 +- 10 files changed, 76 insertions(+), 54 deletions(-) diff --git a/config/default.cfg b/config/default.cfg index 2dec6eef9..7969a2c91 100644 --- a/config/default.cfg +++ b/config/default.cfg @@ -22,9 +22,9 @@ cfg$model <- "main.gms" #def = "main.gms" #### input settings #### # which input data sets should be used? -cfg$input <- c(regional = "rev4.108_h12_magpie.tgz", - cellular = "rev4.108_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz", - validation = "rev4.108_h12_validation.tgz", +cfg$input <- c(regional = "rev4.109_h12_magpie.tgz", + cellular = "rev4.109_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz", + validation = "rev4.109_h12_validation.tgz", additional = "additional_data_rev4.50.tgz", calibration = "calibration_H12_26Mar24.tgz") diff --git a/main.gms b/main.gms index 5a585545d..4292d8bb5 100644 --- a/main.gms +++ b/main.gms @@ -147,44 +147,44 @@ $title magpie *' * Always try to access model outputs through the corresponding magpie package instead of accessing them directly with readGDX. It cannot be guaranteed that your script will work in the future if you do otherwise (as only the corresponding magpie package will be continuously adapted to changes in the GAMS code). *##################### R SECTION START (VERSION INFO) ########################## -* -* Used data set: rev4.106_h12_magpie.tgz +* +* Used data set: rev4.109_h12_magpie.tgz * md5sum: NA * Repository: scp://cluster.pik-potsdam.de/p/projects/rd3mod/inputdata/output -* -* Used data set: rev4.106_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz +* +* Used data set: rev4.109_h12_fd712c0b_cellularmagpie_c200_MRI-ESM2-0-ssp370_lpjml-8e6c5eb1.tgz * md5sum: NA * Repository: scp://cluster.pik-potsdam.de/p/projects/rd3mod/inputdata/output -* -* Used data set: rev4.106_h12_validation.tgz +* +* Used data set: rev4.109_h12_validation.tgz * md5sum: NA * Repository: scp://cluster.pik-potsdam.de/p/projects/rd3mod/inputdata/output -* +* * Used data set: additional_data_rev4.50.tgz * md5sum: NA -* Repository: scp://cluster.pik-potsdam.de/p/projects/landuse/data/input/archive -* +* Repository: https://rse.pik-potsdam.de/data/magpie/public +* * Used data set: calibration_H12_26Mar24.tgz * md5sum: NA * Repository: https://rse.pik-potsdam.de/data/magpie/public -* +* * Low resolution: c200 * High resolution: 0.5 -* +* * Total number of cells: 200 -* +* * Number of cells per region: * CAZ CHA EUR IND JPN LAM MEA NEU OAS REF SSA USA * 14 23 10 7 4 26 21 9 16 23 32 15 -* +* * Regionscode: 62eff8f7 -* -* Regions data revision: 4.106 -* +* +* Regions data revision: 4.109 +* * lpj2magpie settings: * * LPJmL data: MRI-ESM2-0:ssp370 -* * Revision: 4.106 -* +* * Revision: 4.109 +* * aggregation settings: * * Input resolution: 0.5 * * Output resolution: c200 @@ -193,10 +193,10 @@ $title magpie * CAZ CHA EUR IND JPN LAM MEA NEU OAS REF SSA USA * 14 23 10 7 4 26 21 9 16 23 32 15 * * Call: withCallingHandlers(expr, message = messageHandler, warning = warningHandler, error = errorHandler) -* -* -* Last modification (input data): Thu May 23 11:16:51 2024 -* +* +* +* Last modification (input data): Tue Jun 18 09:52:31 2024 +* *###################### R SECTION END (VERSION INFO) ########################### $offupper diff --git a/modules/42_water_demand/agr_sector_aug13/declarations.gms b/modules/42_water_demand/agr_sector_aug13/declarations.gms index 67feae3db..c441331c0 100644 --- a/modules/42_water_demand/agr_sector_aug13/declarations.gms +++ b/modules/42_water_demand/agr_sector_aug13/declarations.gms @@ -6,22 +6,23 @@ *** | Contact: magpie@pik-potsdam.de parameters - i42_wat_req_k(t,j,k) LPJmL annual water demand for irrigation per ha per year (m^3) + Livestock demand per ton (m^3) - ic42_wat_req_k(j,k) LPJmL annual water demand for irrigation per ha per year (m^3) + Livestock demand per ton (m^3) - i42_env_flows(t,j) Environmental flow requirements if a protection policy is in place (mio. m^3) - i42_env_flows_base(t,j) Environmental flow requirements if no protection policy is in place (mio. m^3) - ic42_env_flow_policy(i) Determines whether environmental flow protection is enforced in the current time step (1) - i42_env_flow_policy(t,i) Determines whether environmental flow protection is enforced (1) - p42_efp(t_all,scen42) Determines whether environmental flow protection is enforced and its fading in of environmental flow policy (1) - p42_efp_fader(t_all) Determines the fading in of environmental flow policy (1) - p42_country_dummy(iso) Dummy parameter indicating whether country is affected by EFP (1) - p42_EFP_region_shr(t_all,i) Weighted share of region with regards to EFP (1) - ic42_pumping_cost(i) Parameter to capture values for pumping costs in a particular time step (USD05MER per m^3) + i42_wat_req_k(t,j,k) LPJmL annual water demand for irrigation per ha per year (m^3) + Livestock demand per ton (m^3) + ic42_wat_req_k(j,k) LPJmL annual water demand for irrigation per ha per year (m^3) + Livestock demand per ton (m^3) + i42_env_flows(t,j) Environmental flow requirements if a protection policy is in place (mio. m^3) + i42_env_flows_base(t,j) Environmental flow requirements if no protection policy is in place (mio. m^3) + ic42_env_flow_policy(i) Determines whether environmental flow protection is enforced in the current time step (1) + i42_env_flow_policy(t,i) Determines whether environmental flow protection is enforced (1) + p42_efp(t_all,scen42) Determines whether environmental flow protection is enforced and its fading in of environmental flow policy (1) + p42_efp_fader(t_all) Determines the fading in of environmental flow policy (1) + p42_country_dummy(iso) Dummy parameter indicating whether country is affected by EFP (1) + p42_EFP_region_shr(t_all,i) Weighted share of region with regards to EFP (1) + ic42_pumping_cost(i) Parameter to capture values for pumping costs in a particular time step (USD05MER per m^3) + i42_watdem_total(t,j,watdem_ineldo) Non-agricultural water demand for entire year used in post-processing (m^3) ; equations q42_water_demand(wat_dem,j) Water withdrawals of different sectors (mio. m^3 per yr) - q42_water_cost(i) Total cost of pumping irrigation water (USD05MER per yr) + q42_water_cost(i) Total cost of pumping irrigation water (USD05MER per yr) ; positive variables diff --git a/modules/42_water_demand/agr_sector_aug13/presolve.gms b/modules/42_water_demand/agr_sector_aug13/presolve.gms index 6fa1cb23d..91107677f 100644 --- a/modules/42_water_demand/agr_sector_aug13/presolve.gms +++ b/modules/42_water_demand/agr_sector_aug13/presolve.gms @@ -39,6 +39,10 @@ vm_watdem.fx("manufacturing",j) = sum(wat_src, im_wat_avail(t,wat_src,j)) * s42_ vm_watdem.fx("electricity",j) = 0; vm_watdem.fx("domestic",j) = 0; +* Fill non-agricultural water demand parameter of entire year for post-processing +i42_watdem_total(t,j,watdem_ineldo) = 0; +i42_watdem_total(t,j,"manufacturing") = sum(wat_src, im_wat_avail(t,wat_src,j)) * s42_reserved_fraction; + * Country switch to determine countries for which EFP holds. * In the default case, the EFP affects all countries when activated. p42_country_dummy(iso) = 0; diff --git a/modules/42_water_demand/agr_sector_aug13/sets.gms b/modules/42_water_demand/agr_sector_aug13/sets.gms index 03ca25178..78f20947c 100644 --- a/modules/42_water_demand/agr_sector_aug13/sets.gms +++ b/modules/42_water_demand/agr_sector_aug13/sets.gms @@ -9,6 +9,9 @@ sets watdem_exo(wat_dem) Exogenous water demands / manufacturing, electricity, domestic, ecosystem / + watdem_ineldo(wat_dem) Exogenous water demand subset covering humanly induced demands + / domestic, manufacturing, electricity / + scen42 Environmental Flow Policy (EFP) / off, on / diff --git a/modules/42_water_demand/all_sectors_aug13/declarations.gms b/modules/42_water_demand/all_sectors_aug13/declarations.gms index 81503a7f7..29ca8e484 100644 --- a/modules/42_water_demand/all_sectors_aug13/declarations.gms +++ b/modules/42_water_demand/all_sectors_aug13/declarations.gms @@ -6,22 +6,23 @@ *** | Contact: magpie@pik-potsdam.de parameters - i42_wat_req_k(t_all,j,k) LPJmL annual water demand for irrigation per ha per yr and livestock demand per ton per yr (m^3) - ic42_wat_req_k(j,k) LPJmL annual water demand for irrigation per ha per yr and livestock demand per ton per yr (m^3) - i42_env_flows(t,j) Environmental flow requirements in case of policy (mio m^3) - i42_env_flows_base(t,j) Environmental flow requirements in case of no policy (mio m^3) - ic42_env_flow_policy(i) Determines whether environmental flow protection is enforced in the current time step (1) - i42_env_flow_policy(t,i) Determines whether environmental flow protection is enforced (1) - p42_efp(t_all,scen42) Determines whether environmental flow protection is enforced and its fading in of environmental flow policy (1) - p42_efp_fader(t_all) Determines the fading in of environmental flow policy (1) - p42_country_dummy(iso) Dummy parameter indicating whether country is affected by EFP (1) - p42_EFP_region_shr(t_all,i) Weighted share of region with regards to EFP (1) - ic42_pumping_cost(i) Parameter to capture values for pumping costs in a particular time step (USD05MER per m^3) + i42_wat_req_k(t_all,j,k) LPJmL annual water demand for irrigation per ha per yr and livestock demand per ton per yr (m^3) + ic42_wat_req_k(j,k) LPJmL annual water demand for irrigation per ha per yr and livestock demand per ton per yr (m^3) + i42_env_flows(t,j) Environmental flow requirements in case of policy (mio m^3) + i42_env_flows_base(t,j) Environmental flow requirements in case of no policy (mio m^3) + ic42_env_flow_policy(i) Determines whether environmental flow protection is enforced in the current time step (1) + i42_env_flow_policy(t,i) Determines whether environmental flow protection is enforced (1) + p42_efp(t_all,scen42) Determines whether environmental flow protection is enforced and its fading in of environmental flow policy (1) + p42_efp_fader(t_all) Determines the fading in of environmental flow policy (1) + p42_country_dummy(iso) Dummy parameter indicating whether country is affected by EFP (1) + p42_EFP_region_shr(t_all,i) Weighted share of region with regards to EFP (1) + ic42_pumping_cost(i) Parameter to capture values for pumping costs in a particular time step (USD05MER per m^3) + i42_watdem_total(t,j,watdem_ineldo) Non-agricultural water demand for entire year used in post-processing (m^3) ; equations - q42_water_demand(wat_dem,j) Water withdrawals of different sectors (mio. m^3 per yr) - q42_water_cost(i) Total cost of pumping irrigation water (USD05MER per yr) + q42_water_demand(wat_dem,j) Water withdrawals of different sectors (mio. m^3 per yr) + q42_water_cost(i) Total cost of pumping irrigation water (USD05MER per yr) ; positive variables diff --git a/modules/42_water_demand/all_sectors_aug13/input.gms b/modules/42_water_demand/all_sectors_aug13/input.gms index a725f58cf..b21d8d90c 100644 --- a/modules/42_water_demand/all_sectors_aug13/input.gms +++ b/modules/42_water_demand/all_sectors_aug13/input.gms @@ -92,13 +92,21 @@ $include "./modules/42_water_demand/input/f42_wat_req_fao.csv" $offdelim /; -table f42_watdem_ineldo(t_all,j,scen_watdem_nonagr,watdem_ineldo) Manufacturing electricity and domestic water demand under different socioeconomic scenarios (mio. m^3) +table f42_watdem_ineldo(t_all,j,scen_watdem_nonagr,watdem_ineldo) Manufacturing electricity and domestic water demand under different socioeconomic scenarios in the growing period (mio. m^3) $ondelim $include "./modules/42_water_demand/input/watdem_nonagr_grper.cs3" $offdelim ; m_fillmissingyears(f42_watdem_ineldo,"j,scen_watdem_nonagr,watdem_ineldo"); +* This input is not used within MAgPIE, but necessary for the postprocessing +table f42_watdem_ineldo_total(t_all,j,scen_watdem_nonagr,watdem_ineldo) Manufacturing electricity and domestic water demand under different socioeconomic scenarios in the entire year (mio. m^3) +$ondelim +$include "./modules/42_water_demand/input/watdem_nonagr_total.cs3" +$offdelim +; +m_fillmissingyears(f42_watdem_ineldo_total,"j,scen_watdem_nonagr,watdem_ineldo"); + parameter f42_env_flows(t_all,j) Environmental flow requirements from LPJ and Smakhtin algorithm (mio. m^3) / diff --git a/modules/42_water_demand/all_sectors_aug13/presolve.gms b/modules/42_water_demand/all_sectors_aug13/presolve.gms index e3c7a4f9f..baa83ee40 100644 --- a/modules/42_water_demand/all_sectors_aug13/presolve.gms +++ b/modules/42_water_demand/all_sectors_aug13/presolve.gms @@ -39,13 +39,17 @@ if ((s42_pumping = 1), * depends on the socioeconomic scenario if (m_year(t) <= sm_fix_SSP2, vm_watdem.fx(watdem_ineldo,j) = f42_watdem_ineldo(t,j,"ssp2",watdem_ineldo); + i42_watdem_total(t,j,watdem_ineldo) = f42_watdem_ineldo_total(t,j,"ssp2",watdem_ineldo); else if ((s42_watdem_nonagr_scenario = 1), vm_watdem.fx(watdem_ineldo,j) = f42_watdem_ineldo(t,j,"ssp1",watdem_ineldo); - Elseif(s42_watdem_nonagr_scenario = 2), + i42_watdem_total(t,j,watdem_ineldo) = f42_watdem_ineldo_total(t,j,"ssp1",watdem_ineldo); + Elseif (s42_watdem_nonagr_scenario = 2), vm_watdem.fx(watdem_ineldo,j) = f42_watdem_ineldo(t,j,"ssp2",watdem_ineldo); - Elseif(s42_watdem_nonagr_scenario = 3), + i42_watdem_total(t,j,watdem_ineldo) = f42_watdem_ineldo_total(t,j,"ssp2",watdem_ineldo); + Elseif (s42_watdem_nonagr_scenario = 3), vm_watdem.fx(watdem_ineldo,j) = f42_watdem_ineldo(t,j,"ssp3",watdem_ineldo); + i42_watdem_total(t,j,watdem_ineldo) = f42_watdem_ineldo_total(t,j,"ssp3",watdem_ineldo); ); ); diff --git a/modules/42_water_demand/input/files b/modules/42_water_demand/input/files index f9df64edc..26723d5a3 100644 --- a/modules/42_water_demand/input/files +++ b/modules/42_water_demand/input/files @@ -2,5 +2,6 @@ lpj_airrig.cs2 lpj_envflow_grper.cs2 watdem_nonagr_grper.cs3 +watdem_nonagr_total.cs3 f42_wat_req_fao.csv f42_pumping_cost.cs4 diff --git a/scripts/start/projects/project_EAT2p0.R b/scripts/start/projects/project_EAT2p0.R index 6bd47137e..1c4aadc72 100644 --- a/scripts/start/projects/project_EAT2p0.R +++ b/scripts/start/projects/project_EAT2p0.R @@ -82,7 +82,7 @@ bau <- function(cfg) { cfg$gms$c60_2ndgen_biodem <- "R21M42-SSP2-NPi" # default # Climate Change - cfg$input['cellular'] <- "rev4.99_h12_c6a7458f_cellularmagpie_c200_IPSL-CM6A-LR-ssp370_lpjml-8e6c5eb1.tgz" + cfg$input['cellular'] <- "rev4.109_h12_c6a7458f_cellularmagpie_c200_IPSL-CM6A-LR-ssp370_lpjml-8e6c5eb1.tgz" return(cfg) } From 730138e914799d4a050f3956de2d32177732dcc7 Mon Sep 17 00:00:00 2001 From: Felicitas Date: Tue, 18 Jun 2024 10:37:25 +0200 Subject: [PATCH 4/8] adjusted changelog --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b5c6ad4e..f07b1bed5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,9 +8,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### changed - **scripts** adjusted SLURM job handling +- **scripts** updated EL2p0 start scripts ### added -- +- **42_water_demand** added non-agricultural water demand for entire year ### removed - From e9d39a559c70f17ec608928396d474192340c3ca Mon Sep 17 00:00:00 2001 From: Felicitas Date: Tue, 18 Jun 2024 10:39:10 +0200 Subject: [PATCH 5/8] fixed incomplete final line warning in checkSummation.R --- scripts/output/extra/checkSummation.R | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/output/extra/checkSummation.R b/scripts/output/extra/checkSummation.R index 12e524568..0c0e01816 100644 --- a/scripts/output/extra/checkSummation.R +++ b/scripts/output/extra/checkSummation.R @@ -16,16 +16,16 @@ library(piamInterfaces) options(width = 180) ## Check outputdir -if(!exists("source_include")) { +if (!exists("source_include")) { outputdir <- "." } f <- file.path(outputdir, "report.mif") -if(!file.exists(f)) { +if (!file.exists(f)) { warning("report.mif missing, cannot check anything. Please create report first!") } else { failvar <- checkSummations(f, outputDirectory = NULL, absDiff = 0.001, summationsFile = "extractVariableGroups") - if(nrow(failvars) > 0) saveRDS(failvar, file.path(outputdir, "summationCheck.rds")) -} \ No newline at end of file + if (nrow(failvars) > 0) saveRDS(failvar, file.path(outputdir, "summationCheck.rds")) +} From aebfa7b7a2cccb3d83b09e30ec385583358fac71 Mon Sep 17 00:00:00 2001 From: Felicitas Date: Tue, 18 Jun 2024 12:11:59 +0200 Subject: [PATCH 6/8] included an ifinclude for backwards compatibiltiy --- modules/42_water_demand/all_sectors_aug13/input.gms | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/42_water_demand/all_sectors_aug13/input.gms b/modules/42_water_demand/all_sectors_aug13/input.gms index b21d8d90c..e5823ca67 100644 --- a/modules/42_water_demand/all_sectors_aug13/input.gms +++ b/modules/42_water_demand/all_sectors_aug13/input.gms @@ -102,7 +102,7 @@ m_fillmissingyears(f42_watdem_ineldo,"j,scen_watdem_nonagr,watdem_ineldo"); * This input is not used within MAgPIE, but necessary for the postprocessing table f42_watdem_ineldo_total(t_all,j,scen_watdem_nonagr,watdem_ineldo) Manufacturing electricity and domestic water demand under different socioeconomic scenarios in the entire year (mio. m^3) $ondelim -$include "./modules/42_water_demand/input/watdem_nonagr_total.cs3" +$if exist "./modules/42_water_demand/input/watdem_nonagr_total.cs3" $include "./modules/42_water_demand/input/watdem_nonagr_total.cs3" $offdelim ; m_fillmissingyears(f42_watdem_ineldo_total,"j,scen_watdem_nonagr,watdem_ineldo"); From 0678ddbe0f4750290754cf30bc75436e5e599bd7 Mon Sep 17 00:00:00 2001 From: Felicitas Date: Tue, 18 Jun 2024 16:03:27 +0200 Subject: [PATCH 7/8] corrected legacy bug: added sm_fix_SSP2 to not used --- modules/44_biodiversity/bv_btc_mar21/not_used.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/44_biodiversity/bv_btc_mar21/not_used.txt b/modules/44_biodiversity/bv_btc_mar21/not_used.txt index bf287154e..2430a1919 100644 --- a/modules/44_biodiversity/bv_btc_mar21/not_used.txt +++ b/modules/44_biodiversity/bv_btc_mar21/not_used.txt @@ -1,2 +1,3 @@ name,type,reason pcm_land, input, not used +sm_fix_SSP2, input, not used From c4671781890a020f8325615e90f661ff1cb65981 Mon Sep 17 00:00:00 2001 From: Felicitas Date: Tue, 18 Jun 2024 16:11:09 +0200 Subject: [PATCH 8/8] corrected typo in unit --- modules/42_water_demand/agr_sector_aug13/declarations.gms | 2 +- modules/42_water_demand/all_sectors_aug13/declarations.gms | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/42_water_demand/agr_sector_aug13/declarations.gms b/modules/42_water_demand/agr_sector_aug13/declarations.gms index c441331c0..b719d383f 100644 --- a/modules/42_water_demand/agr_sector_aug13/declarations.gms +++ b/modules/42_water_demand/agr_sector_aug13/declarations.gms @@ -17,7 +17,7 @@ parameters p42_country_dummy(iso) Dummy parameter indicating whether country is affected by EFP (1) p42_EFP_region_shr(t_all,i) Weighted share of region with regards to EFP (1) ic42_pumping_cost(i) Parameter to capture values for pumping costs in a particular time step (USD05MER per m^3) - i42_watdem_total(t,j,watdem_ineldo) Non-agricultural water demand for entire year used in post-processing (m^3) + i42_watdem_total(t,j,watdem_ineldo) Non-agricultural water demand for entire year used in post-processing (mio. m^3 per yr) ; equations diff --git a/modules/42_water_demand/all_sectors_aug13/declarations.gms b/modules/42_water_demand/all_sectors_aug13/declarations.gms index 29ca8e484..42c836dfc 100644 --- a/modules/42_water_demand/all_sectors_aug13/declarations.gms +++ b/modules/42_water_demand/all_sectors_aug13/declarations.gms @@ -17,7 +17,7 @@ parameters p42_country_dummy(iso) Dummy parameter indicating whether country is affected by EFP (1) p42_EFP_region_shr(t_all,i) Weighted share of region with regards to EFP (1) ic42_pumping_cost(i) Parameter to capture values for pumping costs in a particular time step (USD05MER per m^3) - i42_watdem_total(t,j,watdem_ineldo) Non-agricultural water demand for entire year used in post-processing (m^3) + i42_watdem_total(t,j,watdem_ineldo) Non-agricultural water demand for entire year used in post-processing (mio. m^3 per yr) ; equations