How to control times at which PDE Toolbox solves a parabolic equation?
Show older comments
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
Accepted Answer
More Answers (1)
Bill Greene
on 12 Feb 2014
0 votes
>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 Comments
Abrar Habib
on 12 Feb 2014
Bill Greene
on 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
Abrar Habib
on 28 Feb 2014
Edited: Abrar Habib
on 1 Mar 2014
Categories
Find more on Eigenvalue Problems in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!