Skip to content
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

Check for custom quadrature for each integral, not each form #622

Merged
merged 4 commits into from
Nov 6, 2023

Conversation

mscroggs
Copy link
Member

@mscroggs mscroggs commented Oct 13, 2023

@coveralls
Copy link

coveralls commented Oct 13, 2023

Coverage Status

coverage: 79.732%. remained the same when pulling 2851b57 on mscroggs/dolfinx-2664 into d5a68e6 on main.

@mscroggs mscroggs requested a review from jorgensd October 13, 2023 11:21
Copy link
Member

@jorgensd jorgensd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR does currently not work with the main branch, mwe:

import dolfinx as df
import ufl
import numpy as np
import mpi4py
import basix.ufl

msh = df.mesh.create_unit_square(mpi4py.MPI.COMM_WORLD, 10, 10)

CG2_vect = df.fem.functionspace(msh, ("Lagrange", 1))
Qe = basix.ufl.quadrature_element(msh.topology.cell_name(), value_shape=(), scheme="default", degree=1)
Quad = df.fem.functionspace(msh, Qe)


u = df.fem.Function(Quad)
v = ufl.TrialFunction(CG2_vect)

dx_m = ufl.Measure("dx",domain=msh, metadata={"quadrature_degree": 1, "quadrature_scheme": "default"}) 
ds = ufl.Measure("ds", domain=msh)

residual = u * v * dx_m
vol = df.fem.form(residual)
residual = v * ds
surf = df.fem.form(residual)


residual = u * v * dx_m + v * ds
vol_surf = df.fem.form(residual)

vol_v = df.fem.assemble_vector(vol)
sur_v = df.fem.assemble_vector(surf)

vol_surf = df.fem.assemble_vector(vol_surf)

assert np.allclose(vol_v.x.array+sur_v.x.array, vol_surf.x.array)

Same error as in FEniCS/dolfinx#2664

@mscroggs
Copy link
Member Author

mscroggs commented Nov 6, 2023

This PR does currently not work with the main branch, mwe:

import dolfinx as df
import ufl
import numpy as np
import mpi4py
import basix.ufl

msh = df.mesh.create_unit_square(mpi4py.MPI.COMM_WORLD, 10, 10)

CG2_vect = df.fem.functionspace(msh, ("Lagrange", 1))
Qe = basix.ufl.quadrature_element(msh.topology.cell_name(), value_shape=(), scheme="default", degree=1)
Quad = df.fem.functionspace(msh, Qe)


u = df.fem.Function(Quad)
v = ufl.TrialFunction(CG2_vect)

dx_m = ufl.Measure("dx",domain=msh, metadata={"quadrature_degree": 1, "quadrature_scheme": "default"}) 
ds = ufl.Measure("ds", domain=msh)

residual = u * v * dx_m
vol = df.fem.form(residual)
residual = v * ds
surf = df.fem.form(residual)


residual = u * v * dx_m + v * ds
vol_surf = df.fem.form(residual)

vol_v = df.fem.assemble_vector(vol)
sur_v = df.fem.assemble_vector(surf)

vol_surf = df.fem.assemble_vector(vol_surf)

assert np.allclose(vol_v.x.array+sur_v.x.array, vol_surf.x.array)

Same error as in FEniCS/dolfinx#2664

I've added this code to dolfinx as a test in FEniCS/dolfinx#2870. That test should now pass with FEniCS/basix#733 and this PR

@mscroggs mscroggs requested a review from jorgensd November 6, 2023 11:31
@mscroggs mscroggs enabled auto-merge November 6, 2023 11:40
@mscroggs mscroggs added this pull request to the merge queue Nov 6, 2023
Merged via the queue into main with commit 66a53ac Nov 6, 2023
@mscroggs mscroggs deleted the mscroggs/dolfinx-2664 branch November 6, 2023 11:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants