Timeline for How to prevent NDSolve to store result for each time step?
Current License: CC BY-SA 4.0
24 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Mar 24, 2021 at 21:57 | vote | accept | SantaP | ||
Mar 23, 2021 at 21:45 | answer | added | Michael E2 | timeline score: 4 | |
Mar 23, 2021 at 15:43 | comment | added | SantaP | @user21 I think it will not help because interpolating function is about final stage of simulation. I need to find a way to say Mathematica to accomulate during iteration only certain steps (not all). | |
Mar 23, 2021 at 15:00 | comment | added | user21 |
@MichaelE2, that's certainly the approach I would think is most promising. One could go ahead and then plug these stop times into an ElementMeshInterpolation to get a single interpolating function. But I am not sure about the overall accuracy of this approach, because the time stepper does not store unnecessary data, I would think. But I am interested to see what comes out of this.
|
|
Mar 23, 2021 at 14:39 | history | edited | SantaP | CC BY-SA 4.0 |
deleted 1 character in body
|
Mar 23, 2021 at 14:35 | comment | added | SantaP | @MichaelE2 I've changed the problem. Now silumation lasts 3 mins and produces 494*10492 grid. | |
Mar 23, 2021 at 14:32 | history | edited | SantaP | CC BY-SA 4.0 |
added 251 characters in body
|
Mar 23, 2021 at 14:26 | comment | added | Michael E2 |
@user21 My interpretation led me to do the following: Use NDSolve`Iterate to advance the time integration to a sequence of specified time stops; at each stop, harvest the "SolutionData" . This can be used to construct a sequence of interpolations over the spatial discretization, one for each time stop. I wasn't going to worry about interpolation over time unless specifically requested. The sequence would be useful for illustrating the evolution of the system while saving memory.
|
|
Mar 23, 2021 at 7:36 | comment | added | user21 | I still have trouble understanding your request: You'd like to have an interpolating function that does not use all data points computed but still have the same accuracy compared to a interpolating function that makes use of all computed data points? | |
Mar 23, 2021 at 4:06 | comment | added | Michael E2 |
The time steps for your example code are quite large, just as it is. I believe I have a way to do what (I think) you're requesting. But it saves very little in the case you posted. Even if I extend the interval to {t, 0, 100} , there are only 32 steps. The start-up overhead tends to dominate the marginal increase in memory per step. With so few steps, it's hard to decrease the number of steps saved in order to show any significant memory savings.
|
|
Mar 22, 2021 at 21:17 | comment | added | Ulrich Neumann |
@MichaelE2 What a pity! I also thougt to use NDSolve`ProcessEquations (your comment&link) but I don't know how to split the coodinates t and the spatial coordinates...
|
|
Mar 22, 2021 at 20:55 | comment | added | SantaP | Yes, it still saves all the steps and just chage the output. Unfortunatly it does not help but thanks any way. | |
Mar 22, 2021 at 20:39 | comment | added | Michael E2 | @UlrichNeumann Check the memory usage. I don't know for sure (things change), but I thought that form would save all the intermediate steps until the end, and then return only the desired values and throw the rest away. | |
Mar 22, 2021 at 19:15 | comment | added | Ulrich Neumann |
@ RodionStepanov I Think my answer is what you are looking for. For example NDSolveValue[{x''[t] == x[t]^2, x[0] == 1, x'[0] == 0}, {x[1], x[2]}, {t, 0, 2}] gives the solution at two times, accuracy and resolution isn't affected!
|
|
Mar 22, 2021 at 18:40 | comment | added | SantaP | @Ulrich Neumann no, I need evolution but with lower resulution. | |
Mar 22, 2021 at 18:40 | comment | added | SantaP | @user21 I want to keep the accuracy of simulations. | |
Mar 22, 2021 at 18:36 | comment | added | SantaP | @MarcoB I add my example with code. | |
Mar 22, 2021 at 18:35 | history | edited | SantaP | CC BY-SA 4.0 |
added 1608 characters in body
|
Mar 22, 2021 at 17:22 | comment | added | Ulrich Neumann | NDSolve[{x''[t] == x[t]^2, x[0] == 1, x'[0] == 0}, x[2], {t, 0,2}] returns only the last timestep! | |
Mar 22, 2021 at 16:24 | comment | added | user21 | If you need less accuracy, why not reduce the accuracy goal? | |
Mar 22, 2021 at 15:57 | comment | added | Michael E2 | Apparently I couldn't find it a couple of months ago either: mathematica.stackexchange.com/a/238226/4999 | |
Mar 22, 2021 at 15:51 | comment | added | Michael E2 |
Try NDSolve[{x''[t] == x[t]^2, x[0] == 1, x'[0] == 0}, x, {t, 2, 2}] . (Note the time interval.) It's in the docs somewhere, but I can't find it right now. You can also accumulate solution data for a subinterval {t, 1, 2} .
|
|
Mar 22, 2021 at 15:51 | comment | added | MarcoB | Can you show an example with code? | |
Mar 22, 2021 at 15:49 | history | asked | SantaP | CC BY-SA 4.0 |