For the numerical integration of reaction terms in my PDE on a 2D triangular mesh, I would like to use the scheme $$ \int_T \Phi(x) \approx \frac{|T|}{3} (\Phi(x_0) + \Phi(x_1) + \Phi(x_2)) $$ where the $x_i$ are the triangle nodes.

How to specify this when assembleing the system?


Actually you don't specify quadrature rule to assembler but to form compiler. You can tweak ffc/quadrature_schemes.py for your needs or you can adjust generated code. In both cases you just supply your quadrature points and weights.

  • $\begingroup$ Luckily, assemble() has an form_compiler_parameters argument. $\endgroup$ – Nico Schlömer May 17 '13 at 13:25
  • $\begingroup$ @Nico: Yes, but FFC seems to accept only default and canonical which is a scheme supplied by FIAT. $\endgroup$ – Jan Blechta May 17 '13 at 13:28
  • $\begingroup$ Indeed, quadrature_schemes.py doesn't seem to permit custom schemes. $\endgroup$ – Nico Schlömer May 17 '13 at 13:55

You can adjust the quadrature degree by setting

parameters["form_compiler_parameters"]["quadrature_degree"] = q

This will change the quadrature degree such that polynomials of degree q are integrated exactly.

FEniCS will try to autodetect the necessary quadrature degree so this should normally not be needed. However, in some cases you might want to underintegrate by setting a lower value of q.

  • $\begingroup$ I skimmed through FFC/ffc/quadrature_schemes.py to see what schemes are used for the particular degrees, but the "lumping" scheme that I'd like to use is not implemented. $\endgroup$ – Nico Schlömer May 17 '13 at 13:54

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.