0
$\begingroup$

I want to learn a very simple PDE to gain physical and mathematical intuition—a PDE with just one spatial dimension $x$ and a time dimension $t$. And, I want to write code for it in Matlab and use a standard PDE solver that Matlab might have, so that I can get a feel for the solution to the PDE and how the solution changes/behaves with a change in $x$ or $t$.

  • I have no experience with PDEs.

  • What could be a nice PDE to start with?

  • What's a nice Matlab solver for PDEs?

  • For ODEs, the Matlab solver ode45 is pretty nice to use.

$\endgroup$
  • $\begingroup$ A really basic one that fits your desired criteria could be the unsteady heat equation in 1D. As for PDE solvers in matlab, never used one so I can’t comment. I have always rolled my own PDE solving code if I write something in matlab. $\endgroup$ – spektr Jan 8 at 7:07
  • $\begingroup$ @spektr interesting: is there a standard solver code that I could learn to write on my own? do you have a reference maybe? I'd also like to write a simple solver, so that I can understand the numerical method underlying the solver. $\endgroup$ – user33775 Jan 8 at 7:11
  • $\begingroup$ Well a common approach is to discretize the spatial derivatives of the PDE to obtain a system of ODEs and then solve this system with ‘ode45’ or something along these lines. The easiest discretization is to turn spatial derivatives into finite difference approximations. $\endgroup$ – spektr Jan 8 at 7:17
  • $\begingroup$ @spektr how long does it take to learn this, in your estimation? maybe a week for the unsteady heat equation? how many lines of matlab code would it be? less than 100 lines of code maybe? (sorry for my cluelessness.) $\endgroup$ – user33775 Jan 8 at 8:37
4
$\begingroup$

Standard examples of PDE to solve with the typically taught basic discretization methods (Crank-Nicolson et al.) are

  • Transport equations, and other first order equations like Burger's, have often explicit solutions and conservation laws that the numerical methods more-or-less satisfy

  • The heat equation with different boundary conditions and source terms is the teaching example for Crank-Nicolson and related methods,

  • The KdV, Korteweg-deVries equation with a soliton wave (animating a wave function in MATLAB) or multiples of them, (Zabusky and Kruskal's stepper for the KdV equation) is heavily non-linear and teaches why stiffness has to be taken into account, thus the use of implicit solver methods.

  • In using complex-valued functions, one can explore the non-linear Schrödinger (NLS) equations (pseudo-spectral method in NLS), with the same difficulties as the last one.

$\endgroup$
2
$\begingroup$

If you're interested in modelling any type of PDE within MATLAB, the Partial Differential Equation Toolbox should be able to handle anything you're interested in.

This includes tools for meshing, solving and visualising the results from a user defined system of equations. It can handle both time and spatially dependent systems simultaneously.

The complete documentation holds a significant volume of worked examples which would probably be helpful in gaining some intuition for various systems. PDEPE make also be a useful function for 1D problems.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.