1 |
C $Header: /u/gcmpack/MITgcm_contrib/dgoldberg/code_ad_flowline/cost_test.F,v 1.1 2012/07/20 13:42:08 heimbach Exp $ |
2 |
C $Name: $ |
3 |
|
4 |
#include "STREAMICE_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 |
#ifdef ALLOW_STREAMICE |
25 |
# include "STREAMICE.h" |
26 |
#endif |
27 |
#ifdef ALLOW_COST |
28 |
#include "cost.h" |
29 |
#include "COST_OPTIONS.h" |
30 |
#endif |
31 |
|
32 |
|
33 |
C == Routine arguments == |
34 |
C myThid - Thread number for this instance of the routine. |
35 |
integer bi, bj |
36 |
integer myThid |
37 |
|
38 |
#ifdef ALLOW_COST_TEST |
39 |
C == Local variables |
40 |
_RL thetaRef, HAF |
41 |
|
42 |
integer i, j, k |
43 |
integer ig, jg |
44 |
integer itlo,ithi |
45 |
integer jtlo,jthi |
46 |
_RL i_numcells, dCdx, dCdy, dBdx, dBdy, dTdx, dTdy |
47 |
_RL utmp, vtmp, uotmp, votmp, cotmp |
48 |
INTEGER ILNBLNK |
49 |
EXTERNAL ILNBLNK |
50 |
CHARACTER*(MAX_LEN_FNAM) STREAMICExvelOptimFile |
51 |
CHARACTER*(MAX_LEN_FNAM) STREAMICEyvelOptimFile |
52 |
_RL U_obs (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
53 |
_RL V_obs (1-OLx:sNx+OLx,1-OLy:sNy+OLy,nSx,nSy) |
54 |
|
55 |
jtlo = mybylo(mythid) |
56 |
jthi = mybyhi(mythid) |
57 |
itlo = mybxlo(mythid) |
58 |
ithi = mybxhi(mythid) |
59 |
|
60 |
i_numcells = 1.0/(Nx*Ny) |
61 |
|
62 |
! STREAMICExvelOptimFile= |
63 |
! & STREAMICEvelOptimFile(1: |
64 |
! & ILNBLNK(STREAMICEvelOptimFile))//"u.bin" |
65 |
! STREAMICEyvelOptimFile= |
66 |
! & STREAMICEvelOptimFile(1: |
67 |
! & ILNBLNK(STREAMICEvelOptimFile))//"v.bin" |
68 |
|
69 |
! _BARRIER |
70 |
|
71 |
! CALL READ_FLD_XY_RS( STREAMICExvelOptimFile, ' ', |
72 |
! & U_obs, 0, myThid ) |
73 |
! CALL READ_FLD_XY_RS( STREAMICEyvelOptimFile, ' ', |
74 |
! & V_obs, 0, myThid ) |
75 |
|
76 |
C-- Calculate mask for tracer cells (0 => land, 1 => water) |
77 |
! k=1 |
78 |
|
79 |
C-- Calculate cost function on tile of this instance |
80 |
do bj = jtlo,jthi |
81 |
do bi = itlo,ithi |
82 |
do j=1,sNy |
83 |
do i=1,sNx |
84 |
|
85 |
|
86 |
if (streamice_hmask(i,j,bi,bj).eq.1.0) then |
87 |
objf_test (bi,bj) = objf_test (bi,bj) + |
88 |
& u_streamice(i,j,bi,bj)**2+v_streamice(i,j,bi,bj)**2 |
89 |
endif |
90 |
|
91 |
|
92 |
end do |
93 |
end do |
94 |
end do |
95 |
end do |
96 |
|
97 |
#endif |
98 |
|
99 |
RETURN |
100 |
END |