Skip to content

Commit 054cccd

Browse files
committed
Fix error reporting when config_nfglevels is insufficiently large
In init_atmosphere, during the interpolation of first-guess meteorological fields from the intermediate files (config_init_case = 7 or 9), the value of config_nfglevels must be set to a minimum of the number of vertical levels in the intermediate file. Currently, the routines init_atm_case_gfs and init_atm_case_lbc have a logic to throw an error and exit if config_nfglevels is not sufficiently large. In practice, this error message is not reported consistently with intermediate files containing many levels and/or many MPI ranks being used. This commit fixes the inconsistent error reporting issue by adding the required deallocate statements before the repeated calls to read_next_met_field in the case of config_nfglevels being insufficiently large. Without the deallocate, one or more MPI ranks crash during the read of the field % slab from the intermediate file. This typically results in a crash of init_atmosphere without any useful error messages in the log files.
1 parent 1d6ec7c commit 054cccd

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/core_init_atmosphere/mpas_init_atm_cases.F

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3547,6 +3547,7 @@ subroutine init_atm_case_gfs(block, mesh, nCells, nEdges, nVertLevels, fg, state
35473547
! many unique levels are found using the code above
35483548
!
35493549
if (too_many_fg_levs) then
3550+
deallocate(field % slab)
35503551
call read_next_met_field(field, istatus)
35513552
cycle
35523553
end if
@@ -5283,6 +5284,7 @@ subroutine init_atm_case_lbc(timestamp, block, mesh, nCells, nEdges, nVertLevels
52835284
! many unique levels are found using the code above
52845285
!
52855286
if (too_many_fg_levs) then
5287+
deallocate(field % slab)
52865288
call read_next_met_field(field, istatus)
52875289
cycle
52885290
end if

0 commit comments

Comments
 (0)