I’m encountering the warning “used dof inconsistency (silence this warning by setting BilinearForm(…check_unused=False) )” when I try to solve a Poisson problem in 3D on an H1 space with order greater than 1.
I manually define a mesh with two materials and set my H1 space to only integrate over one of the materials. I think this may be part of the the problem since integrating over the full mesh is fine. However, I’m not sure why I only encounter problems if the order of the H1 space is greater than 1.
I’ve attached a simplified version of the code I use to generate the mesh and the code I use to solve the Poisson problem.
I cannot reproduce your example, there seem to be some functions/files missing.
This warning is emitted if there are dofs in the space that are marked as used dofs but never used (safety for example for typos in definedons,…).
I’m not sure if they are emitted for lowest order dofs so it may be that that warning is never emitted if order=1.
If you only invert your matrix on the dofs that you defined the integrators on it is probably ok to ignore or silence the warning.
If you could change your example so that it is executable I can have a look at it.
Thanks for the quick reply. I’ve updated the code and attached a .txt file of the necessary numpy array so you should be able to run it.
My main issue is that the matrix I get when I get the warning is singular. I think this is due to the same thing causing the warning and I’m not correctly integrating over some of my dofs. But I’m not sure why that’s the case. (the matrix is not singular if order=1 and I don’t get the warning)
the problem is that the higher order degrees of freedom for the H1(…order=2) are not related to your nodes in the mesh. H1 uses a hierarchical basis, where the shape functions are related to mesh edges, faces and cells. Their dof-numbers are numbers after total number of mesh-points.
Every second of your points (in each directions) are not used for placing unknowns, thus the dof-inconsistency warning.
I recommend to import your griddata as a VoxelCoefficientFunction, and then interpolate it to a GridFunction via
We cannot form the gradient directly of a voxelcf (at least not a the moment), but you can use the gradient of the GridFunction you interpolated to.
VoxelCF can use (tri-)linear interpolation by now, but higher order interpolation could be added with little coding.
Thank you for the reply. If I understand you correctly, when I interpolate my array values from the VoxelCoefficient onto the GridFunction values are only assigned to degrees of freedom corresponding to mesh nodes, not any of the higher order degrees of freedom? Could you point me to how I could access the higher order degrees of freedom to assign values to them?
interpolating from VoxelCoefficient into a GridFunction also computes high order coefficients. We use element-wise L2-projection, with numerical integration.
But you don’t have to create mesh-points for the edge/face/cell-midepoints.
Here is as small example interpolating from VoxelCoefficient into a 3rd order FEM-space. The structured voxel-mesh and the finite element mesh is can be unrelated.