Closed francispoulin closed 2 years ago
Is it there also in the ConservativeFormulation
case?
Good question, and I tried it and, yes, in happens in both formulations.
The signature of the ∇_dot_qᶜ
in solution_and_tracers.jl
(line 107) seems to be wrong.
Try changing it with
- ∇_dot_qᶜ(i, j, k, grid, closure, diffusivities, val_tracer_index, solution, tracers, clock, nothing)
If you want you can open a PR to fix it, maybe the one where we deal with closures + ShallowWaterModel
I am happy to open a PR but when I try the line you suggested , unfortunately, there is still a problem.
Some good news! This fixes it for the vector invariant formulation.
However, when I try the conervative form it complains about not knowing u
. See the start of the output below.
ERROR: LoadError: TaskFailedException
nested task error: type NamedTuple has no field u
Stacktrace:
[1] getproperty(x::NamedTuple{(:uh, :vh, :h), Tuple{Field{Face, Center, Center, Nothing, RectilinearGrid{Float64, Periodic, Periodic, Flat, Float64, Float64, Float64, OffsetArrays.
Ah, I see the problem... all the viscous_flux
are formulated in terms of velocities U.u, U.v, U.w
which the shallow water model does not necessarily have. This will be slightly more involved to fix than just changing the signature of the function.
It depends how you want to formulate the viscous operator, as a diffusion of u
or a diffusion of uh
. If the former is always the desired formulation, both in the vector invariant and the conservative equations, then it might be useful to add the velocities as a field of the shallow water model and pass them to the tendency kernel.
So indeed, we should open a PR to adapt the shallow water model to work with closures
I agree this is more complicated. I will create a PR to propose the change you suggested. Maybe next week we can discuss closure for the conservative model, and do that in a separate PR?
This is a minimum working example that shows how we (@writingindy and I) have tried to use closure in the
VectorInvariantFormulation
of theShallowWaterModel
but get aTaskFailedException
error, copied below.@simone-silvestri , do you have any idea as to how this can be fixed?
Error: