From f1a1d48cb6ec7d265cb2e24f6917b5ba4e2e2893 Mon Sep 17 00:00:00 2001 From: LasNikas Date: Mon, 7 Oct 2024 16:33:36 +0200 Subject: [PATCH] implement suggestions --- docs/src/systems/entropically_damped_sph.md | 2 +- src/schemes/fluid/entropically_damped_sph/system.jl | 8 +++----- src/schemes/fluid/transport_velocity.jl | 7 ++----- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/docs/src/systems/entropically_damped_sph.md b/docs/src/systems/entropically_damped_sph.md index 2f285df71..e81de5cad 100644 --- a/docs/src/systems/entropically_damped_sph.md +++ b/docs/src/systems/entropically_damped_sph.md @@ -109,7 +109,7 @@ Here, ``\tilde{p}_{ab}`` is the density-weighted pressure \tilde{p}_{ab} = \frac{\rho_b p_a + \rho_a p_b}{\rho_a + \rho_b}, ``` -with the density ``\rho_a``, ``\rho_b`` and the pressure ``p_a``, ``p_b`` of particles ``a`` and ``b`` respectively. ``\bm{A}_a`` and ``\bm{A}_b`` are the convection tensors for particle ``a`` and ``b`` respectively and is given, e.g. for particle ``a``, as ``\bm{A}_a = \rho v_a\left(\tilde{v}_a-v_a\right)^T``. +with the density ``\rho_a``, ``\rho_b`` and the pressure ``p_a``, ``p_b`` of particles ``a`` and ``b`` respectively. ``\bm{A}_a`` and ``\bm{A}_b`` are the convection tensors for particle ``a`` and ``b`` respectively and are given, e.g. for particle ``a``, as ``\bm{A}_a = \rho v_a\left(\tilde{v}_a-v_a\right)^T``. ```@autodocs Modules = [TrixiParticles] diff --git a/src/schemes/fluid/entropically_damped_sph/system.jl b/src/schemes/fluid/entropically_damped_sph/system.jl index d93ae6982..614190934 100644 --- a/src/schemes/fluid/entropically_damped_sph/system.jl +++ b/src/schemes/fluid/entropically_damped_sph/system.jl @@ -246,11 +246,9 @@ function update_average_pressure!(system, ::TransportVelocityAdami, v_ode, u_ode end end - for particle in eachparticle(system) - if neighbor_counter[particle] > 0 - pressure_average[particle] /= neighbor_counter[particle] - end - end + pressure_average ./= neighbor_counter + + return system end function write_v0!(v0, system::EntropicallyDampedSPHSystem, ::SummationDensity) diff --git a/src/schemes/fluid/transport_velocity.jl b/src/schemes/fluid/transport_velocity.jl index 07505bb29..26a3688b6 100644 --- a/src/schemes/fluid/transport_velocity.jl +++ b/src/schemes/fluid/transport_velocity.jl @@ -13,11 +13,8 @@ See [TVF](@ref transport_velocity_formulation) for more details of the method. Thus, it is highly recommended to use [`ViscosityAdami`](@ref) as viscosity model, since [`ArtificialViscosityMonaghan`](@ref) leads to bad results. """ -struct TransportVelocityAdami{ELTYPE} - background_pressure::ELTYPE - function TransportVelocityAdami(background_pressure::Real) - new{typeof(background_pressure)}(background_pressure) - end +struct TransportVelocityAdami{T<:Real} + background_pressure::T end # Calculate `v_nvariables` appropriately