How to control times at which PDE Toolbox solves a parabolic equation?
10 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Abrar Habib
am 12 Feb. 2014
Beantwortet: Bill Greene
am 4 Mär. 2014
I am solving a 1D groundwater flow equation with time-dependent forcing using PDE Toolbox. I managed to input the time-dependent forcing (which is a vector of data values at specific times) into the PDE Toolbox using the following function:
function f = fcoeff(t)
W = importdata('Rainfall_daily.mat'); % the forcing
nt=length(W);
tW = 0:nt-1; % values of time at which forcing data is available
W_intrp = interp1(tW,W,t,'linear'); % interpolated values of forcing at
times used by toolbox
disp([t, W_intrp])
f = W_intrp;
However, the PDE toolbox misses some data points in the vector 'W' because it sometimes takes too large time steps. This does not yield correct results at the time values I ask it to plot the results at. That is why I want to force the PDE toolbox to solve the parabolic PDE at time values that I specify. This will also help me avoid using interp1 in the above function.
Thanks, Abrar
0 Kommentare
Akzeptierte Antwort
Bill Greene
am 4 Mär. 2014
I'm afraid I wasn't able to run your example. I believe that your fcoeff function has an error in it.
I did take a look at the Rainfall_daily.mat file. If I am right in assuming that the first column is some kind of time measure and the second is the function value, it looks like the function is extremely discontinuous.
The ODE solver used by the PDE Toolbox parabolic function has an option, MaxStep, that allows you to specify the maximum step size used during the solution. It might be possible to improve the solution you are getting by setting this to a fraction of the delta_time of your data.
Unfortunately, there is no simple way to do this without editing the PDE Toolbox parabolic function. If you edit this function (I suggest making a copy of the original first), you will see where the ode15s function is being called and where the other options to ode15s are being set. Adding the MaxStep option should be straightforward. I think this change will cause the parabolic function to execute much slower so I suggest you remove this change when you are through with this particular example.
Good luck!
Bill
0 Kommentare
Weitere Antworten (1)
Bill Greene
am 12 Feb. 2014
>This does not yield correct results at the time values I ask it to plot the results
So, why don't you request results at the time of each point in your W-vector?
You could also experiment with setting smaller values of the rtol and atol optional input arguments to the parabolic function.
Regardless, you will still need the interp1() function to perform interpolation because the function ode15s, the ODE solver used by parabolic(), will call your function at arbitrary times between the initial and final times.
Bill
3 Kommentare
Bill Greene
am 12 Feb. 2014
So if I understand you right, you are including every time in your W vector in the tlist argument to parabolic, but parabolic is not calling your f-coefficient evaluator at those times?
I would need to investigate this further. If you can post your complete example, (using the paper-clip icon in the editor dialog below), I'll take a look.
Bill
Siehe auch
Kategorien
Mehr zu Eigenvalue Problems finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!