Time-dependent point source for diffusion with pdepe
Mostrar comentarios más antiguos
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 comentarios
Torsten
el 26 de En. de 2018
Is the source position a boundary point of your domain of integration ?
Lukas
el 26 de En. de 2018
Switches are generally hard to simulate. I would either use events or separate calls of the ode or pde solver. Your initial value of Source is only zero at exactly t=0. This will not have any effect on the simulation result, as the timespan in inf. small. Better omit this statement.
Nicholas Mikolajewicz
el 26 de En. de 2018
If the source is at the boundary, it has to be incorporated in the boundary condition function pdex4bc and removed from the pdex4pde function.
If you know the value u1* of the source at time t, maybe a boundary condition of the form
-D1*du1/dx = ka*(u1-u1*)
(ka = ka-value) is adequate.
Knowing more about the process you are trying to describe might help.
Best wishes
Torsten.
Nicholas Mikolajewicz
el 26 de En. de 2018
Torsten
el 30 de En. de 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.
Nicholas Mikolajewicz
el 30 de En. de 2018
Respuestas (0)
Categorías
Más información sobre Programming en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!