Solving one-dimensional PDE's using the PDE Toolbox
이전 댓글 표시
Hi,
I've been trying to solve a non-linear, heat-equation-type system of PDE's using the 'pdepe' function, with only one dimension in space. However, for many sets of parameter values, the solver exhibits unstable behaviour (oscillations, etc). I think that my problem demands a more sophisticated solver, due to nonlinearities and discontinuities. Hence, I am now trying to use the PDE Toolbox, hoping that it would be able to handle my problem, since it has an adaptive mesh algorithm, etc. However, I was unable to figure out how to use the PDE Toolbox for one-dimensional problems, nor was I able to find any examples of this.
Is it possible to use the PDE Toolbox to solve one-dimensional problems? I'm find with using the command-line interface (I don't necessarily need to use the GUI). If this is possible, I'd greatly appreciate it if someone could provide me with some code that solves a simple heat equation PDE (one dimension in space) using the PDE Toolbox, just to get me on the right foot (since, for some reason, I get really lost when I try to read the documentation for the PDE Toolbox).
Thanks,
Abed
채택된 답변
추가 답변 (1개)
Ok this question has already been answered, but I want to share my experience with pdepe.
I also had problems with oscilating, unstable behaviour of pdepe. I found that the Problem lies not directly in the pdepe, but in the underlying ode15s solver. You can specify some options (with odeset()) for the pdepe-solver which are then passed to the ode15s solver.
The problem is, that only very few of the possible odeset() options are passed. To get a much more stable solution from the underlying ode15s solver I reduced the 'MaxOrder' option from the Default value of {5} to 2.
It's not that hard to make the option available for your pdepe solver.
How to make your pdepe solver more stable:
1) Find the file 'pdepe.m' in somewhere in your matlab installation path and copy it to your working directory. And rename it to e.g. 'pdepe_opt.m'.
2) Find the file 'pdentrp.m' (which is located in the 'private' directory next to 'pdepe.m') and copy it to your working directory.
3) In your local copy of pdepe.m, namely pdepe_opt.m add the line
maxorder = odeget(options,'MaxOrder',[],'fast');
after the line
maxstep = odeget(options,'MaxStep',[],'fast');
4) Then add
'MaxOrder',maxorder,
as argument of the odeset command, which is some lines below.
5) Before the line in your code where you call pdepe, insert
options = odeset('MaxOrder',2)
(or any number from 1 to 5) and then call the optimized pdepe function with your specified options:
sol = pdepe_opt(m,@pdex1pde,@pdex1ic,@pdex1bc,x,t,options)
I hope this works as well for you as it did for me.
Best regards,
Tom
댓글 수: 4
Abed Alnaif
2015년 3월 20일
Sonia
2015년 7월 7일
It worked for me too, after trying out all other impossible options! In fact, I didn´t need to modify the function, passing extra option in odeset sufficed. Thanks a lot!!
Lucy
2017년 11월 22일
This is amazing thank you!
Mario Buchely
2020년 4월 13일
This solution didn't work for me.
But I modified the pdepe.m fuction, and changed the solver from ode15s to ode23s. After this change, and copying the modifed in the workind directory (and the pdentrp.m file), my solution converged and worked fine.
Thank you for the key to solve this issue.
카테고리
도움말 센터 및 File Exchange에서 Eigenvalue Problems에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!