-
Notifications
You must be signed in to change notification settings - Fork 363
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
Implement the IEFLX fixer #1303
Implement the IEFLX fixer #1303
Conversation
@kaizhangpnl , @rljacob : I assume we should merge this as soon as possible. Kai, I just want to make sure that you are aware that next is currently frozen, so unless Rob says otherwise we will need to wait until things clear up before merging these changes. I'll coordinate with @singhbalwinder , and merge this after he merges #1301 . |
Hi @susburrows I just assigned a pull request to you. I also assigned a different pull request (#1301) to @singhbalwinder, which should be merged to the master before merging this one. I have discussed both pull requests with @golaz. Thanks! |
hah, we timed that almost exactly at the same time :) |
:) Thanks for the information. That's fine. |
Hi Kai – I went through your code and I believe that it basically works as intended – nice job! I do have some questions/comments though. The first question impacts accuracy, the others just make it easier for other people to understand what you’ve done ;-).
|
Hi Peter, Thanks for your comments. Please find my reply below:
The idea was to compute IEFLX using consistent QFLX, SST, and PRECT (variables used during the same physics time step). On the other hand, since we see only tiny changes of QFLX & SST between two adjacent time steps, I think moving the calculation to phys_run2 won't do much harm and I am open to the alternative solution. @philrasch and @golaz, what do you think?
I will put some additional notes at places where ieflx_gmean is calculated.
The extra namelist variable is used to facilitate a diagnostic calculation, i.e. we can diagnose IEFLX without affecting the simulation. I prefer to leave it as is, so that we don't have to implement it again when we try to improve the internal energy treatment in the future.
Well spotted! The three variables (qflx_glob, rain_glob, snow_glob) were used in a version with more detailed diagnostics, but they are not used in the current code. Will remove them. |
Thanks Kai - I see what you're saying about wanting to use a consistent SST, QFLX, and PRECT. I'm surprised you don't think QFLX will change much between timesteps since wind and surface temperature could change a lot over half-hour timesteps (particularly over land). I'm also not sure whether the ocean coupling interval could affect this sensitivity. Also, while PRECT is computed in tphysbc using "old" SST and QFLX, it is assumed constant over the whole model step, so I'm not sure we can say it is "inconsistent" with the new SST and QFLX after coupling... And I really do mean "I'm not sure" here - your explanation makes sense and I'm not sure whether or not my suggestion of moving things makes sense. Thanks for adding the comments about units and stuff. It looks much better. I still think changing the name "thousand" to "rho_water" or "water_density" or something would make the code look more professional. ;-) |
Hi peter,
What I wanted to say was that the global mean diagnostics for qflx and ieflx_up between two time steps were pretty small (most values < 1%). I agree that if we look at the grid-box values of qflx and ieflx_up, the difference would be much larger. I also don't know which way is better. Fortunately, I have archived the detailed output at each time step from a previous test simulation, so I did an offline calculation. Using the global mean diagnostics as input for the two methods discussed here, the relative difference in the calculated daily mean IEFLX is small (about 4%). However, the absolute difference at each time step could be as large as 1W/m2, and the relative difference 100%. This is because ieflx is a small term compared to ieflx_up and ieflx_dn, and a small relative difference in ieflx_up and ieflx_dn could result a large ieflx. I will leave it to you and @golaz to decide which one to use.
Done. |
In thinking more about where to compute the correction, it seems like you have the choice between using stale SST and QFLX information or using PRECT which was computed off an earlier (and therefore potentially inconsistent) surface state. My intuition is that stale input is worse than old PRECT information. I've pinged @golaz for his vote. |
I think the best way is to follow what the ocean model does for the energy fix. If new SST and QFLX are used to calculate the internal energy exchange in the ocean model, we'd better adopt your approach, and vice versa. I've tried the alternative method in a short simulation and it runs well, so if we are going to use the new approach, I can commit it any time. |
@kaizhangpnl, adding my two cents to the discussion.
|
@golaz and @kaizhangpnl, ieflx_gmean could be rewritten to calculate the mean of two fields (up and down) in one call to gmean. This has very close to the same MPI cost as doing just one gmean. FYI. |
However, unless there are numerical reasons to compute ieup_glob and iedn_glob before differencing, then taking the difference first and then calculating the gmean would be more efficient. |
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.
@kaizhangpnl, thank you for making the changes. The code modifications look good to me now and should be ready to be merged. Just to be safe, I'd like to ask @PeterCaldwell to take one more look at them as well.
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.
I just took a quick glance since I looked at this in detail before and the new changes just seem to move things around and fix issues that I and others have pointed out. Thanks for your hard work on this, Kai!
Thank you, @PeterCaldwell and @golaz for your review! |
72e839c
to
af7873e
Compare
@kaizhangpnl , @rljacob : since this is a bug fix PR, is there a bug / issue report that should be associated with it? |
Bisect confirmed that this PR generates a runtime error on melvin (GCC 5.3). GCC 5.3 is also available on Anvil to help you resolve this. Please revert this commit from next. |
Thanks for the note. I am trying to identify the reason. |
As Rob noted above, this PR caused runtime failures in atmosphere-only compset tests on melvin (gnu compiler). I've reverted the merge to next until we can sort out the issue. Error message: |
Does anyone know how to configure the model to use the gnu compiler? The old method doesn't work with CIME5. |
By the way, the model compiled with Intel ran well in the debug mode on anvil. |
We need to know what kind of error you're seeing and what command you're trying to do. |
I used
but when I compiled the model, it said: mpicc -c -I/blues/gpfs/home/kaizhang/model/ACME_20170407_ieflx/cime/share/timing -O2 -fp-model precise -std=gnu99 -O0 -g -DFORTRANUNDERSCORE -DNO_R16 -DCPRINTEL -DHAVE_MPI /blues/gpfs/home/kaizhang/model/ACME_20170407_ieflx/cime/share/timing/gptl.c It seems to me that the model was still being compiled by intel. |
my case directory is : /home/kaizhang/model/cases/ACME_20170407_ieflx_FC5AV1C-L_ne30_ne30_EXP01_DEBUG_gnu_256p and build directory is: /lcrc/group/acme/kaizhang/acme_scratch/ACME_20170407_ieflx_FC5AV1C-L_ne30_ne30_EXP01_DEBUG_gnu_256p/bld |
Are you trying to use an existing case directory? If so, you have to do "case.setup -c" after changing a compiler. |
Thanks for your help! The command you recommended works for me as well. However, even after "case.setup -c" the method I used (xmlchange_exe --id COMPILER --val "gnu") still fails with the same error message. Anyway, I reproduced the gnu-runtime-error problem on anvil. The bug has been found and the model runs well now with gnu on anvil. I will commit the bug fix after a further test. |
The bug fix is committed. |
Fantastic, thanks Kai! I'll squash your commits before merging. @rljacob : looks like melvin is reporting essentially a clean dashboard. Am I clear to merge this to next for integration testing? |
Yes. I think you have to "revert the revert" to put this back on next. |
Thanks Rob. I won't have to do that since I will squash the commits together, so it will have a new hash. |
Information on the IE fixer: https://acme-climate.atlassian.net/wiki/display/ATM/Simulation+with+the+IEFLX+fixer These modifications add to those in PR #1301. The following variable will be added to the master list if ieflx_opt > 0 SHFLXFIX : SHFLX plus global mean IEFLX (sensible heat flux used in the atmosphere model) To switch on the IEFLX fixer, set ieflx_opt = 2 By default, the IEFLX fixer is switched off. [BFB]
bd7d7d0
to
32edd82
Compare
#1303) This PR implements the IEFLX fixer (https://acme-climate.atlassian.net/wiki/display/ATM/Simulation+with+the+IEFLX+fixer) These modifications add to those in PR #1301. The following variable will be added to the master list if ieflx_opt > 0 SHFLXFIX : SHFLX plus global mean IEFLX (sensible heat flux used in the atmosphere model) To switch on the IEFLX fixer, set ieflx_opt = 2 By default, the IEFLX fixer is switched off. [BFB]
This PR implements the IEFLX fixer (https://acme-climate.atlassian.net/wiki/display/ATM/Simulation+with+the+IEFLX+fixer) These modifications add to those in PR #1301. The following variable will be added to the master list if ieflx_opt > 0 SHFLXFIX : SHFLX plus global mean IEFLX (sensible heat flux used in the atmosphere model) To switch on the IEFLX fixer, set ieflx_opt = 2 By default, the IEFLX fixer is switched off. [BFB] * kaizhangpnl/atm/check_energy_bugfix_AND_ieflx: Implement the IEFLX fixer
@kaizhangpnl - I'm trying to use this change now and I notice that the namelist variable l_ieflx_fix is defined but is no longer actually used anywhere. Also, the impact of different ieflx_opt choices (or even the set of allowable choices) is not explained anywhere. Fixing these things isn't a huge priority, but should probably be done to avoid confusion in the future. Sorry for not catching this in my last review. |
@PeterCaldwell Thanks for your comments. I thought the code (the two equations) were self-explaining, but it seemed not the case. Apart from the simple description of the equations, probably more background information is needed (as documented on the confluence page). I will create a separate push request later. For now, please see the commit summary and confluence link below: This PR implements the IEFLX fixer These modifications add to those in PR #1301. The following variable will be added to the master list if ieflx_opt > 0 To switch on the IEFLX fixer, set By default, the IEFLX fixer is switched off. [BFB] |
…ewcase Add input-dir to create_newcase Test suite: code-checker Test baseline: Test namelist changes: Test status: bit for bit Fixes #1303 User interface changes?: None Code review: @jedwards4b
if(is_subcol_on()) then | ||
call pbuf_register_subcol('TEOUT', 'phys_register', teout_idx) | ||
call pbuf_register_subcol('IEFLX', 'phys_register', ieflx_idx) |
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.
@kaizhangpnl - @tangq noticed that the line just above is a bug: the code will crash if you try to pbuf_register_subcol before you pbuf_add_field. We didn't catch this because we never try running in subcolumn mode. This line isn't needed, however, since the same operation is done correctly just below.
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.
Since this has already been merged to master, please open an issue for this bug.
@PeterCaldwell Yes, this is a bug. It seems I forgot to remove this line during the last round of code cleanup. I will create a new PR to fix it. |
Yup, no big deal. I missed it in my review and it doesn't affect any of the runs we are doing these days. Might as well fix it though. |
This PR implements the IEFLX fixer
(https://acme-climate.atlassian.net/wiki/display/ATM/Simulation+with+the+IEFLX+fixer)
These modifications add to those in PR #1301.
The following variable will be added to the master list if ieflx_opt > 0
SHFLXFIX : SHFLX plus global mean IEFLX (sensible heat flux used in the atmosphere model)
To switch on the IEFLX fixer, set
ieflx_opt = 2
By default, the IEFLX fixer is switched off.
[BFB]