标签:
杂谈 |
分类: 牛刀小试 |
【来源:hhttp://nbviewer.ipython.org/github/barbagroup/CFDPython/blob/master/lessons/04_Step_3.ipynb】
与对流方程不同,扩散方程是2阶的偏微分方程。一维扩散方程可用下面的方程进行描述:
![[系列]Python计算CFD问题<4>:一维扩散方程](http://simg.sinajs.cn/blog7style/images/common/sg_trans.gif)
该方程可以离散为:
![[系列]Python计算CFD问题<4>:一维扩散方程](http://simg.sinajs.cn/blog7style/images/common/sg_trans.gif)
写成迭代的形式为:
![[系列]Python计算CFD问题<4>:一维扩散方程](http://simg.sinajs.cn/blog7style/images/common/sg_trans.gif)
采用与前例相同的初始条件,及0.5<=x<=1时,u=1,其他位置u=2。扩散系数mu=0.3。
程序代码为:
![[系列]Python计算CFD问题<4>:一维扩散方程](http://simg.sinajs.cn/blog7style/images/common/sg_trans.gif)
利用函数diffision可查看各时刻速度分布(时间步数分别为0、50、100、150、200、250)。
![[系列]Python计算CFD问题<4>:一维扩散方程](http://simg.sinajs.cn/blog7style/images/common/sg_trans.gif)
![[系列]Python计算CFD问题<4>:一维扩散方程](http://simg.sinajs.cn/blog7style/images/common/sg_trans.gif)
![[系列]Python计算CFD问题<4>:一维扩散方程](http://simg.sinajs.cn/blog7style/images/common/sg_trans.gif)
![[系列]Python计算CFD问题<4>:一维扩散方程](http://simg.sinajs.cn/blog7style/images/common/sg_trans.gif)
![[系列]Python计算CFD问题<4>:一维扩散方程](http://simg.sinajs.cn/blog7style/images/common/sg_trans.gif)
![[系列]Python计算CFD问题<4>:一维扩散方程](http://simg.sinajs.cn/blog7style/images/common/sg_trans.gif)
放到一起看起来可能更直观一些:

加载中…