Skip to content

Commit

Permalink
Merge pull request #3 from magpiemodel/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
FelicitasBeier committed Mar 3, 2020
2 parents d341612 + d0f990e commit b862d2d
Show file tree
Hide file tree
Showing 145 changed files with 3,264 additions and 1,124 deletions.
8 changes: 5 additions & 3 deletions .Rprofile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ if(file.exists("~/.Rprofile")) source("~/.Rprofile")
# to the model output folder. Otherwise, the run itself will again use the
# default library set!

# snapshot <- "/p/projects/rd3mod/R/libraries/snapshots/dec2016"
# if(file.exists(snapshot)) .libPaths(snapshot)

# snapshot <- "/p/projects/rd3mod/R/libraries/snapshots/2019_02_28"
# if(file.exists(snapshot)) {
# cat("Set libPaths to",snapshot,"\n")
# .libPaths(snapshot)
# }
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Handle line endings automatically for files detected as text
# and leave all files detected as binary untouched.
* text=auto
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,13 @@ model source code via the R package goxygen
package and run the main function (goxygen) in the main folder of the model.
The resulting documentation can be found in the folder "doc".

Please find a set of tutorials here https://github.com/magpiemodel/tutorials.
This guide will give you a brief technical introduction in how to install, run and use the model
and how to analyse the model output.

Please pay attentions to the MAgPIE Coding Etiquette when you modify the code.
The Coding Etiquette you find at
https://redmine.pik-potsdam.de/projects/pik-model-operations/wiki/Coding_Etiquette
The Coding Etiquette explains also the used name conventions and other
The Coding Etiquette you find at the beginning of the documentation mentioned above.
The Coding Etiquette explains also the naming conventions and other
structural characteristics.

## COPYRIGHT
Expand Down Expand Up @@ -88,8 +91,6 @@ Under Windows you need to install Rtools
(https://cran.r-project.org/bin/windows/Rtools/) and to add it to the PATH
variable. After that you can run the following lines of code:

After that all packages can be installed via `install.packages`

```
pkgs <- c("gdxrrw",
"ggplot2",
Expand Down
155 changes: 129 additions & 26 deletions config/default.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@ cfg$model <- "main.gms" #def = "main.gms"

# which input data sets should be used?

cfg$input <- c("magpie4.1_default_apr19.tgz", "additional_data_rev3.68.tgz",
"isimip_rcp-IPSL_CM5A_LR-rcp2p6-co2_rev38_c200_690d3718e151be1b450b394c1064b1c5.tgz")
cfg$input <- c("isimip_rcp-IPSL_CM5A_LR-rcp2p6-co2_rev42_c200_690d3718e151be1b450b394c1064b1c5.tgz",
"rev4.42_690d3718e151be1b450b394c1064b1c5_magpie.tgz",
"rev4.42_690d3718e151be1b450b394c1064b1c5_validation.tgz",
"calibration_H12_c200_26Feb20.tgz",
"additional_data_rev3.77.tgz")

#a list of repositories (please pay attention to the list format!) in which the
#files should be searched for. Files will be searched in all repositories until
Expand Down Expand Up @@ -124,6 +127,9 @@ cfg$gms$c12_interest_rate <- "medium" # def = "medium"
# ***--------------------- 13_tc -----------------------------------------
# * (endo_jun18): endogenous technological change with full cost accounting and
# * stepwise updated crop area information
# * (exo): exogenous technological change (removes non-linearities from the model);
# * requires an existing model run with endo tc for generating the input file
# * f13_tau_scenario.csv
cfg$gms$tc <- "endo_jun18" # def = endo_jun18

# * tc cost scenario: low, medium or high
Expand Down Expand Up @@ -169,9 +175,67 @@ cfg$gms$s15_elastic_demand <- 1 # def =1
# * OTHER: "PB" (planetary boundaries)
cfg$gms$c15_food_scenario <- "SSP2" # def = SSP2

# * ruminant meat share scenario
# * Temporal development of ruminant meat share within the livestock food product
# * group (applied before food demand model is executed)
# * options: constant, halving2050, mixed
cfg$gms$c15_rumscen <- "mixed" # def = mixed
cfg$gms$c15_rum_share <- "mixed" # def = mixed

# * Stronger ruminant fadeout in India
# * options: 0 (=off), 1 (=on)
cfg$gms$s15_rum_share_fadeout_india_strong <- 1 # def = 1

# * Milk share fadeout in India within the livestock food product
# * group (applied before food demand model is executed)
# * options: 0 (=off), 1 (=on)
cfg$gms$s15_milk_share_fadeout_india <- 1 # def = 1

# * Exogenous food substitution scenarios including functional forms, targets
# * and transition periods (applied after food demand model is executed)
# * options: constant,
# * lin_zero_10_50, lin_zero_20_50, lin_zero_20_30,
# * lin_50pc_10_50_extend90, lin_75pc_10_50_extend90, lin_80pc_20_50, lin_80pc_20_50_extend95, lin_90pc_20_50_extend95,
# * lin_99-98-90pc_20_50-60-100
cfg$gms$c15_rumscen <- "constant" # def = constant
cfg$gms$c15_fishscen <- "constant" # def = constant
cfg$gms$c15_alcscen <- "constant" # def = constant
cfg$gms$c15_livescen <- "constant" # def = constant


# * target year for transition to exogenous scenarios
# * only active for exogenous scenario switches that are set to 1
# * currently available: waste (s15_exo_waste) and EAT Lancet diets (s15_exo_diet)
# * options: y2030, y2050
cfg$gms$c15_exo_scen_targetyear <- "y2050" # def = y2050


# * switch for transition to food waste scenarios
# * (1): transition towards exogenous food waste target
# * (0): regression-based estimation of food waste
cfg$gms$s15_exo_waste <- 0 # def = 0

# * scenario target for the ratio between food demand and intake
# * only activated if s15_exo_waste is set to 1
# * options: scalars >1
# * (1.1): corresponds to 10% food waste ~ quarter waste of HIC
# * (1.2): corresponds to 20% food waste ~ half waste of HIC
cfg$gms$s15_waste_scen <- 1.2 # def = 1.2


# * switch for transition to EAT Lancet diet scenarios
# * (1): transition towards exogenous diets and food demand
# * (0): regression-based estimation of diets and food demand
cfg$gms$s15_exo_diet <- 0 # def = 0

# * exogenous calorie scenario (EAT Lancet diet scenarios)
# * only activated if s15_exo_diet is set to 1
# * options: healthy_BMI, 2100kcal, 2500kcal
cfg$gms$c15_kcal_scen <- "healthy_BMI" # def = healthy_BMI

# * exogenous food-specific diet scenario (EAT Lancet diet scenarios)
# * only activated if s15_exo_diet is set to 1
# * options: BMK, FLX, PSC, VEG, VGN, FLX_hmilk, FLX_hredmeat
cfg$gms$c15_EAT_scen <- "FLX" # def = FLX


# ***--------------------- 16_demand -------------------------------------
# * (sector_may15): default for flexible regions
Expand Down Expand Up @@ -200,6 +264,7 @@ cfg$gms$processing <- "substitution_dec18" # def = substitution_dec18
# ***--------------------- 21_trade --------------------------------------
# * (free_apr16): free trade without restrictions
# * (off): no trade at all
# * (exo): exogenously prescribed trade
# * (selfsuff_reduced): self-sufficiency based trade with trade costs related
# * to exports
cfg$gms$trade <- "selfsuff_reduced" # def = selfsuff_reduced
Expand Down Expand Up @@ -237,17 +302,18 @@ cfg$gms$s31_fac_req_past <- 1 # def = 1

# ***--------------------- 32_forestry -----------------------------------
# * (static_sep16) : static forestry sector
# * (affore_vegc_dec16): static forestry sector + afforestation
cfg$gms$forestry <- "affore_vegc_dec16" # def = affore_vegc_dec16
# * (affore_vegc_dec16): static forestry sector + afforestation #to_be_deleted
# * (dynamic_oct19): static forestry sector + afforestation with detailed age-classes
cfg$gms$forestry <- "dynamic_oct19" # def = dynamic_oct19

# * afforestation planing horizon (years)
cfg$gms$s32_planing_horizon <- 80 # def = 80
cfg$gms$s32_planing_horizon <- 50 # def = 50

# Afforestation policy
# * ("none"): no prescribed afforestation
# * ("npi"): prescribed afforestation based on NPI policies
# * ("ndc"): prescribed afforestation based on NPI+NDC policies
cfg$gms$c32_aff_policy <- "npi" # def = "none"
cfg$gms$c32_aff_policy <- "npi" # def = "npi"

# maximum total global afforestation in Mha (Inf = no constraint)
cfg$gms$s32_max_aff_area <- Inf # def = Inf
Expand All @@ -266,8 +332,8 @@ cfg$gms$urban <- "static" # def = static
# ***--------------------- 35_natveg --------------------------------------
# * 35_natveg includes primforest, secdforest and other land
# * (static): static natveg land
# * (dynamic_may18): dynamic natveg land
cfg$gms$natveg <- "dynamic_may18" # def = dynamic_may18
# * (dynamic_oct19): dynamic natveg land with detailed age-classes
cfg$gms$natveg <- "dynamic_oct19" # def = dynamic_oct19

# * protected areas (primforest,secdforest,other land)
# * (WDPA) WDPA IUCN catI+II
Expand Down Expand Up @@ -347,10 +413,14 @@ cfg$gms$s42_watdem_nonagr_scenario <- 1 # def = 1
# * (3): gdp driven increase
cfg$gms$s42_irrig_eff_scenario <- 1 # def = 1

# * Irrigation efficiency
# * (Only used if global static value is requested)
cfg$gms$s42_irrigation_efficiency <- 0.66 # def=0.66

# * Environmental flow protection policy
# * (off): no EFP policy
# * (on): global EFP policy starting in 2015
# * (mixed): EFP policy starting in 2015 only in hic regions
# * (on): global EFP policy
# * (mixed): EFP policy only in hic regions
cfg$gms$c42_env_flow_policy <- "off" # def = "off"

# * Environmental flow protection scenario
Expand Down Expand Up @@ -395,13 +465,14 @@ cfg$gms$climate <- "static" # def = static
# * (exoeff_aug16): exogenous nr efficiency
cfg$gms$nr_soil_budget <- "exoeff_aug16" # def = exoeff_aug16

# * options: neff55_55_starty1990,neff60_60_starty1990,neff65_70_starty1990,
# * scenario for nr efficiency on croplands or pastures
# * options: constant,
# * neff55_55_starty1990,neff60_60_starty1990,neff65_70_starty1990,
# * neff65_70_starty2010,neff60_60_starty2010,neff55_60_starty2010,
# * neff70_75_starty2010,neff75_80_starty2010,neff80_85_starty2010
# * neff85_85_starty2010
cfg$gms$c50_scen_neff <- "neff60_60_starty2010" # def = neff60_60_starty2010
# * scenario for animal waste management.
# * option: "ssp1", "ssp2", "ssp3", "ssp4", "ssp5", "constant", "a1", "a2", "b1","b2"
cfg$gms$c55_scen_conf <- "ssp2" # def = ssp2
cfg$gms$c50_scen_neff_pasture <- "constant" # def = constant

# ***--------------------- 51_nitrogen ------------------------------------
# * (ipcc2006_sep16): IPCC based nitrogen implementation
Expand All @@ -413,6 +484,9 @@ cfg$gms$nitrogen <- "ipcc2006_sep16" # def = ipcc2006_sep16
# * (off): carbon calculations deactivated
cfg$gms$carbon <- "normal_dec17" # def = normal_dec17

# * switch for using natveg (0) or plantation (1) growth curves for afforestation
cfg$gms$s52_forestry_plantation <- 0 # def = 0

# * carbon scenario
# * options: cc (climate change)
# * nocc (no climate change)
Expand All @@ -433,16 +507,27 @@ cfg$gms$phosphorus <- "off" # def = off
# * (off): deactivated animal waste management
cfg$gms$awms <- "ipcc2006_aug16" # def = ipcc2006_aug16

# * scenario for animal waste management.
# * option: "ssp1", "ssp2", "ssp3", "ssp4", "ssp5", "constant", "a1", "a2", "b1","b2",
#* "GoodPractice"
cfg$gms$c55_scen_conf <- "ssp2" # def = ssp2

# ***--------------------- 56_ghg_policy ----------------------------------
# * (price_jan19): GHG emission pricing with phase-in over 20 year period and depending on development state
cfg$gms$ghg_policy <- "price_jan19" # def = price_jan19
# * (price_jan20): applies pollutant prices to different emission types and calculates the reward for CDR from afforestation
cfg$gms$ghg_policy <- "price_jan20" # def = price_jan20

# * Switch for scaling GHG price with development state (1=on 0=off)
cfg$gms$s56_ghgprice_devstate_scaling <- 0 # def = 0

# * Switch for phasing-in GHG price over a 20 year period (1=on 0=off)
cfg$gms$s56_ghgprice_phase_in <- 0 # def = 0

# * start year of GHG emission pricing phase-in (only used in price_jan19)
# * start year of GHG emission pricing phase-in (only used if s56_ghgprice_phase_in=1)
cfg$gms$s56_ghgprice_start <- 2025 # def = 2025

# * reduction factor for CO2 price (only used in price_jan19)
# * lowers the economic incentive for CO2 emission reduction (avoided deforestation) and afforestation
cfg$gms$s56_cprice_red_factor <- 0.5 # def = 0.5
cfg$gms$s56_cprice_red_factor <- 1 # def = 1

# * GHG pollutant price scenario
# * Available scenarios:
Expand Down Expand Up @@ -473,6 +558,20 @@ cfg$gms$s56_cprice_red_factor <- 0.5 # def = 0.5
# * coupling
cfg$gms$c56_pollutant_prices <- "R2M41-SSP2-NPi" # def = "R2M41-SSP2-NPi"

# * Switch for C price driven afforestation (1=on 0=off)
cfg$gms$s56_c_price_induced_aff <- 1

# * C price expectation for afforestation decision-making in years
# * 0 is myopic behaviour (only C price of current time step)
# * reflects perfect-foresight if equal to s32_planing_horizon
# * should not be higher than s32_planing_horizon
cfg$gms$s56_c_price_exp_aff <- 50 # def = 50

# * share of carbon credits for afforestation projects pooled in a buffer
# * Values > 0 will reduced the incentive for c price induced afforestation
# * a plausible value is 0.2, based on the Gold Standard for afforestation projects
cfg$gms$s56_buffer_aff <- 0.2 # def = 0.2

# * Upper limit for CH4 and N2O GHG price (USD05MER per tC)
# * Limits GHG prices selected in c56_pollutant_prices to the chosen value.
# * CH4 and N2O GHG prices are limited by default to 1000 USD05MER per tC equivalent,
Expand All @@ -482,16 +581,17 @@ cfg$gms$c56_pollutant_prices <- "R2M41-SSP2-NPi" # def = "R2M41-SSP2-NPi
cfg$gms$s56_limit_ch4_n2o_price <- 1000 # def = 1000

# * emission policies
# * options: none, all, ssp_nosoil, all_nosoil
# * options: none, all, ssp_nosoil, redd+_nosoil, all_nosoil
# * none: Not including any GHG sources
# * ssp_nosoil: Above ground CO2 emis from LUC in natveg; all CH4 and N2O emissions
# * redd+_nosoil: Above ground CO2 emis from LUC in natveg and forestry; all CH4 and N2O emissions
# * all_nosoil: Above ground CO2 emis from LUC for all LUs; all CH4 and N2O emissions
# * all: CO2 emis from LUC in all LUs; all CH4 and N2O emissions
cfg$gms$c56_emis_policy <- "ssp_nosoil" # def = ssp_nosoil
cfg$gms$c56_emis_policy <- "redd+_nosoil" # def = redd+_nosoil

# * Treatment of negative costs originating from negative co2 emissions
# * reward negative co2 emissions (-Inf) or not (0)
# * s56_reward_neg_emis is applied the on emission policy chosen in c56_emis_policy
# * s56_reward_neg_emis is applied on the emission policy chosen in c56_emis_policy
# * In case of carbon pricing s56_reward_neg_emis = -Inf results in increase of other land
# * For runs with afforestation s56_reward_neg_emis should be 0 (default setting)
cfg$gms$s56_reward_neg_emis <- 0 # def = 0
Expand Down Expand Up @@ -618,7 +718,7 @@ cfg$gms$s80_num_nonopt_allowed <- Inf

# * 1: using optfile for specified solver settings
# * 0: default settings (optfile will be ignored)
cfg$gms$s80_optfile <- 0
cfg$gms$s80_optfile <- 1


#*******************************END MODULE SETUP********************************
Expand All @@ -638,7 +738,7 @@ cfg$logoption <- 2
# Should output.R generate output?
# List of output scripts that should be used
# Available scripts can be found in scripts/output/
cfg$output <- c("rds_report","validation","interpolation")
cfg$output <- c("rds_report","validation","disaggregation")

# Set the format for the results folder
# :date: is a placeholder for the current time stamp (e.g. "results:date:")
Expand All @@ -649,7 +749,10 @@ cfg$results_folder <- "output/:title::date:"
cfg$files2export <- list()
# Files that should be copied before MAgPIE is started
cfg$files2export$start <- c("input/info.txt",
"modules/10_land/input/avl_land.cs3",
"modules/10_land/input/avl_land_t_0.5.mz",
"modules/14_yields/input/lpj_yields_0.5.mz",
"modules/50_nr_soil_budget/input/f50_NitrogenFixationRateNatural_0.5.mz",
"modules/50_nr_soil_budget/input/f50_AtmosphericDepositionRates_0.5.mz",
"input/spatial_header.rda",
"scripts/run_submit/submit.R",
"scripts/run_submit/submit.sh",
Expand Down
Loading

0 comments on commit b862d2d

Please sign in to comment.