Skip to content

Commit a6beb81

Browse files
author
LasNikas
committed
Merge branch 'main' into oriented-bbox
2 parents b19c703 + 184e529 commit a6beb81

38 files changed

+53499
-6412
lines changed

.buildkite/pipeline.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ steps:
22
- label: "CUDA"
33
plugins:
44
- JuliaCI/julia#v1:
5-
version: "1"
5+
version: "1.11"
66
agents:
77
queue: "juliagpu"
88
cuda: "*"
@@ -16,7 +16,7 @@ steps:
1616
- label: "AMDGPU"
1717
plugins:
1818
- JuliaCI/julia#v1:
19-
version: "1"
19+
version: "1.11"
2020
agents:
2121
queue: "juliagpu"
2222
rocm: "*"
@@ -30,7 +30,7 @@ steps:
3030
- label: "Metal"
3131
plugins:
3232
- JuliaCI/julia#v1:
33-
version: "1"
33+
version: "1.11"
3434
agents:
3535
queue: "juliaecosystem"
3636
os: "macos"

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
matrix:
4444
version:
4545
- '1.10'
46-
- '1'
46+
- '1.11'
4747
os:
4848
- ubuntu-latest
4949
include:
@@ -53,9 +53,9 @@ jobs:
5353
os: windows-latest
5454
- version: '1.10'
5555
os: macos-14
56-
- version: '1'
56+
- version: '1.11'
5757
os: windows-latest
58-
- version: '1'
58+
- version: '1.11'
5959
os: macos-14
6060

6161
steps:

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ docs/src/news.md
1212
docs/src/tutorials
1313
*_replaced.md
1414
run
15-
*.json
1615
!.zenodo.json
1716
*.png
1817
*.jpg

examples/fluid/dam_break_2d.jl

Lines changed: 12 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ boundary_particle_spacing = fluid_particle_spacing / spacing_ratio
3333
# ==== Experiment Setup
3434
gravity = 9.81
3535

36-
tspan = (0.0, 5.7 / sqrt(gravity))
36+
tspan = (0.0, 5.7 / sqrt(gravity / H))
3737

3838
# Boundary geometry and initial fluid particle positions
3939
initial_fluid_size = (W, H)
@@ -50,29 +50,19 @@ tank = RectangularTank(fluid_particle_spacing, initial_fluid_size, tank_size, fl
5050

5151
# ==========================================================================================
5252
# ==== Fluid
53-
smoothing_length = 1.75 * fluid_particle_spacing
53+
smoothing_length = 2 * fluid_particle_spacing
5454
smoothing_kernel = WendlandC2Kernel{2}()
5555

5656
fluid_density_calculator = ContinuityDensity()
57+
5758
alpha = 0.02
5859
viscosity_fluid = ArtificialViscosityMonaghan(alpha=alpha, beta=0.0)
59-
# A typical formula to convert Artificial viscosity to a
60-
# kinematic viscosity is provided by Monaghan as
61-
# nu = alpha * smoothing_length * sound_speed/8
62-
63-
# Alternatively a kinematic viscosity for water can be set
64-
# nu = 1.0e-6
6560

66-
# This allows the use of a physical viscosity model like:
67-
# viscosity_fluid = ViscosityAdami(nu=nu)
68-
# or with additional dissipation through a Smagorinsky model
69-
# viscosity_fluid = ViscosityAdamiSGS(nu=nu)
70-
# For more details see the documentation "Viscosity model overview".
71-
72-
# Alternatively the density diffusion model by Molteni & Colagrossi can be used,
73-
# which will run faster.
74-
# density_diffusion = DensityDiffusionMolteniColagrossi(delta=0.1)
75-
density_diffusion = DensityDiffusionAntuono(tank.fluid, delta=0.1)
61+
# The density diffusion model by Molteni and Colagrossi shows unphysical effects at the
62+
# free surface in long-running simulations, but is significantly faster than the model
63+
# by Antuono. This simulation is short enough to use the faster model.
64+
density_diffusion = DensityDiffusionMolteniColagrossi(delta=0.1)
65+
# density_diffusion = DensityDiffusionAntuono(tank.fluid, delta=0.1)
7666

7767
fluid_system = WeaklyCompressibleSPHSystem(tank.fluid, fluid_density_calculator,
7868
state_equation, smoothing_kernel,
@@ -86,9 +76,8 @@ fluid_system = WeaklyCompressibleSPHSystem(tank.fluid, fluid_density_calculator,
8676
# ==== Boundary
8777
boundary_density_calculator = AdamiPressureExtrapolation()
8878
viscosity_wall = nothing
89-
# For a no-slip condition the corresponding wall viscosity without SGS can be set
90-
# viscosity_wall = ViscosityAdami(nu=nu)
91-
# viscosity_wall = ViscosityMorris(nu=nu)
79+
# For a no-slip boundary condition, define a wall viscosity:
80+
# viscosity_wall = viscosity_fluid
9281
boundary_model = BoundaryModelDummyParticles(tank.boundary.density, tank.boundary.mass,
9382
state_equation=state_equation,
9483
boundary_density_calculator,
@@ -114,15 +103,9 @@ info_callback = InfoCallback(interval=100)
114103
solution_prefix = ""
115104
saving_callback = SolutionSavingCallback(dt=0.02, prefix=solution_prefix)
116105

117-
# Save at certain timepoints which allows comparison to the results of Marrone et al.,
118-
# i.e. (1.5, 2.36, 3.0, 5.7, 6.45).
119-
# Please note that the images in Marrone et al. are obtained at a particle_spacing = H/320,
120-
# which takes between 2 and 4 hours.
121-
saving_paper = SolutionSavingCallback(save_times=[0.0, 0.371, 0.584, 0.743, 1.411, 1.597],
122-
prefix="marrone_times")
123-
124106
# This can be overwritten with `trixi_include`
125107
extra_callback = nothing
108+
extra_callback2 = nothing
126109

127110
use_reinit = false
128111
density_reinit_cb = use_reinit ?
@@ -131,7 +114,7 @@ density_reinit_cb = use_reinit ?
131114
stepsize_callback = StepsizeCallback(cfl=0.9)
132115

133116
callbacks = CallbackSet(info_callback, saving_callback, stepsize_callback, extra_callback,
134-
density_reinit_cb, saving_paper)
117+
extra_callback2, density_reinit_cb)
135118

136119
time_integration_scheme = CarpenterKennedy2N54(williamson_condition=false)
137120
sol = solve(ode, time_integration_scheme,

examples/fluid/dam_break_2d_gpu.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ trixi_include(@__MODULE__,
3636
joinpath(examples_dir(), "fluid", "dam_break_2d.jl"),
3737
neighborhood_search=neighborhood_search,
3838
fluid_particle_spacing=fluid_particle_spacing,
39-
tspan=tspan,
39+
tspan=tspan, smoothing_length=smoothing_length,
4040
density_diffusion=density_diffusion,
4141
boundary_layers=boundary_layers, spacing_ratio=spacing_ratio,
4242
boundary_model=boundary_model,

src/TrixiParticles.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ using Adapt: Adapt
66
using Base: @propagate_inbounds
77
using CSV: CSV
88
using Dates
9-
using DataFrames: DataFrame
9+
using DataFrames: DataFrames, DataFrame
1010
using DelimitedFiles: DelimitedFiles
1111
using DiffEqCallbacks: PeriodicCallback, PeriodicCallbackAffect, PresetTimeCallback
1212
using FastPow: @fastpow

src/callbacks/post_process.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,11 @@ function (pp::PostprocessCallback)(integrator; from_initialize=false)
238238
# comes AFTER the `PostprocessCallback` in the `CallbackSet`.
239239
dv_ode, du_ode = zero(vu_ode).x
240240
else
241-
dv_ode, du_ode = get_du(integrator).x
241+
# Depending on the time integration scheme, this might call the RHS function
242+
@trixi_timeit timer() "update du" begin
243+
# Don't create sub-timers here to avoid cluttering the timer output
244+
@notimeit timer() dv_ode, du_ode = get_du(integrator).x
245+
end
242246
end
243247
v_ode, u_ode = vu_ode.x
244248
semi = integrator.p

test/examples/examples_fluid.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@
404404
end
405405

406406
@trixi_testset "fluid/pipe_flow_3d.jl" begin
407-
@trixi_test_nowarn trixi_include(@__MODULE__,
407+
@trixi_test_nowarn trixi_include(@__MODULE__, tspan=(0, 0.1),
408408
joinpath(examples_dir(), "fluid",
409409
"pipe_flow_3d.jl"))
410410
@test sol.retcode == ReturnCode.Success
@@ -415,7 +415,7 @@
415415
@trixi_test_nowarn trixi_include(@__MODULE__,
416416
joinpath(examples_dir(), "fluid",
417417
"poiseuille_flow_2d.jl"),
418-
tspan=(0.0, 0.1))
418+
tspan=(0.0, 0.02))
419419
@test fluid_system isa WeaklyCompressibleSPHSystem
420420
@test sol.retcode == ReturnCode.Success
421421
@test count_rhs_allocations(sol, semi) == 0
@@ -425,7 +425,7 @@
425425
@trixi_test_nowarn trixi_include(@__MODULE__,
426426
joinpath(examples_dir(), "fluid",
427427
"poiseuille_flow_2d.jl"),
428-
tspan=(0.0, 0.1), wcsph=false)
428+
tspan=(0.0, 0.02), wcsph=false)
429429
@test fluid_system isa EntropicallyDampedSPHSystem
430430
@test sol.retcode == ReturnCode.Success
431431
@test count_rhs_allocations(sol, semi) == 0
@@ -589,7 +589,7 @@
589589
@trixi_test_nowarn trixi_include(@__MODULE__,
590590
joinpath(examples_dir(), "fluid",
591591
"dam_break_2d.jl"),
592-
tspan=(0, 0.1), sol=nothing) [
592+
tspan=(0, 0.3), sol=nothing) [
593593
r"┌ Info: The desired tank length in y-direction .*\n",
594594
r"└ New tank length in y-direction.*\n"]
595595

@@ -607,7 +607,7 @@
607607
@trixi_test_nowarn trixi_include(@__MODULE__,
608608
joinpath(examples_dir(), "fluid",
609609
"dam_break_2d.jl"),
610-
tspan=(0, 0.1), sol=nothing,
610+
tspan=(0, 0.3), sol=nothing,
611611
cfl=0.25) [
612612
r"┌ Info: The desired tank length in y-direction .*\n",
613613
r"└ New tank length in y-direction.*\n"]

test/examples/gpu.jl

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -505,19 +505,19 @@ end
505505
cut_off_bnd=false)
506506

507507
@test isapprox(Array(result.computed_density),
508-
Float32[500.33255, 893.09766, 997.7032, 1001.14355, 1001.234,
509-
1001.0098, 1000.4352, 999.7572, 999.1139, 989.6319])
508+
Float32[500.96387, 859.06744, 989.0479, 1001.3735,
509+
1001.30927, 1001.0831, 1000.7325, 1000.3575,
510+
999.8011, 975.98553])
510511

511512
@test isapprox(Array(result.density),
512-
Float32[1002.3152, 1002.19653, 1001.99915, 1001.7685,
513-
1001.5382,
514-
1001.3093, 1001.0836, 1000.8649, 1000.635,
515-
1000.4053])
513+
Float32[1002.1891, 1002.0748, 1001.8913, 1001.67126,
514+
1001.4529, 1001.2382, 1001.0298, 1000.81964,
515+
1000.594, 1000.3878])
516516

517517
@test isapprox(Array(result.pressure),
518-
Float32[5450.902, 5171.2856, 4706.551, 4163.9185, 3621.5042,
519-
3082.6948, 2551.5725, 2036.1208, 1494.8608,
520-
954.14355])
518+
Float32[5154.1177, 4885.1, 4452.6533, 3934.9075, 3420.5737,
519+
2915.0933, 2424.0908, 1929.7888, 1398.8309,
520+
913.2089])
521521
end
522522

523523
@testset verbose=true "Plane" begin
@@ -527,22 +527,19 @@ end
527527

528528
result = interpolate_plane_2d(interpolation_start, interpolation_end,
529529
resolution, semi_new, semi_new.systems[1],
530-
sol;
531-
cut_off_bnd=false)
530+
sol; cut_off_bnd=false)
532531

533532
@test isapprox(Array(result.computed_density),
534-
Float32[250.18625, 500.34482, 499.77225, 254.3632, 499.58026,
535-
999.1413, 998.6351, 503.0122])
533+
Float32[250.47523, 500.98248, 500.49924, 253.77109,
534+
500.0491, 1000.0818, 999.6527, 503.08704])
536535

537536
@test isapprox(Array(result.density),
538-
Float32[1002.34467, 1002.3365, 1001.5021, 999.7109,
539-
1000.84863,
540-
1000.8373, 1000.3423, 1000.20734])
537+
Float32[1002.2373, 1002.22516, 1001.4339, 999.3567,
538+
1000.8318, 1000.80237, 1000.3408, 999.92017])
541539

542540
@test isapprox(Array(result.pressure),
543-
Float32[5520.0513, 5501.1846, 3536.2256, -680.5194,
544-
1997.7814,
545-
1971.0717, 805.8584, 488.4068])
541+
Float32[5267.867, 5239.2466, 3376.045, -1514.4237,
542+
1958.2637, 1888.739, 802.3146, -187.81871])
546543
end
547544
end
548545
end

test/validation/validation.jl

Lines changed: 36 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -38,50 +38,66 @@
3838
end
3939

4040
@trixi_testset "dam_break_2d" begin
41+
# Use `SerialUpdate()` to obtain consistent results when using multiple
42+
# threads and a shorter tspan to speed up CI tests.
4143
@trixi_test_nowarn trixi_include(@__MODULE__,
4244
joinpath(validation_dir(), "dam_break_2d",
43-
"validation_dam_break_2d.jl")) [
45+
"validation_dam_break_2d.jl"),
46+
update_strategy=SerialUpdate(),
47+
tspan=(0.0, 4 / sqrt(9.81 / 0.6))) [
4448
r"┌ Info: The desired tank length in y-direction.*\n",
45-
r"└ New tank length in y-direction is set to.*\n"
49+
r"└ New tank length in y-direction is set to.*\n",
50+
r"WARNING: Method definition max_x_coord.*\n",
51+
r"WARNING: Method definition interpolated_pressure.*\n"
4652
]
4753
@test sol.retcode == ReturnCode.Success
4854
@test count_rhs_allocations(sol, semi) == 0
4955

5056
if Sys.ARCH === :aarch64
5157
# MacOS ARM produces slightly different pressure values than x86.
5258
# Note that pressure values are in the order of 1e5.
53-
@test isapprox(error_edac_P1, 0, atol=5e-6)
54-
@test isapprox(error_edac_P2, 0, atol=4e-11)
55-
@test isapprox(error_wcsph_P1, 0, atol=400.0)
56-
@test isapprox(error_wcsph_P2, 0, atol=0.03)
59+
@test isapprox(error_edac_P1, 0, atol=eps(1e5))
60+
@test isapprox(error_edac_P2, 0, atol=eps(1e5))
61+
@test isapprox(error_wcsph_P1, 0, atol=eps(1e5))
62+
@test isapprox(error_wcsph_P2, 0, atol=eps(1e5))
5763
elseif VERSION < v"1.11"
58-
# 1.10 produces slightly different pressure values than 1.11.
59-
# This is most likely due to muladd and FMA instructions in the
60-
# density diffusion update (inside the StaticArrays matrix-vector product).
61-
# Note that pressure values are in the order of 1e5.
62-
@test isapprox(error_edac_P1, 0, atol=eps())
63-
@test isapprox(error_edac_P2, 0, atol=eps())
64-
@test isapprox(error_wcsph_P1, 0, atol=8.0)
65-
@test isapprox(error_wcsph_P2, 0, atol=5e-4)
64+
# 1.10 produces slightly different pressure values than 1.11
65+
@test isapprox(error_edac_P1, 0, atol=eps(1e5))
66+
@test isapprox(error_edac_P2, 0, atol=eps(1e5))
67+
@test isapprox(error_wcsph_P1, 0, atol=eps(1e5))
68+
@test isapprox(error_wcsph_P2, 0, atol=eps(1e5))
6669
else
67-
# Reference values are computed with 1.11
68-
@test isapprox(error_edac_P1, 0, atol=5e-7)
69-
@test isapprox(error_edac_P2, 0, atol=4e-11)
70+
# Reference values are computed with 1.11 on x86
7071
@test isapprox(error_wcsph_P1, 0, atol=eps())
7172
@test isapprox(error_wcsph_P2, 0, atol=eps())
73+
# Why are these errors not zero?
74+
@test isapprox(error_edac_P1, 0, atol=eps(1e5))
75+
@test isapprox(error_edac_P2, 0, atol=eps(1e5))
7276
end
7377

7478
# Ignore method redefinitions from duplicate `include("../validation_util.jl")`
7579
@trixi_test_nowarn trixi_include(@__MODULE__,
7680
joinpath(validation_dir(), "dam_break_2d",
77-
"plot_dam_break_results.jl")) [
81+
"plot_pressure_sensors.jl")) [
7882
r"WARNING: Method definition linear_interpolation.*\n",
7983
r"WARNING: Method definition interpolated_mse.*\n",
80-
r"WARNING: Method definition extract_number_from_filename.*\n",
81-
r"WARNING: Method definition extract_resolution_from_filename.*\n"
84+
r"WARNING: Method definition extract_number_from_filename.*\n"
85+
]
86+
# Verify number of plots
87+
@test length(axs_edac[1].scene.plots) >= 2
88+
@test length(axs_wcsph[1].scene.plots) >= 2
89+
90+
# Ignore method redefinitions from duplicate `include("../validation_util.jl")`
91+
@trixi_test_nowarn trixi_include(@__MODULE__,
92+
joinpath(validation_dir(), "dam_break_2d",
93+
"plot_surge_front.jl")) [
94+
r"WARNING: Method definition linear_interpolation.*\n",
95+
r"WARNING: Method definition interpolated_mse.*\n",
96+
r"WARNING: Method definition extract_number_from_filename.*\n"
8297
]
8398
# Verify number of plots
8499
@test length(axs_edac[1].scene.plots) >= 2
100+
@test length(axs_wcsph[1].scene.plots) >= 2
85101
end
86102

87103
@trixi_testset "TGV_2D" begin

0 commit comments

Comments
 (0)