Skip to content

Commit

Permalink
Updated test results and formatted
Browse files Browse the repository at this point in the history
  • Loading branch information
amrueda committed Sep 17, 2024
1 parent 3f78c43 commit 6307055
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 16 deletions.
18 changes: 10 additions & 8 deletions src/callbacks_step/stepsize_dg2d.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Specialization of max_dt function for 3D equations in 2D manifolds
function Trixi.max_dt(u, t,
mesh::Union{StructuredMesh{2}, UnstructuredMesh2D, P4estMesh{2},
T8codeMesh{2}},
constant_speed::False, equations::AbstractEquations{3}, dg::DG, cache)
mesh::Union{StructuredMesh{2}, UnstructuredMesh2D, P4estMesh{2},
T8codeMesh{2}},
constant_speed::False, equations::AbstractEquations{3}, dg::DG, cache)
# to avoid a division by zero if the speed vanishes everywhere,
# e.g. for steady-state linear advection
max_scaled_speed = nextfloat(zero(t))
Expand All @@ -16,11 +16,13 @@ function Trixi.max_dt(u, t,
lambda1, lambda2, lambda3 = max_abs_speeds(u_node, equations)

# Local speeds transformed to the reference element
Ja11, Ja12, Ja13 = Trixi.get_contravariant_vector(1, contravariant_vectors, i, j,
element)
Ja11, Ja12, Ja13 = Trixi.get_contravariant_vector(1, contravariant_vectors, i,
j,
element)
lambda1_transformed = abs(Ja11 * lambda1 + Ja12 * lambda2 + Ja13 * lambda3)
Ja21, Ja22, Ja23 = Trixi.get_contravariant_vector(2, contravariant_vectors, i, j,
element)
Ja21, Ja22, Ja23 = Trixi.get_contravariant_vector(2, contravariant_vectors, i,
j,
element)
lambda2_transformed = abs(Ja21 * lambda1 + Ja22 * lambda2 + Ja23 * lambda3)

inv_jacobian = abs(inverse_jacobian[i, j, element])
Expand All @@ -33,4 +35,4 @@ function Trixi.max_dt(u, t,
end

return 2 / (nnodes(dg) * max_scaled_speed)
end
end
16 changes: 8 additions & 8 deletions test/test_spherical_advection.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ EXAMPLES_DIR = pkgdir(TrixiAtmo, "examples")
@test_trixi_include(joinpath(EXAMPLES_DIR,
"elixir_euler_spherical_advection_cartesian.jl"),
l2=[
8.44505073e-03,
8.23414117e-03,
1.84210648e-03,
8.44498914e-03,
8.23407970e-03,
1.84210216e-03,
0.00000000e+00,
6.44302430e-02,
6.44302432e-02,
],
linf=[
9.48950488e-02,
9.64811952e-02,
1.37453400e-02,
9.48946345e-02,
9.64807833e-02,
1.37450721e-02,
0.00000000e+00,
4.09322999e-01,
4.09322956e-01,
])
# Ensure that we do not have excessive memory allocations
# (e.g., from type instabilities)
Expand Down

0 comments on commit 6307055

Please sign in to comment.