-
Notifications
You must be signed in to change notification settings - Fork 6
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
MAM4xx calcsize port #72
Conversation
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.
Guys, this looks pretty great so far. I see a lot of FIXMEs that will lead to useful discussion.
Great write-up, thanks.
Do we have to keep variable names like |
@jeff-cohere , @singhbalwinder : We see in this PR some common things that have shown up in others already, and will likely continue to show up (below). Thanks, @odiazib and @mjs271 for this work and for making the following discussion much easier with good code and good code comments.
|
I opened #74 so we can discuss names of quantities there. Unfortunately, we don't have enough collective momentum yet to let these kinds of issues get in the way of pull requests. |
Regarding item 2 (bad constants): I agree that poor handling of floating point arithmetic is lamentable, but our scientist friends are not trained in numerical analysis and we might have trouble explaining departures from MAM4 implementations to them. We can address this on a case-by-case basis, but I'm not personally willing to spend a lot of energy in this direction because we haven't made a lot of progress in the past when we've attempted to do so. |
I think it's in good shape to go ahead! |
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 is more or less ready to go--nice work, you two!
@pbosler raised several good points in his review, and I think we should actually discuss these things in a group setting because they pertain to several parameterizations. I have created some GitHub Issues to track these conversations. Everyone, please feel free to modify these issues and add new ones to better reflect any points you feel need to be discussed, clarified, etc.
Other reviewers: please take a look at this PR and weigh in with your thoughts.
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.
Great PR, thanks for all the work, in particular, for being so thorough with validation and testing. Most of my previous comments (on the draft PR) can be deferred to Issues and discussions with the larger group and should not delay this PR. Some things that I would like to be resolved as part of this PR are:
- Double-check that
dgncur_i
anddgncur_c
need to be added toDiagnostics
; I think they're already there asDiagnostics.dry_geometric_mean_diameter
. We may need to updateDiagnostics
to account for the c/I separation for these diagnostics. If so, let's make another issue and do that in a separate PR since this one is already large. - There is some
if
logic implemented by a multiplication by one million that I'd like to take out and replace with an actualif
orbool
-dependent statement. - There are redundant arrays (e.g., volume and diameter) and functions (mode averaged-size) that should be replaced with already-implemented functions from
conversions
andmode_wet/dry_particle_size
. - There are some code comments that refer to the fortran mam4 constant indexing convention, which we've replaced in mam4xx by enums. Please double-check that we're using the enums in the code and not the old fortran indices, and update the comments if necessary.
… for single precision. One possible solution for Issue #75
…ME related with low and high diameter in e3sm. E3SM is consistent in applying limits in diameter. MAM4xx calcsize is marching all validation test from e3sm!
f5415b5
to
434b4ac
Compare
I rebase collab/ccalcsize branch against main branch because of merging issues. |
…of dgncur_i/c. Deleting dgncur_i/c.
Thanks for the comments, @pbosler and @singhbalwinder . I have left comments that indicate what I think should be changed and what we should defer. @mjs271 , if you can address these comments, we can do a final review and get this PR merged. I think it's crucial for us to keep our momentum. Down the line when we have more code in |
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.
It sounds like @mjs271 will create several Issues to track the outstanding comments. It's ok to merge once we have those.
const Real &init_num_i, const Real &init_num_c, | ||
const Real &dt, const Real &v2nmin, const Real &v2nmax, | ||
const Real &v2nminrl, const Real &v2nmaxrl, | ||
const Real &adj_tscale_inv, const Real &close_to_one, |
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.
Saving this for a separate issue/PR is ok with me.
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.
This all looks good to me too. Thanks for all this work @mjs271 and @odiazib, as well as the great reviews from @jeff-cohere and @pbosler.
@jeff-cohere @pbosler Thanks marking those issue candidates for me. I'm at AGU this week, but I'll knock them down as I snag some free moments. Feel free to merge, though, and I can refer to the closed PR. |
I've created issues for everything we should revisit for this PR, so I'm merging it. |
This is the MAM4xx port of the
calcsize
process from e3sm.In e3sm, this subroutine calculates the aerosol distribution parameters (
dgncur_i
,dgncur_c
,v2ncur_i
,v2ncur_c
) and also updates the tendencies for the mass mixing ratio (q_aero_i
andq_aero_c
) and number mixing ratios (n_mode_i
,n_mode_c
) for all four modes (accumulation, aitken, coarse, and primary carbon). To portcalcsize
, we follow thenucleation
andgasaerexch
implementations in mam4xx. Therefore,calcsize
has a top-levelcompute_tendencies()
function that provides the aboveprognostics
anddiagnostics
quantities to the host model.For reference, we used the refactored MAM4 code and the ported Fortran code in Haero, as recommend by Balwinder. MAM4xx
calcsize
builds on both CPUs and NVIDIA GPUs and passes all implemented unit and validation tests, though, vacuously so in some cases that require more data for validation.We carry out initial high-level validation testing for MAM4xx
calcsize
(src/validation/calcsize/compute_tendencies.cpp
) using Skywalker output from e3sm. We are able to match most of the outputs, except for the particulate diameter of the aitken mode. We will need additional output from e3sm (and validation output for other functions) to find and fix this issue.Main points to consider in this mam4xx
calcsize
port:ColumnViews
of 4 modes and each mode has 7 species.ColumnView
has a length of number of vertical levels in an atmospheric column, in contrast to MAM4's 2-rank array with dimensions of number of levels and total number of species, grouped by mode._n_common_species_ait_accum
: number of common species between aitken and accumulation modes._noxf_acc2ait
: species in accumulation mode that are NOT part of the aitken mode._ait_spec_in_acc
: index of aitken species that are also in accumulation mode._acc_spec_in_ait
: index of accumulation species also in aitken mode.dgncur_i
,dgncur_c
) and number to volume ratio (v2ncur_c
,v2ncur_i
) diagnostic variables inaero_conf.hpp
. These variables are outputs fromcalcsize
and are needed for verification.i
, in contrast to MAM4'sa
subscript (for "advected" species).inv_density
) to the initialization ofcalcsize
. We use a 4x7 data struct to match the shape oftendencies
andprognostics
.validation/calcsize
) for the following functions:get_relaxed_v2n_limits
,compute_dry_volume_k
,adjust_num_sizes
,update_diameter_and_vol2num
, andaitken_accum_exchange
. We created the associated yaml inputs and python outputs for these tests in themam_x_validation
repository (currently on our own branch).mam_x_validation
once this PR in mam4xx is finalized.Fixes #75