大家好,最近在学习着用MATLAB处理传质问题,但在边界条件的处理中遇到一些问题,想问问大家。所要讨论的模型如下:
∂C/∂t+F ∂q/∂t+u ∂C/∂z=D (∂^2 C)/(∂z^2 )
其中:F、u、D 是常数;q=f(C)
初始条件:C ( z,t = 0)= 0
边界条件:C ( z=0, t) =C0 , 0<=t<=tp
C ( z = 0, t)= 0, tp
我目前用的代码是这样的
m = 0;
x = linspace(0,1,20);
t = linspace(0,20,80);
sol = pdepe(m,@pdex1pde,@pdex1ic,@pdex1bc,x,t);
% Extract the first solution component as u.
u = sol(:,:,1);
% A surface plot is often a good way to study a solution.
surf(x,t,u)
title('Numerical solution computed with 20 mesh points.')
xlabel('Distance x')
ylabel('Time t')
% A solution profile can also be illuminating.
figure
plot(t,u(:,1))
%--------------------------------------------------------
function [c,f,s] = pdex1pde(x,t,u,DuDx)
a0=1;
b0=0.3;
k0=1;
c0=30;
d0=0;
c=1;
f=-d0*DuDx;
s=-(a0/b0)*DuDx-((1-b0)/b0)*k0*(u-c0);
%--------------------------------------------------------
function [pl,ql,pr,qr] = pdex1bc(xl,ul,xr,ur,t)
pl=ul-((t-7)>=0)*100;
ql = 0;
pr = 0;
qr = 0.1;
%--------------------------------------------------------
function u0=pdex1ic(x)
u0=0;
%--------------------------------------------------------
但是模拟时出现了错误
Warning: Failure at t=7.000000e+000. Unable to meet integration tolerances without reducing the step size below the smallest value
allowed (1.421085e-014) at time t.
> In ode15s at 819
In pdepe at 320
Warning: Time integration has failed. Solution is available at requested time points up to t=6.835443e+000.
> In pdepe at 326
??? Error using ==> surf at 70
Data dimensions must agree.
请问该怎么解决,或有效的实现分段边界条件呢?谢谢