pde1dm with coupled ODEs

2 visualizzazioni (ultimi 30 giorni)
feynman feynman
feynman feynman il 4 Feb 2024
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 Commenti
Bill Greene
Bill Greene il 6 Feb 2024
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.
feynman feynman
feynman feynman il 7 Feb 2024
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

Accedi per commentare.

Risposte (1)

Bill Greene
Bill Greene il 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 Commenti
Torsten
Torsten il 8 Feb 2024
Modificato: Torsten il 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.
feynman feynman
feynman feynman il 8 Feb 2024
Thanks for the clarification that an ODE recognized by pdepe is defined this way, i.e. having only time derivatives

Accedi per commentare.

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by