Skip to content

Parametric regional GHG cap (AR6 GWP) + trade self-sufficiency floor (+ NZB grid) - #4

Merged
alexkoberle merged 9 commits into
emis_cap_regfrom
cap-parametric-ar6gwp
Jul 6, 2026
Merged

Parametric regional GHG cap (AR6 GWP) + trade self-sufficiency floor (+ NZB grid)#4
alexkoberle merged 9 commits into
emis_cap_regfrom
cap-parametric-ar6gwp

Conversation

@flohump

@flohump flohump commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

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 to
current behaviour, so emis_cap_reg/develop runs are bit-preserved unless a switch is
turned on (all new mechanisms gated at sm_fix_SSP2).

What's in it

Module 56 (cap_apr26_reg) — parametric regional cap + AR6 GWP

Time-flexible linear cap ramp (s56_emis_cap_parametric=1): free before start_year,
linear start_valuetarget by target_year, held after — via m_linear_time_interpol
in preloop.gms. Region-general: applied to the regions selected by policy_countries56
(mask p56_cap_region, no hard-coded region); supersedes the discrete cs3 ladder for
continuous cap sweeps. AR6 GWP100 baked into p56_gwp (CH₄=27, N₂O=273) so the
constrained quantity matches the GWP100AR6|Land reporting basis.

Module 21 (selfsuff_reduced) — minimum self-sufficiency floor

New one-sided lower bound q21_min_selfsuff: Σ vm_prod_reg ≥ i21_min_selfsuff · Σ vm_supply, anchored at the 2025 f21_self_suff ratio ("freeze at 2025", no baseline run
needed). Region mask policy_countries21, commodity subset forcesuff21, scaled by
s21_forcesuff_value. Keeps a tight regional cap from cutting the region's exports (trade
leakage) and prevents spurious raw-feedstock imports.

Module 57 (MACC) — temporal fade-in

s57_maxmac_fadein linearly fades forced MAC-curve abatement between
s57_maxmac_fadein_start/_end (default 2025→2050) for a 1.5 °C-aligned path.

Modules 14 / 35 / 59 — supporting fixes

youngsecdf harvestable 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.cfg registers 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.R is one portable example that
launches the 61-run NZB comparison grid (7 policy families × a reported-AFOLU cap ladder)
and documents how the switches combine.

Testing

  • codeCheck clean; gams main.gms action=c compiles.
  • The 61-run grid ran to completion, feasible across families.
  • New switches OFF by default → emis_cap_reg baseline reproduced.

Status

Draft — opening for review of the mechanism/config surface before finalising.

flohump added 9 commits June 28, 2026 15:11
…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").
…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
flohump requested a review from alexkoberle July 3, 2026 14:47
@flohump
flohump marked this pull request as ready for review July 3, 2026 14:47
@alexkoberle
alexkoberle merged commit afd188f into emis_cap_reg Jul 6, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants