-
Notifications
You must be signed in to change notification settings - Fork 121
Validate PlotData2D
with LinearScalarAdvectionEquation3D
#2377
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
354fdc8
8c7fdab
361718c
d43cdf6
3d27584
48101db
fca850e
7072467
b517559
13db45a
532ca9f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -691,6 +691,58 @@ end | |||||||||||||||||
end | ||||||||||||||||||
end | ||||||||||||||||||
end | ||||||||||||||||||
|
||||||||||||||||||
@trixi_testset "PlotData2D" begin | ||||||||||||||||||
equations = LinearScalarAdvectionEquation3D((0.2, -0.7, 0.5)) | ||||||||||||||||||
solver = DGSEM(polydeg = 3, surface_flux = flux_lax_friedrichs) | ||||||||||||||||||
ode_solver = CarpenterKennedy2N54(williamson_condition = false) | ||||||||||||||||||
coordinates_min = (-1.0, -1.0, -1.0) | ||||||||||||||||||
coordinates_max = (+1.0, +1.0, +1.0) | ||||||||||||||||||
diffusivity() = 5.0e-4 | ||||||||||||||||||
equations_parabolic = LaplaceDiffusion3D(diffusivity(), equations) | ||||||||||||||||||
solver_parabolic = ViscousFormulationBassiRebay1() | ||||||||||||||||||
boundary_conditions = boundary_condition_periodic | ||||||||||||||||||
boundary_conditions_parabolic = boundary_condition_periodic | ||||||||||||||||||
initial_refinement_level = 3 | ||||||||||||||||||
|
||||||||||||||||||
function initial_condition_diffusive_convergence_test(x, t, | ||||||||||||||||||
equation::LinearScalarAdvectionEquation3D) | ||||||||||||||||||
x_trans = x - equation.advection_velocity * t | ||||||||||||||||||
nu = diffusivity() | ||||||||||||||||||
c = 1.0; | ||||||||||||||||||
A = 0.5; | ||||||||||||||||||
L = 2; | ||||||||||||||||||
f = 1 / L; | ||||||||||||||||||
Comment on lines
+712
to
+715
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||
omega = 2 * pi * f | ||||||||||||||||||
scalar = c + A * sin(omega * sum(x_trans)) * exp(-2 * nu * omega^2 * t) | ||||||||||||||||||
return SVector(scalar) | ||||||||||||||||||
end | ||||||||||||||||||
initial_condition = initial_condition_diffusive_convergence_test | ||||||||||||||||||
|
||||||||||||||||||
@testset "TreeMesh" begin | ||||||||||||||||||
mesh = TreeMesh(coordinates_min, coordinates_max; | ||||||||||||||||||
n_cells_max = 10^4, | ||||||||||||||||||
initial_refinement_level = initial_refinement_level) | ||||||||||||||||||
sol = solve(ode, ode_solver; dt = 1.0, adaptive = false, | ||||||||||||||||||
save_everystep = false) | ||||||||||||||||||
Comment on lines
+726
to
+727
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where is the |
||||||||||||||||||
|
||||||||||||||||||
pd = @inferred PlotData2D(sol) | ||||||||||||||||||
@test length(pd.data) == 1 | ||||||||||||||||||
|
||||||||||||||||||
for i in eachindex(pd.x) | ||||||||||||||||||
x = SVector(pd.x[i], pd.y[i], 0.0) | ||||||||||||||||||
u = initial_condition(x, 0.1, equations)[1] | ||||||||||||||||||
@test isapprox(pd.data[1][i], u, atol = 0.9) | ||||||||||||||||||
end | ||||||||||||||||||
|
||||||||||||||||||
pd = @inferred PlotData1D(ode.u0, ode.p, slice = :z) | ||||||||||||||||||
for i in eachindex(pd.x) | ||||||||||||||||||
x = SVector(0, 0, pd.x[i]) | ||||||||||||||||||
u = initial_condition(x, 0.1, equations)[1] | ||||||||||||||||||
@test isapprox(pd.data[1], u, atol = 0.5) | ||||||||||||||||||
end | ||||||||||||||||||
Comment on lines
+732
to
+743
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The tolerances are quite large. Maybe the time integration method should be adapted to get better results? |
||||||||||||||||||
end | ||||||||||||||||||
end | ||||||||||||||||||
end | ||||||||||||||||||
|
||||||||||||||||||
@timed_testset "plotting TimeIntegratorSolution" begin | ||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.