The DICEModel Module
DICEModel
— ModuleDICEModel
Implementation of the DICE 2023 model
Notes:
- Based on DICE2023-b-4-3-10.gms and included files (Nonco2-b-4-3-1.gms and FAIR-beta-4-3-1.gms)
- Variable casing has been harmonized that all parameters and post-optimization computation have lower cases, and all optimization variables have upper case.
Module Index
DICEModel.Parameters
DICEModel.RegParameters
DICEModel.run_dice
DICEModel.run_dice_scenario
DICEModel.@fields_to_vars
Detailed API
DICEModel.Parameters
— TypeParameters
This structure contains the "default" parameters, which can eventually be modified using keyword arguments in the run_dice(pars)
function (e.g. run_dice(a2base = 0.01)
).
The structure first defines some "raw" parameters, and then some "computed" parameters (mostly arrays of ntsteps length). Both can be overridden with keyword arguments in the run_dice(pars)
function. In particular, "computed" parameters can be overridden in two ways: either by overriding the raw parameters from which they are computed, or by computing the parameter in a different way (outside the model) and overriding the computed parameter.
Available parameters:
tstep
: Years per periodntsteps
: Number of time periodsregions
: Name of the regionsgama
: Capital elasticity in production functionpop1
: Initial world population 2020 (millions)popadj
: Growth rate to calibrate to 2050 population projectionpopasym
: Asymptotic population (millions)dk
: Depreciation rate on capital (per year)q1
: Initial world output 2020 (trill 2019 USD)al1
: Initial level of total factor productivityga1
: Initial growth rate for TFP per 5 yearsdela
: Decline rate of TFP per 5 yearsgsigma1
: Initial growth of sigma (per year)delgsig
: Decline rate of gsigma per periodasymgsig
: Asymptotic sigmae1
: Industrial emissions 2020 (GtCO2 per year)miu1
: Emissions control rate historical 2020fosslim
: Maximum cumulative extraction fossil fuels (GtC)cumemiss0
: Cumulative emissions 2020 (GtC)a1
: Damage intercepta2base
: Damage quadratic terma3
: Damage exponentexpcost2
: Exponent of control cost functionpback2050
: Cost of backstop in 2019$ per tCO2 (2050)gback
: Initial cost decline of backstop cost per yearcprice1
: Carbon price in 2020 (2019$ per tCO2)gcprice
: Growth rate of base carbon price per yearlimmiu2070
: Emission control limit from 2070limmiu2120
: Emission control limit from 2120limmiu2200
: Emission control limit from 2220limmiu2300
: Emission control limit from 2300delmiumax
: Emission control delta limit per periodbetaclim
: Climate betaelasmu
: Elasticity of marginal utility of consumptionprstp
: Pure rate of social time preferencepi_val
: Capital risk premium (renamed to avoid conflict with Julia's pi)k0
: Initial capital stock (10^12 2019 USD)siggc1
: Annual standard deviation of consumption growthsrf
: Scaling factor for discountingscale1
: Multiplicative scaling coefficientscale2
: Additive scaling coefficienteland0
: Carbon emissions from land 2015 (GtCO2 per year)deland
: Decline rate of land emissions (per period)f_misc2020
: Non-abatable forcings 2020f_misc2100
: Non-abatable forcings 2100f_ghgabate2020
: Forcings of abatable non-CO2 GHG in 2020f_ghgabate2100
: Forcings of abatable non-CO2 GHG in 2100eco2eghgb2020
: Emissions of abatable non-CO2 GHG (GtCO2e) in 2020eco2eghgb2100
: Emissions of abatable non-CO2 GHG (GtCO2e) in 2100emissrat2020
: Ratio of CO2e to industrial CO2 in 2020emissrat2100
: Ratio of CO2e to industrial CO2 in 2100fcoef1
: Coefficient of non-CO2 abateable emissionsfcoef2
: Coefficient of non-CO2 abateable emissionsyr0
: Calendar year that corresponds to model year zeroemshare0
: Carbon emissions share into Reservoir 0emshare1
: Carbon emissions share into Reservoir 1emshare2
: Carbon emissions share into Reservoir 2emshare3
: Carbon emissions share into Reservoir 3tau0
: Decay time constant for Reservoir 0tau1
: Decay time constant for Reservoir 1tau2
: Decay time constant for Reservoir 2tau3
: Decay time constant for Reservoir 3teq1
: Thermal equilibration parameter for box 1teq2
: Thermal equilibration parameter for box 2d1
: Thermal response timescale for deep oceand2
: Thermal response timescale for upper oceanirf0
: Pre-industrial IRF100irc
: Increase in IRF100 with cumulative carbon uptakeirt
: Increase in IRF100 with warmingfco22x
: Forcings of equilibrium CO2 doublingmat0
: Initial concentration in atmosphere in 2020 (GtC)res00
: Initial concentration in Reservoir 0 in 2020 (GtC)res10
: Initial concentration in Reservoir 1 in 2020 (GtC)res20
: Initial concentration in Reservoir 2 in 2020 (GtC)res30
: Initial concentration in Reservoir 3 in 2020 (GtC)mateq
: Equilibrium concentration in atmosphere (GtC)tbox10
: Initial temperature box 1 change in 2020 (°C)tbox20
: Initial temperature box 2 change in 2020 (°C)tatm0
: Initial atmospheric temperature change in 2020 (°C)times
: Time periods sequence (0,5,10,...,400)tidx
: Time periods index sequence (1,2,3,...,81)t0idx
: Time periods index sequence (0,1,2,...,80)nreg
: Number of regionsridx
: Regions index sequencerartp
: Risk-adjusted rate of time preferencemiuup
: Upper bounds on miuvarpcc
: Variance of per capita consumptionrprecaut
: Precautionary rate of returnrr1
: STP factor without precautionary factorrr
: STP with precautionary factoroptlrsav
: Optimal long-run savings rate used for transversalityl_temp
: Level of population and labor (temp, used only for its first value)l
: Level of population and laborga
: Growth rate of Total Factor Productivityal_temp
: Level of total factor productivity (temp, used only for its first value)al
: Level of total factor productivitycpricebase
: Carbon price in base casepbacktime
: Backstop price 2019$ per ton CO2sig1
: Carbon intensity 2020 kgCO2-output 2020gsig
: Change in sigma (rate of decarbonization)sigma_temp
: CO2-emissions output ratio (temp, used only for its first value)sigma
: CO2-emissions output ratioeland
co2e_ghgabateb
f_misc
emissrat
sigmatot
cost1tot
DICEModel.RegParameters
— TypeRegParameters
Regional specific parameters. The default is for for a single world entity (DICE2023), but the model provides a second "default" RICE2020 with the world divided in 12 regions.
Available parameters:
DICEModel.run_dice
— Methodrun_dice(;optimizer=optimizer_with_attributes(Ipopt.Optimizer,"print_level" => 5), bounds=Dict{String,Tuple{String,String}}(),kwargs...)
Run the DICE model (currently v 2023), possibly with custom optimiser, bounds or parameters.
This function runs the DICE model and returns the results as a named tuple.
Function arguments
optimizer': The optimiser to use and possibly its options. Defaults to: [
optimizerwithattributes(Ipopt.Optimizer,"print_level" => 5)`].bounds
`: A dictionary of equality or inequality constraints. Each constraint should be specified with the variable name as key and a two-element tuple as value. The first element is either "<=", ">=" or "==", and the second element is the right-hand side of the constraint (a single value or a vector of ntimesteps length). Default: (empty dictionary). See the source code for the names of the model variables.kwargs
: Keyword arguments to override the default parameter values. See the documentation for the [
Parameters`](@ref) structure for the available model parameters.
WARNING: Sometimes changing a parameter doesn't lead to the expected behavior. This is because the model (in its original GAMS form that has been re-implemented in this package) performs some calibrations with the parameters, so several parameters have to be changed together. For example all the scenarios that test different discount rates don't change only the prstp
parameter, but compute several other parameters, sometimes in a different matter than the default model, and have different calibration for initial conditions. Always check the source code to make sure that the parameter you want to change doesn't have other side effects in the model.
Outputs
- A named tuple containing the following fields:
solved
,status
,times
,tidx
, the post_process computed values, the optimisation variables, the parameters structure (pars
).
Examples:
res = run_dice()
ECO2_opt = res.ECO2
plot(res.times[1:11] .+ 2020,ECO2_opt[1:11],ylim=(0,80), title="CO₂ emissions",ylabel="GtCO₂/yr",label="C/B optimal", markershape=:circle, markercolor=:white)
res_crazy = run_dice(optimizer=optimizer_with_attributes(Ipopt.Optimizer,"print_level" => 0), bounds = Dict("MIU"=>("==",1.0), "TATM"=>("<=",15), "Y" =>(">=",[fill(floatmin(Float64),10);fill(0.1,71)]), "ECO2" =>("<=",10000)), a2base = 0.01)
Notes
- The
bounds
add constraints to the problem, but do not replace hard written bounds in the model. In particular, themiuup
parameter should be used instead for the upper limit of emission controls. - Bounds are always intended for the full time steps. If you need a bound for a subset of time steps (e.g. the first time step), you still need to assemble your full time array of the bound using
floatmin(Float64)
orfloatmax(Float64)
as appropriate.
DICEModel.run_dice_scenario
— Methodrun_dice_scenario(scenario::String)
Run one of the "official" 11 scenarios in Nordhous's DICE 2023 model:
cbopt
: The C/B optimal scenariot2c
: The temperature constrained to max 2 °C scenariot15c
: The temperature constrained to max 1.5 °C scenarioaltdam
: The alternative damage scenarioparisext
: The Paris extended scenariobase
: The base (current policies) scenarior5
: The scenario with discount rate of 5%r4
: The scenario with discount rate of 4%r3
: The scenario with discount rate of 3%r2
: The scenario with discount rate of 2%r1
: The scenario with discount rate of 1%
To run "your own" scenarios, use the function run_dice
, where you can set the input parameters and constraints as you like.
Output
- A named tuple containing the following fields:
solved
,status
,times
,tidx
, the post_process computed values and the optimization variables.
DICEModel.@fields_to_vars
— Macro@fields_to_vars(t,x)
Utility macro to convert a struct fields to local variables (for readibility, so that we can write parx
instead of using everywhere p.parx
).