Skip to content

Set minimum value for rough_mom and rough_heat to prevent NaN/Inf #8

Open
Biao-Zhao wants to merge 1 commit intoNOAA-GFDL:mainfrom
Biao-Zhao:main
Open

Set minimum value for rough_mom and rough_heat to prevent NaN/Inf #8
Biao-Zhao wants to merge 1 commit intoNOAA-GFDL:mainfrom
Biao-Zhao:main

Conversation

@Biao-Zhao
Copy link
Copy Markdown

@Biao-Zhao Biao-Zhao commented Sep 22, 2025

When rough_mom or rough_heat is zero on the exchange grid, calculations of variables such as the friction velocity (ex_u_star) can result in NaN or Inf. This happens because the calculation of ex_u_star involve divisions by rough_mom, e.g. logarithmic form of zref/rough_mom. Setting a minimum value for rough_mom and rough_heat prevents these numerical errors and model crash when output ex_u_star.

@nikizadehgfdl
Copy link
Copy Markdown
Contributor

This will also fix issue #9 that I just ran into. @Biao-Zhao why did you choose 1.0e-6? lm4 initializes these to 0.1.
https://github.com/NOAA-GFDL/lm4/blob/03cbeda10e40130e05d4752dd4513dd4898d194e/land_model.F90#L3334

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants