Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

source injection onto multiple time functions when source term has non-grid dimensions fails #2147

Closed
deckerla opened this issue Jun 15, 2023 · 0 comments · Fixed by #2128
Closed

Comments

@deckerla
Copy link
Contributor

import devito

nt = 10
nfreq = 2
g = devito.Grid(shape=(5,6))
u1 = devito.TimeFunction(name="u1", grid=g, time_order=0)
u2 = devito.TimeFunction(name="u2", grid=g, time_order=0)

stf = devito.SparseTimeFunction(name="stf", nt=nt, npoint=1, grid=g)
stf.data[:] = 1.
stf.coordinates_data[:] = 0.5
freq_dim = devito.DefaultDimension(name="freq_dim", default_value=nfreq)
f = devito.Function(name="f", dimensions=(freq_dim,), shape=(nfreq,), grid=g)
f.data[:] = 2.

inj_u1 = stf.inject(field=u1.forward, expr=stf*f)
inj_u2 = stf.inject(field=u2.forward, expr=stf*f)

op1 = devito.Operator([inj_u1], opt=("advanced", {"min-storage":True}), name="inj_u1")
print(op1.parameters)
op1.apply()

op2 = devito.Operator([inj_u2], opt=("advanced", {"min-storage":True}), name="inj_u2")
print(op2.parameters)
op2.apply()

op3 = devito.Operator([inj_u1, inj_u2], opt=("advanced", {"min-storage":True}), name="Failing")
print(op3.parameters)
op3.apply()

this results in:

cvx@cbox-lukedecker-ela2d:~/.julia/dev/JetPackDevitoPSD/test$ python mfe.py 
(f(freq_dim), stf(time, p_stf), stf_coords(p_stf, d), u1(t, x, y), x_M, x_m, y_M, y_m, freq_dim_M, freq_dim_m, h_x, h_y, o_x, o_y, p_stf_M, p_stf_m, time_M, time_m, nthreads_nonaffine, timers)
Operator `inj_u1` ran in 0.04 s
(f(freq_dim), stf(time, p_stf), stf_coords(p_stf, d), u2(t, x, y), x_M, x_m, y_M, y_m, freq_dim_M, freq_dim_m, h_x, h_y, o_x, o_y, p_stf_M, p_stf_m, time_M, time_m, nthreads_nonaffine, timers)
Operator `inj_u2` ran in 0.01 s
(f(freq_dim), stf(time, p_stf), stf_coords(p_stf, d), u1(t, x, y), u2(t, x, y), x_M, x_m, y_M, y_m, freq_dim_M, freq_dim_m, h_x, h_y, o_x, o_y, p_stf_M, p_stf_m, posx, posy, time_M, time_m, nthreads_nonaffine, timers)
Traceback (most recent call last):
  File "/home/cvx/.julia/dev/JetPackDevitoPSD/test/mfe.py", line 29, in <module>
    op3.apply(posx=0.5, posy=0.5)
  File "/home/cvx/.conda/envs/conda_jl/lib/python3.10/site-packages/devito/operator/operator.py", line 812, in apply
    args = self.arguments(**kwargs)
  File "/home/cvx/.conda/envs/conda_jl/lib/python3.10/site-packages/devito/operator/operator.py", line 653, in arguments
    args = self._prepare_arguments(**kwargs)
  File "/home/cvx/.conda/envs/conda_jl/lib/python3.10/site-packages/devito/operator/operator.py", line 604, in _prepare_arguments
    p._arg_check(args, self._dspace[p], am=self._access_modes.get(p))
AttributeError: 'Symbol' object has no attribute '_arg_check'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant