1 |
C $Header: /u/gcmpack/MITgcm/verification/bottom_ctrl_5x5/code_ad/cost_test.F,v 1.2 2007/10/09 02:36:41 jmc Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "COST_OPTIONS.h" |
5 |
|
6 |
subroutine cost_test( myThid ) |
7 |
C *==========================================================* |
8 |
C | subroutine cost_test |
9 |
C | o this routine computes the cost function for the tiles |
10 |
C | of this processor |
11 |
C *==========================================================* |
12 |
C | Notes |
13 |
C *==========================================================* |
14 |
IMPLICIT NONE |
15 |
|
16 |
C == Global variables === |
17 |
#include "SIZE.h" |
18 |
#include "EEPARAMS.h" |
19 |
#include "PARAMS.h" |
20 |
#include "DYNVARS.h" |
21 |
#include "GRID.h" |
22 |
|
23 |
#include "cost.h" |
24 |
|
25 |
C == Routine arguments == |
26 |
C myThid - Thread number for this instance of the routine. |
27 |
integer myThid |
28 |
|
29 |
#ifdef ALLOW_COST_TEST |
30 |
C == Local variables |
31 |
integer bi, bj |
32 |
integer i, j, k |
33 |
integer ig, jg |
34 |
integer itlo,ithi |
35 |
integer jtlo,jthi |
36 |
_RL vol_trans |
37 |
C-- index values at which the transport is to be calculated |
38 |
INTEGER iysecmin, iysecmax, ixsec |
39 |
PARAMETER (ixsec = 4, iysecmin = 3, iysecmax = 3) |
40 |
|
41 |
jtlo = mybylo(mythid) |
42 |
jthi = mybyhi(mythid) |
43 |
itlo = mybxlo(mythid) |
44 |
ithi = mybxhi(mythid) |
45 |
|
46 |
DO bj=jtlo,jthi |
47 |
DO bi=itlo,ithi |
48 |
vol_trans = 0. |
49 |
DO J=1,sNy |
50 |
jg = myYGlobalLo-1+(bj-1)*sNy+J |
51 |
IF ( jg .ge. iysecmin .and. jg .le. iysecmax ) THEN |
52 |
DO I=1,sNx |
53 |
ig = myXGlobalLo-1+(bi-1)*sNx+I |
54 |
IF ( ig .eq. ixsec ) THEN |
55 |
DO K=1,Nr |
56 |
IF ( maskW(I,J,K,BI,BJ) .NE. 0. ) THEN |
57 |
vol_trans = vol_trans |
58 |
& + uVel(I,J,K,BI,BJ) |
59 |
& *_hFacW(I,J,K,BI,BJ) |
60 |
& *dyG(I,J,BI,BJ)*drF(K) |
61 |
ENDIF |
62 |
ENDDO |
63 |
ENDIF |
64 |
ENDDO |
65 |
ENDIF |
66 |
ENDDO |
67 |
objf_test(bi,bj) = vol_trans*1.0e-06 |
68 |
END DO |
69 |
END DO |
70 |
CML objf_test(1,1) = vVel(3,3,1,1,1)* _hFacS(3,3,1,1,1) |
71 |
Cml iLocOut = 6 |
72 |
Cml jLocOut = 35 |
73 |
Cml kLocOut = 1 |
74 |
Cml |
75 |
Cmlce some reference temperature |
76 |
Cml thetaRef = 24.0 _d 0 |
77 |
Cml |
78 |
CmlC-- Calculate cost function on tile of this instance |
79 |
Cml do bj = jtlo,jthi |
80 |
Cml do bi = itlo,ithi |
81 |
Cml do j=1,sNy |
82 |
Cml jg = myYGlobalLo-1+(bj-1)*sNy+j |
83 |
Cml do i=1,sNx |
84 |
Cml ig = myXGlobalLo-1+(bi-1)*sNx+i |
85 |
Cml |
86 |
Cml if ((ig .eq. iLocOut) .and. (jg .eq. jLocOut)) then |
87 |
Cml write(*,'(a,3(x,i4),a,4(x,i4))') |
88 |
Cml & 'COST ',ig,jg,kLocOut,' TILE ',i,j,bi,bj |
89 |
Cml objf_test(bi,bj) = theta(i,j,kLocOut,bi,bj) |
90 |
Cml endif |
91 |
Cml |
92 |
Cml enddo |
93 |
Cml enddo |
94 |
Cml enddo |
95 |
Cml enddo |
96 |
|
97 |
#endif /* ALLOW_COST_TEST */ |
98 |
|
99 |
RETURN |
100 |
END |