1 | subroutine ibr_1 |
---|
2 | #define DEBUG_LEVEL 1 |
---|
3 | ! Routine to calculate the Inertia, Buoyancy, Rotation terms of |
---|
4 | ! xi momentum equation, ignoring the pressure and dissipation terms |
---|
5 | ! |
---|
6 | ! inputs: |
---|
7 | ! U,v,W contravariant velocities (x,z) and horizontal velocity (y) |
---|
8 | ! GM_uu the grid metric term in front of the U^2 term |
---|
9 | ! GM_uw the grid metric term in front of the U*W term |
---|
10 | ! GM_ww the grid metric term in front of the W^2 term |
---|
11 | ! pd perturbation density |
---|
12 | ! Rot the inverse Rossby number U/fL |
---|
13 | ! Ri the Richardson number (N2*L^2)/U^2 |
---|
14 | ! nx,ny,locnz size of fields |
---|
15 | ! dxi,deta,dzeta regular grid spacings on the computational mesh |
---|
16 | ! work work array of at least (6*nx*ny*locnz,3*nx*ny*locnz) |
---|
17 | ! for evaluation of DNS terms, no evaluation of DNS terms |
---|
18 | ! x_zeta derivative of cartesion x wrt grid coordinate zeta |
---|
19 | ! y_eta derivative of cartesian y wrt coordinate eta |
---|
20 | ! z_zeta derivative of cartesion z wrt grid coordinate zeta |
---|
21 | ! det_J determinant of transformation matrix |
---|
22 | ! BC_flag - derivative conditions and end values |
---|
23 | ! |
---|
24 | ! output: |
---|
25 | ! rhs1 an (nx,ny,locnz) array such that dU/dt = rhs - pressure term |
---|
26 | ! |
---|
27 | |
---|
28 | use mpi_parameters |
---|
29 | use grid_info |
---|
30 | use dependent_variables |
---|
31 | use pde_parameters |
---|
32 | use rhs_variables |
---|
33 | use intermediate_variables |
---|
34 | use boundary_information |
---|
35 | use counters_flags_etc |
---|
36 | use dimensional_scales |
---|
37 | use user_parameters |
---|
38 | |
---|
39 | implicit none |
---|
40 | include '../input/problem_size.h' |
---|
41 | |
---|
42 | integer :: flag |
---|
43 | integer :: ii,jj,kk |
---|
44 | real :: end_values(2),h |
---|
45 | real, dimension(:,:,:,:), allocatable :: work |
---|
46 | allocate ( work(nx,ny,locnz,3) ) |
---|
47 | work(:,:,:,:) = 0. |
---|
48 | |
---|
49 | #if DEBUG_LEVEL >= 1 |
---|
50 | if(myid==0)write(0,*) 'hello world from ibr_1, Rot=',Rot |
---|
51 | #endif |
---|
52 | |
---|
53 | !Calculate dU/dxi, dU/dy dU/dzeta and store in work arrays 1,2,3 |
---|
54 | flag=BC_flag(1,1) |
---|
55 | h=Grid(0)%dxi |
---|
56 | !!! write(0,*) 'call compact_ddx, myid = ', myid |
---|
57 | call compact_ddx(U,work(1,1,1,1),flag,end_values,nx,ny,locnz) |
---|
58 | |
---|
59 | flag=BC_flag(1,2) |
---|
60 | h=Grid(0)%deta |
---|
61 | !!! write(0,*) 'call compact_ddy, myid = ', myid |
---|
62 | call compact_ddy(U,work(1,1,1,2),flag,end_values,nx,ny,locnz) |
---|
63 | |
---|
64 | do j=1,ny |
---|
65 | work(:,j,:,2)=work(:,j,:,2)/Grid(0)%y_eta(j) |
---|
66 | enddo |
---|
67 | |
---|
68 | flag=BC_flag(1,3) |
---|
69 | h=Grid(0)%dzeta |
---|
70 | !!! write(0,*) 'call compact_ddz, myid = ', myid |
---|
71 | call compact_ddz_mpi(U,work(1,1,1,3),flag,end_values,nx,ny,locnz) |
---|
72 | |
---|
73 | ! Add up the advective terms |
---|
74 | !!! write(0,*) 'at ADD 1, myid = ', myid |
---|
75 | !!! do kk=1,locnz |
---|
76 | !!! do jj=1,ny |
---|
77 | !!! do ii=1,nx |
---|
78 | !!! work(ii,jj,kk,1) = 0. |
---|
79 | !!! work(ii,jj,kk,2) = 0. |
---|
80 | !!! work(ii,jj,kk,3) = 0. |
---|
81 | !!! U(ii,jj,kk) = 0. |
---|
82 | !!! V(ii,jj,kk) = 0. |
---|
83 | !!! W(ii,jj,kk) = 0. |
---|
84 | !!! if(work(ii,jj,kk,3) .lt. 0.) work(ii,jj,kk,3) = 0. |
---|
85 | !!! if(ii.ge.257) then |
---|
86 | !!! write(0,*) 'MYID',myid,' II,JJ,KK,WORK = ',ii,jj,kk,work(ii,jj,kk,1),work(ii,jj,kk,2),work(ii,jj,kk,3) |
---|
87 | !!! endif |
---|
88 | !!! rhs1(ii,jj,kk,MM0) = -(work(ii,jj,kk,1) * U(ii,jj,kk) + & |
---|
89 | !!! work(ii,jj,kk,2) * V(ii,jj,kk) + & |
---|
90 | !!! work(ii,jj,kk,3) * W(ii,jj,kk) ) |
---|
91 | !!! enddo |
---|
92 | !!! enddo |
---|
93 | !!! enddo |
---|
94 | rhs1(:,:,:,MM0) = -( work(:,:,:,1)*U + work(:,:,:,2)*V + work(:,:,:,3)*W ) |
---|
95 | |
---|
96 | ! Add in the terms due to grid transformation |
---|
97 | !!! write(0,*) 'at ADD 2, myid = ', myid |
---|
98 | do j=1,ny |
---|
99 | rhs1(1:nx,j,1:locnz,MM0) = & |
---|
100 | rhs1(1:nx,j,1:locnz,MM0) - & |
---|
101 | ( GM_uu(1:nx,1:locnz,1)*U(1:nx,j,1:locnz)*U(1:nx,j,1:locnz) & |
---|
102 | + GM_uw(1:nx,1:locnz,1)*U(1:nx,j,1:locnz)*W(1:nx,j,1:locnz) & |
---|
103 | + GM_ww(1:nx,1:locnz,1)*W(1:nx,j,1:locnz)*W(1:nx,j,1:locnz) ) |
---|
104 | enddo |
---|
105 | |
---|
106 | ! Add on the buoyancy and rotation terms |
---|
107 | !!! write(0,*) 'at ADD 3, myid = ', myid |
---|
108 | !! do j=1,ny |
---|
109 | !! rhs1(1:nx,j,1:locnz,MM0) = & |
---|
110 | !! rhs1(1:nx,j,1:locnz,MM0) & |
---|
111 | !!+ Grid(0)%x_zeta(1:nx,1:locnz)*Ri*pd(1:nx,j,1:locnz)/Grid(0)%det_J(1:nx,1:locnz) & |
---|
112 | !!+ Grid(0)%z_zeta(1:nx,1:locnz)*Rot*v(1:nx,j,1:locnz)/Grid(0)%det_J(1:nx,1:locnz) |
---|
113 | !! enddo |
---|
114 | do j=1,ny |
---|
115 | rhs1(1:nx,j,1:locnz,MM0) = rhs1(1:nx,j,1:locnz,MM0) & |
---|
116 | + Ri * pd(1:nx,j,1:locnz) * Grid(0)%x_zeta(1:nx,1:locnz)/Grid(0)%det_J(1:nx,1:locnz) & |
---|
117 | + (Rot + beta_window(j) ) * v(1:nx,j,1:locnz) * Grid(0)%z_zeta(1:nx,1:locnz)/Grid(0)%det_J(1:nx,1:locnz) |
---|
118 | enddo |
---|
119 | |
---|
120 | print*,'beta: max=',maxval(Rot+beta_window(:)) |
---|
121 | |
---|
122 | deallocate( work ) |
---|
123 | end subroutine ibr_1 |
---|
124 | |
---|
125 | subroutine ibr_2 |
---|
126 | #define DEBUG_LEVEL 1 |
---|
127 | ! Routine to calculate the Inertia, Buoyancy, Rotation terms of |
---|
128 | ! eta momentum equation, ignoring the pressure and dissipation terms |
---|
129 | ! |
---|
130 | ! inputs: |
---|
131 | ! U,v,W contravariant velocities (x,z) and horizontal velocity (y) |
---|
132 | ! GM_uu the grid metric term in front of the U^2 term |
---|
133 | ! GM_uw the grid metric term in front of the U*W term |
---|
134 | ! GM_ww the grid metric term in front of the W^2 term |
---|
135 | ! Rot the inverse Rossby number U/fL |
---|
136 | ! Ri the Richardson number (N2*L^2)/U^2 |
---|
137 | ! nx,ny,locnz size of fields |
---|
138 | ! dxi,deta,dzeta regular grid spacings on the computational mesh |
---|
139 | ! work work array of at least (6*nx*ny*locnz,3*nx*ny*locnz) |
---|
140 | ! for evaluation of DNS terms, no evaluation of DNS terms |
---|
141 | ! x_zeta derivative of cartesion x wrt grid coordinate zeta |
---|
142 | ! y_eta derivative of cartesian y wrt coordinate eta |
---|
143 | ! z_zeta derivative of cartesion z wrt grid coordinate zeta |
---|
144 | ! det_J determinant of transformation matrix |
---|
145 | ! BC_flag - derivative conditions and end values |
---|
146 | ! |
---|
147 | ! output: |
---|
148 | ! rhs2 an (nx,ny,locnz) array such that dv/dt = rhs - pressure term |
---|
149 | ! |
---|
150 | |
---|
151 | use mpi_parameters |
---|
152 | use grid_info |
---|
153 | use dependent_variables |
---|
154 | use intermediate_variables |
---|
155 | use pde_parameters |
---|
156 | use user_parameters |
---|
157 | use rhs_variables |
---|
158 | use boundary_information |
---|
159 | use counters_flags_etc |
---|
160 | use dimensional_scales |
---|
161 | |
---|
162 | implicit none |
---|
163 | include '../input/problem_size.h' |
---|
164 | |
---|
165 | integer :: flag |
---|
166 | real :: end_values(2),h |
---|
167 | real, dimension(:,:,:,:), allocatable :: work |
---|
168 | allocate ( work(nx,ny,locnz,3) ) |
---|
169 | work(:,:,:,:) = 0. |
---|
170 | |
---|
171 | #if DEBUG_LEVEL >= 1 |
---|
172 | if(myid==0) write(0,*) 'hello world from ibr_2' |
---|
173 | #endif |
---|
174 | |
---|
175 | !Calculate dv/dxi, dv/dy dv/dzeta and store in work arrays 1,2,3 |
---|
176 | flag=BC_flag(1,1) |
---|
177 | h=Grid(0)%dxi |
---|
178 | call compact_ddx(v,work(1,1,1,1),flag,end_values,nx,ny,locnz) |
---|
179 | |
---|
180 | flag=BC_flag(1,2) |
---|
181 | h=Grid(0)%deta |
---|
182 | call compact_ddy(v,work(1,1,1,2),flag,end_values,nx,ny,locnz) |
---|
183 | do j=1,ny |
---|
184 | work(:,j,:,2)=work(:,j,:,2)/Grid(0)%y_eta(j) |
---|
185 | enddo |
---|
186 | |
---|
187 | flag=BC_flag(1,3) |
---|
188 | h=Grid(0)%dzeta |
---|
189 | call compact_ddz_mpi(v,work(1,1,1,3),flag,end_values,nx,ny,locnz) |
---|
190 | |
---|
191 | ! Add up the advective terms |
---|
192 | rhs2(:,:,:,MM0) = -( work(:,:,:,1)*U + work(:,:,:,2)*V + work(:,:,:,3)*W ) |
---|
193 | |
---|
194 | ! Add on the buoyancy and rotation terms |
---|
195 | !!! xlv ajout effet beta |
---|
196 | !! do j=1,ny |
---|
197 | !! rhs2(1:nx,j,1:locnz,MM0) = rhs2(1:nx,j,1:locnz,MM0) & |
---|
198 | !! -Rot*( Grid(0)%x_xi(1:nx,1:locnz)*U(1:nx,j,1:locnz) + & |
---|
199 | !! Grid(0)%x_zeta(1:nx,1:locnz)*W(1:nx,j,1:locnz) ) |
---|
200 | !! enddo |
---|
201 | do j=1,ny |
---|
202 | rhs2(1:nx,j,1:locnz,MM0) = rhs2(1:nx,j,1:locnz,MM0) & |
---|
203 | -( Rot + beta_window(j) ) *( Grid(0)%x_xi(1:nx,1:locnz)*U(1:nx,j,1:locnz) & |
---|
204 | + Grid(0)%x_zeta(1:nx,1:locnz)*W(1:nx,j,1:locnz) ) |
---|
205 | enddo |
---|
206 | |
---|
207 | |
---|
208 | print*,'beta: max=',maxval(Rot+beta_window(:)) |
---|
209 | |
---|
210 | |
---|
211 | deallocate( work ) |
---|
212 | end subroutine ibr_2 |
---|
213 | |
---|
214 | subroutine ibr_3 |
---|
215 | #define DEBUG_LEVEL 1 |
---|
216 | ! Routine to calculate the Inertia, Buoyancy, Rotation terms of |
---|
217 | ! zeta momentum equation, ignoring the pressure and dissipation terms |
---|
218 | ! |
---|
219 | ! inputs: |
---|
220 | ! U,v,W contravariant velocities (x,z) and horizontal velocity (y) |
---|
221 | ! GM_uu the grid metric term in front of the U^2 term |
---|
222 | ! GM_uw the grid metric term in front of the U*W term |
---|
223 | ! GM_ww the grid metric term in front of the W^2 term |
---|
224 | ! pd perturbation density |
---|
225 | ! Rot the inverse Rossby number U/fL |
---|
226 | ! Ri the Richardson number (N2*L^2)/U^2 |
---|
227 | ! nx,ny,locnz size of fields |
---|
228 | ! dxi,deta,dzeta regular grid spacings on the computational mesh |
---|
229 | ! work work array of at least (6*nx*ny*locnz,3*nx*ny*locnz) |
---|
230 | ! for evaluation of DNS terms, no evaluation of DNS terms |
---|
231 | ! x_zeta derivative of cartesion x wrt grid coordinate zeta |
---|
232 | ! y_eta derivative of cartesian y wrt coordinate eta |
---|
233 | ! z_zeta derivative of cartesion z wrt grid coordinate zeta |
---|
234 | ! det_J determinant of transformation matrix |
---|
235 | ! BC_flag - derivative conditions and end values |
---|
236 | ! |
---|
237 | ! output: |
---|
238 | ! rhs3 an (nx,ny,locnz) array such that dU/dt = rhs - pressure term |
---|
239 | ! |
---|
240 | |
---|
241 | use mpi_parameters |
---|
242 | use grid_info |
---|
243 | use dependent_variables |
---|
244 | use intermediate_variables |
---|
245 | use pde_parameters |
---|
246 | use rhs_variables |
---|
247 | use boundary_information |
---|
248 | use counters_flags_etc |
---|
249 | use user_parameters |
---|
250 | use dimensional_scales |
---|
251 | |
---|
252 | implicit none |
---|
253 | include '../input/problem_size.h' |
---|
254 | |
---|
255 | integer :: flag |
---|
256 | real :: end_values(2),h |
---|
257 | real, dimension(:,:,:,:), allocatable :: work |
---|
258 | real, dimension(:), allocatable :: mean_value |
---|
259 | allocate ( work(nx,ny,locnz,3) ) |
---|
260 | work(:,:,:,:) = 0. |
---|
261 | allocate( mean_value(locnz) ) |
---|
262 | mean_value(:) = 0. |
---|
263 | |
---|
264 | #if DEBUG_LEVEL >= 1 |
---|
265 | if(myid==0) write(0,*) 'hello world from ibr_3' |
---|
266 | #endif |
---|
267 | |
---|
268 | !Calculate dW/dxi, dW/dy dW/dzeta and store in work arrays 1,2,3 |
---|
269 | flag=BC_flag(1,1) |
---|
270 | h=Grid(0)%dxi |
---|
271 | call compact_ddx(W,work(1,1,1,1),flag,end_values,nx,ny,locnz) |
---|
272 | |
---|
273 | flag=BC_flag(1,2) |
---|
274 | h=Grid(0)%deta |
---|
275 | call compact_ddy(W,work(1,1,1,2),flag,end_values,nx,ny,locnz) |
---|
276 | do j=1,ny |
---|
277 | work(:,j,:,2)=work(:,j,:,2)/Grid(0)%y_eta(j) |
---|
278 | enddo |
---|
279 | |
---|
280 | flag=BC_flag(1,3) |
---|
281 | h=Grid(0)%dzeta |
---|
282 | call compact_ddz_mpi(W,work(1,1,1,3),flag,end_values,nx,ny,locnz) |
---|
283 | |
---|
284 | ! Add up the advective terms |
---|
285 | rhs3(:,:,:,MM0) = -( work(:,:,:,1)*U + work(:,:,:,2)*V + work(:,:,:,3)*W ) |
---|
286 | |
---|
287 | ! Add in the terms due to grid transformation |
---|
288 | do j=1,ny |
---|
289 | rhs3(1:nx,j,1:locnz,MM0) = & |
---|
290 | rhs3(1:nx,j,1:locnz,MM0) - & |
---|
291 | ( GM_uu(1:nx,1:locnz,2)*U(1:nx,j,1:locnz)*U(1:nx,j,1:locnz) & |
---|
292 | + GM_uw(1:nx,1:locnz,2)*U(1:nx,j,1:locnz)*W(1:nx,j,1:locnz) & |
---|
293 | + GM_ww(1:nx,1:locnz,2)*W(1:nx,j,1:locnz)*W(1:nx,j,1:locnz) ) |
---|
294 | enddo |
---|
295 | |
---|
296 | ! Compute the xy mean of the buoyancy term |
---|
297 | do k=1,locnz |
---|
298 | mean_value(k) = 0.0 |
---|
299 | do j=1,ny |
---|
300 | do i=1,nx |
---|
301 | mean_value(k) = mean_value(k) + Grid(0)%x_xi(i,k)*Ri*pd(i,j,k)/Grid(0)%det_J(i,k) |
---|
302 | enddo |
---|
303 | enddo |
---|
304 | mean_value(k) = mean_value(k)/float(nx*ny) |
---|
305 | enddo |
---|
306 | |
---|
307 | ! Add on the buoyancy (- the mean component) and rotation terms |
---|
308 | !!! xlv ajout effet beta |
---|
309 | !! do j=1,ny |
---|
310 | !! do k=1,locnz |
---|
311 | !! rhs3(1:nx,j,k,MM0) = & |
---|
312 | !! rhs3(1:nx,j,k,MM0) & |
---|
313 | !! - ( Grid(0)%x_xi(1:nx,k)*Ri*pd(1:nx,j,k)/Grid(0)%det_J(1:nx,k) - mean_value(k) ) & |
---|
314 | !! - Grid(0)%z_xi(1:nx,k)*Rot*v(1:nx,j,k)/Grid(0)%det_J(1:nx,k) |
---|
315 | !! enddo |
---|
316 | !! enddo |
---|
317 | do j=1,ny |
---|
318 | do k=1,locnz |
---|
319 | rhs3(1:nx,j,k,MM0) = rhs3(1:nx,j,k,MM0) & |
---|
320 | - ( Ri * Grid(0)%x_xi(1:nx,k)/Grid(0)%det_J(1:nx,k) * pd(1:nx,j,k) - mean_value(k) ) & |
---|
321 | - ( Rot + beta_window(j) )* v(1:nx,j,k)* Grid(0)%z_xi(1:nx,k)/Grid(0)%det_J(1:nx,k) |
---|
322 | enddo |
---|
323 | enddo |
---|
324 | |
---|
325 | print*,'beta: max=',maxval(Rot+beta_window(:)) |
---|
326 | |
---|
327 | deallocate( work,mean_value ) |
---|
328 | end subroutine ibr_3 |
---|
329 | |
---|
330 | subroutine ibr_4 |
---|
331 | ! Routine to calculate the rhs of the perturbation scalar 1 equation |
---|
332 | ! ignoring the diffusive term. |
---|
333 | ! |
---|
334 | ! inputs: |
---|
335 | ! U,v,W contravariant velocities (x,z) and horizontal velocity (y) |
---|
336 | ! s1 perturbation scalar 1, s1_bar; the ambient profile |
---|
337 | ! nx,ny,locnz size of fields |
---|
338 | ! dxi,deta,dzeta regular grid spacings on the computational mesh |
---|
339 | ! x_zeta derivative of cartesion x wrt grid coordinate zeta |
---|
340 | ! y_eta derivative of cartesian y wrt coordinate eta |
---|
341 | ! z_zeta derivative of cartesion z wrt grid coordinate zeta |
---|
342 | ! det_J determinant of transformation matrix |
---|
343 | ! BC_flag - derivative conditions and end values |
---|
344 | ! |
---|
345 | ! output: |
---|
346 | ! rhs4 an (nx,ny,locnz) array such that ds1/dt = rhs - diffusive term |
---|
347 | ! |
---|
348 | |
---|
349 | use mpi_parameters |
---|
350 | use grid_info |
---|
351 | use dependent_variables |
---|
352 | use pde_parameters |
---|
353 | use rhs_variables |
---|
354 | use boundary_information |
---|
355 | use counters_flags_etc |
---|
356 | use user_parameters |
---|
357 | |
---|
358 | implicit none |
---|
359 | include '../input/problem_size.h' |
---|
360 | |
---|
361 | integer :: flag |
---|
362 | real :: end_values(2),h |
---|
363 | real, dimension(:,:,:,:), allocatable :: work |
---|
364 | allocate (work(nx,ny,locnz,4)) |
---|
365 | work(:,:,:,:) = 0. |
---|
366 | |
---|
367 | #if DEBUG_LEVEL >= 1 |
---|
368 | if(myid==0) write(0,*) 'hello world from ibr_4' |
---|
369 | #endif |
---|
370 | |
---|
371 | !Store total scalar in work(:,:,:,4) |
---|
372 | do j=1,ny |
---|
373 | work(1:nx,j,1:locnz,4)=s1(1:nx,j,1:locnz)+s1_bar(1:nx,1:locnz) |
---|
374 | enddo |
---|
375 | |
---|
376 | !Calculate ds1/dxi, ds1/dy ds1/dzeta and store in work arrays 1,2,3 |
---|
377 | flag=BC_flag(1,1) |
---|
378 | h=Grid(0)%dxi |
---|
379 | call compact_ddx(work(:,:,:,4),work(1,1,1,1),flag,end_values,nx,ny,locnz) |
---|
380 | |
---|
381 | flag=BC_flag(1,2) |
---|
382 | h=Grid(0)%deta |
---|
383 | call compact_ddy(work(:,:,:,4),work(1,1,1,2),flag,end_values,nx,ny,locnz) |
---|
384 | do j=1,ny |
---|
385 | work(:,j,:,2)=work(:,j,:,2)/Grid(0)%y_eta(j) |
---|
386 | enddo |
---|
387 | |
---|
388 | flag=BC_flag(1,3) |
---|
389 | h=Grid(0)%dzeta |
---|
390 | call compact_ddz_mpi(work(:,:,:,4),work(1,1,1,3),flag,end_values,nx,ny,locnz) |
---|
391 | |
---|
392 | ! Add up the advective terms |
---|
393 | rhs4(:,:,:,MM0) = -( work(:,:,:,1)*U + work(:,:,:,2)*V + work(:,:,:,3)*W ) |
---|
394 | |
---|
395 | deallocate( work ) |
---|
396 | end subroutine ibr_4 |
---|
397 | |
---|
398 | subroutine ibr_5 |
---|
399 | ! Routine to calculate the rhs of the perturbation scalar 2 equation |
---|
400 | ! ignoring the diffusive term. |
---|
401 | ! |
---|
402 | ! inputs: |
---|
403 | ! U,v,W contravariant velocities (x,z) and horizontal velocity (y) |
---|
404 | ! s2 perturbation scalar 1, s2_bar; the ambient profile |
---|
405 | ! nx,ny,locnz size of fields |
---|
406 | ! dxi,deta,dzeta regular grid spacings on the computational mesh |
---|
407 | ! x_zeta derivative of cartesion x wrt grid coordinate zeta |
---|
408 | ! y_eta derivative of cartesian y wrt coordinate eta |
---|
409 | ! z_zeta derivative of cartesion z wrt grid coordinate zeta |
---|
410 | ! det_J determinant of transformation matrix |
---|
411 | ! BC_flag - derivative conditions and end values |
---|
412 | ! |
---|
413 | ! output: |
---|
414 | ! rhs5 an (nx,ny,locnz) array such that ds1/dt = rhs - diffusive term |
---|
415 | ! |
---|
416 | |
---|
417 | use mpi_parameters |
---|
418 | use grid_info |
---|
419 | use dependent_variables |
---|
420 | use pde_parameters |
---|
421 | use rhs_variables |
---|
422 | use boundary_information |
---|
423 | use counters_flags_etc |
---|
424 | use user_parameters |
---|
425 | |
---|
426 | implicit none |
---|
427 | include '../input/problem_size.h' |
---|
428 | |
---|
429 | integer :: flag |
---|
430 | real :: end_values(2),h |
---|
431 | real, dimension(:,:,:,:), allocatable :: work |
---|
432 | allocate (work(nx,ny,locnz,4)) |
---|
433 | work(:,:,:,:) = 0. |
---|
434 | |
---|
435 | #if DEBUG_LEVEL >= 1 |
---|
436 | if(myid==0) write(0,*) 'hello world from ibr_5' |
---|
437 | #endif |
---|
438 | |
---|
439 | !Store total scalar in work(:,:,:,4) |
---|
440 | do j=1,ny |
---|
441 | work(1:nx,j,1:locnz,4)=s2(1:nx,j,1:locnz)+s2_bar(1:nx,1:locnz) |
---|
442 | enddo |
---|
443 | |
---|
444 | !Calculate ds2/dxi, ds2/dy ds2/dzeta and store in work arrays 1,2,3 |
---|
445 | flag=BC_flag(1,1) |
---|
446 | h=Grid(0)%dxi |
---|
447 | call compact_ddx(work(:,:,:,4),work(1,1,1,1),flag,end_values,nx,ny,locnz) |
---|
448 | |
---|
449 | flag=BC_flag(1,2) |
---|
450 | h=Grid(0)%deta |
---|
451 | call compact_ddy(work(:,:,:,4),work(1,1,1,2),flag,end_values,nx,ny,locnz) |
---|
452 | do j=1,ny |
---|
453 | work(:,j,:,2)=work(:,j,:,2)/Grid(0)%y_eta(j) |
---|
454 | enddo |
---|
455 | |
---|
456 | flag=BC_flag(1,3) |
---|
457 | h=Grid(0)%dzeta |
---|
458 | call compact_ddz_mpi(work(:,:,:,4),work(1,1,1,3),flag,end_values,nx,ny,locnz) |
---|
459 | |
---|
460 | ! Add up the advective terms |
---|
461 | rhs5(:,:,:,MM0) = -( work(:,:,:,1)*U + work(:,:,:,2)*V + work(:,:,:,3)*W ) |
---|
462 | |
---|
463 | deallocate( work ) |
---|
464 | end subroutine ibr_5 |
---|
465 | |
---|