Skip to content

Commit

Permalink
Merge pull request magpiemodel#6 from magpiemodel/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
mishkos committed Oct 7, 2019
2 parents aa388b6 + 93327a5 commit 3471d96
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 13 deletions.
6 changes: 5 additions & 1 deletion config/default.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ cfg$gms$c09_gdp_scenario <- "SSP2" # def = SSP2
# ***--------------------- 10_land ----------------------------------------
# * (feb15): default land realization
# * (landmatrix_dec18): includes a land transition matrix
cfg$gms$land <- "landmatrix_dec18" # def = feb15
cfg$gms$land <- "landmatrix_dec18" # def = landmatrix_dec18


# ***--------------------- 11_costs ------ --------------------------------
Expand Down Expand Up @@ -222,6 +222,10 @@ cfg$gms$s21_trade_tariff <- 1 # def =1
# ***--------------------- 30_crop ---------------------------------------
# * (endo_jun13): dynamic cropland
cfg$gms$crop <- "endo_jun13" # def = endo_jun13
# * (c30_bioen_type): switch for type of bioenergy crops; options: begr, betr, all
cfg$gms$c30_bioen_type <- "all" # def = "all"
# * (c30_bioen_water): switch for irrigation of bioenergy crops; options: rainfed, irrigated, all
cfg$gms$c30_bioen_water <- "rainfed" # def = "rainfed"

# ***--------------------- 31_past ---------------------------------------
# * (static): static pasture
Expand Down
1 change: 1 addition & 0 deletions config/scenario_config.csv
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ c14_yields_scenario;cc;nocc;;;;;;;;;;;;cc;cc;cc;cc;cc
c42_watdem_scenario;cc;nocc;;;;;;;;;;;;cc;cc;cc;cc;cc
c43_watavail_scenario;cc;nocc;;;;;;;;;;;;cc;cc;cc;cc;cc
c52_carbon_scenario;cc;nocc;;;;;;;;;;;;cc;cc;cc;cc;cc
c59_som_scenario;cc;nocc;;;;;;;;;;;;cc;cc;cc;cc;cc
5 changes: 5 additions & 0 deletions modules/30_crop/endo_jun13/input.gms
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
*** | MAgPIE License Exception, version 1.0 (see LICENSE file).
*** | Contact: magpie@pik-potsdam.de

$setglobal c30_bioen_type all
* options: begr, betr, all

$setglobal c30_bioen_water rainfed
* options: rainfed, irrigated, all

********* CROPAREA INITIALISATION **********************************************

Expand Down
18 changes: 16 additions & 2 deletions modules/30_crop/endo_jun13/presolve.gms
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,22 @@
*** | MAgPIE License Exception, version 1.0 (see LICENSE file).
*** | Contact: magpie@pik-potsdam.de

vm_area.fx(j,"begr","irrigated")=0;
vm_area.fx(j,"betr","irrigated")=0;
$ifthen "%c30_bioen_type%" == "all" bioen_type_30(kbe30) = yes;
$else bioen_type_30("%c30_bioen_type%") = yes;
$endif

$ifthen "%c30_bioen_water%" == "all" bioen_water_30(w) = yes;
$else bioen_water_30("%c30_bioen_water%") = yes;
$endif

*' @code
*' First, all 2nd generation bioenergy area is fixed to zero, irrespective of type and
*' rainfed/irrigation.
vm_area.fx(j,kbe30,w)=0;
*' Second, the bounds for 2nd generation bioenergy area are released depending on
*' the dynamic sets bioen_type_30 and bioen_water_30.
vm_area.up(j,bioen_type_30,bioen_water_30)=Inf;
*' @stop

crpmax30(crp30) = yes$(f30_rotation_max_shr(crp30) < 1);
crpmin30(crp30) = yes$(f30_rotation_min_shr(crp30) > 0);
6 changes: 6 additions & 0 deletions modules/30_crop/endo_jun13/sets.gms
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,10 @@ sets
fiber_r . (cottn_pro)
begr_r . (begr)
betr_r . (betr) /

kbe30(kcr) bio energy activities
/ betr, begr /

bioen_type_30(kbe30) dynamic set bioen type
bioen_water_30(w) dynamic set bioen water
;
33 changes: 23 additions & 10 deletions scripts/start/coacch.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ buildInputVector <- function(regionmapping = "H12",
climatescen_name= "rcp2p6",
co2 = "co2",
climate_model = "IPSL_CM5A_LR",
resolution = "h200",
resolution = "c400",
archive_rev = "38",
madrat_rev = "4.18",
validation_rev = "4.18",
calibration = "calibration_coacch_sept19.tgz",
additional_data = "additional_data_rev3.67.tgz") {
additional_data = "additional_data_rev3.68.tgz") {
mappings <- c(H11="8a828c6ed5004e77d1ba2025e8ea2261",
H12="690d3718e151be1b450b394c1064b1c5",
coacch="",
coacch="c2a48c5eae535d4b8fe9c953d9986f1b",
mag="c30c1c580039c2b300d86cc46ff4036a",
agmip="c77f075908c3bc29bdbe1976165eccaf",
sim4nexus="25dd7264e8e145385b3bd0b89ec5f3fc",
Expand Down Expand Up @@ -98,7 +98,8 @@ cfg$recalibrate <- "ifneeded"



start_the_run<-function(ssp,mit,rcp,gcm,co2){
start_the_run<-function(ssp,mit,rcp,gcm,co2,cc){
# select alias names for reporting
if(gcm=="IPSL_CM5A_LR"){gcm_alias="IPSL-CM5A-LR"}
if(gcm=="HadGEM2_ES"){gcm_alias="HadGEM2-ES"}
if(gcm=="GFDL_ESM2M"){gcm_alias="GFDL-ESM2M"}
Expand All @@ -107,16 +108,27 @@ start_the_run<-function(ssp,mit,rcp,gcm,co2){
if(mit=="26"){mit_alias="2p6"}
if(mit=="45"){mit_alias="4p5"}
if(mit=="Ref"){mit_alias="NoMit"}
if(rcp=="NoCC"){rcp_alias=rcp}else{rcp_alias=substring(rcp,4)}

if(co2=="co2") {title=paste(ssp,gcm_alias,rcp_alias,mit_alias,sep="_")} else {title=paste(ssp,gcm_alias,substring("rcp2p6",4),mit_alias,"NoCO2",sep="_")}
# create runname
if(co2=="co2") {
title=paste(ssp,gcm_alias,substring(rcp,4),mit_alias,sep="_")
} else {
title=paste(ssp,gcm_alias,substring("rcp2p6",4),mit_alias,"NoCO2",sep="_")
}
cat(paste(title))
cfg<-general_settings(title=title))


cfg<-general_settings(title=title)
cfg<-lucode::setScenario(cfg,ssp)
cfg$input <- buildInputVector(climatescen_name=rcp,climate_model = gcm, regionmapping = "coacch",calibration=calib)
mitigation=paste0("SSPDB-",ssp,"-",mit,"-",model)
cfg$gms$c56_pollutant_prices <- mitigation
cfg$gms$c60_2ndgen_biodem <- mitigation
if(cc==FALSE){
cfg<-lucode::setScenario(cfg,"nocc")
} else {
cfg<-lucode::setScenario(cfg,"cc")
}
start_run(cfg=cfg,codeCheck=codeCheck)
}

Expand Down Expand Up @@ -156,14 +168,15 @@ for (ssp in c("SSP1","SSP2","SSP3","SSP4","SSP5")){
co2="co2"
if(rcp=="NoCC"){
gcm = c("HadGEM2_ES")
start_the_run(ssp,mit,rcp,gcm,co2)
rcp= c("rcp4p5")
start_the_run(ssp,mit,rcp,gcm,co2,cc=FALSE)
} else {
for(gcm in gcmopt){
start_the_run(ssp,mit,rcp,gcm,co2)
start_the_run(ssp,mit,rcp,gcm,co2,cc=TRUE)
}
if (rcp == "rcp8p5"){
co2="noco2"
start_the_run(ssp,mit,rcp,gcm,co2)
start_the_run(ssp,mit,rcp,gcm,co2,cc=TRUE)
}
}
}
Expand Down

0 comments on commit 3471d96

Please sign in to comment.