Skip to content

When routing fails, exit code should not be 0 #118

@kasra-keshavarz

Description

@kasra-keshavarz

Specifically this part of the routing code:

if (exitstatus /= 0) then
if (dtmin <= mindtmin) then
write(*, '(a15, a43, f6.1)') 'route yields a ', 'negative store2 value at dtmin = mindtmin: ', mindtmin
write(*, '(a25, a50)') 'It''s likely that qo1 is ', 'so large that store2 is negative even with qo2=0.0'
write(*, '(a29, a50, a50)') &
'If this run was started from ', 'shed2flowinit utility, then try lowering the QI, ', &
'QO, and STORE ratios until this error is resolved'
write(*, *) 'Else rerun with a smaller value of dtmin'
stop

My suggestion is to change stop to stop exitstatus (uncertain about the Fortran syntax).

Technically, that if clause is executed whenever the exitstatus variable is non-zero.

This helps tracking the successful execution of the model. Current exit code (of 0) suggests model has been executed successfully, in *nix systems at least.

Also, a similar code exists here:

if (exitstatus .ne. 0) then
if (dtmin .le. mindtmin) then
write(*,'(a15,a43,f6.1)') 'route yields a ',
* 'negative store2 value at dtmin = mindtmin: ',
* mindtmin
write(*,'(a25,a50)') 'It''s likely that qo1 is ',
* 'so large that store2 is negative even with qo2=0.0'
write(*,'(a29,a50,a50)')'If this run was started from ',
* 'shed2flowinit utility, then try lowering the QI, ',
* 'QO, and STORE ratios until this error is resolved'
write(*,*) 'Else rerun with a smaller value of dtmin'
stop

I assume the latter is not executed and is legacy WATROUTE/WATFLOOD code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions