Skip to content

Commit 697a0ef

Browse files
committed
additional code shortening
1 parent 5e53d53 commit 697a0ef

File tree

4 files changed

+13
-115
lines changed

4 files changed

+13
-115
lines changed

src/common/m_mpi_common.fpp

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ module m_mpi_common
2424
2525
implicit none
2626
27-
integer, private :: err_code, ierr, v_size !<
27+
integer, private :: ierr, v_size !<
2828
!$acc declare create(v_size)
2929
!! Generic flags used to identify and report MPI errors
3030
@@ -123,24 +123,11 @@ contains
123123
!! @param beta Eulerian void fraction from lagrangian bubbles
124124
subroutine s_initialize_mpi_data(q_cons_vf, ib_markers, levelset, levelset_norm, beta)
125125
126-
type(scalar_field), &
127-
dimension(sys_size), &
128-
intent(in) :: q_cons_vf
129-
130-
type(integer_field), &
131-
optional, &
132-
intent(in) :: ib_markers
133-
134-
type(levelset_field), &
135-
optional, &
136-
intent(IN) :: levelset
137-
138-
type(levelset_norm_field), &
139-
optional, &
140-
intent(IN) :: levelset_norm
141-
142-
type(scalar_field), &
143-
intent(in), optional :: beta
126+
type(scalar_field), dimension(sys_size), intent(in) :: q_cons_vf
127+
type(integer_field), optional, intent(in) :: ib_markers
128+
type(levelset_field), optional, intent(IN) :: levelset
129+
type(levelset_norm_field), optional, intent(IN) :: levelset_norm
130+
type(scalar_field), intent(in), optional :: beta
144131
145132
integer, dimension(num_dims) :: sizes_glb, sizes_loc
146133
integer, dimension(1) :: airfoil_glb, airfoil_loc, airfoil_start

src/post_process/m_mpi_proxy.fpp

Lines changed: 4 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,6 @@ module m_mpi_proxy
2323
2424
implicit none
2525
26-
!> @name Buffers of the conservative variables received/sent from/to neighboring
27-
!! processors. Note that these variables are structured as vectors rather
28-
!! than arrays.
29-
!> @{
30-
real(wp), allocatable, dimension(:) :: q_cons_buffer_in
31-
real(wp), allocatable, dimension(:) :: q_cons_buffer_out
32-
!> @}
33-
3426
!> @name Receive counts and displacement vector variables, respectively, used in
3527
!! enabling MPI to gather varying amounts of data from all processes to the
3628
!! root process
@@ -41,7 +33,7 @@ module m_mpi_proxy
4133
4234
!> @name Generic flags used to identify and report MPI errors
4335
!> @{
44-
integer, private :: err_code, ierr
36+
integer, private :: ierr
4537
!> @}
4638
4739
contains
@@ -54,61 +46,6 @@ contains
5446
5547
integer :: i !< Generic loop iterator
5648
57-
! Allocating vectorized buffer regions of conservative variables.
58-
! The length of buffer vectors are set according to the size of the
59-
! largest buffer region in the sub-domain.
60-
if (buff_size > 0) then
61-
62-
! Simulation is at least 2D
63-
if (n > 0) then
64-
65-
! Simulation is 3D
66-
if (p > 0) then
67-
68-
allocate (q_cons_buffer_in(0:buff_size* &
69-
sys_size* &
70-
(m + 2*buff_size + 1)* &
71-
(n + 2*buff_size + 1)* &
72-
(p + 2*buff_size + 1)/ &
73-
(min(m, n, p) &
74-
+ 2*buff_size + 1) - 1))
75-
allocate (q_cons_buffer_out(0:buff_size* &
76-
sys_size* &
77-
(m + 2*buff_size + 1)* &
78-
(n + 2*buff_size + 1)* &
79-
(p + 2*buff_size + 1)/ &
80-
(min(m, n, p) &
81-
+ 2*buff_size + 1) - 1))
82-
83-
! Simulation is 2D
84-
else
85-
86-
allocate (q_cons_buffer_in(0:buff_size* &
87-
sys_size* &
88-
(max(m, n) &
89-
+ 2*buff_size + 1) - 1))
90-
allocate (q_cons_buffer_out(0:buff_size* &
91-
sys_size* &
92-
(max(m, n) &
93-
+ 2*buff_size + 1) - 1))
94-
95-
end if
96-
97-
! Simulation is 1D
98-
else
99-
100-
allocate (q_cons_buffer_in(0:buff_size*sys_size - 1))
101-
allocate (q_cons_buffer_out(0:buff_size*sys_size - 1))
102-
103-
end if
104-
105-
! Initially zeroing out the vectorized buffer region variables
106-
! to avoid possible underflow from any unused allocated memory
107-
q_cons_buffer_in = 0._wp
108-
q_cons_buffer_out = 0._wp
109-
110-
end if
111-
11249
! Allocating and configuring the receive counts and the displacement
11350
! vector variables used in variable-gather communication procedures.
11451
! Note that these are only needed for either multidimensional runs
@@ -366,10 +303,7 @@ contains
366303
subroutine s_mpi_gather_data_extents(q_sf, data_extents)
367304

368305
real(wp), dimension(:, :, :), intent(in) :: q_sf
369-
370-
real(wp), &
371-
dimension(1:2, 0:num_procs - 1), &
372-
intent(inout) :: data_extents
306+
real(wp), dimension(1:2, 0:num_procs - 1), intent(inout) :: data_extents
373307

374308
#ifdef MFC_MPI
375309

@@ -395,13 +329,8 @@ contains
395329
!! @param q_root_sf Flow variable defined on the entire computational domain
396330
subroutine s_mpi_defragment_1d_flow_variable(q_sf, q_root_sf)
397331

398-
real(wp), &
399-
dimension(0:m), &
400-
intent(in) :: q_sf
401-
402-
real(wp), &
403-
dimension(0:m), &
404-
intent(inout) :: q_root_sf
332+
real(wp), dimension(0:m), intent(in) :: q_sf
333+
real(wp), dimension(0:m), intent(inout) :: q_root_sf
405334

406335
#ifdef MFC_MPI
407336

@@ -421,12 +350,6 @@ contains
421350

422351
#ifdef MFC_MPI
423352

424-
! Deallocating the conservative variables buffer vectors
425-
if (buff_size > 0) then
426-
deallocate (q_cons_buffer_in)
427-
deallocate (q_cons_buffer_out)
428-
end if
429-
430353
! Deallocating the receive counts and the displacement vector
431354
! variables used in variable-gather communication procedures
432355
if ((format == 1 .and. n > 0) .or. n == 0) then

src/pre_process/m_mpi_proxy.fpp

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,8 @@ module m_mpi_proxy
2323
2424
implicit none
2525
26-
integer, private :: err_code, ierr, v_size !<
27-
!! Generic flags used to identify and report MPI errors
28-
29-
real(wp), private, allocatable, dimension(:), target :: q_prims_buff_send !<
30-
!! This variable is utilized to pack and send the buffer of the cell-average
31-
!! primitive variables, for a single computational domain boundary at the
32-
!! time, to the relevant neighboring processor.
33-
34-
real(wp), private, allocatable, dimension(:), target :: q_prims_buff_recv !<
35-
!! q_prims_buff_recv is utilized to receive and unpack the buffer of the cell-
36-
!! average primitive variables, for a single computational domain boundary
37-
!! at the time, from the relevant neighboring processor.
38-
39-
! integer :: halo_size
26+
integer, private :: ierr !<
27+
!! Generic flag used to identify and report MPI errors
4028
4129
contains
4230
!> Since only processor with rank 0 is in charge of reading

src/simulation/m_mpi_proxy.fpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ module m_mpi_proxy
4444
4545
!> @name Generic flags used to identify and report MPI errors
4646
!> @{
47-
integer, private :: err_code, ierr
47+
integer, private :: ierr
4848
!> @}
4949
5050
integer :: i_halo_size

0 commit comments

Comments
 (0)