improve and restructure core/declarations: add units where missing, improve descriptions, restructure along themes, add suggestions to move declarations to modules - #2142
Conversation
…actoring, should not affect the solution
lecfab
left a comment
There was a problem hiding this comment.
Thanks for this vast undertaking Felix. The structure will make declarations much clearer and allow us to put chunks in modules when relevant.
|
|
||
| *** co2 price mark-up per region on top of pm_taxCO2eq calculated in 46_carbonpriceRegi module | ||
| pm_taxCO2eqRegi(tall,all_regi) "Additional regional CO2 tax path calulated in in 46_carbonpriceRegi module to reach regional emissions targets [T$/GtC]. To get $/tCO2, multiply with 272 [T$/GtC]" | ||
| pm_taxCO2eqSum(tall,all_regi) "sum of pm_taxCO2eq, pm_taxCO2eqRegi, pm_taxCO2eqSCC [T$/GtC]. To get $/tCO2, multiply with 272 [T$/GtC]" |
There was a problem hiding this comment.
This pattern of comment comes back many times:
"explanation [T$/GtC]. To get $ /tCO2, multiply with 272 [T$/GtC]"
I would remove the second unit bracket, and eventually replace by
"explanation [T$/GtC]. To get $/tCO2, multiply with s_xxx ≈ 272"
With s_xxx a conversion factor, like those exist:
s_MtCO2_2_GtC "conversion factor from MtCO2 to native REMIND emission unit GtC" /2.727e-04/
sm_DptCO2_2_TDpGtC "Conversion multiplier to go from $/tCO2 to T$/GtC: 44/12/1000" /0.00366667/
| sm_tgn_2_pgc = (44/28) * s_gwpN2O * (12/44) * 0.001; | ||
| sm_tgch4_2_pgc = s_gwpCH4 * (12/44) * 0.001; | ||
|
|
||
| *** carbon intensities of coal, oil, and gas | ||
| *** carbon intensities of coal, oil, and gas (move to core datainput?) |
There was a problem hiding this comment.
Definitely, but it could maybe even go to 21_tax as it is mostly involved there.
|
|
||
| pm_cintraw(all_enty) "carbon intensity of fossils [GtC per TWa]" | ||
| *** parameters used for 2005 capacity calibration (move to module 5 intialCap?) |
There was a problem hiding this comment.
would agree, but it looks like pm_EN_demand_from_initialcap2 has a role in 24_trade, and pm_vintage_in in core
There was a problem hiding this comment.
Ideally, all of this code should be moved to initialCap then. Content-wise, it all has to do with getting the 2005 state right.
| o_avgAdjCostInv(ttot,all_regi,all_te) "average adjustment cost calculated in postsolve for diagnostics" | ||
| o_avgAdjCost_2_InvCost_ratioPc(ttot,all_regi,all_te) "ratio in % of average adj cost compared to direct inv costs" | ||
| *** energy service layer (only relevant for transport, move to transport module?) | ||
| pm_fe2es(tall,all_regi,all_teEs) "Conversion factor from final energies to transport energy services [Tpkm/TWa, Ttkm/Twa]" |
| $ifthen.minMaxSeFeSectorShareDev "%cm_seFeSectorShareDevMethod%" == "minMaxAvrgShare" | ||
| q_minMaxPenSeFeSectorShareDev(ttot,all_regi,all_enty,all_enty,emi_sectors,all_emiMkt) "min-max penalty balance for secondary energy share deviation in sectors" | ||
| $endif.minMaxSeFeSectorShareDev | ||
| p_adj_coeff_glob(all_te) "coefficient for adjustment costs - global scale [unitless]" |
There was a problem hiding this comment.
would it make sense to put together all the adjustment cost declarations?
Like p_adj_coeff_Orig, p_adj_seed_te_Orig, p_adj_coeff_glob, v_adjFactor...
(also if you understand them, documenting their differences would be very helpful 🙏 )
There was a problem hiding this comment.
Yes, this was done above. I think this specific parameter can be removed. That is why I sorted it to the bottom.
| pm_conv_TWa_EJ "conversion from TWa to EJ" /31.536/, | ||
| sm_c_2_co2 "conversion from c to co2" /3.666666666667/, | ||
| *** conversion factors of time units | ||
| *** ------------Unit Conversion Factors--------------- |
There was a problem hiding this comment.
Now that they are all reorganised, would be nice to make the conversion numbers consistent: so far they always have different numbers of decimals, different roundings etc..
Examples:
- s_zj_2_twa /31.7098/, but sm_EJ_2_TWa /31.71e-03/ (adding more digits is maybe unnecessary, as we already use the approximation 1a=365j)
- sm_DptCO2_2_TDpGtC /0.00366667/, but sm_c_2_co2 /3.666666666667/,
- etc
As it would change results a tiny bit, it could be annoying to put it in a PR where you want to test that results stay unchanged. But in this one it could make sense as the reordering has no impact?
There was a problem hiding this comment.
I agree. Perhaps lets do that in another PR.
| o_carbon_underground(ttot,all_regi,all_enty) "output parameter" | ||
| o_carbon_reemitted(ttot,all_regi,all_enty) "output parameter" | ||
|
|
||
| o_emi_conv(all_enty) "output parameter" / co2 3666.6666666666666666666666666667, ch4 28, n2o 416.4286, so2 1, bc 1, oc 1 / |
There was a problem hiding this comment.
see my comment on units elsewhere: if we use that many decimals for co2, this should also appear in the conversion factors s_...
…where pm_actualbudgetco2 has its maximum
…nce either peak budget year must be time step of maximum cumulative CO2 emissions or the difference in cumulative emissions between both time steps needs to be smaller than sm_peakbudget_diff_tolerance
|
I am agree with the merge as long as a decision is reached in https://github.com/remindmodel/development_issues/issues/623 |
|
@LaviniaBaumstark I would like to merge this now as it gets increasingly annoying to keep this branch up-to-date with develop. Any objections? |
|
Advertising here for another restructuring that i'd like to merge soon but don't know who should review it: |



Purpose of this PR
This restructures core/declarations and improves documentation. This is a step towards enhancing the modularization of REMIND by moving parts out the core to specific modules (see https://github.com/remindmodel/development_issues/issues/618). It is a pure refactoring and should not affect the results.
This change structures the declarations in the core into 5 categories and adds suggestions which declarations could be moved out to other modules (possibly in a later step to not overload this PR). These are the 5 categories:
I improved the documentation to the best of my knowledge but ofc I may overlook things. Note that I also used AI (github co-pilot) for parts of the tasks of moving code and reformating it. So, it would be important that for each section some people check whether they spot any issues or would suggest different categorization or documentation. Also check whether declarations that are flagged as "can be removed" can actually be removed (or had a purpose which got lost by accident or has been overlooked).
I'd appreciate feedback from the different people on the energy system (@lecfab, @Renato-Rodrigues), emissions (@Renato-Rodrigues, @amerfort, @gabriel-abrahao), Macro and Other category (@LaviniaBaumstark).
Update:
As the restructuring caused slight perturbations in the solver route that led to different peak budget year solutions, another convergence criterion was added for peak budget runs that checks that either
OR
see https://github.com/remindmodel/development_issues/issues/623
Next steps:
(to be followed up in subsequent PRs)
Here is a comparison with the version before and after the refactoring. NPi and PkBudg650 runs tested are practically identical.
/p/tmp/schreyer/Modeling/remind/refac/compScen-Refac_Before_After-2025-07-22_09.43.55-H12.pdfType of change
Indicate the items relevant for your PR by replacing ◻️ with ☑️.
Do not delete any lines. This makes it easier to understand which areas are affected by your changes and which are not.
Parts concerned
Impact
Checklist
Do not delete any line. Leave unfinished elements unchecked so others know how far along you are.
In the end all checkboxes must be ticked before you can merge.
make test) after my final commit and all tests pass (FAIL 0)remind2if and where it was neededforbiddenColumnNamesin readCheckScenarioConfig.R in case the PR leads to deprecated switchesCHANGELOG.mdcorrectly (added, changed, fixed, removed, input data/calibration)Further information (optional)