1 |
dimitri |
1.5 |
c $Header: /u/gcmpack/MITgcm/pkg/exf/exf_check_range.F,v 1.4 2004/11/27 15:41:50 dimitri Exp $ |
2 |
heimbach |
1.1 |
|
3 |
|
|
#include "EXF_OPTIONS.h" |
4 |
|
|
|
5 |
|
|
subroutine exf_check_range( mytime, myiter, mythid ) |
6 |
|
|
|
7 |
|
|
c ================================================================== |
8 |
|
|
c SUBROUTINE exf_check_range |
9 |
|
|
c ================================================================== |
10 |
|
|
c |
11 |
|
|
implicit none |
12 |
|
|
|
13 |
|
|
c == global variables == |
14 |
|
|
|
15 |
|
|
#include "EEPARAMS.h" |
16 |
|
|
#include "SIZE.h" |
17 |
|
|
#include "FFIELDS.h" |
18 |
|
|
#include "GRID.h" |
19 |
|
|
|
20 |
|
|
#include "exf_param.h" |
21 |
|
|
#include "exf_constants.h" |
22 |
|
|
#include "exf_fields.h" |
23 |
|
|
#include "exf_clim_fields.h" |
24 |
|
|
c == routine arguments == |
25 |
|
|
|
26 |
|
|
c mythid - thread number for this instance of the routine. |
27 |
|
|
|
28 |
|
|
integer mytime, myiter, mythid |
29 |
|
|
|
30 |
|
|
c == local variables == |
31 |
|
|
|
32 |
|
|
integer bi,bj |
33 |
|
|
integer i,j |
34 |
|
|
integer jtlo |
35 |
|
|
integer jthi |
36 |
|
|
integer itlo |
37 |
|
|
integer ithi |
38 |
|
|
integer jmin |
39 |
|
|
integer jmax |
40 |
|
|
integer imin |
41 |
|
|
integer imax |
42 |
heimbach |
1.3 |
integer exferr |
43 |
heimbach |
1.1 |
|
44 |
|
|
c == end of interface == |
45 |
|
|
|
46 |
heimbach |
1.3 |
exferr = 0 |
47 |
|
|
|
48 |
heimbach |
1.1 |
jtlo = mybylo(mythid) |
49 |
|
|
jthi = mybyhi(mythid) |
50 |
|
|
itlo = mybxlo(mythid) |
51 |
|
|
ithi = mybxhi(mythid) |
52 |
|
|
jmin = 1-oly |
53 |
|
|
jmax = sny+oly |
54 |
|
|
imin = 1-olx |
55 |
|
|
imax = snx+olx |
56 |
|
|
|
57 |
|
|
do bj = jtlo,jthi |
58 |
|
|
do bi = itlo,ithi |
59 |
|
|
|
60 |
|
|
do j = jmin,jmax |
61 |
|
|
do i = imin,imax |
62 |
|
|
c |
63 |
|
|
c Heat flux. |
64 |
heimbach |
1.2 |
if ( ABS(hflux(i,j,bi,bj)) .GT. 1000. .AND. |
65 |
heimbach |
1.3 |
& hFacC(i,j,1,bi,bj) .NE. 0. ) then |
66 |
|
|
print *, 'EXF WARNING: hflux out of range for i,j= ', |
67 |
|
|
& i, j, hflux(i,j,bi,bj) |
68 |
|
|
exferr = 1 |
69 |
|
|
endif |
70 |
heimbach |
1.1 |
c |
71 |
|
|
c Salt flux. |
72 |
heimbach |
1.2 |
if ( ABS(sflux(i,j,bi,bj)) .GT. 1.E-6 .AND. |
73 |
heimbach |
1.3 |
& hFacC(i,j,1,bi,bj) .NE. 0. ) then |
74 |
|
|
print *, 'EXF WARNING: sflux out of range for i,j= ', |
75 |
|
|
& i, j, sflux(i,j,bi,bj) |
76 |
|
|
exferr = 1 |
77 |
|
|
endif |
78 |
heimbach |
1.1 |
c |
79 |
|
|
c Zonal wind stress. |
80 |
heimbach |
1.2 |
if ( ABS(ustress(i,j,bi,bj)) .GT. 2. .AND. |
81 |
heimbach |
1.3 |
& hFacW(i,j,1,bi,bj) .NE. 0. ) then |
82 |
|
|
print *, 'EXF WARNING: ustress out of range for i,j= ', |
83 |
|
|
& i, j, ustress(i,j,bi,bj) |
84 |
|
|
exferr = 1 |
85 |
|
|
endif |
86 |
heimbach |
1.1 |
c |
87 |
|
|
c Meridional wind stress. |
88 |
heimbach |
1.2 |
if ( ABS(vstress(i,j,bi,bj)) .GT. 2. .AND. |
89 |
heimbach |
1.3 |
& hFacS(i,j,1,bi,bj) .NE. 0. ) then |
90 |
|
|
print *, 'EXF WARNING: vstress out of range for i,j= ', |
91 |
|
|
& i, j, vstress(i,j,bi,bj) |
92 |
|
|
exferr = 1 |
93 |
|
|
endif |
94 |
heimbach |
1.1 |
c |
95 |
|
|
#ifdef ALLOW_ATM_WIND |
96 |
|
|
c zonal wind speed |
97 |
heimbach |
1.3 |
if ( ABS(uwind(i,j,bi,bj)) .GT. 100. .AND. |
98 |
|
|
& hFacW(i,j,1,bi,bj) .NE. 0. ) then |
99 |
|
|
print *, 'EXF WARNING: uwind out of range for i,j= ', |
100 |
|
|
& i, j, uwind(i,j,bi,bj) |
101 |
|
|
exferr = 1 |
102 |
|
|
endif |
103 |
heimbach |
1.1 |
c |
104 |
|
|
c zonal wind speed |
105 |
heimbach |
1.3 |
if ( ABS(vwind(i,j,bi,bj)) .GT. 100. .AND. |
106 |
|
|
& hFacS(i,j,1,bi,bj) .NE. 0. ) then |
107 |
|
|
print *, 'EXF WARNING: vwind out of range for i,j= ', |
108 |
|
|
& i, j, vwind(i,j,bi,bj) |
109 |
|
|
exferr = 1 |
110 |
|
|
endif |
111 |
heimbach |
1.1 |
#endif |
112 |
|
|
|
113 |
|
|
#ifdef ALLOW_ATM_TEMP |
114 |
|
|
c 2-m air temperature |
115 |
heimbach |
1.3 |
if ( (atemp(i,j,bi,bj) .LT. 183 .OR. |
116 |
|
|
& atemp(i,j,bi,bj) .GT. 343 ) .AND. |
117 |
|
|
& hFacC(i,j,1,bi,bj) .NE. 0. ) then |
118 |
|
|
print *, 'EXF WARNING: atemp + exf_offset_atemp ', |
119 |
|
|
& 'out of range for i,j= ', |
120 |
|
|
& i, j, atemp(i,j,bi,bj) |
121 |
|
|
exferr = 1 |
122 |
|
|
endif |
123 |
heimbach |
1.1 |
c |
124 |
|
|
c 2-m specific humidity |
125 |
heimbach |
1.2 |
if ( (aqh(i,j,bi,bj) .LT. 0. .OR. |
126 |
heimbach |
1.3 |
& aqh(i,j,bi,bj) .GT. 0.1 ) .AND. |
127 |
|
|
& hFacC(i,j,1,bi,bj) .NE. 0. ) then |
128 |
|
|
print *, 'EXF WARNING: aqh out of range for i,j= ', |
129 |
|
|
& i, j, aqh(i,j,bi,bj) |
130 |
|
|
exferr = 1 |
131 |
|
|
endif |
132 |
heimbach |
1.1 |
c |
133 |
|
|
c precipitation rate |
134 |
heimbach |
1.2 |
if ( (precip(i,j,bi,bj) .LT. 0. .OR. |
135 |
heimbach |
1.3 |
& precip(i,j,bi,bj) .GT. 0.1 ) .AND. |
136 |
|
|
& hFacC(i,j,1,bi,bj) .NE. 0. ) then |
137 |
|
|
print *, 'EXF WARNING: precip out of range for i,j= ', |
138 |
|
|
& i, j, precip(i,j,bi,bj) |
139 |
|
|
exferr = 1 |
140 |
|
|
endif |
141 |
heimbach |
1.1 |
#endif |
142 |
|
|
|
143 |
|
|
#ifdef SHORTWAVE_HEATING |
144 |
|
|
c Short wave radiative flux. |
145 |
dimitri |
1.5 |
if ( (swflux(i,j,bi,bj) .GT. 1. .OR. |
146 |
heimbach |
1.3 |
& swflux(i,j,bi,bj) .LT. -500. ) .AND. |
147 |
|
|
& hFacC(i,j,1,bi,bj) .NE. 0. ) then |
148 |
|
|
print *, 'EXF WARNING: swflux out of range for i,j= ', |
149 |
|
|
& i, j, swflux(i,j,bi,bj) |
150 |
|
|
exferr = 1 |
151 |
|
|
endif |
152 |
heimbach |
1.1 |
#endif |
153 |
|
|
|
154 |
heimbach |
1.3 |
#ifdef ALLOW_RUNOFF |
155 |
dimitri |
1.4 |
c Runoff. |
156 |
heimbach |
1.3 |
if ( (runoff(i,j,bi,bj) .LT. 0. .OR. |
157 |
|
|
& runoff(i,j,bi,bj) .GT. 1.E-6 ) .AND. |
158 |
|
|
& hFacC(i,j,1,bi,bj) .NE. 0. ) then |
159 |
|
|
print *, 'EXF WARNING: runoff out of range for i,j= ', |
160 |
|
|
& i, j, runoff(i,j,bi,bj) |
161 |
dimitri |
1.4 |
print *, 'Please note that input units for runoff are' |
162 |
|
|
print *, 'm/s not m/yr. If input file is in m/yr, set' |
163 |
|
|
print *, 'exf_inscalrunoff=1.0/(86400.*365.0)' |
164 |
|
|
print *, 'in the data.exf input file.' |
165 |
heimbach |
1.3 |
exferr = 1 |
166 |
|
|
endif |
167 |
|
|
#endif |
168 |
|
|
|
169 |
|
|
if ( exferr .NE. 0 ) then |
170 |
|
|
print *, 'EXF WARNING: If you think these values are OK ' |
171 |
|
|
print *, 'EXF WARNING: then set useExfCheckRange=.FALSE.' |
172 |
|
|
STOP 'in S/R exf_check_range' |
173 |
|
|
endif |
174 |
|
|
|
175 |
heimbach |
1.1 |
enddo |
176 |
|
|
enddo |
177 |
|
|
c |
178 |
|
|
enddo |
179 |
|
|
enddo |
180 |
|
|
|
181 |
|
|
end |