Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Naming surfaces in gmsh #965

Open
NoelGK opened this issue Mar 15, 2023 · 3 comments
Open

Naming surfaces in gmsh #965

NoelGK opened this issue Mar 15, 2023 · 3 comments

Comments

@NoelGK
Copy link

NoelGK commented Mar 15, 2023

Hi,

I am trying to import a mesh created in gmsh, with surfaces and volumes labeled also in gmsh, so that later I can define my regions using the syntax "vertices of group __" or "cells of group __". Nevertheless, with evey format that I have tried, I get the same error.

NotImplementedError: meshes with several cell kinds are not supported!

But this is not the case, I am not introducing triangles+tethrahedra, they are just 3-dimensional elements but with the surfaces labeled. Is it possible to import this kind of meshes? Which format should I use?

Thank you in advance.

@flothesof
Copy link
Contributor

Hi @NoelGK

I have worked on this before, see this heat equation example: https://sfepy.org/doc-devel/examples/diffusion-time_heat_equation_multi_material.html#diffusion-time-heat-equation-multi-material

Regions are defined by tags as follows:

regions = {
    'Omega': 'all',
    'Omega_Cylinder': 'cells of group 4',
    'Omega_Powder': 'cells of group 3',
    'Omega_Plate': 'cells of group 1 +v cells of group 2',
    'Gamma_Plate': ('vertices in (z < -9.95e-3)', 'facet'),
    'Gamma_Source': ('vertices of surface *v r.Omega_Cylinder', 'face'),
}

To get this to work, I defined physical surfaces in the .geo file:

// Physical volumes
Physical Volume ("powder") = {3};
Physical Volume ("cylinder") = {4};
Physical Volume ("plate") = {1, 2};

And then exported them using the .mesh format, because msh22 or msh didn’t work for me.

// generate the mesh
// gmsh -3 -format mesh -o .\multi_material_cylinder_plate.mesh .\multi_material_cylinder_plate.geo

// convert to vtk format using sfepy
// sfepy-convert -d 3 .\multi_material_cylinder_plate.mesh .\multi_material_cylinder_plate.vtk

The full .geo file is in the sources here: https://github.com/sfepy/sfepy/blob/master/meshes/3d/multi_material_cylinder_plate.geo

Hope this helps.

Cheers,
Florian

@flothesof
Copy link
Contributor

@rc maybe it would be nice to add explanations along what I wrote above to the doc, probably in this section https://sfepy.org/doc-devel/preprocessing.html ?

@rc
Copy link
Member

rc commented Mar 15, 2023

Yes, it could go into the preprocessing doc - moreover many things can be done in a simpler way thanks to gmsh improvements.

BTW. the git version of sfepy does support meshes with several cell kinds, provided those have different topological dimensions (@vlukes am I right?).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants