-
-
Notifications
You must be signed in to change notification settings - Fork 101
Resolving Issue: Errors in Simple Handwritten PDEs as ODEs #1291
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
Conversation
For the psuedospectral, see the comment in #929. The ApproxFun dev mentioned we should change to OrthogonalPolynomials.jl for this part so we should take that recommendation. |
@ChrisRackauckas Could you please run the workflow so I can check the logs for errors?
|
Why are mass matrices required here? Most of these should resolve to not have any algebraic constraints if the right spectral discretization is chosen. (Singular) Mass matrices (DAEs) would prohibit most of the solvers from being used. Though if that's a requirement for one of them, then so bit and that changes the solvers that should be chosen there (and would be an interesting contrast) |
L = 2.0 # Domain length | ||
xs, prob = allen_cahn(N, L) | ||
# @time sol = solve(prob, AutoVern7(RadauIIA5(autodiff=false)); dt=1e-2, abstol=1e-14, reltol=1e-14, adaptive=true) | ||
@time sol = solve(prob, Tsit5(); abstol=1e-14, reltol=1e-14, adaptive=true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Explicit methods usually have issues with convergence due to order loss. I'm not sure changing to an explicit method for these for the reference will work out well. Though you'll see the in the work-precision diagram if you have a problem with the convergence, since all of the other methods will hit a wall and only converge to the error of the reference solution.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, I commented the wrong line in this commit. Thanks!
reltols = 0.1 .^ (1:3) | ||
multipliers = 0.5 .^ (0:3) | ||
setups = [ | ||
Dict(:alg => IMEXEuler(), :dts => 1e-4 * multipliers), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd keep the same sets as above. A set showing all of the exponential integrators, all of the IMEX methods, all of the normal methods, and then a comparison of the best between the families.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Understood, planning to reincorporate the complete tests for the server builds as I can only prototype a few sets with the current local resources. Should these still be fixed time-steps or use adaptive time-stepping?
Dict(:alg => Rodas4(), :dts => 1e-4 * multipliers), | ||
Dict(:alg => Rodas5(), :dts => 1e-4 * multipliers), | ||
Dict(:alg => GRK4T(), :dts => 1e-4 * multipliers), | ||
Dict(:alg => GRK4A(), :dts => 1e-4 * multipliers), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the main ones to add to the mass matrices comparisons would be FBDF and QNDF. Also a DAEProblem formulation testing DASKR.jl and Sundials.IDA. You can benchmark multiple simultaneous problem implementations using the prob_choice
setup, see the DAE benchmarks for how this is done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great to know; thanks for the tips!
…r derivatives from SummationByPartsOperators.jl
@ChrisRackauckas Please run the workflow so I can check the logs for errors?
|
setups = [Dict(:alg => KenCarp5()), | ||
Dict(:alg => ARKODE(Sundials.Implicit(), order=5, linear_solver=:Dense)), | ||
Dict(:alg => KenCarp5(linsolve=KrylovJL_GMRES())), | ||
Dict(:alg => ARKODE(Sundials.Implicit(), order=5, linear_solver=:GMRES)), | ||
Dict(:alg => ETDRK3(), :dts => 1e-2 * multipliers), | ||
Dict(:alg => ETDRK4(), :dts => 1e-3 * multipliers)] | ||
labels = hcat("KenCarp5 (dense linsolve)", "ARKODE (dense linsolve)", "KenCarp5 (Krylov linsolve)", | ||
"ARKODE (Krylov linsolve)", "ETDRK3 (m=5)", "ETDRK4 (m=5)") | ||
@time wp = WorkPrecisionSet(prob,abstols,reltols,setups; | ||
print_names=true, names=labels, | ||
numruns=5, error_estimate=:l2, | ||
save_everystep=false, appxsol=test_sol, maxiters=Int(1e5)); | ||
|
||
plot(wp, label=labels, markershape=:auto, title="Between family, medium order") | ||
abstols = 0.1 .^ (5:8) # all fixed dt methods so these don't matter much | ||
reltols = 0.1 .^ (1:4) | ||
multipliers = 0.5 .^ (0:3) | ||
setups = [ | ||
Dict(:alg => CNAB2(), :dts => 1e-4 * multipliers), | ||
Dict(:alg => CNAB2(linsolve=KrylovJL_GMRES()), :dts => 1e-4 * multipliers), | ||
Dict(:alg => ETDRK2(), :dts => 1e-4 * multipliers), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is missing all of the good high order methods?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I should've specified that the high-tolerance solvers were tested. Currently testing the low-tolerance/high-order methods; will be included in the next few commits.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ChrisRackauckas Please run the workflow on the latest commit? I think it's mostly ready.
be23be3
to
82b34f3
Compare
…ciMLBenchmarks.jl into dev-pde-benchmarks
Wow this is looking pretty good. Very thorough, everything looks correct. I think there's a few little tweaks to maybe do, like adding preconditioners on the Krylov methods, but what I'm going to do is merge it so it can build and it's easier to see it all together. I think it's like 95% or 99% done, and the last little bits I can probably do most of. But let's see what it looks like in the docs. This is a great change, using all of the latest PDE tools and everything! |
Checklist
contributor guidelines, in particular the SciML Style Guide and
COLPRAC.
Additional context
This merges changes to resolve issue #1284 on the benchmarks of handwritten PDEs as ODEs via finite-difference and pseudo-spectral methods.
The package dependencies have been updated to remove unused ones, and the compat entries have been updated for Julia v1.10. The implementations have been tested on local machines (Macbook Pro M1 Pro on macOS Sequoia and a beefier CPU running Ubuntu 22.04 LTS) by running
SciMLBenchmarks.weave_file
on the relevant.jmd
files.At present, changes have been implemented for the following PDEs in one spatial and one time dimension:
The following changes have been implemented to the finite-difference method benchmarks:
SparseArrays
.MatrixOperator
interfaces are used from the updatedSciMLOperators
forSplitODEProblem
.These are functioning for certain solver algorithm choices (
IMEXEuler
,CNAB2
,CLAF2
,ETDRK2
,SBDF2
)Commits will be progressively added in this pull (such as pseudo-spectral method updates), including revisions based on comments from the reviewers (@ChrisRackauckas).