SubDomain
- class devito.types.SubDomain(*args, **kwargs)[source]
Bases:
AbstractSubDomainBase class to define Grid subdomains.
To create a new SubDomain, all one needs to do is overriding
define(). This method takes as input a set of Dimensions and produce a mapperM : Dimensions -> {d, ('left', N), ('middle', N, M), ('right', N)}so that:
If
M(d) = d, then the SubDomain spans the entire Dimensiond.If
M(d) = ('left', N), then the SubDomain spans a contiguous region ofNpoints starting atd’s left extreme.M(d) = ('right', N)is analogous to the case above.If
M(d) = ('middle', N, M), then the SubDomain spans a contiguous region ofd_size - (N + M)points starting atNand finishing atd_sizeM - M.
Examples
An “Inner” SubDomain, which spans the entire domain except for an exterior boundary region of
thickness=3, can be implemented as follows>>> from devito import SubDomain >>> class Inner(SubDomain): ... name = 'inner' ... def define(self, dimensions): ... return {d: ('middle', 3, 3) for d in dimensions}
Like before, but now spanning the entire
yDimension of a three-dimensional grid>>> class InnerY(SubDomain): ... name = 'inner_y' ... def define(self, dimensions): ... x, y, z = dimensions ... return {x: ('middle', 3, 3), y: y, z: ('middle', 3, 3)}
See also
DomainAn example of preset SubDomain.
InteriorAn example of preset Subdomain.