xref: /phasta/AcuStat/src/error.f (revision 595995161822a203c8467e0e4a253d7bd7d6df32) !
1        subroutine error (routin, variab, num)
2c
3c----------------------------------------------------------------------
4c
5c This utility routine prints out the error and stops the program.
6c
7c input:
8c  routin       : name of the routine where the error occurred
9c  variab       : an 8-character error message
10c  num          : any integer number associated with the error
11c
12c Farzin Shakib, Summer 1985.
13c----------------------------------------------------------------------
14c
15        include "commonAcuStat.h"
16        include "mpif.h"
17c
18        character*8 routin, variab
19c
20        data ierchk /0/
21c
22c.... check for redundant error
23c
24        if (ierchk .eq. 1) stop
25        ierchk = 1
26
27        if(myrank.eq.master) then
28c
29c.... open file
30c
31           open (unit=ierror, file=ferror, status='unknown')
32c
33c.... print the error
34c
35           write (*,1000) title, routin, variab, num
36           if (num .ne. 0) write (ierror,1000) title, routin, variab, num
37           if (num .eq. 0) write (ierror,1000) title, routin, variab
38c
39c.... halt the process
40c
41           close (ierror)
42        endif
43
44c        WRITE(6,'(A,G14.6)') 'Life: ',death - birth
45
46        if (numpe > 1) then
47           call MPI_ABORT(MPI_COMM_WORLD)
48        endif
49
50
511000    format(' ',a80,//,
52     &         ' ****** Error occurred in routine <',a8,'>',/,
53     &          '  Error code :',a8,:,' : ',i8,//)
54        end
55