E3SM-Project / E3SM-Project/E3SM
EAMxx: `Required` fields with no provider are silently zero-filled on pg2 grids
- Dominant language
- Fortran
- Stars
- 441
- Forks
- 481
- Avg merge
- 4d 7h
- Merged PRs (30d)
- 33
Description
On a pg2 physics grid, a field registered with `add_field(...)` that no active process `Computed`s is silently allocated and zero-filled. The run proceeds with zeros rather than failing.
`process_ic_field()` skips every `physics_pg2` field (`components/eamxx/src/control/atmosphere_driver.cpp:1163`):
```cpp
} else if (not (fvphyshack and grid_name == "physics_pg2")) {
```
`fvphyshack` is set true whenever the physics grid type is pg2 (`components/eamxx/src/dynamics/homme/homme_grids_manager.cpp:214`), so these fields are never added to `ic_fields_names`, never read from the IC file, and never validated. `Field::allocate_view()` then leaves them value-initialized to zero.
Nothing else enforces the `Required`/`Computed` tags at runtime: `AtmProcDAG::has_unmet_dependencies()` is not called anywhere outside its own unit test, and neither `AtmosphereProcessGroup` nor the `FieldManager` checks that a `Required` field has a provider.
**Repro:** add `add_field("i_do_not_exist", scalar3d_mid, none, grid_name, ps);` to `SHOCMacrophysics::create_requests()` and run any ne4pg2 case — it runs to completion. The same edit on a GLL-physics config fails as expected with "Input file does not store a required variable".
Found by @whannah1 while enabling convective GWD in [PR #8680](https://github.com/E3SM-Project/E3SM/pull/8680), where GW's `deep_conv_t_tend` input is silently zero if ZM is not in the atm process list.
@bartgol
Contributor guide
Assessment
This issue has not been assessed yet.