1 |
C $Header: /u/gcmpack/MITgcm/pkg/cost/cost_test.F,v 1.7 2007/10/08 23:59:21 jmc 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 |
|
41 |
jtlo = mybylo(mythid) |
42 |
jthi = mybyhi(mythid) |
43 |
itlo = mybxlo(mythid) |
44 |
ithi = mybxhi(mythid) |
45 |
|
46 |
if ( useCubedSphereExchange) then |
47 |
iLocOut = 7 |
48 |
jLocOut = 28 |
49 |
kLocOut = 1 |
50 |
else |
51 |
iLocOut = 80 |
52 |
jLocOut = 30 |
53 |
kLocOut = 1 |
54 |
endif |
55 |
|
56 |
ce some reference temperature |
57 |
thetaRef = 24.0D0 |
58 |
|
59 |
C-- Calculate mask for tracer cells (0 => land, 1 => water) |
60 |
k=1 |
61 |
|
62 |
C-- Calculate cost function on tile of this instance |
63 |
do bj = jtlo,jthi |
64 |
do bi = itlo,ithi |
65 |
do j=1,sNy |
66 |
jg = myYGlobalLo-1+(bj-1)*sNy+j |
67 |
do i=1,sNx |
68 |
ig = myXGlobalLo-1+(bi-1)*sNx+i |
69 |
|
70 |
#ifndef ALLOW_COST_TSQUARED |
71 |
if ((ig .eq. iLocOut) .and. (jg .eq. jLocOut)) then |
72 |
write(*,'(a,3(x,i4),a,4(x,i4))') |
73 |
& 'COST ',ig,jg,kLocOut,' TILE ',i,j,bi,bj |
74 |
objf_test(bi,bj) = theta(i,j,kLocOut,bi,bj) |
75 |
cph( |
76 |
print *, 'ph-cost ', ig, jg, kLocOut, |
77 |
& theta(i,j,kLocOut,bi,bj) |
78 |
cph) |
79 |
endif |
80 |
#else |
81 |
objf_test(bi,bj) = objf_test(bi,bj) + |
82 |
& theta(i,j,kLocOut,bi,bj)**2 |
83 |
#endif |
84 |
|
85 |
end do |
86 |
end do |
87 |
end do |
88 |
end do |
89 |
|
90 |
#endif |
91 |
|
92 |
END |