Solid Particle Implementation for E-L Solver#1301
Solid Particle Implementation for E-L Solver#1301JA0307 wants to merge 12 commits intoMFlowCode:masterfrom
Conversation
This adds checks for particles_lagrange wherever "bubbles_lagrange is checked Variables for lagrangian solid particles are implemented
This adds two files to MFC. This includes src/simulation/m_particles_EL.fpp and src/simulation/m_particles_EL_kernels.fpp, which are used to compute particle dynamics, collisions, source terms, drag, integrate particle positions, etc.
…ication This implements mpi communication of collision forces with ghost particles in simulation/m_mpi_proxy.fpp The particle transfer between mpi ranks is made to support a "ghost" region and only the physical mpi domain. The ghost transfer is done when collisions are being computed. The physical transfer is done for true particle ownership.
This commit adds files necessary for compiling and running the EL particle solver. These files/changes are not part of this specific feature development. These changes are part of the MovingBubblesFresh commits. Since this feature for moving solid lagrangian particles is a fork of the MovingBubblesFresh development fork, it has inherent dependencies. When MovingBubblesFresh gets merged into MFC, this commit will be irrelevant.
a2bf4ac to
e527f8f
Compare
Claude Code ReviewIncremental review from: e527f8f Previously-flagged issues addressed in this update: New findings since last Claude review[HIGH] Declaration-after-executable-statement: Fortran syntax error in MPI builds The fix initializes bubs_glb = 0 ! ← executable statement
integer :: ierr ! ← local declaration after executable: Fortran syntax error
integer :: i, j, k, ...Per the Fortran standard, all declarations must precede the first executable statement in a scoping unit. Move Remaining from prior review (not re-examined here): |
- Remove forbidden save variable (next_write_time) - Add _wp suffixes to all bare float literals in drag correlations - Fix d-exponent literal (5.0d-11 -> 5.0e-11_wp) - Add missing @:DEALLOCATE for weights_*_grad arrays - Add intent(in) on stage parameter - Use fluid_pp Re when viscous=T instead of hardcoded viscosity - Remove dead kahan_comp array (allocated/zeroed/freed, never read) - Initialize bubs_glb=0 before conditional MPI reduce - Add #else branch to s_mpi_reduce_int_sum for non-MPI builds - Add #ifdef MFC_MPI guards to s_transfer_collision_forces - Restore accidentally deleted bub_pp broadcasts in pre_process Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Fix *2 -> **2 typo in Osnes drag volume fraction correction (QS_ModifiedParmar, QS_Osnes) - Fix MPI request buffer overflow in s_transfer_collision_forces (2*MAX_NEIGHBORS local arrays) - Uncomment GPU_ROUTINE on s_fornberg_weights (called from GPU parallel loops) - Add gauSum <= 0 guard to prevent division by zero in gaussian smearing - Add rho_fluid > 0 guard for sound speed computation - Add bounds limits to s_locate_cell while loops to prevent GPU hangs - Fix bare 0. literal to 0._wp for precision discipline - Fix 0._wp assigned to integer part_id - Remove implicit save from local logicals (separate declaration from init) - Re-enable particle radius NaN/negative validation in m_start_up - Fix rad**3._wp to rad**3 for consistency and efficiency Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Claude Code ReviewIncremental review from: 069237f Previously-flagged issues addressed or carried forward: The declaration-after-executable bug ( Findings since last Claude review[HIGH] Declaration-after-executable still present — Fortran standard violation This was flagged in the previous review and remains unfixed. In an MFC_SIMULATION + MFC_MPI build the preprocessor expands to: bubs_glb = 0 ! ← executable statement
! ...
integer :: ierr ! ← local declaration AFTER executable: illegal per Fortran standardFix: move [MEDIUM] In [MEDIUM]
real(wp), ..., intent(inout) :: vL_field
real(wp), ..., intent(inout) :: vR_fieldThe implementation only reads these arrays (computes [LOW] Bare integer literal
aTemp(l) = 2._wp*f_bTemp/(fmass_g + fmass_v) - 3*fV*fVel(l)/fRThe bare integer [LOW] Typo in NVTX range label:
call nvtxStartRange("BETA-COMM-SENDRECV-NO-RMDA")Should be Remaining from prior reviews (not re-examined here): |
- Fix bubs_glb=0 placement after declarations (Fortran standard violation) - Add missing max_dt declaration and GPU_DECLARE in m_time_steppers.fpp - Add @:PROHIBIT for particle restart without MPI - Deallocate beta_vars in pre_process and post_process finalizers - Change vL_field/vR_field intent(inout) to intent(in) in s_gradient_field - Fix bare integer 3 -> 3._wp in m_bubbles.fpp - Fix NVTX typo RMDA -> RDMA Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Claude Code ReviewIncremental review from: 3c49f42 Previously-flagged issues addressed in this update: New findings since last Claude review[HIGH] Module-level This commit adds: ! Module level (line 73)
real(wp), allocatable, dimension(:, :, :) :: max_dtallocated conditionally in the initializer: if (cfl_dt) then
@:ALLOCATE(max_dt(0:m, 0:n, 0:p)) ! line 474
end ifbut Additionally, inside real(wp) :: max_dt ! local scalar — shadows the module-level 3-D arrayThe GPU parallel loop at lines 766-769 passes this local scalar to Fix: add Remaining from prior reviews (not re-examined here): |
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add missing END_GPU_PARALLEL_LOOP in s_enforce_EL_particles_boundary_conditions - Add GPU_ROUTINE on particle_in_domain_physical (called from GPU kernel) - Fix p > 1 to p > 0 for 3D check in particle_in_domain (MFC convention) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Claude Code ReviewIncremental review from: 754cc32 Previously-flagged findings from last review: No new issues were found in the prior increment. All previously flagged issues (declaration-after-executable, New findings since last Claude review[MEDIUM] Optional
The [LOW] No-op assignments in The case default
do l = 1, num_dims
fVel(l) = fVel(l)
fPos(l) = fPos(l)
end doThese are no-ops. The block can be removed entirely or replaced with a comment. [LOW] Unconditional MPI broadcast of hardcoded-IC variables in pre_process
Remaining from prior reviews (not re-examined here): |
…gs, remove dead code - Fix module @brief with proper E-L solver description and citation - Fix 13 incorrect bubble->particle references in comments/docstrings - Add array dimension convention documentation (stage 1=current, 2=RK) - Add docstrings for collision, finalize_beta_field, build_linked_list - Fix s_enforce_EL_particles_boundary_conditions docstring with phases - Add docstring for f_interp_barycentric - Document collision parameters with units (ksp, E, nu, cor) - Fix mangled search-replace artifacts (fomu_fluidla -> formula) - Fix @file header, author name typo (Madea -> Maeda) - Fix MPI proxy docstrings (nBub -> nPart, remove stale params) - Remove dead commented-out bubble variable code and gradient calls - Remove no-op 1._wp* multiplier in s_compute_stddsv Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add section 9.3 to case.md: parameter table and descriptions for all particle-specific parameters (particles_lagrange, nParticles_glb, qs_drag_model, collision_force, interpolation_order, etc.) - Add section 6.3 to equations.md: governing equations for particle tracking including volume fraction, equation of motion, drag correlations, pressure gradient, added mass, and collision forces Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Update bubble_model description to include 0=Particle choice - Add new bubble params to section 9.2: drag_model, vel_model, charNz, input_path, pressure_force, gravity_force, write_void_evol - Add interfacial flow IC params to patch section: interface_file, normFac, normMag, g0_ic, p0_ic Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Description
This update expands upon the pre-existing (in development) E-L solver for bubble dynamics to include solid particle dynamics. This is in support of the PSAAP center, which requires the capability to model solid particle dynamics in MFC.
Type of change
Testing
The solver has been tested by running various 2D/3D problems involving fluid-particle interactions, such as spherical blasts surrounded by a layer of particles, shock-particle curtains, collision tests, etc.
The inputs to the EL solid particle solver have all been turned on/off to verify they work independent of each other, and together.
The code has been tested for CPU and GPU usage. The GPU usage has been tested on Tuolumne.
Two new files have been added:
m_particles_EL.fpp
m_particles_EL_kernels.fpp
File 1 has the main particle dynamics subroutines. This initializes the particles, computes fluid forces, coupling terms, computes collision forces, enforces boundary conditions, and writes the data for post-processing.
File 2 has the gaussian kernel projection code and the subroutine to compute the force on the particle due to the fluid. This compute the quasi-steady drag force, pressure gradient force, added mass force, stokes drag, gravitational force. Models for the quasi-steady drag are implemented here.
Checklist
See the developer guide for full coding standards.
GPU changes (expand if you modified
src/simulation/)AI code reviews
Reviews are not triggered automatically. To request a review, comment on the PR:
@coderabbitai review— incremental review (new changes only)@coderabbitai full review— full review from scratch/review— Qodo review/improve— Qodo code suggestions