Skip to content

Commit

Permalink
tests: Add elastic 3D tests
Browse files Browse the repository at this point in the history
  • Loading branch information
georgebisbas committed Jun 24, 2024
1 parent 9d9067e commit adaad83
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
15 changes: 13 additions & 2 deletions tests/test_xdsl_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -1120,7 +1120,6 @@ def test_elastic_2D(self, shape, so, nt):
assert not np.isclose(xdsl_norm_tau2, 0.0, rtol=1e-04)
assert not np.isclose(xdsl_norm_tau3, 0.0, rtol=1e-04)


@pytest.mark.parametrize('shape', [(101, 101, 101), (201, 201, 201)])
@pytest.mark.parametrize('so', [2, 4, 8])
@pytest.mark.parametrize('nt', [10, 20, ])
Expand Down Expand Up @@ -1198,11 +1197,23 @@ def test_elastic_3D(self, shape, so, nt):
# TODO: Reinitialize the fields to zero
v[0].data[:] = 0
v[1].data[:] = 0
v[2].data[:] = 0

# (Pdb) tau
# Matrix([
# [ t_xx(t, x, y, z), t_xy(t, x + h_x/2, y + h_y/2, z), t_xz(t, x + h_x/2, y, z + h_z/2)],
# [t_xy(t, x + h_x/2, y + h_y/2, z), t_yy(t, x, y, z), t_yz(t, x, y + h_y/2, z + h_z/2)],
# [t_xz(t, x + h_x/2, y, z + h_z/2), t_yz(t, x, y + h_y/2, z + h_z/2), t_zz(t, x, y, z)]])

tau[0].data[:] = 0
tau[1].data[:] = 0
tau[2].data[:] = 0
tau[3].data[:] = 0
tau[4].data[:] = 0
tau[5].data[:] = 0
tau[6].data[:] = 0
tau[7].data[:] = 0
tau[8].data[:] = 0

# Inject sources. We use it to preinject data
op = Operator([u_v] + [u_t] + src_xx + src_yy + src_zz)
Expand Down Expand Up @@ -1230,4 +1241,4 @@ def test_elastic_3D(self, shape, so, nt):
assert not np.isclose(xdsl_norm_tau0, 0.0, rtol=1e-04)
assert not np.isclose(xdsl_norm_tau1, 0.0, rtol=1e-04)
assert not np.isclose(xdsl_norm_tau2, 0.0, rtol=1e-04)
assert not np.isclose(xdsl_norm_tau3, 0.0, rtol=1e-04)
assert not np.isclose(xdsl_norm_tau3, 0.0, rtol=1e-04)
2 changes: 1 addition & 1 deletion xdsl_examples/diffusion_2D_wBCs.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from devito import (Grid, TimeFunction, Eq, solve, Operator,
Constant, norm, configuration)
from examples.cfd import init_hat
from xdsl_examples.bench_utils import plot_2dfunc
# from xdsl_examples.bench_utils import plot_2dfunc


parser = argparse.ArgumentParser(description='Process arguments.')
Expand Down

0 comments on commit adaad83

Please sign in to comment.