Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions core/bounds.gms
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,8 @@ if(c_ccsinjecratescen > 0,
*** Potential of EU27 regions is pooled and redistributed according to GDP (Only upper limit for 2030)
*** Norway and UK announced to store CO2 for EU27 countries. So 50% of Norway and UK potential in 2030 is attributed to EU27-Pool
if(not cm_emiscen = 1, !! cm_emiscen 1 = BAU
vm_co2CCS.lo(t,regi,"cco2","ico2","ccsinje","1") $ (t.val <= 2030) = s_MtCO2_2_GtC * p_boundCapCCS(t,regi,"operational") $ (t.val <= 2030);
vm_co2CCS.up(t,regi,"cco2","ico2","ccsinje","1") $ (t.val <= 2030) = s_MtCO2_2_GtC * (
vm_co2CCS.lo(t,regi,"cco2","ico2","ccsinje","1") $ (t.val <= 2030) = sm_MtCO2_2_GtC * p_boundCapCCS(t,regi,"operational") $ (t.val <= 2030);
vm_co2CCS.up(t,regi,"cco2","ico2","ccsinje","1") $ (t.val <= 2030) = sm_MtCO2_2_GtC * (
p_boundCapCCS(t,regi,"operational") $ (t.val <= 2030)
+ p_boundCapCCS(t,regi,"construction") $ (t.val <= 2030)
+ p_boundCapCCS(t,regi,"planned") $ (t.val <= 2030) * c_fracRealfromAnnouncedCCScap2030);
Expand Down Expand Up @@ -372,7 +372,7 @@ loop(regi $ (p_boundCapCCSindicator(regi) = 0),
*** Limit REMINDs ability to vent captured CO2 to 1 MtCO2 per yr per region. This happens otherwise to a great extend in stringent climate
*** policy scenarios if CCS and CCU capacities are limited in early years, to lower overall adjustment costs of capture technologies.
*** In reality, people don't have perfect foresight and without storage or usage capacities, no capture facilities will be built.
v_co2capturevalve.up(t,regi) = 1 * s_MtCO2_2_GtC;
v_co2capturevalve.up(t,regi) = 1 * sm_MtCO2_2_GtC;


*** ==================================================================
Expand Down
21 changes: 10 additions & 11 deletions core/datainput.gms
Original file line number Diff line number Diff line change
Expand Up @@ -561,23 +561,22 @@ $offdelim

*** carbon intensities of coal, oil, and gas
*** emissions factor of primary energy fossil fuels
pm_cintraw("pecoal") = 26.1 / s_zj_2_twa;
pm_cintraw("peoil") = 20.0 / s_zj_2_twa;
pm_cintraw("pegas") = 15.0 / s_zj_2_twa;
pm_cintraw("pecoal") = 26.1 / s_ZJ_2_TWa;
pm_cintraw("peoil") = 20.0 / s_ZJ_2_TWa;
pm_cintraw("pegas") = 15.0 / s_ZJ_2_TWa;

$ifthen.tech_CO2capturerate not "%c_tech_CO2capturerate%" == "off"
p_PECarriers_CarbonContent(peFos)=pm_cintraw(peFos);
*** From conversation: 25 GtC/ZJ is the assumed carbon content of PE biomass (makes default bioh2c capture rate 90%)
*** Convert to GtC/TWa
p_PECarriers_CarbonContent("pebiolc")=25 / s_zj_2_twa;
p_PECarriers_CarbonContent("pebiolc") = 25 / s_ZJ_2_TWa; !! convert 25 GtC/ZJ to GtC/TWa
loop(pe2se(entyPe,entySe,te)$(p_tech_co2capturerate(te)),
if(p_tech_co2capturerate(te) gt 0,
if(p_tech_co2capturerate(te) ge 1,
abort "Error: Inconsistent switch usage. A CO2 capture rate is greater than 1. Check c_tech_CO2capturerate.";
);
*** Alter CO2 capture rate in f_dataemiglob
*** f_dataemiglob is given in GtC/ZJ
f_dataemiglob(entyPe,entySe,te,"cco2") = p_tech_co2capturerate(te) * p_PECarriers_CarbonContent(entyPe) * s_zj_2_twa;
f_dataemiglob(entyPe,entySe,te,"cco2") = p_tech_co2capturerate(te) * p_PECarriers_CarbonContent(entyPe) * s_ZJ_2_TWa;
if(sameAs(entyPe,"pebiolc"),
f_dataemiglob(entyPe,entySe,te,"co2") = -f_dataemiglob(entyPe,entySe,te,"cco2") ;
else
Expand All @@ -602,8 +601,8 @@ $ifthen "%c_SSP_forcing_adjust%" == "forcing_SSP5"
$endif
);
*nb* specific emissions of transformation technologies (co2 in gtc/zj -> conv. gtc/twyr):
f_dataemiglob(enty,enty2,te,"co2")$pe2se(enty,enty2,te) = 1/s_zj_2_twa * f_dataemiglob(enty,enty2,te,"co2");
f_dataemiglob(enty,enty2,te,"cco2") = 1/s_zj_2_twa * f_dataemiglob(enty,enty2,te,"cco2");
f_dataemiglob(enty,enty2,te,"co2")$pe2se(enty,enty2,te) = 1/s_ZJ_2_TWa * f_dataemiglob(enty,enty2,te,"co2");
f_dataemiglob(enty,enty2,te,"cco2") = 1/s_ZJ_2_TWa * f_dataemiglob(enty,enty2,te,"cco2");

table f_dataetaglob(tall,all_te) "global eta data"
$include "./core/input/generisdata_varying_eta.prn"
Expand Down Expand Up @@ -1545,9 +1544,9 @@ $include "./core/input/f_nechem_emissionFactors.cs4r"
$offdelim
/;

pm_emifacNonEnergy(ttot,regi,"sesofos", "fesos","indst","co2") = f_nechem_emissionFactors(ttot,regi,"solids") / s_zj_2_twa;
pm_emifacNonEnergy(ttot,regi,"seliqfos","fehos","indst","co2") = f_nechem_emissionFactors(ttot,regi,"liquids") / s_zj_2_twa;
pm_emifacNonEnergy(ttot,regi,"segafos", "fegas","indst","co2") = f_nechem_emissionFactors(ttot,regi,"gases") / s_zj_2_twa;
pm_emifacNonEnergy(ttot,regi,"sesofos", "fesos","indst","co2") = f_nechem_emissionFactors(ttot,regi,"solids") / s_ZJ_2_TWa;
pm_emifacNonEnergy(ttot,regi,"seliqfos","fehos","indst","co2") = f_nechem_emissionFactors(ttot,regi,"liquids") / s_ZJ_2_TWa;
pm_emifacNonEnergy(ttot,regi,"segafos", "fegas","indst","co2") = f_nechem_emissionFactors(ttot,regi,"gases") / s_ZJ_2_TWa;

***------ Read in projections for incineration rates of plastic waste---
*** "incineration rates [fraction]"
Expand Down
4 changes: 2 additions & 2 deletions core/declarations.gms
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ sm_trillion_2_non "trillion to non" /1e+12/,

*** energy units
pm_conv_TWa_EJ "conversion from TWa to EJ" /31.536/,
s_zj_2_twa "zeta joule to tw year" /31.7098/,
s_ZJ_2_TWa "zeta joule to tw year" /31.71/,
sm_EJ_2_TWa "multiplicative factor to convert from EJ to TWa" /31.71e-03/,
sm_GJ_2_TWa "multiplicative factor to convert from GJ to TWa" /31.71e-12/,
sm_TWa_2_TWh "tera Watt year to Tera Watt hour" /8.76e+3/,
Expand All @@ -628,7 +628,7 @@ sm_c_2_co2 "conversion from c to co2" /3.666666
s_NO2_2_N "convert NO2 to N [14 / (14 + 2 * 16)]" / .304 /
sm_tgn_2_pgc "conversion factor 100-yr GWP from TgN to PgCeq"
sm_tgch4_2_pgc "conversion factor 100-yr GWP from TgCH4 to PgCeq"
s_MtCO2_2_GtC "conversion factor from MtCO2 to native REMIND emission unit GtC" /2.727e-04/
sm_MtCO2_2_GtC "conversion factor from MtCO2 to native REMIND emission unit GtC" /2.727e-04/
s_MtCH4_2_TWa "Energy content of methane. MtCH4 --> TWa: 1 MtCH4 = 1.23 * 10^6 toe * 42 GJ/toe * 10^-9 EJ/GJ * 1 TWa/31.536 EJ = 0.001638 TWa (BP statistical review)" /0.001638/
s_gwpCH4 "Global Warming Potentials of CH4, AR5 WG1 CH08 Table 8.7" /28/
s_gwpN2O "Global Warming Potentials of N2O, AR5 WG1 CH08 Table 8.7" /265/
Expand Down
192 changes: 82 additions & 110 deletions core/loop.gms
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
*** | Contact: remind@pik-potsdam.de
*** SOF ./core/loop.gms

*--------------------------------------------------------------------------
***-------------------------------------------------------------------
*** solveoptions
*--------------------------------------------------------------------------
***-------------------------------------------------------------------
option limcol = 0;
option limrow = 0;
hybrid.optfile = 1;
Expand All @@ -21,158 +21,130 @@ o_modelstat = 100;

$ifthen.calibrate "%CES_parameters%" == "calibrate" !! CES_parameters
$ifthen.subsectors "%industry%" == "subsectors" !! industry
!! Calibrating industry/subsectors lead to random infeasibilities on the order
!! of 1e-15. Relaxing this attribute a little solves this problem.
*** Calibrating industry/subsectors lead to random infeasibilities on the order of 1e-15.
*** Relaxing this attribute a little solves this problem.
hybrid.tolinfeas = 1e-14;
$endif.subsectors
$endif.calibrate

***-------------------------------------------------------------------
*** read GDX
*** read GDX
***-------------------------------------------------------------------
*** load start gdx

execute_loadpoint "input";

***--------------------------------------------------------------------------
*** start iteration loop
***--------------------------------------------------------------------------

LOOP(iteration $(ord(iteration)<(cm_iteration_max+1)),
***-------------------------------------------------------------------
*** start iteration loop
***-------------------------------------------------------------------
loop(iteration $ (iteration.val <= cm_iteration_max),
if(iteration.val = cm_iteration_max,
option solprint = on
);

IF(ord(iteration)>(cm_iteration_max-1),
OPTION solprint=on
);
*--------------------------------------------------------------------------
***-------------------------------------------------------------------
*** BOUNDS
*--------------------------------------------------------------------------
***-------------------------------------------------------------------
$include "./core/bounds.gms";
$batinclude "./modules/include.gms" bounds


***--------------------------------------------------------------------------
***-------------------------------------------------------------------
*** PRESOLVE
***--------------------------------------------------------------------------
***-------------------------------------------------------------------
$include "./core/presolve.gms";
$batinclude "./modules/include.gms" presolve

*** Fixing information (.L, .FX and .M) from run to be fixed to is read in from input_ref.gdx (t < cm_startyear)
*** happens via submit.R script (files levs.gms, fixings.gms, margs.gms)
*** submit.R looks for the unique string in the following line and replaces it with the offlisting include into the full.gms at this position
***cb20140305readinpositionforfixingfiles
*** When there is a reference run, input_ref.gdx contains the necessary fixing information (.L, .FX and .M) for t < cm_startyear
*** Script submit.R creates reference files (levs.gms, fixings.gms, margs.gms) and inludes them in full.gms by replacing the following line
*** cb20140305readinpositionforfixingfiles

*** In case of fixing, fix to prices from input_ref.gdx (t < cm_startyear).
*** Parameters are not automatically treated by the fixing mechanism above.
if( (cm_startyear gt 2005),
*** Also fix prices, which are not automatically treated by the fixing mechanism above.
if(cm_startyear > 2005,
Execute_Loadpoint "input_ref" p_pvpRef = pm_pvp;
pm_pvp(ttot,trade)$( (ttot.val ge 2005) and (ttot.val lt cm_startyear) and (NOT tradeSe(trade))) = p_pvpRef(ttot,trade);
);
pm_pvp(ttot,trade) $ (ttot.val >= 2005 and ttot.val < cm_startyear and not tradeSe(trade)) = p_pvpRef(ttot,trade);
);

***--------------------------------------------------------------------------
***-------------------------------------------------------------------
*** SOLVE
***--------------------------------------------------------------------------
***-------------------------------------------------------------------
*** Set options for debugging
if (cm_nash_mode eq 1,
option
solprint = on
limcol = 2147483647
limrow = 2147483647
;
);

if(cm_nash_mode = 1,
option
solprint = on
limcol = 2147483647
limrow = 2147483647
;
);

o_modelstat = 100;
loop(sol_itr$(sol_itr.val <= cm_solver_try_max),
if(o_modelstat ne 2,
loop(sol_itr $ (sol_itr.val <= cm_solver_try_max),
if(o_modelstat ne 2,
$batinclude "./modules/include.gms" solve
)
)
); !! end of sol_itr loop, when o_modelstat is not equal to 2

***---------------------------------------------------------
*** Track of changes between iterations
***---------------------------------------------------------
loop(entyPe$(NOT sameas(entyPe,"peur")),
o_negitr_cumulative_peprod(iteration,entyPe) = 0.031536
* sum(regi,
sum(ttot$( (ttot.val lt 2100) AND (ttot.val gt 2005)), vm_prodPe.l(ttot,regi,entyPe) * pm_ts(ttot) )
+ sum(ttot$(ttot.val eq 2005), vm_prodPe.l(ttot,regi,entyPe) * pm_ts(ttot) * 0.5 )
+ sum(ttot$(ttot.val eq 2100), vm_prodPe.l(ttot,regi,entyPe) * ( pm_ttot_val(ttot)- pm_ttot_val(ttot-1) ) * 0.5 )
);
);
o_negitr_cumulative_peprod(iteration,"peur") =
sum(regi,
sum(ttot$( (ttot.val lt 2100) AND (ttot.val gt 2005)), sum(pe2rlf("peur",rlf), 0.4102 * vm_prodPe.l(ttot,regi,"peur") * pm_ts(ttot) ) )
+ sum(ttot$(ttot.val eq 2005), 0.4102 * vm_prodPe.l(ttot,regi,"peur") * pm_ts(ttot) * 0.5 )
+ sum(ttot$(ttot.val eq 2100), 0.4102 * vm_prodPe.l(ttot,regi,"peur") * ( pm_ttot_val(ttot)- pm_ttot_val(ttot-1) ) * 0.5 )
);
o_negitr_cumulative_CO2_emineg_co2luc(iteration) =
sum(regi,
sum(ttot$( (ttot.val lt 2100) AND (ttot.val gt 2005)), 3.6667 * vm_emiMacSector.l(ttot,regi,"co2luc") * pm_ts(ttot) )
+ sum(ttot$(ttot.val eq 2005), 3.6667 * vm_emiMacSector.l(ttot,regi,"co2luc") * pm_ts(ttot) * 0.5 )
+ sum(ttot$(ttot.val eq 2100), 3.6667 * vm_emiMacSector.l(ttot,regi,"co2luc") * ( pm_ttot_val(ttot)- pm_ttot_val(ttot-1) ) * 0.5 )
);
***-------------------------------------------------------------------
*** Track of changes between iterations
***-------------------------------------------------------------------
o_negitr_cumulative_peprod(iteration,entyPe) =
((1 / s_ZJ_2_TWa) $ (not sameas(entyPe,"peur")) + 0.4102 $ (sameas(entyPe,"peur"))) !! conversion from TWa (or Mt uranium) to ZJ
* sum(regi,
sum(ttot $ (ttot.val < 2100 and ttot.val > 2005), vm_prodPe.l(ttot,regi,entyPe) * pm_ts(ttot) )
+ sum(ttot $ (ttot.val = 2005), vm_prodPe.l(ttot,regi,entyPe) * pm_ts(ttot) * 0.5 )
+ sum(ttot $ (ttot.val = 2100), vm_prodPe.l(ttot,regi,entyPe) * ( pm_ttot_val(ttot) - pm_ttot_val(ttot-1) ) * 0.5 )
);

o_negitr_cumulative_CO2_emineg_cement(iteration) =
sum(regi,
sum(ttot$( (ttot.val lt 2100) AND (ttot.val gt 2005)), 3.6667 * vm_emiMacSector.l(ttot,regi,"co2cement_process") * pm_ts(ttot) )
+ sum(ttot$(ttot.val eq 2005), 3.6667 * vm_emiMacSector.l(ttot,regi,"co2cement_process") * pm_ts(ttot) * 0.5 )
+ sum(ttot$(ttot.val eq 2100), 3.6667 * vm_emiMacSector.l(ttot,regi,"co2cement_process") * ( pm_ttot_val(ttot)- pm_ttot_val(ttot-1) ) * 0.5 )
);
o_negitr_cumulative_CO2_emieng_seq(iteration)
=
3.6667
o_negitr_cumulative_CO2_emineg_co2luc(iteration) = sm_c_2_co2 !! conversion from carbon to CO2
* sum(regi,
sum(ttot $ (ttot.val < 2100 and ttot.val > 2005), vm_emiMacSector.l(ttot,regi,"co2luc") * pm_ts(ttot) )
+ sum(ttot $ (ttot.val = 2005), vm_emiMacSector.l(ttot,regi,"co2luc") * pm_ts(ttot) * 0.5 )
+ sum(ttot $ (ttot.val = 2100), vm_emiMacSector.l(ttot,regi,"co2luc") * ( pm_ttot_val(ttot) - pm_ttot_val(ttot-1) ) * 0.5 )
);

o_negitr_cumulative_CO2_emineg_cement(iteration) = sm_c_2_co2 !! conversion from carbon to CO2
* sum(regi,
sum((ttot,emi2te(enty,enty2,te,"cco2"))$( ttot.val gt 2005 AND ttot.val lt 2100 ),
vm_emiTeDetail.l(ttot,regi,enty,enty2,te,"cco2")
* pm_ts(ttot)
)
+ sum((ttot,emi2te(enty,enty2,te,"cco2"))$( ttot.val eq 2005 ),
vm_emiTeDetail.l(ttot,regi,enty,enty2,te,"cco2")
* pm_ts(ttot)
/ 2
)
+ sum((ttot,emi2te(enty,enty2,te,"cco2"))$( ttot.val eq 2100 ),
vm_emiTeDetail.l(ttot,regi,enty,enty2,te,"cco2")
* (pm_ttot_val(ttot) - pm_ttot_val(ttot-1))
/ 2
)
)
;
sum(ttot $ (ttot.val < 2100 and ttot.val > 2005), vm_emiMacSector.l(ttot,regi,"co2cement_process") * pm_ts(ttot) )
+ sum(ttot $ (ttot.val = 2005), vm_emiMacSector.l(ttot,regi,"co2cement_process") * pm_ts(ttot) * 0.5 )
+ sum(ttot $ (ttot.val = 2100), vm_emiMacSector.l(ttot,regi,"co2cement_process") * ( pm_ttot_val(ttot) - pm_ttot_val(ttot-1) ) * 0.5 )
);

o_negitr_cumulative_CO2_emieng_seq(iteration) = sm_c_2_co2 !! conversion from carbon to CO2
* sum((regi,emi2te(enty,enty2,te,"cco2")),
sum(ttot $ ( ttot.val > 2005 and ttot.val < 2100 ), vm_emiTeDetail.l(ttot,regi,enty,enty2,te,"cco2") * pm_ts(ttot))
+ sum(ttot $ ( ttot.val = 2005 ), vm_emiTeDetail.l(ttot,regi,enty,enty2,te,"cco2") * pm_ts(ttot) * 0.5)
+ sum(ttot $ ( ttot.val = 2100 ), vm_emiTeDetail.l(ttot,regi,enty,enty2,te,"cco2") * ( pm_ttot_val(ttot) - pm_ttot_val(ttot-1) ) * 0.5)
);

o_negitr_disc_cons_dr5_reg(iteration,regi) =
sum(ttot$( (ttot.val lt 2100) AND (ttot.val gt 2005)), vm_cons.l(ttot,regi) * (0.95 ** (pm_ttot_val(ttot) - s_t_start)) * pm_ts(ttot) )
+ sum(ttot$(ttot.val eq 2005), vm_cons.l(ttot,regi) * (0.95 ** (pm_ttot_val(ttot) - s_t_start)) * pm_ts(ttot) * 0.5 )
+ sum(ttot$(ttot.val eq 2100), vm_cons.l(ttot,regi) * (0.95 ** (pm_ttot_val(ttot) - s_t_start)) * ( pm_ttot_val(ttot)- pm_ttot_val(ttot-1) ) * 0.5 )
;
sum(ttot $ ( (ttot.val < 2100) and (ttot.val > 2005)), vm_cons.l(ttot,regi) * (0.95 ** (pm_ttot_val(ttot) - s_t_start)) * pm_ts(ttot) )
+ sum(ttot $ (ttot.val = 2005), vm_cons.l(ttot,regi) * (0.95 ** (pm_ttot_val(ttot) - s_t_start)) * pm_ts(ttot) * 0.5 )
+ sum(ttot $ (ttot.val = 2100), vm_cons.l(ttot,regi) * (0.95 ** (pm_ttot_val(ttot) - s_t_start)) * ( pm_ttot_val(ttot) - pm_ttot_val(ttot-1) ) * 0.5 );

o_negitr_disc_cons_drInt_reg(iteration,regi) =
sum(ttot$( (ttot.val lt 2100) AND (ttot.val gt 2005)), vm_cons.l(ttot,regi) * qm_budget.m(ttot,regi)/ (qm_budget.m("2005",regi) + 1.e-8) * pm_ts(ttot) )
+ sum(ttot$(ttot.val eq 2005), vm_cons.l(ttot,regi) * qm_budget.m(ttot,regi)/ (qm_budget.m("2005",regi) + 1.e-8) * pm_ts(ttot) * 0.5 )
+ sum(ttot$(ttot.val eq 2100), vm_cons.l(ttot,regi) * qm_budget.m(ttot,regi)/ (qm_budget.m("2005",regi) + 1.e-8) * ( pm_ttot_val(ttot)- pm_ttot_val(ttot-1) ) * 0.5 )
;
sum(ttot $ ( (ttot.val < 2100) and (ttot.val > 2005)), vm_cons.l(ttot,regi) * qm_budget.m(ttot,regi)/ (qm_budget.m("2005",regi) + sm_eps) * pm_ts(ttot) )
+ sum(ttot $ (ttot.val = 2005), vm_cons.l(ttot,regi) * qm_budget.m(ttot,regi) / (qm_budget.m("2005",regi) + sm_eps) * pm_ts(ttot) * 0.5 )
+ sum(ttot $ (ttot.val = 2100), vm_cons.l(ttot,regi) * qm_budget.m(ttot,regi) / (qm_budget.m("2005",regi) + sm_eps) * ( pm_ttot_val(ttot) - pm_ttot_val(ttot-1) ) * 0.5 );

***--------------------------------------------------------------------------
***-------------------------------------------------------------------
*** POSTSOLVE
***--------------------------------------------------------------------------
***-------------------------------------------------------------------
$include "./core/postsolve.gms";
$batinclude "./modules/include.gms" postsolve

*--------------------------------------------------------------------------
*** save gdx
*--------------------------------------------------------------------------
*** write the fulldata.gdx file after each optimal iteration
*** In Nash status 7 is considered optimal in that respect (see definition of
*** o_modelstat in solve.gms)
***-------------------------------------------------------------------
*** save gdx
***-------------------------------------------------------------------
*** Write the fulldata.gdx file after each optimal iteration
*** In Nash, status 7 is considered optimal (see definition of o_modelstat in solve.gms)
logfile.nr = 1;
if (o_modelstat le 2,
if(o_modelstat <= 2,
execute_unload "fulldata";
!! retain gdxes of intermediate iterations by copying them using shell
!! commands
if (c_keep_iteration_gdxes eq 1,
if(c_keep_iteration_gdxes = 1, !! save gdx of intermediate iterations using shell command "copy"
put_utility logfile, "shell" /
"cp fulldata.gdx fulldata_" iteration.val:0:0 ".gdx";
);
else
execute_unload "non_optimal";
if (c_keep_iteration_gdxes eq 1,
if(c_keep_iteration_gdxes = 1,
put_utility logfile, "shell" /
"cp non_optimal.gdx non_optimal_" iteration.val:0:0 ".gdx";
);
Expand Down
Loading