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

Iteration bugs in energy balance #2

Open
rafaqz opened this issue Feb 28, 2018 · 4 comments
Open

Iteration bugs in energy balance #2

rafaqz opened this issue Feb 28, 2018 · 4 comments

Comments

@rafaqz
Copy link

rafaqz commented Feb 28, 2018

Thanks for making this module available.

It seems that the while loop in EnergyBalance is not actually iterative, and will just repeat the same calculations until maxiter, as newTi or lastTi do not feed back into any calculations. I'm not sure what this means for energy balance estimates.

@ARS-CSGCL-DT
Copy link
Member

ARS-CSGCL-DT commented Mar 1, 2018 via email

@rafaqz
Copy link
Author

rafaqz commented Mar 2, 2018

Thanks for your response!

I realised later that the gas exchange function does the main work. But still having the where loop in energy balance is confusing, and uses precious cpu cycles! There are quite a few lines of code around the model that are not used like this, especially in the C4 function, and other parts of photosynthesis that can be pulled out of the inside loops. My latest version is a lot faster for the same output (i need to run it ~1,000,000x a second!)

Unfortunately I can't put in a pull request as I've converted the code to the julia language for easier interop with my plant growth models, but I will eventually share the julia package on github.

@ARS-CSGCL-DT
Copy link
Member

ARS-CSGCL-DT commented Mar 5, 2018 via email

@rafaqz
Copy link
Author

rafaqz commented Mar 7, 2018

Sure, it only makes sense to optimise the bottlenecks. For me photosynthesis is the bottleneck!

I'm using your photosynthesis/energy budget model as part of a species-distribution modelling framework for plants. I'm currently playing with coupling this component to a Dynamic Energy Budget and/or Thornley Transport Resistance models of plant growth.

I'm generating local microclimates using the NichemapR package, and we will hopefully be able to predict some kind of spatial patterns of habitat suitability if we have a physiological plant model that behaves realistically enough in response to local climatic variables. I was writing this photosynthesis/energy budget part out myself from scratch before realising it could be a whole thesis worth of work by itself!! So it was great to find this repository.

I'll let you know when I publish the set packages I'm working on. It will include a package based on this one but hopefully faster and reorganised a little (and fully credited of course!!). It was very relieving to see that this module has such a liberal license so I can use it however I need to. I'm using Julia as it makes this kind of work a lot easier than C++, and its very easy to make packages that interact with each other cleanly even in inner loops, so I'm migrating a lot of plant physiology packages to Julia, hopefully that turns out to be a good decision!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants