Can pdepe solve a system of two second-order equations?

5 views (last 30 days)
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
Schmieje
Schmieje on 30 Jan 2025
You are right, the equation should read following the pde1dm_manual.

Sign in to comment.

Accepted Answer

Torsten
Torsten on 30 Jan 2025
Edited: Torsten on 30 Jan 2025
Goto
download the code, goto folder "documents" and study example 4.4 in "pde1dm_manual".
  4 Comments
Torsten
Torsten on 30 Jan 2025
Since you modified your question I'm not sure whether you could solve your problem with the code given or whether you still encounter difficulties.
Schmieje
Schmieje on 2 Feb 2025
Edited: Walter Roberson on 2 Feb 2025
Yes, I got a solution for the updated code.
These are the results for every
i = 1:10:numel(t)
sol = pdepe(0,@pdex1pde,@pdex1ic,@pdex1bc,x,t);
result = sol(i,:,1);
with the given model parameters
x = linspace(0,2*pi,100);
t = linspace(0,10,151);
D = 0.01;

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!