devito icon indicating copy to clipboard operation
devito copied to clipboard

Symbolic coefficents with the term function.dxr generates an error

Open kmn319 opened this issue 3 years ago • 3 comments

The coefficient furthest to the right is not being replaced when using the right sided finite difference term 'Function'.dxr with symbolic coefficients. Hence the presence of the w symbol causing the error.

from devito import * import numpy as npextent = (10., 10.) shape = (11, 11)grid = Grid(extent=extent, shape=shape) f = Function(name='f', grid=grid, space_order=3, coefficients = 'symbolic') x, y = grid.dimensions weights = np.array([-0.6, 0.1, 0.6, 5]) u_x_coeffs = Coefficient(1, f, x, weights)coeffs = Substitutions(u_x_coeffs)f.data[:,:] = 1 eq = Eq(f, f.dxr, coefficients = coeffs) op = Operator([eq] ) op.apply() print(eq.evaluate)

kmn319 avatar Jan 08 '21 16:01 kmn319

Hi, thanks for the report. Could you write a short test reproducing this error?

some guidelines here

FabioLuporini avatar Jan 08 '21 21:01 FabioLuporini

ah, I think you have one on Slack, just paste that maybe?

FabioLuporini avatar Jan 08 '21 21:01 FabioLuporini

Thanks Fabio, sorry I didn't update the example earlier. I've added a test case for the error.

kmn319 avatar Jan 22 '21 12:01 kmn319