Skip to content

Commit

Permalink
fixed some double definition and reduced resolution in elixir
Browse files Browse the repository at this point in the history
  • Loading branch information
gregorgassner committed Oct 10, 2023
1 parent 7548300 commit 86a063a
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 39 deletions.
8 changes: 5 additions & 3 deletions examples/tree_2d_dgsem/elixir_jin_xin_euler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ using Trixi
# semidiscretization of the compressible Euler equations

epsilon_relaxation = 1.0e-5
a1 = a2 = a3 = a4 = 15.0
b1 = b2 = b3 = b4 = 15.0
a1 = a2 = a3 = a4 = 30.0
b1 = b2 = b3 = b4 = 30.0

equations_relaxation = CompressibleEulerEquations2D(1.4)
equations = JinXinCompressibleEulerEquations2D(epsilon_relaxation, a1, a2, a3, a4, b1, b2, b3, b4,equations_relaxation)
Expand All @@ -28,6 +28,7 @@ end

#initial_condition = initial_condition_constant
initial_condition = Trixi.InitialConditionJinXin(initial_condition_kelvin_helmholtz_instability)
#initial_condition = Trixi.InitialConditionJinXin(initial_condition_density_wave)
solver = DGSEM(polydeg=3, surface_flux=Trixi.flux_upwind)

#surface_flux = Trixi.flux_upwind
Expand All @@ -45,7 +46,7 @@ coordinates_min = (-1.0, -1.0)
coordinates_max = ( 1.0, 1.0)

mesh = TreeMesh(coordinates_min, coordinates_max,
initial_refinement_level=6,
initial_refinement_level=5,
n_cells_max=1_000_000)


Expand All @@ -56,6 +57,7 @@ semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, solver)#
# ODE solvers, callbacks etc.

tspan = (0.0, 3.7)
#tspan = (0.0, 2.0)
ode = semidiscretize(semi, tspan)

summary_callback = SummaryCallback()
Expand Down
72 changes: 36 additions & 36 deletions src/callbacks_stage/subcell_limiter_idp_correction_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,40 +41,40 @@ function perform_idp_correction!(u, dt, mesh::TreeMesh2D, equations, dg, cache)

return nothing
end
function perform_idp_correction!(u, dt, mesh::TreeMesh2D, equations::JinXinCompressibleEulerEquations2D, dg, cache)

# relaxation parameter
eps = equations.eps_relaxation
dt_ = dt * 1.0
factor =1.0/ (eps + dt_)

@threaded for element in eachelement(dg, cache)
for j in eachnode(dg), i in eachnode(dg)
u_node = get_node_vars(u, equations, dg, i, j, element)

# compute compressible Euler fluxes
u_cons = SVector(u_node[1], u_node[2], u_node[3], u_node[4])
eq_relax = equations.equations_relaxation
vu = flux(u_cons,1,eq_relax)
wu = flux(u_cons,2,eq_relax)
# compute relaxation terms
du1 = 0.0
du2 = 0.0
du3 = 0.0
du4 = 0.0
du5 = factor * (eps * u[5] + dt_ * vu[1])
du6 = factor * (eps * u[6] + dt_ * vu[2])
du7 = factor * (eps * u[7] + dt_ * vu[3])
du8 = factor * (eps * u[8] + dt_ * vu[4])
du9 = factor * (eps * u[9] + dt_ * wu[1])
du10= factor * (eps * u[10]+ dt_ * wu[2])
du11= factor * (eps * u[11]+ dt_ * wu[3])
du12= factor * (eps * u[12]+ dt_ * wu[4])
new_u = SVector(du1, du2, du3, du4, du5, du6, du7, du8, du9, du10, du11, du12)
set_node_vars!(u, new_u, equations, dg, i, j, element)
end
end

return nothing
end
#function perform_idp_correction!(u, dt, mesh::TreeMesh2D, equations::JinXinCompressibleEulerEquations2D, dg, cache)
#
# # relaxation parameter
# eps = equations.eps_relaxation
# dt_ = dt * 1.0
# factor =1.0/ (eps + dt_)
#
# @threaded for element in eachelement(dg, cache)
# for j in eachnode(dg), i in eachnode(dg)
# u_node = get_node_vars(u, equations, dg, i, j, element)
#
# # compute compressible Euler fluxes
# u_cons = SVector(u_node[1], u_node[2], u_node[3], u_node[4])
# eq_relax = equations.equations_relaxation
# vu = flux(u_cons,1,eq_relax)
# wu = flux(u_cons,2,eq_relax)
# # compute relaxation terms
# du1 = 0.0
# du2 = 0.0
# du3 = 0.0
# du4 = 0.0
# du5 = factor * (eps * u[5] + dt_ * vu[1])
# du6 = factor * (eps * u[6] + dt_ * vu[2])
# du7 = factor * (eps * u[7] + dt_ * vu[3])
# du8 = factor * (eps * u[8] + dt_ * vu[4])
# du9 = factor * (eps * u[9] + dt_ * wu[1])
# du10= factor * (eps * u[10]+ dt_ * wu[2])
# du11= factor * (eps * u[11]+ dt_ * wu[3])
# du12= factor * (eps * u[12]+ dt_ * wu[4])
# new_u = SVector(du1, du2, du3, du4, du5, du6, du7, du8, du9, du10, du11, du12)
# set_node_vars!(u, new_u, equations, dg, i, j, element)
# end
# end
#
# return nothing
#end
end # @muladd

0 comments on commit 86a063a

Please sign in to comment.