Skip to content

Commit

Permalink
Merge pull request #204 from worlddynamics/dev
Browse files Browse the repository at this point in the history
Update Project.toml and improvements
  • Loading branch information
natema authored Sep 25, 2023
2 parents 9bd5f0b + 6f619c7 commit 933f20b
Showing 16 changed files with 85 additions and 253 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "WorldDynamics"
uuid = "34572acc-64b2-43ec-bac8-7b2a4baad13f"
authors = ["Emanuele Natale", "Pierluigi Crescenzi", "Paulo Bruno Serafim"]
version = "0.4.2"
version = "0.4.3"

[deps]
ColorSchemes = "35d6a980-a343-548e-a6ea-1d62b119f2f4"
2 changes: 1 addition & 1 deletion docs/src/tutorial.md
Original file line number Diff line number Diff line change
@@ -175,7 +175,7 @@ Note that the function `getinitialisations ` can be used to get a copy of the di

### Coding the subsystem

The file `subsystems.jl` starst with the decalaration of the variable `t` with respect to which the derivatives have to be computed.
The file `subsystems.jl` starts with the decalaration of the variable `t` with respect to which the derivatives have to be computed.

```
@variables t
4 changes: 1 addition & 3 deletions src/World1A/world1a/scenarios.jl
Original file line number Diff line number Diff line change
@@ -4,9 +4,7 @@ function standard_run(; kwargs...)

systems = [w1, w1a]

connection_eqs = [
w1a.msl ~ w1.msl
]
connection_eqs = WorldDynamics.variable_connections(systems)

system = WorldDynamics.compose(systems, connection_eqs)

5 changes: 1 addition & 4 deletions src/World1B/world1b/scenarios.jl
Original file line number Diff line number Diff line change
@@ -5,10 +5,7 @@ function standard_run(; kwargs...)

systems = [w1, w1a, w1b]

connection_eqs = [
w1b.qlm ~ w1.qlm
w1b.qlf ~ w1.qlf
]
connection_eqs = WorldDynamics.variable_connections(systems)

system = WorldDynamics.compose(systems, connection_eqs)

48 changes: 1 addition & 47 deletions src/World2/world2/scenarios.jl
Original file line number Diff line number Diff line change
@@ -53,53 +53,7 @@ function natural_resource_depletion(;
ql,
]


connection_eqs = [
# population
pop.br ~ br.br
pop.dr ~ dr.dr
br.p ~ pop.p
br.msl ~ ci.msl
br.cr ~ pop.cr
br.fr ~ ai.fr
br.polr ~ pol.polr
dr.p ~ pop.p
dr.msl ~ ci.msl
dr.cr ~ pop.cr
dr.fr ~ ai.fr
dr.polr ~ pol.polr
# natural resources
nr.nrur ~ nrur.nrur
nrur.p ~ pop.p
nrur.msl ~ ci.msl
# capital investment
ci.ciaf ~ ai.ciaf
ci.nrem ~ nr.nrem
ci.p ~ pop.p
ci.cig ~ cig.cig
ci.cid ~ cid.cid
cig.p ~ pop.p
cig.msl ~ ci.msl
cid.ci ~ ci.ci
# agricultural investment
ai.cr ~ pop.cr
ai.cira ~ ci.cira
ai.polr ~ pol.polr
ai.qlm ~ ql.qlm
ai.qlf ~ ql.qlf
# pollution
pol.polg ~ polg.polg
pol.pola ~ pola.pola
pola.pol ~ pol.pol
pola.polr ~ pol.polr
polg.p ~ pop.p
polg.cir ~ ci.cir
# quality life
ql.msl ~ ci.msl
ql.cr ~ pop.cr
ql.fr ~ ai.fr
ql.polr ~ pol.polr
]
connection_eqs = WorldDynamics.variable_connections(systems)

return WorldDynamics.compose(systems, connection_eqs)
end
31 changes: 1 addition & 30 deletions src/World3/agriculture/scenarios.jl
Original file line number Diff line number Diff line change
@@ -12,36 +12,7 @@ function historicalrun(; kwargs...)

systems = [pop, io, pp, ld, ai, iad, leuiu, dlm, lfr, lfd]

connection_eqs = [
ld.ler ~ leuiu.ler
ld.lrui ~ leuiu.lrui
ld.ly ~ ai.ly
ld.pop ~ pop.pop
ld.iopc ~ io.iopc
ld.io ~ io.io
ld.fiald ~ iad.fiald
ai.tai ~ ld.tai
ai.fiald ~ iad.fiald
ai.falm ~ dlm.falm
ai.al ~ ld.al
ai.lfert ~ lfd.lfert
ai.io ~ io.io
iad.ly ~ ai.ly
iad.dcph ~ ld.dcph
iad.alai ~ ai.alai
iad.lymc ~ ai.lymc
iad.aiph ~ ai.aiph
leuiu.ly ~ ai.ly
leuiu.al ~ ld.al
leuiu.iopc ~ io.iopc
leuiu.pop ~ pop.pop
dlm.fpc ~ ld.fpc
lfr.lfert ~ lfd.lfert
lfr.falm ~ dlm.falm
lfd.lfr ~ lfr.lfr
lfd.ppolx ~ pp.ppolx
io.pop ~ pop.pop
]
connection_eqs = WorldDynamics.variable_connections(systems)

return WorldDynamics.compose(systems, connection_eqs)
end
20 changes: 1 addition & 19 deletions src/World3/capital/scenarios.jl
Original file line number Diff line number Diff line change
@@ -8,25 +8,7 @@ function historicalrun(; kwargs...)

systems = [pop, nr, ag, is, ss, js]

connection_eqs = [
is.pop ~ pop.pop
is.fcaor ~ nr.fcaor
is.cuf ~ js.cuf
is.fioaa ~ ag.fioaa
is.fioas ~ ss.fioas
ss.iopc ~ is.iopc
ss.io ~ is.io
ss.cuf ~ js.cuf
ss.pop ~ pop.pop
js.ic ~ is.ic
js.iopc ~ is.iopc
js.sc ~ ss.sc
js.sopc ~ ss.sopc
js.al ~ ag.al
js.aiph ~ ag.aiph
js.p2 ~ pop.p2
js.p3 ~ pop.p3
]
connection_eqs = WorldDynamics.variable_connections(systems)

return WorldDynamics.compose(systems, connection_eqs)
end
9 changes: 1 addition & 8 deletions src/World3/nonrenewable/scenarios.jl
Original file line number Diff line number Diff line change
@@ -6,14 +6,7 @@ function historicalrun(; kwargs...)

systems = [pop, io, ic, nr]

connection_eqs = [
nr.pop ~ pop.pop
nr.iopc ~ io.iopc
io.ic ~ ic.ic
io.fcaor ~ nr.fcaor
io.pop ~ pop.pop
ic.io ~ io.io
]
connection_eqs = WorldDynamics.variable_connections(systems)

return WorldDynamics.compose(systems, connection_eqs)
end
10 changes: 1 addition & 9 deletions src/World3/pollution/scenarios.jl
Original file line number Diff line number Diff line change
@@ -8,15 +8,7 @@ function historicalrun(; kwargs...)

systems = [pop, nr, ag, pd, atcc, pp]

connection_eqs = [
pd.ppolx ~ pp.ppolx
atcc.lmp ~ pd.lmp
pp.ppgf22 ~ atcc.ppgf22
pp.pcrum ~ nr.pcrum
pp.pop ~ pop.pop
pp.aiph ~ ag.aiph
pp.al ~ ag.al
]
connection_eqs = WorldDynamics.variable_connections(systems)

return WorldDynamics.compose(systems, connection_eqs)
end
10 changes: 10 additions & 0 deletions src/World3/pollution/subsystems.jl
Original file line number Diff line number Diff line change
@@ -33,6 +33,16 @@ function agriculture(; name, params=_params, inits=_inits, tables=_tables, range
ODESystem(eqs; name)
end

function persistent_pollution_dummy(; name, params=_params, inits=_inits, tables=_tables, ranges=_ranges)
@variables ppgf22(t)

eqs = [
ppgf22 ~ 1.0
]

ODESystem(eqs; name)
end

function persistent_pollution(; name, params=_params, inits=_inits, tables=_tables, ranges=_ranges)
@parameters pyear = params[:pyear]
@parameters ppgf1 = params[:ppgf1]
19 changes: 1 addition & 18 deletions src/World3/population/pop1/scenarios.jl
Original file line number Diff line number Diff line change
@@ -9,24 +9,7 @@ function historicalrun(; kwargs...)

systems = [pop, dr, br, io, so, pp, f]

connection_eqs = [
pop.le ~ dr.le
pop.tf ~ br.tf
dr.fpc ~ f.fpc
dr.sopc ~ so.sopc
dr.iopc ~ io.iopc
dr.ppolx ~ pp.ppolx
br.le ~ dr.le
br.iopc ~ io.iopc
br.sopc ~ so.sopc
dr.dr ~ pop.dr
dr.pop ~ pop.pop
br.br ~ pop.br
br.pop ~ pop.pop
io.pop ~ pop.pop
so.pop ~ pop.pop
f.pop ~ pop.pop
]
connection_eqs = WorldDynamics.variable_connections(systems)

return WorldDynamics.compose(systems, connection_eqs)
end
19 changes: 1 addition & 18 deletions src/World3/population/pop15/scenarios.jl
Original file line number Diff line number Diff line change
@@ -9,24 +9,7 @@ function historicalrun(; kwargs...)

systems = [pop, dr, br, io, so, pp, f]

connection_eqs = [
pop.le ~ dr.le
pop.tf ~ br.tf
dr.fpc ~ f.fpc
dr.sopc ~ so.sopc
dr.iopc ~ io.iopc
dr.ppolx ~ pp.ppolx
br.le ~ dr.le
br.iopc ~ io.iopc
br.sopc ~ so.sopc
dr.dr ~ pop.dr
dr.pop ~ pop.pop
br.br ~ pop.br
br.pop ~ pop.pop
io.pop ~ pop.pop
so.pop ~ pop.pop
f.pop ~ pop.pop
]
connection_eqs = WorldDynamics.variable_connections(systems)

return WorldDynamics.compose(systems, connection_eqs)
end
19 changes: 1 addition & 18 deletions src/World3/population/pop4/scenarios.jl
Original file line number Diff line number Diff line change
@@ -9,24 +9,7 @@ function historicalrun(; kwargs...)

systems = [pop, dr, br, io, so, pp, f]

connection_eqs = [
pop.le ~ dr.le
pop.tf ~ br.tf
dr.fpc ~ f.fpc
dr.sopc ~ so.sopc
dr.iopc ~ io.iopc
dr.ppolx ~ pp.ppolx
br.le ~ dr.le
br.iopc ~ io.iopc
br.sopc ~ so.sopc
dr.dr ~ pop.dr
dr.pop ~ pop.pop
br.br ~ pop.br
br.pop ~ pop.pop
io.pop ~ pop.pop
so.pop ~ pop.pop
f.pop ~ pop.pop
]
connection_eqs = WorldDynamics.variable_connections(systems)

return WorldDynamics.compose(systems, connection_eqs)
end
80 changes: 3 additions & 77 deletions src/World3/world3/scenarios.jl
Original file line number Diff line number Diff line change
@@ -42,6 +42,7 @@ function historicalrun(;

@named nr = NonRenewable.non_renewable(; params=nonrenewable_params, inits=nonrenewable_inits, tables=nonrenewable_tables, ranges=nonrenewable_ranges)

@named ppd = Pollution.persistent_pollution_dummy(; params=pollution_params, inits=pollution_inits, tables=pollution_tables, ranges=pollution_ranges)
@named pp = Pollution.persistent_pollution(; params=pollution_params, inits=pollution_inits, tables=pollution_tables, ranges=pollution_ranges)

@named se = SupplementaryEquations.supplementary_equations()
@@ -52,86 +53,11 @@ function historicalrun(;
is, ss, js,
ld, ai, iad, leuiu, dlm, lfr, lfd,
nr,
pp,
pp, ppd,
se,
]


connection_eqs = [
# population
pop.le ~ dr.le
pop.tf ~ br.tf
dr.dr ~ pop.dr
dr.pop ~ pop.pop
dr.fpc ~ ld.fpc
dr.sopc ~ ss.sopc
dr.iopc ~ is.iopc
dr.ppolx ~ pp.ppolx
br.br ~ pop.br
br.pop ~ pop.pop
br.le ~ dr.le
br.iopc ~ is.iopc
br.sopc ~ ss.sopc
# capital
is.pop ~ pop.pop
is.fcaor ~ nr.fcaor
is.cuf ~ js.cuf
is.fioaa ~ ld.fioaa
is.fioas ~ ss.fioas
ss.iopc ~ is.iopc
ss.io ~ is.io
ss.cuf ~ js.cuf
ss.pop ~ pop.pop
js.ic ~ is.ic
js.iopc ~ is.iopc
js.sc ~ ss.sc
js.sopc ~ ss.sopc
js.al ~ ld.al
js.aiph ~ ai.aiph
js.p2 ~ pop.p2
js.p3 ~ pop.p3
# agriculture
ld.ler ~ leuiu.ler
ld.lrui ~ leuiu.lrui
ld.ly ~ ai.ly
ld.pop ~ pop.pop
ld.iopc ~ is.iopc
ld.io ~ is.io
ld.fiald ~ iad.fiald
ai.tai ~ ld.tai
ai.fiald ~ iad.fiald
ai.falm ~ dlm.falm
ai.al ~ ld.al
ai.lfert ~ lfd.lfert
ai.io ~ is.io
iad.ly ~ ai.ly
iad.dcph ~ ld.dcph
iad.alai ~ ai.alai
iad.lymc ~ ai.lymc
iad.aiph ~ ai.aiph
leuiu.ly ~ ai.ly
leuiu.al ~ ld.al
leuiu.iopc ~ is.iopc
leuiu.pop ~ pop.pop
dlm.fpc ~ ld.fpc
lfr.lfert ~ lfd.lfert
lfr.falm ~ dlm.falm
lfd.lfr ~ lfr.lfr
lfd.ppolx ~ pp.ppolx
# non-renewable
nr.pop ~ pop.pop
nr.iopc ~ is.iopc
# pollution
pp.ppgf22 ~ 1.0
pp.pcrum ~ nr.pcrum
pp.pop ~ pop.pop
pp.aiph ~ ai.aiph
pp.al ~ ld.al
# supplementary eqs
se.f ~ ld.f
se.so ~ ss.so
se.io ~ is.io
]
connection_eqs = WorldDynamics.variable_connections(systems)

return WorldDynamics.compose(systems, connection_eqs)
end
Loading

2 comments on commit 933f20b

@aurorarossi
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/92183

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.4.3 -m "<description of version>" 933f20b78df53d70c091d3ed72502462d180c8da
git push origin v0.4.3

Please sign in to comment.