solving a system of pdes using pdepe

4 vues (au cours des 30 derniers jours)
Ricardo Machado
Ricardo Machado le 22 Déc 2020
Commenté : Bill Greene le 23 Déc 2020
So i have the follwing system of pdes:
where .
where .
The symmetry boundary conditions are:
The other two boundary conditions are given by:
At
and
.
Parameter values are: k1 = 5 ,k2 =6 , C=8.
So this is the function code:
function [c,f,s] = pdefun(x,t,u,dudx)
% Equation to solve
c = [1; 1];
if x <= 2
f = 5*dudx;
else
f = 6*dudx;
end
%k1 and k2.
end
% ---------------------------------------------
function u0 = pdeic(x) % Initial Conditions
u0 = [10; 0];
end
% ---------------------------------------------
function [pl,ql,pr,qr] = pdebc(xl,ul,xr,ur,t) % Boundary Conditions
pl = [0; 0];
ql = [0; 0];
pr = [e; f];
qr = [g; h];
end
% ---------------------------------------------
Then to solve the equation:
x = [0 0.1 0.2 0.3 0.4 0.45 0.475 0.5 0.525 0.55 0.6 0.7 0.8 0.9 0.95 0.975 0.99 1];
t = [0 0.001 0.005 0.01 0.05 0.1 0.5 1];
m = 2;
sol = pdepe(m,@pdefun,@pdeic,@pdebc,x,t);
u1 = sol(:,:,1);
u2 = sol(:,:,2);
To plot the solution:
surf(x,t,u1) %or u_{2}
title('u_1(x,t)')
xlabel('Distance x')
ylabel('Time t')
Just asking how do you write down the boundary conditions to make it suitable for pdepe as the examples provided on the matlab website don't help much with putting the boundary conditions in the standard form?
  1 commentaire
Bill Greene
Bill Greene le 23 Déc 2020
I have written a short note that describes pdepe boundary conditions in more detail than the pdepe documentation.
You might find that helpful.

Connectez-vous pour commenter.

Réponses (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by