Skip to content
Open
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
2 changes: 2 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ LoggingExtras = "e6f89c97-d47a-5376-807f-9c37f3926c36"
Parameters = "d96e819e-fc66-5662-9728-84c9c7592b0a"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
ProgressMeter = "92933f4c-e287-5a05-a399-4b506db050ca"
SIMD = "fdea26ae-647d-5447-a871-4b548cad5224"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
StructArrays = "09ab397b-f2b6-538f-b94a-2f83cf4a842a"
TimerOutputs = "a759f4b9-e2f1-59dc-863e-4aeb61b1ea8f"
Expand All @@ -35,6 +36,7 @@ LoggingExtras = "1.1.0"
Parameters = "0.12.3"
Printf = "1.10"
ProgressMeter = "1.11.0"
SIMD = "3.5.0"
StaticArrays = "1.9.15"
StructArrays = "0.7.1"
TimerOutputs = "0.5.29"
Expand Down
29 changes: 26 additions & 3 deletions src/SimulationEquations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export EquationOfState, EquationOfStateGamma7, Pressure!, DensityEpsi!, LimitDen
using StaticArrays
using Parameters
using FastPow
using SIMD

@inline function EquationOfStateGamma7(ρ,c₀,ρ₀)
return @fastpow ((c₀^2*ρ₀)/7) * ((ρ/ρ₀)^7 - 1)
Expand All @@ -26,10 +27,32 @@ end
# This is to handle the special factor multiplied on density in the time stepping procedure, when
# using symplectic time stepping
@inline function DensityEpsi!(Density, dρdtIₙ⁺,ρₙ⁺,Δt)
@inbounds for i in eachindex(Density)
epsi = - (dρdtIₙ⁺[i] / ρₙ⁺[i]) * Δt
Density[i] *= (2 - epsi) / (2 + epsi)
_density_epsi_simd!(Density, dρdtIₙ⁺, ρₙ⁺, Δt)
return Density
end

@inline function _density_epsi_simd!(Density, dρdtIₙ⁺, ρₙ⁺, Δt)
T = eltype(Density)
lanes = T === Float32 ? 8 : 4
W = Vec{lanes, T}
n = length(Density)
i = 1

@inbounds while i <= n - lanes + 1
density_vec = vload(W, Density, i)
dρdt_vec = vload(W, dρdtIₙ⁺, i)
ρn_vec = vload(W, ρₙ⁺, i)
epsi_vec = -(dρdt_vec / ρn_vec) * T(Δt)
ratio_vec = (T(2) - epsi_vec) / (T(2) + epsi_vec)
vstore!(Density, i, density_vec * ratio_vec)
i += lanes
end

@inbounds for j in i:n
epsi = - (dρdtIₙ⁺[j] / ρₙ⁺[j]) * Δt
Density[j] *= (2 - epsi) / (2 + epsi)
end
return Density
end

# This version of the function using !Bool(MotionLimiter) instead of BoundaryBool
Expand Down