test_utils.py 文件源码

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

项目:opensbli 作者: opensbli 项目源码 文件源码
def test_get_derivatives(navier_stokes_problem, grid):
    """ Ensure that spatial and temporal Derivative objects are identified and returned correctly. """

    expanded_equations = navier_stokes_problem.get_expanded(navier_stokes_problem.equations)
    expanded_formulas = navier_stokes_problem.get_expanded(navier_stokes_problem.formulas)

    spatial_derivatives, temporal_derivatives = get_derivatives(flatten(expanded_equations))

    assert str(spatial_derivatives) == "[Derivative(rhou0[x0, x1, t], x0), Derivative(rhou1[x0, x1, t], x1), Derivative(rhou0[x0, x1, t]*u1[x0, x1, t], x1), Derivative(p[x0, x1, t] + rhou0[x0, x1, t]*u0[x0, x1, t], x0), Derivative(u1[x0, x1, t], x0, x1), Derivative(u0[x0, x1, t], x0, x0), Derivative(u0[x0, x1, t], x1, x1), Derivative(rhou1[x0, x1, t]*u0[x0, x1, t], x0), Derivative(p[x0, x1, t] + rhou1[x0, x1, t]*u1[x0, x1, t], x1), Derivative(u0[x0, x1, t], x0, x1), Derivative(u1[x0, x1, t], x1, x1), Derivative(u1[x0, x1, t], x0, x0), Derivative((p[x0, x1, t] + rhoE[x0, x1, t])*u0[x0, x1, t], x0), Derivative((p[x0, x1, t] + rhoE[x0, x1, t])*u1[x0, x1, t], x1), Derivative(u0[x0, x1, t], x0), Derivative(u1[x0, x1, t], x1), Derivative(u0[x0, x1, t], x1), Derivative(u1[x0, x1, t], x0), Derivative(T[x0, x1, t], x0, x0), Derivative(T[x0, x1, t], x1, x1)]"

    assert str(temporal_derivatives) == "[Derivative(rho[x0, x1, t], t), Derivative(rhou0[x0, x1, t], t), Derivative(rhou1[x0, x1, t], t), Derivative(rhoE[x0, x1, t], t)]"

    return
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号