1 |
C $Header: /u/gcmpack/MITgcm/pkg/streamice/streamice_get_vel_resid_err_oad.F,v 1.2 2015/03/23 14:07:16 dgoldberg Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "STREAMICE_OPTIONS.h" |
5 |
#ifdef ALLOW_AUTODIFF |
6 |
# include "AUTODIFF_OPTIONS.h" |
7 |
#endif |
8 |
|
9 |
|
10 |
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
11 |
|
12 |
CBOP |
13 |
SUBROUTINE STREAMICE_GET_VEL_RESID_ERR_OAD ( err_max, myThid ) |
14 |
C /============================================================\ |
15 |
C | SUBROUTINE | |
16 |
C | o | |
17 |
C |============================================================| |
18 |
C | | |
19 |
C \============================================================/ |
20 |
IMPLICIT NONE |
21 |
|
22 |
C === Global variables === |
23 |
#include "SIZE.h" |
24 |
#include "EEPARAMS.h" |
25 |
#include "PARAMS.h" |
26 |
#include "STREAMICE.h" |
27 |
#include "STREAMICE_CG.h" |
28 |
|
29 |
C !INPUT/OUTPUT ARGUMENTS |
30 |
_RL err_max |
31 |
INTEGER myThid |
32 |
Real*8 u_dummy (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
33 |
Real*8 v_dummy (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
34 |
_RL err_sum |
35 |
_RL err_sum_tile (nSx,nSy) |
36 |
|
37 |
#ifdef ALLOW_STREAMICE |
38 |
#if (defined (ALLOW_STREAMICE_OAD_FP)) |
39 |
|
40 |
INTEGER conv_flag, i, j, bi, bj, myIter |
41 |
|
42 |
|
43 |
INTEGER ikey_nl |
44 |
_RL err_tempu, err_tempv |
45 |
_RL max_vel, tempu, tempv, err_lastchange, cgtol |
46 |
CHARACTER*(MAX_LEN_MBUF) msgBuf |
47 |
LOGICAL isTape |
48 |
|
49 |
err_max = 0. _d 0 |
50 |
err_sum = 0. _d 0 |
51 |
|
52 |
DO bj = myByLo(myThid), myByHi(myThid) |
53 |
DO bi = myBxLo(myThid), myBxHi(myThid) |
54 |
err_sum_tile(bi,bj) = 0. _d 0 |
55 |
ENDDO |
56 |
ENDDO |
57 |
|
58 |
DO bj = myByLo(myThid), myByHi(myThid) |
59 |
DO bi = myBxLo(myThid), myBxHi(myThid) |
60 |
DO j=1-oly,sNy+oly |
61 |
DO i=1-olx,sNx+olx |
62 |
Au_SI (i,j,bi,bj) = 0. _d 0 |
63 |
Av_SI (i,j,bi,bj) = 0. _d 0 |
64 |
u_dummy (i,j,bi,bj) = u_streamice(i,j,bi,bj) |
65 |
v_dummy (i,j,bi,bj) = v_streamice(i,j,bi,bj) |
66 |
ubd_SI (i,j,bi,bj) = 0. _d 0 |
67 |
vbd_SI (i,j,bi,bj) = 0. _d 0 |
68 |
ENDDO |
69 |
ENDDO |
70 |
ENDDO |
71 |
ENDDO |
72 |
|
73 |
CALL STREAMICE_CG_BOUND_VALS( myThid, |
74 |
O ubd_SI, |
75 |
O vbd_SI) |
76 |
|
77 |
CALL STREAMICE_CG_ACTION( myThid, |
78 |
O Au_SI, |
79 |
O Av_SI, |
80 |
I U_dummy, |
81 |
I V_dummy, |
82 |
I 0, sNx+1, 0, sNy+1 ) |
83 |
|
84 |
|
85 |
DO bj = myByLo(myThid), myByHi(myThid) |
86 |
DO bi = myBxLo(myThid), myBxHi(myThid) |
87 |
DO j=1,sNy |
88 |
DO i=1,sNx |
89 |
err_tempu = 0. _d 0 |
90 |
err_tempv = 0. _d 0 |
91 |
IF (STREAMICE_umask(i,j,bi,bj).eq.1) THEN |
92 |
err_tempu = |
93 |
& ABS (Au_SI(i,j,bi,bj)+0*ubd_SI(i,j,bi,bj) - |
94 |
& taudx_SI(i,j,bi,bj)) |
95 |
ENDIF |
96 |
IF (STREAMICE_vmask(i,j,bi,bj).eq.1) THEN |
97 |
err_tempv = MAX( err_tempu, |
98 |
& ABS (Av_SI(i,j,bi,bj)+0*vbd_SI(i,j,bi,bj) - |
99 |
& taudy_SI(i,j,bi,bj))) |
100 |
ENDIF |
101 |
IF (err_tempv .ge. err_max) THEN |
102 |
err_max = err_tempv |
103 |
ENDIF |
104 |
ENDDO |
105 |
ENDDO |
106 |
ENDDO |
107 |
ENDDO |
108 |
|
109 |
|
110 |
|
111 |
CALL GLOBAL_MAX_R8 (err_max, myThid) |
112 |
|
113 |
#endif |
114 |
#endif |
115 |
RETURN |
116 |
END |