Forum Message

 

 

We have moved the forum to https://forum.ngsolve.org . This is an archived version of the topics until 05/05/23. All the topics were moved to the new forum and conversations can be continued there. This forum is just kept as legacy to not invalidate old links. If you want to continue a conversation just look for the topic in the new forum.

Notice

The forum is in read only mode.

Used DOF Inconsistency

More
3 years 11 months ago #2798 by elizabethmonte
Hello,

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.

Thanks.

File Attachment:

File Name: test.py
File Size:5 KB
Attachments:
More
3 years 10 months ago #2799 by christopher
Replied by christopher on topic Used DOF Inconsistency
Hi elizabeth,
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.
Best
Christopher
More
3 years 10 months ago #2800 by elizabethmonte
Hi Christopher,

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)

File Attachment:

File Name: test_2020-06-01-2.py
File Size:6 KB

File Attachment:

File Name: phi.txt
File Size:1,448 KB
More
3 years 10 months ago #2811 by joachim
Replied by joachim on topic Used DOF Inconsistency
Hi Elizabeth,

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
Code:
gf.Set(voxelcf)

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.

Best,
Joachim
The following user(s) said Thank You: elizabethmonte
More
3 years 10 months ago #2816 by elizabethmonte
Hi Joachim,

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?

Thanks.
More
3 years 10 months ago #2817 by joachim
Replied by joachim on topic Used DOF Inconsistency
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.

Joachim
Attachments:
The following user(s) said Thank You: elizabethmonte
Time to create page: 0.130 seconds