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

*No products are associated with this question.*

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.

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;

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

Learn moreOpportunities for recent engineering grads.

Apply Today
## 0 Comments