Implicit ODEs and discretized PDEs with time-variable parameters.

I am trying to solve a system of ODEs and PDEs that have already been discretized in space and the integration using ode15s is getting done without bugs.
However, when I look at the results I can see many artefacts given by the fact that some of the parameters randomly change value in time and Matlab is not able to integrate nicely to obtain a smooth profile. It only does that when I set a constant value for all the flows involved but unfortunately my real life system isn't like that. I am integrating concentrations (X_BH) and material flows (Q) vary from one day to another without being correlated in any way with the time.
So instead of having a constant for the entire duration of the process, the Q value changes every day. I can see when I plot this variable (a flow in chemical engineering) that the solver has gone back and forth every time the value changed and the integrated states (concentrations, in my case) have weird spikes or dips, suggesting the the solves struggled to integrate.
How can I integrate my system and get reliable results while all the flows are so variable?
I have looked a bot at ode15i but I don't know enough Maths to understand what my Jacobian would be or how to estimate initial values for the derivative. I only have initial conditions for the concentrations.
Thank you!

6 Comments

Stop and restart the solver every time Q makes discontinous jumps. You cannot just integrate over such jumps in the input parameters - especially when PDEs are involved.
I am already integrading day by day and setting the intitial conditions for the concentrations as those at the end of the previous day and the results are as shown in the pictures. :(
The PDEs have been discretized in space and are now ODEs with respect to time only. Not sure whether that is still problematic or not.
Often, the ODE integrator uses values for input parameters past the period of integration. So if you supply Q as the unsteady profile shown above, it may happen that the solver takes values for Q from a time greater than one day and thereby ruins the profile for the concentrations. So make sure Q is really constant during one integration period (e.g. by just supplying it as a single value).
If you already do this and it doesn't solve the problem, I suspect that your equation for the concentrations are unstable or your discretization is somehow flawed. But without seeing the mathematical problem in more detail, I cannot give further advice.
Interesting.
I am giving it as a vector and then based on the time that the ode15s is at, it chooses the corersponding value from the vector inside the function that describes the right hand side of the ODE system. I will try to give the values one by one just before I call ode15s.
Thank you so much!
I have tried, I solved the issue of the flow going up and down but discontinuities still show up simply because the flow value changes.
They are less intense for the first 10 hours, when the slope of the concentration is higher, but once the increase in C slows down, the peaks and dips are more intense.
:(
I can't interprete your results for C since I don't know your equations. But there must be other parameters that influence C apart from Q. Otherwise I couldn't explain why C slightly increases between 59 and 62 and decreases between 66 and 69 although Q in both cases is at a comparable level.

Sign in to comment.

Answers (0)

Asked:

on 1 Oct 2023

Commented:

on 5 Oct 2023

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!