You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 1dcae14
Browse filesBrowse the repository at this point in the historyBrowse files
api: Add Derivative halo=0 for SubDomain-restricted derivatives and adjoints
`expr.dx(halo=0)` treats `expr` as zero outside the SubDomain of its
equation, and `.T` keeps the flag. Hence `Inc(q_bar, out_bar.dx(halo=0).T,
subdomain=S)` is the adjoint of `Eq(out, q.dx, subdomain=S)`, i.e. D^T R^T with
R the restriction to S, without a user-side zero-padded work field. Equations
without halo=0 derivatives, or without a SubDomain, are evaluated as before.
- An equation with halo=0 derivatives evaluates its rhs with
`_eval_at(lhs, subdomain=S)`. The halo=0 derivatives record S, and multiply
each stencil tap by a SubDomainIndicator (SubDomain.indicator) of the grid
point it reads: 1 inside S, 0 outside, recording the stencil radius
(IndexSet.radius). The other terms of a sum are restricted to S at the
evaluation point (SubDomain.restrict); factors are not.
- The equation then iterates over S grown by the largest radius
(SubDomain.grow, a SubDomain with a parent), and expands the indicators into
branch-free integer MIN/MAX, which invariant hoisting computes once.
- It works for expanded, unexpanded and staggered derivatives. Derivatives of
halo=0 derivatives, MultiSubDomains and methods other than FD raise
NotImplementedError.
Tests: dot tests of `Eq(out, g.dx, subdomain=S)` against
`Inc(g_bar, out_bar.dx(halo=0).T, subdomain=S)` for left/right/middle
SubDomains, first and second derivatives, orders 2/4/8, Eq and Inc, 2D and
unexpanded forms, in 1D and 3D; staggered dot tests against
`-out_bar.dx(halo=0)`, as in elastic adjoints; sums and factors; SubDomain
growth; a forward check; and a one-face CPML operator.
0 commit comments