Skip to content

Commit

Permalink
Merge branch 'AMR_Parabolic_2D3D_Tree' of github.com:DanielDoehring/T…
Browse files Browse the repository at this point in the history
…rixi.jl into AMR_Parabolic_2D3D_Tree
  • Loading branch information
DanielDoehring committed Oct 24, 2023
2 parents b8a010d + 202106b commit 0353488
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 22 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "Trixi"
uuid = "a7f1ee26-1774-49b1-8366-f1abc58fbfcb"
authors = ["Michael Schlottke-Lakemper <[email protected]>", "Gregor Gassner <[email protected]>", "Hendrik Ranocha <[email protected]>", "Andrew R. Winters <[email protected]>", "Jesse Chan <[email protected]>"]
version = "0.5.46-pre"
version = "0.5.47-pre"

[deps]
CodeTracking = "da1fd8a2-8d9e-5ec2-8556-3022fb5608a2"
Expand Down
8 changes: 4 additions & 4 deletions examples/p4est_2d_dgsem/elixir_euler_double_mach_amr.jl
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ See Section IV c on the paper below for details.
phi = pi / 6
sin_phi, cos_phi = sincos(phi)

rho = 8
rho = 8.0
v1 = 8.25 * cos_phi
v2 = -8.25 * sin_phi
p = 116.5
else
rho = 1.4
v1 = 0
v2 = 0
p = 1
v1 = 0.0
v2 = 0.0
p = 1.0
end

prim = SVector(rho, v1, v2, p)
Expand Down
4 changes: 2 additions & 2 deletions src/callbacks_step/save_solution.jl
Original file line number Diff line number Diff line change
Expand Up @@ -211,11 +211,11 @@ end
get_element_variables!(element_variables, u_ode, semi)
callbacks = integrator.opts.callback
if callbacks isa CallbackSet
for cb in callbacks.continuous_callbacks
foreach(callbacks.continuous_callbacks) do cb
get_element_variables!(element_variables, u_ode, semi, cb;
t = integrator.t, iter = iter)
end
for cb in callbacks.discrete_callbacks
foreach(callbacks.discrete_callbacks) do cb
get_element_variables!(element_variables, u_ode, semi, cb;
t = integrator.t, iter = iter)
end
Expand Down
7 changes: 4 additions & 3 deletions src/callbacks_step/summary.jl
Original file line number Diff line number Diff line change
Expand Up @@ -168,16 +168,17 @@ function initialize_summary_callback(cb::DiscreteCallback, u, t, integrator;

callbacks = integrator.opts.callback
if callbacks isa CallbackSet
for cb in callbacks.continuous_callbacks
foreach(callbacks.continuous_callbacks) do cb
show(io_context, MIME"text/plain"(), cb)
println(io, "\n")
end
for cb in callbacks.discrete_callbacks
foreach(callbacks.discrete_callbacks) do cb
# Do not show ourselves
cb.affect! === summary_callback && continue
cb.affect! === summary_callback && return nothing

show(io_context, MIME"text/plain"(), cb)
println(io, "\n")
return nothing
end
else
show(io_context, MIME"text/plain"(), callbacks)
Expand Down
7 changes: 4 additions & 3 deletions src/time_integration/methods_2N.jl
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,10 @@ function solve(ode::ODEProblem, alg::T;

# initialize callbacks
if callback isa CallbackSet
for cb in callback.continuous_callbacks
foreach(callback.continuous_callbacks) do cb
error("unsupported")
end
for cb in callback.discrete_callbacks
foreach(callback.discrete_callbacks) do cb
cb.initialize(cb, integrator.u, integrator.t, integrator)
end
elseif !isnothing(callback)
Expand Down Expand Up @@ -172,10 +172,11 @@ function solve!(integrator::SimpleIntegrator2N)

# handle callbacks
if callbacks isa CallbackSet
for cb in callbacks.discrete_callbacks
foreach(callbacks.discrete_callbacks) do cb
if cb.condition(integrator.u, integrator.t, integrator)
cb.affect!(integrator)
end
return nothing
end
end

Expand Down
7 changes: 4 additions & 3 deletions src/time_integration/methods_3Sstar.jl
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,10 @@ function solve(ode::ODEProblem, alg::T;

# initialize callbacks
if callback isa CallbackSet
for cb in callback.continuous_callbacks
foreach(callback.continuous_callbacks) do cb
error("unsupported")
end
for cb in callback.discrete_callbacks
foreach(callback.discrete_callbacks) do cb
cb.initialize(cb, integrator.u, integrator.t, integrator)
end
elseif !isnothing(callback)
Expand Down Expand Up @@ -248,10 +248,11 @@ function solve!(integrator::SimpleIntegrator3Sstar)

# handle callbacks
if callbacks isa CallbackSet
for cb in callbacks.discrete_callbacks
foreach(callbacks.discrete_callbacks) do cb
if cb.condition(integrator.u, integrator.t, integrator)
cb.affect!(integrator)
end
return nothing
end
end

Expand Down
8 changes: 4 additions & 4 deletions src/time_integration/methods_SSP.jl
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,10 @@ function solve(ode::ODEProblem, alg = SimpleSSPRK33()::SimpleAlgorithmSSP;

# initialize callbacks
if callback isa CallbackSet
for cb in callback.continuous_callbacks
foreach(callback.continuous_callbacks) do cb
error("unsupported")
end
for cb in callback.discrete_callbacks
foreach(callback.discrete_callbacks) do cb
cb.initialize(cb, integrator.u, integrator.t, integrator)
end
elseif !isnothing(callback)
Expand All @@ -148,7 +148,7 @@ function solve!(integrator::SimpleIntegratorSSP)
callbacks = integrator.opts.callback

integrator.finalstep = false
while !integrator.finalstep
@trixi_timeit timer() "main loop" while !integrator.finalstep
if isnan(integrator.dt)
error("time step size `dt` is NaN")
end
Expand Down Expand Up @@ -184,7 +184,7 @@ function solve!(integrator::SimpleIntegratorSSP)

# handle callbacks
if callbacks isa CallbackSet
for cb in callbacks.discrete_callbacks
foreach(callbacks.discrete_callbacks) do cb
if cb.condition(integrator.u, integrator.t, integrator)
cb.affect!(integrator)
end
Expand Down
2 changes: 1 addition & 1 deletion test/test_tree_2d_euler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ EXAMPLES_DIR = pkgdir(Trixi, "examples", "tree_2d_dgsem")
t = sol.t[end]
u_ode = sol.u[end]
du_ode = similar(u_ode)
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 15000
end
end

Expand Down
2 changes: 1 addition & 1 deletion test/test_tree_2d_eulermulti.jl
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ EXAMPLES_DIR = pkgdir(Trixi, "examples", "tree_2d_dgsem")
t = sol.t[end]
u_ode = sol.u[end]
du_ode = similar(u_ode)
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 15000
end
end

Expand Down

0 comments on commit 0353488

Please sign in to comment.