1454-projection-optimization #1549
Conversation
Claude Code ReviewHead SHA: f85f983 Files changed:
Findings: [Correctness — Compilation failure]
is_inside = -0.5_wp*patch_ib(patch_id)%length_x <= x .and. 0.5_wp*patch_ib(patch_id)%length_x >= x &
is_inside = is_inside .and. -0.5_wp*patch_ib(patch_id)%length_y <= y.and. ...The trailing [Correctness — Compilation failure]
public :: f_is_inside_circle, f_is_inside_sphere, f_is_inside_cylinder, f_is_inside_rectangle, f_is_inside_cuboid, &
& f_is_inside_airfoil, f_is_inside_airfoil_3D, f_is_inside_ellipseNeither [Correctness — Undefined behaviour]
function f_is_inside_ellipse(patch_id, x, y) result(is_inside)
...
logical :: is_inside
end function f_is_inside_ellipse
|
Description
In many-particle cases, the limiting factor in the IBM compute is by far the time it takes to project the immersed boundaries onto the grid. This is fundamentally rooted in how we parallelize the work. The current code parallelizes of x, y, and z, but sequentially iterates through the IB patches. In cases where there are many IBs that are small, we are launching several (thousands) of GPU kernels each time step, but each kernel only works on hundreds of grid cells. Adding an option to parallelize over the thousands of particles should be significantly larger parallelism and thus optimize the projection.
In order to maintain the functionality of both parallelism methods, I need a separate set of geometry bounding checks. Since we perform a check in icpp patches and now 2 in IB patches, this is a significant amount of redundant code that must be maintained. To be somewhat forward-looking, I opted to merge all geometry checking into a single module that can be called from both forms of IB parallelism and the icpp pre_processing code. This should clean up the code nicely and significantly reduce code maintenance going forward. Since I am apparently refactoring everything again, I also have opted to update the patch geometry indexes to use a more unified framework and deprecate the unneeded cylinder length checks.
The end result is the creation of a new module in common, the deletion of duplicate code, and a new parallelism path for IB patches when utilizing GPU compute.
Closes #1454, #1532, #1543
Type of change (delete unused ones)
Testing
Not Yet.
Checklist
Check these like this
[x]to indicate which of the below applies.See the developer guide for full coding standards.
GPU changes (expand if you modified
src/simulation/)AI code reviews
Reviews are not retriggered automatically. To request a review, comment on the PR:
@claude full review— Claude full review (also triggers on PR open/reopen/ready)claude-full-review— Claude full review via label