Point data in high order meshes
See original GitHub issueHow would one go about saving point_data
for a 10-noded tetrahedral mesh for instance? I have right now, basis.nodal_dofs
and basis.edge_dofs
. I was using linear meshes up until now and hence basis.nodal_dofs
sufficed even when having a high order approximation such as in #651
from skfem.io import from_meshio
from pygmsh import opencascade, generate_mesh as gm
import numpy as np
from skfem import *
def generateMesh():
R_out = 1.0e-2
geo = opencascade.Geometry
geom = geo(R_out / 30.0, R_out / 10.)
geom.add_raw_code("Mesh.ElementOrder=2;")
outer_ball = geom.add_ball([0.0, 0.0, 0.0], R_out)
msh = gm(geom)
return msh
mesh = from_meshio(generateMesh())
uelem = ElementVectorH1(ElementTetCCR())
elems = {
"u": uelem
}
basis = {
field: InteriorBasis(mesh, e, intorder=4)
for field, e in elems.items()
}
du = basis["u"].zeros()
mesh.save("filename.xdmf", point_data = {"u": du[basis["u"].nodal_dofs].T}) # would work if linear mesh
raises
Traceback (most recent call last):
File "D:\Research\runHyperelasticSphere.py", line 433, in <module>
mesh.save("filename.xdmf", point_data = {"u": du[basis["u"].nodal_dofs].T}) # would work if linear mesh
File "C:\Users\bshri\AppData\Local\Programs\Python\Python39\lib\site-packages\skfem\mesh\mesh.py", line 424, in save
return to_file(self, filename, point_data, **kwargs)
File "C:\Users\bshri\AppData\Local\Programs\Python\Python39\lib\site-packages\skfem\io\meshio.py", line 154, in to_file
meshio.write(filename, to_meshio(mesh, point_data), **kwargs)
File "C:\Users\bshri\AppData\Local\Programs\Python\Python39\lib\site-packages\skfem\io\meshio.py", line 150, in to_meshio
return meshio.Mesh(mesh.p.T, cells, point_data)
File "C:\Users\bshri\AppData\Local\Programs\Python\Python39\lib\site-packages\meshio\_mesh.py", line 61, in __init__
raise ValueError(
ValueError: len(points) = 30317, but len(point_data["u"]) = 4123
How would one go about incorporating edge_dofs
in saving point_data
?
Issue Analytics
- State:
- Created 2 years ago
- Comments:12 (12 by maintainers)
Top Results From Across the Web
Mesh Order Explained: Understanding High ... - System Analysis
A high-order mesh connects adjacent mesh points with a curve of polynomial degree higher than one (i.e. linear). The easiest way to understand...
Read more >Higher-order meshing of implicit geometries—part I - arXiv
Level-set data is given at the nodes of a higher-order background mesh and the interpolated zero-level sets imply boundaries of the domain ...
Read more >Output and visualization of high-order solutions/meshes #6931
The current workflow for storing high-order element solutions and high-order meshes (with attached manifolds) is by subdividing them.
Read more >High-Order Mesh Generation Based on Optimal Affine ...
For each interior node in the high-order straight-sided mesh, a set of weights that relates the node to its neighbors is calculated. After...
Read more >automatic higher order mesh generation and movement utilizing
curved mesh deformation strategy, the method can handle high-order mesh movement or ... good agreement with the experimental data.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think these formats that support quadratic meshes expect one value per node. However, I think you can use projection with
ElementVector
. Just when passing data topoint_data
I think it must be component-by-component. Not sure though, I’m mostly usingmatplotlib
for visualization.The global
L2
projection withElementVector
seems to be a bit off. I don’t know why though. Will try component-wiseL2
projection.The problem I was solving is that of an incompressible shell radially stretched outwards and simply plotting the projected displacement seemed to suggest that something isn’t correct. See
L2
projectionwhereas if I simply write the
nodal
andedge
dofs, it seems to work (at least I don’t see anything noticeably off).Actual
nodal
andedge
dataThe dof-ordering is quite nice in the sense that I can simply stich together the nodal and edge dofs by
I will close this since it seems I can get what I wanted to begin with. The complete code is basically example 36 but for different geometry and b.c’s and now with
ElementTetCCR