24小时热门版块排行榜    

查看: 862  |  回复: 0

补天士Sai

金虫 (正式写手)

[求助] 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<t

我目前用的代码是这样的
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.


请问该怎么解决,或有效的实现分段边界条件呢?谢谢
回复此楼
只要活着,哪里都是天堂!
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖

智能机器人

Robot (super robot)

我们都爱小木虫

找到一些相关的精华帖子,希望有用哦~

科研从小木虫开始,人人为我,我为人人
相关版块跳转 我要订阅楼主 补天士Sai 的主题更新
最具人气热帖推荐 [查看全部] 作者 回/看 最后发表
[基金申请] 应该是93bebmhtak前后十一个字符比较关键 +17 Lanmanbaby 2026-08-09 29/1450 2026-08-12 00:24 by zhanghaozhu
[基金申请] 为什么网上很多人说本周 12号出结果 +6 瞬息宇宙 2026-08-10 7/350 2026-08-11 19:25 by Tide man
[硕博家园] 读博的好处 +3 lnee 2026-08-11 3/150 2026-08-11 18:10 by 希望我好好的
[基金申请] 分享一下我之前已中青C的计划书的filecode +3 布布和一二 2026-08-11 4/200 2026-08-11 15:20 by aasahr
[基金申请] 听说今天filecode变了 +26 布布和一二 2026-08-06 49/2450 2026-08-11 13:18 by WH3796
[基金申请] FileCode能看出啥? +7 要乐观耀哥 2026-08-10 17/850 2026-08-11 10:50 by 要乐观耀哥
[基金申请] filecode +9 documentary 2026-08-10 9/450 2026-08-11 10:08 by wk7465
[基金申请] 基金中了 +15 laoda193707 2026-08-06 15/750 2026-08-11 00:11 by jiafei2190
[基金申请] 确定了,国自然21号放榜 +6 布布和一二 2026-08-10 7/350 2026-08-10 19:15 by 2000zf36392
[基金申请] 关于代码变化问题,想知道的进来 +17 且听虎啸 2026-08-07 24/1200 2026-08-10 18:35 by zhangduo2008
[基金申请] 静等基金结果 +5 gjjjzhong 2026-08-10 16/800 2026-08-10 17:19 by Tide man
[基金申请] 关于Filecode分析方法 +3 majunge000 2026-08-10 3/150 2026-08-10 15:46 by lch2012
[基金申请] 国自然结果 +4 Vierhys 2026-08-10 8/400 2026-08-10 15:06 by Vierhys
[基金申请] 据悉今年马上要出结果了 +7 瞬息宇宙 2026-08-10 8/400 2026-08-10 12:42 by Vivilian
[基金申请] 2026国自然放榜时间 +9 布布和一二 2026-08-08 9/450 2026-08-10 11:22 by xxxx2020
[基金申请] 面上项目filecode邪修 +5 西山十月 2026-08-09 7/350 2026-08-10 07:32 by 仁砚薪传
[基金申请] 关于filecode,很负责任的告诉大家 +6 爱看书的可乐 2026-08-08 7/350 2026-08-08 22:13 by a_niu
[基金申请] 国基金的申报应该改成非等额制,评价高的钱多评价低的钱少,但是增加资助率 +7 a089 2026-08-07 7/350 2026-08-08 18:05 by gltch
[基金申请] filecode +14 等待解的谜 2026-08-06 19/950 2026-08-07 12:20 by wlwhappy
[基金申请] 影响面上的因素 +8 布布和一二 2026-08-05 11/550 2026-08-06 10:41 by 宝贝虫子
信息提示
请填处理意见