FEniCS / dolfinx

Next generation FEniCS problem solving environment
https://fenicsproject.org
GNU Lesser General Public License v3.0
731 stars 177 forks source link

Custom integrals in FEniCSx #33

Closed ataber closed 8 months ago

ataber commented 6 years ago

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?

garth-wells commented 6 years ago

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.

ataber commented 6 years ago

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?

jorgensd commented 2 years ago

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