-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcheck_for_nans.f90
167 lines (141 loc) · 4.56 KB
/
check_for_nans.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
subroutine check_for_nans_ivelocities(cMarker)
use ModSizeGitm
use ModGITM
use GITM_planet
implicit none
character (LEN=*), intent(in) :: cMarker
integer :: iLon, iLat, iAlt, idir
logical :: IsFound
IsFound = .false.
do iLon=-1,nLons+2
do iLat=-1,nLats+2
do iAlt=-1,nAlts+2
do idir=1,3
if (isnan(iVelocity(iLon,iLat,iAlt,idir,1))) then
write(*,*) 'Nan found in ivelocity : '
write(*,*) cMarker
write(*,*) iLon,iLat,iAlt,iProc,idir
IsFound = .true.
endif
enddo
enddo
enddo
enddo
if (IsFound) call stop_gitm("Stopping...")
end subroutine check_for_nans_ivelocities
subroutine check_for_nans_ions(cMarker)
use ModSizeGitm
use ModGITM
use GITM_planet
implicit none
character (LEN=*), intent(in) :: cMarker
integer :: iLon, iLat, iAlt, iIon
logical :: IsFound
IsFound = .false.
do iLon=-1,nLons+2
do iLat=-1,nLats+2
do iAlt=-1,nAlts+2
do iIon=1,nIons
if (isnan(iDensityS(iLon,iLat,iAlt,iIon,1))) then
write(*,*) 'Nan found in iDensityS : '
write(*,*) cMarker
write(*,*) iLon,iLat,iAlt,iProc,iIon
IsFound = .true.
endif
if (iDensityS(iLon,iLat,iAlt,iIon,1) < 0.0) then
write(*,*) 'Negative density found in iDensityS : '
write(*,*) cMarker
write(*,*) iLon,iLat,iAlt,iProc,iIon
IsFound = .true.
endif
enddo
enddo
enddo
enddo
if (IsFound) call stop_gitm("Stopping...")
end subroutine check_for_nans_ions
subroutine check_for_nans_neutrals(cMarker)
use ModSizeGitm
use ModGITM
use GITM_planet
implicit none
character (LEN=*), intent(in) :: cMarker
integer :: iLon, iLat, iAlt, iNeu
logical :: IsFound
IsFound = .false.
do iLon=-1,nLons+2
do iLat=-1,nLats+2
do iAlt=-1,nAlts+2
do iNeu=1,nSpecies
if (isnan(nDensityS(iLon,iLat,iAlt,iNeu,1))) then
write(*,*) 'Nan found in nDensityS : '
write(*,*) cMarker
write(*,*) iLon,iLat,iAlt,iProc,iNeu
IsFound = .true.
endif
if (nDensityS(iLon,iLat,iAlt,iNeu,1) < 0.0) then
write(*,*) 'Negative density found in nDensityS : '
write(*,*) cMarker
write(*,*) iLon,iLat,iAlt,iProc,iNeu
IsFound = .true.
endif
enddo
enddo
enddo
enddo
if (IsFound) call stop_gitm("Stopping...")
end subroutine check_for_nans_neutrals
subroutine check_for_nans_temps(cMarker)
use ModSizeGitm
use ModGITM
use GITM_planet
implicit none
character (LEN=*), intent(in) :: cMarker
integer :: iLon, iLat, iAlt, iNeu
logical :: IsFound
IsFound = .false.
do iLon=-1,nLons+2
do iLat=-1,nLats+2
do iAlt=-1,nAlts+2
if (isnan(Temperature(iLon,iLat,iAlt,1))) then
write(*,*) 'Nan found in Temperature : '
write(*,*) cMarker
write(*,*) iLon,iLat,iAlt,iProc
IsFound = .true.
endif
if (isnan(iTemperature(iLon,iLat,iAlt,1))) then
write(*,*) 'Nan found in iTemperature : '
write(*,*) cMarker
write(*,*) iLon,iLat,iAlt,iProc
IsFound = .true.
endif
if (isnan(eTemperature(iLon,iLat,iAlt,1))) then
write(*,*) 'Nan found in eTemperature : '
write(*,*) cMarker
write(*,*) iLon,iLat,iAlt,iProc
IsFound = .true.
endif
! Check for negative Temperatures:
if (Temperature(iLon,iLat,iAlt,1)<0.0) then
write(*,*) 'Negative found in Temperature : '
write(*,*) cMarker
write(*,*) iLon,iLat,iAlt,iProc
IsFound = .true.
endif
if (iTemperature(iLon,iLat,iAlt,1)<0.0) then
write(*,*) 'Negative found in iTemperature : '
write(*,*) cMarker
write(*,*) iLon,iLat,iAlt,iProc
IsFound = .true.
endif
if (eTemperature(iLon,iLat,iAlt,1)<0.0) then
write(*,*) 'Negative found in eTemperature : '
write(*,*) cMarker
write(*,*) iLon,iLat,iAlt,iProc
IsFound = .true.
endif
enddo
enddo
enddo
if (IsFound) call stop_gitm("Stopping...")
end subroutine check_for_nans_temps