Hi Everyone,
I am trying to use pdepe to solve a diffusion problem and Im having issues trying to set my left side boundary condition.
dP=0.04; %thickness polymer layer [cm]
d=100; %times in days [d]
tt=d*86400; %time in seconds [s]
x = linspace(0,dP,5); t = linspace(0,tt,100); m = 0; sol = pdepe(m,@equa,@IC,@BC,x,t); u =sol(:,:,1) function [c,f,s,algo] = equa(x,t,u,DuDx) ∂Cp/∂t=D*∂/∂x(∂Cp/∂x) c = 1; f = D*DuDx; s = 0; end function u0 = IC(x) u0 = Cpo; %Initial concentration[microg/cm^3]
end function [pl,ql,pr,qr] = BC(xl,ul,xr,ur,t) pl =0; ql =1; pr =h*((ur/K)-Cinf); qr =D; end the first boundary condition (0,t) ∂Cp/∂x=0 the second boundary condition (x,t) h*(Cp/K-Cinf)+D*∂Cp/∂x=0
Rigth now looks like it is working using Cinf as a constant but actually Cinf should change and increase with time (accumulation).
Cinf=A/V*integral(∂Cp/∂x (t) dt, 0,t)I really dont know how to solve it this way Could someone please guide me?
Best Answer