ctsm5.4.055: Add temporal smoothing of DYNBAL conservation correction fluxes - #4189
ctsm5.4.055: Add temporal smoothing of DYNBAL conservation correction fluxes#4189billsacks wants to merge 15 commits into
Conversation
Rather than releasing all of the DYNBAL fluxes in the year in which they're generated, instead put them in storage pools that are released with a 20-year turnover time. This reduces these fluxes, especially in the oscillatory case that is somewhat common with a dynamic ice sheet. This partially addresses ESCOMP#4188 (specifically, option (1) in that issue).
I found the previous sign convention unintuitive. While I'm changing these fluxes anyway, I'm going to flip the sign convention to be more intuitive.
This feels conceptually similar to the other resetting done by reset_dynbal_baselines, so it feels like these should be reset at the same time. (This wasn't an issue before the changes on this branch that change the annual dribblers to pools with a residence time, because the annual dribblers would empty themselves by the end of each year.)
This will be unnecessary following ESCOMP/CTSM#4189. This testmod is currently unused, so it seems safe to bring this in even before that CTSM PR is merged, since the plan is to merge that PR soon.
|
@billsacks when this is ready for review maybe this can be a paired review with @slevis-lmwg? I think we may want this in the CESM3_alpha10a tag? |
|
@slevis-lmwg - I feel this is ready for review. I'm still reviewing some test results, but from my initial look things looked basically good. |
I think you mean cesm3_0_alpha11a. We don't need this in beta10 as it's only changing transient cases, and beta10 is about 1850 and CPLHIST spinup. It would also further delay the beta10 tag. The pic of the whiteboard from yesterday also agrees with this being in beta11 rather than beta10. |
slevis-lmwg
left a comment
There was a problem hiding this comment.
@billsacks thank you for writing clear code and comments. I made minor suggestions and asked for confirmation of my understanding once or twice. I may get a bit more out of this PR from a paired review, but it also does not seem necessary. If you would rather meet, I would be open.
I'm not clear on the vision for the different beta tags, but as I just noted to @ekluzek - this is desired for the coupled spinup immediately following the land spinup - so probably around the end of next week. |
…ting Remove unnecessary testmod setting ### Description of changes This will be unnecessary following ESCOMP/CTSM#4189. This testmod is currently unused, so it seems safe to bring this in even before that CTSM PR is merged, since the plan is to merge that PR soon. ### Specific notes Contributors other than yourself, if any: N/A Fixes: N/A User interface changes?: No Testing performed (automated tests and/or manual tests): None
I agree with @billsacks here, I think this is something that's used in the CESM3 PI control runs as soon as is realistically possible. I'm also not really clear what that means for the staging of CESM alpha tags, but I thought it could be alpha10e based on one version of the plan I saw today? |
I don't have too strong of a sense if it should be in beta10 or beta11. I mainly didn't want to add more complexity to beta10. From the planning we talked about today, I don't think the MOM, CICE, CAM, and CTSM tags will be ready and in a cesm alpha tag for about 2 weeks. So unless they want to start another coupled segment without all of those in place, but just the DYNBAL tag in place -- I think it's either the tail end of beta10 (cesm3_0_alpha10d) or it's the beginning of beta11 (cesm3_0_alpha11a). I don't think there will be much of a difference between either option in terms of timing. It's just if it's in beta10, it WILL have had prebeta testing done on it, and if it's in beta11, it would have to WAIT for the prebeta testing of beta10 to happen. I know Dave wanted to start by the 9th, based on what we talked about today, I think the 18th is a realistic timeline, with maybe a few days sooner if things go well. But, if things don't go great it probably slips into the next week after the 18th. |
ekluzek
left a comment
There was a problem hiding this comment.
This is all great stuff, that will be good to have in place to counter the oscilitory behavior that's been seen. It's more or less transforming the dribblers that were fixed on a year return time to something with a flexible time (currently 20 years). But, it's also easy to change that time now.
I have a bunch of questions and comments. The most important ones are:
- I think we should set clm5_0 physics to use a value of 0.75 to get similar behavior to how it worked previously
- The long description in namelist_definition is very clear and very useful. But, I think for usability/accessability it should go somewhere else. I'm thinking the Tech Note.
- I ask if we think we really want to remove the old dribblers?
- IF we do want to remove the old dribblers the AnnualFluxDribbler module should be removed and the unit tests for it.
- If we are removing unit tests -- shouldn't we add some for the new behavior?
I think some decisions might have been made to get something robust in place quickly. And that is probably what we need here. But, I think we might want to make sure we are good with all of them for long term? And if not we might want to plan some follow on refactoring of the most important things.
We should probably talk about some of this together as well. But, we probably don't want/need to do that until next week....
It's impossible to exactly recover the old behavior, but using a residence time somewhere between 0.5 year and 1.0 year gives something that roughly approximates the old behavior. So make that the default for clm5_0. Co-authored-by: Erik Kluzek <ekluzek@users.noreply.github.com>
Instead of a hard-coded 365, use get_average_days_per_year (both to avoid hard-coding 365, and to get a more correct value if we're running with a Gregorian calendar).
Now that namelist defaults recovers something close to the old clm5_0 behavior, I feel that this extra text in namelist definition is unnecessary.
ekluzek
left a comment
There was a problem hiding this comment.
@billsacks it looks like all review points were taken care of. So I resolved most of the conversations. The only one I left open was the one about the long (but clear) instructions in the namelist_definition file, in case you were going to do more with it. But, I would also be fine with your going ahead with it as is.
So approving. Are you planning on running the baselines on Derecho and Izumi and making the ChangeLog/ChangeSum files to close this one out?
Since, you are ready now, we could switch tag order and make this "55" and mine "56", which won't be ready on Friday anyway.
|
Oh, actually @billsacks it looks like @slevis-lmwg is assigned to this, so maybe he's going to finish the baselines for it? It would just be good if you start the ChangeLog file @billsacks. @slevis-lmwg we are thinking of changing the tag order so this becomes "55" and goes next. I won't have a tag on master on Friday, so this could come in now. |
|
@billsacks is going to take this all the way home and it's now next up in the tag queue. |
The problem with the previous placement is that dynSubgridControlMod is initialized before the calendar is initialized. This new placement allows us to initialize this variable after the calendar is initialized. It also keeps the namelist variable local to where it's needed.
|
I have confirmed that the recent change to move the namelist variable is bit-for-bit with the previous version of this branch, by running |
Also, test the new zeroing of the dynbal storage terms in this unit test.
When the RUN fails, the COMPARE_base_rest is left in a PEND state
ekluzek
left a comment
There was a problem hiding this comment.
Some comments about handling file units with newunit, and about endrun.
| ! !USES: | ||
| use shr_const_mod , only : SHR_CONST_CDAY | ||
| use abortutils , only : endrun | ||
| use fileutils , only : getavu, relavu |
| dynbal_storage_residence_time = 0._r8 | ||
|
|
||
| if (masterproc) then | ||
| nu_nml = getavu() |
There was a problem hiding this comment.
You can remove the old unit processing things we had. Fortran now allows you to use a new unit keyword in the open statement to give you a free unit.
I'd like to move to that pattern so we can remove the unit processing stuff.
| if (nml_error == 0) then | ||
| read(nu_nml, nml=dyn_cons_biogeophys_inparm, iostat=nml_error) | ||
| if (nml_error /= 0) then | ||
| call endrun(msg='ERROR reading dyn_cons_biogeophys_inparm namelist'//errMsg(sourcefile, __LINE__)) |
There was a problem hiding this comment.
You can now remove the bit about errMsg and pass file and line options directly in the endrun call. It's a little less cumbersome.
| call endrun(msg='ERROR finding dyn_cons_biogeophys_inparm namelist'//errMsg(sourcefile, __LINE__)) | ||
| end if | ||
| close(nu_nml) | ||
| call relavu( nu_nml ) |
There was a problem hiding this comment.
This can be removed with the newunit option to open.
| call endrun(msg='ERROR reading dyn_cons_biogeophys_inparm namelist'//errMsg(sourcefile, __LINE__)) | ||
| end if | ||
| else | ||
| call endrun(msg='ERROR finding dyn_cons_biogeophys_inparm namelist'//errMsg(sourcefile, __LINE__)) |
There was a problem hiding this comment.
Same thing here. Line and file can be used as arguments directly in endrun.
| integer :: nu_nml ! unit for namelist file | ||
| integer :: nml_error ! namelist i/o error flag | ||
|
|
||
| character(len=*), parameter :: subname = 'dynConsBiogeophys_readnl' |
There was a problem hiding this comment.
I suggest removing this. With the file and line options to endrun I've found this not useful. And it has the possibility of changing the subroutine name and forgetting to change this. So it has a maintenance burden that file and line to endrun don't have.
Description of changes
Spread the DYNBAL water and energy fluxes over many years: Rather than releasing all of the DYNBAL fluxes in the year in which they're generated, instead put them in storage pools that are released with a 20-year residence time (controllable via a new namelist parameter). This reduces these fluxes, especially in the oscillatory case that is somewhat common with a dynamic ice sheet.
The new storage pools are reset when reset_dynbal_baselines is set to .true., since this feels conceptually similar to the other resetting done by that flag, so it feels appropriate to do this resetting at the same time.
This PR also changes the sign convention for the DYNBAL fluxes: the previous sign convention was unintuitively the opposite of the sign convention of other fluxes to river/atm; while I'm changing these fluxes anyway, I'm also flipping the sign convention to be more intuitive and hopefully less error-prone.
I have evaluated the changes here by examining QFLX_ICE_DYNBAL, QFLX_LIQ_DYNBAL and EFLX_DYNBAL, FSH_TO_COUPLER, QRUNOFF_ICE_TO_COUPLER and QRUNOFF_TO_COUPLER in 3 cases with compset I1850Clm60BgcCropG at resolution f09_g17:
Specific notes
Contributors other than yourself, if any:
CTSM issues resolved or otherwise addressed, if any:
If answers are expected to change, describe (delete this line otherwise):
ERS_Ly3_P64x2.f10_f10_mg37.IHistClm50BgcCropG.derecho_intel.clm-cropMonthOutputwith SROF and verified that diffs were then limited to just the expected variables.)ERS_D_Ld5_Mmpi-serial.1x1_mexicocityMEX.I1PtClm60SpRsGs.derecho_gnu.clm-CLM1PTStartDate,SMS_Ld12_Mmpi-serial.1x1_vancouverCAN.I1PtClm60SpRsGs.derecho_gnu.clm-output_sp_highfreq, andERP_D_Ld5.f10_f10_mg37.I2000Clm60Sp.derecho_intel.clm-decStart--clm-nofireemis.Any user interface changes (namelist or namelist defaults changes)?
dynbal_storage_residence_timeTesting planned or performed, if any:
Requirements before merge: