Skip to content

Commit

Permalink
Merge pull request remindmodel#1729 from orichters/45fix
Browse files Browse the repository at this point in the history
some adjustments to diffCurvPhaseIn2Lin, add @laurinks as author
  • Loading branch information
orichters authored Jul 9, 2024
2 parents 7608333 + 2a61d3b commit 6d0ea62
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 16 deletions.
11 changes: 9 additions & 2 deletions .zenodo.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,18 @@
},
{
"name": "Klein, David",
"affiliation": "Potsdam Institute for Climate Impact Research"
"affiliation": "Potsdam Institute for Climate Impact Research",
"orcid": "0009-0001-7917-8041"
},
{
"name": "Koch, Johannes",
"affiliation": "Potsdam Institute for Climate Impact Research"
"affiliation": "Potsdam Institute for Climate Impact Research",
"orcid": "0000-0003-2920-8086"
},
{
"name": "Köhler-Schindler, Laurin",
"affiliation": "Potsdam Institute for Climate Impact Research",
"orcid": "0000-0003-4268-3084"
},
{
"name": "Körner, Alexander"
Expand Down
6 changes: 6 additions & 0 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,12 @@ authors:

- family-names: "Koch"
given-names: "Johannes"
orcid: https://orcid.org/0000-0003-2920-8086
affiliation: "Potsdam Institute for Climate Impact Research"

- family-names: "Köhler-Schindler"
given-names: "Laurin"
orcid: https://orcid.org/0000-0003-4268-3084
affiliation: "Potsdam Institute for Climate Impact Research"

- family-names: "Körner"
Expand Down
23 changes: 12 additions & 11 deletions modules/45_carbonprice/diffCurvPhaseIn2Lin/datainput.gms
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*** | Contact: [email protected]
*** SOF ./modules/45_carbonprice/diffCurvPhaseIn2Lin/datainput.gms
***------------------------------------------------------------------------------------------------------------------------
*** *BS* 20190930 linear convergence with starting points differentiated by GDP/capita, global price from 2040
*** linear convergence with starting points differentiated by GDP/capita, global price from 2050
***-----------------------------------------------------------------------------------------------------------------------


Expand All @@ -31,31 +31,32 @@ if(cm_co2_tax_2020 lt 0,
abort "please choose a valid cm_co2_tax_2020"
elseif cm_co2_tax_2020 ge 0,
*** convert tax value from $/t CO2eq to T$/GtC
p45_CO2priceTrajDeveloped("2040")= 3 * cm_co2_tax_2020 * sm_DptCO2_2_TDpGtC; !! shifted to 2040 to make sure that even in delay scenarios the fixpoint of the linear price path is inside the "t" range, otherwise the CO2 prices from reference run may be overwritten
p45_CO2priceTrajDeveloped("2040") = 3 * cm_co2_tax_2020 * sm_DptCO2_2_TDpGtC;
*** shifted to 2040 to make sure that even in delay scenarios the fixpoint of the linear price path is inside the "t" range, otherwise the CO2 prices from reference run may be overwritten
*** The factor 3 comes from shifting the 2020 value 20 years into the future at linear increase of 10% of 2020 value per year.
);



p45_CO2priceTrajDeveloped(ttot)$((ttot.val gt 2005) AND (ttot.val ge cm_startyear)) = p45_CO2priceTrajDeveloped("2040")*( 1 + 0.1/3 * (ttot.val-2040)); !! no CO2 price in 2005 and only change CO2 prices after ;
p45_CO2priceTrajDeveloped(t)$(t.val gt 2005) = p45_CO2priceTrajDeveloped("2040")*( 1 + 0.1/3 * (t.val-2040)); !! no CO2 price in 2005 and only change CO2 prices afterwards
*** annual increase by (10/3)% of the 2040 value is the same as a 10% increase of the 2020 value is the same as a linear increase from 0 in 2010 to the 2020/2040 value


*** Then create regional phase-in:
loop(ttot$((ttot.val ge cm_startyear) AND (ttot.val le cm_CO2priceRegConvEndYr) ),
p45_regCO2priceFactor(ttot,regi) =
loop(t$(t.val le cm_CO2priceRegConvEndYr),
p45_regCO2priceFactor(t,regi) =
min(1,
max(0,
p45_phasein_2025ratio(regi) + (1 - p45_phasein_2025ratio(regi))
* Power(
( (ttot.val - 2025) + (cm_CO2priceRegConvEndYr - 2025) * 0.1 )
max(0,
p45_phasein_2025ratio(regi) + (1 - p45_phasein_2025ratio(regi))
* Power(
( (t.val - 2025) + (cm_CO2priceRegConvEndYr - 2025) * 0.1 )
/ ( (cm_CO2priceRegConvEndYr - 2025) * 1.1 )
, 2
) !! use Power instead of ** to allow ttot be smaller than 2025, and thus the base to be negative
)
)
);
);
p45_regCO2priceFactor(ttot,regi)$(ttot.val ge cm_CO2priceRegConvEndYr) = 1;
p45_regCO2priceFactor(t,regi)$(t.val ge cm_CO2priceRegConvEndYr) = 1;


*** transition to global price - starting point depends on GDP/cap
Expand Down
1 change: 1 addition & 0 deletions modules/45_carbonprice/diffCurvPhaseIn2Lin/not_used.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ pm_prtp,input,questionnaire
vm_demFeSector,input,questionnaire
pm_emifac,input,questionnaire
cm_co2_tax_spread,input,added by codeCheck
cm_startyear,parameter,not needed
2 changes: 1 addition & 1 deletion scripts/output/single/MAGICC7_AR6.R
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ runHarmoniseAndInfillCmd <- paste(

runClimateEmulatorCmd <- paste(
"python", file.path(scriptsFolder, "run_clim.py"),
normalizePath(file.path(climateAssessmentFolder, paste0(baseFileName, "_harmonized_infilled.csv"))),
normalizePath(file.path(climateAssessmentFolder, paste0(baseFileName, "_harmonized_infilled.csv")), mustWork = FALSE),
climateAssessmentFolder,
"--num-cfgs", nparsets,
"--scenario-batch-size", 1,
Expand Down
2 changes: 1 addition & 1 deletion scripts/output/single/fixOnRef.R
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ fixOnMif <- function(outputdir) {
dref <- quitte::as.quitte(refmif)
d <- fixMAGICC(d, dref, startyear, title)
failfile <- file.path(outputdir, "log_fixOnRef.csv")
fixeddata <- piamInterfaces::fixOnRef(d, dref, ret = "TRUE_or_fixed", startyear = startyear, failfile = failfile)
fixeddata <- piamInterfaces::fixOnRef(d, dref, ret = "TRUE_or_fixed", startyear = startyear, failfile = failfile, relDiff = 0.00002)

update <- paste0("MAGICC data. ", if (! isTRUE(fixeddata)) "Run output.R -> single -> fixOnRef to fix the rest.")
if (! isTRUE(fixeddata) && isTRUE(envi$cfg$fixOnRefAuto)) {
Expand Down
2 changes: 1 addition & 1 deletion tutorials/11_ManagingRenv.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ REMIND uses [renv](https://rstudio.github.io/renv/) for managing required R pack
The `piamenv` functions explained earlier should cover all common tasks, use the following for more control.
- `renv::install("[email protected]")` install specific package version
- `renv::install("githubuser/package", ref = "<commit hash>")` install package from GitHub, optionally provide commit hash
- `renv::install("/p/tmp/username/yourpackagefolder")` install package from sources
- `renv::install("/p/tmp/username/yourpackagefolder")` install package from sources. Always use an absolute path!
- `renv::remove("package")` uninstall package
- `renv::update(exclude = "renv")` (`make update-renv-all`) update all packages except renv (please do not update renv itself)
- `renv::update("package")` update package
Expand Down

0 comments on commit 6d0ea62

Please sign in to comment.