Hello everyone, I would like to use pdepe for solving a heat equation 1D space, so it looks good. But I don't really understand where the diffusion coefficient is ?
I would like to solve : (1)--> du/dt = d/dx(D(u) du/dx) with D(u) the non linear diffusion coefficient function of u. Is it possible to put D(u) at this location in the equation (1)?
Thanks to the community. :)

 채택된 답변

Grzegorz Knor
Grzegorz Knor 2011년 9월 23일

0 개 추천

Yes it is possible in pdefun :)
Look at example:
function diffusion
m = 0;
x = linspace(0,1,20);
t = linspace(0,2,5);
sol = pdepe(m,@eqtn,@ic,@bc,x,t);
u = sol(:,:,1);
figure;
surf(x,t,u);
xlabel('Distance x');
ylabel('Time t');
% --------------------------------------------------------------------------
function [c,f,s] = eqtn(x,t,u,DuDx)
c = 1;
f = Dfsn(u)*DuDx;
s = 0;
% --------------------------------------------------------------------------
function u0 = ic(x)
u0 = 1:length(x);
% --------------------------------------------------------------------------
function [pl,ql,pr,qr] = bc(xl,ul,xr,ur,t)
pl = ul;
ql = 2;
pr = ur;
qr = 2;
% --------------------------------------------------------------------------
function d = Dfsn(u)
d = sqrt(u+1);
Where Dfsn is your non linear diffusion coefficient function.

댓글 수: 5

Alex
Alex 2011년 9월 23일
Thanks Grzegorz, but could you tell me more the equation you are solving in your example. Because it seems weird to have an increase of u, a diffusion equation must diffuse not increase.
Grzegorz Knor
Grzegorz Knor 2011년 9월 23일
This equation has no physical meaning. I wrote a simple example that shows just how to use any function D in the parabolic partial differential equation.
Bjorn Gustavsson
Bjorn Gustavsson 2011년 9월 23일
@Alex: Depending on your heating and cooling rates of course you can get increasing temperatures, and a temperature varying heat conductivity is not unheard of - that should just reflect a variation of how efficiently heat is conducted at different temperatures. In the physical systems I work with D is roughly proportional to T.^(5/2).
Alex
Alex 2011년 10월 3일
Ok, thanks for the answer. I had work on it, but I remain stuck on pl, ql, pr and qr. In a basic heat equation you have to give an initial condition and boundary condition. What is in that case the boundary condition ?
For example, initial condition is u(t=0,x)=sin(Pix) u(t,x=0)=u(t,x=1)=0 for [0,1] in space.
So what are the link with pl,pr,ql,qr and boundary condition ?
Mohammed Thaiki
Mohammed Thaiki 2016년 12월 1일
Hello ; I have a problem with a heat transfer script, below the script:
clear all; x=linspace(0,.01,50);%We use 50 values from 0 to 0.01 t=linspace(0,1,60);%We used 60 points from 0 to 1 m=0; sol=pdepe(m,@ecuation,@initialcond,@boundary,x,t) u=sol(:,:,1); % Surface plot command and data surf(x,t,u) colormap([gray]) xlabel('\delta (m)') ylabel('L (m)') zlabel('C_a (M)') shading interp figure for j=1:length(t) plot(x,u(j,:),'k') xlabel('\delta (m)') ylabel('C_a (M)') hold on end
and the three files :
1. @ecuation function [c,f,s]=ecuation(x,t,u,DuDx) c=2*0.5*((x/0.01)-0.5*(x/0.01)^2)/2.1e-5;%term (C) f=DuDx;%Flow term (F) s=0;%source term (S)
2. @initialcond %Initial conditions. function u0=initialcond(x) u0=0;
3. @boundary %Boundary conditions. function [pl,ql,pd,qd]=boundary(xl,ul,xd,ud,t) %for y = 0 pl=0; ql=1; %%for y = δ pd=ur-.1; qd=0;
MATLAB gives error in line :
sol=pdepe(m,@ecuation,@initialcond,@boundary,x,t)
I am waiting for your ideas to solve this problem thank you

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Matrix Computations에 대해 자세히 알아보기

질문:

2011년 9월 23일

댓글:

2016년 12월 1일

Community Treasure Hunt

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

Start Hunting!

Translated by