agate-model / Agate.jl

A Julia library to build flexible and composable aquatic ecosystems.
MIT License
5 stars 0 forks source link

Create a column model example #49

Open radka-j opened 2 weeks ago

nanophyto commented 2 weeks ago

For the 1D examples it would be great if we can also provide an "offline" model example. In offline models, pre-computed velocity fields and state variables such as temperature are pre-computed. This saves time when running the model, especially in a probabilistic case where we would run the physics once, and the biogeochemistry e.g. 1000 times.

radka-j commented 23 hours ago

There are 2 examples of column models on OceanBioME:

nanophyto commented 23 hours ago

There are 2 examples of column models on OceanBioME:

I think it makes sense to focus on the first example. For the second example external data is required (complicating tests) but the T and S fields are otherwise functionally very similar:

@inline temp(x, y, z, t) = 2.4 * cos(t * 2π / year + 50days) + 10
T = FunctionField{Center, Center, Center}(temp, grid; clock)

vs

temp = ncread(filename, "temp")
temperature_itp = LinearInterpolation(times, temp)
t_function(x, y, z, t) = temperature_itp(mod(t, 364days))
T = FunctionField{Center, Center, Center}(t_function, grid; clock)

Having uneven z-grid spacing would be great to have though. Especially once we start running longer steady state experiments as we would need a much deeper water column.