Time-dependent point source for diffusion with pdepe
7 views (last 30 days)
Show older comments
Hi Everyone,
I was hoping someone could give me a hand with this diffusion problem. In brief, I'm trying to simulate two-dimensional diffusion which includes a time-dependent source function to reproduce some experimental results, however I've encountered challenges...
I have no problem simulating diffusion alone, however the problem arises in introducing the source for t>0 at x = 0. Currently I've been trying to do the following:
function [c,f,s] = pdex4pde(x,t,u,DuDx, xSpan, tSpan)
c = [1; 1];
f = [D1; D2] .* DuDx; % diffusion term
k1 = 0.02; % degradation rate for species 1
k2 = k1/4; % degradation rate for species 2
sourcePosition = 0; %micrometers
releaseTime = 1; %seconds
initialConc = 0.001
if x == sourcePosition & t <= releaseTime ;
n = (0.221 * releaseTime ) + 1.662; % source function parameter
k = 0.138 * releaseTime ^ 1.53); % source function parameter
releaseFunction = (initialConc .* (tSpan.^n) ./ ((k.^n) + (tSpan.^n))); % sourcefunction
releaseRates = diff(releaseFunction); % source function differential
if t == 0 % at t = 0, there is nothing in the system
Source=0;
else % for t>0, diffusing species is introduced into the system
Source = interp1(tSpan(2:end), releaseRates, t, 'linear', 'extrap');
end
else
Source= 0;
end
F1 = -k1*u(1) + Source;
F2 = k1*u(1)-k2*u(2);
s = [F1; F2];
end
Any suggestions would be immensely appreciated, I've been struggling with this for a while now. I'm do not have a strong math background, so the simpler the better if possible. If there's any other information what is needed, please let me know.
Thanks in advance!
7 Comments
Torsten
on 30 Jan 2018
I don't understand the physical background - so I can't give you further advice. But your solution with
pl = -pdexSource;
ql = 1.0;
can't be correct because D1*du1/dx has unit mol/(m^2*s) wheras pdexSource has unit mol/(m^3*s), I guess.
Best wishes
Torsten.
Answers (0)
See Also
Categories
Find more on Equation Solving in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!