Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
88 commits
Select commit Hold shift + click to select a range
4273c84
Remove interior point conservative variable protection for stationary…
danieljvickers Mar 15, 2026
4b2f519
Merge branch 'master' of github.com:danieljvickers/MFC
danieljvickers Mar 15, 2026
ba0cacb
Merge branch 'MFlowCode:master' into master
danieljvickers Mar 17, 2026
e6988ba
Merge branch 'MFlowCode:master' into master
danieljvickers Mar 17, 2026
0ce6f11
Merge branch 'MFlowCode:master' into master
danieljvickers Mar 18, 2026
16bd456
Merge branch 'MFlowCode:master' into master
danieljvickers Mar 24, 2026
f0e117d
Merge branch 'MFlowCode:master' into master
danieljvickers Apr 1, 2026
b42028a
Merge branch 'MFlowCode:master' into master
danieljvickers Apr 15, 2026
8728091
Merge branch 'MFlowCode:master' into master
danieljvickers Apr 21, 2026
f652274
Initial separation for patch_ibs
danieljvickers Apr 21, 2026
3baf894
Added IB patch reduction at the start of the simulation so that ranks…
danieljvickers Apr 22, 2026
2365f2c
intermittent commit
danieljvickers Apr 22, 2026
71bae6a
we now write the global IB index, not the local one to ib_markers, as…
danieljvickers Apr 22, 2026
0779098
Refactored ib reduction to use neighbor bounds
danieljvickers Apr 23, 2026
d9ac1c2
prototype of send-receive replacing all-to-all
danieljvickers Apr 23, 2026
ee0bc0c
Compilation errors resolved
danieljvickers Apr 23, 2026
8303cea
Resolved out of bounds error
danieljvickers Apr 24, 2026
1c1801c
added send test algorithm for alternative MPI communication
danieljvickers Apr 24, 2026
f014ca9
Fixed early segfault due to uninitialized IB patch array
danieljvickers Apr 24, 2026
d36fe0b
Debugged rank ownership bug and invalid number of global IBs
danieljvickers Apr 24, 2026
cc76bf3
Fixed global patch ID not being present on other ranks
danieljvickers Apr 24, 2026
e6e0613
Merge branch 'master' into local-aware-ibm
sbryngelson Apr 26, 2026
13ad7d0
Updating restart data
danieljvickers Apr 28, 2026
2983eba
Merge branch 'local-aware-ibm' of github.com:danieljvickers/MFC into …
danieljvickers Apr 28, 2026
35b7864
add integer declaration
danieljvickers Apr 28, 2026
0ab63cb
Fixed duplicate particle output
danieljvickers Apr 28, 2026
fce3071
Updated post processing
danieljvickers Apr 29, 2026
6e9cd50
Fixed stalling issues in proc_rank > 2 cases
danieljvickers Apr 29, 2026
92b776d
Significant MPI debug
danieljvickers Apr 29, 2026
4734b4e
Multi-rank passes and works
danieljvickers Apr 29, 2026
6765800
Removed some prints
danieljvickers Apr 29, 2026
d2a2c89
Removed state writing test because it only fails in CI
danieljvickers Apr 30, 2026
8ff8038
Merge branch 'master' into local-aware-ibm
danieljvickers Apr 30, 2026
1a1aed1
Changes to support analytic IB's in new setup
danieljvickers Apr 30, 2026
6b8bc70
Bad macro syntax
danieljvickers Apr 30, 2026
7be67e4
Significantly condensed collision logic and added neighbor check
danieljvickers Apr 30, 2026
13930cc
Added neighbor lookup to simplify logic and integrate periodicity
danieljvickers Apr 30, 2026
df589a8
Fixed bug in 3 rank case
danieljvickers Apr 30, 2026
343983b
Additional parenthesis to ensure correct domain checks
danieljvickers Apr 30, 2026
fb1dbdb
Fixed small error in analytic patch code
danieljvickers Apr 30, 2026
f722e38
Fixed some single-rank ib state output
danieljvickers May 1, 2026
3144880
Merge branch 'master' of github.com:danieljvickers/MFC
danieljvickers May 1, 2026
9b9975b
Fixed STL mdoels
danieljvickers May 2, 2026
a07f9af
Finished all features, now I need to unbreak test suite
danieljvickers May 2, 2026
877b5ee
Small debugging and toolchain support
danieljvickers May 2, 2026
aa86dad
Fixed nvhpc compilation issue
danieljvickers May 4, 2026
73408c9
Update processor inforamtion to GPU for use in subroutines
danieljvickers May 4, 2026
97900ab
Fixed periodic GPU cases
danieljvickers May 4, 2026
4150b8e
Fixed IBs in multi-rank periodicity
danieljvickers May 4, 2026
3f30041
Clean up lines using the new neighborhood ib patch getter subroutine
danieljvickers May 4, 2026
ff45acc
Passes tests on NVHPC 25.11
danieljvickers May 5, 2026
05dcede
Deleted some extra lines
danieljvickers May 5, 2026
a087388
Merged in several major changes that were accidentally pushed to the …
danieljvickers May 5, 2026
f282fe9
Works on 3-ranks
danieljvickers May 5, 2026
2126d4e
Fixed compiler issue for non-mpi cases
danieljvickers May 5, 2026
01cd346
fixed stalling issue on multirank cases for cray compilers
May 6, 2026
401d243
Fixed memory corruption issue on 8k particle case
May 6, 2026
0f79876
Fixed neighbor instantiation for larger-than 8-rank cases
May 6, 2026
6446782
Successfully ran 128k IBs
May 7, 2026
f6155f3
fixed formatting issue
May 7, 2026
c8379a0
Lookup table for improved perofrmance
May 8, 2026
a631916
CHanges to allow rocm profiling on frontier and to parallelize array …
May 8, 2026
0f9eb30
fixed incorrect array sizing
May 11, 2026
9879df3
Altered dynamic array allocation
May 11, 2026
8fc61d9
Merge branch 'master' into local-aware-ibm
danieljvickers May 11, 2026
6bdf257
Merge branch 'master' into local-aware-ibm
danieljvickers May 11, 2026
7c39cf4
Merge branch 'master' into local-aware-ibm
danieljvickers May 12, 2026
c862070
Address AI comments
danieljvickers May 12, 2026
d132c7e
Added particle beds as a feature
danieljvickers May 12, 2026
a70fe62
Formatting, collision N_2 fixes, and example update
danieljvickers May 12, 2026
dc433b6
Updated to long precicion to not overflow particle placement
danieljvickers May 12, 2026
9060f6f
style: apply ffmt v0.4.0 formatting
sbryngelson May 12, 2026
5bb2160
Merge branch 'master' into local-aware-ibm, apply ffmt v0.4.0 formatting
sbryngelson May 12, 2026
72639c4
docs: add m_particle_bed module brief, category, and num_particle_bed…
sbryngelson May 12, 2026
ef31786
style: apply ffmt v0.4.0 formatting (fix & %member breaks)
sbryngelson May 12, 2026
06b802e
fix: lazy-allocate patch_ib to restore FP-stability CI
sbryngelson May 12, 2026
1bbe86e
fix: grow patch_ib on non-rank-0 before MPI broadcast of IB patches
sbryngelson May 12, 2026
1a61c23
fix: use num_ib_patches_max_namelist in Python toolchain for patch_ib…
sbryngelson May 12, 2026
0af6cb9
fix: clamp patch_ib copy in s_reduce_ib_patch_array to num_aware_ibs
sbryngelson May 12, 2026
de6add6
fix: use MOVE_ALLOC for 1-rank/no-MPI to avoid patch_ib truncation
sbryngelson May 12, 2026
9c2a820
fix: replace move_alloc on patch_ib with allocate/copy for GPU safety
sbryngelson May 12, 2026
2c3099e
test: add golden file for 2D mibm_particle_bed example
sbryngelson May 13, 2026
0210fbb
Optimized particle bed instantitation
May 13, 2026
a68ffe8
WR BTW
May 13, 2026
98e8b1c
WR BTW
May 13, 2026
85442c0
Merge conflicts
May 13, 2026
975c5db
Removed print statements
May 13, 2026
8008855
formatting and spelling
May 13, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions docs/documentation/case.md
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,8 @@ This is enabled by adding ``'elliptic_smoothing': "T",`` and ``'elliptic_smoothi
| Parameter | Type | Description |
| ---: | :----: | :--- |
| `num_ibs` | Integer | Number of immersed boundary patches |
| `num_particle_beds` | Integer | Number of particle bed specifications to generate immersed boundary patches from |
| `ib_neighborhood_radius` | Integer | Parameter that controls the neighborhood size for IB detection. |
| `geometry` | Integer | Geometry configuration of the patch.|
| `x[y,z]_centroid` | Real | Centroid of the applied geometry in the [x,y,z]-direction. |
| `length_x[y,z]` | Real | Length, if applicable, in the [x,y,z]-direction. |
Expand Down Expand Up @@ -373,6 +375,8 @@ Additional details on this specification can be found in [NACA airfoil](https://

- `ib_coefficient_of_friction` is the coefficient of friction used in IB collisions.

- `ib_neighborhood_radius` controls the size of the neighborhood size. This value defaults to 1, which indicates that any given rank is aware of IB's up to 1 ranks away. This parameter is required to strong-scale a case when IB's eventually grow to be larger than one full processor domain wide.

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

| Parameter | Type | Description |
Expand Down Expand Up @@ -643,7 +647,7 @@ To restart the simulation from $k$-th time step, see @ref running "Restarting Ca
| `alpha_wrt(i)` | Logical | Add the volume fraction of fluid $i$ to the database |
| `gamma_wrt` | Logical | Add the specific heat ratio function to the database |
| `heat_ratio_wrt` | Logical | Add the specific heat ratio to the database |
| `ib_state_wrt` | Logical | Write IB state and loads to a datafile at each time step |
| `ib_state_wrt` | Logical | Parameter to handle writing IB state on saves and outputting the state as a point mesh to SILO files. |
| `pi_inf_wrt` | Logical | Add the liquid stiffness function to the database |
| `pres_inf_wrt` | Logical | Add the liquid stiffness to the formatted database |
| `c_wrt` | Logical | Add the sound speed to the database |
Expand Down Expand Up @@ -711,7 +715,7 @@ If `file_per_process` is true, then pre_process, simulation, and post_process mu

- `probe_wrt` activates the output of state variables at coordinates specified by `probe(i)%[x;y,z]`.

- `ib_state_wrt` activates the output of data specified by patch_ib(i)%force(:) (and torque, vel, angular_vel, angles, [x,y,z]_centroid) into a single binary datafile for all IBs at all timesteps. During post_processing, this file is converted into separate time histories for each IB.
- `ib_state_wrt` is used to trigger post-processing of the IB state to be written out as a point mesh in the SILO files. When no IBs are moving, it also triggers force and torque calculation so that those values may be written to the output state files.

- `output_partial_domain` activates the output of part of the domain specified by `[x,y,z]_output%%beg` and `[x,y,z]_output%%end`.
This is useful for large domains where only a portion of the domain is of interest.
Expand Down
1 change: 1 addition & 0 deletions docs/module_categories.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"m_compute_cbc",
"m_boundary_common",
"m_ibm",
"m_particle_bed",
"m_igr",
"m_ib_patches",
"m_compute_levelset"
Expand Down
136 changes: 136 additions & 0 deletions examples/2D_mibm_particle_bed/case.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
import json
import math

# 2D shock wave interacting with a bed of 20 free-floating circular particles.

gam_a = 1.4

# Shock parameters (Mach 1.5)
mach_number = 1.5
pre_shock_pressure = 1
pre_shock_density = 1.4
pre_shock_speed = 0.0
post_shock_pressure = 2.4583
post_shock_density = 2.6069
post_shock_speed = 0.6944

domain_size = 4.0
wave_front = -1.5

total_time = 1.5
num_time_steps = 2000
dt = float(total_time / num_time_steps)
num_saves = 100
steps_to_save = int(num_time_steps / num_saves)

# Soft-sphere collision parameters (from 3D_mibm_sphere_head_on_collision)
collision_time = 20.0 * dt

# Particle bed parameters
bed_x = 0.5
bed_y = 0.0
bed_lx = 2.0
bed_ly = 3.5
particle_radius = 0.15
particle_mass = 0.25
particle_min_spacing = 0.05

print(
json.dumps(
{
# Logistics
"run_time_info": "T",
# Computational Domain Parameters
"x_domain%beg": -domain_size * 0.5,
"x_domain%end": domain_size * 0.5,
"y_domain%beg": -domain_size * 0.5,
"y_domain%end": domain_size * 0.5,
"cyl_coord": "F",
"m": 256,
"n": 256,
"p": 0,
"dt": dt,
"t_step_start": 0,
"t_step_stop": num_time_steps,
"t_step_save": steps_to_save,
# Simulation Algorithm Parameters
"num_patches": 2,
"model_eqns": 2,
"alt_soundspeed": "F",
"num_fluids": 1,
"mpp_lim": "F",
"mixture_err": "T",
"time_stepper": 3,
"weno_order": 5,
"weno_eps": 1.0e-16,
"weno_Re_flux": "T",
"weno_avg": "T",
"avg_state": 2,
"mapped_weno": "T",
"null_weights": "F",
"mp_weno": "T",
"riemann_solver": 2,
"wave_speeds": 1,
"bc_x%beg": -17,
"bc_x%end": -8,
"bc_y%beg": -15,
"bc_y%end": -15,
# Immersed boundaries — all circles come from the particle bed
"ib": "T",
"num_ibs": 0,
"viscous": "T",
# Collision model (soft-sphere, from 3D_mibm_sphere_head_on_collision)
"collision_model": 1,
"coefficient_of_restitution": 0.9,
"collision_time": collision_time,
"ib_coefficient_of_friction": 0.1,
# Particle bed: 20 free-floating circles placed randomly in region
"num_particle_beds": 1,
"particle_bed(1)%x_centroid": bed_x,
"particle_bed(1)%y_centroid": bed_y,
"particle_bed(1)%z_centroid": 0.0,
"particle_bed(1)%length_x": bed_lx,
"particle_bed(1)%length_y": bed_ly,
"particle_bed(1)%length_z": 0.0,
"particle_bed(1)%num_particles": 20,
"particle_bed(1)%radius": particle_radius,
"particle_bed(1)%mass": particle_mass,
"particle_bed(1)%min_spacing": particle_min_spacing,
"particle_bed(1)%moving_ibm": 2,
"particle_bed(1)%seed": 42,
# Output
"format": 1,
"precision": 2,
"prim_vars_wrt": "T",
"E_wrt": "T",
"ib_state_wrt": "F",
"parallel_io": "T",
# IC Patch 1: post-shock region (left of wave front)
"patch_icpp(1)%geometry": 3,
"patch_icpp(1)%x_centroid": 0.5 * wave_front - 0.25 * domain_size,
"patch_icpp(1)%y_centroid": 0.0,
"patch_icpp(1)%length_x": 0.5 * domain_size + wave_front,
"patch_icpp(1)%length_y": domain_size,
"patch_icpp(1)%vel(1)": post_shock_speed,
"patch_icpp(1)%vel(2)": 0.0,
"patch_icpp(1)%pres": post_shock_pressure,
"patch_icpp(1)%alpha_rho(1)": post_shock_density,
"patch_icpp(1)%alpha(1)": 1.0,
# IC Patch 2: pre-shock region (right of wave front)
"patch_icpp(2)%geometry": 3,
"patch_icpp(2)%x_centroid": 0.5 * wave_front + 0.25 * domain_size,
"patch_icpp(2)%y_centroid": 0.0,
"patch_icpp(2)%length_x": 0.5 * domain_size - wave_front,
"patch_icpp(2)%length_y": domain_size,
"patch_icpp(2)%vel(1)": pre_shock_speed,
"patch_icpp(2)%vel(2)": 0.0,
"patch_icpp(2)%pres": pre_shock_pressure,
"patch_icpp(2)%alpha_rho(1)": pre_shock_density,
"patch_icpp(2)%alpha(1)": 1.0,
# Fluid properties: air
"fluid_pp(1)%gamma": 1.0 / (gam_a - 1.0),
"fluid_pp(1)%pi_inf": 0,
"fluid_pp(1)%Re(1)": 2500000,
}
)
)
2 changes: 1 addition & 1 deletion examples/2D_mibm_shock_cylinder/case.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
"precision": 2,
"prim_vars_wrt": "T",
"E_wrt": "T",
"ib_state_wrt": "T",
"ib_state_wrt": "F",
"parallel_io": "T",
# Patch: Constant Tube filled with air
# Specify the cylindrical air tube grid geometry
Expand Down
2 changes: 0 additions & 2 deletions src/common/include/case.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@

! For pre-process.
#:def analytical()

#:enddef

! For moving immersed boundaries in simulation
#:def mib_analytical()

#:enddef
22 changes: 13 additions & 9 deletions src/common/m_constants.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,19 @@ module m_constants
real(wp), parameter :: verysmall = 1.e-12_wp !< Very small number
!> Radius cutoff to avoid division by zero for 3D spherical harmonic patch (geometry 14)
real(wp), parameter :: small_radius = 1.e-32_wp
integer, parameter :: num_stcls_min = 5 !< Minimum # of stencils
integer, parameter :: path_len = 400 !< Maximum path length
integer, parameter :: name_len = 50 !< Maximum name length
integer, parameter :: dflt_int = -100 !< Default integer value
integer, parameter :: fourier_rings = 5 !< Fourier filter ring limit
integer, parameter :: num_fluids_max = 10 !< Maximum number of fluids in the simulation
integer, parameter :: num_probes_max = 10 !< Maximum number of flow probes in the simulation
integer, parameter :: num_patches_max = 10 !< Maximum number of IC patches
integer, parameter :: num_ib_patches_max = 50000 !< Maximum number of immersed boundary patches (patch_ib)
integer, parameter :: num_stcls_min = 5 !< Minimum # of stencils
integer, parameter :: path_len = 400 !< Maximum path length
integer, parameter :: name_len = 50 !< Maximum name length
integer, parameter :: dflt_int = -100 !< Default integer value
integer, parameter :: fourier_rings = 5 !< Fourier filter ring limit
integer, parameter :: num_fluids_max = 10 !< Maximum number of fluids in the simulation
integer, parameter :: num_probes_max = 10 !< Maximum number of flow probes in the simulation
integer, parameter :: num_patches_max = 10 !< Maximum number of IC patches
integer, parameter :: num_ib_patches_max = 2050000 !< Maximum number of immersed boundary patches (patch_ib)
!> Max patches readable from the namelist; patch_ib grows to num_ib_patches_max only when particle beds are used
integer, parameter :: num_ib_patches_max_namelist = 50000
integer, parameter :: num_local_ibs_max = 2000 !< Maximum number of immersed boundary patches (patch_ib)
integer, parameter :: num_particle_beds_max = 10 !< Maximum number of particle bed patch specifications
integer, parameter :: num_bc_patches_max = 10 !< Maximum number of boundary condition patches
integer, parameter :: max_2d_fourier_modes = 10 !< Max Fourier mode index for 2D modal patch (geometry 13)
integer, parameter :: max_sph_harm_degree = 5 !< Max degree L for 3D spherical harmonic patch (geometry 14)
Expand Down
13 changes: 6 additions & 7 deletions src/common/m_derived_types.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,12 +202,10 @@ module m_derived_types

type :: t_model_array
! Original CPU-side fields (unchanged)
type(t_model), allocatable :: model !< STL/OBJ geometry model
real(wp), allocatable, dimension(:,:,:) :: boundary_v !< Boundary vertices
real(wp), allocatable, dimension(:,:) :: interpolated_boundary_v !< Interpolated boundary vertices
integer :: boundary_edge_count !< Number of boundary edges
integer :: total_vertices !< Total vertex count
integer :: interpolate !< Interpolation flag
type(t_model), allocatable :: model !< STL/OBJ geometry model
real(wp), allocatable, dimension(:,:,:) :: boundary_v !< Boundary vertices
integer :: boundary_edge_count !< Number of boundary edges
integer :: total_vertices !< Total vertex count

! GPU-friendly flattened arrays
integer :: ntrs !< Copy of model%ntrs
Expand Down Expand Up @@ -272,9 +270,10 @@ module m_derived_types
end type ic_patch_parameters

type ib_patch_parameters

integer :: geometry !< Type of geometry for the patch
integer :: gbl_patch_id
real(wp) :: x_centroid, y_centroid, z_centroid !< Geometric center coordinates of the patch

!> Centroid locations of intermediate steps in the time_stepper module
real(wp) :: step_x_centroid, step_y_centroid, step_z_centroid
real(wp), dimension(1:3) :: centroid_offset !< offset of center of mass from computed cell center for odd-shaped IBs
Expand Down
7 changes: 3 additions & 4 deletions src/common/m_model.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -983,12 +983,13 @@ contains
dx_local = minval(dx); dy_local = minval(dy)
if (p /= 0) dz_local = minval(dz)

@:ALLOCATE(models(num_ibs))
allocate (stl_bounding_boxes(num_ibs,1:3,1:3))

do patch_id = 1, num_ibs
if (patch_ib(patch_id)%geometry == 5 .or. patch_ib(patch_id)%geometry == 12) then
allocate (models(patch_id)%model)
print *, " * Reading model: " // trim(patch_ib(patch_id)%model_filepath)
if (proc_rank == 0) print *, " * Reading model: " // trim(patch_ib(patch_id)%model_filepath)

model = f_model_read(patch_ib(patch_id)%model_filepath)
params%scale(:) = patch_ib(patch_id)%model_scale(:)
Expand All @@ -1001,9 +1002,7 @@ contains
params%scale(:) = 1._wp
end if

if (proc_rank == 0) then
print *, " * Transforming model."
end if
if (proc_rank == 0) print *, " * Transforming model."

! Get the model center before transforming the model
bbox_old = f_create_bbox(model)
Expand Down
2 changes: 2 additions & 0 deletions src/common/m_mpi_common.fpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ contains
proc_rank = 0
#endif

$:GPU_UPDATE(device='[num_procs, proc_rank]')

end subroutine s_mpi_initialize

!> Set up MPI I/O data views and variable pointers for parallel file output.
Expand Down
Loading
Loading