Skip to content

780 abiotic model account properly for time step and area in particular with energy fluxes#933

Merged
vgro merged 25 commits intodevelopfrom
780-abiotic-model---account-properly-for-time-step-and-area-in-particular-with-energy-fluxes
Jul 15, 2025
Merged

780 abiotic model account properly for time step and area in particular with energy fluxes#933
vgro merged 25 commits intodevelopfrom
780-abiotic-model---account-properly-for-time-step-and-area-in-particular-with-energy-fluxes

Conversation

@vgro
Copy link
Copy Markdown
Collaborator

@vgro vgro commented Jul 7, 2025

This PR aims to sort out the time intervals for the energy balance. The equations really only make sense in a short time interval, an hour or so, so I did a very clumsy for loop implementation as a first step and would appreciate feedback on how to better handle it. At the moment we cannot have hourly input data, so it does not make sense to run it for more than 1 average hour, this is a separate problem.

I have also deleted a lot of bits that are handled by the plant model now (related to absorbed radiation).

Fixes #780

Type of change

  • New feature (non-breaking change which adds functionality)
  • Optimization (back-end change that speeds up the code)
  • Bug fix (non-breaking change which fixes an issue)

Key checklist

  • Make sure you've run the pre-commit checks: $ pre-commit run -a
  • All tests pass: $ poetry run pytest

Further checks

  • Code is commented, particularly in hard-to-understand areas
  • Tests added that prove fix is effective or that feature works
  • Relevant documentation reviewed and updated

@davidorme
Copy link
Copy Markdown
Collaborator

@vgro Could you walk through the logic of the time interval value to run_microclimate? At the moment AbioticModel._update is pinning that value at 3600? So what are the different time interval cases that the logic is intended to handle?

vgro and others added 2 commits July 7, 2025 13:32
@vgro
Copy link
Copy Markdown
Collaborator Author

vgro commented Jul 7, 2025

I want the timestep that goes in the functions (delta t) to be one hour, the update interval of the model will most likely always be larger than that, so I divide the model update interval by 3600 to get the number of hours per model time interval. If the model time interval is a day or shorter, run for every hour (this will be the option with hourly input data), if not than do only one step

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Jul 8, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.22%. Comparing base (486672f) to head (e613726).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop     #933   +/-   ##
========================================
  Coverage    94.22%   94.22%           
========================================
  Files           79       79           
  Lines         6320     6308   -12     
========================================
- Hits          5955     5944   -11     
+ Misses         365      364    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Collaborator

@dalonsoa dalonsoa left a comment

Choose a reason for hiding this comment

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

I've made a comment about a potential error, but other than that, I do not see any other, more elegant way of doing this if the equations being solved require smaller timesteps. To be honest, inner loops to handle shorter timesteps is something that I was expecting to happen given the different timescales of the processes you are handling.

@vgro vgro marked this pull request as ready for review July 10, 2025 12:51
vgro and others added 3 commits July 10, 2025 16:34
…time-step-and-area-in-particular-with-energy-fluxes
…area-in-particular-with-energy-fluxes' of https://github.com/ImperialCollegeLondon/virtual_rainforest into 780-abiotic-model---account-properly-for-time-step-and-area-in-particular-with-energy-fluxes
…time-step-and-area-in-particular-with-energy-fluxes
Copy link
Copy Markdown
Collaborator

@davidorme davidorme left a comment

Choose a reason for hiding this comment

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

Looks good - thanks for clarifying the timing stuff. I do find the setup within run_microclimate a bit confusing - it seems like the running mode (iterated vs equilibrium) might be something that is an argument to the function. Having said that - there's a lot of stuff still to come when the hourly data becomes available - so I think that's polishing for later.

@vgro
Copy link
Copy Markdown
Collaborator Author

vgro commented Jul 15, 2025

Looks good - thanks for clarifying the timing stuff. I do find the setup within run_microclimate a bit confusing - it seems like the running mode (iterated vs equilibrium) might be something that is an argument to the function. Having said that - there's a lot of stuff still to come when the hourly data becomes available - so I think that's polishing for later.

Thanks for the feedback. I will definitely revisit the setup; at the moment the model just returns the final state and I would like to treat this more like the hydrology model where monthly means/stats will be returned. I just didn't want to complicate this PR any further (initially only intended to make sure everything has the same unit). Will consider #517 in this context.

…time-step-and-area-in-particular-with-energy-fluxes
@vgro vgro merged commit 14a109e into develop Jul 15, 2025
16 checks passed
@vgro vgro deleted the 780-abiotic-model---account-properly-for-time-step-and-area-in-particular-with-energy-fluxes branch July 15, 2025 13:05
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

Successfully merging this pull request may close these issues.

Abiotic model - account properly for time step and area, in particular with energy fluxes

4 participants