MONC
ultimateflux.F90
Go to the documentation of this file.
1 
11  implicit none
12 
13 #ifndef TEST_MODE
14  private
15 #endif
16 
17  public ultflx
18 
19  real(kind=default_precision) :: r6
20 
21 contains
22 
23  subroutine ultflx(y_flow_index, x_flow_index, u, v, w, y_scalar_index, x_scalar_index, zf, &
24  local_grid, grid_config, parallel, kdof, dt, flux_y, flux_z, flux_x, flux_previous_x, rdz, rdzn, dzn, kmin, kmax)
25 
26  integer, intent(in) ::y_flow_index, x_flow_index, y_scalar_index, x_scalar_index &! loop counter
27  ,kdof,& ! =1 for advection of W, 0 otherwise to shift vertical grid index
28  kmin, kmax
29  real(kind=default_precision), intent(in) ::dt ! timestep (s)
30  type(prognostic_field_type), intent(inout) :: u, w, v, zf
31  type(grid_configuration_type), intent(inout) :: grid_config
32  type(local_grid_type), intent(inout) :: local_grid
33  type(parallel_state_type), intent(inout) :: parallel
34  real(kind=default_precision), intent(in), dimension(:) :: rdz, rdzn, dzn
35  real(kind=default_precision), intent(inout), dimension(:) ::&
36  flux_z &! flux through bottom cell face
37  ,flux_y &! flux through left (y-dirn) cell face
38  ,flux_x & ! flux through left (x-dirn) cell face
39  ,flux_previous_x
40  r6 = 1.0_default_precision/6.0_default_precision
41 
42 #ifdef W_ACTIVE
43  call handle_vertical_fluxes(y_flow_index, x_flow_index, u, v, w, y_scalar_index, x_scalar_index, zf, &
44  local_grid, grid_config, kdof, dt, flux_z, rdz, rdzn, dzn, kmin, kmax)
45 #endif
46 
47 #ifdef V_ACTIVE
48  if (y_scalar_index .ne. local_grid%local_domain_end_index(y_index) .or. parallel%my_coords(y_index) .ne. &
49  parallel%dim_sizes(y_index)-1) then
50  call handle_y_direction_fluxes(y_flow_index, x_flow_index, u, v, w, y_scalar_index, x_scalar_index, zf, local_grid, &
51  grid_config, kdof, dt, flux_y, rdz, kmin, kmax)
52  end if
53 #endif
54 
55 #ifdef U_ACTIVE
56  flux_x(:) = flux_previous_x(:)
57  call handle_x_direction_fluxes(y_flow_index, x_flow_index, u, v, w, y_scalar_index, x_scalar_index, zf, &
58  local_grid, grid_config, kdof, dt, flux_previous_x, rdz, kmin, kmax)
59 #endif
60  end subroutine ultflx
61 
62  subroutine handle_vertical_fluxes(y_flow_index, x_flow_index, u, v, w, y_scalar_index, x_scalar_index, zf, &
63  local_grid, grid_config, kdof, dt, flux_z, rdz, rdzn, dzn, kmin, kmax)
64  integer, intent(in) :: kdof, y_flow_index, x_flow_index, y_scalar_index, x_scalar_index, kmin, kmax
65  real(kind=default_precision), intent(in) :: dt
66  type(prognostic_field_type), intent(inout) :: u, w, v, zf
67  type(grid_configuration_type), intent(inout) :: grid_config
68  type(local_grid_type), intent(inout) :: local_grid
69  real(kind=default_precision), intent(in), dimension(:) :: rdz, rdzn, dzn
70  real(kind=default_precision), intent(inout), dimension(:) :: flux_z
71 
72  if (kmin==1) call handle_vertical_fluxes_bottomofcolumn(y_flow_index, x_flow_index, u, v, w, y_scalar_index, x_scalar_index, &
73  zf, grid_config, kdof, dt, flux_z, rdz, rdzn, dzn)
74  call handle_vertical_fluxes_topofcolumn(y_flow_index, x_flow_index, u, v, w, y_scalar_index, x_scalar_index, zf, &
75  local_grid, grid_config, kdof, dt, flux_z, rdz, rdzn, dzn)
76  call handle_vertical_fluxes_middleofcolumn(y_flow_index, x_flow_index, u, v, w, y_scalar_index, x_scalar_index, zf, &
77  local_grid, grid_config, kdof, dt, flux_z, rdz, rdzn, dzn)
78  if (kmin .gt. 1) flux_z(2)=0.0_default_precision
79  end subroutine handle_vertical_fluxes
80 
81  subroutine handle_x_direction_fluxes(y_flow_index, x_flow_index, u, v, w, y_scalar_index, x_scalar_index, zf, local_grid, &
82  grid_config, kdof, dt, flux_x, rdz, kmin, kmax)
83  integer, intent(in) :: y_flow_index, x_flow_index, y_scalar_index, x_scalar_index, kdof, kmin, kmax
84  real(kind=default_precision), intent(in) :: dt
85  type(prognostic_field_type), intent(inout) :: u, w, v, zf
86  type(grid_configuration_type), intent(inout) :: grid_config
87  type(local_grid_type), intent(inout) :: local_grid
88  real(kind=default_precision), intent(in), dimension(:) :: rdz
89  real(kind=default_precision), intent(out), dimension(:) :: flux_x
90 
91  integer :: k, kp1, kp0
92 
93  real(kind=default_precision) :: advneg,advpos,&
94  fgt1, fgt2,&
95  fc,&
96  fcurvs,&
97  fd,&
98  fdels,&
99  fu,&
100  sum_cfl_out
101 
102  do k=2, kmax
103  kp1=min(k+1,local_grid%size(z_index))
104  kp0=kp1-1
105  call calculate_stencil_for_u(k, advneg, advpos, fc, fcurvs, fd, fdels, fu, &
106  u%data(:, y_flow_index, x_flow_index), zf%data(:, y_scalar_index, x_scalar_index-1), &
107  zf%data(:, y_scalar_index, x_scalar_index+2), zf%data(:, y_scalar_index, x_scalar_index), &
108  zf%data(:, y_scalar_index, x_scalar_index+1))
109  if(abs(fcurvs) .ge. abs(fdels))then
110  flux_x(k) = fc
111  else
112  if (u%data(k, y_flow_index, x_flow_index) .gt. 0.0_default_precision) then
113  sum_cfl_out=0.0_default_precision
114 #ifdef W_ACTIVE
115  sum_cfl_out = sum_cfl_out + rdz(k)*(max(0.0_default_precision,&
116  w%data(k, y_flow_index, x_flow_index))+abs(min(0.0_default_precision,w%data(k-1, y_flow_index, x_flow_index))))
117 #endif
118 #ifdef V_ACTIVE
119  sum_cfl_out = sum_cfl_out + grid_config%horizontal%cy*(max(0.0_default_precision,&
120  v%data(k, y_flow_index, x_flow_index))+abs(min(0.0_default_precision,v%data(k, y_flow_index-1, x_flow_index))))
121 #endif
122 #ifdef U_ACTIVE
123  sum_cfl_out = sum_cfl_out + grid_config%horizontal%cx*(u%data(k, y_flow_index, x_flow_index)+&
124  abs(min(0.0_default_precision,u%data(k, y_flow_index, x_flow_index-1))))
125 #endif
126  sum_cfl_out = sum_cfl_out * dt
127  else
128  sum_cfl_out=0.0_default_precision
129 #ifdef W_ACTIVE
130  sum_cfl_out = sum_cfl_out + rdz(k)*&
131  (max(0.0_default_precision,w%data(k, y_flow_index, x_flow_index+1))+&
132  abs(min(0.0_default_precision,w%data(k-1, y_flow_index, x_flow_index+1))))
133 #endif
134 #ifdef V_ACTIVE
135  sum_cfl_out = sum_cfl_out + grid_config%horizontal%cy*(max(0.0_default_precision,&
136  v%data(k, y_flow_index, x_flow_index+1))+&
137  abs(min(0.0_default_precision,v%data(k, y_flow_index-1, x_flow_index+1))))
138 #endif
139 #ifdef U_ACTIVE
140  sum_cfl_out = sum_cfl_out + grid_config%horizontal%cx*(max(0.0_default_precision,&
141  u%data(k, y_flow_index, x_flow_index+1))-u%data(k, y_flow_index, x_flow_index))
142 #endif
143  sum_cfl_out = sum_cfl_out * dt
144  end if
145  ! First gradient term in Z direction
146  fgt1=0.0_default_precision
147 #ifdef W_ACTIVE
148  fgt1=calculate_gradient_term_in_z(k, w%data(:, y_flow_index, x_flow_index), &
149  w%data(:, y_flow_index, x_flow_index+1), dt, advneg, advpos, kdof, kp0, kp1, &
150  zf%data(:, y_scalar_index, x_scalar_index), zf%data(:, y_scalar_index, x_scalar_index+1), rdz)
151 #endif
152 
153  ! Second gradient term in Y direction
154  fgt2=0.0_default_precision
155 #ifdef V_ACTIVE
156  fgt2=calculate_gradient_term_in_y(k, v, y_flow_index, x_flow_index+1, &
157  grid_config%horizontal%cy, dt, fc, zf, y_scalar_index, x_scalar_index, multiplication_factor_one=advpos, &
158  term_data_two=zf, term_data_two_y_index=y_scalar_index, term_data_two_x_index=x_scalar_index+1, &
159  multiplication_factor_two=advneg, data_two=v, data_two_y_index=y_flow_index, data_two_x_index=x_flow_index)
160 #endif
161  ! Now calculate the fluxes in X
162  flux_x(k) = calculate_flux_in_x(u%data(k, y_flow_index, x_flow_index), dt, sum_cfl_out, fdels, fd, fc, fu, fgt1, fgt2, &
163  grid_config%horizontal%cx, fcurvs)
164  end if
165  end do
166  end subroutine handle_x_direction_fluxes
167 
168  subroutine handle_y_direction_fluxes(y_flow_index, x_flow_index, u, v, w, y_scalar_index, x_scalar_index, zf, &
169  local_grid, grid_config, kdof, dt, flux_y, rdz, kmin, kmax)
170  integer, intent(in) :: y_flow_index, x_flow_index, y_scalar_index, x_scalar_index, kdof, kmin, kmax
171  real(kind=default_precision), intent(in) :: dt
172  type(grid_configuration_type), intent(inout) :: grid_config
173  type(prognostic_field_type), intent(inout) :: u, w, v, zf
174  type(local_grid_type), intent(inout) :: local_grid
175  real(kind=default_precision), intent(in), dimension(:) :: rdz
176  real(kind=default_precision), intent(inout), dimension(:) :: flux_y
177 
178  integer :: k, kp1, kp0, jofset, jperiod
179 
180  real(kind=default_precision) :: advneg,advpos,&
181  fgt1, fgt2,&
182  fc,&
183  fcurvs,&
184  fd,&
185  fdels,&
186  fu,&
187  sum_cfl_out
188 
189  do k=2, kmax
190  kp1=min(k+1,local_grid%size(z_index))
191  kp0=kp1-1
192  ! Set up the stencil_mod
193  call calculate_stencil_for_y(y_flow_index, x_flow_index, y_scalar_index, x_scalar_index, k, advneg, &
194  advpos, fc, fcurvs, fd, fdels, fu, jofset, jperiod, v, zf)
195  if (abs(fcurvs) .ge. abs(fdels) )then
196  flux_y(k) = fc
197  else
198  sum_cfl_out=0.0_default_precision
199 #ifdef W_ACTIVE
200  sum_cfl_out = sum_cfl_out + rdz(k)* (max(0.0_default_precision,w%data(k, y_flow_index+jofset, &
201  x_flow_index))+ abs(min(0.0_default_precision,w%data(k-1, y_flow_index+jofset, x_flow_index))))
202 #endif
203 #ifdef V_ACTIVE
204  sum_cfl_out = sum_cfl_out + grid_config%horizontal%cy*(max(0.0_default_precision,v%data(&
205  k, y_flow_index+jofset, x_flow_index)) +&
206  abs(min(0.0_default_precision,v%data(k, y_flow_index-1 +jofset+jperiod, x_flow_index))))
207 #endif
208 #ifdef U_ACTIVE
209  sum_cfl_out = sum_cfl_out + grid_config%horizontal%cx*(max(0.0_default_precision,u%data(&
210  k, y_flow_index+jofset, x_flow_index)) + &
211  abs(min(0.0_default_precision,u%data(k, y_flow_index+jofset, x_flow_index-1))))
212 #endif
213  sum_cfl_out = sum_cfl_out * dt
214  ! First gradient term in Z direction
215  fgt1=0.0_default_precision
216 #ifdef W_ACTIVE
217  fgt1= calculate_gradient_term_in_z(k, w%data(:, y_flow_index, x_flow_index), w%data(:, y_flow_index+1, &
218  x_flow_index), dt, advneg, advpos, kdof, kp0, kp1, &
219  zf%data(:, y_scalar_index+jofset, x_scalar_index), rdz=rdz)
220 #endif
221  ! Second gradient term in X direction
222  fgt2=0.0_default_precision
223 #ifdef U_ACTIVE
224  fgt2=calculate_gradient_term_in_x(k, u%data(:, y_flow_index, x_flow_index-1), u%data(:, y_flow_index, &
225  x_flow_index), u%data(:, y_flow_index+1, x_flow_index-1), u%data(:, y_flow_index+1, x_flow_index), &
226  grid_config%horizontal%cx, dt, fc, zf%data(k, y_scalar_index+jofset, x_scalar_index+1), &
227  zf%data(k, y_scalar_index+jofset, x_scalar_index-1), 0)
228 #endif
229  ! Now calculate the flux in Y
230  flux_y(k)=calculate_flux_in_y(v%data(k, y_flow_index, x_flow_index), dt, sum_cfl_out, &
231  fdels, fd, fc, fu, fgt1, fgt2, grid_config%horizontal%cy, fcurvs)
232  end if
233  end do
234  end subroutine handle_y_direction_fluxes
235 
236  subroutine handle_vertical_fluxes_middleofcolumn(y_flow_index, x_flow_index, u, v, w, y_scalar_index, x_scalar_index, zf, &
237  local_grid, grid_config, kdof, dt, flux_z, rdz, rdzn, dzn)
238  integer, intent(in) :: kdof, y_flow_index, x_flow_index, y_scalar_index, x_scalar_index
239  real(kind=default_precision), intent(in) :: dt
240  type(grid_configuration_type), intent(inout) :: grid_config
241  type(prognostic_field_type), intent(inout) :: u, w, v, zf
242  type(local_grid_type), intent(inout) :: local_grid
243  real(kind=default_precision), intent(in), dimension(:) :: rdz, rdzn, dzn
244  real(kind=default_precision), intent(inout), dimension(:) :: flux_z
245 
246  integer :: kofset, k
247 
248  real(kind=default_precision) :: advneg,advpos,&
249  fgt1, fgt2,&
250  fc,&
251  fcurvs,&
252  fd,&
253  fdels,&
254  fu,&
255  rdc,&
256  rdu,&
257  sum_cfl_out
258 
259  do k=2,local_grid%size(z_index)-2
260  call calculate_stencil_for_w(y_flow_index, x_flow_index, y_scalar_index, x_scalar_index, k, advneg, &
261  advpos, fc, fcurvs, fd, fdels, fu, kofset, w, zf)
262 
263  if(abs(fcurvs) .ge. abs(fdels))then
264  flux_z(k+1) = fc
265  else
266  sum_cfl_out=0.0_default_precision
267 #ifdef W_ACTIVE
268  sum_cfl_out=sum_cfl_out+rdz(k+kofset)*(max(0.0_default_precision,w%data(k+kofset, y_flow_index, &
269  x_flow_index))+ abs(min(0.0_default_precision,w%data(k-1+kofset, y_flow_index, x_flow_index))))
270 #endif
271 #ifdef V_ACTIVE
272  sum_cfl_out=sum_cfl_out+grid_config%horizontal%cy*(max(0.0_default_precision,&
273  v%data(k+kofset, y_flow_index, x_flow_index))+&
274  abs(min(0.0_default_precision,v%data(k+kofset, y_flow_index-1, x_flow_index))))
275 #endif
276 #ifdef U_ACTIVE
277  sum_cfl_out=sum_cfl_out+grid_config%horizontal%cx*(max(0.0_default_precision,&
278  u%data(k+kofset, y_flow_index, x_flow_index))+ &
279  abs(min(0.0_default_precision,u%data(k+kofset, y_flow_index, x_flow_index-1))))
280 #endif
281  sum_cfl_out = sum_cfl_out * dt
282 
283  ! First gradient term, in Y direction
284  fgt1=0.0_default_precision
285 #ifdef V_ACTIVE
286  fgt1=calculate_gradient_term_in_y(k, v, y_flow_index, x_flow_index, grid_config%horizontal%cy, &
287  dt, fc, zf, y_scalar_index, x_scalar_index, kofset)
288 #endif
289  ! Second gradient TERM, in X direction
290  fgt2=0.0_default_precision
291 #ifdef U_ACTIVE
292  fgt2=calculate_gradient_term_in_x(k, u%data(:, y_flow_index, x_flow_index-1), u%data(:, y_flow_index, &
293  x_flow_index), u%data(:, y_flow_index, x_flow_index-1), u%data(:, y_flow_index, &
294  x_flow_index), grid_config%horizontal%cx, dt, fc, zf%data(k+kofset, y_scalar_index, x_scalar_index+1), &
295  zf%data(k+kofset, y_scalar_index, x_scalar_index-1), 1)
296 #endif
297  rdu=rdzn(k) *advpos + rdzn(k+2)*advneg
298  rdc=rdz(k+kdof)*advpos + rdz(k+1+kdof)*advneg
299 
300  ! Calculate the fluxes in W
301  flux_z(k+1) = calculate_flux_in_w(k, w%data(k, y_flow_index, x_flow_index), &
302  dt, sum_cfl_out, rdc, fdels, fd, fc, fu, rdu, fgt1, fgt2, dzn, rdzn)
303  end if
304  end do
306 
307  subroutine handle_vertical_fluxes_bottomofcolumn(y_flow_index, x_flow_index, u, v, w, y_scalar_index, x_scalar_index, zf, &
308  grid_config, kdof, dt, flux_z, rdz, rdzn, dzn)
309  integer, intent(in) :: y_flow_index, x_flow_index, y_scalar_index, x_scalar_index, kdof
310  real(kind=default_precision), intent(in) :: dt
311  type(grid_configuration_type), intent(inout) :: grid_config
312  type(prognostic_field_type), intent(inout) :: u, w, v, zf
313  real(kind=default_precision), intent(in), dimension(:) :: rdz, rdzn, dzn
314  real(kind=default_precision), intent(out), dimension(:) :: flux_z
315 
316  integer :: k
317 
318  real(kind=default_precision) :: fgt1, fgt2,&
319  fc,&
320  fcurvs,&
321  fd,&
322  fdels,&
323  fu,&
324  rdc,&
325  rdu,&
326  sum_cfl_out
327 
328  k=1
329  if(w%data(k, y_flow_index, x_flow_index) .ge. 0.0_default_precision) then
330  fu = zf%data(1, y_scalar_index, x_scalar_index)
331  fc = zf%data(k, y_scalar_index, x_scalar_index)
332  fd = zf%data(k+1, y_scalar_index, x_scalar_index)
333  else
334  fu = zf%data(k+2, y_scalar_index, x_scalar_index)
335  fc = zf%data(k+1, y_scalar_index, x_scalar_index)
336  fd = zf%data(k, y_scalar_index, x_scalar_index)
337  end if
338  fcurvs = fd - 2.0_default_precision*fc + fu
339  fdels = fd - fu
340  if(abs(fcurvs) .ge. abs(fdels))then
341  flux_z(k+1) = fc
342  else
343  if(w%data(k, y_flow_index, x_flow_index) .ge. 0.0_default_precision) then
344  sum_cfl_out=0.0_default_precision
345 #ifdef W_ACTIVE
346  sum_cfl_out = sum_cfl_out + w%data(k, y_flow_index, x_flow_index)*rdz(k+kdof)
347 #endif
348 #ifdef V_ACTIVE
349  sum_cfl_out = sum_cfl_out + grid_config%horizontal%cy*(max(0.0_default_precision,v%data(k, y_flow_index, x_flow_index))&
350  +abs(min(0.0_default_precision,v%data(k, y_flow_index-1, x_flow_index))))
351 #endif
352 #ifdef U_ACTIVE
353  sum_cfl_out = sum_cfl_out + grid_config%horizontal%cx*(max(0.0_default_precision,u%data(k, y_flow_index, x_flow_index))&
354  +abs(min(0.0_default_precision,u%data(k, y_flow_index, x_flow_index-1))))
355 #endif
356  sum_cfl_out = sum_cfl_out * dt
357 
358  ! First gradient term in Y direction
359  fgt1=0.0_default_precision
360 #ifdef V_ACTIVE
361  fgt1=calculate_gradient_term_in_y(k, v, y_flow_index, x_flow_index, &
362  grid_config%horizontal%cy, dt, fc, zf, y_scalar_index, x_scalar_index)
363 #endif
364  ! Second gradient term in X direction
365  fgt2=0.0_default_precision
366 #ifdef U_ACTIVE
367  fgt2=calculate_gradient_term_in_x(k, u%data(:, y_flow_index, x_flow_index-1), u%data(:, y_flow_index, &
368  x_flow_index), u%data(:, y_flow_index, x_flow_index-1), u%data(:, y_flow_index, &
369  x_flow_index), grid_config%horizontal%cx, dt, fc, zf%data(k, y_scalar_index, x_scalar_index+1), &
370  zf%data(k, y_scalar_index, x_scalar_index-1), 1)
371 #endif
372  rdu=rdzn(2) ! k map_typeped onto 2
373  rdc=rdz(k+kdof)
374  else
375  sum_cfl_out=0.0_default_precision
376 #ifdef W_ACTIVE
377  sum_cfl_out=sum_cfl_out+rdz(k+1+kdof)*(max(0.0_default_precision,w%data(k+1, y_flow_index, &
378  x_flow_index)) -w%data(k, y_flow_index, x_flow_index))
379 #endif
380 #ifdef V_ACTIVE
381  sum_cfl_out=sum_cfl_out+grid_config%horizontal%cy*(max(0.0_default_precision,v%data(k+1, y_flow_index, x_flow_index))&
382  +abs(min(0.0_default_precision,v%data(k+1, y_flow_index-1, x_flow_index))))
383 #endif
384 #ifdef U_ACTIVE
385  sum_cfl_out=sum_cfl_out + grid_config%horizontal%cx*(max(0.0_default_precision,u%data(k+1, y_flow_index, x_flow_index))&
386  +abs(min(0.0_default_precision,u%data(k+1, y_flow_index, x_flow_index-1))))
387 #endif
388  sum_cfl_out = sum_cfl_out * dt
389 
390  ! First gradient term in Y direction
391  fgt1=0.0_default_precision
392 #ifdef V_ACTIVE
393  fgt1=calculate_gradient_term_in_y(k, v, y_flow_index, x_flow_index, &
394  grid_config%horizontal%cy, dt, fc, zf, y_scalar_index, x_scalar_index, 1)
395 #endif
396  ! Second gradient term in X direction
397  fgt2=0.0_default_precision
398 #ifdef U_ACTIVE
399  fgt2=calculate_gradient_term_in_x(k, u%data(:, y_flow_index, x_flow_index-1), u%data(:, y_flow_index, &
400  x_flow_index), u%data(:, y_flow_index, x_flow_index-1), u%data(:, y_flow_index, &
401  x_flow_index), grid_config%horizontal%cx, dt, fc, zf%data(k+1, y_scalar_index, x_scalar_index+1), &
402  zf%data(k+1, y_scalar_index, x_scalar_index-1), 1)
403 #endif
404  rdu=rdzn(k+2)
405  rdc=rdz(k+1+kdof)
406  end if
407  ! Calculate fluxes in W
408  flux_z(k+1) = calculate_flux_in_w(k, w%data(k, y_flow_index, x_flow_index), &
409  dt, sum_cfl_out, rdc, fdels, fd, fc, fu, rdu, fgt1, fgt2, dzn, rdzn)
410  end if
412 
413  subroutine handle_vertical_fluxes_topofcolumn(y_flow_index, x_flow_index, u, v, w, y_scalar_index, x_scalar_index, zf, &
414  local_grid, grid_config, kdof, dt, flux_z, rdz, rdzn, dzn)
415  integer, intent(in) :: y_flow_index, x_flow_index, y_scalar_index, x_scalar_index, kdof
416  real(kind=default_precision), intent(in) :: dt
417  type(grid_configuration_type), intent(inout) :: grid_config
418  type(prognostic_field_type), intent(inout) :: u, w, v, zf
419  type(local_grid_type), intent(inout) :: local_grid
420  real(kind=default_precision), intent(in), dimension(:) :: rdz, rdzn, dzn
421  real(kind=default_precision), intent(inout), dimension(:) :: flux_z
422 
423  integer :: k
424 
425  real(kind=default_precision) :: fgt1, fgt2,&
426  fc,&
427  fcurvs,&
428  fd,&
429  fdels,&
430  fu,&
431  rdc,&
432  rdu,&
433  sum_cfl_out
434 
435  k=local_grid%size(z_index)-1
436 
437  if(w%data(k, y_flow_index, x_flow_index) .ge. 0.0_default_precision) then
438  fu = zf%data(k-1, y_scalar_index, x_scalar_index)
439  fc = zf%data(k, y_scalar_index, x_scalar_index)
440  fd = zf%data(k+1, y_scalar_index, x_scalar_index)
441  else
442  ! Extrapolate linearly to level equidistant above upper boundary
443  fu = 2.0_default_precision*zf%data(k+1, y_scalar_index, x_scalar_index) - zf%data(k, y_scalar_index, x_scalar_index)
444  fc = zf%data(k+1, y_scalar_index, x_scalar_index)
445  fd = zf%data(k, y_scalar_index, x_scalar_index)
446  end if
447  fcurvs = fd - 2.0_default_precision*fc + fu
448  fdels = fd - fu
449  if(abs(fcurvs) .ge. abs(fdels))then
450  flux_z(k+1) = fc
451  else
452  if(w%data(k, y_flow_index, x_flow_index) .ge. 0.0_default_precision) then
453  sum_cfl_out=0.0_default_precision
454 #ifdef W_ACTIVE
455  sum_cfl_out = sum_cfl_out + rdz(k+kdof)*(w%data(k, y_flow_index, x_flow_index)&
456  +abs(min(0.0_default_precision,w%data(k-1, y_flow_index, x_flow_index))))
457 #endif
458 #ifdef V_ACTIVE
459  sum_cfl_out = sum_cfl_out + grid_config%horizontal%cy*(max(0.0_default_precision,v%data(k, y_flow_index, x_flow_index))+&
460  abs(min(0.0_default_precision,v%data(k, y_flow_index-1, x_flow_index))))
461 #endif
462 #ifdef U_ACTIVE
463  sum_cfl_out = sum_cfl_out + grid_config%horizontal%cx*(max(0.0_default_precision,u%data(k, y_flow_index, x_flow_index))&
464  +abs(min(0.0_default_precision,u%data(k, y_flow_index, x_flow_index-1))))
465 #endif
466  sum_cfl_out = sum_cfl_out * dt
467 
468  ! First gradient term in Y direction
469  fgt1=0.0_default_precision
470 #ifdef V_ACTIVE
471  fgt1=calculate_gradient_term_in_y(k, v, y_flow_index, x_flow_index, grid_config%horizontal%cy, dt, fc, &
472  zf, y_scalar_index, x_scalar_index)
473 #endif
474  ! Second gradient term in X direction
475  fgt2=0.0_default_precision
476 #ifdef U_ACTIVE
477  fgt2=calculate_gradient_term_in_x(k, u%data(:, y_flow_index, x_flow_index-1), u%data(:, y_flow_index, &
478  x_flow_index), u%data(:, y_flow_index, x_flow_index-1), u%data(:, y_flow_index, &
479  x_flow_index), grid_config%horizontal%cx, dt, fc, zf%data(k, y_scalar_index, x_scalar_index+1), &
480  zf%data(k, y_scalar_index, x_scalar_index-1), 1)
481 #endif
482  rdu=rdzn(k)
483  rdc=rdz(k+kdof)
484  else
485  sum_cfl_out=0.0_default_precision
486 #ifdef W_ACTIVE
487  sum_cfl_out = sum_cfl_out + (- w%data(k, y_flow_index, x_flow_index)&
488  *rdz(min(local_grid%size(z_index),k+1+kdof)))
489 #endif
490 #ifdef V_ACTIVE
491  sum_cfl_out = sum_cfl_out + grid_config%horizontal%cy*(max(0.0_default_precision,&
492  v%data(k+1, y_flow_index, x_flow_index))+&
493  abs(min(0.0_default_precision,v%data(k+1, y_flow_index-1, x_flow_index))))
494 #endif
495 #ifdef U_ACTIVE
496  sum_cfl_out = sum_cfl_out + grid_config%horizontal%cx*(max(0.0_default_precision,&
497  u%data(k+1, y_flow_index, x_flow_index))&
498  +abs(min(0.0_default_precision,u%data(k+1, y_flow_index, x_flow_index-1))))
499 #endif
500  sum_cfl_out = sum_cfl_out * dt
501 
502  ! First gradient term in Y direction
503  fgt1=0.0_default_precision
504 #ifdef V_ACTIVE
505  fgt1=calculate_gradient_term_in_y(k, v, y_flow_index, x_flow_index, grid_config%horizontal%cy, &
506  dt, fc, zf, y_scalar_index, x_scalar_index, 1)
507 #endif
508  ! Second gradient term in X direction
509  fgt2=0.0_default_precision
510 #ifdef U_ACTIVE
511  fgt2=calculate_gradient_term_in_x(k, u%data(:, y_flow_index, x_flow_index-1), u%data(:, y_flow_index, &
512  x_flow_index), u%data(:, y_flow_index, x_flow_index-1), u%data(:, y_flow_index, &
513  x_flow_index), grid_config%horizontal%cx, dt, fc, zf%data(k+1, y_scalar_index, x_scalar_index+1), &
514  zf%data(k+1, y_scalar_index, x_scalar_index-1), 1)
515 #endif
516  rdu=rdzn(local_grid%size(z_index))
517  rdc=rdz(min(local_grid%size(z_index),k+1+kdof))
518  end if
519  ! Now calculate fluxes in W
520  flux_z(k+1) = calculate_flux_in_w(k, w%data(k, y_flow_index, x_flow_index), &
521  dt, sum_cfl_out, rdc, fdels, fd, fc, fu, rdu, fgt1, fgt2, dzn, rdzn)
522  end if
524 
525  real(kind=default_precision) function calculate_flux_in_w(k, data_value, dt, sum_cfl_out, rdc, fdels, fd, fc, fu, rdu, fgt1, &
526  fgt2, dzn, rdzn)
527  integer, intent(in) :: k
528  real(kind=default_precision), intent(in), dimension(:) :: dzn, rdzn
529  real(kind=default_precision), intent(in) :: dt, sum_cfl_out, rdc, fdels, fd, fc, fu, rdu, fgt1, fgt2
530  real(kind=default_precision), intent(in) :: data_value
531 
532  real(kind=default_precision) :: dd,&
533  rdd,&
534  cflmod,&
535  hrcfl,&
536  hcfl,&
537  cflcoef,&
538  rfdels,&
539  ffs,&
540  fnfs,&
541  fncs,&
542  fnrefs,&
543  ftemp
544 
545  dd=dzn(k+1)
546  rdd=rdzn(k+1)
547  cflmod=abs(data_value*rdzn(k+1)*dt)
548  hrcfl=1.0_default_precision/(sum_cfl_out+1.e-30_default_precision)
549  hcfl=0.5_default_precision*cflmod
550  cflcoef=r6*(1.0_default_precision-cflmod*cflmod)*(dd*dd*rdc)
551  rfdels=1.0_default_precision/(fdels+1.e-30_default_precision)
552  ffs=0.5_default_precision*(fd+fc)-hcfl*(fd-fc)-cflcoef*((fd-fc)*rdd-(fc-fu)*rdu) - fgt1 - fgt2
553  fnfs=(ffs-fu)*rfdels
554  fncs=(fc-fu)*rfdels
555  fnrefs=fncs*hrcfl
556  ftemp=max(fncs,min(fnfs,fnrefs,1.0_default_precision))
557  calculate_flux_in_w = ftemp*fdels + fu
558  end function calculate_flux_in_w
559 
560  real(kind=default_precision) function calculate_flux_in_x(data_value, dt, sum_cfl_out, fdels, fd, fc, fu, fgt1, fgt2, cx, fcurvs)
561  real(kind=default_precision), intent(in) :: sum_cfl_out, fdels, fd, fc, fu, fgt1, fgt2, cx, dt, fcurvs
562  real(kind=default_precision), intent(in) :: data_value
563 
564  real(kind=default_precision) :: cflmod,&
565  hrcfl,&
566  hcfl,&
567  cflcoef,&
568  rfdels,&
569  ffs,&
570  fnfs,&
571  fncs,&
572  fnrefs,&
573  ftemp
574 
575  cflmod=abs(data_value*cx*dt)
576  hrcfl=1.0_default_precision/(sum_cfl_out+1.e-30_default_precision)
577  hcfl=0.5_default_precision*cflmod
578  cflcoef=r6*(1.0_default_precision-cflmod*cflmod)
579  rfdels=1.0_default_precision/(fdels+1.e-30_default_precision)
580  ffs=0.5_default_precision*(fd+fc)-hcfl*(fd-fc)-cflcoef*fcurvs - fgt1 - fgt2
581  fnfs=(ffs-fu)*rfdels
582  fncs=(fc-fu)*rfdels
583  fnrefs=fncs*hrcfl
584  ftemp=max(fncs,min(fnfs,fnrefs,1.0_default_precision))
585  calculate_flux_in_x = ftemp*fdels + fu
586  end function calculate_flux_in_x
587 
588  real(kind=default_precision) function calculate_flux_in_y(data_value, dt, sum_cfl_out, fdels, fd, fc, fu, fgt1, fgt2, cy, fcurvs)
589  real(kind=default_precision), intent(in) :: dt, sum_cfl_out, fdels, fd, fc, fu, fgt1, fgt2, cy, fcurvs
590  real(kind=default_precision), intent(in) :: data_value
591 
592  real(kind=default_precision) :: cflmod,&
593  hrcfl,&
594  hcfl,&
595  cflcoef,&
596  rfdels,&
597  ffs,&
598  fnfs,&
599  fncs,&
600  fnrefs,&
601  ftemp
602 
603  cflmod=abs(data_value*cy*dt)
604  hrcfl=1.0_default_precision/(sum_cfl_out+1.e-30_default_precision)
605  hcfl=0.5_default_precision*cflmod
606  cflcoef=r6*(1.0_default_precision-cflmod*cflmod)
607  rfdels=1.0_default_precision/(fdels+1.e-30_default_precision)
608  ffs=0.5_default_precision*(fd+fc)-hcfl*(fd-fc)-cflcoef*fcurvs - fgt1 - fgt2
609  fnfs=(ffs-fu)*rfdels
610  fncs=(fc-fu)*rfdels
611  fnrefs=fncs*hrcfl
612  ftemp=max(fncs,min(fnfs,fnrefs,1.0_default_precision))
613  calculate_flux_in_y = ftemp*fdels + fu
614  end function calculate_flux_in_y
615 
616  subroutine calculate_stencil_for_u(k, advneg, advpos, fc, fcurvs, fd, fdels, fu, &
617  flow_field, advection_field_one, advection_field_two, advection_field_three, advection_field_four)
618  integer, intent(in) :: k
619  real(kind=default_precision), intent(in), dimension(:) :: flow_field, advection_field_one, advection_field_two, &
620  advection_field_three, advection_field_four
621  real(kind=default_precision), intent(out) :: advneg, advpos, fc, fcurvs, fd, fdels, fu
622 
623  real(kind=default_precision) :: sign_modified
624 
625  sign_modified = sign(real(.5, kind=default_precision),flow_field(k))
626  advpos = 0.5_default_precision+sign_modified
627  advneg = 0.5_default_precision-sign_modified
628  fu = advection_field_one(k)*advpos + advection_field_two(k)*advneg
629  fc = advection_field_three(k)*advpos + advection_field_four(k)*advneg
630  fd = advection_field_four(k)*advpos + advection_field_three(k)*advneg
631  fdels = fd - fu
632  fcurvs = fd - 2.0_default_precision*fc + fu
633  end subroutine calculate_stencil_for_u
634 
635  subroutine calculate_stencil_for_y(y_flow_index, x_flow_index, y_scalar_index, x_scalar_index, k, advneg, advpos, &
636  fc, fcurvs, fd, fdels, fu, jofset, jperiod, flow_field, zf)
637  integer, intent(in) :: y_flow_index, x_flow_index, y_scalar_index, x_scalar_index, k
638  type(prognostic_field_type), intent(inout) :: flow_field, zf
639  integer, intent(out) :: jofset, jperiod
640  real(kind=default_precision), intent(out) :: advneg, advpos, fc, fcurvs, fd, fdels, fu
641 
642  real(kind=default_precision) :: ajeq0, sign_modified
643 
644  sign_modified=sign(0.5_default_precision, flow_field%data(k, y_flow_index, x_flow_index))
645  advpos=0.5_default_precision+sign_modified
646  advneg=0.5_default_precision-sign_modified
647  jofset=nint(advneg)
648  ajeq0=0.5_default_precision-sign(0.5_default_precision, (y_scalar_index-1)-0.5_default_precision)
649  jperiod=merge(0,1, y_scalar_index .gt. 1) !nint(jjp*ajeq0) ! =JJP OR 0
650 
651  fu = zf%data(k, y_scalar_index-1+jperiod, x_scalar_index)*advpos + zf%data(k, y_scalar_index+2, x_scalar_index)*advneg
652  fc = zf%data(k, y_scalar_index, x_scalar_index) *advpos + zf%data(k, y_scalar_index+1, x_scalar_index)*advneg
653  fd = zf%data(k, y_scalar_index+1, x_scalar_index)*advpos + zf%data(k, y_scalar_index, x_scalar_index)*advneg
654  fdels = fd - fu
655  fcurvs = fd - 2.0_default_precision*fc + fu
656  end subroutine calculate_stencil_for_y
657 
658  subroutine calculate_stencil_for_w(y_flow_index, x_flow_index, y_scalar_index, x_scalar_index, k, advneg, advpos, &
659  fc, fcurvs, fd, fdels, fu, kofset, flow_field, zf)
660  integer, intent(in) :: y_flow_index, x_flow_index, y_scalar_index, x_scalar_index, k
661  type(prognostic_field_type), intent(inout) :: flow_field, zf
662  integer, intent(out) :: kofset
663  real(kind=default_precision), intent(out) :: advneg, advpos, fc, fcurvs, fd, fdels, fu
664 
665  real(kind=default_precision) :: sign_modified
666 
667  sign_modified=sign(real(.5, kind=default_precision),flow_field%data(k, y_flow_index, x_flow_index))
668  advpos=0.5_default_precision+sign_modified
669  advneg=0.5_default_precision-sign_modified
670  kofset=nint(advneg)
671  fu = zf%data(k-1, y_scalar_index, x_scalar_index)*advpos + zf%data(k+2, y_scalar_index, x_scalar_index)*advneg
672  fc = zf%data(k+kofset, y_scalar_index, x_scalar_index)
673  fd = zf%data(k+1, y_scalar_index, x_scalar_index)*advpos + zf%data(k, y_scalar_index, x_scalar_index) *advneg
674  fcurvs = fd - 2.0_default_precision*fc + fu
675  fdels = fd - fu
676  end subroutine calculate_stencil_for_w
677 
678  real(kind=default_precision) function calculate_gradient_term_in_z(k, column_one, column_two, dt, advneg, &
679  advpos, kdof, kp0, kp1, source_column_one, source_column_two, rdz)
680  integer, intent(in) :: k, kdof, kp0, kp1
681  real(kind=default_precision), intent(in) :: dt, advneg, advpos
682  real(kind=default_precision), intent(in), dimension(:) :: column_one, column_two, source_column_one
683  real(kind=default_precision), intent(in), dimension(:), optional :: source_column_two
684  real(kind=default_precision), intent(in), dimension(:) :: rdz
685 
686  integer :: ksu, ksl, kposwf
687  real(kind=default_precision) :: specific_face, temp_src
688 
689  specific_face=0.125_default_precision*(column_one(k)+column_one(k-1)+column_two(k)+column_two(k-1))
690  kposwf=nint(0.5_default_precision+sign(real(0.5, kind=default_precision), specific_face))
691  ksu=kp1*(1-kposwf)+(k-1)*kposwf
692  ksl=kp0*(1-kposwf)+k*kposwf
693  temp_src=source_column_one(ksl)-source_column_one(ksu)
694  if (present(source_column_two)) temp_src = temp_src * advpos+(source_column_two(ksl)-source_column_two(ksu))*advneg
695  calculate_gradient_term_in_z=abs(specific_face)*rdz(k+kdof)*dt*temp_src
696  end function calculate_gradient_term_in_z
697 
698  real(kind=default_precision) function calculate_gradient_term_in_x(k, column_one, column_two, column_three, column_four, &
699  cx, dt, fc, source_value_one, source_value_two, kpv)
700  integer, intent(in) :: k, kpv
701  real(kind=default_precision), intent(in) :: cx, dt, fc
702  real(kind=default_precision), intent(in) :: source_value_one, source_value_two
703  real(kind=default_precision), intent(in), dimension(:) :: column_one, column_two, column_three, column_four
704 
705  real(kind=default_precision) :: specific_face, posuf
706 
707  specific_face=0.125_default_precision*(column_one(k)+column_two(k)+column_three(k+kpv)+column_four(k+kpv))
708  posuf=0.5_default_precision+sign(real(.5, kind=default_precision), specific_face)
709  calculate_gradient_term_in_x=abs(specific_face)*cx*dt*(fc-(source_value_one*(1.-posuf)+source_value_two*posuf))
710  end function calculate_gradient_term_in_x
711 
712  real(kind=default_precision) function calculate_gradient_term_in_y(k, data, data_y_index, data_x_index, cy, &
713  dt, fc, term_data_one, term_data_one_y_index, term_data_one_x_index, koffset_one, multiplication_factor_one, &
714  term_data_two, term_data_two_y_index, term_data_two_x_index, &
715  koffset_two, multiplication_factor_two, data_two, data_two_y_index, data_two_x_index)
716 
717  integer, intent(in) :: k, data_y_index, data_x_index, term_data_one_y_index, term_data_one_x_index
718  integer, intent(in), optional :: term_data_two_y_index, term_data_two_x_index, data_two_y_index, data_two_x_index
719  integer, intent(in), optional :: koffset_one, koffset_two
720  real(kind=default_precision), intent(in), optional :: multiplication_factor_one, multiplication_factor_two
721  real(kind=default_precision), intent(in) :: cy, dt, fc
722  type(prognostic_field_type), intent(in) :: data, term_data_one
723  type(prognostic_field_type), intent(in), optional :: term_data_two, data_two
724 
725  real(kind=default_precision) :: specific_face, calc_term_one, calc_term_two
726  integer :: jsu, k_index
727 
728  calc_term_two=0.
729 
730  if (present(data_two)) then
731  specific_face=0.125_default_precision*(data%data(k, data_y_index, data_x_index)+&
732  data_two%data(k, data_two_y_index, data_two_x_index)+&
733  data%data(k, data_y_index-1, data_x_index)+ data_two%data(k, data_two_y_index-1, data_two_x_index))
734  else
735  specific_face=0.125_default_precision*(data%data(k, data_y_index-1, data_x_index)+&
736  data%data(k, data_y_index, data_x_index)+&
737  data%data(k+1, data_y_index-1, data_x_index)+data%data(k+1, data_y_index, data_x_index))
738  end if
739 
740  if (present(koffset_one)) then
741  k_index=k+koffset_one
742  else
743  k_index=k
744  end if
745 
746  jsu=term_data_one_y_index-nint(sign(real(1.0, kind=default_precision), specific_face))
747  calc_term_one = term_data_one%data(k_index, jsu, term_data_one_x_index)
748  if (present(multiplication_factor_one)) calc_term_one = calc_term_one * multiplication_factor_one
749  if (present(term_data_two)) then
750  if (present(koffset_two)) then
751  k_index=k+koffset_two
752  else
753  k_index=k
754  end if
755  jsu=term_data_two_y_index-nint(sign(real(1.0, kind=default_precision), specific_face))
756  calc_term_two = term_data_two%data(k_index, jsu, term_data_two_x_index)
757  if (present(multiplication_factor_two)) calc_term_two = calc_term_two * multiplication_factor_two
758  calc_term_one = calc_term_one + calc_term_two
759  end if
760  calculate_gradient_term_in_y=abs(specific_face)*cy*dt*(fc-calc_term_one)
761  end function calculate_gradient_term_in_y
762 end module ultimateflux_mod
ultimateflux_mod::calculate_flux_in_w
real(kind=default_precision) function calculate_flux_in_w(k, data_value, dt, sum_cfl_out, rdc, fdels, fd, fc, fu, rdu, fgt1, fgt2, dzn, rdzn)
Definition: ultimateflux.F90:527
prognostics_mod
Contains prognostic field definitions and functions.
Definition: prognostics.F90:2
ultimateflux_mod::calculate_gradient_term_in_y
real(kind=default_precision) function calculate_gradient_term_in_y(k, data, data_y_index, data_x_index, cy, dt, fc, term_data_one, term_data_one_y_index, term_data_one_x_index, koffset_one, multiplication_factor_one, term_data_two, term_data_two_y_index, term_data_two_x_index, koffset_two, multiplication_factor_two, data_two, data_two_y_index, data_two_x_index)
Definition: ultimateflux.F90:716
ultimateflux_mod::handle_y_direction_fluxes
subroutine handle_y_direction_fluxes(y_flow_index, x_flow_index, u, v, w, y_scalar_index, x_scalar_index, zf, local_grid, grid_config, kdof, dt, flux_y, rdz, kmin, kmax)
Definition: ultimateflux.F90:170
ultimateflux_mod::calculate_flux_in_y
real(kind=default_precision) function calculate_flux_in_y(data_value, dt, sum_cfl_out, fdels, fd, fc, fu, fgt1, fgt2, cy, fcurvs)
Definition: ultimateflux.F90:589
grids_mod::x_index
integer, parameter, public x_index
Definition: grids.F90:14
grids_mod::y_index
integer, parameter, public y_index
Definition: grids.F90:14
ultimateflux_mod::handle_vertical_fluxes_bottomofcolumn
subroutine handle_vertical_fluxes_bottomofcolumn(y_flow_index, x_flow_index, u, v, w, y_scalar_index, x_scalar_index, zf, grid_config, kdof, dt, flux_z, rdz, rdzn, dzn)
Definition: ultimateflux.F90:309
state_mod::parallel_state_type
Information about the parallel aspects of the system.
Definition: state.F90:21
ultimateflux_mod::calculate_gradient_term_in_x
real(kind=default_precision) function calculate_gradient_term_in_x(k, column_one, column_two, column_three, column_four, cx, dt, fc, source_value_one, source_value_two, kpv)
Definition: ultimateflux.F90:700
ultimateflux_mod::calculate_stencil_for_w
subroutine calculate_stencil_for_w(y_flow_index, x_flow_index, y_scalar_index, x_scalar_index, k, advneg, advpos, fc, fcurvs, fd, fdels, fu, kofset, flow_field, zf)
Definition: ultimateflux.F90:660
ultimateflux_mod::calculate_stencil_for_y
subroutine calculate_stencil_for_y(y_flow_index, x_flow_index, y_scalar_index, x_scalar_index, k, advneg, advpos, fc, fcurvs, fd, fdels, fu, jofset, jperiod, flow_field, zf)
Definition: ultimateflux.F90:637
grids_mod::grid_configuration_type
Wraps the dimensional configuration types.
Definition: grids.F90:101
ultimateflux_mod::r6
real(kind=default_precision) r6
A sixth used when calculating fluxes in specific directions.
Definition: ultimateflux.F90:19
ultimateflux_mod
Calculates the effective face values for advection using Leonard's ultimate quickest scheme with firs...
Definition: ultimateflux.F90:6
ultimateflux_mod::handle_vertical_fluxes_topofcolumn
subroutine handle_vertical_fluxes_topofcolumn(y_flow_index, x_flow_index, u, v, w, y_scalar_index, x_scalar_index, zf, local_grid, grid_config, kdof, dt, flux_z, rdz, rdzn, dzn)
Definition: ultimateflux.F90:415
grids_mod::z_index
integer, parameter, public z_index
Grid index parameters.
Definition: grids.F90:14
ultimateflux_mod::handle_vertical_fluxes_middleofcolumn
subroutine handle_vertical_fluxes_middleofcolumn(y_flow_index, x_flow_index, u, v, w, y_scalar_index, x_scalar_index, zf, local_grid, grid_config, kdof, dt, flux_z, rdz, rdzn, dzn)
Definition: ultimateflux.F90:238
ultimateflux_mod::handle_vertical_fluxes
subroutine handle_vertical_fluxes(y_flow_index, x_flow_index, u, v, w, y_scalar_index, x_scalar_index, zf, local_grid, grid_config, kdof, dt, flux_z, rdz, rdzn, dzn, kmin, kmax)
Definition: ultimateflux.F90:64
ultimateflux_mod::calculate_flux_in_x
real(kind=default_precision) function calculate_flux_in_x(data_value, dt, sum_cfl_out, fdels, fd, fc, fu, fgt1, fgt2, cx, fcurvs)
Definition: ultimateflux.F90:561
ultimateflux_mod::ultflx
subroutine, public ultflx(y_flow_index, x_flow_index, u, v, w, y_scalar_index, x_scalar_index, zf, local_grid, grid_config, parallel, kdof, dt, flux_y, flux_z, flux_x, flux_previous_x, rdz, rdzn, dzn, kmin, kmax)
Definition: ultimateflux.F90:25
grids_mod::local_grid_type
Defined the local grid, i.e. the grid held on this process after decomposition.
Definition: grids.F90:118
prognostics_mod::prognostic_field_type
A prognostic field which is assumed to be 3D.
Definition: prognostics.F90:13
datadefn_mod
Contains common definitions for the data and datatypes used by MONC.
Definition: datadefn.F90:2
ultimateflux_mod::calculate_stencil_for_u
subroutine calculate_stencil_for_u(k, advneg, advpos, fc, fcurvs, fd, fdels, fu, flow_field, advection_field_one, advection_field_two, advection_field_three, advection_field_four)
Definition: ultimateflux.F90:618
grids_mod
Functionality to support the different types of grid and abstraction between global grids and local o...
Definition: grids.F90:5
ultimateflux_mod::calculate_gradient_term_in_z
real(kind=default_precision) function calculate_gradient_term_in_z(k, column_one, column_two, dt, advneg, advpos, kdof, kp0, kp1, source_column_one, source_column_two, rdz)
Definition: ultimateflux.F90:680
datadefn_mod::default_precision
integer, parameter, public default_precision
MPI communication type which we use for the prognostic and calculation data.
Definition: datadefn.F90:17
state_mod
The model state which represents the current state of a run.
Definition: state.F90:2
ultimateflux_mod::handle_x_direction_fluxes
subroutine handle_x_direction_fluxes(y_flow_index, x_flow_index, u, v, w, y_scalar_index, x_scalar_index, zf, local_grid, grid_config, kdof, dt, flux_x, rdz, kmin, kmax)
Definition: ultimateflux.F90:83