1 |
jmc |
1.11 |
C $Header: /u/gcmpack/MITgcm/pkg/cost/cost_test.F,v 1.10 2012/08/10 19:36:02 jmc Exp $ |
2 |
jmc |
1.7 |
C $Name: $ |
3 |
heimbach |
1.1 |
|
4 |
jmc |
1.10 |
#include "COST_OPTIONS.h" |
5 |
heimbach |
1.1 |
|
6 |
|
|
subroutine cost_test( myThid ) |
7 |
jmc |
1.11 |
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 |
heimbach |
1.1 |
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 |
jmc |
1.11 |
integer bi, bj |
32 |
heimbach |
1.1 |
_RL thetaRef |
33 |
|
|
integer i, j, k |
34 |
|
|
integer ig, jg |
35 |
|
|
integer itlo,ithi |
36 |
|
|
integer jtlo,jthi |
37 |
|
|
|
38 |
|
|
jtlo = mybylo(mythid) |
39 |
|
|
jthi = mybyhi(mythid) |
40 |
|
|
itlo = mybxlo(mythid) |
41 |
|
|
ithi = mybxhi(mythid) |
42 |
|
|
|
43 |
heimbach |
1.6 |
if ( useCubedSphereExchange) then |
44 |
|
|
iLocOut = 7 |
45 |
|
|
jLocOut = 28 |
46 |
|
|
kLocOut = 1 |
47 |
|
|
else |
48 |
|
|
iLocOut = 80 |
49 |
|
|
jLocOut = 30 |
50 |
|
|
kLocOut = 1 |
51 |
|
|
endif |
52 |
heimbach |
1.1 |
|
53 |
|
|
ce some reference temperature |
54 |
jmc |
1.11 |
thetaRef = 24.0 _d 0 |
55 |
heimbach |
1.1 |
|
56 |
|
|
C-- Calculate mask for tracer cells (0 => land, 1 => water) |
57 |
|
|
k=1 |
58 |
|
|
|
59 |
|
|
C-- Calculate cost function on tile of this instance |
60 |
|
|
do bj = jtlo,jthi |
61 |
|
|
do bi = itlo,ithi |
62 |
|
|
do j=1,sNy |
63 |
|
|
jg = myYGlobalLo-1+(bj-1)*sNy+j |
64 |
|
|
do i=1,sNx |
65 |
|
|
ig = myXGlobalLo-1+(bi-1)*sNx+i |
66 |
|
|
|
67 |
heimbach |
1.8 |
#ifndef ALLOW_COST_TSQUARED |
68 |
heimbach |
1.1 |
if ((ig .eq. iLocOut) .and. (jg .eq. jLocOut)) then |
69 |
heimbach |
1.2 |
write(*,'(a,3(x,i4),a,4(x,i4))') |
70 |
|
|
& 'COST ',ig,jg,kLocOut,' TILE ',i,j,bi,bj |
71 |
heimbach |
1.1 |
objf_test(bi,bj) = theta(i,j,kLocOut,bi,bj) |
72 |
heimbach |
1.4 |
cph( |
73 |
|
|
print *, 'ph-cost ', ig, jg, kLocOut, |
74 |
|
|
& theta(i,j,kLocOut,bi,bj) |
75 |
|
|
cph) |
76 |
heimbach |
1.1 |
endif |
77 |
heimbach |
1.8 |
#else |
78 |
|
|
objf_test(bi,bj) = objf_test(bi,bj) + |
79 |
|
|
& theta(i,j,kLocOut,bi,bj)**2 |
80 |
|
|
#endif |
81 |
heimbach |
1.1 |
|
82 |
jmc |
1.11 |
enddo |
83 |
|
|
enddo |
84 |
|
|
enddo |
85 |
|
|
enddo |
86 |
heimbach |
1.1 |
|
87 |
jmc |
1.11 |
#endif /* ALLOW_COST_TEST */ |
88 |
heimbach |
1.1 |
|
89 |
jmc |
1.9 |
RETURN |
90 |
heimbach |
1.1 |
END |