-
Notifications
You must be signed in to change notification settings - Fork 374
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
Fix ncol/pcols mismatch on interpolating aerosol mass fields to pressure levels #6260
Conversation
|
Since you filed #6259, I was trying to remember how I came up with the calls PR #5862. I simply copied the logic from elsewhere and used it for the aerosol fields. So, this likely is more widespread issue than the aerosol fields. For example, the current calls for the interpolated-to-pressure aerosol fields look like: call vertinterp(ncol, pcols, pver, pmid, 85000._r8, mass_3d_tmp, mass_at_pressure) Similar calls can be found in different places. Some examples below. components/eam/src/physics/cam/gw_drag.F90 call vertinterp(ncol, pcols, pver, state%pmid, 5000._r8, dummyx, dummmy_p_surf) components/eam/src/physics/rrtmg/radiation.F90 call vertinterp(ncol, pcols, pverp, state%pint, 20000._r8, fns, fsn200) components/eam/src/physics/cam/cam_diagnostics.F90 call vertinterp(ncol, pcols, pver, state%pmid, 80000._r8, state%t, p_surf) components/eam/src/physics/cam/zm_conv_intr.F90 call vertinterp(ncol, pcols, pver, state%pmid, 60000._r8, state%u,du600) Should we fix these other calls in this PR or are they sufficiently different? I know we have a pressing interest in these specific fields for the campaigns coming up, so we could simply punt on the other issues until later. |
Thanks for the quick review, @mahf708 . Those other interpolations are ok. Take the following as an example The 2nd argument specify the column dimension sizes for For the aerosol mass arrays, such as |
Ah, I see! Thanks! I was obviously lazy to figure out all the nuances here, and I will do better next time (or I should manage to learn enough f90) before I edit any substantial code 😸 |
That is fine. We all reuse codes often by copying/pasting. Everybody could miss something like this sometimes. |
Fix ncol/pcols mismatch on interpolating aerosol mass fields to pressure levels The input dimension size specified in call vertinterp to interpolate aerosol masses to pressure levels can be larger than the actual mass array (pcols >= ncol). This can cause unintended values, either from different levels or random values outside the memory space associated with the array being used for interpolation, resulting in NaN values for some configuration or on some machines. Even though not resulting in NaN values for a run, such mismatch is also expected to cause the interpolated arrays being corrupted. Fixes #6259. [BFB] Differences only for diagnostic fields such as mass_bc_850 in eam.h0, if they are saved for a test
Merged to next. |
The input dimension size specified in call vertinterp to interpolate aerosol masses to
pressure levels can be larger than the actual mass array (pcols >= ncol). This can cause
unintended values, either from different levels or random values outside the memory
space associated with the array being used for interpolation, resulting in NaN values for
some configuration or on some machines. Even though not resulting in NaN values for a run,
such mismatch is also expected to cause the interpolated arrays being corrupted.
Fixes #6259.
[BFB] Differences only for diagnostic fields such as mass_bc_850 in eam.h0, if they are saved for a test