[Gmsh] R: Post-processing stress field
Ok, got it, in this case you are associating one tensor to the cell and to the nodes. My question is: I have a number of scalar fields, some defined on the nodes, other defined on cell centers. Can I associate all the scalar fields in the same view (one for elements and one for nodes), or do I have to generate one view per field (i.e. more $ElementData or $NodeData blocks)? -Messaggio originale- Da: Christophe Geuzaine [mailto:cgeuza...@uliege.be] Inviato: giovedì 31 gennaio 2019 09:46 A: Alessandro Vicini Cc: gmsh@onelab.info Oggetto: Re: [Gmsh] Post-processing stress field > On 31 Jan 2019, at 09:40, Alessandro Vicini > wrote: > > > I would be grateful if you could post a similar MSH2 example for a > tetrahedron grid, with 1 data field assigned on nodes and another one > assigned on cell centers... > Here we go: $MeshFormat 2.0 0 8 $EndMeshFormat $Nodes 4 1 0.0 0.0 0.0 2 0.1 0.0 0.0 3 0.1 0.1 0.0 4 0.0 0.0 0.1 $EndNodes $Elements 1 1000 4 2 6 100 1 2 3 4 $EndElements $ElementData 1 "stress field per element" 1 0. 3 0 9 1 1000 1 0 0 0 2 0 0 0 3 $EndElementData $NodeData 1 "stress field per node" 1 0. 3 0 9 4 1 1 0 0 0 2 0 0 0 3 2 1 0.1 0.1 0.1 2 0.1 0.1 0.1 3 3 1 0.2 0.2 0.2 2 0.2 0.2 0.2 3 4 1 0.3 0.3 0.3 2 0.3 0.3 0.3 3 $EndNodeData > A. > > > -Messaggio originale- > Da: gmsh [mailto:gmsh-boun...@ace20.montefiore.ulg.ac.be] Per conto di > Christophe Geuzaine > Inviato: giovedì 31 gennaio 2019 09:37 > A: Max Orok > Cc: gmsh@onelab.info; Gaetano Camarda > Oggetto: Re: [Gmsh] Post-processing stress field > > > >> On 30 Jan 2019, at 23:58, Max Orok 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 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 >> 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. >> >> >> >> >> >> Sincerely, >> Max >> >> On Tue, Jan 29, 2019 at 11:24 AM Gaetano Camarda wrote: >> Hello everyone, >> >> I’m having some difficult on post processing a mesh I created. >> >> I create a mesh on Gmsh
[Gmsh] R: Post-processing stress field
Great, thank you. Could you clarify what are the 9 values that you associate with the element and with each node? A. -Messaggio originale- Da: Christophe Geuzaine [mailto:cgeuza...@uliege.be] Inviato: giovedì 31 gennaio 2019 09:46 A: Alessandro Vicini Cc: gmsh@onelab.info Oggetto: Re: [Gmsh] Post-processing stress field > On 31 Jan 2019, at 09:40, Alessandro Vicini > wrote: > > > I would be grateful if you could post a similar MSH2 example for a > tetrahedron grid, with 1 data field assigned on nodes and another one > assigned on cell centers... > Here we go: $MeshFormat 2.0 0 8 $EndMeshFormat $Nodes 4 1 0.0 0.0 0.0 2 0.1 0.0 0.0 3 0.1 0.1 0.0 4 0.0 0.0 0.1 $EndNodes $Elements 1 1000 4 2 6 100 1 2 3 4 $EndElements $ElementData 1 "stress field per element" 1 0. 3 0 9 1 1000 1 0 0 0 2 0 0 0 3 $EndElementData $NodeData 1 "stress field per node" 1 0. 3 0 9 4 1 1 0 0 0 2 0 0 0 3 2 1 0.1 0.1 0.1 2 0.1 0.1 0.1 3 3 1 0.2 0.2 0.2 2 0.2 0.2 0.2 3 4 1 0.3 0.3 0.3 2 0.3 0.3 0.3 3 $EndNodeData > A. > > > -Messaggio originale- > Da: gmsh [mailto:gmsh-boun...@ace20.montefiore.ulg.ac.be] Per conto di > Christophe Geuzaine > Inviato: giovedì 31 gennaio 2019 09:37 > A: Max Orok > Cc: gmsh@onelab.info; Gaetano Camarda > Oggetto: Re: [Gmsh] Post-processing stress field > > > >> On 30 Jan 2019, at 23:58, Max Orok 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 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 >> 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. >> >> >> >> >> >> Sincerely, >> Max >> >> On Tue, Jan 29, 2019 at 11:24 AM Gaetano Camarda 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
[Gmsh] R: Post-processing stress field
I would be grateful if you could post a similar MSH2 example for a tetrahedron grid, with 1 data field assigned on nodes and another one assigned on cell centers... A. -Messaggio originale- Da: gmsh [mailto:gmsh-boun...@ace20.montefiore.ulg.ac.be] Per conto di Christophe Geuzaine Inviato: giovedì 31 gennaio 2019 09:37 A: Max Orok Cc: gmsh@onelab.info; Gaetano Camarda Oggetto: Re: [Gmsh] Post-processing stress field > On 30 Jan 2019, at 23:58, Max Orok 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 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 > 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. > > > > > > Sincerely, > Max > > On Tue, Jan 29, 2019 at 11:24 AM Gaetano Camarda 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 > > https://urlsand.esvalabs.com/?u=http%3A%2F%2Fonelab.info%2Fmailman%2Fl > istinfo%2Fgmsh=9895bfa0=91a6eddd=y=y > > > -- > Max Orok > Contractor > > https://urlsand.esvalabs.com/?u=http%3A%2F%2Fwww.mevex.com=9895bfa0; > h=21dbbfec=y=y > > > > > -- > Max Orok > Contractor > > https://urlsand.esvalabs.com/?u=http%3A%2F%2Fwww.mevex.com=9895bfa0; > h=21dbbfec=y=y > > > ___ > gmsh mailing list > gmsh@onelab.info > > https://urlsand.esvalabs.com/?u=http%3A%2F%2Fonelab.info%2Fmailman%2Fl > istinfo%2Fgmsh=9895bfa0=91a6eddd=y=y — Prof. Christophe Geuzaine University of Liege, Electrical Engineering and Computer Science