Skip to content
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

Update ODE integration #167

Merged
merged 1 commit into from
Dec 31, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/integration.jl
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,7 @@ function boltzmann(prob::Union{CauchyProblem, SorptivityCauchyProblem})
settled = DiscreteCallback(let direction = monotonicity(prob)
(u, t, integrator) -> direction * u[2] ≤ zero(u[2])
end,
function succeed!(integrator)
terminate!(integrator)
integrator.sol = SciMLBase.solution_new_retcode(integrator.sol,
ReturnCode.Success)
end,
(integrator) -> terminate!(integrator, ReturnCode.Success),
save_positions = (false, false))

ODEProblem(boltzmann(prob.eq), u0, (ob, typemax(ob)), callback = settled)
Expand Down Expand Up @@ -116,6 +112,8 @@ function solve(prob::Union{CauchyProblem, SorptivityCauchyProblem},
verbose = true)
odesol = solve!(_init(prob, alg, verbose = verbose))

@assert odesol.retcode != ReturnCode.Terminated

return Solution(odesol, prob, alg, _niter = 1)
end

Expand All @@ -124,6 +122,8 @@ function Solution(_odesol::ODESolution,
_alg::BoltzmannODE;
_retcode = _odesol.retcode,
_niter)
@assert _odesol.retcode != ReturnCode.Terminated

return Solution(o -> _odesol(o, idxs = 1),
_prob,
_alg,
Expand Down
Loading