-
Notifications
You must be signed in to change notification settings - Fork 0
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
Iso1 interface #1
Conversation
demonstrate prototype optional argument handling internal to the columnphysics migrate to fortran use for n_iso and tr_iso, remove them from interfaces (to be done to other similar variables) fix isotope hardcoded basal ice growth and isotope update logic refactor optional closing argument to follow new approach (get ride of "extra" ridge_ice call) fix isotope restart bug (read unit number) add isotope restart test to base suite add subnames to icepack_isotope.F90 rename public icepack_isotope variable frac to isotope_frac_method to improve clarity add some coding standard documentation to developers guide under column physics section
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.
Cool. This looks great to me.
Why not use tr_iso (or whatever it is) as the flag, instead of iso_flag?
The flags are one of the trickier things to work out. I think they'll have to be implemented as needed. If you look where the iso_flag is used in atmo_boundary_layer, it's also protected by a tr_iso if test.
In this case, the icepack_atm_boundary calls atmo_boundary. There are at least 4 cases to consider; tr_iso is true or false and iso arguments passed into icepack_atm_boundary or not. In particular, there is a case in the current implementation where the iso arguments are NOT passed into icepack_atm_boundary but tr_iso can still be true. icepack_atm_boundary apparently serves a few different roles. So there does need to be a local flag to get the logic right for this particular set of calls. You'll see in other places, no extra flag was needed. We just use tr_iso to decide whether to compute something down the internal calling tree. In those cases, we assume non-fake iso data is passed into the columnphysics when tr_iso is true and do exactly what you're proposing. Again, it depends how the public interface is used. All this brings up again some other thoughts. There is very little checking that the array sizes or arguments are correct in any way. What if the iso arrays are accidently declared (in the higher level code) size n_aero or something else? What if a subset of arguments that go together are passed and some are missing? We might check that they are all there or we might just check that one is and assume they all are. But none of that traps an error in argument passing. We could add these checks, but the extra cost (since we are calling each gridpoint separately) could be non-trivial and it could add a ton of logic in the code that makes the code messier. In theory, we should be checking that for a given feature, all the required arguments are passed and they are the correct sizes, maybe even on different levels of the calling tree, and maybe in comparison to the basic sizes already define (ie. n_iso). Yikes on that! Not sure what, if anything, to do about it. We could start to add some methods like call icepack_check_variable_size(Qa_iso,n_iso) that would check the size of an array against what's expected and set the abort flag if it's a problem. There are a lot of things that are pretty loosely goosey now because we started with a working implementation (CICE). But we might want to think about what is needed to robustly support calling Icepack from a new external model and ensure results are correct. The good thing is this is just increasing the robustness of Icepack and doesn't affect the interfaces, so we could put these feature in over time. I'm not even sure what the requirement is. Is it that size(Qa_iso) >= n_iso? when arrays come in should they be declared (:) or (n_iso)? There are things in the current interfaces that are not fully flushed out and lots of error handling could be added. Sort of depends on the goals, process, and expectations in the community. |
I think we need to look carefully at this, to make sure it's right. @dabail10
In principle, this is desirable, but in practice, I agree it's probably too expensive. It also makes the code harder to read, which has always been a guiding principle for me in code development (maybe it shouldn't be). If there is a clean way to do these kinds of checks in debug mode, so that they aren't super invasive and don't affect production runs, I'd be interested in exploring them further. What's next? I can merge this PR, then is the next thing to implement the changes to the Icepack driver in CICE? I won't be able to work on this for a few days, most likely. Dave might be able to come back to it sooner. Thanks for doing this..... |
I don't think there's much harm in merging it into your branch as long as nobody thinks we're heading in the wrong direction in terms of implementation. Just let me know if you want me to do something else either related to isotopes or otherwise. If progress is slowed on isotopes, it could even be merged into master with the understanding that we have tested the CICE implementation nor sorted out conservation yet. But I assume those things will happen and it does provide a leap forward in case E3SM wants to have a look. There are several things competing, finishing isotopes, E3SM, and then further interface cleanup. I'm not sure how to prioritize those best. |
I will merge this now so that @dabail10 can take a look at the atmo_boundary implementation. |
PR checklist
Update Isotope Interfaces
apcraig
Ran full test suites on conrad with icepack, all bit-for-bit with current master. Also verified isotope results unchanged from original implementation and test isotope exact restart.
Ran full test suites on conrad with CICE master PLUS this version of icepack and everything builds and runs fine, everything is bit-for-bit, fully backwards compatible interfaces
update isotope interfaces to be backwards compatible with prior interfaces
demonstrate prototype optional argument handling internal to the columnphysics
migrate to fortran use for n_iso and tr_iso, remove them from interfaces (to be done to other similar variables?)
fix isotope hardcoded basal ice growth and isotope update logic
refactor optional closing argument to follow new approach (get rid of "extra" ridge_ice call)
fix isotope restart bug (read unit number)
add isotope restart test to base suite
add subnames to icepack_isotope.F90
rename public icepack_isotope variable frac to isotope_frac_method to improve clarity
ran the docintfc option in icepack.setup to revise icepack interfaces in readthedocs
add some coding standard documentation to readthedocs developers guide under column physics section