pde1dm with coupled ODEs

According to the pde1dm manual, pde1dm with coupled ODEs has to do with three additional arguments to the pde1dm function:
[solution,odeSolution] = pde1dm(m,pdeFunc,icFunc,bcFunc,meshPts,timePts,... odeFunc, odeIcFunc,xOde)
However, I just:
pde1dm(m,pdeFunc,icFunc,bcFunc,meshPts,timePts)
as though I were using pdepe and I still got the correct result. Why? So when should one add the three additional arguments to pde1dm?

6 Comments

Torsten
Torsten on 4 Feb 2024
Edited: Torsten on 4 Feb 2024
Why don't you ask all your questions about pde1dm in one request, preferably in this one:
thanks for the suggestion. I thought people prefer being asked one question/theme in one request, rather than multiple. I'm ok with either.
any expert from mathworks please?
Bill Greene is the only one who can answer your questions; pde1dm is not a code from TMW.
If you run into problems using pde1dm, I am willing to take a look. But there is no way I can respond based on the scant information you have provided in this post.
In general what I expect is the following:
  1. A complete mathematical description of the problem you are trying to solve including the equations (in math format) and the result you expect to obtain.
  2. A complete listing of your source code, simplified as much as possible, and formatted as a code block so I can easily download and run it.
To solve ut=uxx through a decomposition into two equations with two unknowns u and ux: and
function heat
w=1;x=linspace(-pi,pi);t=linspace(0,10);
% sol=pdepe(0,@pde,@ic,@bc,x,t);
sol=pde1dm(0,@pde,@ic,@bc,x,t);
u=sol(:,:,1);surf(x,t,u)
%%
function [c,f,s]=pde(x,t,u,ux)
c=[1;0];f=[u(2);u(1)];s=[0;-u(2)];
end
%%
function u0=ic(x)
u0=[cos(x);-sin(x)];
end
%%
function [pl,ql,pr,qr]=bc(xl,ul,xr,ur,t)
pl=[0;ul(2)];ql=[1;0];pr=[0;ur(2)];qr=[1;0];
end
end

Sign in to comment.

Answers (1)

Bill Greene
Bill Greene on 7 Feb 2024
Your second equation is an elliptic PDE NOT an ODE because both unknown variables are functions of both x and t.. Accordingly, pdepe(and pde1dm) are able to solve this system.
If you are confused about this issue, you should look more carefully at the definition of an ODE shown as equation 2 in the pde1dm user manual. I looked again at the explanation there and don't have anything to add to that at this point.

4 Comments

thank you! I thought those that have only spatial or only temporal derivatives but not both are called ODEs in pdepe/1dm. I checked the pde1dm manual but didn't find any precise definition like how you describe: as long as they are both spatially and temporally dependent even if they haven't spatial and temporal derivatives together, they are still regarded as PDEs?
Dear Dr Greene, how do you like my last comment/question?
Torsten
Torsten on 8 Feb 2024
Edited: Torsten on 8 Feb 2024
As far as I know, additional ODEs are of the form
d(uode)/dt = f(uode,upde,x,t)
thus the equation for uode is described by an ordinary differential equation in time without dependence on uode_x or upde_x.
Thanks for the clarification that an ODE recognized by pdepe is defined this way, i.e. having only time derivatives

Sign in to comment.

Tags

Asked:

on 4 Feb 2024

Commented:

on 8 Feb 2024

Community Treasure Hunt

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

Start Hunting!