Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Purpose
Our goal is to prescribed soil organic carbon from time varying data. We added this in, but our only use case currently was TimeVaryingInput((t) -> constant). Since SOC is a 3d field, I think the allocations in regridded_snapshot! led to a big slowdown with this change.
Before that PR:
https://buildkite.com/clima/climaland-benchmark/builds/709#0190a29f-b2ff-40e3-9dae-a007eae845c4 (10 seconds)
After.: https://buildkite.com/clima/climaland-benchmark/builds/744#0190b780-87fb-493d-ad30-3ee2aabf1d30 (25 seconds)
For now, I added the option to have SOC be only a spatially varying field and not use TimeVaryingInput (and hence not need regridded_snapshot!). this should speed things up for us, and also be relevant for shorter runs where SOC is not varying much, or for runs where we do not have time-varying data.
The time per simulation is now back to 10 seconds.
To-do
Content
Allow for the prescribed SOC driver to be a field, and not a TimeVaryingInput. In this case, set p.drivers.soc = the field each evaluate step, intead of evaluating the TimeVaryingInput object at a specific time.