Spatial discretization has failed. Discretization supports only parabolic and elliptic equations, with flux term involving spatial derivative.
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Mohammadamin Mahmoudabadbozchelou
el 29 de Sept. de 2020
Comentada: Mohammadamin Mahmoudabadbozchelou
el 30 de Sept. de 2020
Hello. I have trouble sovling following system of equations. Coud anyone please help me in this regard?
Here is the system of equations (containing 1 PDE coupled with 1 ODE) I have in mind:
u1_t = ((-eta_s - eta_p * u2)/rho) * u1_xx
u2_t = -kn * u2 * u1_x + kp * (1 - u2)
The Boundry and Initial conditions are also as follow:
BC: u1(0,t) = 0 , u1(1,t) = 1
IC: u1(x,0) = 0 , u2(0) = 0
Here is the code I'm using:
global rho eta_s eta_p kp kn
rho = 1000;
eta_s = 5;
eta_p = 1;
kp = 0.1;
kn = 0.3;
x = [0 0.005 0.01 0.05 0.1 0.2 0.5 0.7 0.9 0.95 0.99 0.995 1];
t = [0 0.005 0.01 0.05 0.1 0.5 1 1.5 2];
m = 0;
sol = pdepe(m,@pdefun,@pdeic,@pdebc,x,t);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [c,f,s] = pdefun(x,t,u,dudx)
global rho eta_s eta_p kp kn
c = [1; 1];
f = [ -( ( eta_s + eta_p*u(2) ) / ( rho ) ) * dudx(1) ; -kn * u(2) * u(1) ];
s = [ 0 ; kp * ( 1 - u(2)) ];
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function u0 = pdeic(x)
u0 = [0; 1];
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [pl,ql,pr,qr] = pdebc(xl,ul,xr,ur,t)
pl = [ul(1)-0; 0];
ql = [0; 0];
pr = [ur(1)-1; 0];
qr = [0; 0];
end
0 comentarios
Respuesta aceptada
Bill Greene
el 30 de Sept. de 2020
Your boundary conditions for u2 (q=0, p=0 at each end) are not valid.
The second equation in your system (u2_t=...) is, in fact, a PDE, not an ODE because the RHS contains u1_x which is a function of x. So u2 must be a function of both t and x.
I believe that the second component of your flux, -kn * u(2) * u(1), is also incorrect and that the corresponding term from the second PDE should be included in s. Once you have made this fix, you can define BC on u2 at each end as q=1,p=0. Since f for this PDE will be zero, this BC does nothing but it does satisfy pdepe.
Más respuestas (0)
Ver también
Categorías
Más información sobre Boundary Conditions en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!