ESCOMP / ESCOMP/CTSM

Problems when asking for history variable at a higher subgrid level than available (add graceful error checking)

Open
#1,913 9 comments 0 reactions 1 assignee Claimed by @samsrabin View on GitHub
bug
Dominant language
Fortran
Stars
352
Forks
361
Avg merge
6d 6h
Merged PRs (30d)
8

Description

### Brief summary of bug

If you ask for a variable at a higher subgrid level than is available, the error message is not helpful. The output example of this is from Jon Wolfe.

### General bug information

**CTSM version you are using:** ? but in latest ctsm ctsm5.1.dev114

**Does this bug cause significantly incorrect results in the model's science?** No

**Configurations affected:** BGC-Crop

### Details of bug

This is specifically about what happens when you ask for CROPPROD1C at PFT level, when CROPPROD1C is a gridcell level variable so it's only available at gridcell level averaging. But, it's a general problem that applies to other variables as well.

### Important details of your setup / configuration so we can reproduce the bug

``` fortran
hist_dov2xy = .true.,.false.,.false.
hist_fincl2 = 'CROPPROD1C'
hist_fincl3 = 'CROPPROD1C'
hist_nhtfrq = 0,0,0
hist_type1d_pertape = ' ','PFTS','GRID'
```

### Important output or errors that show the problem

The following must be what you see when running in DEBUG mode, there would still be a problem without DEBUG mode, but likely much messier.

The cesm log complains about this:

```
forrtl: severe (408): fort: (2): Subscript #1 of the array HBUF has value 15735 which is greater than the upper bound of 1970

Image PC Routine Line Source
cesm.exe 0000000004EF7F66 Unknown Unknown Unknown
cesm.exe 0000000000BC2B54 histfilemod_mp_hi 4318 histFileMod.F90
cesm.exe 0000000000D6A165 restfilemod_mp_re 124 restFileMod.F90
cesm.exe 00000000009051CF clm_driver_mp_clm 1365 clm_driver.F90
cesm.exe 000000000089807F lnd_comp_mct_mp_l 457 lnd_comp_mct.F90
cesm.exe 0000000000476A85 component_mod_mp_ 737 component_mod.F90
cesm.exe 000000000043E2B1 cime_comp_mod_mp_ 2626 cime_comp_mod.F90
cesm.exe 000000000045E5CC MAIN__ 133 cime_driver.F90=
cesm.exe 0000000000416A12 Unknown Unknown Unknown
```

Definition of done:
- [ ] Figure out how we can recognize this in the code
- [ ] Add error checking so that the model gracefully fails in this case

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.