Skip to content

Commit 3a9bb76

Browse files
BCKim55sbryngelson
andauthored
Add hemisphere shell particle cloud packing (#1667)
Co-authored-by: Spencer Bryngelson <sbryngelson@gmail.com>
1 parent f5d2b4c commit 3a9bb76

22 files changed

Lines changed: 1875 additions & 70 deletions

‎docs/documentation/case.md‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,18 +423,25 @@ A particle cloud is a compact specification of a bed of identical circular (2D)
423423
| Parameter | Type | Description |
424424
| ---: | :----: | :--- |
425425
| `x[y,z]_centroid` | Real | Centre of the cloud region in the [x,y,z]-direction. |
426-
| `length_x[y,z]` | Real | Extent of the cloud region in the [x,y,z]-direction. |
426+
| `length_x[y,z]` | Real | Extent of the cloud region in the [x,y,z]-direction for `cloud_geometry = 1`; ignored by `cloud_geometry = 2`. |
427427
| `num_particles` | Integer | Number of particles to place in the region. |
428428
| `radius` | Real | Radius of every particle in the cloud. |
429429
| `mass` | Real | Mass of every particle in the cloud. |
430430
| `min_spacing` | Real | Minimum surface-to-surface gap between particles (centres are `2*radius + min_spacing` apart). |
431+
| `cloud_geometry` | Integer | Shape of the cloud region. |
432+
| `shell_inner_radius` | Real | Inner radius for hemisphere-shell clouds (`cloud_geometry = 2`). |
433+
| `shell_outer_radius` | Real | Outer radius for hemisphere-shell clouds (`cloud_geometry = 2`). |
431434
| `moving_ibm` | Integer | Motion flag applied to every particle (see `patch_ib(j)%%moving_ibm`). |
432435
| `seed` | Integer | Random seed for reproducible placement (used by `packing_method = 1`). |
433436
| `packing_method` | Integer | Algorithm used to place the particles. |
434437

438+
- `cloud_geometry` selects the cloud region:
439+
- `1` (box) uses `x[y,z]_centroid` and `length_x[y,z]` to define the region.
440+
- `2` uses `x[y,z]_centroid`, `shell_inner_radius`, and `shell_outer_radius` to define a half-annulus in 2D and a hemisphere shell in 3D. Particle centres are sampled between `shell_inner_radius + radius` and `shell_outer_radius - radius`, and the flat plane is kept clear by one particle radius. The flat face is fixed at `y_centroid` in 2D and `z_centroid` in 3D; the filled region opens toward positive `y` in 2D and positive `z` in 3D. The full shell extent (`x[y,z]_centroid +/- shell_outer_radius` on the open side, and one particle radius of clearance on the flat-face side) must lie inside the computational domain; a hemisphere shell also requires at least two dimensions (`n > 0`).
435441
- `packing_method` selects how the `num_particles` are positioned within the cloud region:
436442
- `1` (rejection sampling) draws random positions and rejects any that violate `min_spacing`, producing a disordered bed. `seed` makes the placement reproducible.
437443
- `2` (lattice) places the particles on the optimally dense lattice for the geometry — a triangular lattice in 2D and a face-centered cubic lattice in 3D. The lattice spacing is derived from the particle density (`num_particles` over the region area/volume); if that spacing is below the required `2*radius + min_spacing`, the region is too dense and the run aborts.
444+
- Hemisphere-shell clouds currently support rejection sampling only; `cloud_geometry = 2` with `packing_method = 2` is rejected during input validation.
438445

439446
### 5. Fluid Material's {#sec-fluid-materials}
440447

‎src/common/m_derived_types.fpp‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,9 +374,13 @@ module m_derived_types
374374
real(wp) :: radius !< Particle radius
375375
real(wp) :: mass !< Particle mass
376376
real(wp) :: min_spacing !< Minimum surface-to-surface gap (particle centers are 2*radius + min_spacing apart)
377+
real(wp) :: shell_inner_radius !< Inner radius for shell packing
378+
real(wp) :: shell_outer_radius !< Outer radius for shell packing
377379
integer :: moving_ibm !< Motion flag: 0=static, 1=moving (forces), 2=forced path
378380
integer :: seed !< Random seed for reproducible placement
381+
integer :: cloud_geometry !< Cloud region geometry: 1=box, 2=hemisphere shell
379382
integer :: packing_method !< Packing algorithm: 1=rejection sampling, 2=lattice
383+
integer :: periodic !< Periodic overlap flag for box rejection packing: 0=off, 1=on
380384
end type particle_cloud_parameters
381385
382386
!> Derived type annexing the physical parameters (PP) of the fluids. These include the specific heat ratio function and liquid

‎src/simulation/m_global_parameters.fpp‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -639,9 +639,13 @@ contains
639639
particle_cloud(i)%radius = dflt_real
640640
particle_cloud(i)%mass = dflt_real
641641
particle_cloud(i)%min_spacing = 0._wp
642+
particle_cloud(i)%shell_inner_radius = dflt_real
643+
particle_cloud(i)%shell_outer_radius = dflt_real
642644
particle_cloud(i)%moving_ibm = 0
643645
particle_cloud(i)%seed = 0
646+
particle_cloud(i)%cloud_geometry = 1
644647
particle_cloud(i)%packing_method = dflt_int
648+
particle_cloud(i)%periodic = 0
645649
end do
646650
647651
do i = 1, num_ib_patches_max_namelist

‎src/simulation/m_mpi_proxy.fpp‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,13 +200,15 @@ contains
200200
! manual: particle_cloud (runtime loop to num_particle_clouds; irregular member subset)
201201
do i = 1, num_particle_clouds
202202
#:for VAR in ['x_centroid', 'y_centroid', 'z_centroid', 'length_x', 'length_y', 'length_z', &
203-
& 'radius', 'mass', 'min_spacing']
203+
& 'radius', 'mass', 'min_spacing', 'shell_inner_radius', 'shell_outer_radius']
204204
call MPI_BCAST(particle_cloud(i)%${VAR}$, 1, mpi_p, 0, MPI_COMM_WORLD, ierr)
205205
#:endfor
206206
call MPI_BCAST(particle_cloud(i)%num_particles, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr)
207207
call MPI_BCAST(particle_cloud(i)%moving_ibm, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr)
208208
call MPI_BCAST(particle_cloud(i)%seed, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr)
209+
call MPI_BCAST(particle_cloud(i)%cloud_geometry, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr)
209210
call MPI_BCAST(particle_cloud(i)%packing_method, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr)
211+
call MPI_BCAST(particle_cloud(i)%periodic, 1, MPI_INTEGER, 0, MPI_COMM_WORLD, ierr)
210212
end do
211213

212214
! manual: acoustic/probe (combined loop; complex acoustic member set)

0 commit comments

Comments
 (0)