@@ -128,51 +128,62 @@ function compute_density!(system, u, u_ode, semi, ::SummationDensity)
128128end
129129
130130# With 'SummationDensity', density is calculated in wcsph/system.jl:compute_density!
131- @inline function continuity_equation! (dv, density_calculator :: SummationDensity ,
131+ @inline function continuity_equation! (drho_particle, :: SummationDensity ,
132132 particle_system, neighbor_system,
133- v_particle_system, v_neighbor_system,
134133 particle, neighbor, pos_diff, distance,
135- m_b, rho_a, rho_b, grad_kernel)
136- return dv
134+ m_b, rho_a, rho_b, v_a, v_b, grad_kernel)
135+ return drho_particle
137136end
138137
139138# This formulation was chosen to be consistent with the used pressure_acceleration formulations
140- @propagate_inbounds function continuity_equation! (dv, density_calculator:: ContinuityDensity ,
139+ @propagate_inbounds function continuity_equation! (drho_particle,
140+ :: ContinuityDensity ,
141141 particle_system:: AbstractFluidSystem ,
142142 neighbor_system,
143- v_particle_system, v_neighbor_system,
144143 particle, neighbor, pos_diff, distance,
145- m_b, rho_a, rho_b, grad_kernel)
146- return continuity_equation! (dv , particle_system, neighbor_system, v_particle_system ,
147- v_neighbor_system, particle, neighbor, pos_diff, distance,
148- m_b, rho_a, rho_b, grad_kernel)
144+ m_b, rho_a, rho_b, v_a, v_b, grad_kernel)
145+ continuity_equation! (drho_particle , particle_system, neighbor_system,
146+ particle, neighbor, pos_diff, distance,
147+ m_b, rho_a, rho_b, v_a, v_b , grad_kernel)
149148end
150149
151- @propagate_inbounds function continuity_equation! (dv, particle_system, neighbor_system ,
152- v_particle_system, v_neighbor_system ,
150+ @propagate_inbounds function continuity_equation! (drho_particle ,
151+ particle_system, neighbor_system ,
153152 particle, neighbor, pos_diff, distance,
154- m_b, rho_a, rho_b, grad_kernel)
155- vdiff = current_velocity (v_particle_system, particle_system, particle) -
156- current_velocity (v_neighbor_system, neighbor_system, neighbor)
153+ m_b, rho_a, rho_b, v_a, v_b, grad_kernel)
154+ v_diff = v_a - v_b
157155
158- vdiff += continuity_equation_shifting_term (shifting_technique (particle_system),
156+ v_diff = continuity_equation_shifting_term (v_diff,
157+ shifting_technique (particle_system),
159158 particle_system, neighbor_system,
160159 particle, neighbor, rho_a, rho_b)
161160
162161 # Since this is one of the most performance critical functions, using fast divisions
163162 # here gives a significant speedup on GPUs.
164163 # See the docs page "Development" for more details on `div_fast`.
165- dv[ end , particle ] += div_fast (rho_a, rho_b) * m_b * dot (vdiff , grad_kernel)
164+ drho_particle[ ] += div_fast (rho_a, rho_b) * m_b * dot (v_diff , grad_kernel)
166165
167166 # Artificial density diffusion should only be applied to systems representing a fluid
168167 # with the same physical properties i.e. density and viscosity.
169168 # TODO : shouldn't be applied to particles on the interface (depends on PR #539)
170169 if particle_system === neighbor_system
171- density_diffusion! (dv, density_diffusion (particle_system),
172- v_particle_system, particle, neighbor,
173- pos_diff, distance, m_b, rho_a, rho_b, particle_system,
174- grad_kernel)
170+ density_diffusion! (drho_particle, density_diffusion (particle_system),
171+ particle_system, particle, neighbor,
172+ pos_diff, distance, m_b, rho_a, rho_b, grad_kernel)
175173 end
174+
175+ return drho_particle
176+ end
177+
178+ @inline function write_drho_particle! (dv, density_calculator, drho_particle, particle)
179+ return dv
180+ end
181+
182+ @propagate_inbounds function write_drho_particle! (dv, :: ContinuityDensity ,
183+ drho_particle, particle)
184+ dv[end , particle] += drho_particle[]
185+
186+ return dv
176187end
177188
178189function calculate_dt (v_ode, u_ode, cfl_number, system:: AbstractFluidSystem , semi)
0 commit comments