@@ -43,6 +43,13 @@ module m_global_parameters
4343 integer :: m, n, p
4444 !> @}
4545
46+ !> @name Max and min number of cells in a direction of each combination of x- ,y- , and z-
47+ !> @{
48+ integer :: mn_max, np_max, mp_max, mnp_max
49+ integer :: mn_min, np_min, mp_min, mnp_min
50+
51+ !> @}
52+
4653 !> @name Global number of cells in each direction
4754 !> @{
4855 integer :: m_glb, n_glb, p_glb
@@ -267,6 +274,7 @@ module m_global_parameters
267274 !! numbers, will be non- negligible.
268275 !> @{
269276 integer , dimension (2 ) :: Re_size
277+ integer :: Re_size_max
270278 integer , allocatable, dimension (:, :) :: Re_idx
271279 !> @}
272280
@@ -516,6 +524,16 @@ contains
516524 ! Computational domain parameters
517525 m = dflt_int; n = 0; p = 0
518526
527+ ! Update the min and max of the cells in each direction
528+ mn_max = max(m, n)
529+ np_max = max(n, p)
530+ mp_max = max(m, p)
531+ mnp_max = max(m, n, p)
532+ mn_min = min(m, n)
533+ np_min = min(n, p)
534+ mp_min = min(m, p)
535+ mnp_min = min(m, n, p)
536+
519537 cyl_coord = .false.
520538
521539 dt = dflt_real
@@ -1028,13 +1046,15 @@ contains
10281046 if (Re_size(1) > 0._wp) shear_stress = .true.
10291047 if (Re_size(2) > 0._wp) bulk_stress = .true.
10301048
1049+ Re_size_max = maxval(Re_size)
1050+
10311051 !$acc update device(Re_size, viscous, shear_stress, bulk_stress)
10321052
10331053 ! Bookkeeping the indexes of any viscous fluids and any pairs of
10341054 ! fluids whose interface will support effects of surface tension
10351055 if (viscous) then
10361056
1037- @:ALLOCATE(Re_idx(1:2, 1:maxval(Re_size) ))
1057+ @:ALLOCATE(Re_idx(1:2, 1:Re_size_max ))
10381058
10391059 k = 0
10401060 do i = 1, num_fluids
0 commit comments