Open ns-ku opened 5 days ago
The non-uniform mesh refinement will only be triggered if the defect of the obtained numerical solution from solving given BVP system is higher than absolute tolerance and the initial mesh is not equidistributed, which means the BVP you want to solve is not well-posed and the dt
you gave the solver is not satisfying, but this linear problem may not be such a case.
Thanks! That was just an example. I have, of course, also tried with non-linear equations. I was just wondering if something can generally be done for those problems, where the solution changes rapidly within a small time-span (like Allen-Cahn equations), to get a better resolution in the problematic regions but coarser mesh in the regions with nearly no changes.
Sorry, somehow lost track of this issue
I was just wondering if something can generally be done for those problems
The answer is yes, the point of defect estimation and mesh refinement is to overcome such difficulty in solving such problems, you can refer to chapter 9 of "Numerical Solution of Boundary Value Problems for Ordinary Differential Equations" by U. Ascher et al, which is also the mesh selection and redistribution algorithms in MIRK and FIRK methods in BoundaryValueDiffEq.jl
That was just an example. I have, of course, also tried with non-linear equations.
On a difficult nonlinear equation it didn't adapt? This case seems to just be because MIRK methods of high order converge very fast on this test equation, so there's no need to adapt, the starting dt choice is a sufficient approximation to the tolerance that is chosen. You'd need to also decrease the relative tolerance to make it do more. We see in the benchmarks on many equations that it very quickly can get to an error below machine epsilon for linear BVPs.
I'd suspect in a nonlinear equation you'd find it generally will need to adapt though.
Hi!
I am testing BVP solvers but cannot figure how to obtain a non-uniform meshing for BVP problems. The mesh that I get does get adapted but remains uniform (for that, I check sol.t). Are the non-uniform meshes (like in bvp4c in Matlab) supported by BoundaryValueDiffEq? I use version 5.12.0.
Here is the example of the code: `function bvp!(du, u, p, x) du[1] = u[2] du[2] = -u[1] end
function bc!(residual, u, p, t) residual[1] = u[1][1] - 0
residual[2] = u[1][end] -2 end
tspan = (0, pi/2) u0 = [1.0, -1.0] prob = BVProblem(bvp!, bc!, u0, tspan)
sol = solve(prob, MIRK4(), dt = 0.05, abstol = 1e-9)
plot(sol, seriestype=:scatter, lw=2) xlabel!("x") ylabel!("u(x)") plot(sol.t, seriestype=:scatter, lw=2)`
Am I missing something?
Thanks a lot for the help in advance!`