@@ -41,6 +41,9 @@ function interact!(dv, v_particle_system, u_particle_system,
4141 rho_a = @inbounds current_density (v_particle_system, particle_system, particle)
4242 rho_b = @inbounds current_density (v_neighbor_system, neighbor_system, neighbor)
4343
44+ v_a = @inbounds current_velocity (v_particle_system, particle_system, particle)
45+ v_b = @inbounds current_velocity (v_neighbor_system, neighbor_system, neighbor)
46+
4447 m_a = @inbounds hydrodynamic_mass (particle_system, particle)
4548 m_b = @inbounds hydrodynamic_mass (neighbor_system, neighbor)
4649
@@ -58,15 +61,17 @@ function interact!(dv, v_particle_system, u_particle_system,
5861 dv_pressure_boundary = 2 * p_boundary * (m_b / (rho_a * rho_b)) * grad_kernel
5962
6063 # Propagate `@inbounds` to the viscosity function, which accesses particle data
61- dv_viscosity_ = @inbounds dv_viscosity (viscosity_model (fluid_system,
62- neighbor_system),
63- particle_system, neighbor_system,
64- v_particle_system, v_neighbor_system,
65- particle, neighbor, pos_diff, distance,
66- sound_speed, m_a, m_b, rho_a, rho_b,
67- grad_kernel)
68-
69- dv_particle = dv_pressure + dv_viscosity_ + dv_pressure_boundary
64+ dv_viscosity_ = Ref (zero (pos_diff))
65+ @inbounds dv_viscosity! (dv_viscosity_,
66+ viscosity_model (fluid_system,
67+ neighbor_system),
68+ particle_system, neighbor_system,
69+ v_particle_system, v_neighbor_system,
70+ particle, neighbor, pos_diff, distance,
71+ sound_speed, m_a, m_b, rho_a, rho_b,
72+ v_a, v_b, grad_kernel)
73+
74+ dv_particle = dv_pressure + dv_viscosity_[] + dv_pressure_boundary
7075
7176 for i in 1 : ndims (particle_system)
7277 @inbounds dv[i, particle] += dv_particle[i]
0 commit comments