-
Notifications
You must be signed in to change notification settings - Fork 4
Description
There was already some refactoring done on the way closures work in #68. Basically, closure relations have to define three methods:
variables(previouslyclosurevar) defining one or more state variables needed for the closure relation; for soil energy, this includes bothtemperatureand theliquid_water_fraction.closure!(state, grid, ::ClosureType, args...)for computing the forward map prognostic -> closure varsinvclosure!(state, grid, ::ClosureType, args...)for computing the inverse map closure vars -> prognostic state.
Furthermore, closures are typically defined directly in the prognostic variable declaration, e.g.
prognostic(:internal_energy, XYZ(), closure=energy.closure, ...)which means that it is not necessary to manually add variables(energy.closure)... to the tuple of vars.
That's all fine, but maybe a bit confusing and overengineered. So maybe we can think about how to further refine this interface to be more consistent, e.g. by making closures simply behave the same way as any parameterization type, where one would write:
variables(energy::SoilEnergyBalance) = (
prognostic(:internal_energy, XYZ(), ...),
variables(energy.closure)...,
...
)then we could make closure! and invclosure! just standard process methods that dispatch on their respective internal types (here the closure property) without formally needing the closure type in the interface.
This would a fairly minor change, and I'm not sure it really makes a huge difference in the end.
@maximilian-gelbrecht following up from #68