Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warn user when choosing wrong wall viscosity model #445

Merged
merged 8 commits into from
Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/src/systems/boundary.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@ viscosity parameter of the adjacent fluid or the equivalent from the artificial
viscous interaction (default `viscosity=nothing`), a free-slip wall boundary
condition is applied.

!!! warning
The viscosity model [`ArtificialViscosityMonaghan`](@ref) for [`BoundaryModelDummyParticles`](@ref)
has not been verified yet.

### References
- S. Adami, X. Y. Hu, N. A. Adams.
"A generalized wall boundary condition for smoothed particle hydrodynamics".
Expand Down
9 changes: 4 additions & 5 deletions src/schemes/boundary/dummy_particles/dummy_particles.jl
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ function create_cache_model(viscosity::Nothing, n_particles, n_dims)
return (;)
end

function create_cache_model(viscosity::ViscosityAdami, n_particles, n_dims)
ELTYPE = eltype(viscosity.nu)
function create_cache_model(viscosity, n_particles, n_dims)
ELTYPE = eltype(viscosity.epsilon)

wall_velocity = zeros(ELTYPE, n_dims, n_particles)

Expand Down Expand Up @@ -425,12 +425,11 @@ function compute_smoothed_velocity!(cache, viscosity::ViscosityAdami,
return cache
end

@inline function compute_wall_velocity!(viscosity, system, system_coords, particle)
@inline function compute_wall_velocity!(viscosity::Nothing, system, system_coords, particle)
return viscosity
end

@inline function compute_wall_velocity!(viscosity::ViscosityAdami, system,
system_coords, particle)
@inline function compute_wall_velocity!(viscosity, system, system_coords, particle)
(; boundary_model) = system
(; cache) = boundary_model
(; volume, wall_velocity) = cache
Expand Down
4 changes: 2 additions & 2 deletions src/schemes/boundary/system.jl
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,11 @@ end
return viscous_velocity(v, system.boundary_model.viscosity, system, particle)
end

@inline function viscous_velocity(v, ::ViscosityAdami, system, particle)
@inline function viscous_velocity(v, viscosity, system, particle)
return extract_svector(system.boundary_model.cache.wall_velocity, system, particle)
end

@inline function viscous_velocity(v, viscosity, system, particle)
@inline function viscous_velocity(v, viscosity::Nothing, system, particle)
return current_velocity(v, system, particle)
end

Expand Down
4 changes: 2 additions & 2 deletions src/schemes/fluid/viscosity.jl
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ end
rho_mean)
(; smoothing_length) = particle_system

v_a = current_velocity(v_particle_system, particle_system, particle)
v_b = current_velocity(v_neighbor_system, neighbor_system, neighbor)
v_a = viscous_velocity(v_particle_system, particle_system, particle)
v_b = viscous_velocity(v_neighbor_system, neighbor_system, neighbor)
v_diff = v_a - v_b

pi_ab = viscosity(sound_speed, v_diff, pos_diff, distance, rho_mean, smoothing_length)
Expand Down
Loading