mimiframework / Mimi.jl

Integrated Assessment Modeling Framework
https://www.mimiframework.org
Other
68 stars 34 forks source link

Time "integration" #993

Open milankl opened 6 months ago

milankl commented 6 months ago

I was curious how Mimi handles the time integration, but looking into the examples it seems that in Mimi every run_timestep has to be formulated as recurrence relation, i.e.

X_{i+i} = F(X_i, t_i; P)

the next time step $i+1$ of a variable(s) $X$ as a function of its current value(s) $X_i$ some time $t_i$ and some parameters $P$ in contrast to formulating it as a differential equation

\frac{dX}{dt} = F(X_i, t_i; P)

whereby F, the run_timestep, would return the tendency. Consequently, I found some examples where some Euler forward step essentially seems to be hardcoded into the run_timestep function, e.g.

https://github.com/raddleverse/MimiBRICK.jl/blob/84c4bc4a6823c04c0b9467394a2d9822f7cdf105/src/components/thermal_expansion_component.jl#L44

https://github.com/anthofflab/MimiDICE2016R2.jl/blob/3d48bb075455542e61622b78444d927b7557c992/src/components/emissions_component.jl#L30

https://github.com/anthofflab/MimiFAIR.jl/blob/5b334a00ac0492af38e8e1f2a69cde786e561c40/src/components/temperature.jl#L32

I'm just wondering how much control would one have if a formulation as differential equation was preferred, I see the time dimension often defined as 2015:2100 or 2015:ts:2100 or similar, so it seems to me you're using year as unit here but one could use sub-year steps or multiyear steps?