Skip to content
24 changes: 24 additions & 0 deletions src/post_process/m_global_parameters.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,23 @@ contains
fluid_pp(i)%mu_bulk = dflt_real
end do

num_particle_clouds = 0
do i = 1, num_particle_clouds_max
particle_cloud(i)%x_centroid = 0._wp
particle_cloud(i)%y_centroid = 0._wp
particle_cloud(i)%z_centroid = 0._wp
particle_cloud(i)%length_x = dflt_real
particle_cloud(i)%length_y = dflt_real
particle_cloud(i)%length_z = dflt_real
particle_cloud(i)%num_particles = 0
particle_cloud(i)%radius = dflt_real
particle_cloud(i)%mass = dflt_real
particle_cloud(i)%min_spacing = 0._wp
particle_cloud(i)%moving_ibm = 0
particle_cloud(i)%seed = 0
particle_cloud(i)%packing_method = dflt_int
end do

! Subgrid bubble parameters (bub_pp struct + scalar companions; bub_pp%R0ref is set in common
! via R0ref; the scalar companions are per-target manual declarations)
bub_pp%R0ref = dflt_real; R0ref = dflt_real
Expand Down Expand Up @@ -322,6 +339,13 @@ contains
! defaulted on non-root ranks nor broadcast. Post-process never carries viscous stresses.
viscous = .false.

! Particle clouds expand into individual IB patches at simulation startup, so num_ibs as read
! from the case file counts only the namelist patches. Match the global count the simulation
! arrives at (s_reduce_ib_patch_array) so the IB state records can be read back.
do i = 1, num_particle_clouds
num_ibs = num_ibs + particle_cloud(i)%num_particles
end do
Comment on lines +342 to +347

! Gamma/Pi_inf: force num_fluids=1 (post_process-specific side effect of the gamma-law model)
if (model_eqns == model_eqns_gamma_law) num_fluids = 1

Expand Down
12 changes: 12 additions & 0 deletions src/post_process/m_mpi_proxy.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,18 @@ contains
#:endfor
#:endfor

! manual: particle_cloud (runtime loop to num_particle_clouds; irregular member subset)
do i = 1, num_particle_clouds
#:for VAR in ['x_centroid', 'y_centroid', 'z_centroid', 'length_x', 'length_y', 'length_z', &
& 'radius', 'mass', 'min_spacing']
call MPI_BCAST(particle_cloud(i)%${VAR}$, 1, mpi_p, 0, MPI_COMM_WORLD, ierr)
Comment on lines +98 to +100
#:endfor
call MPI_BCAST(particle_cloud(i)%num_particles, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr)
call MPI_BCAST(particle_cloud(i)%moving_ibm, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr)
call MPI_BCAST(particle_cloud(i)%seed, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr)
call MPI_BCAST(particle_cloud(i)%packing_method, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr)
end do

! manual: cfl_dt (runtime-computed logical), bc_io (BC-file existence)
call MPI_BCAST(cfl_dt, 1, MPI_LOGICAL, 0, MPI_COMM_WORLD, ierr)
call MPI_BCAST(bc_io, 1, MPI_LOGICAL, 0, MPI_COMM_WORLD, ierr)
Expand Down
2 changes: 0 additions & 2 deletions src/simulation/m_collisions.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,6 @@ contains
integer :: gp_idx, i, j, k, patch_id
real(wp) :: edge_location, overlap_distance

! iterate over all ghost points to detect the one that is most-overlapping in each direction

$:GPU_PARALLEL_LOOP(private='[patch_id, edge_location, overlap_distance]')
do patch_id = 1, num_ibs
#:for X, DIR, IDX in [('x', 1, 1), ('y', 2, 3), ('z', 3, 5)]
Expand Down
2 changes: 1 addition & 1 deletion src/simulation/m_global_parameters.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ module m_global_parameters
$:GPU_DECLARE(create='[bc_x%vb1, bc_x%vb2, bc_x%vb3, bc_x%ve1, bc_x%ve2, bc_x%ve3]')
$:GPU_DECLARE(create='[bc_y%vb1, bc_y%vb2, bc_y%vb3, bc_y%ve1, bc_y%ve2, bc_y%ve3]')
$:GPU_DECLARE(create='[bc_z%vb1, bc_z%vb2, bc_z%vb3, bc_z%ve1, bc_z%ve2, bc_z%ve3]')
$:GPU_DECLARE(create='[ib_bc_x%beg, ib_bc_y%beg, ib_bc_z%beg]')
$:GPU_DECLARE(create='[ib_bc_x%beg, ib_bc_x%end, ib_bc_y%beg, ib_bc_y%end, ib_bc_z%beg, ib_bc_z%end]')
#elif defined(MFC_OpenMP)
$:GPU_DECLARE(create='[bc_x, bc_y, bc_z]')
$:GPU_DECLARE(create='[ib_bc_x, ib_bc_y, ib_bc_z]')
Expand Down
4 changes: 2 additions & 2 deletions src/simulation/m_ibm.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ contains
call nvtxStartRange("SETUP-IBM-MODULE")

! GPU routines require updated cell centers
$:GPU_UPDATE(device='[num_ibs, num_gbl_ibs, x_cc, y_cc, dx, dy, ib_bc_x%beg, ib_bc_y%beg]')
$:GPU_UPDATE(device='[num_ibs, num_gbl_ibs, x_cc, y_cc, dx, dy, ib_bc_x%beg, ib_bc_x%end, ib_bc_y%beg, ib_bc_y%end]')
if (p /= 0) then
$:GPU_UPDATE(device='[z_cc, dz, ib_bc_z%beg]')
$:GPU_UPDATE(device='[z_cc, dz, ib_bc_z%beg, ib_bc_z%end]')
end if
$:GPU_UPDATE(device='[patch_ib(1:num_ibs), glb_bounds]')

Expand Down
4 changes: 2 additions & 2 deletions toolchain/mfc/params/definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1308,6 +1308,8 @@ def _decl(targets: set, *names: str) -> None:
"avg_state",
"alt_soundspeed",
"mixture_err",
"num_particle_clouds",
"particle_cloud",
)
_nv(
_PRE_SIM,
Expand Down Expand Up @@ -1389,10 +1391,8 @@ def _decl(targets: set, *names: str) -> None:
"coefficient_of_restitution",
"collision_time",
"ib_coefficient_of_friction",
"num_particle_clouds",
"ib_neighborhood_radius",
"many_ib_patch_parallelism",
"particle_cloud",
"tau_star",
"cont_damage_s",
"alpha_bar",
Expand Down
Loading