1 |
jmc |
1.5 |
C $Header: /u/gcmpack/MITgcm/pkg/cost/cost_vector.F,v 1.4 2007/10/08 23:59:21 jmc Exp $ |
2 |
jmc |
1.4 |
C $Name: $ |
3 |
heimbach |
1.1 |
|
4 |
jmc |
1.5 |
#include "COST_OPTIONS.h" |
5 |
heimbach |
1.1 |
|
6 |
|
|
subroutine cost_vector( myThid ) |
7 |
|
|
C /==========================================================\ |
8 |
|
|
C | subroutine cost_vector | |
9 |
|
|
C | o This routine computes the meridional heat transport. | |
10 |
|
|
C | The current indices are for North Atlantic 29N | |
11 |
|
|
C | 2x2 global setup. | |
12 |
|
|
C \==========================================================/ |
13 |
|
|
implicit none |
14 |
|
|
|
15 |
|
|
C == Global variables === |
16 |
|
|
#include "SIZE.h" |
17 |
|
|
#include "EEPARAMS.h" |
18 |
|
|
#include "PARAMS.h" |
19 |
|
|
#include "GRID.h" |
20 |
|
|
#include "DYNVARS.h" |
21 |
|
|
|
22 |
|
|
#include "cost.h" |
23 |
|
|
|
24 |
|
|
C ======== Routine arguments ====================== |
25 |
|
|
C myThid - Thread number for this instance of the routine. |
26 |
|
|
integer myThid |
27 |
|
|
|
28 |
|
|
#ifdef ALLOW_COST_VECTOR |
29 |
|
|
C ========= Local variables ========================= |
30 |
|
|
integer isecbeg , isecend , jsec |
31 |
|
|
integer kmaxdepth |
32 |
|
|
integer i, j, k |
33 |
|
|
integer ig, jg |
34 |
|
|
integer bi, bj |
35 |
|
|
_RL locfc |
36 |
|
|
_RL vVel_bar(Nr), theta_bar(Nr), count(Nr) |
37 |
|
|
_RL petawatt |
38 |
|
|
_RL sum |
39 |
|
|
parameter( petawatt = 1.e+15 ) |
40 |
|
|
|
41 |
|
|
C 80W - 0W at 24N |
42 |
|
|
parameter( isecbeg = 70, isecend = 90, jsec = 27 ) |
43 |
|
|
parameter ( kmaxdepth = 15 ) |
44 |
|
|
C 80W - 0W at 48N |
45 |
|
|
C parameter( isecbeg = 70, isecend = 90, jsec = 33 ) |
46 |
|
|
C parameter ( kmaxdepth = 14 ) |
47 |
|
|
|
48 |
|
|
|
49 |
|
|
|
50 |
|
|
C------------------------------------------------------ |
51 |
|
|
C Accumulate meridionally integrated transports |
52 |
|
|
C Note bar(V)*bar(T) not bar(VT) |
53 |
mlosch |
1.2 |
C Attention pYFaceA [m^2*gravity*rhoConst] |
54 |
heimbach |
1.1 |
C------------------------------------------------------ |
55 |
|
|
|
56 |
|
|
DO bj=myByLo(myThid),myByHi(myThid) |
57 |
|
|
DO bi=myBxLo(myThid),myBxHi(myThid) |
58 |
|
|
|
59 |
|
|
locfc = 0.0 |
60 |
|
|
do j=1,sNy |
61 |
|
|
jg = myYGlobalLo-1+(bj-1)*sNy+j |
62 |
|
|
if (jg .eq. jsec) then |
63 |
|
|
|
64 |
|
|
do i=1,sNx |
65 |
|
|
ig = myXGlobalLo-1+(bi-1)*sNx+i |
66 |
|
|
if ((ig .ge. isecbeg) .and. (ig .le. isecend)) then |
67 |
|
|
sum = 0. _d 0 |
68 |
|
|
do k = 1, kmaxdepth |
69 |
|
|
sum = sum |
70 |
|
|
& + vVel(i,j,k,bi,bj) * maskS(i,j,k,bi,bj) |
71 |
|
|
& * drF(k) |
72 |
|
|
C & * 0.5*(theta(i,j,k,bi,bj)+theta(i,j-1,k,bi,bj)) |
73 |
|
|
end do |
74 |
|
|
objf_vector(i,bi,bj) = sum*dxG(i,j,bi,bj) |
75 |
|
|
end if |
76 |
|
|
end do |
77 |
|
|
|
78 |
|
|
end if |
79 |
|
|
end do |
80 |
|
|
|
81 |
heimbach |
1.3 |
do i = 1,sNx |
82 |
|
|
print*,' --> objf_vector(i,bi,bj) = ', |
83 |
|
|
& objf_vector(i,bi,bj) |
84 |
|
|
end do |
85 |
|
|
|
86 |
heimbach |
1.1 |
END DO |
87 |
|
|
END DO |
88 |
|
|
|
89 |
|
|
#endif |
90 |
jmc |
1.4 |
|
91 |
heimbach |
1.1 |
end |