1 |
jmc |
1.7 |
C $Header: $ |
2 |
|
|
C $Name: $ |
3 |
heimbach |
1.1 |
|
4 |
|
|
#include "COST_CPPOPTIONS.h" |
5 |
|
|
|
6 |
|
|
subroutine cost_atlantic_heat( myThid ) |
7 |
|
|
C /==========================================================\ |
8 |
|
|
C | subroutine cost_atlantic_heat | |
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 |
|
|
#include "cost.h" |
22 |
|
|
|
23 |
|
|
C ======== Routine arguments ====================== |
24 |
|
|
C myThid - Thread number for this instance of the routine. |
25 |
|
|
integer myThid |
26 |
|
|
|
27 |
|
|
#ifdef ALLOW_COST_ATLANTIC_HEAT |
28 |
|
|
C ========= Local variables ========================= |
29 |
|
|
integer isecbeg , isecend , jsec |
30 |
heimbach |
1.4 |
integer jsecbeg , jsecend , isec |
31 |
heimbach |
1.1 |
integer kmaxdepth |
32 |
|
|
integer i, j, k |
33 |
|
|
integer ig, jg |
34 |
|
|
integer bi, bj |
35 |
|
|
_RL locfc |
36 |
heimbach |
1.6 |
_RL uVel_bar(Nr), vVel_bar(Nr), theta_bar(Nr) |
37 |
|
|
_RL thetaUvel_bar(Nr), thetaVvel_bar(Nr) |
38 |
heimbach |
1.4 |
_RL countU(Nr), countV(Nr), countT(Nr) |
39 |
heimbach |
1.6 |
_RL countTU(Nr), countTV(Nr) |
40 |
heimbach |
1.1 |
_RL petawatt |
41 |
|
|
_RL sum |
42 |
|
|
parameter( petawatt = 1.e+15 ) |
43 |
|
|
|
44 |
|
|
C 80W - 0W at 24N |
45 |
heimbach |
1.4 |
parameter( isecbeg = 69, isecend = 87, jsec = 28 ) |
46 |
|
|
cph parameter( isecbeg = 70, isecend = 90, jsec = 30 ) |
47 |
|
|
parameter( jsecbeg = 10, jsecend = 27, isec = 59 ) |
48 |
|
|
parameter ( kmaxdepth = 5 ) |
49 |
heimbach |
1.1 |
C 80W - 0W at 48N |
50 |
|
|
C parameter( isecbeg = 70, isecend = 90, jsec = 33 ) |
51 |
|
|
C parameter ( kmaxdepth = 14 ) |
52 |
|
|
|
53 |
|
|
|
54 |
|
|
|
55 |
|
|
C------------------------------------------------------ |
56 |
|
|
C Accumulate meridionally integrated transports |
57 |
|
|
C Note bar(V)*bar(T) not bar(VT) |
58 |
mlosch |
1.3 |
C Attention pYFaceA [m^2*gravity*rhoConst] |
59 |
heimbach |
1.1 |
C------------------------------------------------------ |
60 |
|
|
|
61 |
|
|
DO bj=myByLo(myThid),myByHi(myThid) |
62 |
|
|
DO bi=myBxLo(myThid),myBxHi(myThid) |
63 |
|
|
|
64 |
|
|
locfc = 0.0 |
65 |
heimbach |
1.2 |
sum = 0.0 |
66 |
|
|
|
67 |
heimbach |
1.4 |
#define MERID_TRANSPORT |
68 |
|
|
|
69 |
|
|
#ifdef MERID_TRANSPORT |
70 |
heimbach |
1.1 |
|
71 |
|
|
#undef ENERGYNORM |
72 |
|
|
#ifdef ENERGYNORM |
73 |
|
|
|
74 |
|
|
do i=1,sNx |
75 |
|
|
ig = myXGlobalLo-1+(bi-1)*sNx+i |
76 |
|
|
if ((ig .ge. isecbeg) .and. (ig .le. isecend)) then |
77 |
|
|
sum = 0.0 |
78 |
|
|
do k = 1, kmaxdepth |
79 |
|
|
sum = sum |
80 |
|
|
& + (vVel(i,j,k,bi,bj) * maskS(i,j,k,bi,bj) |
81 |
|
|
& * drF(k))**2 |
82 |
|
|
end do |
83 |
|
|
locfc = locfc + sum*dxG(i,j,bi,bj) |
84 |
|
|
end if |
85 |
|
|
end do |
86 |
|
|
|
87 |
|
|
#else |
88 |
|
|
|
89 |
heimbach |
1.4 |
do j=1,sNy |
90 |
|
|
jg = myYGlobalLo-1+(bj-1)*sNy+j |
91 |
|
|
if (jg .eq. jsec) then |
92 |
|
|
|
93 |
heimbach |
1.1 |
do k = 1, Nr |
94 |
|
|
vVel_bar(k) = 0.0 |
95 |
heimbach |
1.6 |
thetaVvel_bar(k) = 0.0 |
96 |
heimbach |
1.2 |
countV(k) = 0.0 |
97 |
heimbach |
1.6 |
countTV(k) = 0.0 |
98 |
heimbach |
1.1 |
do i=1,sNx |
99 |
|
|
ig = myXGlobalLo-1+(bi-1)*sNx+i |
100 |
heimbach |
1.2 |
c |
101 |
heimbach |
1.1 |
if ((ig .ge. isecbeg) .and. (ig .le. isecend)) then |
102 |
jmc |
1.7 |
vVel_bar(k) = vVel_bar(k) |
103 |
heimbach |
1.6 |
& + cMeanVVel(i,j,k,bi,bj)*maskS(i,j,k,bi,bj) |
104 |
|
|
|
105 |
|
|
thetaVvel_bar(k) = thetaVvel_bar(k) |
106 |
|
|
& + cMeanThetaVVel(i,j,k,bi,bj)*dxG(i,j,bi,bj) |
107 |
|
|
& *maskS(i,j,k,bi,bj)*maskC(i,j,k,bi,bj) |
108 |
|
|
|
109 |
jmc |
1.7 |
countTV(k) = countTV(k) + |
110 |
heimbach |
1.6 |
& maskS(i,j,k,bi,bj)*maskC(i,j,k,bi,bj) |
111 |
jmc |
1.7 |
countV(k) = countV(k) + |
112 |
heimbach |
1.6 |
& maskS(i,j,k,bi,bj) |
113 |
heimbach |
1.1 |
end if |
114 |
heimbach |
1.2 |
|
115 |
heimbach |
1.1 |
enddo |
116 |
|
|
enddo |
117 |
heimbach |
1.2 |
c |
118 |
|
|
do k = 1, Nr |
119 |
heimbach |
1.6 |
#ifdef ALLOW_COST_ATLANTIC_HEAT_DOMASS |
120 |
|
|
if ( k .LE. kmaxdepth .AND. countV(k) .NE. 0) then |
121 |
|
|
sum = sum |
122 |
|
|
& + vVel_bar(k)*drF(k)/countV(k) |
123 |
|
|
end if |
124 |
|
|
#else |
125 |
|
|
if ( k .LE. kmaxdepth .AND. countTV(k) .NE. 0) then |
126 |
heimbach |
1.2 |
sum = sum |
127 |
heimbach |
1.6 |
& + thetaVVel_bar(k)*drF(k)/countTV(k) |
128 |
heimbach |
1.2 |
end if |
129 |
heimbach |
1.6 |
#endif |
130 |
heimbach |
1.1 |
end do |
131 |
|
|
|
132 |
heimbach |
1.4 |
#endif /* ENERGYNORM */ |
133 |
|
|
|
134 |
|
|
#else |
135 |
|
|
|
136 |
jmc |
1.7 |
cph need to change this part to go from |
137 |
heimbach |
1.6 |
cph \bar{u}*\bar{T} to \bar{u*T} |
138 |
|
|
cph (required store dir. are now in place) |
139 |
|
|
|
140 |
heimbach |
1.4 |
do i=1,sNx |
141 |
|
|
ig = myXGlobalLo-1+(bi-1)*sNx+i |
142 |
|
|
if (ig .eq. isec) then |
143 |
|
|
|
144 |
|
|
do k = 1, Nr |
145 |
|
|
uVel_bar(k) = 0.0 |
146 |
|
|
theta_bar(k) = 0.0 |
147 |
|
|
countT(k) = 0.0 |
148 |
|
|
countU(k) = 0.0 |
149 |
|
|
do j=1,sNy |
150 |
|
|
jg = myYGlobalLo-1+(bj-1)*sNy+j |
151 |
|
|
c |
152 |
|
|
if ((jg .ge. jsecbeg) .and. (jg .le. jsecend)) then |
153 |
|
|
uVel_bar(k) = uVel_bar(k) |
154 |
|
|
& + cMeanUVel(i,j,k,bi,bj) |
155 |
|
|
& *maskW(i,j,k,bi,bj) |
156 |
|
|
& *maskC(i,j,k,bi,bj)*maskC(i-1,j,k,bi,bj) |
157 |
|
|
theta_bar(k) = theta_bar(k) + |
158 |
|
|
& 0.5*( cMeanTheta(i,j,k,bi,bj) |
159 |
|
|
& +cMeanTheta(i-,j,k,bi,bj) ) |
160 |
|
|
& *maskW(i,j,k,bi,bj)*dyG(i,j,bi,bj) |
161 |
|
|
& *maskC(i,j,k,bi,bj)*maskC(i-1,j,k,bi,bj) |
162 |
|
|
countT(k) = countT(k) + maskW(i,j,k,bi,bj) |
163 |
|
|
& *maskC(i,j,k,bi,bj)*maskC(i-1,j,k,bi,bj) |
164 |
|
|
countU(k) = countU(k) + maskW(i,j,k,bi,bj) |
165 |
|
|
& *maskC(i,j,k,bi,bj)*maskC(i-1,j,k,bi,bj) |
166 |
|
|
end if |
167 |
|
|
|
168 |
|
|
enddo |
169 |
|
|
enddo |
170 |
|
|
c |
171 |
|
|
do k = 1, Nr |
172 |
|
|
if ( k .LE. kmaxdepth .AND. |
173 |
|
|
& countT(k) .NE. 0 .AND. countU(k) .NE. 0) then |
174 |
|
|
sum = sum |
175 |
|
|
& + uVel_bar(k) * theta_bar(k) * drF(k) |
176 |
|
|
& / ( countT(k) * countU(k) ) |
177 |
|
|
end if |
178 |
|
|
end do |
179 |
|
|
|
180 |
heimbach |
1.1 |
#endif |
181 |
|
|
|
182 |
|
|
end if |
183 |
|
|
end do |
184 |
|
|
|
185 |
heimbach |
1.6 |
#ifdef ALLOW_COST_ATLANTIC_HEAT_DOMASS |
186 |
jmc |
1.7 |
objf_atl(bi,bj) = |
187 |
heimbach |
1.6 |
& sum*1.E-6 |
188 |
|
|
#else |
189 |
jmc |
1.7 |
objf_atl(bi,bj) = |
190 |
heimbach |
1.4 |
& sum*HeatCapacity_Cp*rhoConst/petawatt |
191 |
heimbach |
1.6 |
#endif |
192 |
heimbach |
1.1 |
|
193 |
|
|
c-- end of bi,bj loop |
194 |
|
|
end do |
195 |
|
|
end do |
196 |
|
|
|
197 |
|
|
#endif |
198 |
jmc |
1.7 |
|
199 |
heimbach |
1.1 |
end |