general_tests.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:PorousMediaLab 作者: biogeochemistry 项目源码 文件源码
def transport_equation_test(self):
        '''Check the transport equation integrator'''
        lab = create_lab()
        D = 40
        lab.add_species(True, 'O2', D, 0, bc_top=1, bc_top_type='dirichlet', bc_bot=0, bc_bot_type='neumann')
        lab.dcdt.O2 = '0'
        lab.solve()
        x = np.linspace(0, lab.length, lab.length / lab.dx + 1)
        sol = 1 / 2 * (special.erfc((x - lab.w * lab.tend) / 2 / np.sqrt(D * lab.tend)) + np.exp(
            lab.w * x / D) * special.erfc((x + lab.w * lab.tend) / 2 / np.sqrt(D * lab.tend)))

        assert max(lab.O2.concentration[:, -1] - sol) < 1e-4
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号