ESCOMP / mizuRoute

Reach-based river routing model
http://escomp.github.io/mizuRoute/
GNU General Public License v3.0
39 stars 51 forks source link

Add error checking for control options that work together in the CESM coupling buildnml #424

Open ekluzek opened 10 months ago

ekluzek commented 10 months ago

We should add error checking for the control options that work together in the control files in the buildnml when coupled to CESM. This would be checking that options are compatible with each other.

So for example I brought this up in this comment that lake is NOT compatible with rout_opt==0

https://github.com/ESCOMP/mizuRoute/pull/421#issuecomment-1680867984

Other options should be examined and make sure they work with each other. Options that don't flagged as not working the buildnml will die when it's tried.

This is helpful to have the model die before it's even put in the queue by making sure options are compatible. This provides the quickest information to the user that something should not be done. There might also be options that give a warning, or that you have to set a warning flag to use. Then of course all of the options that DO work together you want to work. So you need to do some testing to get this all setup correctly.

ekluzek commented 10 months ago

I propose a way to do this would be to add a:

<ignore_warnings>      T      ! Ignore warnings for incompatible options in the control file, only die for errors

If this is set to "F" the buildnml would die with warning about the incompatibility, as well as telling the user how to set this flag so that those options can be allowed. When set to true it still sends a warning message about the issue, but allow the namelist to be built and the simulation to continue.

Doing this sort of thing is helpful to new and non-expert users to figure out what options are allowed, while also allowing experts to work on options that they want to eventually get working. Then there are some things that are just a contradiction and should never be done. So it helps all users. This can also be used if an option won't make a difference in a simulation -- it'll let you know that option isn't connected and won't affect simulations. This prevents the user from running long simulations only to realize something wasn't working or didn't make a difference.

This is roughly how we have it setup in CTSM. Incompatible options will die, while others die and send the following message:

-- Add -ignore_warnings option to CLM_BLDNML_OPTS to ignore this warning

This turns off all warnings, but it still prints a message about them.