-
Notifications
You must be signed in to change notification settings - Fork 186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Many of the shallow water advection operators appear to be wrong #1866
Comments
@francispoulin does it also make sense to write these divergences as two-dimensional (in xy) since that's what we are restricted to for ShallowWaterModel? It might make the code clearer. |
Very sorry for the problems that you found but I'm glad you found them. I believe when @ali-ramadhan and I put this together we were following other examples but I definitely should have been more careful. Just so that I understand, instead of having As for computing the velocity, I hope we can fix that soon as well. I know that One option would be to add |
No need to apologize, just trying to help. I think you can form an AbstractOperation for velocities when the model is constructed, eg: velocities = (u = uh/h, v = vh/h) These can be stored in
We'd write a horizontal divergence either as
or
I think this is written in the docstrings but doesn't appear to be reflected in the code. Correct me if I'm wrong. |
I don't quite understand how the examples can be right without the areas though, so I feel I might be missing something. |
Maybe part of my confusion is on whether the solution fields, Maybe having docs on the finite volume method, as discussed previously, would help to clear some of this up? |
All quantities are cell averaged. Certainly it would be good to state this in the docs if it is not stated already. |
Well, it's mentioned in the docs. |
#1900 brings the finite-volume discussion further up in the Docs/Numerical Implementations. |
I think that's a great idea. Also, it occurs to me that it would be nice to have another validation code for |
I think more validation is great. Integrated cases are split into three categories:
I suggest adding bona fide Tests and validation, rather than examples, if we are interested in determining the correctness of the code. |
I am trying to follow the reasoning as to why the momentum flux does not need the area terms and I have an idea. First, I have tried to follow the dependencies of the flux function and find the following:
The final function is defined for either centered of upwinding schemes.
Something similar is true for Does this answer the question why there should not be any area terms in the flux? If this convention is confusing, do we want to do something different? |
Also, it occurs to me that dividing the difference terms by the volumes in |
@glwagner : I don't know that this approaches achieves the high order that we can achieve and I am happy to try something else. Also, it would be nice to have a test that does this. The test that we have for advection assumes that |
I'm closing this issue because I'm judging that it's not of current, timely relevance to Oceananigans development. If you would like to make it a higher priority or if you think the issue was closed in error please feel free to re-open. |
Shallow water advection operators don't look right:
Oceananigans.jl/src/Models/ShallowWaterModels/shallow_water_advection_operators.jl
Lines 30 to 36 in 5fbd8cd
In particular the advective fluxes are not multiplied by cell area, even though the flux differences are divided by cell volume. Surely this can't be right? Perhaps I am missing something.
The mass flux divergence is correct, however:
Oceananigans.jl/src/Models/ShallowWaterModels/shallow_water_advection_operators.jl
Lines 55 to 58 in 5fbd8cd
But the tracer flux is again incorrect, missing a multiplication by area:
Oceananigans.jl/src/Models/ShallowWaterModels/shallow_water_advection_operators.jl
Lines 80 to 83 in 5fbd8cd
The functions that calculate velocity are not correct:
Oceananigans.jl/src/Models/ShallowWaterModels/shallow_water_advection_operators.jl
Lines 88 to 89 in 5fbd8cd
because they don't take into account the fact that
uh
is at cell faces inx
, whileh
is at cell centers.Finally, I think the momentum flux operators aren't quite right because they don't produce the correct high-order advection stencil:
Oceananigans.jl/src/Models/ShallowWaterModels/shallow_water_advection_operators.jl
Lines 14 to 24 in 5fbd8cd
I think what we really want is to express the notion that the velocity
u
advects the total momentumuh
. For this we have to passuh. / h
in the place of the advecting velocity (the first entry) in functions like_advective_momentum_flux_Uu
, rather than dividing byh
after using second-order interpolation after the advective flux is calculated.The text was updated successfully, but these errors were encountered: