Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Variable initialization incorrect #62

Open
universmile opened this issue Sep 21, 2022 · 4 comments
Open

Variable initialization incorrect #62

universmile opened this issue Sep 21, 2022 · 4 comments
Assignees
Labels
bug Result is clearly wrong

Comments

@universmile
Copy link
Contributor

The initialization of falm and lfrt are incorrect in Figures 4.69d and 4.70d. This seems to be related to the usage of the smooth function when computing derivatives.

Fig  4 69d

@natema natema added the break Something isn't working label Sep 21, 2022
@natema natema added this to the reproducing World3 milestone Sep 21, 2022
@natema
Copy link
Member

natema commented Sep 21, 2022

One sanity check here is to solve the system with a different method.

@universmile
Copy link
Contributor Author

The initialization inaccuracy persists after trying different methods.

In the following, we provide the code snippet for Fig. 4.69d.

fig_4_69d_variables = [
    (dlm.fr, 0, 4, "fr"),
    (dlm.falm, 0, 0.1, "falm"),
    (lfd.lfert, 0, 600, "lfert"),
    (lfd.lfd, 0, 80, "lfd"),
    (lfr.lfr, 0, 80, "lfr"),
    (lfr.lfrt, 0, 20, "lfrt"),
]

system = agriculture_historicalrun()
sol_4_69d = WorldDynamics.solve(system, (1900, 2100))
plotvariables(sol_4_69d, (t, 1900, 1970), fig_4_69d_variables, name="Fig. 4.69d", showlegend=true, showaxis=true, colored=true)

After solving the system, we get the following initial values of the flm variable :
sol_4_69d[dlm.falm][1:5] = (0.08, 0.04002382698512611, 0.040040848269282996, 0.040175000234290166)

The origin of the update is coming from the interpolation function :
falm ~ interpolate(pfr, tables[:falm], ranges[:falm])

where

tables[:falm] = (0.0, 0.04, 0.07, 0.09, 0.1) 
ranges[:falm] = (0, 4)

The initial values of pfr are reported below :
sol_4_69d[dlm.pfr][1:4] = (1.0, 1.0110931817510707, 1.0217794925728327, 1.068709296379689)

@natema
Copy link
Member

natema commented Sep 21, 2022

As a sanity check, test if changing the solver as suggested in #60 makes any difference.

@universmile
Copy link
Contributor Author

Unfortunately, it doesn't.

@paulobruno paulobruno added improvement Improve existing code bug Result is clearly wrong and removed break Something isn't working improvement Improve existing code labels Oct 5, 2022
@paulobruno paulobruno removed this from the reproducing World3 milestone Oct 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Result is clearly wrong
Projects
None yet
Development

No branches or pull requests

4 participants