I am trying to change the default ordering of degrees of freedom in each individual element to align with an external numbering scheme that I imposed (in a custom assembly function).
However, I did not find a matching function to impose the ordering for the UFL finite element type, which I then use to create a function space on a mesh with dolfinx.fem.functionspace.
Is there some neat way to impose a custom ordering, because I could not find a dedicated function? Or should I just change the underlying element after the function space has been created?
If you create your element using the function basix.ufl.custom_element it will be a Basix custom element directly wrapped as a UFL element which you can then pass into dolfinx.fem.functionspace.
Let me know if you have any issues using this,
Matthew
When stepping thorugh with my debugger, I still find that the UFL element has an incorrect DOF ordering. I realized that just switching the underlying basix element (inside of the UFL element) is not enough, I have to change some other stuff too.
Thank you very much and sorry if I missed something!
No problem, thank you!
However, I do not understand how to use this function to permute the local DOFs.
If it is not too much to ask, could you please give me an example of how to create a UFL element with permuted local DOFs, because I really cannot grasp how to do it on my own. In the code above, I managed to do it on the Basix side, but I do not know how to transfer it to UFL.
Thank you very much, that indeed solves the problem!
The solution however raised a new question for me - how can I create a vector element this way? This functionality already exists in basix.ufl.element, so adding the ordering input will fix this in the future, but I am not sure how to do it in the context of version 0.7.0 that I am using right now.
Thank you in advance for any suggestions in this regard
Thank you very much, that indeed constructs the correct element
I encountered one final hurdle. I want to space which adheres to custom ordering so I pass the blocked element to the function dolfinx.fem.functionspace (version 0.7.3) and it seems to “forget” the custom ordering. By this I mean that the underlying element.basix_element has an empty dof_ordering field. The ordering is the same as if I had built the space with a “regular” element. Is this expected behaviour? If yes, can it be circumvented?
Thank you in advance!
P.S. Sorry if this thread turned out to be very long, I just wanted to clear a bunch of permutation steps that are in various places throughout the code I am working on… I am still quite new to FEniCS, so any help means a lot.