-
-
Notifications
You must be signed in to change notification settings - Fork 36
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
Boundary conditions should always use solution object #260
Conversation
Benchmark Results
Benchmark PlotsA plot of the benchmark results have been uploaded as an artifact to the workflow run for this PR. |
OK, this PR only changed the boundary condition convention to function bc!(residual, u, p, t)
residual[1] = u(pi / 4)[1] + pi / 2
residual[2] = u(pi / 2)[1] - pi / 2
end If it's okay, I will replace other solvers as well. Funny that when I am benchmarking the changes in this PR, the solving is getting a bit faster🤯 This PRjulia> @benchmark sol = solve(prob, MIRK4(), dt = 0.05)
BenchmarkTools.Trial: 9976 samples with 1 evaluation.
Range (min … max): 398.833 μs … 21.430 ms ┊ GC (min … max): 0.00% … 97.59%
Time (median): 434.625 μs ┊ GC (median): 0.00%
Time (mean ± σ): 500.182 μs ± 563.331 μs ┊ GC (mean ± σ): 12.65% ± 10.75%
█▄ ▁
██▇▅▄▃▁▁▁▃▁▁▁▃▁▃▁▁▁▁▁▁▃▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▅▃▆▇ █
399 μs Histogram: log(frequency) by time 4.41 ms <
Memory estimate: 1.08 MiB, allocs estimate: 24342. Master branchjulia> @benchmark sol = solve(prob, MIRK4(), dt = 0.05)
BenchmarkTools.Trial: 9520 samples with 1 evaluation.
Range (min … max): 411.166 μs … 15.173 ms ┊ GC (min … max): 0.00% … 96.72%
Time (median): 459.167 μs ┊ GC (median): 0.00%
Time (mean ± σ): 524.214 μs ± 598.530 μs ┊ GC (mean ± σ): 11.43% ± 9.61%
█▂ ▁
██▄▃▃▁▃▄▄▁▃▁▁▁▄▁▁▁▁▁▁▁▁▃▃▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▃▃▁▃▁▁▃▁▁▁▃▁▃▁▁▃▁▁▁▃▆ █
411 μs Histogram: log(frequency) by time 5.38 ms <
Memory estimate: 1.03 MiB, allocs estimate: 23762. |
Fix #107
Fix #185
Supesed #208
Let's finish this! Now I have only changed MIRK methods when evaluating boundary conditions, the workaround is to change values during
__mirk_loss
but build a new one in__mirk_loss_bc
where there would be dual numbers since we are using automatic differentiation to build sparse Jacobain.