MFC
Exascale flow solver
Loading...
Searching...
No Matches
m_collisions Module Reference

Ghost-node immersed boundary method: locates ghost/image points, computes interpolation coefficients, and corrects the flow state. More...

Functions/Subroutines

real(wp) function f_inv_tangential_mass (patch)
 inverse effective tangential mass of a sphere or circle at its contact point: 1/m + r^2/I
subroutine s_ib_friction_direction (tangential_vector, normal_force_mag, inv_mass_t)
 scales the slip velocity into the friction direction, -F_t = mu*|F_n|*v_t/max(|v_t|, eps). With ib_friction_slip_eps > 0, eps is floored at the stick limit mu*|F_n|*dt/m_t, which keeps the explicit update stable. With 0 it is v_t/|v_t|, left unscaled at exactly zero slip.
subroutine, public s_initialize_collisions_module ()
subroutine s_resize_pair_bits (num_bodies)
 Size the pair bitset for num_bodies IBs, doubled so a growing body count does not reallocate every step (empty on exit).
subroutine, public s_apply_collision_forces (ghost_points, num_gps, ib_markers, forces, torques)
subroutine s_apply_ib_collision_forces_soft_sphere (num_considered_collisions, forces, torques)
 applies collision forces to IBs assuming a soft-sphere collision model (all IBs are circles or spheres)
subroutine s_apply_wall_collision_forces_soft_sphere (forces, torques)
 applies collision forces to IBs assuming a soft-sphere collision model (all IBs are circles or spheres)
pure integer(kind=8) function f_pair_bit_index (a, b, num_bodies)
 Triangular index (0-based) of the unordered pair a < b, both in 1 to num_bodies.
subroutine s_detect_ib_collisions (gps, ib_markers, num_gps, num_considered_collisions)
 Uses ghost-point information to find IB pairs that may be colliding, effectively an optimized nearest-neighbor search: every ghost point with another patch's marker within 2 cells gives a candidate pair. Both patches record it: the rank that owns the contact point may hold interior ghost points of only one of them, so one-sided detection can leave that rank blind to a contact within a cell of its boundary. The many duplicate candidates are dropped on the GPU: each candidate is mapped to its sorted neighborhood pair (a, b) and claims that pair's bit in pair_bits with an atomic OR, and only the thread that flips the bit appends the pair. Bits are cleared by s_clear_pair_bits after the forces. A pair's periodic image is taken from the claiming candidate; two different images of one pair would need a domain about two particles across.
subroutine s_clear_pair_bits (num_considered_collisions)
 Clear the bits the last s_detect_ib_collisions set (every set bit belongs to a recorded pair, so whole words can be zeroed).
subroutine s_detect_wall_collisions (any_wall_collision)
 uses boundary conditions and particle locations to check for wall conditions
logical function, public f_neighborhood_ranks_own_location (location)
 function checks if this local MPI processor owns this specific collision
subroutine, public s_finalize_collisions_module ()

Variables

integer, dimension(:,:), allocatable collision_lookup
real(wp), dimension(:,:), allocatable wall_overlap_distances
real(wp) spring_stiffness
real(wp) damping_parameter
logical, public collisions_active
 true when any IB-IB or IB-wall contact was detected on this rank since the last adaptive-dt computation
integer, dimension(:), allocatable pair_bits
 One bit per unordered pair (a < b) of this rank's IBs (local + neighborhood indices, a triangular index over pair_bits_capacity): the ghost-point candidate pass claims each pair with an atomic OR, so only the first thread to find a pair records it and duplicates are dropped on the GPU. Bits are cleared after the forces are applied, so the set is empty between calls. Sized from num_ibs and regrown with it; memory is quadratic in the body count (1e4 bodies take 6 MB).
integer pair_bits_capacity
 Number of IBs the bitset is indexed for.

Detailed Description

Ghost-node immersed boundary method: locates ghost/image points, computes interpolation coefficients, and corrects the flow state.

Function/Subroutine Documentation

◆ f_inv_tangential_mass()

real(wp) function m_collisions::f_inv_tangential_mass ( type(ib_patch_parameters), intent(in) patch)

inverse effective tangential mass of a sphere or circle at its contact point: 1/m + r^2/I

Definition at line 441 of file m_collisions.fpp.f90.

Here is the caller graph for this function:

◆ f_neighborhood_ranks_own_location()

logical function, public m_collisions::f_neighborhood_ranks_own_location ( real(wp), dimension(3), intent(in) location)

function checks if this local MPI processor owns this specific collision

Definition at line 1445 of file m_collisions.fpp.f90.

◆ f_pair_bit_index()

pure integer(kind=8) function m_collisions::f_pair_bit_index ( integer, intent(in) a,
integer, intent(in) b,
integer, intent(in) num_bodies )

Triangular index (0-based) of the unordered pair a < b, both in 1 to num_bodies.

Definition at line 1042 of file m_collisions.fpp.f90.

Here is the caller graph for this function:

◆ s_apply_collision_forces()

subroutine, public m_collisions::s_apply_collision_forces ( type(ghost_point), dimension(:), intent(in) ghost_points,
integer, intent(in) num_gps,
type(integer_field), intent(in) ib_markers,
real(wp), dimension(num_ibs, 3), intent(inout) forces,
real(wp), dimension(num_ibs, 3), intent(inout) torques )

Definition at line 713 of file m_collisions.fpp.f90.

Here is the call graph for this function:

◆ s_apply_ib_collision_forces_soft_sphere()

subroutine m_collisions::s_apply_ib_collision_forces_soft_sphere ( integer, intent(in) num_considered_collisions,
real(wp), dimension(num_ibs, 3), intent(inout) forces,
real(wp), dimension(num_ibs, 3), intent(inout) torques )

applies collision forces to IBs assuming a soft-sphere collision model (all IBs are circles or spheres)

Definition at line 747 of file m_collisions.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ s_apply_wall_collision_forces_soft_sphere()

subroutine m_collisions::s_apply_wall_collision_forces_soft_sphere ( real(wp), dimension(num_ibs, 3), intent(inout) forces,
real(wp), dimension(num_ibs, 3), intent(inout) torques )

applies collision forces to IBs assuming a soft-sphere collision model (all IBs are circles or spheres)

Definition at line 916 of file m_collisions.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ s_clear_pair_bits()

subroutine m_collisions::s_clear_pair_bits ( integer, intent(in) num_considered_collisions)

Clear the bits the last s_detect_ib_collisions set (every set bit belongs to a recorded pair, so whole words can be zeroed).

Definition at line 1238 of file m_collisions.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ s_detect_ib_collisions()

subroutine m_collisions::s_detect_ib_collisions ( type(ghost_point), dimension(num_gps), intent(in) gps,
type(integer_field), intent(in) ib_markers,
integer, intent(in) num_gps,
integer, intent(out) num_considered_collisions )

Uses ghost-point information to find IB pairs that may be colliding, effectively an optimized nearest-neighbor search: every ghost point with another patch's marker within 2 cells gives a candidate pair. Both patches record it: the rank that owns the contact point may hold interior ghost points of only one of them, so one-sided detection can leave that rank blind to a contact within a cell of its boundary. The many duplicate candidates are dropped on the GPU: each candidate is mapped to its sorted neighborhood pair (a, b) and claims that pair's bit in pair_bits with an atomic OR, and only the thread that flips the bit appends the pair. Bits are cleared by s_clear_pair_bits after the forces. A pair's periodic image is taken from the claiming candidate; two different images of one pair would need a domain about two particles across.

Definition at line 1074 of file m_collisions.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ s_detect_wall_collisions()

subroutine m_collisions::s_detect_wall_collisions ( logical, intent(out) any_wall_collision)

uses boundary conditions and particle locations to check for wall conditions

Definition at line 1285 of file m_collisions.fpp.f90.

Here is the caller graph for this function:

◆ s_finalize_collisions_module()

subroutine, public m_collisions::s_finalize_collisions_module

Definition at line 1542 of file m_collisions.fpp.f90.

◆ s_ib_friction_direction()

subroutine m_collisions::s_ib_friction_direction ( real(wp), dimension(3), intent(inout) tangential_vector,
real(wp), intent(in) normal_force_mag,
real(wp), intent(in) inv_mass_t )

scales the slip velocity into the friction direction, -F_t = mu*|F_n|*v_t/max(|v_t|, eps). With ib_friction_slip_eps > 0, eps is floored at the stick limit mu*|F_n|*dt/m_t, which keeps the explicit update stable. With 0 it is v_t/|v_t|, left unscaled at exactly zero slip.

Definition at line 470 of file m_collisions.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ s_initialize_collisions_module()

subroutine, public m_collisions::s_initialize_collisions_module

Definition at line 502 of file m_collisions.fpp.f90.

Here is the call graph for this function:

◆ s_resize_pair_bits()

subroutine m_collisions::s_resize_pair_bits ( integer, intent(in) num_bodies)

Size the pair bitset for num_bodies IBs, doubled so a growing body count does not reallocate every step (empty on exit).

Definition at line 623 of file m_collisions.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ collision_lookup

integer, dimension(:,:), allocatable m_collisions::collision_lookup

Definition at line 388 of file m_collisions.fpp.f90.

◆ collisions_active

logical, public m_collisions::collisions_active

true when any IB-IB or IB-wall contact was detected on this rank since the last adaptive-dt computation

Definition at line 417 of file m_collisions.fpp.f90.

◆ damping_parameter

real(wp) m_collisions::damping_parameter

Definition at line 390 of file m_collisions.fpp.f90.

◆ pair_bits

integer, dimension(:), allocatable m_collisions::pair_bits

One bit per unordered pair (a < b) of this rank's IBs (local + neighborhood indices, a triangular index over pair_bits_capacity): the ghost-point candidate pass claims each pair with an atomic OR, so only the first thread to find a pair records it and duplicates are dropped on the GPU. Bits are cleared after the forces are applied, so the set is empty between calls. Sized from num_ibs and regrown with it; memory is quadratic in the body count (1e4 bodies take 6 MB).

Definition at line 423 of file m_collisions.fpp.f90.

◆ pair_bits_capacity

integer m_collisions::pair_bits_capacity

Number of IBs the bitset is indexed for.

Definition at line 424 of file m_collisions.fpp.f90.

◆ spring_stiffness

real(wp) m_collisions::spring_stiffness

Definition at line 390 of file m_collisions.fpp.f90.

◆ wall_overlap_distances

real(wp), dimension(:,:), allocatable m_collisions::wall_overlap_distances

Definition at line 389 of file m_collisions.fpp.f90.