Skip to content

Commit 289676d

Browse files
committed
tests: Start work on diffusion-like test
1 parent 35dfdae commit 289676d

1 file changed

Lines changed: 26 additions & 16 deletions

File tree

tests/test_specialization.py

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,6 @@
99
ConditionalDimension, switchconfig)
1010
from devito.ir.iet.visitors import Specializer
1111

12-
# Test that specializer replaces symbols as expected
13-
14-
# Create a couple of arbitrary operators
15-
# Reference bounds, subdomains, spacings, constants, conditionaldimensions with symbolic
16-
# factor
17-
# Create a couple of different substitution sets
18-
19-
# Check that all the instances in the kernel are replaced
20-
# Check that all the instances in the parameters are removed
21-
22-
# Check that sanity check catches attempts to specialize non-scalar types
23-
# Check that trying to specialize symbols not in the Operator parameters results
24-
# in an error being thrown
25-
26-
# Check that sizes and strides get specialized when using `linearize=True`
27-
2812

2913
class TestSpecializer:
3014
"""Tests for the Specializer transformer"""
@@ -240,3 +224,29 @@ def test_basic(self, caplog, override):
240224
@pytest.mark.parametrize('override', [False, True])
241225
def test_basic_mpi(self, caplog, mode, override):
242226
self.test_basic(caplog, override)
227+
228+
def test_diffusion_like(self):
229+
grid = Grid(shape=(11, 11))
230+
231+
dt = 2.5e-5
232+
233+
f = TimeFunction(name='f', grid=grid, space_order=4)
234+
f.data[:, 4:-4, 4:-4] = 1
235+
236+
op = Operator(Eq(f.forward, f - grid.time_dim.spacing*f.laplace))
237+
238+
op.apply(t_M=100, dt=dt)
239+
240+
check = np.array(f.data[0])
241+
f.data[:] = 0
242+
f.data[:, 4:-4, 4:-4] = 1
243+
244+
op.apply(t_M=100, dt=dt, specialize=tuple())
245+
246+
print(f.data[0])
247+
print(check)
248+
assert False
249+
250+
# Diffusion-like test
251+
# Acoustic-like test (with and without source injection)
252+
# Elastic-like test (with and without source injection)

0 commit comments

Comments
 (0)