-
Notifications
You must be signed in to change notification settings - Fork 10
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
Clarify DSS weights and fix DSS buffer bug #2136
Conversation
b275362
to
27a094f
Compare
@akshaysridhar, could you also try out the conservation check from CliMA/ClimaAtmos.jl#3422 with this PR? I think that's currently the only test where we would expect to see a noticeable difference. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall I think this is a good improvement, but I have a few comments that I think need addressed:
- Name bikeshedding:
dss_weights
vslocal_dss_weights
? I don't have strong opinions, but I'd like to push towards consistent names if possible, and we do already havelocal_geometry
- Restarts: we should add
center_dss_weights
andface_dss_weights
to InputOutput readers / writers, so that simulations can properly be restarted. - Tests: is there some unit test we can add / update to show the impact of these changes? (e.g., a convergence test like it the other deep atmosphere fix?)
Thanks @charleskawczynski! I will try to set up a deep-atmosphere conservation unit test like I had for the column integrals. As for the other two points:
|
Great, thanks!
Sounds good to me.
Ah, right, that outer constructor will just create these dss weights. Sounds good. Overall looking very good! |
d088bf6
to
d8f1a18
Compare
After adding the conservation test, I have found that changing to 3D weights does nothing to improve conservation in deep atmospheres (the maximum error was 13 times machine epsilon with both 2D and 3D weights). This is because the radial distance Based on this result, I've removed the part of this PR that modifies the weights to 3D, retaining the old behavior of using the horizontal weights for extruded fields, and I've added a comment to explain why we are allowed to do this. I'll keep the remaining parts of this PR, like the buffer bugfix, conservation test, and improvements in naming consistency. |
bf4c5ad
to
c55317c
Compare
Can you please point to where this fix is? I don't see it. Also, is this news-worthy? And is it at all behavior changing (thinking about reproducibility tests)? |
@charleskawczynski, here is the relevant line on main: ClimaCore.jl/src/Topologies/dss.jl Line 104 in 4f97a51
And here is the new version: ClimaCore.jl/src/Topologies/dss.jl Line 115 in c55317c
I think the value of Nf used here needs to match the DSS buffer, rather than the incoming data. Now that I've removed the use of 3D weights for deep atmospheres, nothing in this PR should be behavior changing. I'm not sure if any of the remaining housekeeping changes, like the internal variable renaming and the new unit test, are newsworthy. |
ca7aeaf
to
c55317c
Compare
c55317c
to
590b1c9
Compare
This PR extends the DSS machinery to handle 3D weights alongside 2D weights, and it fixes the weights for deep-atmosphere grids. The weights are now always consistent with the metric determinant$J$ , ensuring that DSS does not violate conservation of scalars or vorticity in ClimaAtmos.Update: This turned out not to be necessary (see comment below).In addition, this PR adds a unit test for conservation and enforces consistency of function/variable names, ensuring that the weights are always called
dss_weights
and updating docstrings where needed. It also fixes a preexisting bug in DSS buffer allocation for, e.g.,Covariant12Vector
s, which are transformed intoUVWVector
s when DSSed in a 3D space, and so haveNf = 2
for the input data andNf = 3
for the buffer. There was previously a line in the Topologies module that assumed these values ofNf
are equal.