Timeline for Why is this scipy.root code not converging?
Current License: CC BY-SA 4.0
18 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Mar 13, 2023 at 3:50 | vote | accept | Klaus3 | ||
Mar 12, 2023 at 5:27 | answer | added | whpowell96 | timeline score: 1 | |
Mar 10, 2023 at 21:41 | history | edited | Anton Menshov♦ | CC BY-SA 4.0 |
deleted 4 characters in body
|
Mar 10, 2023 at 17:10 | comment | added | IPribec | Let us continue this discussion in chat. | |
Mar 10, 2023 at 16:51 | comment | added | IPribec |
Just below the function definition of EDP. In the energy balance you only iterate till N_points_1-1 . Perhaps you should consider a different toy problem, instead of a parabolic one. Edit: I stand corrected... It gets replaced with v[k] . But that gets set to the initial guess np.linspace(25,60,N_variables) . But the last row still will not be a linear function from 25 to 60.
|
|
Mar 10, 2023 at 16:31 | comment | added | Klaus3 | Where do you see T_N[N_points_1,:] = 1?. Because thats a clear mistake by me if thats the case | |
Mar 10, 2023 at 15:38 | comment | added | IPribec | Without a sink term to get rid of heat, it's kind of difficult to have T_N[N_points_1,:] = 1, when the boundaries are set to 25 and 60. Don't you think? Seems like a violation of the maximum principle to me... | |
Mar 10, 2023 at 14:46 | answer | added | IPribec | timeline score: 3 | |
Mar 10, 2023 at 14:40 | comment | added | Klaus3 | So, a root finding problem. There should be zero problem to simply use a root finder from the start. Just read this part in the link: "Each event occurs at the zeros of a continuous function of time and state. Each function must have the signature event(t, y) and return a float. The solver will find an accurate value of t at which event(t, y(t)) = 0 using a root-finding algorithm. By default, all zeros will be found. | |
Mar 10, 2023 at 14:29 | comment | added | Klaus3 | The system of ODE's that's discretized by the Runge Kutta or BDF methods of solve.ivp, which involves rootfinding algorithms to solve them. | |
Mar 10, 2023 at 14:10 | comment | added | IPribec |
After the spatial discretization using FDM you end up with a system of ODEs. You can then integrate this system in time to obtain the temperature values at nodes. This approach is known as the method of lines. The events callback in solve_ivp serves a different purpose, say, to find out when does a particular point reach a certain temperature.
|
|
Mar 10, 2023 at 13:11 | comment | added | Klaus3 | @IPribec i'm Sorry but all differential equation problems transform into root finding problems when discretized. Read the "events" part of the link you posted , all values are to be found by a root finding algorithm. Plus, Ivp is only for ODEs, this is a PDE. | |
Mar 10, 2023 at 9:39 | comment | added | IPribec |
Why are you using a root solver for an initial value problem? The right method to use here is scipy.integrate.solve_ivp .
|
|
Mar 8, 2023 at 0:31 | comment | added | Klaus3 | So i've been testing with initial conditions and even when providing an initial guess very close to the solution, they still don't converge. I am going to make another question because this is far too bizarre for such a simple system. | |
Mar 7, 2023 at 15:13 | comment | added | Lutz Lehmann | Another effect is that with a simple grid the distance to the boundary is linear in the number of nodes. Using multi-grid or multi-resolution (like wavelet) discretizations reduces this distance, purely on graph connectivity, to the logarithm of the node size. This should reduce the "travel time" for local errors to the boundary, thus speed up the solution process. | |
Mar 7, 2023 at 15:09 | comment | added | Lutz Lehmann | To some part this is because with the non-linear (necessarily sequential) solvers, you play some kind of whack-a-mole with the local error. Getting improvements in one place worsens the error in another one. So each step is part global error reduction and a larger part error shifting. In some old methods to solve Poisson equations, this was called "ironing", moving local errors around until they fall off over the boundary conditions. | |
S Mar 6, 2023 at 20:37 | review | First questions | |||
Mar 10, 2023 at 21:41 | |||||
S Mar 6, 2023 at 20:37 | history | asked | Klaus3 | CC BY-SA 4.0 |