Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

how to solve non-linear PDE

Asked by Davoud on 7 May 2013

I want to solve the following PDE and plot the U versus r for following equation du/dt=-div(u^0.8 du/dr). was wondering if anyone can help me out? 0=<r<=5, 0=<t<=30 Thanks

0 Comments

Davoud

Products

No products are associated with this question.

1 Answer

Answer by Youssef KHMOU on 8 May 2013
Edited by Youssef KHMOU on 8 May 2013
Accepted answer

hi,

try :

 doc pdepe

Generally the PDEs in matlab follow the general formuale :

 c(x,t,u,du/dx).du/dt=(x^-m).d/dx[(x^-m)f(x,t,u,du/dx)]+s(x,t,u,du/dx)

Where the s is the source term and f is the flux term.

given a PDE , you have to make an analogy between your equation and the general form above, so for example in your case we have : s=0; m=0;c=1; and f=u^0.8*Diveregence(u) .

You have missing conditions in your problem : Initial conditions and Boundary conditions , i tried to write for you the sample with default conditions in Math(c) documentation , adapt it based on you I.C:

 % function ( M-file)
function SOL=PDEX1()
r=linspace(0,5,100);
t=linspace(0,30,100);
m=0;
SOL= pdepe(m,@pdex1pde,@pdex1ic,@pdex1bc,r,t);
function [c,f,s] = pdex1pde(r,t,u,M)
% du/dt=div(u^(0.8)du/dr)
c =1;
D=gradient(u);
M =(u.^(0.8)).*D;
f= M;
s =0;
function u0 = pdex1ic(r)
u0 = sin(pi*r);
function [pl,ql,pr,qr] = pdex1bc(xl,ul,xr,ur,t)
pl = ul;
ql = 0;
pr = pi * exp(-t);
qr = 1;

change now the initial/ boundary conditions.

Your equation seems like it has a Nusselt number no? anyway we r waiting for the result interpretation,

 % In the workspace try :
 >>S=PDEX1();
 >>surf(S);

I hope this helps.

2 Comments

Davoud on 9 May 2013

Hi Youssef, Thanks for your help I think you made a mistake, because the left hand side of the equation I asked is divergence not gradient also the initial condition is at t=0 u=1 and at r=5 u=0.512 and at r=0 du/dr=0

Youssef KHMOU on 9 May 2013

hi, I choosed gradient because i still dont know if U is 2D or 3D, but basically its 2D ( function of radius and time ) and i tried with with diff/diff(r) and gradient, they give ~ the same , but using diff(u)./diff(r) gives an error.

about the initial conditions, make these changes :

function u0 = pdex1ic(r)
u0 = 1;
function [pl,ql,pr,qr] = pdex1bc(xl,ul,xr,ur,t)
pl = 1;
ql = 1;
pr = -0.512;
qr = 1;
Youssef  KHMOU

Contact us