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

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 Commenti

What boundary conditions are you trying to use?
As written, first and third derivative of u are set to 0 at both endpoints.
I just thought to set Neumann boundaries on the ends of both equations, so .
I don't think that system has a unique solution.
You are right, the equation should read following the pde1dm_manual.

Accedi per commentare.

 Risposta accettata

Torsten
Torsten il 30 Gen 2025
Modificato: Torsten il 30 Gen 2025
Goto
download the code, goto folder "documents" and study example 4.4 in "pde1dm_manual".

4 Commenti

Thank you @Torsten, that is exactly what I was looking for
Note that the equation in the document uses the second derivative with respect to t, not the first.
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.
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;

Accedi per commentare.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by