Re: Set groups in vtk mesh.
Yes, mmesh.point_data['mat_ids'] would work, but I did not see it in your mesh :)
r.
On 2/3/20 4:43 AM, FaTune wrote:
Your little snipped has worked like magic! Thank you so much!
Am I right that to also save 'mat_ids' I have to change the argument [np.zeros_like(conn[:, 0])] to mmesh.point_data['mat_ids']?
smesh = Mesh.from_data( 'meshio-mesh', mmesh.points, mmesh.point_data['node_groups'], [conn], mmesh.point_data['mat_ids'], ['3_4'], )
On Mon, Feb 3, 2020 at 3:45 AM Robert Cimrman <cimrman3@ntc.zcu.cz> wrote:
I was thinking about meshio too. But because it does not write the old VTK format, you could try the following:
import numpy as np import meshio from sfepy.discrete.fem import Mesh mmesh = meshio.read('trian.vtk') conn = mmesh.cells['tetra'] smesh = Mesh.from_data( 'meshio-mesh', mmesh.points, mmesh.point_data['node_groups'], [conn], [np.zeros_like(conn[:, 0])], ['3_4'], ) smesh.write('trian2.vtk')
Then
postproc.py --only-names=node_groups -b trian2.vtk --wire
seems to show the regions correctly.
r.
Thank you for help. I'm not sure I know how to convert the mesh into
format. Is there any converter? I've tried to convert trian.vtk to trian.mesh using meshio-convert in ubuntu. But the resulting trian.mesh doesn't have any information about node_groups.
On Sun, Feb 2, 2020 at 9:05 PM Robert Cimrman <cimrman3@ntc.zcu.cz> wrote:
Can you try converting the mesh to "# vtk DataFile Version 2.0" format? Your mesh is in "# vtk DataFile Version 4.2", and the reader in sfepy does not read it correctly.
r.
I see the node_groups in paraview, but don't see it if I use your snipped:
python postproc.py trian.vtk --all -b
The file trian.vtk is in the attachment. Clearly something is wrong in
On 2/2/20 1:49 AM, FaTune wrote: this
mesh.
On Sun, Feb 2, 2020 at 10:49 AM Robert Cimrman <cimrman3@ntc.zcu.cz> wrote:
On 2/2/20 12:28 AM, FaTune wrote: > In addition to the previous message. I created vtk mesh with values in > field "node_groups" to be 1 or 2. When I use 'vertices of group 0' sfepy > works without errors, but set this region to every single vertex in
> mesh, and I don't have values 0 in 'node_groups' field. When I change 0 to > 1 or 2 it raises error. Apparently sfepy just ignores 'node_groups' field.
It is possible to display the vertex and cell groups in a mesh with
On 2/2/20 1:14 PM, FaTune wrote: older the the
following (or use any VTK viewer, such as paraview):
python postproc.py meshes/3d/acoustic_wg.vtk --all -b
Does it show your regions correctly? If the mesh and the node_groups are well defined, what you do should work.
If the above does not help you finding what's wrong, send here a minimal example that demonstrates the problem.
r.
> On Sun, Feb 2, 2020 at 10:16 AM <fatune@gmail.com> wrote: > >> regions = { >> 'Omega' : 'all', >> 'Gamma_Left' : ('vertices in (x < 0.00001)', 'facet'), >> 'Gamma_Right' : ('vertices in (x > 99.099999)', 'facet'), >> 'GammaIn': ('vertices of group 0', 'edge'), >> } >> >> >> The group I am struggling with is GammaIn. I was using vibro_acoustic3d.py >> as an example when I was creating my vtk mesh. Am I right in my assumption >> that it is enough to add field "node_groups" to my vtk and sfepy will >> gather information of the group number from this field?
participants (1)
-
Robert Cimrman