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!