Clear Filters
Clear Filters

boundary conditions for pdepe

2 views (last 30 days)
yogan sganzerla
yogan sganzerla on 24 Jun 2017
Answered: Torsten on 26 Jun 2017
Hello, My using pdepe to solve a problem. I have a square and the right side the temperature is 10ºC and in the left side the temperature is 0ºC. In the time Zero, e.g T(x,0) the temperature in the body is 5 degrees.
I know that I can solve this problem easily using hands, but I would like to show for my students how they can use these tools to solve it.
I am using pdepe and I just want to know how to setup the @pdex1bc. What are my coefficients "pl","ql","pr","ql" in the function?
Thanks
  1 Comment
Joshua
Joshua on 24 Jun 2017
I will admit that I do not have experience using pdepe, but based on my experience with function handles and reading the documentation, "pl","ql","pr","ql" are all boundary conditions (bcs) of the pde that you define using your custom function @pdex1bc. From what I understand, in the code below, you can define "pl","ql","pr","ql" however you want in @pdex1bc based on your problem. If the left side of your square is x=xl=0 and the right side is x=xl=length, pl and ql would correspond to bcs at x=xl=0, and pr and qr would correspond to bcs at x=xr=length. I assume one of those would include the constant temperatures on each side, but without seeing your equation I am not sure. In the example code below they gave, they define the bcs based on xl,ul,xr,ur,t from the problem.
function [pl,ql,pr,qr] = pdex1bc(xl,ul,xr,ur,t)
pl = ul;
ql = 0;
pr = pi * exp(-t);
qr = 1;
Not sure if that was helpful at all. I only have experience using ode45 which is much simpler.

Sign in to comment.

Answers (1)

Torsten
Torsten on 26 Jun 2017
pl = ul;
ql = 0.0;
pr = ur-10;
qr = 0.0;
Best wishes
Torsten.

Products

Community Treasure Hunt

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

Start Hunting!