Skip to content

Commit

Permalink
fix for non-adaptive timestepping
Browse files Browse the repository at this point in the history
  • Loading branch information
archermarx committed Jun 7, 2023
1 parent 23550ea commit 2e28d77
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/simulation/update_electrons.jl
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,19 @@ function update_electrons!(U, params, t = 0)
# update electrostatic potential and potential gradient on edges
solve_potential_cell!(ϕ, params)

dt_min = Inf

@inbounds for i in 2:ncells-1
Q = source_electron_energy(U, params, i)
dt_min = min(dt_min, abs(params.CFL * 3 * ne[i] * Tev[i] / Q))
end
if params.adaptive
dt_min = Inf

@inbounds for i in 2:ncells-1
Q = source_electron_energy(U, params, i)
dt_min = min(dt_min, abs(params.CFL * 3 * ne[i] * Tev[i] / Q))
end

dt_sub = min(dt_min, params.dt[] - t_sub)
dt_sub = min(dt_min, params.dt[] - t_sub)
else
dt_sub = params.dt[]
end

# Update the electron temperature and pressure
update_electron_energy!(U, params, dt_sub)
Expand Down

0 comments on commit 2e28d77

Please sign in to comment.