Parametric regional GHG cap (AR6 GWP) + trade self-sufficiency floor (+ NZB grid) - #4
Merged
Merged
Conversation
…e-in; soil-C carry-forward cap_apr26_reg (module 56 GHG-policy realization): - Continuous parametric regional cap: a config-driven, time-flexible cap trajectory (s56_emis_cap_parametric switch + start/target year and start/endpoint value scalars in input.gms; m_linear_time_interpol in preloop.gms). The cap is free before s56_emis_cap_start_year, ramps linearly from s56_emis_cap_start_value to s56_emis_cap_target by s56_emis_cap_target_year, and is held at the target for all later years (works for any horizon, incl. runs to 2100). No cs3 columns / capscen56 set entries needed. It is applied to the region(s) selected via policy_countries56 (config-driven region mask p56_cap_region, no hard-coded region — mirrors the existing country->region price-share machinery). With s56_emis_cap_parametric=0 (default) the cs3 path is used unchanged. - GWP basis switched AR5 -> AR6 (CH4 28->27, N2O 265->273) so the capped quantity uses the same GWP100 basis as the magpie4 GWP100AR6|Land reporting. 57_maccs/on_aug22: - Optional linear fade-in of the prescribed s57_maxmac steps (s57_maxmac_fadein/_start/_end). Gated: fadein=0 reproduces the flat baseline. 59_som (cellpool_jan23, static_jan19): - Carry the soil-C stock forward to the next timestep (as done for the above-ground pools), fixing soil-C telescoping under the cap (= PR magpiemodel#904). config/default.cfg: - Defaults for the new switches: the parametric cap (s56_emis_cap_parametric + start_year/start_value/target_year/target) and the MACC fade-in (s57_maxmac_fadein/_start/_end). scripts/start: NZB run setups using the parametric cap / no-cap reference runs (parametric +-200 extension, lever corners, baseline variants, reference runs). Parametric runs select the capped region via policy_countries56 (e.g. "BRA").
…into cap-parametric-ar6gwp
…t curve Young secondary forest on other land (youngsecdf) took its wood yield from the FRA-calibrated secdforest growing stock while its carbon followed the uncalibrated curve, letting the optimiser extract calibrated-level wood at near-zero booked carbon under any land-CO2 incentive. Add a dedicated im_growing_stock_ysf derived from the uncalibrated curve and feed it to the youngsecdf term of q35_prod_other, so wood yield and carbon are consistent. Addresses the PR magpiemodel#876 other-land wood-harvest known limitation.
Generalize the BRA-only forced wood/woodfuel self-sufficiency switch into a region-selectable lever: s21_force_wood_selfsuff (default off) + policy_countries21 country selector with a superregion mask (a superregion is forced only if all its countries are selected via supreg/i_to_iso), replacing the hard-coded sameas(h,"BRA") guard. Mirrors policy_countries56. Suppresses wood-harvest trade leakage when a region's land-use emissions are constrained. Also drop the unused ov56_emis_co2eq output block in cap_apr26_reg/postsolve.
One start script -> 49 SLURM jobs on the PIK HPC, all cap_apr26_reg / nocc /
AR6 GWP / forced BRA wood self-sufficiency, indexed on achieved reported
GWP100AR6|Land BRA AFOLU 2050:
Fam C conservation {WDPA, 30by30, HalfEarth} x cap ladder (cap alone)
Fam A BRA capped + RoW 2C price; global context {A/R + 2nd-gen bioenergy}
toggled on/off together
Fam B cap + BRA 1.5C price driving price-induced A/R + price-driven MACC
anchor NPI only
Tier-switchable (light/medium) via 2 lines; horizon via c_timesteps.
Family A ('BRA does not act alone') now applies the 2C context (price +
price-induced A/R + 2nd-gen bioenergy demand) to the REST OF WORLD only:
BRA stays capped/unpriced with BASELINE bioenergy demand (NPi2025; in NZB
BRA's bioenergy comes from MACRO). Implemented via scen_countries60=BRA so
the region split mirrors policy_countries56. Collapses to one gA_RoW2C
ladder ('context-off' == Family C HalfEarth). Adds NZB_FAMILIES env switch
to re-run a subset (e.g. NZB_FAMILIES=A) without touching C/B/anchor.
Replace the wood-only s21_force_wood_selfsuff pin with a general, region- and commodity-flexible minimum self-sufficiency FLOOR. - New equation q21_min_selfsuff: superregional production >= i21_min_selfsuff * demand -- a one-sided lower bound (raises self-sufficiency where it binds, does not cap the upper side; unlike the old two-sided i21_trade_bal_reduction pin). - i21_min_selfsuff = s21_forcesuff_value * f21_self_suff for the commodities in forcesuff21 and the regions in policy_countries21, from sm_fix_SSP2 onward. Anchored to the time-constant input f21_self_suff, so it freezes each commodity's 2025 export/import intensity -- no baseline run needed. - New switches: s21_force_selfsuff (on/off), forcesuff21 (subset of k_trade, empty by default), s21_forcesuff_value (fraction of the 2025 self-sufficiency held). - Removes s21_force_wood_selfsuff; wood/woodfuel self-sufficiency is now obtained by listing them in forcesuff21 (floor == pin for wood under a cap, since the binding side is always the lower bound). - nzb_hpc_grid.R updated to the new switch. Empty forcesuff21 / s21_force_selfsuff = 0 reproduces develop behaviour bit-for-bit. codeCheck-clean; compiles (gams main.gms action=c).
scripts/start/nzb_export_grid.R -- one start script for the 61-run NZB export grid
(each start_run -> one SLURM job). 7 families, indexed by achieved reported
GWP100AR6|Land BRA AFOLU 2050:
gC_wdpa / gC_30by30 / gC_half : conservation, cap alone + forced 1.5C MACC
gA_RoW2C : RoW at 2C, BRA capped/unpriced (WDPA), baseline BRA bioenergy
gB_price : cap + BRA 1.5C CO2 price (price-driven A/R + MACC), WDPA
gF_freeze: gC_wdpa + forcesuff21 = all BRA f21_self_suff>1 (export freeze)
g0_npi : NPI-only anchor
All: cap_apr26_reg, nocc, AR6 GWP, c56_cap_policy=all, s21_force_selfsuff=1 (BRA),
forest NPI, 5year2050. Reported ladder {-1000,-500,-250,-100,-50,0,50,100,250,500}
(cap target = reported + 50 nominal; dashboard re-indexes on achieved). BRA price
trimmed to its <= -63 window. NZB_FAMILIES env for subset re-runs.
…ciency Consolidate the NZB start scripts to one portable example (scripts/start/nzb_export_grid.R) and remove the exploratory ones; strip HPC/SLURM/site-specific wording from the keeper so it runs anywhere. Add cane/cassava/molasses to the common forcesuff21 self-sufficiency floor so no run shows spurious raw-sugar imports (a processing-hub artifact at f21~1.0).
flohump
marked this pull request as ready for review
July 3, 2026 14:47
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.
Summary
Adds the modelling machinery used for the Net-Zero Brazil (NZB) regional AFOLU-cap
analysis, on top of
emis_cap_reg. Everything sits behind new switches that default tocurrent behaviour, so
emis_cap_reg/develop runs are bit-preserved unless a switch isturned on (all new mechanisms gated at
sm_fix_SSP2).What's in it
Module 56 (
cap_apr26_reg) — parametric regional cap + AR6 GWPTime-flexible linear cap ramp (
s56_emis_cap_parametric=1): free beforestart_year,linear
start_value→targetbytarget_year, held after — viam_linear_time_interpolin
preloop.gms. Region-general: applied to the regions selected bypolicy_countries56(mask
p56_cap_region, no hard-coded region); supersedes the discrete cs3 ladder forcontinuous cap sweeps. AR6 GWP100 baked into
p56_gwp(CH₄=27, N₂O=273) so theconstrained quantity matches the
GWP100AR6|Landreporting basis.Module 21 (
selfsuff_reduced) — minimum self-sufficiency floorNew one-sided lower bound
q21_min_selfsuff:Σ vm_prod_reg ≥ i21_min_selfsuff · Σ vm_supply, anchored at the 2025f21_self_suffratio ("freeze at 2025", no baseline runneeded). Region mask
policy_countries21, commodity subsetforcesuff21, scaled bys21_forcesuff_value. Keeps a tight regional cap from cutting the region's exports (tradeleakage) and prevents spurious raw-feedstock imports.
Module 57 (MACC) — temporal fade-in
s57_maxmac_fadeinlinearly fades forced MAC-curve abatement betweens57_maxmac_fadein_start/_end(default 2025→2050) for a 1.5 °C-aligned path.Modules 14 / 35 / 59 — supporting fixes
youngsecdfharvestable growing stock taken from the uncalibrated secondary-forest curve(resolves a wood-yield/carbon inconsistency; also a candidate for upstream
develop);soil-C carry-forward in
postsolve.config + start script
config/default.cfgregisters all new switches, each defaulting to current behaviour(
s56_emis_cap_parametric=0,s21_force_selfsuff=0,forcesuff21="",s57_maxmac_fadein=0).scripts/start/nzb_export_grid.Ris one portable example thatlaunches the 61-run NZB comparison grid (7 policy families × a reported-AFOLU cap ladder)
and documents how the switches combine.
Testing
codeCheckclean;gams main.gms action=ccompiles.emis_cap_regbaseline reproduced.Status
Draft — opening for review of the mechanism/config surface before finalising.