-
Notifications
You must be signed in to change notification settings - Fork 245
Open
Description
I've been using SubDomainSet to create a border where the same boundary conditions are applied. However, when I add a receiver or, source, I get an error. Here's a simplified piece of code using the modified example for SubDomainSet with Receiver:
import numpy as np
from devito import Grid, Function, Eq, Operator, SubDomainSet, TimeFunction
from examples.seismic import Receiver
nx = 30
nz = nx
NBL_x = 4
NBL_z = 4
time_range = TimeAxis(start=0, stop=5, step=1)
class Border(SubDomainSet):
name = 'border'
A1 = np.array([0, nx - NBL_x, 0], dtype=np.int32)
A2 = np.array([nx-NBL_x, 0, 0], dtype=np.int32)
A3 = np.array([0, 0, nz - NBL_z], dtype=np.int32)
A4 = np.array([NBL_z, NBL_z, 0], dtype=np.int32)
B = Border(N=3, bounds=(A1, A2, A3, A4))
class Main(SubDomainSet):
name = 'main'
MA = Main(N=1, bounds=(NBL_x, NBL_x, 0, NBL_z))
grid = Grid(extent=(nx, nz), shape=(nx, nz), subdomains=(MA,B))
f = TimeFunction(name='f', grid=grid, space_order=so, time_order=1, dtype=np.int32)
eq = Eq(f.forward, f+1, subdomain=grid.subdomains['main'])
eq2 = Eq(f.forward, f+2, subdomain=grid.subdomains['border'])
receiver = Receiver(name='receiver', grid=grid, npoint=2, time_range=time_range, subdomains=(MA,B), d_size=4)
receiver.coordinates.data[:] = [[12,2], [18,2]]
receiver._arg_values()['d_size'] = 4
rec = receiver.interpolate(expr = f)
op = Operator([eq,eq2] + rec)
op.apply(dt=dt, time_M=5)
f.data
The error I get is:
InvalidArgument: Default `receiver(time, p_receiver)` is incompatible with other args as `d_size=2`, while `d_size=4` is expected. Perhaps you forgot to override `receiver(time, p_receiver)`?
Metadata
Metadata
Assignees
Labels
No labels