Bug fix that causes MPAS to crash with frac_seaice=false. #1278
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The title above should be a 1 line short summary of the pull request (i.e. what the project the PR represents is intended to do).
Enter a description of this PR. This should include why this PR was created, and what it does.
Changes to the code related to fractional sea ice in
mpas_atmphys_driver_seaice.F, mpas_atmphys_driver_sfclayer.F,
mpas_atmphys_lsm_shared.F:
1. Fixed bug that caused MPAS to crash with frac_seaice=false. It is
fixed with adding 'if(config_frac_seaice) then' around the code in seaice
driver that uses *_sea variables, which are not allocated. For example,
in the line:
chs_p(i,j) = xice_p(i,j)*chs_p(i,j) + (1._RKIND-xice_p(i,j))*chs_sea(i,j)
2. We've seen a computational problem with the current use of cpm
variable in seaice driver:
cpm(i) = xice_p(i,j)*cpm(i) + (1._RKIND-xice_p(i,j))*cpm_sea(i,j)
which is fixed by treating cpm as all other variables:
cpm_p(i,j) = xice_p(i,j)*cpm_p(i,j) + (1._RKIND-xice_p(i,j))*cpm_sea(i,j)
3. We recommend to replace
if(xice_p(i,j).ge.xice_threshold .and. xice_p(i,j).le.1._RKIND)
with
if(xice_p(i,j).ge.xice_threshold .and. xice_p(i,j).lt.1._RKIND) then
to avoid unnecessary computations over vast areas in Arctic covered with
sea ice where xice_p(i,j) = 1.
Testing and relations to other Pull Requests should be added as subsequent comments.
This code is tested in the MPAS runs at GSL.
This PR will fix the issue #1275.
See the below examples for more information.
MPAS-Dev/MPAS#930
MPAS-Dev/MPAS#931