Skip to content

Commit c9dd5c5

Browse files
1535 particle bed modificaiton and alternative packing algorithms (#1539)
1 parent 68dbb6b commit c9dd5c5

16 files changed

Lines changed: 337 additions & 294 deletions

File tree

docs/documentation/case.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ This is enabled by adding ``'elliptic_smoothing': "T",`` and ``'elliptic_smoothi
313313
| ---: | :----: | :--- |
314314
| `num_ibs` | Integer | Number of immersed boundary patches |
315315
| `num_stl_models` | Integer | Number of STL/OBJ model entries in the `stl_models` array |
316-
| `num_particle_beds` | Integer | Number of particle bed specifications to generate immersed boundary patches from |
316+
| `num_particle_clouds` | Integer | Number of particle bed specifications to generate immersed boundary patches from |
317317
| `ib_neighborhood_radius` | Integer | Parameter that controls the neighborhood size for IB detection. |
318318
| `geometry` | Integer | Geometry configuration of the patch.|
319319
| `x[y,z]_centroid` | Real | Centroid of the applied geometry in the [x,y,z]-direction. |

docs/module_categories.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
"m_compute_cbc",
3939
"m_boundary_common",
4040
"m_ibm",
41-
"m_particle_bed",
41+
"m_particle_cloud",
4242
"m_igr",
4343
"m_ib_patches",
4444
"m_compute_levelset"
Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -85,19 +85,20 @@
8585
"collision_time": collision_time,
8686
"ib_coefficient_of_friction": 0.1,
8787
# Particle bed: 20 free-floating circles placed randomly in region
88-
"num_particle_beds": 1,
89-
"particle_bed(1)%x_centroid": bed_x,
90-
"particle_bed(1)%y_centroid": bed_y,
91-
"particle_bed(1)%z_centroid": 0.0,
92-
"particle_bed(1)%length_x": bed_lx,
93-
"particle_bed(1)%length_y": bed_ly,
94-
"particle_bed(1)%length_z": 0.0,
95-
"particle_bed(1)%num_particles": 20,
96-
"particle_bed(1)%radius": particle_radius,
97-
"particle_bed(1)%mass": particle_mass,
98-
"particle_bed(1)%min_spacing": particle_min_spacing,
99-
"particle_bed(1)%moving_ibm": 2,
100-
"particle_bed(1)%seed": 42,
88+
"num_particle_clouds": 1,
89+
"particle_cloud(1)%x_centroid": bed_x,
90+
"particle_cloud(1)%y_centroid": bed_y,
91+
"particle_cloud(1)%z_centroid": 0.0,
92+
"particle_cloud(1)%length_x": bed_lx,
93+
"particle_cloud(1)%length_y": bed_ly,
94+
"particle_cloud(1)%length_z": 0.0,
95+
"particle_cloud(1)%num_particles": 20,
96+
"particle_cloud(1)%radius": particle_radius,
97+
"particle_cloud(1)%mass": particle_mass,
98+
"particle_cloud(1)%min_spacing": particle_min_spacing,
99+
"particle_cloud(1)%moving_ibm": 2,
100+
"particle_cloud(1)%seed": 42,
101+
"particle_cloud(1)%packing_method": 1,
101102
# Output
102103
"format": 1,
103104
"precision": 2,

src/common/m_constants.fpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ module m_constants
3131
!> Fixed capacity of patch_ib (namelist patches + local particle bed subset after reduction)
3232
integer, parameter :: num_ib_patches_max_namelist = 54000
3333
integer, parameter :: num_local_ibs_max = 2000 !< Maximum number of immersed boundary patches (patch_ib)
34-
integer, parameter :: num_particle_beds_max = 10 !< Maximum number of particle bed patch specifications
34+
integer, parameter :: num_particle_clouds_max = 10 !< Maximum number of particle bed patch specifications
3535
integer, parameter :: num_bc_patches_max = 10 !< Maximum number of boundary condition patches
3636
integer, parameter :: max_2d_fourier_modes = 10 !< Max Fourier mode index for 2D modal patch (geometry 13)
3737
integer, parameter :: max_sph_harm_degree = 5 !< Max degree L for 3D spherical harmonic patch (geometry 14)

src/common/m_derived_types.fpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ module m_derived_types
320320
real(wp), dimension(1:3) :: step_angular_vel !< velocity array used to store intermediate steps in the time_stepper module
321321
end type ib_patch_parameters
322322

323-
type particle_bed_parameters
323+
type particle_cloud_parameters
324324
real(wp) :: x_centroid, y_centroid, z_centroid !< Center of the particle bed region
325325
real(wp) :: length_x, length_y, length_z !< Dimensions of the particle bed region
326326
integer :: num_particles !< Number of particles to generate
@@ -329,7 +329,8 @@ module m_derived_types
329329
real(wp) :: min_spacing !< Minimum surface-to-surface gap (particle centers are 2*radius + min_spacing apart)
330330
integer :: moving_ibm !< Motion flag: 0=static, 1=moving (forces), 2=forced path
331331
integer :: seed !< Random seed for reproducible placement
332-
end type particle_bed_parameters
332+
integer :: packing_method !< Packing algorithm: 1=rejection sampling
333+
end type particle_cloud_parameters
333334

334335
!> Derived type annexing the physical parameters (PP) of the fluids. These include the specific heat ratio function and liquid
335336
!! stiffness function.

src/simulation/m_checker.fpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ contains
3838

3939
@:PROHIBIT(ib_state_wrt .and. .not. ib, "ib_state_wrt requires ib to be enabled")
4040

41+
if (num_particle_clouds > 0) then
42+
call s_check_inputs_particle_clouds
43+
end if
44+
4145
end subroutine s_check_inputs
4246

4347
!> Checks constraints on compiler options
@@ -106,4 +110,21 @@ contains
106110

107111
end subroutine s_check_inputs_nvidia_uvm
108112

113+
!> Checks that each active particle cloud has a valid packing_method specified
114+
impure subroutine s_check_inputs_particle_clouds
115+
116+
integer :: i
117+
character(len=5) :: idxStr
118+
119+
do i = 1, num_particle_clouds
120+
call s_int_to_str(i, idxStr)
121+
@:PROHIBIT(particle_cloud(i)%packing_method == dflt_int, &
122+
& "particle_cloud("//trim(idxStr)//")%packing_method must be specified (1 = rejection sampling)")
123+
@:PROHIBIT(particle_cloud(i)%packing_method /= 1, &
124+
& "particle_cloud("//trim(idxStr) &
125+
& //")%packing_method must be 1 (rejection sampling is the only supported method)")
126+
end do
127+
128+
end subroutine s_check_inputs_particle_clouds
129+
109130
end module m_checker

src/simulation/m_global_parameters.fpp

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ module m_global_parameters
263263
!> @{
264264
type(ib_patch_parameters), dimension(num_ib_patches_max_namelist) :: patch_ib !< Immersed boundary patch parameters
265265
integer, dimension(num_local_ibs_max) :: local_ib_patch_ids !< lookup table of IBs in the local compute domain
266-
type(particle_bed_parameters), dimension(num_particle_beds_max) :: particle_bed !< Particle bed specifications
266+
type(particle_cloud_parameters), dimension(num_particle_clouds_max) :: particle_cloud !< Particle bed specifications
267267
integer, allocatable, dimension(:,:,:) :: ib_neighbor_ranks !< MPI ranks of neighborhood domains, indexed (-N:N,-N:N,-N:N)
268268
type(ib_airfoil_parameters), dimension(num_ib_airfoils_max) :: ib_airfoil !< Per-airfoil NACA user inputs (namelist)
269269
type(ib_airfoil_grid), dimension(num_ib_airfoils_max) :: ib_airfoil_grids !< Per-airfoil computed surface grids
@@ -689,20 +689,21 @@ contains
689689
ib_airfoil_grids(i)%Np = 0
690690
end do
691691
692-
num_particle_beds = 0
693-
do i = 1, num_particle_beds_max
694-
particle_bed(i)%x_centroid = 0._wp
695-
particle_bed(i)%y_centroid = 0._wp
696-
particle_bed(i)%z_centroid = 0._wp
697-
particle_bed(i)%length_x = dflt_real
698-
particle_bed(i)%length_y = dflt_real
699-
particle_bed(i)%length_z = dflt_real
700-
particle_bed(i)%num_particles = 0
701-
particle_bed(i)%radius = dflt_real
702-
particle_bed(i)%mass = dflt_real
703-
particle_bed(i)%min_spacing = 0._wp
704-
particle_bed(i)%moving_ibm = 0
705-
particle_bed(i)%seed = 0
692+
num_particle_clouds = 0
693+
do i = 1, num_particle_clouds_max
694+
particle_cloud(i)%x_centroid = 0._wp
695+
particle_cloud(i)%y_centroid = 0._wp
696+
particle_cloud(i)%z_centroid = 0._wp
697+
particle_cloud(i)%length_x = dflt_real
698+
particle_cloud(i)%length_y = dflt_real
699+
particle_cloud(i)%length_z = dflt_real
700+
particle_cloud(i)%num_particles = 0
701+
particle_cloud(i)%radius = dflt_real
702+
particle_cloud(i)%mass = dflt_real
703+
particle_cloud(i)%min_spacing = 0._wp
704+
particle_cloud(i)%moving_ibm = 0
705+
particle_cloud(i)%seed = 0
706+
particle_cloud(i)%packing_method = dflt_int
706707
end do
707708
708709
do i = 1, num_ib_patches_max_namelist

src/simulation/m_mpi_proxy.fpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ contains
7474
& 'wave_speeds', 'avg_state', 'precision', 'bc_x%beg', 'bc_x%end', &
7575
& 'bc_y%beg', 'bc_y%end', 'bc_z%beg', 'bc_z%end', 'fd_order', &
7676
& 'num_probes', 'num_integrals', 'bubble_model', 'thermal', &
77-
& 'num_source', 'relax_model', 'num_ibs', 'num_particle_beds', 'n_start', &
77+
& 'num_source', 'relax_model', 'num_ibs', 'num_particle_clouds', 'n_start', &
7878
& 'num_bc_patches', 'num_igr_iters', 'num_igr_warm_start_iters', &
7979
& 'adap_dt_max_iters', 'collision_model', 'ib_neighborhood_radius', &
8080
& 'int_comp' ]
@@ -222,14 +222,15 @@ contains
222222
#:endfor
223223
end do
224224

225-
do i = 1, num_particle_beds
225+
do i = 1, num_particle_clouds
226226
#:for VAR in ['x_centroid', 'y_centroid', 'z_centroid', 'length_x', 'length_y', 'length_z', &
227227
& 'radius', 'mass', 'min_spacing']
228-
call MPI_BCAST(particle_bed(i)%${VAR}$, 1, mpi_p, 0, MPI_COMM_WORLD, ierr)
228+
call MPI_BCAST(particle_cloud(i)%${VAR}$, 1, mpi_p, 0, MPI_COMM_WORLD, ierr)
229229
#:endfor
230-
call MPI_BCAST(particle_bed(i)%num_particles, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr)
231-
call MPI_BCAST(particle_bed(i)%moving_ibm, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr)
232-
call MPI_BCAST(particle_bed(i)%seed, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr)
230+
call MPI_BCAST(particle_cloud(i)%num_particles, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr)
231+
call MPI_BCAST(particle_cloud(i)%moving_ibm, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr)
232+
call MPI_BCAST(particle_cloud(i)%seed, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr)
233+
call MPI_BCAST(particle_cloud(i)%packing_method, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr)
233234
end do
234235

235236
do j = 1, num_probes_max

0 commit comments

Comments
 (0)