def test_acoustic2d_create_matrices():
fld = fds.Acoustic2D(t_delta=1, t_samples=1,
x_delta=1, x_samples=2,
y_delta=1, y_samples=2,
material=fds.AcousticMaterial(700, 0.01, bulk_viscosity=1))
fld.create_matrices()
assert np.allclose(fld.a_p_vx.toarray(), [[-4900, 4900, 0, 0], [0, -4900, 4900, 0],
[0, 0, -4900, 4900], [0, 0, 0, -4900]])
assert np.allclose(fld.a_p_vy.toarray(), [[-4900, 0, 4900, 0], [0, -4900, 0, 4900],
[0, 0, -4900, 0], [0, 0, 0, -4900]])
assert np.allclose(fld.a_vx_p.toarray(), [[100, 0, 0, 0], [-100, 100, 0, 0], [0, -100, 100, 0],
[0, 0, -100, 100]])
assert np.allclose(fld.a_vy_p.toarray(), [[100, 0, 0, 0], [0, 100, 0, 0], [-100, 0, 100, 0],
[0, -100, 0, 100]])
assert np.allclose(fld.a_vx_vx.toarray(), [[-400, 100, 100, 0], [100, -400, 100, 100],
[100, 100, -400, 100], [0, 100, 100, -400]])
assert np.allclose(fld.a_vy_vy.toarray(), [[-400, 100, 100, 0], [100, -400, 100, 100],
[100, 100, -400, 100], [0, 100, 100, -400]])
评论列表
文章目录