Replies: 5 comments 7 replies
-
|
Hi Joost, thank you very much for this idea. In general, it would be great to improve the composability. @jagoosw and I are starting to think about how to implement MARBL in OceanBioME, and it would be good to use the same approach there too (and re-use functionality where possible). It would be good to use the same approach for both of the full complexity models (PISCES and MARBL). We could then think about how/whether to incorporate this into the low and medium complexity models (NPZD and LOBSTER). A small point: I don't quite understand the use of "input" in this context. To me input sounds like something that the user needs to specify, whereas I think here they are the individual terms in the iron budget (correct me if I'm wrong). What about using "rate" or "source" instead? |
Beta Was this translation helpful? Give feedback.
-
|
Hi Joost, This seems like a really interesting idea and I think working out some kind of abstraction like this would be really helpful. I'm not sure I understand why we need the type @inline iron_tendency(::SimpleIron,
small_particle_iron_remineralisation,
grazing_waste,
upper_trophic_waste,
phytoplankton_iron_uptake,
ligand_aggregation_loss,
colloidal_aggregation,
scavenging,
bacterial_uptake) =
(small_particle_iron_remineralisation +
grazing_waste +
upper_trophic_waste -
phytoplankton_iron_uptake -
ligand_aggregation_loss -
colloidal_aggregation -
scavenging -
bacterial_uptake)
# separate function looks up values:
@inline function iron_inputs(bgc::SimpleIronPISCES, i, j, k, grid, clock, fields, auxiliary_fields)
...
return (small_particle_iron_remineralisation,
grazing_waste,
upper_trophic_waste,
phytoplankton_iron_uptake,
ligand_aggregation_loss,
colloidal_aggregation,
scavenging,
bacterial_uptake)
endMaybe I'm missing something? To John's comment: if I'm understanding correctly perhaps a better name would be arguments or args not inputs |
Beta Was this translation helpful? Give feedback.
-
Anyway, I think this is a good idea and my origional attempt to abstract PISCES wasn't the most thought through. It seems like it would make sense to abstract away some of the getting values etc. by having reusable KFs, but I'm not sure exactly how todo that (and on originally writing PISCES and LOBSTER as "continuous" models where we just get the tracer values, I found it a lot harder to abstract, although possibly the XInputs idea solves this problem). If its possible todo piecewise maybe it is the best approach todo this a component at a time and we can use PISCES as a testing ground since no one really uses it. |
Beta Was this translation helpful? Give feedback.
-
|
Hi both, Thanks for your enthusiasm and comment already. It sounds like the way forward is to
|
Beta Was this translation helpful? Give feedback.
-
|
I started a bit on an self contained iron kernel which looked something like this: However, while this is great for re-use since the kernel is self contained, for processes other than iron this would lead to a lot of repeated calculations... This particularly true for the plankton side where different modules re-use things like prey availability, grazing pressure, and growth efficiency. I'm thus now thinking about effectively splitting More concrete (diatom) example: Mostly thinking out loud at this point. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
@jagoosw I’m very interested in re-using some of the model components of PISCES (with a long term goal of building DARWIN-PISCES 😈), but the current setup makes this quite difficult. What are your thoughts on the suggested changes below to make the model more modular?
The idea would be to add two layers of abstraction to make the model more composable on both the sub-module (e.g. simple iron) and kernel (e.g. ligand_aggregation) side.
Sub-Module (e.g. Iron) contract layer.
The idea here would be to give each process a small concrete
structwith parameter and tracer values, such that they can be reused independently without requiring a callback to the bgc PISCES struct.Iron example:
Pure kernel layer
For this layer the idea would be to split scalar maths from value look-ups, such that the math does not depend on the grid or bgc objects. This would make each component also re-usable:
For example, split:
Into:
Let me know what you think, I’ve started on a proof of concept fork for iron already but would be good to hear your thoughts:
A downside of this approach would be additional abstraction and code surface, so something worth mentioning...
Beta Was this translation helpful? Give feedback.
All reactions