dolfinx icon indicating copy to clipboard operation
dolfinx copied to clipboard

Custom integrals in FEniCSx

Open ataber opened this issue 7 years ago • 3 comments

How will custom integrals be implemented? I imagine there's a lot of coordination required with this issue.

When I say "custom integrals" I mean: quadrature rules that are computed at solver runtime on a per-cell basis. This encompasses cut-cell, multimesh, and user-supplied per-cell rules. Hopefully there's a solution that can work with all these cases.

Maybe it looks like a map from cells to quadrature rules that can be supplied either by a function that runs at assembly-time, or by the user in the python interface?

ataber avatar Apr 20 '18 17:04 ataber

I'm thinking along the lines of a common signature for tabulate_tensor as suggested in #15 - an interface that takes an array of quadrature points on the reference element.

We could make it possible to attach a 'quadrature' function to a form - this would give a lot of freedom in picking quadrature points. We want to focus on passing functions because it maps well onto using JIT tools like Numba, cffi, pyopnencl, etc.

garth-wells avatar Apr 20 '18 19:04 garth-wells

I think a callback interface, as you suggest, would be great. How would that work? Would such a 'quadrature' function have access to data living in Python, or would it work with data supplied to it in the assembly process? Maybe both?

For instance would the interface be like

def generate_quadrature_rule(element):
  ....

L = u*dc(quadrature_rule=generate_quadrature_rule)

or would it be more like a C++ function defined at compile time that would be called during assembly?

ataber avatar Apr 20 '18 21:04 ataber

I guess this question should be revisited now, as we currently have basix that can tabulate at runtime. @mscroggs, @garth-wells any ideas?

jorgensd avatar Jun 07 '22 08:06 jorgensd