-
Notifications
You must be signed in to change notification settings - Fork 434
output detailed aerosol radiation properties #6317
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
Conversation
|
A blocker: the new higher-dimensioned fields make it impossible to restart the model. The error is of this sort: To reproduce the fail:
Footnotes
|
0f55624
to
f9da17c
Compare
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.
Looks good to me! I have left some very minor nit-picky comments.
Hi @singhbalwinder, thank you for the quick review! I have made some edits in response to your review. I also intentionally exposed the blocker to this PR in a testmod for repro and debug
Do you happen to have seen such errors before? Any tips? Thanks! A (potentially useless) tip for debugging: |
This shouldn't be merged until we figure out the restart bug. I think I heard of similar reports... |
33a43da
to
b1b07e6
Compare
Any progress on restart issue? |
Someone will need to take a deeper dive to figure it out. Our code has diverged significantly enough from CAM. I am afraid to be the one taking the plunge here because it may just drive me crazy... :/ |
After three months, I don't think I will be able to dedicate enough time for this PR. I don't like keeping stale PRs open, so I will close it. My thinking here is the following: We simply don't have bandwidth to resolve this niche issue (as much as I'd like it resolved for good). We are also potentially moving to C++ and so this is likely all moot anyway (at least for me personally). Closing. |
b1b07e6
to
7011e6e
Compare
@rljacob, this is finally ready! |
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.
Thanks, Naser! Overall looks good to me but I have requested some minor changes.
You have added testmods but I don't see any new test added in this PR. Will there be a follow up PR with a test?
|
||
! A toggle to switch between rrtmg and rrtmgp | ||
! TODO: move this to the namelist at some point? | ||
integer :: output_aer_props_rrtmgp = 1 ! 1=rrtmgp, 0=rrtmg |
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 it can carry only two values, can we make it a boolean rather than an integer?
If we assign 1 to this variable by default, would it change the answers? I think it will at least change the netcdf files to add or change a dimension. The output files can be NBFB.
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.
Just diagnostic outputs (and I think it will DIFF even if the fields are not requested, because the coords will DIFF)
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.
In the next edit, I will set this to FALSE (i.e., have it go with the default radiation scheme, unless the user requests it otherwise in the namelist --- so, I will add this to the namelist too)
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.
We should label it NBFB if it is going to cause DIFFs in the nightlies.
@@ -119,6 +130,23 @@ end subroutine modal_aer_opt_readnl | |||
|
|||
!=============================================================================== | |||
|
|||
subroutine modal_aer_opt_coords | |||
integer :: i_nswband | |||
call get_sw_spectral_midpoints(sw_band_midpoints, 'nm') |
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.
Unless I am missing something, sw_band_midpoints
, sw_band_midpoints_p
and lw_band_midpoints
can all be local variables for subroutine modal_aer_opt_coords
.
@@ -67,6 +69,15 @@ module modal_aer_opt | |||
character(len=4) :: diag(0:n_diag) = (/' ','_d1 ','_d2 ','_d3 ','_d4 ','_d5 ', & | |||
'_d6 ','_d7 ','_d8 ','_d9 ','_d10'/) | |||
|
|||
integer, dimension(nswbands) :: rrtmg_to_rrtmgp_swbands = (/ & |
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.
We should make rrtmg_to_rrtmgp_swbands
a parameter
to protect it from accidental changes.
@@ -362,6 +363,9 @@ subroutine phys_register | |||
if (.not. do_clubb_sgs .and. .not. do_shoc_sgs) call vd_register() | |||
|
|||
if (do_aerocom_ind3) call output_aerocom_aie_register() | |||
|
|||
! add new coords to modal_aer_opt | |||
call modal_aer_opt_coords |
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 would call the modal_aer_opt_coords
subroutine from modal_aer_opt_init
rather than physpkg.F90
. physpkg.F90
calls modal_aer_opt_init
and it will be called during the model initialization.
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.
Thanks for the good reminder! Really, this routine doesn't belong in modal_aer_opt to begin with. I will move it to radiation_init (which is what is called by physpkg; it also calls modal_aer_opt_init). That way, this is a model-wide coord setting. I will also add a namelist parameter to allow the user to choose which coord they want and set it for rrtmg (i.e., no reordering, which default for model)
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.
Yeah, that would be a better place to call it. If it doesn't work in the *init
routine, you can call it from the *register
routine.
else | ||
call add_hist_coord('swband', nswbands, 'Shortwave wavelength', 'nm', sw_band_midpoints) | ||
end if | ||
call add_hist_coord('lwband', nlwbands, 'Longwave wavelength', 'nm', lw_band_midpoints) |
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.
We only use sw_band_midpoints_p
if output_aer_props_rrtmgp == 1
. We can rewrite this logic so that the model compute fields only if they are needed. For example (just a suggestion):
! Set history file coordinates for the short wave
call get_sw_spectral_midpoints(sw_band_midpoints, 'nm')
if (output_aer_props_rrtmgp == 1) then
! Reorder bands to match RRTMGP order
do i_nswband = 1, nswbands
sw_band_midpoints_p(i_nswband) = sw_band_midpoints(rrtmg_to_rrtmgp_swbands(i_nswband))
end do
call add_hist_coord('swband', nswbands, 'Shortwave wavelength', 'nm', sw_band_midpoints_p)
else
call add_hist_coord('swband', nswbands, 'Shortwave wavelength', 'nm', sw_band_midpoints)
end if
! Set history file coordinates for the long wave
call get_lw_spectral_midpoints(lw_band_midpoints, 'nm')
call add_hist_coord('lwband', nlwbands, 'Longwave wavelength', 'nm', lw_band_midpoints)
@@ -31,7 +31,7 @@ jobs: | |||
- SMS_P4.ne4pg2_oQU480.F2010.singularity2_gnu | |||
- REP_P4.ne4pg2_oQU480.F2010.singularity2_gnu | |||
- ERS_P4.ne4pg2_oQU480.F2010.singularity2_gnu | |||
- ERS_P4.ne4pg2_oQU480.F2010.singularity2_gnu.eam-wcprod_F2010 | |||
- ERS_P4.ne4pg2_oQU480.F2010.singularity2_gnu.eam-wcprod_F2010_spao |
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.
@singhbalwinder I added the testmod here. I wasn't planning to add it to tests.py (our test suites) but I could do that. Any recommendation for which test suite to add this to? Paging @rljacob for advice 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.
Sorry, I missed this file. This looks fine to me unless we would like to compare against the baselines. If we want to add it to the nightlies, we can add it to one of the integration suites.
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.
Add it to e3sm_atm_integration
@@ -210,7 +238,17 @@ subroutine modal_aer_opt_init() | |||
|
|||
! Add diagnostic fields to history output. | |||
|
|||
call addfld ('MODAL_AER_TAU_SW', (/'lev ','swband'/), 'A', '1', & |
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.
Can you see if there's a CF standard name for any of these new variables and add it to the addfld call?
https://cfconventions.org/Data/cf-standard-names/current/build/cf-standard-name-table.html
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 did some searching and looks like aerosol-radiative properties broken down by short/longwave are not there.
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 think this applies (if we choose to):
atmosphere_optical_thickness_due_to_ambient_aerosol_particles
alias: atmosphere_optical_thickness_due_to_ambient_aerosol
alias: atmosphere_optical_thickness_due_to_aerosol
The optical thickness is the integral along the path of radiation of a volume scattering/absorption/attenuation coefficient. The radiative flux is reduced by a factor exp(-optical_thickness) on traversing the path. A coordinate variable of radiation_wavelength or radiation_frequency can be specified to indicate that the optical thickness applies at specific wavelengths or frequencies. The atmosphere optical thickness applies to radiation passing through the entire atmosphere. "Aerosol" means the system of suspended liquid or solid particles in air (except cloud droplets) and their carrier gas, the air itself. "Ambient_aerosol" means that the aerosol is measured or modelled at the ambient state of pressure, temperature and relative humidity that exists in its immediate environment. "Ambient aerosol particles" are aerosol particles that have taken up ambient water through hygroscopic growth. The extent of hygroscopic growth depends on the relative humidity and the composition of the particles. To specify the relative humidity and temperature at which the quantity described by the standard name applies, provide scalar coordinate variables with standard names of "relative_humidity" and "air_temperature". The specification of a physical process by the phrase due_to_process means that the quantity named is a single term in a sum of terms which together compose the general quantity named by omitting the phrase.
emphasis:
A coordinate variable of radiation_wavelength or radiation_frequency can be specified to indicate that the optical thickness applies at specific wavelengths or frequencies.
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.
And technically, we can merge the SW and LW, but that may be a bit of a messy work...
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.
Here's the others:
asymmetry_factor_of_ambient_aerosol_particles
The asymmetry factor is the angular integral of the aerosol scattering phase function weighted by the cosine of the angle with the incident radiation flux. The asymmetry coefficient is assumed to be an integral over all wavelengths, unless a coordinate of radiation_wavelength is included to specify the wavelength. "Aerosol" means the system of suspended liquid or solid particles in air (except cloud droplets) and their carrier gas, the air itself. "Ambient_aerosol" means that the aerosol is measured or modelled at the ambient state of pressure, temperature and relative humidity that exists in its immediate environment. "Ambient aerosol particles" are aerosol particles that have taken up ambient water through hygroscopic growth. The extent of hygroscopic growth depends on the relative humidity and the composition of the particles. To specify the relative humidity and temperature at which the quantity described by the standard name applies, provide scalar coordinate variables with standard names of "relative_humidity" and "air_temperature".
single_scattering_albedo_in_air_due_to_ambient_aerosol_particles
"Single scattering albedo" is the fraction of radiation in an incident light beam scattered by the particles of an aerosol reference volume for a given wavelength. It is the ratio of the scattering and the extinction coefficients of the aerosol particles in the reference volume. A coordinate variable with a standard name of radiation_wavelength or radiation_frequency should be included to specify either the wavelength or frequency. "Aerosol" means the system of suspended liquid or solid particles in air (except cloud droplets) and their carrier gas, the air itself. "Ambient_aerosol" means that the aerosol is measured or modelled at the ambient state of pressure, temperature and relative humidity that exists in its immediate environment. "Ambient aerosol particles" are aerosol particles that have taken up ambient water through hygroscopic growth. The extent of hygroscopic growth depends on the relative humidity and the composition of the particles. To specify the relative humidity and temperature at which the quantity described by the standard name applies, provide scalar coordinate variables with standard names of "relative_humidity" and "air_temperature". The specification of a physical process by the phrase "due_to_" process means that the quantity named is a single term in a sum of terms which together compose the general quantity named by omitting the phrase.
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.
radiation_wavelength
alias: electromagnetic_wavelength
The radiation wavelength can refer to any electromagnetic wave, such as light, heat radiation and radio waves.
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.
Could you point me to how I could add the CF names to these fld
calls?
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.
Use the standard_name optional argument at the end of the call.
call addfld ('MODAL_AER_TAU_SW', (/'lev ','swband'/), 'A', '1', &
'Aerosol shortwave extinction optical depth', flag_xyfill=.true., &
standard_name='atmosphere_optical_thickness_due_to_ambient_aerosol_particles')
If I try to set the coords in a more coherent manner in radiation (as opposed to the ad hoc manner in the modal model), I get into all sorts of problems. I am going to give up on this. I wasted way too much time debugging this and trying all sorts of different things to make it work. It's simply not worth it. I am going to close the PR (again) and move on. The PR as-is works and is in good shape. However, it is bad design to define these coords in modal_aer_opt. They should be defined as intrinsic part of radiation. When I try to move there, things break down. If someone is interested in this type of PR, the current state is a good (and working) starting point. Before merging to mainline E3SM, the coords should be handled gracefully in radiation (not in the modal model). |
Adds additional detailed diagnostic outputs for aerosol radiation properties.
These diagnostics have long been used for production simulations (e.g., as inputs for SPA in SCREAM), but the code has never been incorporated in the main repository. The additions first include adding a visible-only
AER_TAU_SW_VIS
output to compare against AODVIS (if it weren't for not setting the night times to afillvalue
, the sum of this new output will be exactly the same as AODVIS). The more substantive addition are the optical properties needed for SPAMODAL_AER_TAU_SW
,MODAL_AER_SSA_SW
,MODAL_AER_G_SW
, andMODAL_AER_TAU_LW
. These outputs require adding two new history coordinates (swband
andlwband
), and can be ordered for RRTMG or RRTMGP (default to RRTMGP).[BFB]