matlab解混合边界条件,matlab 解传质方程时出现的问题(分段边界条件)

大家好,最近在学习着用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.

请问该怎么解决,或有效的实现分段边界条件呢?谢谢

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值