Skip to content

Commit 7c0d6ea

Browse files
committed
Move mean density calculation into free surface calculation
1 parent 6faebb0 commit 7c0d6ea

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/general/corrections.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,16 @@ end
3535
# `rho_mean` is the mean density of the fluid, which is used to determine correction values near the free surface.
3636
# Return a tuple `(viscosity_correction, pressure_correction, surface_tension_correction)` representing the correction terms.
3737
@inline function free_surface_correction(correction::AkinciFreeSurfaceCorrection,
38-
particle_system, rho_mean)
38+
particle_system, rho_a, rho_b)
3939
# Equation 4 in ref
40+
rho_mean = (rho_a + rho_b) / 2
4041
k = correction.rho0 / rho_mean
4142

4243
# Viscosity, pressure, surface_tension
4344
return k, 1, k
4445
end
4546

46-
@inline function free_surface_correction(correction, particle_system, rho_mean)
47+
@inline function free_surface_correction(correction, particle_system, rho_a, rho_b)
4748
return 1, 1, 1
4849
end
4950

src/schemes/fluid/weakly_compressible_sph/rhs.jl

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ function interact!(dv, v_particle_system, u_particle_system,
5858
m_b = @inbounds hydrodynamic_mass(neighbor_system, neighbor)
5959
v_b = @inbounds current_velocity(v_neighbor_system, neighbor_system, neighbor)
6060
rho_b = @inbounds current_density(v_neighbor_system, neighbor_system, neighbor)
61-
rho_mean = (rho_a + rho_b) / 2
6261

6362
# The following call is equivalent to
6463
# `p_b = current_pressure(v_neighbor_system, neighbor_system, neighbor)`
@@ -73,7 +72,7 @@ function interact!(dv, v_particle_system, u_particle_system,
7372
(viscosity_correction, pressure_correction,
7473
surface_tension_correction) = free_surface_correction(correction,
7574
particle_system,
76-
rho_mean)
75+
rho_a, rho_b)
7776

7877
# For `ContinuityDensity` without correction, this is equivalent to
7978
# dv_pressure = -m_b * (p_a + p_b) / (rho_a * rho_b) * grad_kernel

0 commit comments

Comments
 (0)