Adding a known velocity (convection) term to reaction diffusion equation using bvp4c
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur Ordinary Differential Equations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!