xref: /phasta/M2NFixBnd/src/error.f (revision 1e99f302ca5103688ae35115c2fefb7cfa6714f1)
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 "commonM2NFixBnd.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           ferror='error.log'
32           open (unit=ierror, file=ferror, status='unknown')
33c
34c.... print the error
35c
36           write (*,1000) title, routin, variab, num
37           if (num .ne. 0) write (ierror,1000) title, routin, variab,num
38           if (num .eq. 0) write (ierror,1000) title, routin, variab
39c
40c.... halt the process
41c
42           close (ierror)
43        endif
44
45c        WRITE(6,'(A,G14.6)') 'Life: ',death - birth
46
47        if (numpe > 1) then
48           call MPI_ABORT(MPI_COMM_WORLD)
49        endif
50
51
521000    format(' ',a80,//,
53     &         ' ****** Error occurred in routine <',a8,'>',/,
54     &          '  Error code :',a8,:,' : ',i8,//)
55        end
56