Can pdepe solve a system of two second-order equations?
Show older comments
Updated 30.01.25, based on the given answers and the pde1dM_manual.pdf section 4.4, I updated the code below accordingly
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
. (Updated based on the answers)My idea is to rewrite it by including a second variable (in fact I now need three equations, since I got the second derivative in time)
,
(Updated based on the answers)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 ; 1; 0];
f = [0; -D*dudx(3); -dudx(1)];
s = [u(2); 0; u(3)];
% Old code
% 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)
% initial condition based on pde1dM_manual.pdf section 4.4
init = 1-cos(x);
d4init_dx4 = cos(x);
u0 = [init; 0; d4init_dx4];
% Old code
% 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)
% Updated boundary conditions equivalent to a simply supported beam
% based on pde1dM_manual.pdf section 4.4.3
pl = [ul(1); ul(2); ul(3)];
ql = [0; 0; 0];
pr = [ur(1); ur(2); ur(3)];
qr = [0; 0; 0];
% Old code
% 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.
Update: Pdepe converged and was able to solve the updated equation as a system of two spatialy second order equations
5 Comments
James Blanchard
on 30 Jan 2025
What boundary conditions are you trying to use?
Torsten
on 30 Jan 2025
As written, first and third derivative of u are set to 0 at both endpoints.
Schmieje
on 30 Jan 2025
James Blanchard
on 30 Jan 2025
I don't think that system has a unique solution.
Schmieje
on 30 Jan 2025
Accepted Answer
More Answers (0)
Categories
Find more on Eigenvalue Problems in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!