-
-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom quadrature rules, runtime quadrature #243
Comments
I don't know if this is the correct place to discuss this but many applications could use quadrature rules using vertices as quadrature points e.g. the already implemented |
Can we use the same signature as the other integrals, and pack the points/weights as coefficients? |
@bleyerj Thanks for the comment. Yes, the right place. So any quadrature scheme "default"/"vertex"/... etc. which is implemented in FIAT for the specific cell should work out of the box. The work to implement new quadrature scheme into FIAT should be perpendicular. I agree it would be nice to have more pre-implemented in stock. I have started working in this concept, will make PRs very soon. @chrisrichardson I don't know if packing into coefficients array is best. I think we should add one |
I tried the custom integral with cutfem last year. I recall there being issues with basis derivative evaluation. |
Thank you Michal for bringing up this topic! For what is worth, I personally think the format
is intuitive when working with cutfem-style methods. Of course, one only wants these on some parts of the domain, so typically one would like to have
and something similar for I can't comment on appropriate signatures more than to say that for these methods that we call multimesh methods, we take in pairs of elements (as in DG) and custom quadrature. |
@michalhabera @mscroggs @chrisrichardson Hi, I would like to revive this discussion again because I am very interested in porting the CutFEM library to FEniCS-X in the coming months. In CutFEM and related methods, quadrature rules can vary from element to element and even within one element (multiple sub-triangles per element for integration). This means that hundreds or thousands of different quadrature rules are needed and therefore I think that a tabulate_tensor function does need to be generated for custom integral measures that can take in a quadrature rule at run-time in the assembly loop. A rough outline of the generated code would be void tabulate_tensor( double* restrict A, const double* restrict w,
const double* restrict c, const double* restrict coordinate_dofs,
const int* restrict entity_local_index,
const uint8_t* restrict quadrature_permutation,
const int* restrict num_quadrature_points,
const double* restrict quadrature_points,
const double* restrict quadrature_weights)
{
//Instead of pre-computing the values for shape functions and their derivatives
// they need to be computed here at the given quadrature points
...
// generate code here to obtain information on the element and number of derivatives
...
// Tabulate values of shape functions and their derivatives at given points
//TODO: expose basix functionality to C and include appropriate header files in generated files
basix_element_tabulate(deriv_order, quadrature_points,tab_data)
// FE* dimensions: [permutation][entities][points][dofs]
static double FE4_C0_D10[perm][entities][num_quadrature_points][ndofs];
//Copy over info from tab_data to FE*..
//Quadrature loop
for (int iq = 0; iq < num_quadrature_points; ++iq)
{
...
}
} In summary, the main extensions I see that are needed for this tabulate_tensor function for custom measures are to expose some of the basix functionality to tabulate basis values and basis derivative values to the generated C-code and to replace the pre-computation step in the tabulate_tensor code generation with the generation of code for the computation of the basis values with basix function calls as outlined above. |
There are few code paths for runtime quadrature. Unfortunately, this is identified with a custom UFL measure, while I think it should be just stored in measure's metadata.
One example interface for custom and runtime quadrature could be
FFCx signature for runtime quadrature (custom integral type) needs updating.
The text was updated successfully, but these errors were encountered: