Skip to content

Commit 4ab107d

Browse files
committed
moved domain_glb to global_parameters
1 parent 6c3975a commit 4ab107d

5 files changed

Lines changed: 36 additions & 42 deletions

File tree

src/common/m_mpi_common.fpp

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,6 @@ module m_mpi_common
4545
integer(kind=8) :: halo_size
4646
$:GPU_DECLARE(create='[halo_size]')
4747
48-
real(wp), allocatable, dimension(:, :), public :: domain_glb
49-
$:GPU_DECLARE(create='[domain_glb]')
50-
!! This variable holds the physical locations of the global domain bounds
51-
5248
contains
5349
5450
!> The computation of parameters, the allocation of memory,
@@ -1892,45 +1888,11 @@ contains
18921888
end subroutine s_mpi_sendrecv_grid_variables_buffers
18931889
#endif
18941890
1895-
!> The goal of this subroutine is to determine the physical global domain bounds
1896-
#ifndef MFC_POST_PROCESS
1897-
impure subroutine s_mpi_global_domain_bounds
1898-
@:ALLOCATE(domain_glb(num_dims, 2))
1899-
#ifdef MFC_MPI
1900-
call s_mpi_allreduce_min(x_domain%beg, domain_glb(1, 1))
1901-
call s_mpi_allreduce_max(x_domain%end, domain_glb(1, 2))
1902-
if (n > 0) then ! 2D
1903-
call s_mpi_allreduce_min(y_domain%beg, domain_glb(2, 1))
1904-
call s_mpi_allreduce_max(y_domain%end, domain_glb(2, 2))
1905-
if (p > 0) then ! 3D
1906-
call s_mpi_allreduce_min(z_domain%beg, domain_glb(3, 1))
1907-
call s_mpi_allreduce_max(z_domain%end, domain_glb(3, 2))
1908-
end if
1909-
end if
1910-
#else
1911-
domain_glb(1, 1) = x_domain%beg
1912-
domain_glb(1, 2) = x_domain%end
1913-
if (n > 0) then ! 2D
1914-
domain_glb(2, 1) = y_domain%beg
1915-
domain_glb(2, 2) = y_domain%end
1916-
if (p > 0) then ! 3D
1917-
domain_glb(3, 1) = z_domain%beg
1918-
domain_glb(3, 2) = z_domain%end
1919-
end if
1920-
end if
1921-
#endif
1922-
$:GPU_UPDATE(device='[domain_glb]')
1923-
end subroutine s_mpi_global_domain_bounds
1924-
#endif
1925-
19261891
!> Module deallocation and/or disassociation procedures
19271892
impure subroutine s_finalize_mpi_common_module
19281893
19291894
#ifdef MFC_MPI
19301895
deallocate (buff_send, buff_recv)
1931-
#ifndef MFC_POST_PROCESS
1932-
@:DEALLOCATE(domain_glb)
1933-
#endif
19341896
#endif
19351897
19361898
end subroutine s_finalize_mpi_common_module

src/pre_process/m_global_parameters.fpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,9 @@ module m_global_parameters
303303
logical :: fft_wrt
304304
logical :: dummy !< AMDFlang workaround: keep a dummy logical to avoid a compiler case-optimization bug when a parameter+GPU-kernel conditional is false
305305

306+
!< global domain bounds
307+
real(wp), allocatable, dimension(:, :) :: domain_glb
308+
306309
contains
307310

308311
!> Assigns default values to user inputs prior to reading
@@ -973,6 +976,18 @@ contains
973976
allocate (logic_grid(0:m, 0:n, 0:p))
974977
end if
975978

979+
allocate (domain_glb(num_dims, 2))
980+
domain_glb(1, 1) = x_domain%beg
981+
domain_glb(1, 2) = x_domain%end
982+
if (n > 0) then ! 2D
983+
domain_glb(2, 1) = y_domain%beg
984+
domain_glb(2, 2) = y_domain%end
985+
if (p > 0) then ! 3D
986+
domain_glb(3, 1) = z_domain%beg
987+
domain_glb(3, 2) = z_domain%end
988+
end if
989+
end if
990+
976991
end subroutine s_initialize_global_parameters_module
977992

978993
impure subroutine s_initialize_parallel_io
@@ -1028,6 +1043,8 @@ contains
10281043

10291044
deallocate (proc_coords)
10301045

1046+
deallocate (domain_glb)
1047+
10311048
#ifdef MFC_MPI
10321049

10331050
if (parallel_io) then

src/pre_process/m_start_up.fpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -820,8 +820,6 @@ contains
820820
end if
821821
end if
822822

823-
call s_mpi_global_domain_bounds()
824-
825823
end subroutine s_read_grid
826824

827825
impure subroutine s_apply_initial_condition(start, finish)

src/simulation/m_global_parameters.fpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,10 @@ module m_global_parameters
554554
$:GPU_DECLARE(create='[tau_star,cont_damage_s,alpha_bar]')
555555
!> @}
556556
557+
!< global domain bounds
558+
real(wp), allocatable, dimension(:, :) :: domain_glb
559+
$:GPU_DECLARE(create='[domain_glb]')
560+
557561
contains
558562
559563
!> Assigns default values to the user inputs before reading
@@ -1301,6 +1305,19 @@ contains
13011305
13021306
$:GPU_UPDATE(device='[relax,relax_model,palpha_eps,ptgalpha_eps]')
13031307
1308+
@:ALLOCATE(domain_glb(num_dims, 2))
1309+
domain_glb(1, 1) = x_domain%beg
1310+
domain_glb(1, 2) = x_domain%end
1311+
if (n > 0) then ! 2D
1312+
domain_glb(2, 1) = y_domain%beg
1313+
domain_glb(2, 2) = y_domain%end
1314+
if (p > 0) then ! 3D
1315+
domain_glb(3, 1) = z_domain%beg
1316+
domain_glb(3, 2) = z_domain%end
1317+
end if
1318+
end if
1319+
$:GPU_UPDATE(device='[domain_glb]')
1320+
13041321
! Allocating grid variables for the x-, y- and z-directions
13051322
@:ALLOCATE(x_cb(-1 - buff_size:m + buff_size))
13061323
@:ALLOCATE(x_cc(-buff_size:m + buff_size))
@@ -1409,6 +1426,8 @@ contains
14091426
if (p == 0) return;
14101427
@:DEALLOCATE(z_cb, z_cc, dz)
14111428
1429+
@:DEALLOCATE(domain_glb)
1430+
14121431
end subroutine s_finalize_global_parameters_module
14131432
14141433
end module m_global_parameters

src/simulation/m_start_up.fpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1366,8 +1366,6 @@ contains
13661366
call s_read_data_files(q_cons_ts(1)%vf)
13671367
end if
13681368

1369-
call s_mpi_global_domain_bounds()
1370-
13711369
! Populating the buffers of the grid variables using the boundary conditions
13721370
call s_populate_grid_variables_buffers()
13731371

0 commit comments

Comments
 (0)