-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathlibrary.f90
74 lines (54 loc) · 1.74 KB
/
library.f90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
!---------------------------------------------------------------------------
!
!---------------------------------------------------------------------------
subroutine report(str, iLevel)
use ModInputs, only : iDebugLevel
implicit none
character (len=*), intent(in) :: str
integer, intent(in) :: iLevel
character (len = 11) :: cArrow
integer :: i
if (iDebugLevel < iLevel .or. iDebugLevel > 10) return
do i=1,iLevel
cArrow(i:i) = "="
enddo
cArrow(iLevel+1:iLevel+1) = ">"
write(*,*) cArrow(1:iLevel+1), " ",str
end subroutine report
!---------------------------------------------------------------------------
!
!---------------------------------------------------------------------------
subroutine stop_gitm(str)
use ModGITM
use ModInputs, only: IsFramework
use ModMpi
use ModUtilities, ONLY: CON_stop
implicit none
character (len=*), intent(in) :: str
integer :: ierror, erno
if (IsFramework) then
call CON_stop("UA/GITM Error: "//str)
else
write(*,*)'Stopping execution! iProc=',iProc,' with msg=',str
call MPI_abort(iCommGITM, erno, ierror)
stop
endif
end subroutine stop_gitm
!---------------------------------------------------------------------------
!
!---------------------------------------------------------------------------
subroutine i2s(iValue, cOut, iLength)
integer, intent(in) :: iValue, iLength
character (len=*), intent(out) :: cOut
character (len=10) :: cFormat
integer :: i
if (iLength < 10) then
write(cFormat,"('(I',I1,')')") iLength
else
write(cFormat,"('(I',I2,')')") iLength
endif
write(cOut, cFormat) iValue
do i=1, iLength
if (cOut(i:i) == ' ') cOut(i:i) = '0'
enddo
end subroutine i2s