Skip to content

Commit 16bbe77

Browse files
LasNikasLasNikas
andauthored
Fix pressure setter (#894)
* fix setter * revise * rm setter from wcsph * dump StrideArrays * add deps --------- Co-authored-by: LasNikas <niklas.nehe@web.de>
1 parent 4b62d60 commit 16bbe77

5 files changed

Lines changed: 28 additions & 21 deletions

File tree

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ RecipesBase = "3cdcf5f2-1ef4-517c-9805-6587b60abb01"
2727
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
2828
SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
2929
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
30-
StrideArrays = "d1fa6d79-ef01-42a6-86c9-f7c551f8593b"
30+
StrideArraysCore = "7792a7ef-975c-4747-a70f-980b88e8d1da"
3131
TimerOutputs = "a759f4b9-e2f1-59dc-863e-4aeb61b1ea8f"
3232
TrixiBase = "9a0f1c46-06d5-4909-a5a3-ce25d3fa3284"
3333
WriteVTK = "64499a7a-5c06-52f2-abe2-ccb03c286192"
@@ -61,7 +61,7 @@ RecipesBase = "1"
6161
Reexport = "1"
6262
SciMLBase = "2"
6363
StaticArrays = "1"
64-
StrideArrays = "0.1"
64+
StrideArraysCore = "0.5.7"
6565
TimerOutputs = "0.5.25"
6666
TrixiBase = "0.1.5"
6767
WriteVTK = "1.21.2"

src/TrixiParticles.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ using SciMLBase: CallbackSet, DiscreteCallback, DynamicalODEProblem, u_modified!
2626
get_tmp_cache, set_proposed_dt!, ODESolution, ODEProblem, terminate!
2727
@reexport using StaticArrays: SVector
2828
using StaticArrays: @SMatrix, SMatrix, setindex
29-
using StrideArrays: PtrArray, StaticInt
29+
using StrideArraysCore: PtrArray, StaticInt
3030
using TimerOutputs: TimerOutput, TimerOutputs, print_timer, reset_timer!, @notimeit
3131
using TrixiBase: @trixi_timeit, timer, timeit_debug_enabled,
3232
disable_debug_timings, enable_debug_timings, TrixiBase

src/schemes/boundary/open_boundary/system.jl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,20 @@ end
241241
return system.pressure
242242
end
243243

244+
@inline function set_particle_pressure!(v, system::OpenBoundarySPHSystem, particle,
245+
pressure)
246+
system.pressure[particle] = pressure
247+
248+
return v
249+
end
250+
251+
@inline function set_particle_density!(v, system::OpenBoundarySPHSystem, particle,
252+
density)
253+
system.density[particle] = density
254+
255+
return v
256+
end
257+
244258
function update_boundary_interpolation!(system::OpenBoundarySPHSystem, v, u, v_ode, u_ode,
245259
semi, t)
246260
update_boundary_model!(system, system.boundary_model, v, u, v_ode, u_ode, semi, t)

src/schemes/fluid/entropically_damped_sph/system.jl

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -257,18 +257,6 @@ end
257257

258258
@inline system_state_equation(system::EntropicallyDampedSPHSystem) = nothing
259259

260-
# WARNING!
261-
# These functions are intended to be used internally to set the pressure
262-
# of newly activated particles in a callback.
263-
# DO NOT use outside a callback. OrdinaryDiffEq does not allow changing `v` and `u`
264-
# outside of callbacks.
265-
@inline function set_particle_pressure!(v, system::EntropicallyDampedSPHSystem, particle,
266-
pressure)
267-
v[end, particle] = pressure
268-
269-
return v
270-
end
271-
272260
@inline system_sound_speed(system::EntropicallyDampedSPHSystem) = system.sound_speed
273261

274262
@inline transport_velocity(system::EntropicallyDampedSPHSystem) = system.transport_velocity

src/schemes/fluid/fluid.jl

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
1+
# WARNING!
2+
# These functions are intended to be used internally to set the density
3+
# of newly activated particles in a callback.
4+
# DO NOT use outside a callback. OrdinaryDiffEq does not allow changing `v` and `u`
5+
# outside of callbacks.
16
@inline function set_particle_density!(v, system::FluidSystem, particle, density)
2-
set_particle_density!(v, system, system.density_calculator, particle, density)
7+
current_density(v, system)[particle] = density
8+
9+
return v
310
end
411

512
# WARNING!
6-
# These functions are intended to be used internally to set the density
13+
# These functions are intended to be used internally to set the pressure
714
# of newly activated particles in a callback.
815
# DO NOT use outside a callback. OrdinaryDiffEq does not allow changing `v` and `u`
916
# outside of callbacks.
10-
@inline set_particle_density!(v, system, ::SummationDensity, particle, density) = v
11-
12-
@inline function set_particle_density!(v, system, ::ContinuityDensity, particle, density)
13-
v[end, particle] = density
17+
@inline function set_particle_pressure!(v, system::FluidSystem, particle, pressure)
18+
current_pressure(v, system)[particle] = pressure
1419

1520
return v
1621
end

0 commit comments

Comments
 (0)