Adding a known velocity (convection) term to reaction diffusion equation using bvp4c
2 次查看(过去 30 天)
显示 更早的评论
I am trying to add a known velocity (10 m/s) to my steady state reaction diffusion equation although I'm a bit confused how to go about doing that.
This is my current code
function simple_steady_state_bvp4c
close all; clear all; clc;
%Diffusion coefficient
D_ij= 1*10^-6;
%Initial concentration at x=0
L0 = 1;
%Total length
x_f = 0.025;
k_1 = 0.25;
solinit = bvpinit(linspace(0,x_f,11),[0.5 0]);
sol = bvp4c(@(x,y)odefcn(x,y,D_ij,k_1),@twobc,solinit);
figure(1)
plot(sol.x,(sol.y(1,:)),'LineWidth',1)
title('Steady State')
xlabel('Distance (\mum)')
ylabel('Concentration (nM)')
axis([0 x_f 0 L0])
function dy = odefcn(x,y,D_ij,k_1)
C_L = y(1);
dC_Ldx = y(2);
R_L = -k_1.*C_L;
dy = zeros(2,1);
dy(1) = dC_Ldx;
dy(2) = (-R_L/D_ij);
end
function res = twobc(ya,yb)
res = [ ya(1)-(L0); yb(2) ];
end
end
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Numerical Integration and Differential Equations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!