rniswon / mfnwt

MODFLOW-NWT - Version: 1.1.0 Newton Formulation for MODFLOW-2005 For more information go to http://water.usgs.gov/ogw/modflow-nwt
4 stars 7 forks source link

parse options doesn't stop if errors in options #11

Closed rniswon closed 7 years ago

rniswon commented 7 years ago

From Chris: Couple of things:

  1. The format statement 32 doesn't work as intended, because there is no integer passed to it. Suggest using:

    32 FORMAT(1X,' REACHINPUT Detected. ',

    • 'Some stream information will be read by reach. ',
    • 'This option replaces NSTRM<0')
  2. The old style approach will happily stop reading options if it finds something it doesn't understand, even a simple misspelling like REACHINPT. I don't know if this is what you want or not. In MF6 we make sure that we die if the program doesn't understand a keyword. It would be nice if this were the case for NWT also. One possible complication is that to do it right, the program would die on comments on that line, but I don't have a problem with that. One way to handle this would be to determine the header up front:

! determine the type of header (-1=error, 0=noheader, 1=old style, 2=new style) select case(line(istart:istop)) case('OPTIONS') iheader = 2 case('REACHINPUT', 'TRANSROUTE', 'TABFILES', 'LOSSFACTOR') iheader = 1 case default read(line(istart:istop),*,IOSTAT=Iostat) intchk if( Iostat == 0 ) then iheader = 0 else iheader = -1 endif end select

At this point you could then handle the -1 error condition, use the if blocks like you have them and parse new style or old style, and have the case default terminate with an unrecognized option error. For this to work with the old style, you would also want to have a call like,

if (istart == len(line)) exit

right after the call to urdcom. This way you would jump out of the loop if you reached the end of the line instead of handling it with case default. Just a thought.

  1. For the new style options, it does not appear that the END keyword is required (because of the way you do case default here; or maybe that is my mistake from the code I sent earlier?). Having case default terminate with an error would fix this.

  2. I see that the options block for the well package is now the first thing, which is good. That SPECIFY keyword has given us a lot of trouble. But now that it is an option, why use SPECIFY as the option? Why not call it PHIRAMP? Maybe use:

[PHIRAMP phiramp [IUNITRAMP iunitramp]]

This way you can set iunitramp to iout by default and only change it if someone wants to.