> On 30 Jan 2019, at 23:58, Max Orok <mo...@mevex.com> wrote: > > Yes, the stresses belong in the $ElementData section for sure. > I think to correctly display it, you'll need to create rows of element data > with 10 entries - 1 for the element number and 9 for the stress tensor values: > > 1 sigx sigxy sigxz sigxy sigy sigyz sigxz sigyz sigz > > I don't know if copying and pasting this pattern in ElementData will work > without some tweaks...
That's correct. Here is a simple MSH2 example with 2 quads, with values [1 0 0, 2 0 0, 3 0 0] and [1 0.1 0.1, 0.1 2 0.1, 0.1 0.1 3]: $MeshFormat 2.0 0 8 $EndMeshFormat $Nodes 6 1 0.0 0.0 0.0 2 0.1 0.0 0.0 3 0.1 0.3 0.0 4 0.0 0.3 0.0 5 0.0 0.15 0.0 6 0.1 0.15 0.0 $EndNodes $Elements 2 1000 3 2 6 100 1 2 6 5 1001 3 2 6 100 5 6 3 4 $EndElements $ElementData 1 "stress field per element" 1 0. 3 0 9 2 1000 1 0 0 0 2 0 0 0 3 1001 1 0.1 0.1 0.1 2 0.1 0.1 0.1 3 $EndElementData PS: the next release will improve the computation of the min/max for tensor fields. (Currently the min/max is computed using the default representation for tensors, i.e. Von-Mises. The next release will take the tensor visualization mode into account when explicitly requesting the calculation of min/max.) Christophe > (there is an InterpolationScheme section that I don't quite understand). If > it were me, I would add the data using the gmsh API and it will handle the > output format how it likes. > > Sincerely, > Max > > > On Wed, Jan 30, 2019 at 2:42 PM Gaetano Camarda <gaetano...@live.it> wrote: > Thanks for your help, but I think I have not understood well. > I have a mesh all brick (8 nodes) and my stress field matrix is composed this > way: > 1 sigx sigy sigz sigxy sigyz sigxz > ... .... ..... ..... ...... ..... > > In each row is express the stress state of the element, I think I have to > copy this matrix into .msh file as $ElementData, but I do not unsterstand > well the input format, is that right this way? > > > Outlook per iOS > Da: Max Orok <mo...@mevex.com> > Inviato: martedì, gennaio 29, 2019 7:14 PM > A: Gaetano Camarda > Cc: gmsh@onelab.info > Oggetto: Re: [Gmsh] Post-processing stress field > > Hello Gaetano, > > Here is a short program to plot 3x3 tensor data using the C++ gmsh API (it > shouldn't be too hard to port to Python or Julia if you're more comfortable > there). It only plots data for one element, but can be extended for your case. > > The "addModelData" call is expecting a vector of vectors with 9 entries each > for this case. > I think the vector ordering corresponding to the matrix is like this: > [elt11, elt12, elt13, elt21, elt22, ...] > > I assume the stress matrix is symmetric and so only has 6 unique entries. > Therefore your vector entries will look like [x xy xz xy y yz xz yz z] > The tricky part will be importing the data in a sensible way. > > Perhaps you could parse a CSV using python and add entries to the data vector > in a loop? > Please find attached the program as well as example input mesh and output > mesh files. > > > > <image.png> > > Sincerely, > Max > > On Tue, Jan 29, 2019 at 11:24 AM Gaetano Camarda <gaetano...@live.it> wrote: > Hello everyone, > > I’m having some difficult on post processing a mesh I created. > > I create a mesh on Gmsh all Hexa (so a brick with 8 nodes), i use this mesh > and import it on Matlab, > > there i run some analisys and find the stress matrix: > > [sigx sigy sigz sigxy sigyz sigxz] > > ….. ….. ….. ….. ….. ….. > > > > Now I would like to visualize the stress field on Gmsh, but I do not find any > way to do so, I can export the matrix, > > I tried to generete a *.pos file, but I didn’t find a solution. > > > > Inviato da Posta per Windows 10 > > > > _______________________________________________ > gmsh mailing list > gmsh@onelab.info > http://onelab.info/mailman/listinfo/gmsh > > > -- > Max Orok > Contractor > www.mevex.com > > > > > -- > Max Orok > Contractor > www.mevex.com > > > _______________________________________________ > gmsh mailing list > gmsh@onelab.info > http://onelab.info/mailman/listinfo/gmsh — Prof. Christophe Geuzaine University of Liege, Electrical Engineering and Computer Science http://www.montefiore.ulg.ac.be/~geuzaine _______________________________________________ gmsh mailing list gmsh@onelab.info http://onelab.info/mailman/listinfo/gmsh