forked from trixi-framework/TrixiParticles.jl
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvalidation.jl
More file actions
138 lines (129 loc) · 6.98 KB
/
validation.jl
File metadata and controls
138 lines (129 loc) · 6.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
@testset verbose=true "Validation" begin
@trixi_testset "general" begin
@trixi_test_nowarn trixi_include(@__MODULE__,
joinpath(validation_dir(), "general",
"investigate_relaxation.jl"),
tspan=(0.0, 1.0))
@test sol.retcode == ReturnCode.Success
@test count_rhs_allocations(sol, semi) == 0
# Verify number of plots
@test plot1.n == 4
end
@trixi_testset "oscillating_beam_2d" begin
@trixi_test_nowarn trixi_include(@__MODULE__,
joinpath(validation_dir(), "oscillating_beam_2d",
"validation_oscillating_beam_2d.jl"),
tspan=(0.0, 1.0)) [
r"\[ Info: To create the self-interaction neighborhood search.*\n"
]
@test sol.retcode == ReturnCode.Success
if VERSION < v"1.12"
# Older Julia versions produce allocations because `get_neighborhood_search`
# is not type-stable with TLSPH.
@test count_rhs_allocations(sol, semi) < 200
else
@test count_rhs_allocations(sol, semi) == 0
end
@test isapprox(error_deflection_x, 0, atol=eps())
@test isapprox(error_deflection_y, 0, atol=eps())
# Ignore method redefinitions from duplicate `include("../validation_util.jl")`
@trixi_test_nowarn trixi_include(@__MODULE__,
joinpath(validation_dir(), "oscillating_beam_2d",
"plot_oscillating_beam_results.jl")) [
r"WARNING: Method definition linear_interpolation.*\n",
r"WARNING: Method definition interpolated_mse.*\n",
r"WARNING: Method definition extract_number_from_filename.*\n",
r"WARNING: Method definition extract_resolution_from_filename.*\n",
r"WARNING: importing deprecated binding Makie.*\n",
r"WARNING: Makie.* is deprecated.*\n",
r" likely near none:1\n",
r", use .* instead.\n"
]
# Verify number of plots
@test length(ax1.scene.plots) >= 6
end
@trixi_testset "dam_break_2d" begin
# Use `SerialUpdate()` to obtain consistent results when using multiple
# threads and a shorter tspan to speed up CI tests.
@trixi_test_nowarn trixi_include(@__MODULE__,
joinpath(validation_dir(), "dam_break_2d",
"validation_dam_break_2d.jl"),
update_strategy=SerialUpdate(),
tspan=(0.0, 4 / sqrt(9.81 / 0.6))) [
r"┌ Info: The desired tank length in y-direction.*\n",
r"└ New tank length in y-direction is set to.*\n",
r"WARNING: Method definition max_x_coord.*\n",
r"WARNING: Method definition interpolated_pressure.*\n"
]
@test sol.retcode == ReturnCode.Success
@test count_rhs_allocations(sol, semi) == 0
# Note that pressure values are in the order of 1e5
@test isapprox(error_wcsph_P1, 0, atol=eps(1e5))
@test isapprox(error_wcsph_P2, 0, atol=eps(1e5))
@test isapprox(error_edac_P1, 0, atol=eps(1e5))
@test isapprox(error_edac_P2, 0, atol=eps(1e5))
# Ignore method redefinitions from duplicate `include("../validation_util.jl")`
@trixi_test_nowarn trixi_include(@__MODULE__,
joinpath(validation_dir(), "dam_break_2d",
"plot_pressure_sensors.jl")) [
r"WARNING: Method definition linear_interpolation.*\n",
r"WARNING: Method definition interpolated_mse.*\n",
r"WARNING: Method definition extract_number_from_filename.*\n"
]
# Verify number of plots
@test length(axs_edac[1].scene.plots) >= 2
@test length(axs_wcsph[1].scene.plots) >= 2
# Ignore method redefinitions from duplicate `include("../validation_util.jl")`
@trixi_test_nowarn trixi_include(@__MODULE__,
joinpath(validation_dir(), "dam_break_2d",
"plot_surge_front.jl")) [
r"WARNING: Method definition linear_interpolation.*\n",
r"WARNING: Method definition interpolated_mse.*\n",
r"WARNING: Method definition extract_number_from_filename.*\n"
]
# Verify number of plots
@test length(axs_edac[1].scene.plots) >= 2
@test length(axs_wcsph[1].scene.plots) >= 2
end
@trixi_testset "hydrostatic_water_column_2d" begin
@trixi_test_nowarn trixi_include(@__MODULE__,
joinpath(validation_dir(),
"hydrostatic_water_column_2d",
"validation.jl"), tspan=(0.0, 0.3),
n_particles_plate_y=3) [
r"┌ Info: The desired tank length in y-direction.*\n",
r"└ New tank length in y-direction is set to.*\n",
r"\[ Info: To create the self-interaction neighborhood search.*\n"
]
# We compare the relative error to the analytical solution
@test isapprox(errors[:edac][2], 0.0, atol=0.033)
@test isapprox(errors[:wcsph][2], 0.0, atol=0.045)
end
@trixi_testset "TGV_2D" begin
@trixi_test_nowarn trixi_include(@__MODULE__,
joinpath(validation_dir(),
"taylor_green_vortex_2d",
"validation_taylor_green_vortex_2d.jl"),
tspan=(0.0, 0.01)) [
r"WARNING: Method definition pressure_function.*\n",
r"WARNING: Method definition initial_pressure_function.*\n",
r"WARNING: Method definition velocity_function.*\n",
r"WARNING: Method definition initial_velocity_function.*\n"
]
@test sol.retcode == ReturnCode.Success
@test count_rhs_allocations(sol, semi) == 0
end
@trixi_testset "LDC_2D" begin
@trixi_test_nowarn trixi_include(@__MODULE__,
joinpath(validation_dir(),
"lid_driven_cavity_2d",
"validation_lid_driven_cavity_2d.jl"),
tspan=(0.0, 0.02), dt=0.01,
SENSOR_CAPTURE_TIME=0.01) [
r"WARNING: Method definition lid_movement_function.*\n",
r"WARNING: Method definition is_moving.*\n"
]
@test sol.retcode == ReturnCode.Success
@test count_rhs_allocations(sol, semi) == 0
end
end