Hi,
I have a time dependent problem which needs to be solved. I need to solve my model for different time say 1s, 10s or bigger.
considering that I solve the mode for 1s is it possible to resume it and continue the run to 10s? The only thing that can be changed in the code in a double parameter.
Simply saying: I wondered if it is possible to resume a complete/incomplete solution and continue it?
Given your problem is a function (of which you pass this double value for seconds), and the solution is very quick, you could just solve and then wait for the number of seconds passed in before returning a value. Then you would roughly be near that time.
To be more exact in the time, you could use <ctime> (http://www.cplusplus.com/reference/ctime/).
You would:
a) get a value at the start of your function.
b) solve your problem
c) loop while getting updated new time values until you reach/past the specified time
d) return
Well, my problem is not related to ctime. "Time" is just a parameter in my model.
Assume that I solve a transient heat transfer model for 1 second and my code calculates heat flux and other parameters.
Now, assume that I want to run it for 10 seconds. Well, I can change the time parameter in my code and can simply solve it again but it is such a slow run and it would be better to continue the previous run to get 1s-10s solution instead of 0s-10s.
I hope I could clarify my problem. The above numbers and problem were just examples.
Maybe save the state of the machine/program at the particular intermediate time point and resume from there at a later time.
Heat transfer is presumably in some form of a matrix so this would be fairly easy provided any loop or wave front calculation or similar involved was interrupted at a controlled point in any iteration.
Don't ask how this would be done because it depends totally on your code. :)