-
Notifications
You must be signed in to change notification settings - Fork 132
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
tracers in upwind transport #267
Comments
Does anyone use upwind? We should probably do a survey before getting rid of it. |
This could be a discussion topic during the town hall -- whether to deprecate some things, and if so, what. Upwind and 0-layer thermo come immediately to mind. A general survey is an interesting idea. I suspect that there will always be someone who thinks we should keep things in the code. E.g. last fall one of our German colleagues strongly urged me not to get rid of the 0-layer thermo. |
I just talked with JF about this. His opinion is we should deprecate upwind... @JFLemieux73 |
I tend to agree with @JFLemieux73. |
@eclare108213 Yes, I'll start a list of specific topics you and I can discuss at we put together a draft agenda. |
I know I said before we should deprecate upwind but I have changed my mind. I am involved in an intercomparison project where we do idealized experiments (similar to box2001). My colleagues just asked me to do a run with upwind...I think it would be a good idea to keep for this kind of idealized experiments. |
@JFLemieux73 we can certainly keep the upwind functionality, but the issue with the tracers remains. I suggest that we revert the changes in #508 and make sure there is an abort if there are any tracers other than those that upwind is able to advect (e.g. by checking that ntrcr is not larger than the number of required tracers). I've updated the code deprecation list. |
I will create a PR to revert #508 and to add a check on ntrcr. Can someone clarify what that check should be? I will also try to figure it out. |
Thank you @apcraig. I was thinking that we could just check that ntrcr is less than or equal to the number of required tracers. But looking at the upwind advection routines, it's more complicated than that. The issue lies in the routines state_to_work and work_to_state, which load and unload arrays to be advected. It looks like work_to_state is probably okay. In state_to_work, the question is whether all of the potential tracers are captured in the manually loaded works array. I don't think so, although many of them are. There is this code check at the end of that routine: |
I'm trying to understand the upwind, it looks like overall, fields are copied into works (state_to_work), then upwind_field is called, then works is copied back out to the fields (work_to_state). upwind_field seems to operate on each field, one at a time, and there is no dependence on the order of the fields or on trcr_depend. What is packed and unpacked are combinations of fields. work_to_state uses icepack_compute_tracers. state_to_work seems to do the opposite of work_to_state but has an implicit understanding of icepack_compute_tracers to do so. What I think we want is equivalent routine in icepack is that consistent with icepack_compute_tracers? Am I on the right track? We can take discussion offline if it makes sense. Maybe we could revert the PR and then update the upwind implementation as a separate task to be done soon? I think that's probably cleaner anyway in terms of tracking changes. |
You're on the right track.
Yes, I think this is the best approach. Then:
Maybe. This is done properly for the incremental remapping advection. If we do the same thing for upwind, then a new routine might makes sense, but it might be possible to just mimic what's done for remap using the existing routines (e.g. state_to tracers, etc). |
I saw state_to_tracer and tracer_to_state. If it makes sense to mimic those, I like that idea. I will run the test suite on the reverted sandbox and then create a PR. Then I can play with the update of the upwind implementation and we can discuss further. |
Now that upwind has be de-deprecated, we still have this tracer issue. @apcraig and I took a look at it earlier today, and the essential issue is how the tracer arrays are loaded into work arrays that are advected. Remap expects them in a different form than upwind does. I think it's fine to have separate routines to load them for each type of advection, but they should follow the same generic steps. It's not clear to me that upwind captures all of the tracer combinations, so the first thing to do is to compare upwind and remap runs in which as many tracers as possible are turned on, particularly brine height, zbgc, and zsalinity tracers. The tracer history output won't be BFB but should be qualitatively similar. If they are, then this present issue is not a bug but rather an opportunity for cleaning up the code, making it more internally consistent and less error-prone. |
Upwind transport should use the tracer dependency arrays instead of doing calculations explicitly in work_to_state and state_to_work. Should we deprecate the upwind scheme?
The text was updated successfully, but these errors were encountered: