Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/simgrid/simgrid
[simgrid.git] / examples / smpi / NAS / LU / verify.f
1
2 c---------------------------------------------------------------------
3 c---------------------------------------------------------------------
4
5         subroutine verify(xcr, xce, xci, class, verified)
6
7 c---------------------------------------------------------------------
8 c---------------------------------------------------------------------
9
10 c---------------------------------------------------------------------
11 c  verification routine                         
12 c---------------------------------------------------------------------
13
14         implicit none
15         include 'mpinpb.h'
16         include 'applu.incl'
17
18         double precision xcr(5), xce(5), xci
19         double precision xcrref(5),xceref(5),xciref, 
20      >                   xcrdif(5),xcedif(5),xcidif,
21      >                   epsilon, dtref
22         integer m
23         character class
24         logical verified
25
26 c---------------------------------------------------------------------
27 c   tolerance level
28 c---------------------------------------------------------------------
29         epsilon = 1.0d-08
30
31         class = 'U'
32         verified = .true.
33
34         do m = 1,5
35            xcrref(m) = 1.0
36            xceref(m) = 1.0
37         end do
38         xciref = 1.0
39
40         if ( (nx0  .eq. 12     ) .and. 
41      >       (ny0  .eq. 12     ) .and.
42      >       (nz0  .eq. 12     ) .and.
43      >       (itmax   .eq. 50    ))  then
44
45            class = 'S'
46            dtref = 5.0d-1
47 c---------------------------------------------------------------------
48 c   Reference values of RMS-norms of residual, for the (12X12X12) grid,
49 c   after 50 time steps, with  DT = 5.0d-01
50 c---------------------------------------------------------------------
51          xcrref(1) = 1.6196343210976702d-02
52          xcrref(2) = 2.1976745164821318d-03
53          xcrref(3) = 1.5179927653399185d-03
54          xcrref(4) = 1.5029584435994323d-03
55          xcrref(5) = 3.4264073155896461d-02
56
57 c---------------------------------------------------------------------
58 c   Reference values of RMS-norms of solution error, for the (12X12X12) grid,
59 c   after 50 time steps, with  DT = 5.0d-01
60 c---------------------------------------------------------------------
61          xceref(1) = 6.4223319957960924d-04
62          xceref(2) = 8.4144342047347926d-05
63          xceref(3) = 5.8588269616485186d-05
64          xceref(4) = 5.8474222595157350d-05
65          xceref(5) = 1.3103347914111294d-03
66
67 c---------------------------------------------------------------------
68 c   Reference value of surface integral, for the (12X12X12) grid,
69 c   after 50 time steps, with DT = 5.0d-01
70 c---------------------------------------------------------------------
71          xciref = 7.8418928865937083d+00
72
73
74         elseif ( (nx0 .eq. 33) .and. 
75      >           (ny0 .eq. 33) .and.
76      >           (nz0 .eq. 33) .and.
77      >           (itmax . eq. 300) ) then
78
79            class = 'W'   !SPEC95fp size
80            dtref = 1.5d-3
81 c---------------------------------------------------------------------
82 c   Reference values of RMS-norms of residual, for the (33x33x33) grid,
83 c   after 300 time steps, with  DT = 1.5d-3
84 c---------------------------------------------------------------------
85            xcrref(1) =   0.1236511638192d+02
86            xcrref(2) =   0.1317228477799d+01
87            xcrref(3) =   0.2550120713095d+01
88            xcrref(4) =   0.2326187750252d+01
89            xcrref(5) =   0.2826799444189d+02
90
91
92 c---------------------------------------------------------------------
93 c   Reference values of RMS-norms of solution error, for the (33X33X33) grid,
94 c---------------------------------------------------------------------
95            xceref(1) =   0.4867877144216d+00
96            xceref(2) =   0.5064652880982d-01
97            xceref(3) =   0.9281818101960d-01
98            xceref(4) =   0.8570126542733d-01
99            xceref(5) =   0.1084277417792d+01
100
101
102 c---------------------------------------------------------------------
103 c   Reference value of surface integral, for the (33X33X33) grid,
104 c   after 300 time steps, with  DT = 1.5d-3
105 c---------------------------------------------------------------------
106            xciref    =   0.1161399311023d+02
107
108         elseif ( (nx0 .eq. 64) .and. 
109      >           (ny0 .eq. 64) .and.
110      >           (nz0 .eq. 64) .and.
111      >           (itmax . eq. 250) ) then
112
113            class = 'A'
114            dtref = 2.0d+0
115 c---------------------------------------------------------------------
116 c   Reference values of RMS-norms of residual, for the (64X64X64) grid,
117 c   after 250 time steps, with  DT = 2.0d+00
118 c---------------------------------------------------------------------
119          xcrref(1) = 7.7902107606689367d+02
120          xcrref(2) = 6.3402765259692870d+01
121          xcrref(3) = 1.9499249727292479d+02
122          xcrref(4) = 1.7845301160418537d+02
123          xcrref(5) = 1.8384760349464247d+03
124
125 c---------------------------------------------------------------------
126 c   Reference values of RMS-norms of solution error, for the (64X64X64) grid,
127 c   after 250 time steps, with  DT = 2.0d+00
128 c---------------------------------------------------------------------
129          xceref(1) = 2.9964085685471943d+01
130          xceref(2) = 2.8194576365003349d+00
131          xceref(3) = 7.3473412698774742d+00
132          xceref(4) = 6.7139225687777051d+00
133          xceref(5) = 7.0715315688392578d+01
134
135 c---------------------------------------------------------------------
136 c   Reference value of surface integral, for the (64X64X64) grid,
137 c   after 250 time steps, with DT = 2.0d+00
138 c---------------------------------------------------------------------
139          xciref = 2.6030925604886277d+01
140
141
142         elseif ( (nx0 .eq. 102) .and. 
143      >           (ny0 .eq. 102) .and.
144      >           (nz0 .eq. 102) .and.
145      >           (itmax . eq. 250) ) then
146
147            class = 'B'
148            dtref = 2.0d+0
149
150 c---------------------------------------------------------------------
151 c   Reference values of RMS-norms of residual, for the (102X102X102) grid,
152 c   after 250 time steps, with  DT = 2.0d+00
153 c---------------------------------------------------------------------
154          xcrref(1) = 3.5532672969982736d+03
155          xcrref(2) = 2.6214750795310692d+02
156          xcrref(3) = 8.8333721850952190d+02
157          xcrref(4) = 7.7812774739425265d+02
158          xcrref(5) = 7.3087969592545314d+03
159
160 c---------------------------------------------------------------------
161 c   Reference values of RMS-norms of solution error, for the (102X102X102) 
162 c   grid, after 250 time steps, with  DT = 2.0d+00
163 c---------------------------------------------------------------------
164          xceref(1) = 1.1401176380212709d+02
165          xceref(2) = 8.1098963655421574d+00
166          xceref(3) = 2.8480597317698308d+01
167          xceref(4) = 2.5905394567832939d+01
168          xceref(5) = 2.6054907504857413d+02
169
170 c---------------------------------------------------------------------
171 c   Reference value of surface integral, for the (102X102X102) grid,
172 c   after 250 time steps, with DT = 2.0d+00
173 c---------------------------------------------------------------------
174          xciref = 4.7887162703308227d+01
175
176         elseif ( (nx0 .eq. 162) .and. 
177      >           (ny0 .eq. 162) .and.
178      >           (nz0 .eq. 162) .and.
179      >           (itmax . eq. 250) ) then
180
181            class = 'C'
182            dtref = 2.0d+0
183
184 c---------------------------------------------------------------------
185 c   Reference values of RMS-norms of residual, for the (162X162X162) grid,
186 c   after 250 time steps, with  DT = 2.0d+00
187 c---------------------------------------------------------------------
188          xcrref(1) = 1.03766980323537846d+04
189          xcrref(2) = 8.92212458801008552d+02
190          xcrref(3) = 2.56238814582660871d+03
191          xcrref(4) = 2.19194343857831427d+03
192          xcrref(5) = 1.78078057261061185d+04
193
194 c---------------------------------------------------------------------
195 c   Reference values of RMS-norms of solution error, for the (162X162X162) 
196 c   grid, after 250 time steps, with  DT = 2.0d+00
197 c---------------------------------------------------------------------
198          xceref(1) = 2.15986399716949279d+02
199          xceref(2) = 1.55789559239863600d+01
200          xceref(3) = 5.41318863077207766d+01
201          xceref(4) = 4.82262643154045421d+01
202          xceref(5) = 4.55902910043250358d+02
203
204 c---------------------------------------------------------------------
205 c   Reference value of surface integral, for the (162X162X162) grid,
206 c   after 250 time steps, with DT = 2.0d+00
207 c---------------------------------------------------------------------
208          xciref = 6.66404553572181300d+01
209
210         elseif ( (nx0 .eq. 408) .and. 
211      >           (ny0 .eq. 408) .and.
212      >           (nz0 .eq. 408) .and.
213      >           (itmax . eq. 300) ) then
214
215            class = 'D'
216            dtref = 1.0d+0
217
218 c---------------------------------------------------------------------
219 c   Reference values of RMS-norms of residual, for the (408X408X408) grid,
220 c   after 300 time steps, with  DT = 1.0d+00
221 c---------------------------------------------------------------------
222          xcrref(1) = 0.4868417937025d+05
223          xcrref(2) = 0.4696371050071d+04
224          xcrref(3) = 0.1218114549776d+05 
225          xcrref(4) = 0.1033801493461d+05
226          xcrref(5) = 0.7142398413817d+05
227
228 c---------------------------------------------------------------------
229 c   Reference values of RMS-norms of solution error, for the (408X408X408) 
230 c   grid, after 300 time steps, with  DT = 1.0d+00
231 c---------------------------------------------------------------------
232          xceref(1) = 0.3752393004482d+03
233          xceref(2) = 0.3084128893659d+02
234          xceref(3) = 0.9434276905469d+02
235          xceref(4) = 0.8230686681928d+02
236          xceref(5) = 0.7002620636210d+03
237
238 c---------------------------------------------------------------------
239 c   Reference value of surface integral, for the (408X408X408) grid,
240 c   after 300 time steps, with DT = 1.0d+00
241 c---------------------------------------------------------------------
242          xciref =    0.8334101392503d+02
243
244         elseif ( (nx0 .eq. 1020) .and. 
245      >           (ny0 .eq. 1020) .and.
246      >           (nz0 .eq. 1020) .and.
247      >           (itmax . eq. 300) ) then
248
249            class = 'E'
250            dtref = 0.5d+0
251
252 c---------------------------------------------------------------------
253 c   Reference values of RMS-norms of residual, for the (1020X1020X1020) grid,
254 c   after 300 time steps, with  DT = 0.5d+00
255 c---------------------------------------------------------------------
256          xcrref(1) = 0.2099641687874d+06
257          xcrref(2) = 0.2130403143165d+05
258          xcrref(3) = 0.5319228789371d+05 
259          xcrref(4) = 0.4509761639833d+05
260          xcrref(5) = 0.2932360006590d+06
261
262 c---------------------------------------------------------------------
263 c   Reference values of RMS-norms of solution error, for the (1020X1020X1020) 
264 c   grid, after 300 time steps, with  DT = 0.5d+00
265 c---------------------------------------------------------------------
266          xceref(1) = 0.4800572578333d+03
267          xceref(2) = 0.4221993400184d+02
268          xceref(3) = 0.1210851906824d+03
269          xceref(4) = 0.1047888986770d+03
270          xceref(5) = 0.8363028257389d+03
271
272 c---------------------------------------------------------------------
273 c   Reference value of surface integral, for the (1020X1020X1020) grid,
274 c   after 300 time steps, with DT = 0.5d+00
275 c---------------------------------------------------------------------
276          xciref =    0.9512163272273d+02
277
278         else
279            verified = .FALSE.
280         endif
281
282 c---------------------------------------------------------------------
283 c    verification test for residuals if gridsize is one of 
284 c    the defined grid sizes above (class .ne. 'U')
285 c---------------------------------------------------------------------
286
287 c---------------------------------------------------------------------
288 c    Compute the difference of solution values and the known reference values.
289 c---------------------------------------------------------------------
290         do m = 1, 5
291            
292            xcrdif(m) = dabs((xcr(m)-xcrref(m))/xcrref(m)) 
293            xcedif(m) = dabs((xce(m)-xceref(m))/xceref(m))
294            
295         enddo
296         xcidif = dabs((xci - xciref)/xciref)
297
298
299 c---------------------------------------------------------------------
300 c    Output the comparison of computed results to known cases.
301 c---------------------------------------------------------------------
302
303         if (class .ne. 'U') then
304            write(*, 1990) class
305  1990      format(/, ' Verification being performed for class ', a)
306            write (*,2000) epsilon
307  2000      format(' Accuracy setting for epsilon = ', E20.13)
308            verified = (dabs(dt-dtref) .le. epsilon)
309            if (.not.verified) then  
310               class = 'U'
311               write (*,1000) dtref
312  1000         format(' DT does not match the reference value of ', 
313      >                 E15.8)
314            endif
315         else 
316            write(*, 1995)
317  1995      format(' Unknown class')
318         endif
319
320
321         if (class .ne. 'U') then
322            write (*,2001) 
323         else
324            write (*, 2005)
325         endif
326
327  2001   format(' Comparison of RMS-norms of residual')
328  2005   format(' RMS-norms of residual')
329         do m = 1, 5
330            if (class .eq. 'U') then
331               write(*, 2015) m, xcr(m)
332            else if (xcrdif(m) .le. epsilon) then
333               write (*,2011) m,xcr(m),xcrref(m),xcrdif(m)
334            else 
335               verified = .false.
336               write (*,2010) m,xcr(m),xcrref(m),xcrdif(m)
337            endif
338         enddo
339
340         if (class .ne. 'U') then
341            write (*,2002)
342         else
343            write (*,2006)
344         endif
345  2002   format(' Comparison of RMS-norms of solution error')
346  2006   format(' RMS-norms of solution error')
347         
348         do m = 1, 5
349            if (class .eq. 'U') then
350               write(*, 2015) m, xce(m)
351            else if (xcedif(m) .le. epsilon) then
352               write (*,2011) m,xce(m),xceref(m),xcedif(m)
353            else
354               verified = .false.
355               write (*,2010) m,xce(m),xceref(m),xcedif(m)
356            endif
357         enddo
358         
359  2010   format(' FAILURE: ', i2, 2x, E20.13, E20.13, E20.13)
360  2011   format('          ', i2, 2x, E20.13, E20.13, E20.13)
361  2015   format('          ', i2, 2x, E20.13)
362         
363         if (class .ne. 'U') then
364            write (*,2025)
365         else
366            write (*,2026)
367         endif
368  2025   format(' Comparison of surface integral')
369  2026   format(' Surface integral')
370
371
372         if (class .eq. 'U') then
373            write(*, 2030) xci
374         else if (xcidif .le. epsilon) then
375            write(*, 2032) xci, xciref, xcidif
376         else
377            verified = .false.
378            write(*, 2031) xci, xciref, xcidif
379         endif
380
381  2030   format('          ', 4x, E20.13)
382  2031   format(' FAILURE: ', 4x, E20.13, E20.13, E20.13)
383  2032   format('          ', 4x, E20.13, E20.13, E20.13)
384
385
386
387         if (class .eq. 'U') then
388            write(*, 2022)
389            write(*, 2023)
390  2022      format(' No reference values provided')
391  2023      format(' No verification performed')
392         else if (verified) then
393            write(*, 2020)
394  2020      format(' Verification Successful')
395         else
396            write(*, 2021)
397  2021      format(' Verification failed')
398         endif
399
400         return
401
402
403         end