Move MAgPIE coupling between the Nash iterations - #2249
Merged
dklein-pik merged 154 commits intoDec 5, 2025
Conversation
Add new realization 'magpie' to module '30_biomass' copying 'magpie_40' and renaming everything. Any changes needed for the new coupling that are module-related (i.e. not in the core) will be done in the new module.
- updating biomass prices and biomass demand - calculating shift factors for supply curves
Introduce new preliminary switch 'cm_MAgPIE_Nash' to activate biomass coupling while still using the old emissions
…les using CSVRead
… it from a csv file (CSVread), since CSVread filled up the memory when it was called in the solve loop, leading to out of memory errors. Added R script that writes the MAgPIE data into a gdx. Add mapping from MAgPIE variables to REMIND parameters.
- core/preloop.gms -> core/presolve.gms - 47_regipol/regiCarbonPrice/datainput.gms -> 47_regipol/regiCarbonPrice/presolve.gms
…oupling with this switch.
…e to core because values are needed earlier
…f MAgPIE iterations sm_magpieIter to trigger the import of magpieData.gdx. Use coupling switch cm_MAgPIE_Nash only to activate the MAgPIE run itself.
Introduce decision and switch when to run MAgPIE Load MAgPIE data only after MAgPIE has run at least once, otherwise use input data. Set some switches only after MAgPIE has run at least one (macSwitch, n2obio).
… across Nash iterations
dklein-pik
requested review from
LaviniaBaumstark
and removed request for
laurinks
December 2, 2025 15:25
…ind into mergeRemindIntoRemMagNash
…ind into mergeRemindIntoRemMagNash
…t are currently not supported and add new ones
LaviniaBaumstark
left a comment
Member
There was a problem hiding this comment.
thanks for all the comments and documentation!
… obtain the MAgPIE folder before MAgPIE starts
…ind into mergeRemindIntoRemMagNash
…it gets updated in the coupling
…sv names and in variable names in the start scripts)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose of this PR
This PR replaces the previous coupling, in which REMIND and MAgPIE run sequentially, with shifting the MAgPIE runs between the Nash iterations.
start_bundle_coupled.Randstart_coupled.Rhave been removed. Usestart.Rtogether with ascenario_config_magpie*.csvfile (formerly known asscenario_config_coupled.csv) to activate the MAgPIE coupling, e.g.The new coupling is mainly perforemd in
core/presolve.gms, by calling an external R script, that transfers the data of the latest Nash solution to MAgPIE, runs MAgPIE, and transfers the MAgPIE data to amagpieData.gdx, which is then read by GAMS.If you need to continue runs to yield a better convergence, paste the path to a previous REMIND or MAgPIE report into the column
continueFromHerein thescenario_config_magpie.csvand start the respective scenario.Create convergence plots for individual runs with
and for continued runs with
Leftorvers
test_20-coupled.Rdoes not work with the new coupling and has been removed)empty_magpieworkpath_gdxand friends to coupled config and evaluate in start.RconfigureCfg L58ffsuch that it finds the right precursor, i.e. it looks forC_runspath_mif_ghgprice_landType of change
Parts concerned
Impact
Checklist
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)
Results are almost identical. Differences are due to slightly different solution paths, since in the old coupling REMIND is running multiple times, each time restarting not exactly where it left (e.g. co2 prices in the initial Nash iterations), whereas in the new coupling the next Nash iteration continues exactly where the old left (except for the variables that are exchanged in the couping).