doriandepriester / mtex2gmsh Goto Github PK
View Code? Open in Web Editor NEWMatlab toolbox for generating 2D meshes from EBSD data
Home Page: https://doriandepriester.github.io/MTEX2Gmsh/
License: MIT License
Matlab toolbox for generating 2D meshes from EBSD data
Home Page: https://doriandepriester.github.io/MTEX2Gmsh/
License: MIT License
Hello!
I am trying to run your toolbox on a Mac. When prompted to identify the executable file for gmsh, I am unable to do so, because the Mac version of gmsh does not use a .exe file.
Are you aware of a workaround to use your toolbox on a Mac?
Thank you,
Colin
Dear Prof. Depriester,
I am trying to use MTEX2prisms to mesh my EBSD data. However, I see a lot of warnings when running the following lines in matlab:
V=grains_Sub_filled.V;
ori = min(V);
grains_Sub_filled.V = V-repmat(ori,size(grains_Sub_filled.V,1),1);
G = gmshGeo(grains_Sub_filled);
G=simplify(G);
max(grains_Sub_filled.V)
mesh(G,'mesh.msh','ElementType','HexOnly','GrainPrefix','','thickness',1);
exportGrainProps(G,'orientations_Ti2.txt','PRISMS')
Warning: wrong control point index in bspline.
Warning: No parametric coordinate on node XXXXX classified on curve XXXXX.
The generated mesh looks a little weird (see attached figures).
I run prisms-plasticity using this mesh as an input and it reports "Unable to open eulerDataFile".
The matlab code and the EBSD file are also attached for your convenience.
I am using matlab R2020a, MTEX 5.7.0 (and 5.5.0), gmsh-4.8.4-Windows64,
Thanks in advance.
Best,
Jie
mesh_EBSD.txt (.m file)
Scan1.txt (.ang file)
Hello,
This tool is very interesting. However, I'd like to know if I can use the tool to mesh images (not necessary coming from EBSD).
It would be helpful if ones can read an image (e.g. imread('')), then mesh it based on colors.
I've an image (attached) and I want to know if I someone can help me to do so.
Thanks
i'm working with EBSD data (.CTF) in Mtex and using MTEX2Gmsh
i was wondering if there is a way to create a edge (or line) between front node and back node in order to have nodes along the edge and mesh it to have more element in Z direction insted of just having a big node from front to back?
I have a few suggestions to improve documentation per openjournals/joss-reviews#2094
Concerning the tutorial:
The example cases are easy to follow and seem to cover the extent of the intended uses, but unit testing is missing. Some recently accepted joss papers using matlab have what seems to be an offline-automated test suite
I did not see any API documentation (maybe I am forgetting how to access this in matlab)
Finally, make sure to add a CONTRIBUTING.md file for Github contributors
Hello Dorian,
Sorry to disturb you. There is a problem when I run the unitTest.m and I haven't modified the code.
My matlab version is R2018b
gmsh 4.12
mtex 5.9.0
I had some try according the Error prompt but it doesn't work. Can you give me some help?
Following is my command window
>> unitTest
ebsd = EBSD
Phase Orientations Mineral Color Symmetry Crystal reference frame
0 1197 (32%) notIndexed
1 1952 (52%) Forsterite LightSkyBlue mmm
2 290 (7.8%) Enstatite DarkSeaGreen mmm
3 282 (7.6%) Diopside Goldenrod 12/m1 X||a*, Y||b*, Z||c
Properties: bands, bc, bs, error, mad, x, y
Scan unit : um
Error using *
Both logical arguments must be scalar. Use TIMES (.*) for elementwise multiplication.
Error in findSingularPoints (line 21)
I_VG = (I_VF * gB.I_FG)==2;
Error in computeSegments (line 14)
sp=findSingularPoints(grains);
Error in gmshGeo (line 46)
[Segmts,OuterLoop,InnerLoops,G.SingularPoints]=computeSegments(grains);
Error in unitTest (line 26)
G=gmshGeo(grains);
Thank you very much for your responses. I clearly missed this in the documentation upon a second read-through.
I do have an additional question regarding the 2D mesh. In 3D, the "gradient" command is working perfectly and successfully meshing in ABAQUS when I create and upload the .inp file. However, when I use any of the available 2D element options along with the gradient command, the gradient effect is overlooked when the mesh is created. All elements are the same size. I also have tried creating the command using the GUI, and see the same result.
The command I used most recently is as follows for the object "G":
mesh(G,'sample.msh','ElementType','Tri','ElementSize',1,'gradient',0.5)
I see this same effect (no gradient) for 'Quad' and 'QuadOnly' 2D options as well. When I upload the .inp file from any 2D mesh into ABAQUS, I then get errors (negative or zero element area) when I check the mesh quality. This is interesting because as I said, things work very well in 3D with all other parameters held equal.
Do you also experience this result when combining the gradient and 2D elements? I would be happy to share the EBSD data I am experimenting with.
Thank you again for your responses.
Originally posted by @Colin-Williams94843 in #17 (comment)
Dear Dorian,
I would like to perform Prism-Platicity CPFEM on an EBSD image. To simulate the fact that the area of interest is embed in a polycrystalline medium, I am wondering if the code could generate meshes for an EBSD image and then surround this area of interest with a "buffer layer" comprising grains with each grain represented by a single element. The orientations of these single-element grains in the "buffer layer" are assigned so that they reflect the bulk texture of the material.
Thanks and regards,
Diego
Dear Dorian,
Thank you for creating such a nice toolbox. I created the gmsh and orientation file for input using the MTEX2Gmsh toolbox.
I ran some simulations. The output is the Quadrature file. I have now the x, yz, r_x,r_y and r_z as output. I wish to plot it.
(1) Is there any possibility of plotting it directly or I have to convert it to Bunge angles first.
(2) I suppose its unstructured mesh. So I should use paraview or some other software.
Regards
Rajesh
Hello Dorian,
For the standard command it says: The above command results in a 1 element thick mesh
so i was wondering if there is there a way to apply thickness and have more elements in Z direction?
Thank you
Regards
David.
Hi,
Firstly I would like to thank you for the powerful tool that already helped me a lot.
I've recently came across an issue with meshes generated with MTEX2Gmsh. Some grains have inconsistent element at boundaries with their surroundings. I have tried to generate the mesh in gmsh using the .geo file without extrusion, the same problem arises everytime in the same place i.e. if I mesh a small part of my microstructure where the previously incriminated grains is, the same problem persist. Everything seems ok in MTEX though. These grains have no connectivity with the rest of the mesh when performing FEM computations.
I attached a picture illustrating my issue. Have I done something wrong ?
Thanks in advance for the help.
EDIT : It seems that there are some wrong spline definitions getting the following gmsh warning "Wrong control point index in bspline"
Maxime
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)));
Ids_str = [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
Hello Dorian,
maybe it is more a problem of python or gmsh, but the mesh-command of MTEX2Gmsh fails - any idea of what I'm doing wrong?
Thanks
Stefan
mesh(G,'small.inp');
Info : Running 'C:\gmsh480\gmsh.exe C:\Users\Stefa\AppData\Local\Temp\tpf2ba8dd2_169d_42f7_a970_0dcbd065c0e3 -o small.inp -v 4 -save' [Gmsh 4.8.0, 1 node, max. 1 thread]
Info : Started on Tue Apr 06 20:08:11 2021
Info : Reading 'C:\Users\Stefa\AppData\Local\Temp\tpf2ba8dd2_169d_42f7_a970_0dcbd065c0e3'...
Info : Writing 'small.inp'...
Info : Done writing 'small.inp'
Info : Shell opening 'C:\Users\Stefa\gmsh-4.8.0-Windows64\tutorial\python\t1.py' with arguments ' -onelab "t1" 127.0.0.1:51647'
Error : Abnormal server termination (Socket listening timeout on socket 127.0.0.1:0)
Info : Shell opening 'C:\Users\Stefa\gmsh-4.8.0-Windows64\tutorial\python\t1.py' with arguments ' -onelab "t1" 127.0.0.1:51648'
Error : Abnormal server termination (Socket listening timeout on socket 127.0.0.1:0)
Info : Shell opening 'C:\Users\Stefa\gmsh-4.8.0-Windows64\tutorial\python\t1.py' with arguments ' -onelab "t1" 127.0.0.1:51650'
Error : Abnormal server termination (Socket listening timeout on socket 127.0.0.1:0)
Info : Saving database 'C:\Users\Stefa\AppData\Local\Temp\tpf2ba8dd2_169d_42f7_a970_0dcbd065c0e3.db'...
Info : Done saving database 'C:\Users\Stefa\AppData\Local\Temp\tpf2ba8dd2_169d_42f7_a970_0dcbd065c0e3.db'
Info : Stopped on Tue Apr 06 20:08:26 2021 (From start: Wall 15.1449s, CPU 0.03125s)
Hi Dorian,
Do you have any recommendations on the acceptable mesh quality for Prism-plasticity. Any rule of thumb on the "threshold" values of SICN, Gamma, and SIGE? How good is good enough?
Many thanks,
Diego
This is an extremely minor issue: there are a handful of suggestions from the matlab warnings (extra semicolons, unnecessary variables) in the gmshGeo class
Hi,
The 'medium' option works perfectly in 3D.
I wondered if it also available in 2D, i.e. without extrusion.
I tried by giving a list of only two dimensions, or by setting the last dimension to 0, but without success.
Thanks
Jean-Michel
Hi Dorian,
Very nice toolbox! Thanks for sharing.
When using savegeo() to create a GMSH geometry file like as follows:
savegeo(G,strcat(output,'.geo'),'ElementSize',elt_size,'gradient',gradient,'ElementType','Tri');
The .geo file contains lines to create Physical Volumes (just below // Sets), although the given options will result in a 2D mesh.
Would it make sense to replace "Physical Volume" by "Physical Surface" when 2D mesh options are passed as arguments to the savegeo function ?
Regards
Jean-Michel
Hi Dorian,
I went through the code and found it very useful and impressive. I think there are some places for improvement.
I will list them here but I don't think that they are showstopper for the review process.
A central point seems to be the reordering of the boundary segments . Here you use an algorithm based on Euler Tours. MTEX itself contains already some Euler Tour algorithms in mtex/tools/graph_tools
which might be more efficient. Another idea can be found in the last paragraph of grain2d/subSet
. Here the boundary segments are ordered without the use of any Euler Tours command by making use of the fact that grain2d.poly
contains already a ordered list of vertices.
For me it would make a lot of sense to include the ordering directly into MTEX. Currently, the grainboundary segments are not ordered at all (unless there is only a single grains). The ordering you suggest seems very reasonable and could easily be the default ordering in MTEX.
The spline interpolation seems to be used only for plotting. This is not so clear from the documentation. Also, wouldn't it make more sense to use some buildin spline function like spline
instead of a custom one.
Smoothing the boundary while keeping triple points and points at the outer boundary fixed should actually be an option within MTEX :) Same is true for the simplification of the geometry,
When publishing the help files it is useful to set
setMTEXpref('generatingHelpMode',true);
as it avoids some output artifacts.
grain2d
? When I understood this correctly the main difference to the class grain2d
is that the boundary segments are sorted and the gmshGeo
keeps track of this order. I'm correct?A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.