CliMA / ClimaOcean.jl

🌎 Tools for realistic regional-to-global ocean simulations, and coupled ocean + sea-ice simulations based on Oceananigans and ClimaSeaIce. Basis for the ocean and sea-ice component of CliMA's Earth system model.
https://clima.github.io/ClimaOceanDocumentation/dev/
MIT License
26 stars 7 forks source link

Problems with the surface flux example #164

Open glwagner opened 2 weeks ago

glwagner commented 2 weeks ago
  1. Why do we interpolate the prescribed atmosphere, when we basically never recommend actually doing this? I think we should have useful examples that are similar to real world usage...
  2. Why do we have to pass grid.underlying_grid for interpolation, that's silly. https://github.com/CliMA/ClimaOcean.jl/blob/dd9148a8f702699ddf2947d3a1a094adddbd9bb1/examples/generate_surface_fluxes.jl#L60

Putting together useful examples shouldn't be this hard...

glwagner commented 2 weeks ago

What's the point of turning off advection, closure, coriolis? These won't be used anyways, right? It's distracting / confusing why this shows up in the surface flux example:

https://github.com/CliMA/ClimaOcean.jl/blob/dd9148a8f702699ddf2947d3a1a094adddbd9bb1/examples/generate_surface_fluxes.jl#L62-L65

simone-silvestri commented 2 weeks ago
  1. Why do we interpolate the prescribed atmosphere, when we basically never recommend actually doing this? I think we should have useful examples that are similar to real world usage...
  2. Why do we have to pass grid.underlying_grid for interpolation, that's silly. https://github.com/CliMA/ClimaOcean.jl/blob/dd9148a8f702699ddf2947d3a1a094adddbd9bb1/examples/generate_surface_fluxes.jl#L60

Putting together useful examples shouldn't be this hard...

We can avoid passing the grid indeed. Passing nothing everywhere is done to make the examples faster since we do not need to compute those tendencies, we can put them back in, probably we should not even construct an ocean simulation but just manually construct fluxes.

glwagner commented 2 weeks ago

Why do we compute tendencies at all?

simone-silvestri commented 2 weeks ago

The tendencies are computed in the update_state! at the end of HydrostaticFreeSurfaceModel. Indeed, we could avoid doing that at construction since it is done in the time-stepping. I am not sure why we call update_state! at construction since the model is not set!ted yet so there is probably also no reason to fill halo regions or to mask immersed fields.

simone-silvestri commented 2 weeks ago

We could remove the update_state! from the construction. Then we would need to compute the fluxes explicitly in the example after the construction of OceanSeaIceModel, which has the advantage of showing that we are computing the fluxes

glwagner commented 2 weeks ago

The user can pass velocities and tracers into the constructor, producing a non-trivial state. Also, the biogeochemical state and auxiliary fields are computed. Certainly, we don't need to compute tendencies...

glwagner commented 2 weeks ago

The halos can also be non-trivial if there are non-trivial boundary conditions... imagine for example a problem starting from rest with a moving wall via ValueBoundaryCondition(1).

simone-silvestri commented 2 weeks ago

Ok, agreed, we can remove the computation of the tendencies at model construction. I will open a PR in Oceanigans to remove the tendency computation at model construction

glwagner commented 2 weeks ago

Do you know why they were included in the first place? Was it just an oversight when the tendency computation was added to update_state!? I recommend reviewing all calls to update_state! to see whether we need to compute tendencies during any of them except during time-stepping.