Coupling LandModel with full surface energy balance to SpeedyWeather#110
Conversation
Also use as default scheme for bare ground evaporation
|
@milankl Since @maximilian-gelbrecht is on vacation, it would be great if you could approve this PR. |
|
@maximilian-gelbrecht and @milankl I have verified that the coupled model runs for up to 1 month of simulated time without errors, though I did not check the output. This is without the Richard's equation soil hydrology since this currently has problems unless you reduce the step size to an unbearably small number (like <10 seconds). This is, to some extent, expected; Richards' equation really needs implicit timestepping to be efficient. |
milankl
left a comment
There was a problem hiding this comment.
Just some comments from my side skimming through!!!
|
Do you want to merge this PR first, and then in a follow up adjust to Speedy 0.19, or still do that here? I am also happy to help with that adjustment. |
|
#114 already updates to Speedy v0.19 |
|
Yesterday(?) we briefly discussed that it's actually not that nice that with the current setup the Terrarium variables are hidden in the model struct. I think there could be a fix. Maybe it's not the long-term solution but we could basically frankenstein both variable containers together. In the coupling script / Terrarium define struct TerrariumVars <: SpeedyWeather.AbstractVariableDim end
Base.zero(::TerrariumVars, model::SpeedyWeather.AbstractModel) = Terrarium.initialize(model.land.model, clock=model.land.clock, boundary_conditions=model.land.boundary_conditions, input_variables=model.land.input_variables, fields = model.land.fields)
SpeedyWeather.variables(land::TerrariumWetLand) = (
SpeedyWeather.PrognosticVariable(name = :terrarium, dims = TerrariumVars(), namespace = :land)
)This would just allocate the Terrarium What do you think @bgroenks96? That should work right? One just needs a slightly modified |
|
Hey @maximilian-gelbrecht, I think this could work but a couple of things: Base.zero(::TerrariumVars, model::SpeedyWeather.AbstractModel) = Terrarium.initialize(model.land.model, clock=model.land.clock, boundary_conditions=model.land.boundary_conditions, input_variables=model.land.input_variables, fields = model.land.fields)As discussed in person, I think this would be an abuse of the I don't understand what this part is doing: SpeedyWeather.variables(land::TerrariumWetLand) = (
SpeedyWeather.PrognosticVariable(name = :terrarium, dims = TerrariumVars(), namespace = :land)
)is this meant to be an example? Or is it literally creating a prognostic variable that has type In any case, I think this discussion should be continued in a separate issue/PR, no? It's not really necessary for this one. |
|
It's not meant as an example, this is how SpeedyWeather allocates variables. It is creating a prognostic variable that has the same type as the return of Aside from the clock all other variable type just declare arrays so |
That might be true in SpeedyWeather but it's not in Terrarium.
I don't think it's a long-term solution because it's very strange to treat the entire Terrarium |
This PR updates the old SpeedyWeather script for the
PrimitiveDryModelair-soil temperature coupling and adds a new script with prototype coupling to aPrimitiveWetModelvia the full SEB.In the process of implementing this, I am also fixing bugs in the surface energy/water flux calculations.
G = R_net + H_s + H_lcorresponding to balance equationR_net + H_s + H_l - G = 0with all fluxes positive upwards (towards the atmosphere).SoilMoistureResistanceFactoris now the default choice forBareGroundEvaporation.