|
| 1 | +# | (C) 2008-2024 Potsdam Institute for Climate Impact Research (PIK) |
| 2 | +# | authors, and contributors see CITATION.cff file. This file is part |
| 3 | +# | of MAgPIE and licensed under AGPL-3.0-or-later. Under Section 7 of |
| 4 | +# | AGPL-3.0, you are granted additional permissions described in the |
| 5 | +# | MAgPIE License Exception, version 1.0 (see LICENSE file). |
| 6 | +# | Contact: magpie@pik-potsdam.de |
| 7 | + |
| 8 | +# ------------------------------------------------------------- |
| 9 | +# description: Land-based mitigation and habitat conservation |
| 10 | +# ------------------------------------------------------------- |
| 11 | + |
| 12 | +rev <- "rev9" |
| 13 | + |
| 14 | +cres <- "c200" |
| 15 | + |
| 16 | +###################################### |
| 17 | +#### Script to start a MAgPIE run #### |
| 18 | +###################################### |
| 19 | + |
| 20 | +library(gms) |
| 21 | +library(lucode2) |
| 22 | +library(magclass) |
| 23 | +library(gdx2) |
| 24 | + |
| 25 | +# Load start functions |
| 26 | +source("scripts/start_functions.R") |
| 27 | + |
| 28 | +# ==================== |
| 29 | +# Calibration |
| 30 | +# ==================== |
| 31 | + |
| 32 | +source("config/default.cfg") |
| 33 | + |
| 34 | +cfg$title <- "calib_run" |
| 35 | +cfg$output <- c("rds_report", "validation_short") |
| 36 | +cfg$force_replace <- TRUE |
| 37 | + |
| 38 | +cfg$recalibrate <- TRUE |
| 39 | +cfg$recalibrate_landconversion_cost <- TRUE |
| 40 | + |
| 41 | +cfg$best_calib <- TRUE |
| 42 | +cfg$best_calib_landconversion_cost <- FALSE |
| 43 | + |
| 44 | +cfg$gms$s14_use_yield_calib <- 1 |
| 45 | + |
| 46 | +# cc is new default |
| 47 | +cfg <- setScenario(cfg, c("nocc_hist", "NPI", "ForestryExo")) |
| 48 | +cfg <- setScenario(cfg, c("MitiConsv"), scenario_config = "config/projects/scenario_config_miti_consv.csv") |
| 49 | + |
| 50 | +# sticky |
| 51 | +cfg$gms$factor_costs <- "sticky_feb18" |
| 52 | + |
| 53 | +# SNV habitat defintion |
| 54 | +cfg$gms$land_snv <- "secdforest, other" |
| 55 | + |
| 56 | +# marginal land scenario |
| 57 | +cfg$gms$c29_marginal_land <- "q33_marginal" |
| 58 | + |
| 59 | +start_run(cfg = cfg) |
| 60 | +calib_tgz <- magpie4::submitCalibration(paste(rev, "MitiConsv", sep = "_")) |
| 61 | + |
| 62 | +# ==================== |
| 63 | +# Scenario runs |
| 64 | +# ==================== |
| 65 | + |
| 66 | +prefix <- paste(rev, "MitiConsv", cres, sep = "_") |
| 67 | + |
| 68 | +scenarios <- c( |
| 69 | + "SSP2-REF", "SSP2-PB650-PriceAR", "SSP2-PB650-PriceProt", |
| 70 | + "SSP2-PB1000-PriceAR", "SSP2-PB1000-PriceProt", |
| 71 | + "SSP2-PB650-PriceAR-30by30", "SSP2-PB650-PriceProt-30by30", |
| 72 | + "SSP2-PB650-PriceAR-BH", "SSP2-PB650-PriceProt-BH", |
| 73 | + "SSP2-PB1000-PriceAR-30by30", "SSP2-PB1000-PriceProt-30by30", |
| 74 | + "SSP2-PB1000-PriceAR-BH", "SSP2-PB1000-PriceProt-BH" |
| 75 | +) |
| 76 | + |
| 77 | +for (scen in scenarios) { |
| 78 | + scen <- unlist(strsplit(scen, "-")) |
| 79 | + ssp <- scen[grepl("SSP", scen)] |
| 80 | + |
| 81 | + if (length(ssp) == 0) { |
| 82 | + ssp <- "SSP2" |
| 83 | + } |
| 84 | + |
| 85 | + source("config/default.cfg") |
| 86 | + |
| 87 | + cfg$qos <- "short_highMem" |
| 88 | + |
| 89 | + cfg$results_folder <- "output/:title::date:" |
| 90 | + |
| 91 | + cfg$output <- c( |
| 92 | + "output_check", "extra/disaggregation", "rds_report", "extra/runSEALSallocation" |
| 93 | + ) |
| 94 | + |
| 95 | + cfg$input["calibration"] <- calib_tgz |
| 96 | + |
| 97 | + # Climate change switched off for these runs |
| 98 | + cfg <- setScenario(cfg, c(ssp, "nocc_hist", "NPI", "ForestryExo")) |
| 99 | + cfg <- setScenario(cfg, c("MitiConsv"), scenario_config = "config/projects/scenario_config_miti_consv.csv") |
| 100 | + |
| 101 | + # Set path to coupled output |
| 102 | + pathToCoupledOutput <- "/p/projects/magpie/users/vjeetze/magpie/projects/MitiConsv/C_MitiConsv_Dec24/remind/output/C_rev5_MitiConsv_SSP2-NPi2025-rem-12/REMIND_generic_C_rev5_MitiConsv_SSP2-NPi2025-rem-12.mif" |
| 103 | + |
| 104 | + # sticky |
| 105 | + cfg$gms$factor_costs <- "sticky_feb18" |
| 106 | + |
| 107 | + # SNV habitat defintion |
| 108 | + cfg$gms$land_snv <- "secdforest, other" |
| 109 | + |
| 110 | + if ("PriceAR" %in% scen) { |
| 111 | + cfg$gms$c56_emis_policy <- "redd+natveg_nosoil" |
| 112 | + } |
| 113 | + |
| 114 | + if ("PriceProt" %in% scen) { |
| 115 | + cfg$gms$c56_emis_policy <- "redd+natveg_nosoil" |
| 116 | + cfg$gms$s56_c_price_induced_AR <- 0 |
| 117 | + } |
| 118 | + |
| 119 | + if ("PB650" %in% scen) { |
| 120 | + cfg <- setScenario(cfg, "NDC") |
| 121 | + # Update path to coupled output |
| 122 | + pathToCoupledOutput <- "/p/projects/magpie/users/vjeetze/magpie/projects/MitiConsv/C_MitiConsv_Dec24/remind/output/C_rev5_MitiConsv_SSP2-PkBudg650-rem-12/REMIND_generic_C_rev5_MitiConsv_SSP2-PkBudg650-rem-12.mif" |
| 123 | + } |
| 124 | + |
| 125 | + if ("PB1000" %in% scen) { |
| 126 | + cfg <- setScenario(cfg, "NDC") |
| 127 | + # Update path to coupled output |
| 128 | + pathToCoupledOutput <- "/p/projects/magpie/users/vjeetze/magpie/projects/MitiConsv/C_MitiConsv_Dec24/remind/output/C_rev5_MitiConsv_SSP2-PkBudg1000-rem-12/REMIND_generic_C_rev5_MitiConsv_SSP2-PkBudg1000-rem-12.mif" |
| 129 | + } |
| 130 | + |
| 131 | + if ("30by30" %in% scen) { |
| 132 | + cfg$gms$c22_protect_scenario <- "30by30" |
| 133 | + } |
| 134 | + |
| 135 | + if ("BH" %in% scen) { |
| 136 | + cfg$gms$c22_protect_scenario <- "BH" |
| 137 | + } |
| 138 | + |
| 139 | + # Settings taken from coupled runs |
| 140 | + cfg$gms$c56_pollutant_prices <- "coupling" |
| 141 | + cfg$gms$c60_2ndgen_biodem <- "coupling" |
| 142 | + cfg$path_to_report_ghgprices <- pathToCoupledOutput |
| 143 | + cfg$path_to_report_bioenergy <- pathToCoupledOutput |
| 144 | + |
| 145 | + cfg$title <- paste0(prefix, "_", paste(scen, collapse = "-")) |
| 146 | + start_run(cfg = cfg, codeCheck = FALSE) |
| 147 | +} |
0 commit comments