Skip to content
Snippets Groups Projects

Draft: Add integration of fenix-basix finite-element library

Open Simon Praetorius requested to merge feature/basix into master

Add wrapper around the finite-element definition and tabulation library Basix: https://docs.fenicsproject.org/basix/v0.8.0/index.html

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • @simon.praetorius thanks for doing this - I was starting to look into this as well but you beat me by a mile.

    Edited by Andreas Dedner
  • Andreas Dedner resolved all threads

    resolved all threads

  • added 4 commits

    Compare with previous version

  • added 1 commit

    • 508c99ea - Directly extract the data table into the output vectors

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • added 2 commits

    • e9f88ad8 - Cleanup documentation
    • 4e584492 - Print the reference element for basix

    Compare with previous version

  • added 1 commit

    • 532d2ee2 - Add entity numbering for basix reference elements

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • added 1 commit

    • d2cbec68 - Make basix local and global finite element constructible from pointer to basix object

    Compare with previous version

  • added 1 commit

    • 89e097a4 - Fix the cellType vs GeometryType mappings

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • mentioned in merge request staging/dune-functions!483

  • The basix library uses std::span and std::mdspan for passing and returning argument to their functions. This is very nice, since very flexible. In our interface of the local basis, we pass the output parameters as std::vector<FieldVector<...>>& out or std::vector<FieldMatrix<...>>& out. What we need is a memory block that can be referenced using a data-handle (e.g. a pointer) to the begin, and a shape (e.g. the row/column sizes of the whole container). Is it allowed to use &out[0][0] (and &out[0][0][0]) for the data-handle and {out.size(), dimRange} (and {out.size(), dimRange, dimDomain}) for the shape, or would this be undefined behavior?

  • 21 case basix::cell::type::point: return GeometryTypes::vertex;
    22 case basix::cell::type::interval: return GeometryTypes::line;
    23 case basix::cell::type::triangle: return GeometryTypes::triangle;
    24 case basix::cell::type::tetrahedron: return GeometryTypes::tetrahedron;
    25 case basix::cell::type::quadrilateral: return GeometryTypes::quadrilateral;
    26 case basix::cell::type::hexahedron: return GeometryTypes::hexahedron;
    27 case basix::cell::type::prism: return GeometryTypes::prism;
    28 case basix::cell::type::pyramid: return GeometryTypes::pyramid;
    29 default: return GeometryTypes::none(0);
    30 }
    31 }
    32
    33 // Map the Dune::GeometryType to cell::type from basix
    34 inline basix::cell::type cellType (GeometryType type)
    35 {
    36 if (type.isVertex())
    • While I have implemented here a local finite-element and a "global" finite-element, I mean by the latter a finite-element transformed to a real geometry. We have discussed in dune-functions that this abstraction does not fit well into dune-localfunctions. One often needs some global information from the grid.

    • Having another discussion about adding global fe would be nice. basixs has methods for this that do not really require too much global information as far as I could understand. Also there are different stages of global fe we could consider;

      • there is the pushforward/back which is really still quite local
      • there is the issue of reordering of basis functions or dofs (twist) or switching signs of dofs (e.g. RT) which are perhaps more problematic to integrate on a local level.

      Would it be possible to separate different parts in some way and move at least part of the globalization into dune-localfunctions? Of course the resulting object has to make sense in some way - but pushforward/back seems reasonable for example, i.e., a localfe in physical space object.

    • This would probably be a good topic for a developer meeting. Currently we try to sort things out in dune-functions and discuss what can be put into dune-localfunctions and what does not fit there well. There is no module for more global definitions of finite-elements.

      In the current implementation I have parametrized the global basis fe with a geometry. It can be bound to such a geometry and one can pass the permutation information in form of the cell_info encoding that basix is using. Unfortunately, I have not yet found a proper definition of this integer, only vague examples. One can look into the dolpinx implementation, though.

      The pull_back/push_forward of basis function values can be implemented with this information. The interface in basix for this is not very nice, though. Maybe an infrastructure for this in Dune is better suited. In dune-functions this is partially implemented.

      Interestingly, there is the interface description of global-valued finite-elements already in dune-localfunctions, but I have not found a place where this is used.

      Edited by Simon Praetorius
    • Please register or sign in to reply
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Please register or sign in to reply
    Loading