NCAR / hrldas

HRLDAS (High Resolution Land Data Assimilation System)
Other
50 stars 53 forks source link

bug (for gfortran compiler only): If-statement for HRLDAS restart time check #148

Closed cenlinhe closed 10 months ago

cenlinhe commented 10 months ago

https://github.com/NCAR/hrldas/blob/423c1328108eb659cd219aaae1aed25826df1209/hrldas/IO_code/module_NoahMP_hrldas_driver.F#L1298-L1299

This above if-statement will cause model crash when restart time frequency is 0 using gfortran compiler. This is fine for intel compiler though. I guess the reason is that gfortran is more strict and it will check the conditions in both sides of ".and." even if the first condition on the left of ".and." is not met, so mod(int, 0) cause arithmatic error in gfortran compiler.

@CharlesZheZhang I remember you saw this before in your test but we never fixed this, right?

CharlesZheZhang commented 10 months ago

Hi Cenlin, this error is similar to what we saw before in create_forcing.F and we fixed it in a pull request: https://github.com/NCAR/hrldas/pull/128

We can have a similar solution to this issue too.

cenlinhe commented 10 months ago

@CharlesZheZhang You are right. We fixed in the create_forcing.F but not this place. I will fix it using similar strategy soon.

cenlinhe commented 10 months ago

this bug has been fixed at this commit: https://github.com/NCAR/hrldas/commit/c9aa8ce0f7b26f6e9ba2efb759fb2b56f1c81630 so I am going to close this issue.