1 |
C $Header: /u/gcmpack/MITgcm/verification/global_ocean.cs32x15/code_ad/cost_test.F,v 1.1 2008/06/14 16:58:32 heimbach Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "CPP_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 | | |
13 |
C | Notes | |
14 |
C | ===== | |
15 |
C \==========================================================/ |
16 |
IMPLICIT NONE |
17 |
|
18 |
C == Global variables === |
19 |
#include "SIZE.h" |
20 |
#include "EEPARAMS.h" |
21 |
#include "PARAMS.h" |
22 |
#include "DYNVARS.h" |
23 |
#include "GRID.h" |
24 |
|
25 |
#include "cost.h" |
26 |
|
27 |
C == Routine arguments == |
28 |
C myThid - Thread number for this instance of the routine. |
29 |
integer bi, bj |
30 |
integer myThid |
31 |
|
32 |
#ifdef ALLOW_COST_TEST |
33 |
C == Local variables |
34 |
_RL thetaRef |
35 |
|
36 |
integer i, j, k |
37 |
integer ig, jg |
38 |
integer itlo,ithi |
39 |
integer jtlo,jthi |
40 |
_RL thetaLev(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,nSy) |
41 |
|
42 |
jtlo = mybylo(mythid) |
43 |
jthi = mybyhi(mythid) |
44 |
itlo = mybxlo(mythid) |
45 |
ithi = mybxhi(mythid) |
46 |
|
47 |
if ( useCubedSphereExchange) then |
48 |
iLocOut = 7 |
49 |
jLocOut = 28 |
50 |
kLocOut = 1 |
51 |
else |
52 |
iLocOut = 80 |
53 |
jLocOut = 30 |
54 |
kLocOut = 1 |
55 |
endif |
56 |
|
57 |
cph CALL READ_FLD_XYZ_RL( hydrogThetaFile, ' ', thetaLev, 0, myThid ) |
58 |
|
59 |
ce some reference temperature |
60 |
thetaRef = 24.0D0 |
61 |
|
62 |
C-- Calculate mask for tracer cells (0 => land, 1 => water) |
63 |
k=1 |
64 |
|
65 |
C-- Calculate cost function on tile of this instance |
66 |
do bj = jtlo,jthi |
67 |
do bi = itlo,ithi |
68 |
do j=1,sNy |
69 |
jg = myYGlobalLo-1+(bj-1)*sNy+j |
70 |
do i=1,sNx |
71 |
ig = myXGlobalLo-1+(bi-1)*sNx+i |
72 |
|
73 |
#ifndef ALLOW_COST_TSQUARED |
74 |
if ((ig .eq. iLocOut) .and. (jg .eq. jLocOut)) then |
75 |
write(*,'(a,3(x,i4),a,4(x,i4))') |
76 |
& 'COST ',ig,jg,kLocOut,' TILE ',i,j,bi,bj |
77 |
objf_test(bi,bj) = theta(i,j,kLocOut,bi,bj) |
78 |
cph( |
79 |
print *, 'ph-cost ', ig, jg, kLocOut, |
80 |
& theta(i,j,kLocOut,bi,bj) |
81 |
cph) |
82 |
endif |
83 |
#else |
84 |
do k=1,nr |
85 |
if (maskC(i,j,k,bi,bj).NE.0.) then |
86 |
objf_test(bi,bj) = objf_test(bi,bj) + |
87 |
& ( theta(i,j,k,bi,bj) )**2 |
88 |
endif |
89 |
enddo |
90 |
#endif |
91 |
|
92 |
end do |
93 |
end do |
94 |
end do |
95 |
end do |
96 |
|
97 |
#endif |
98 |
|
99 |
END |