how can I add complex boundary conditions to pdepe functions?
2 views (last 30 days)
Show older comments
I am trying to solve a following problem: dq(x,t)/dt=D*d/dx(dq(x,t)/dx)
with initial conditions: q(x,0)=0 and boundary conditions: dq(0,t)/dx=0 q(x,t)=f(cs) (for example linear function A*cs) B*D*dq(x,t)/dx=k*(cc-cs)
where cc is a concentration dependent on time and it is changing with time
My code (example constants) is as follows: function [c,f]=func1(x,t,q,Dqdx) c=1; D=5; f=D*Dqdx;
function q0=init(x) q0=0;
function [p1,q1,pr,qr]=bound(x1,u1,xr,ur,t) %I don't know where I need to put this: q(x,t)=f(cs) (for example linear function A*cs) p1=0; q1=1; B=10; cc=linspace(0,1,500); %should i put it here? or in main function? cs=linspace(0,0.1,50); pr=iso(cc,cs); % I am sure that it is not ok qr=B; % this one too
function y=iso(cc,cs) kf=10; y=kf.*(cc-cs);
I appreciate any help
0 Comments
Accepted Answer
Torsten
on 9 Apr 2015
A boundary condition of the form dq/dx=0 is set as
p=0 ; q=1 ;
a boundary condition of the form q=f(cs) is set as
p=u-f(cs); q=0;
a boundary condition of the form B*D*dq/dx=k*(cc-cs) is set as
p=-k*(cc-cs); q=B;
Best wishes
Torsten.
More Answers (0)
See Also
Categories
Find more on Linear Algebra in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!