solving a system of pdes using pdepe

조회 수: 1 (최근 30일)
Ricardo Machado
Ricardo Machado 2020년 12월 22일
댓글: Bill Greene 2020년 12월 23일
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
Bill Greene
Bill Greene 2020년 12월 23일
I have written a short note that describes pdepe boundary conditions in more detail than the pdepe documentation.
You might find that helpful.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 PDE Solvers에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by