DorianDepriester / MTEX2Gmsh

Matlab toolbox for generating 2D meshes from EBSD data
https://doriandepriester.github.io/MTEX2Gmsh/
MIT License
38 stars 17 forks source link

[help wanted] Creating phase groups #7

Open Max-EDFLMT opened 3 years ago

Max-EDFLMT commented 3 years ago

Hi Dorian,

I'm not that confident with GMSH but I added a little something to your mesh command in order to create a group for phases in the fashion you introduced grains groups. This is useful for affecting mechanical behaviors afterwards.

groupPrefix='Gr'; phaseList = unique(obj.Grains.Phase); for i=1:size(phaseList,1) Ids = obj.Grains.GrainID(ismember(obj.Grains.Phase,phaseList(i))); Idsstr = [sprintf('%d,', Ids(1:end-1)), sprintf('%d', Ids(end))]; fprintf(ffid,['Physical Volume("%s%s")={' Ids_str '};\n'],groupPrefix,phaseList{i,1});
end

I added this piece of code right after you ended the "for" loop in "Physical Volumes" section. The issue is that GMSH is creating a mesh for grains groups and phase groups resulting in duplicating the elements everywhere (because grain groups are all included in phase groups, lying on the same base geometry entities)

Is there a way to avoid this issue ?

Thanks in advance,

Maxime

DorianDepriester commented 3 years ago

Hi Maxime, Thank you for your comment. Indeed, grouping grains by their phase could be an interesting feature. I am currently away from office, but I will have a look on your issue ASAP.

Regards.