-
-
Notifications
You must be signed in to change notification settings - Fork 194
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
[BUG]: Assembling sum of quadrature form on volume and CG form on surface #2664
Comments
This is indeed a bug, caused by the lines: https://github.com/FEniCS/ffcx/blob/main/ffcx/analysis.py#L174-L183 This would require some refactoring of the code (the analysis data), @mscroggs any idea for a quick fix? |
Could we change this code so that it simply verifies that the measure quadrature rule is the same as any quadrature element used within the integral, and if not, throw an error? |
I dont think that is a good solution, as the form presented by @SuperFranck seems valid to me. |
You are right! This is not a fix. But that wasn't quite my point (which I did not put across well). The current code is trying to be 'too clever' by reconciling integration rules in QuadratureElements with rules in the measure. I would redesign the code to simply assert that there is a good match, then the logic here can be much simpler. It is the user who should write the correct equations, after all. |
Dear community, I can suggest you a temporary solution of this issue. Actually, if you use variables from vectoral quadrature space only in your forms, your code will work correctly. In order to deal with scalars I suggest following modifications to the minimal example of the issues described above. Q2e = ufl.VectorElement("Quadrature", msh.ufl_cell(), degree=1, dim=2, quad_scheme='default')
Quad2 = df.fem.FunctionSpace(msh, Q2e)
u2 = df.fem.Function(Quad2)
new_u = u2[0]
new_u_values = u2.x.array.reshape((-1, 2))[:,0] # For data update
residual = new_u * v * dx_m - v * ds
df.fem.form(residual) P.S. Tested for fenicsx-0.7.0. Cheers! |
I'm hoping this may be fixed by FEniCS/ffcx#622 (I can at least run the minimal example without a failure now) |
How to reproduce the bug
Hi everyone,
This code aims to highlights a bug (in my humble opinion) in fenicsx-0.6.0.
We use quadrature and CG elements.
We write an equation mixing these elements.
When trying to form this equation, an error appears. However, using fenicsx-0.5.1 there is no problem.
Note also that the way we write the equation have an impact on whether it works.
We propose three writings that work fine, and one other causing trouble.
Error message is not short, but I hope it may help you
Minimal Example (Python)
Output (Python)
Version
0.6.0
DOLFINx git commit
No response
Installation
I used an environment file and run
conda env create --file fenicsx-0.6.0.yml
Additional information
No response
The text was updated successfully, but these errors were encountered: