question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Better support for high-order meshes

See original GitHub issue

This is just random ideas and possible future directions regarding high-order meshes. We have ex31.py for quadratic meshes but it’s a bit convoluted because you go back and forth between InteriorBasis and Mesh.

I was reading https://mfem.org/mesh-format-v1.x/ and experimented with similar ideas in scikit-fem. I created a new module with classes Topology, Dofnum (extracted from InteriorBasis._build_dofnum) and Geometry.

Then you describe the traditional triangular mesh as follows:

>>> from skfem import *
>>> from topology import *
>>> m = MeshTri()
>>> t = m.t
>>> p = m.p
>>> topo = Topology(t)
>>> dofnum = Dofnum(topo, ElementTriP1())
>>> geom = Geometry(p, dofnum)
>>> geom.p
array([[0., 1., 0., 1.],
       [0., 0., 1., 1.]])
>>> geom.t
array([[0, 1],
       [1, 2],
       [2, 3]])

This Geometry is approximately API compatible with traditional skfem.Mesh so you can build a MappingIsoparametric and, using that, an InteriorBasis:

>>> mapping = MappingIsoparametric(geom, ElementTriP1())
>>> basis = InteriorBasis(m, ElementTriP2(), mapping)

Eventually I’d abstract out the mapping step so that geom is directly compatible with InteriorBasis constructor and returns the correct mapping via geom.mapping().

Anyhow, now a quadratic mesh would be described simply as follows:

>>> dofnum = Dofnum(topo, ElementTriP2())
>>> geom = Geometry(array([[0. , 1. , 0. , 1. , 0.5, 0. , 0.5, 1. , 0.5],
...        [0. , 0. , 1. , 1. , 0. , 0.5, 0.5, 0.5, 1. ]]), dofnum)
>>> mapping = MappingIsoparametric(geom, ElementTriP2())
>>> basis = InteriorBasis(m, ElementTriP2(), mapping)

Pretty cool? Obviously all this should be invisible to the user but I wonder if this warrants a rewrite of skfem.mesh so that we can easily define MeshTri2 or something to refer to the quadratic mesh.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
kinnalacommented, Oct 10, 2020

Just did some serious progress on this in #493

Figure_1

Loading a quadratic mesh from Gmsh using meshio and solving the Laplace equation.

0reactions
kinnalacommented, Oct 11, 2020

Closing this shortly and opening new ones that are more detailed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

High-Order Mesh Setup - YouTube
In this video we demonstrate how to setup a mesh for high-order mesh export. Once a linear mesh has been created, a solver...
Read more >
A Variational Framework for High-order Mesh Generation
A Variational Framework for High-order Mesh Generation☆ ... little consensus on which approach is the most robust, fastest and produces the 'best' meshes....
Read more >
Mesh Order Explained: Understanding High ... - System Analysis
Does your mesh order provide the right level of accuracy in a CFD simulation? Learn more about the advantages of high-order meshes and...
Read more >
Technologies for supporting high-order geodesic mesh ...
Technologies for supporting high-order geodesic mesh frameworks for computational astrophysics and space sciences.
Read more >
[1706.00578] Higher-order meshing of implicit geometries - part I
The proposed strategy relies on an automatic meshing of the cut elements. Firstly, the zero-level sets are identified and meshed by higher-order ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found