-
Notifications
You must be signed in to change notification settings - Fork 24
Energy_transport_diag: Adding energy transport diagnostics #247
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
base: noresm_develop
Are you sure you want to change the base?
Energy_transport_diag: Adding energy transport diagnostics #247
Conversation
|
I like the first option best I think, but happy with both suggestions. |
|
@andrearosendahl Can you update this PR with new names? I think the second suggestion indicates that it is not the energy in itself, but the transport. Maybe good to include? However, both will work. Great to get this in. Thanks! |
|
True, I'll update the PR with the second option then. |
|
@gold2718 I hope you can review as well - I'm happy with this |
|
@andrearosendahl, have you run a test with the new names to make sure they come out correctly? to the bottom of the file. That way, they will show up (and be protected) in our regression test suite. |
|
How do I run a test with this new history file? I am creating a new case now with the new names in the user_nl_cam list |
Yes, that is a clean way to test. You don't need a long simulation. A month is probably sufficient. |
|
New case with the new variable names tested here: /cluster/work/users/andrear/n1850.ne16pg3_tn14.noresm3_0_beta03b.entrans.2025-12-04 I also added the names in a new history file as you suggested above @gold2718 |
gold2718
left a comment
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 have a few suggestions on what to change. Some is cleanup and some so that CAM is not slowed down when these diagnostic fields are not being output.
There is more potential optimization we can look at after this is done.
src/physics/cam/cam_diagnostics.F90
Outdated
| !! calculate the atmospheric energy transport terms: | ||
| !! internal energy transport Cp*T*v*dp/g | ||
| ftem(:ncol,:) = (cpair*state%t(:ncol,:)*state%v(:ncol,:))*(state%pdel(:ncol,:)/gravit) | ||
| !call outfld ('INTEnTrans', ftem(:ncol,:) ,ncol ,lchnk ) |
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.
Please remove these commented-out outfld calls (here and below). Currently, there are no addfld calls for them and we can add 3-D fields later if desired.
src/physics/cam/cam_diagnostics.F90
Outdated
| ftem(:ncol,:) = (cpair*state%t(:ncol,:)*state%v(:ncol,:))*(state%pdel(:ncol,:)/gravit) | ||
| !call outfld ('INTEnTrans', ftem(:ncol,:) ,ncol ,lchnk ) | ||
| !! vertically integrate | ||
| ftem3(:ncol)=ftem(:ncol,1) | ||
| do k=2,pver | ||
| ftem3(:ncol) = ftem3(:ncol) + ftem(:ncol,k) | ||
| end do | ||
| call outfld ('IntHeatTr', ftem3(:ncol), ncol ,lchnk) |
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.
The ftem calculation is fairly expensive and should only be done if IntHeatTr will be output. Please implement that as shown in this suggestion (and also below with the appropriate history field names).
| ftem(:ncol,:) = (cpair*state%t(:ncol,:)*state%v(:ncol,:))*(state%pdel(:ncol,:)/gravit) | |
| !call outfld ('INTEnTrans', ftem(:ncol,:) ,ncol ,lchnk ) | |
| !! vertically integrate | |
| ftem3(:ncol)=ftem(:ncol,1) | |
| do k=2,pver | |
| ftem3(:ncol) = ftem3(:ncol) + ftem(:ncol,k) | |
| end do | |
| call outfld ('IntHeatTr', ftem3(:ncol), ncol ,lchnk) | |
| if (hist_field_active('INTEnTrans')) then | |
| ftem(:ncol,:) = (cpair*state%t(:ncol,:)*state%v(:ncol,:))*(state%pdel(:ncol,:)*rga) | |
| !call outfld ('INTEnTrans', ftem(:ncol,:) ,ncol ,lchnk ) | |
| !! vertically integrate | |
| ftem3(:ncol)=ftem(:ncol,1) | |
| do k=2,pver | |
| ftem3(:ncol) = ftem3(:ncol) + ftem(:ncol,k) | |
| end do | |
| call outfld ('IntHeatTr', ftem3(:ncol), ncol ,lchnk) | |
| end if |
Note that I also replaced dividing by gravit with multiplication by rga which is simply 1/gravit. This is because multiplication is a lot faster than division.
src/physics/cam/cam_diagnostics.F90
Outdated
| call outfld ('LatHeatTr', ftem3(:ncol) ,ncol ,lchnk ) | ||
|
|
||
| !! potential energy transport g*z*v*dp/g | ||
| ftem(:ncol,:) = (gravit*z3(:ncol,:)*state%v(:ncol,:))*(state%pdel(:ncol,:)/gravit) |
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.
The gravit terms cancel out here so this can just be:
| ftem(:ncol,:) = (gravit*z3(:ncol,:)*state%v(:ncol,:))*(state%pdel(:ncol,:)/gravit) | |
| ftem(:ncol,:) = z3(:ncol,:)*state%v(:ncol,:)*state%pdel(:ncol,:) |

Added formulas for calculating different parts of the atmospheric energy transport, so they can be outputted when running NorESM3.
Contributors: Andrea Rosendahl @andrearosendahl
Reviewers: @gold2718
Purpose of changes:
Github PR URL: #247
Changes made to build system: None
Changes made to the namelist: None
Changes to the defaults for the boundary datasets: None
Substantial timing or memory changes: None
Test run to verify that I am able to see the new diagnostics: /cluster/work/users/andrear/n1850.ne16pg3_tn14.noresm3_0_beta03b.entrans.2025-11-28
To have the option of outputting 5 atmospheric meridional energy transport variables.
Top of README.case:
./create_newcase --case /cluster/work/users/andrear/n1850.ne16pg3_tn14.noresm3_0_beta03b.entrans.2025-12-04 --compset 1850_CAM70%LT%NORESM%CAMoslo_CLM60%FATES-NOCOMP_CICE_BLOM%HYB%ECO_MOSART_DGLC%NOEVOLVE_SWAV_SESP --res ne16pg3_tn14 --project nn9560k --machine betzy --compiler intel --run-unsupported --user-mods-dir /cluster/work/users/andrear/NorESM_3_0_beta03b/cime_config/usermods_dirs/reduced_out_devsim/
user_nl_cam:
! Users should add all user specific namelist changes below in the form of
! namelist_var = new_namelist_value
use_aerocom = .false.
interpolate_nlat = 96
interpolate_nlon = 144
interpolate_output = .true.,.true.
history_aerosol = .false.
zmconv_c0_lnd = 0.0075D0
zmconv_c0_ocn = 0.0075D0
zmconv_ke = 5.0E-6
zmconv_ke_lnd = 1.0E-5
clim_modal_aero_top_press = 1.D-4
bndtvg = '/cluster/shared/noresm/inputdata/atm/cam/ggas/noaamisc.r8.nc'
dust_emis_method = 'Leung_2023'
dust_emis_fact = 6.1D0
rafsip_on = .true.
micro_mg_dcs = 700.D-6
clubb_c8 = 4.8
nhtfrq = 0, -24
mfilt = 1, 30
ndens = 2, 2
fincl1 = 'IntHeatTr', 'PotEnerTr', 'LatHeatTr', 'KinEnerTr', 'TotEnerTr'
fincl2 = 'Z500', 'T850', 'U850', 'V850'