Coder Social home page Coder Social logo

Comments (1)

danielkoll avatar danielkoll commented on June 19, 2024 1

Here is a minimal example. The example compares a 'delayed' policy scenario in which carbon capture only becomes available after 2100, versus an 'early' policy scenario in which carbon capture is available all along.

using ClimateMARGO
using ClimateMARGO.Models
using ClimateMARGO.Optimization
using ClimateMARGO.PolicyResponse
using PyPlot

## --------
## Define policy scenarios
params = deepcopy(ClimateMARGO.IO.included_configurations["default"])    # load default parameters

# First:
#  * solve no-carbon-capture baseline policy model
m_noCC = ClimateModel(params);
max_deployment_noCC = Dict("mitigate"=>1., "remove"=>0., "geoeng"=>1., "adapt"=>1.);  # disable carbon capture
@time optimize_controls!(m_noCC, max_deployment = max_deployment_noCC);

# Second:
#   * copy baseline
#   * step_forward to t=t0 so policy is preserved before t0
#   * make carbon capture available (= only effective after t0)
#   * finally, need to reset variable present_year; this doesn't seem to affect policy, but otherwise baseline CO2 emissions get messed up in plots
t0 = 80.  # [years]
m_withDelayedCC = deepcopy(m_noCC)
step_forward!(m_withDelayedCC,t0)
max_deployment_withCC = Dict("mitigate"=>1., "remove"=>1., "geoeng"=>1., "adapt"=>1.);
@time optimize_controls!(m_withDelayedCC, max_deployment = max_deployment_withCC);
m_withDelayedCC.domain.present_year = m_noCC.domain.present_year

# Third:
#   * compare to optimum policy if carbon capture had been available all along
m_withEarlyCC = deepcopy(m_noCC)
@time optimize_controls!(m_withEarlyCC, max_deployment = max_deployment_withCC);


## --------
## Make plots
fig, axes = ClimateMARGO.Plotting.plot_state(m_noCC);
fig, axes = ClimateMARGO.Plotting.plot_state(m_withDelayedCC);
fig, axes = ClimateMARGO.Plotting.plot_state(m_withEarlyCC);

from climatemargo.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.