Skip to content

Commit aaaabc7

Browse files
committed
address comments
1 parent e214f26 commit aaaabc7

File tree

8 files changed

+71
-106
lines changed

8 files changed

+71
-106
lines changed

src/common/include/inline_boundary_conditions.fpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@
271271
end do
272272
#:enddef
273273

274-
#:def COLOR_FUNC_BC(DEST, SRC)
274+
#:def COLOR_FUNC_EXTRAPOLATION(DEST, SRC)
275275
do i = 1, num_dims + 1
276276
do j = 1, buff_size
277277
c_divs(i)%sf(${DEST}$) = c_divs(i)%sf(${SRC}$)

src/common/m_boundary_common.fpp

Lines changed: 48 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -52,37 +52,29 @@ contains
5252

5353
subroutine s_initialize_boundary_common_module()
5454

55-
#ifdef MFC_PRE_PROCESS
56-
allocate (bc_buffers(1:num_dims, -1:1))
57-
58-
allocate (bc_buffers(1, -1)%sf(1:sys_size, 0:n, 0:p))
59-
allocate (bc_buffers(1, 1)%sf(1:sys_size, 0:n, 0:p))
60-
if (n > 0) then
61-
allocate (bc_buffers(2, -1)%sf(-buff_size:m + buff_size, 1:sys_size, 0:p))
62-
allocate (bc_buffers(2, 1)%sf(-buff_size:m + buff_size, 1:sys_size, 0:p))
63-
if (p > 0) then
64-
allocate (bc_buffers(3, -1)%sf(-buff_size:m + buff_size, -buff_size:n + buff_size, 1:sys_size))
65-
allocate (bc_buffers(3, 1)%sf(-buff_size:m + buff_size, -buff_size:n + buff_size, 1:sys_size))
66-
end if
67-
end if
68-
#endif
69-
70-
#ifdef MFC_SIMULATION
7155
bcxb = bc_x%beg; bcxe = bc_x%end; bcyb = bc_y%beg; bcye = bc_y%end; bczb = bc_z%beg; bcze = bc_z%end
7256

7357
@:ALLOCATE(bc_buffers(1:num_dims, -1:1))
7458

75-
@:ALLOCATE(bc_buffers(1, -1)%sf(1:sys_size, 0:n, 0:p))
76-
@:ALLOCATE(bc_buffers(1, 1)%sf(1:sys_size, 0:n, 0:p))
77-
@:ACC_SETUP_SFs(bc_buffers(1,-1), bc_buffers(1,1))
78-
if (n > 0) then
79-
@:ALLOCATE(bc_buffers(2,-1)%sf(-buff_size:m+buff_size,1:sys_size,0:p))
80-
@:ALLOCATE(bc_buffers(2,1)%sf(-buff_size:m+buff_size,1:sys_size,0:p))
81-
@:ACC_SETUP_SFs(bc_buffers(2,-1), bc_buffers(2,1))
82-
if (p > 0) then
83-
@:ALLOCATE(bc_buffers(3,-1)%sf(-buff_size:m+buff_size,-buff_size:n+buff_size,1:sys_size))
84-
@:ALLOCATE(bc_buffers(3,1)%sf(-buff_size:m+buff_size,-buff_size:n+buff_size,1:sys_size))
85-
@:ACC_SETUP_SFs(bc_buffers(3,-1), bc_buffers(3,1))
59+
#ifndef MFC_POST_PROCESS
60+
61+
#ifdef MFC_PRE_PROCESS
62+
if (save_bc) then
63+
#elif MFC_SIMULATION
64+
if (read_bc) then
65+
#endif
66+
@:ALLOCATE(bc_buffers(1, -1)%sf(1:sys_size, 0:n, 0:p))
67+
@:ALLOCATE(bc_buffers(1, 1)%sf(1:sys_size, 0:n, 0:p))
68+
@:ACC_SETUP_SFs(bc_buffers(1,-1), bc_buffers(1,1))
69+
if (n > 0) then
70+
@:ALLOCATE(bc_buffers(2,-1)%sf(-buff_size:m+buff_size,1:sys_size,0:p))
71+
@:ALLOCATE(bc_buffers(2,1)%sf(-buff_size:m+buff_size,1:sys_size,0:p))
72+
@:ACC_SETUP_SFs(bc_buffers(2,-1), bc_buffers(2,1))
73+
if (p > 0) then
74+
@:ALLOCATE(bc_buffers(3,-1)%sf(-buff_size:m+buff_size,-buff_size:n+buff_size,1:sys_size))
75+
@:ALLOCATE(bc_buffers(3,1)%sf(-buff_size:m+buff_size,-buff_size:n+buff_size,1:sys_size))
76+
@:ACC_SETUP_SFs(bc_buffers(3,-1), bc_buffers(3,1))
77+
end if
8678
end if
8779
end if
8880
#endif
@@ -425,11 +417,11 @@ contains
425417
do l = 0, p
426418
do k = 0, n
427419
if (bc_type(1, -1)%sf(0, k, l) == -1) then
428-
${COLOR_FUNC_BC("-j,k,l","m - (j-1),k,l")}$
420+
${COLOR_FUNC_EXTRAPOLATION("-j,k,l","m - (j-1),k,l")}$
429421
elseif (bc_type(1, -1)%sf(0, k, l) == -2) then
430422
${COLOR_FUNC_SLIP_WALL_BC(1,"-j,k,l","j-1,k,l")}$
431423
else
432-
${COLOR_FUNC_BC("-j,k,l","0,k,l")}$
424+
${COLOR_FUNC_EXTRAPOLATION("-j,k,l","0,k,l")}$
433425
end if
434426
end do
435427
end do
@@ -442,11 +434,11 @@ contains
442434
do l = 0, p
443435
do k = 0, n
444436
if (bc_type(1, 1)%sf(0, k, l) == -1) then
445-
${COLOR_FUNC_BC("m+j,k,l","j-1,k,l")}$
437+
${COLOR_FUNC_EXTRAPOLATION("m+j,k,l","j-1,k,l")}$
446438
elseif (bc_type(1, 1)%sf(0, k, l) == -2) then
447439
${COLOR_FUNC_SLIP_WALL_BC(1,"m+j,k,l","m - (j-1),k,l")}$
448440
else
449-
${COLOR_FUNC_BC("m+j,k,l","m,k,l")}$
441+
${COLOR_FUNC_EXTRAPOLATION("m+j,k,l","m,k,l")}$
450442
end if
451443
end do
452444
end do
@@ -462,11 +454,11 @@ contains
462454
do l = 0, p
463455
do k = -buff_size, m + buff_size
464456
if (bc_type(2, -1)%sf(k, 0, l) == -1) then
465-
${COLOR_FUNC_BC("k,-j,l","k,n - (j-1),l")}$
457+
${COLOR_FUNC_EXTRAPOLATION("k,-j,l","k,n - (j-1),l")}$
466458
elseif (bc_type(2, -1)%sf(k, 0, l) == -2) then
467459
${COLOR_FUNC_SLIP_WALL_BC(2,"k,-j,l","k,j-1,l")}$
468460
else
469-
${COLOR_FUNC_BC("k,-j,l","k,0,l")}$
461+
${COLOR_FUNC_EXTRAPOLATION("k,-j,l","k,0,l")}$
470462
end if
471463
end do
472464
end do
@@ -479,11 +471,11 @@ contains
479471
do l = 0, p
480472
do k = -buff_size, m + buff_size
481473
if (bc_type(2, 1)%sf(k, 0, l) == -1) then
482-
${COLOR_FUNC_BC("k,n+j,l","k,j-1,l")}$
474+
${COLOR_FUNC_EXTRAPOLATION("k,n+j,l","k,j-1,l")}$
483475
elseif (bc_type(2, 1)%sf(k, 0, l) == -2) then
484476
${COLOR_FUNC_SLIP_WALL_BC(2,"k,n+j,l","k,n - (j-1),l")}$
485477
else
486-
${COLOR_FUNC_BC("k,n+j,l","k,n,l")}$
478+
${COLOR_FUNC_EXTRAPOLATION("k,n+j,l","k,n,l")}$
487479
end if
488480
end do
489481
end do
@@ -499,11 +491,11 @@ contains
499491
do l = -buff_size, n + buff_size
500492
do k = -buff_size, m + buff_size
501493
if (bc_type(3, -1)%sf(k, l, 0) == -1) then
502-
${COLOR_FUNC_BC("k,l,-j","k,l,p - (j-1)")}$
494+
${COLOR_FUNC_EXTRAPOLATION("k,l,-j","k,l,p - (j-1)")}$
503495
elseif (bc_type(3, -1)%sf(k, l, 0) == -2) then
504496
${COLOR_FUNC_SLIP_WALL_BC(3,"k,l,-j","k,l,j-1")}$
505497
else
506-
${COLOR_FUNC_BC("k,l,-j","k,l,0")}$
498+
${COLOR_FUNC_EXTRAPOLATION("k,l,-j","k,l,0")}$
507499
end if
508500
end do
509501
end do
@@ -516,11 +508,11 @@ contains
516508
do l = -buff_size, n + buff_size
517509
do k = -buff_size, m + buff_size
518510
if (bc_type(3, 1)%sf(k, l, 0) == -1) then
519-
${COLOR_FUNC_BC("k,l,p+j","k,l,j-1")}$
511+
${COLOR_FUNC_EXTRAPOLATION("k,l,p+j","k,l,j-1")}$
520512
elseif (bc_type(3, 1)%sf(k, l, 0) == -2) then
521513
${COLOR_FUNC_SLIP_WALL_BC(3,"k,l,p+j","k,l,p - (j-1)")}$
522514
else
523-
${COLOR_FUNC_BC("k,l,p+j","k,l,p")}$
515+
${COLOR_FUNC_EXTRAPOLATION("k,l,p+j","k,l,p")}$
524516
end if
525517
end do
526518
end do
@@ -564,18 +556,27 @@ contains
564556

565557
subroutine s_finalize_boundary_common_module()
566558

567-
deallocate (bc_buffers(1, -1)%sf)
568-
deallocate (bc_buffers(1, 1)%sf)
569-
if (n > 0) then
570-
deallocate (bc_buffers(2, -1)%sf)
571-
deallocate (bc_buffers(2, 1)%sf)
572-
if (p > 0) then
573-
deallocate (bc_buffers(3, -1)%sf)
574-
deallocate (bc_buffers(3, 1)%sf)
559+
#ifndef MFC_POST_PROCESS
560+
561+
#ifdef MFC_PRE_PROCESS
562+
if (save_bc) then
563+
#elif MFC_SIMULATION
564+
if (read_bc) then
565+
#endif
566+
deallocate (bc_buffers(1, -1)%sf)
567+
deallocate (bc_buffers(1, 1)%sf)
568+
if (n > 0) then
569+
deallocate (bc_buffers(2, -1)%sf)
570+
deallocate (bc_buffers(2, 1)%sf)
571+
if (p > 0) then
572+
deallocate (bc_buffers(3, -1)%sf)
573+
deallocate (bc_buffers(3, 1)%sf)
574+
end if
575575
end if
576576
end if
577577

578578
deallocate (bc_buffers)
579+
#endif
579580

580581
end subroutine s_finalize_boundary_common_module
581582

src/common/m_constants.fpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,10 @@ module m_constants
2121
integer, parameter :: fourier_rings = 5 !< Fourier filter ring limit
2222
integer, parameter :: num_fluids_max = 10 !< Maximum number of fluids in the simulation
2323
integer, parameter :: num_probes_max = 10 !< Maximum number of flow probes in the simulation
24-
integer, parameter :: num_patches_max = 25
24+
integer, parameter :: num_patches_max = 10
2525
integer, parameter :: num_bc_patches_max = 10
2626
integer, parameter :: pathlen_max = 400
2727
integer, parameter :: nnode = 4 !< Number of QBMM nodes
28-
real(wp), parameter :: dflt_alf_factor = 10._wp
2928
integer, parameter :: gp_layers = 3 !< Number of ghost point layers for IBM
3029
real(wp), parameter :: capillary_cutoff = 1e-6 !< color function gradient magnitude at which to apply the surface tension fluxes
3130
real(wp), parameter :: acoustic_spatial_support_width = 2.5_wp !< Spatial support width of acoustic source, used in s_source_spatial

src/common/m_mpi_common.fpp

Lines changed: 17 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -50,76 +50,46 @@ contains
5050
subroutine s_initialize_mpi_common_module
5151
5252
#ifdef MFC_MPI
53-
54-
#ifdef MFC_PRE_PROCESS
55-
if (n > 0) then
56-
if (p > 0) then
57-
58-
halo_size = -1 + buff_size*sys_size* &
59-
& (m + 2*buff_size + 1)* &
60-
& (n + 2*buff_size + 1)* &
61-
& (p + 2*buff_size + 1)/ &
62-
& (min(m, n, p) + 2*buff_size + 1)
63-
else
64-
halo_size = -1 + buff_size*sys_size* &
65-
& (max(m, n) + 2*buff_size + 1)
66-
end if
67-
else
68-
halo_size = -1 + buff_size*sys_size
69-
end if
70-
71-
v_size = sys_size
72-
73-
allocate (q_prims_buff_send(0:halo_size))
74-
75-
allocate (q_prims_buff_recv(0:ubound(q_prims_buff_send, 1)))
76-
#endif
77-
7853
! Allocating q_prims_buff_send/recv and ib_buff_send/recv. Please note that
7954
! for the sake of simplicity, both variables are provided sufficient
8055
! storage to hold the largest buffer in the computational domain.
81-
#ifdef MFC_SIMULATION
8256
if (qbmm .and. .not. polytropic) then
8357
if (n > 0) then
8458
if (p > 0) then
85-
@:ALLOCATE(q_prims_buff_send(0:-1 + buff_size*(sys_size + 2*nb*4)* &
59+
halo_size = -1 + buff_size*(sys_size + 2*nb*4)* &
8660
& (m + 2*buff_size + 1)* &
8761
& (n + 2*buff_size + 1)* &
8862
& (p + 2*buff_size + 1)/ &
89-
& (min(m, n, p) + 2*buff_size + 1)))
63+
& (min(m, n, p) + 2*buff_size + 1)
9064
else
91-
@:ALLOCATE(q_prims_buff_send(0:-1 + buff_size*(sys_size + 2*nb*4)* &
92-
& (max(m, n) + 2*buff_size + 1)))
65+
halo_size = -1 + buff_size*(sys_size + 2*nb*4)* &
66+
& (max(m, n) + 2*buff_size + 1)
9367
end if
9468
else
95-
@:ALLOCATE(q_prims_buff_send(0:-1 + buff_size*(sys_size + 2*nb*4)))
69+
halo_size = -1 + buff_size*(sys_size + 2*nb*4)
9670
end if
97-
98-
@:ALLOCATE(q_prims_buff_recv(0:ubound(q_prims_buff_send, 1)))
99-
100-
v_size = sys_size + 2*nb*4
10171
else
10272
if (n > 0) then
10373
if (p > 0) then
104-
@:ALLOCATE(q_prims_buff_send(0:-1 + buff_size*sys_size* &
105-
& (m + 2*buff_size + 1)* &
106-
& (n + 2*buff_size + 1)* &
107-
& (p + 2*buff_size + 1)/ &
108-
& (min(m, n, p) + 2*buff_size + 1)))
74+
halo_size = -1 + buff_size*sys_size* &
75+
& (m + 2*buff_size + 1)* &
76+
& (n + 2*buff_size + 1)* &
77+
& (p + 2*buff_size + 1)/ &
78+
& (min(m, n, p) + 2*buff_size + 1)
10979
else
110-
@:ALLOCATE(q_prims_buff_send(0:-1 + buff_size*sys_size* &
111-
& (max(m, n) + 2*buff_size + 1)))
80+
halo_size = -1 + buff_size*sys_size* &
81+
& (max(m, n) + 2*buff_size + 1)
11282
end if
11383
else
114-
@:ALLOCATE(q_prims_buff_send(0:-1 + buff_size*sys_size))
84+
halo_size = -1 + buff_size*sys_size
11585
end if
86+
end if
11687
117-
@:ALLOCATE(q_prims_buff_recv(0:ubound(q_prims_buff_send, 1)))
88+
v_size = sys_size
11889
119-
v_size = sys_size
120-
end if
121-
#endif
90+
allocate (q_prims_buff_send(0:halo_size))
12291
92+
allocate (q_prims_buff_recv(0:ubound(q_prims_buff_send, 1)))
12393
#endif
12494
12595
end subroutine s_initialize_mpi_common_module

src/pre_process/m_checker.fpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,10 @@ contains
201201
subroutine s_check_bc
202202

203203
integer :: i
204+
character(len=5) :: iStr !< for int to string conversion
204205

205-
@:PROHIBIT(num_bc_patches > num_bc_patches_max, "num_bc_patches must be <= 10")
206+
call s_int_to_str(i, iStr)
207+
@:PROHIBIT(num_bc_patches > num_bc_patches_max, "num_bc_patches must be <= "//trim(iStr))
206208

207209
do i = 1, num_bc_patches
208210

src/pre_process/m_perturbation.fpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ module m_perturbation
1515
use m_eigen_solver ! Subroutines to solve eigenvalue problem for
1616

1717
use m_boundary_common ! Boundary conditions module
18-
! complex general matrix
19-
20-
use m_helper
2118

2219
use ieee_arithmetic
2320

@@ -31,8 +28,6 @@ module m_perturbation
3128

3229
real(wp), allocatable, dimension(:, :, :, :) :: q_prim_temp
3330

34-
! real(wp) :: bcxb, bcxe, bcyb, bcye, bczb, bcze
35-
3631
contains
3732

3833
subroutine s_initialize_perturbation_module()

src/pre_process/m_start_up.fpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -780,7 +780,6 @@ contains
780780
pref = 1._wp
781781
end if
782782
call s_initialize_mpi_common_module()
783-
! call s_initialize_mpi_proxy_module()
784783
call s_initialize_data_output_module()
785784
call s_initialize_variables_conversion_module()
786785
call s_initialize_grid_module()
@@ -933,7 +932,6 @@ contains
933932

934933
! Deallocation procedures for the modules
935934
call s_finalize_mpi_common_module()
936-
! call s_finalize_mpi_proxy_module()
937935
call s_finalize_grid_module()
938936
call s_finalize_variables_conversion_module()
939937
call s_finalize_data_output_module()

toolchain/mfc/run/case_dicts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def analytic(self):
103103
'bubbles_lagrange': ParamType.LOG,
104104
})
105105

106-
for ib_id in range(1, 25+1):
106+
for ib_id in range(1, 10+1):
107107
for real_attr, ty in [("geometry", ParamType.INT), ("radius", ParamType.REAL),
108108
("theta", ParamType.REAL), ("slip", ParamType.LOG),
109109
("c", ParamType.REAL), ("p", ParamType.REAL),

0 commit comments

Comments
 (0)