Fix bugs that cause model crash when CAM radiation is activated#1391
Fix bugs that cause model crash when CAM radiation is activated#1391smileMchen wants to merge 1 commit intoMPAS-Dev:developfrom
Conversation
|
@smileMchen I've tested the changes in this PR, and I can confirm that they fix crashes when using CAM radiation. Could you add a bit more detail to the commit message to explain more specifically what the problem was, and how the changes in the commit fix that problem? For our commit messages, we usually follow the format: one-line summary (80 chars or less), a blank line, then one or more paragraphs (wrapped at 80 chars) describing the changes in the commit in detail. If you have any questions at all, please don't hesitate to ask! |
|
Michael, I have updated the commit message. Thanks. Ming |
|
Thanks for the updated PR description. Since we preserve the commit history when merging PRs, I think it would be good to update the commit message (i.e., to amend the message in commit ef0b686). If you don't object, I can amend ef0b686 with a commit message based on the PR description. Then we should be all set. |
|
Hi Michael, Please go ahead. Thanks. |
This commit fixes bugs that cause MPAS-Atmosphere to crash when the CAM radiation scheme is activated. Several arrays are allocated only when the RRTMG radiation scheme is activated. However, these arrays were being used when the CAM radiation scheme is turned on, leading to a segmentation fault. This commit fixes this issue by conditionally using these arrays only when the RRTMG scheme has been selected at runtime.
mgduda
left a comment
There was a problem hiding this comment.
The fix in this PR looks good to me, and I have just a few very minor clean-up requests. If it would be easier, I can just amend the commit in this PR to address these.
|
|
||
| !copy local arrays to MPAS grid: | ||
| call radiation_sw_to_MPAS(diag_physics,tend_physics,its,ite) | ||
| !mchen call radiation_sw_to_MPAS(diag_physics,tend_physics,its,ite) |
There was a problem hiding this comment.
I think it would be fine to just remove this commented-out line.
|
|
||
| radiation_sw_select: select case (trim(radt_sw_scheme)) | ||
| case("rrtmg_sw") | ||
| do i = its,ite |
There was a problem hiding this comment.
Just for consistency, should we indent this block using three spaces?
| do i = its,ite | ||
| swddir_p(i,j) = 0.0_RKIND | ||
| swddni_p(i,j) = 0.0_RKIND | ||
| swddif_p(i,j) = 0.0_RKIND |
There was a problem hiding this comment.
Should we indent the body of these loops by three spaces for consistency?
This PR fixes the bugs that cause model crash when CAM radiation scheme is activated.
Several arrays are allocated only when RRTMG radiation scheme is activated. However, these arrays are used when CAM radiation scheme is turned on, leading to segmentation fault and subsequent model crash. This PR fixes this issue by reallocating these arrays based on specific schemes.
Tests have been conducted to confirm that changes in this PR fix the model crash when using CAM radiation scheme.