Can pdepe solve a system of two second-order equations?
I am trying to figure out pdepe and how to use it to solve a higher order equation written as multiple second order equations. Even though I am trying to solve a more complex equation in the future I want to start with a simple case
.
My idea is to rewrite it by including a second variable
where
.
I chose the spatial coordinate to range from x=linsapce(0,2*pi,N) to ensure that my initial conditions satisfy my boundary conditions (see below).
In pdepe terms I wrote
function [c,f,s] = pdex1pde(x,t,u,dudx)
global D
c = [1 ; 0];
f = [D*dudx(2); dudx(1)];
s = [0; -u(2)]; %where q=u(2);
end
and providing some initial condition (from 0 to 2pi)
function u0 = pdex1ic(x)
init = 1-cos(x);
d2init_dx2 = cos(x);
u0 = [init; d2init_dx2]
end
For the boundary conditions I just used a Neumann boundary for each boundary
function [pl,ql,pr,qr] = pdex1bc(xl,ul,xr,ur,t)
pl = [0;0];
ql = [1;1];
pr = [0;0];
qr = [1;1];
end
Now pdepe gives me a warning that it could not converge at time t=0 and I don’t get a result.
Is there something that I am missing?
I had a look at other questions about this topic and already stumbled upon this github page (https://github.com/wgreene310/pdepe-examples), but I don’t really understand it without the written equations.
Thank you very much for answering.I am trying to figure out pdepe and how to use it to solve a higher order equation written as multiple second order equations. Even though I am trying to solve a more complex equation in the future I want to start with a simple case
.
My idea is to rewrite it by including a second variable
where
.
I chose the spatial coordinate to range from x=linsapce(0,2*pi,N) to ensure that my initial conditions satisfy my boundary conditions (see below).
In pdepe terms I wrote
function [c,f,s] = pdex1pde(x,t,u,dudx)
global D
c = [1 ; 0];
f = [D*dudx(2); dudx(1)];
s = [0; -u(2)]; %where q=u(2);
end
and providing some initial condition (from 0 to 2pi)
function u0 = pdex1ic(x)
init = 1-cos(x);
d2init_dx2 = cos(x);
u0 = [init; d2init_dx2]
end
For the boundary conditions I just used a Neumann boundary for each boundary
function [pl,ql,pr,qr] = pdex1bc(xl,ul,xr,ur,t)
pl = [0;0];
ql = [1;1];
pr = [0;0];
qr = [1;1];
end
Now pdepe gives me a warning that it could not converge at time t=0 and I don’t get a result.
Is there something that I am missing?
I had a look at other questions about this topic and already stumbled upon this github page (https://github.com/wgreene310/pdepe-examples), but I don’t really understand it without the written equations.
Thank you very much for answering. I am trying to figure out pdepe and how to use it to solve a higher order equation written as multiple second order equations. Even though I am trying to solve a more complex equation in the future I want to start with a simple case
.
My idea is to rewrite it by including a second variable
where
.
I chose the spatial coordinate to range from x=linsapce(0,2*pi,N) to ensure that my initial conditions satisfy my boundary conditions (see below).
In pdepe terms I wrote
function [c,f,s] = pdex1pde(x,t,u,dudx)
global D
c = [1 ; 0];
f = [D*dudx(2); dudx(1)];
s = [0; -u(2)]; %where q=u(2);
end
and providing some initial condition (from 0 to 2pi)
function u0 = pdex1ic(x)
init = 1-cos(x);
d2init_dx2 = cos(x);
u0 = [init; d2init_dx2]
end
For the boundary conditions I just used a Neumann boundary for each boundary
function [pl,ql,pr,qr] = pdex1bc(xl,ul,xr,ur,t)
pl = [0;0];
ql = [1;1];
pr = [0;0];
qr = [1;1];
end
Now pdepe gives me a warning that it could not converge at time t=0 and I don’t get a result.
Is there something that I am missing?
I had a look at other questions about this topic and already stumbled upon this github page (https://github.com/wgreene310/pdepe-examples), but I don’t really understand it without the written equations.
Thank you very much for answering. pdepe, pde, system of equations MATLAB Answers — New Questions