E3SM-Project / E3SM-Project/E3SM
Floating point invalid in MPAS-O RRM init
- Dominant language
- Fortran
- Stars
- 440
- Forks
- 481
- Avg merge
- 3d 22h
- Merged PRs (30d)
- 35
Description
In the line
```F90
cellWidth = 2.0_RKIND * sqrt((areaCell(cell1) + areaCell(cell2) ) / 2.0_RKIND / pii)
```
in ocn_init_routines_compute_mesh_scaling, cell1 or cell2 can be equal to nCells+1 in the case that one is a land cell. When it is a land cell, the value areaCell(nCells+1) = -1.0e34_RKIND set in this same file is used. This leads to a negative argument to sqrt. This invalid value is never used, but it will cause a DEBUG=true E3SM build to crash with a floating point exception.
This option is controlled by config_hmix_use_ref_cell_width. It's set to true in the RRM-ocean case and false in the low-res case. I confirmed this problem by running
```
compset=CMPASO-IAF
res=T62_oEC60to30v3
```
with config_hmix_use_ref_cell_width false and then true. In the true case, the FPE is triggered.
Contributor guide
Assessment
This issue has not been assessed yet.