NCAR / icar

The Intermediate Complexity Atmospheric Research model (ICAR)
MIT License
72 stars 53 forks source link

lsm=0 and LSM vars defined causes crash #121

Closed bertjebertjek closed 2 years ago

bertjebertjek commented 2 years ago

when (some/any) of the vegtype_var, soiltype_var, soil_t_var are defined in the options file, but lsm=0 is selected, the model crashes on initialization in __domain_interface.domain_implementation_MOD_read_land_variables at objects/domain_obj.f90:1622.

Possible Solution

check if lsm /= 0 before allocating vars, this is currently not done.

Steps to Reproduce (for bugs)

  1. set lsm=0 2.define (some/any) of the vegtype_var, soiltype_var, soil_t_var

Your Environment

gutmann commented 2 years ago

It seems to primarily (only?) occur in the domain initialization. The domain object does actually test that arrays have been allocated before assigning an initial condition from a file... but there were cases in which it did not test before assigning a backup default value (e.g. assigning soil_deep_temperature to soil_temperature). It also looked like all of the external variables (snow height, etc) were not checked. I've now added checks for allocation before those assignments too, and it seems to run when lsm=0. I'll post a PR soon.