A double negative is injected into the ccode. It works fine without subdomain=sub2
MFE:
Lx = 1.
Ly = Lx
# Number of grid points in each direction
nx = 11
ny = 11
# mesh spacing
dx = Lx/(nx-1)
dy = Ly/(ny-1)
class UUpdate(SubDomain):
name = 'uupdate'
def define(self, dimensions):
x, y = dimensions
return {x: ('middle', 1, 1), y: ('middle', 1, 0)}
grid = Grid(
shape=(nx, ny), extent=(Lx, Ly), dtype=np.float64
)
sub2 = UUpdate(grid=grid)
time = grid.time_dim
t = grid.stepping_dim
x, y = grid.dimensions
# time stepping parameters
dt = 1e-3
t_end = 1.
ns = int(t_end/dt)
u = TimeFunction(name='u', grid=grid, space_order=2, dtype=np.float64)
eq_u = Eq(u.forward, -(u**2).dxc, subdomain=sub2)
op = Operator(eq_u)
op.apply(time_m=0, time_M=ns-1, dt=dt)
Traceback:
/tmp/devito-jitcache-uid1562842/89a605ee883e6c31458cc956438008d794588835.c:47:31: error: lvalue required as decrement operand
47 | u[t1][x + 2][y + 2] = --5.0e-1*r0*u[t0][x + 1][y + 2]*u[t0][x + 1][y + 2] - 5.0e-1*r0*u[t0][x + 3][y + 2]*u[t0][x + 3][y + 2];
| ^~
FAILED compiler invocation: gcc -march=native -O3 -g -fPIC -Wall -std=c99 -Wno-unused-result -Wno-unused-variable -Wno-unused-but-set-variable -ffast-math -shared -fopenmp /tmp/devito-jitcache-uid1562842/89a605ee883e6c31458cc956438008d794588835.c -lm -o /tmp/devito-jitcache-uid1562842/89a605ee883e6c31458cc956438008d794588835.so
Traceback (most recent call last):
File "/home/zl5621/devito_original/devito/examples/petsc/cfd/mfe.py", line 47, in <module>
op.apply(time_m=0, time_M=ns-1, dt=dt)
File "/home/zl5621/devito_original/devito/devito/operator/operator.py", line 934, in apply
cfunction = self.cfunction
^^^^^^^^^^^^^^
File "/home/zl5621/devito_original/devito/devito/operator/operator.py", line 821, in cfunction
self._jit_compile()
File "/home/zl5621/devito_original/devito/devito/operator/operator.py", line 807, in _jit_compile
recompiled, src_file = self._compiler.jit_compile(self._soname, str(self))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/zl5621/devito_original/devito/devito/arch/compiler.py", line 390, in jit_compile
_, _, _, recompiled = compile_from_string(self, target, code, src_file,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/zl5621/anaconda3/envs/devitoupstream/lib/python3.12/site-packages/codepy/jit.py", line 439, in compile_from_string
toolchain.build_extension(ext_file, source_paths, debug=debug)
File "/home/zl5621/anaconda3/envs/devitoupstream/lib/python3.12/site-packages/codepy/toolchain.py", line 211, in build_extension
raise CompileError("module compilation failed")
codepy.CompileError: module compilation failed
A double negative is injected into the ccode. It works fine without
subdomain=sub2MFE:
Traceback: