## [Libmesh-users] Get XYZ location of global DOFs

 [Libmesh-users] Get XYZ location of global DOFs From: David Xu - 2006-07-26 10:53:30 Attachments: Message as HTML ```Hi All, After I used 3rd order hermite shape function, I realized the resulting dimension of the assembled system matrices is not equal to the number of mesh nodes as in the case of using 2nd order Lagrange. The dimension equals the number of DOFs. I was wondering how to get xyz physical location of each of the global DOF points. Is there an iterator available like the one for mesh nodes? Thanks, David ```

 [Libmesh-users] Get XYZ location of global DOFs From: David Xu - 2006-07-26 10:53:30 Attachments: Message as HTML ```Hi All, After I used 3rd order hermite shape function, I realized the resulting dimension of the assembled system matrices is not equal to the number of mesh nodes as in the case of using 2nd order Lagrange. The dimension equals the number of DOFs. I was wondering how to get xyz physical location of each of the global DOF points. Is there an iterator available like the one for mesh nodes? Thanks, David ```
 Re: [Libmesh-users] Get XYZ location of global DOFs From: David Xu - 2006-07-26 15:52:05 Attachments: Message as HTML ```Roy, Thanks. The reason why I need xyz of the DOFs is that my system matrices are solved by an eigenvalue solver outside libmesh and the size of the eigenvector solution produced by the solver equals to the dimension of the system matrices (or DOFs). I'd like to plot the eigenvector solutions, thus I need to the correspondent xyz coordinates of each of the eigenvector value for visualization purpose. It was easy to do for the 2nd order Lagrange because the size of the eigenvector = n_nodes, now I'm stuck at plotting the results from 3rd order hermite, which have much better accuracy. David On 7/26/06, Roy Stogner wrote: > > On Wed, 26 Jul 2006, David Xu wrote: > > > After I used 3rd order hermite shape function, I realized the resulting > > dimension of the assembled system matrices is not equal to the number of > > mesh nodes as in the case of using 2nd order Lagrange. The dimension > equals > > the number of DOFs. I was wondering how to get xyz physical location of > each > > of the global DOF points. Is there an iterator available like the one > for > > mesh nodes? > > No, there isn't. If you want to be dangerous, you can use the > DOFObject interface of a node in the mesh of an initialized > EquationSystems to view every global degree of freedom index on that > node. Keep in mind that for many elements (including the HERMITE > elements for p=4 and above, I think) there are also degrees of freedom > associated with the Elem itself. > > Why do you need the physical location of non-Lagrange degrees of > freedom? That's kind of unusual. > --- > Roy Stogner > ```
 Re: [Libmesh-users] Get XYZ location of global DOFs From: Roy Stogner - 2006-07-28 03:47:30 ```On Wed, 26 Jul 2006, David Xu wrote: > Thanks. The reason why I need xyz of the DOFs is that my system matrices are > solved by an eigenvalue solver outside libmesh and the size of the > eigenvector solution produced by the solver equals to the dimension of the > system matrices (or DOFs). I'd like to plot the eigenvector solutions, thus > I need to the correspondent xyz coordinates of each of the eigenvector value > for visualization purpose. No, you don't. Those XYZ coordinates *overlap* - each Hermite point will have 2 degrees of freedom in 1D, 4 in 2D, and 8 in 3D. You can throw away all but the first degree of freedom on each node and plot each piecewise cubic element as a piecewise linear, but if you want an accurate representation of your results you'll either need plotting software that can handle higher polynomials or you'll need to subdivide your mesh elements. The most general way you can do things is to load your eigenvector solutions back into libMesh (preferably into the same running process that gave you the original matrix, so there's no question of node renumbering). Then you can use the libMesh plotting functions (assuming you're happy with the limitations of those output formats) or use the libMesh FE objects to get an arbitrarily dense cloud of points for your own plotting software. --- Roy Stogner ```
 Re: [Libmesh-users] Get XYZ location of global DOFs From: Roy Stogner - 2006-07-26 17:13:39 ```On Wed, 26 Jul 2006, David Xu wrote: > After I used 3rd order hermite shape function, I realized the resulting > dimension of the assembled system matrices is not equal to the number of > mesh nodes as in the case of using 2nd order Lagrange. The dimension equals > the number of DOFs. I was wondering how to get xyz physical location of each > of the global DOF points. Is there an iterator available like the one for > mesh nodes? No, there isn't. If you want to be dangerous, you can use the DOFObject interface of a node in the mesh of an initialized EquationSystems to view every global degree of freedom index on that node. Keep in mind that for many elements (including the HERMITE elements for p=4 and above, I think) there are also degrees of freedom associated with the Elem itself. Why do you need the physical location of non-Lagrange degrees of freedom? That's kind of unusual. --- Roy Stogner ```
 Re: [Libmesh-users] Get XYZ location of global DOFs From: Roy Stogner - 2006-07-26 17:59:10 ```On Wed, 26 Jul 2006, David Xu wrote: > On 7/26/06, Roy Stogner wrote: > > I see. Do you any of the plotting software that can handle higher > polynomials? No. If I knew of any I'd be using it myself. ;-) As it is I usually get good enough plots from the bisected piecewise linear plots that libMesh's output functions produce by default. > I remember you mentioned lagrange only support up to 2nd order. If that's > correct, That's correct. > I may also want to try higher order hierarchic (up to p=5?). The polynomial degrees supported by each finite element class depend on the geometric element. Check out the definition of FEInterface::max_order() if you want to see what each supports. On HEX27 elements, the hierarchics support "unlimited" polynomial degree - but ill conditioning and floating point error will probably screw up your solution around p=11. > Will hierarchic (p>2) have the same node re-numbering problem for > getting xyz? Wait wait wait - you're talking about two problems here. When I mentioned node renumbering before, I was talking about the difficulty of loading old solutions into new meshes. The problem in plotting solutions on non-lagrange elements is different, and yes, the hierarchics will be equally tricky. >> The most general way you can do things is to load your eigenvector >> solutions back into libMesh (preferably into the same running process >> that gave you the original matrix, so there's no question of node >> renumbering). Then you can use the libMesh plotting functions >> (assuming you're happy with the limitations of those output formats) >> or use the libMesh FE objects to get an arbitrarily dense cloud of >> points for your own plotting software. > > That sounds like a project to me. Would you please point me to the possible > classes/functions I need to load the eigenvector solutions back into libMesh Yes: NumericVector<>::set() We don't have any "load numeric vector from file" function, but it shouldn't be too hard to read in a file and set the coefficients yourself. > and to plot them? Currently, for the 2nd order lagrange, I just concatenate > the node xyz locations with the the eigenvector solutions, and then plot > them in Matlab. Okay. If Matlab doesn't have any particular requirements for the ordering of the points you plot, then it's easy: Loop over all the elements. On each geometric element, reinit your FE object with a grid quadrature rule whose order at least equals your polynomial degree. Get the XYZ coordinates and the solution value at each quadrature point, and output them. That will output vertex and edge points multiple times, but the plot should look the same. If your elements are so large that the plot still looks faceted, use a quadrature rule with more points. --- Roy ```
 Re: [Libmesh-users] Get XYZ location of global DOFs From: David Xu - 2006-07-26 20:34:59 Attachments: Message as HTML ```On 7/26/06, Roy Stogner wrote: > > On Wed, 26 Jul 2006, David Xu wrote: > > > On 7/26/06, Roy Stogner wrote: > > > > I see. Do you any of the plotting software that can handle higher > > polynomials? > > No. If I knew of any I'd be using it myself. ;-) As it is I usually > get good enough plots from the bisected piecewise linear plots that > libMesh's output functions produce by default. > > > I remember you mentioned lagrange only support up to 2nd order. If > that's > > correct, > > That's correct. > > > I may also want to try higher order hierarchic (up to p=5?). > > The polynomial degrees supported by each finite element class depend > on the geometric element. Check out the definition of > FEInterface::max_order() if you want to see what each supports. > > On HEX27 elements, the hierarchics support "unlimited" polynomial > degree - but ill conditioning and floating point error will probably > screw up your solution around p=11. > > > Will hierarchic (p>2) have the same node re-numbering problem for > > getting xyz? > > Wait wait wait - you're talking about two problems here. When I > mentioned node renumbering before, I was talking about the difficulty > of loading old solutions into new meshes. The problem in plotting > solutions on non-lagrange elements is different, and yes, the > hierarchics will be equally tricky. > > >> The most general way you can do things is to load your eigenvector > >> solutions back into libMesh (preferably into the same running process > >> that gave you the original matrix, so there's no question of node > >> renumbering). Then you can use the libMesh plotting functions > >> (assuming you're happy with the limitations of those output formats) > >> or use the libMesh FE objects to get an arbitrarily dense cloud of > >> points for your own plotting software. > > > > That sounds like a project to me. Would you please point me to the > possible > > classes/functions I need to load the eigenvector solutions back into > libMesh > > Yes: NumericVector<>::set() We don't have any "load numeric vector > from file" function, but it shouldn't be too hard to read in a file > and set the coefficients yourself. > > > and to plot them? Currently, for the 2nd order lagrange, I just > concatenate > > the node xyz locations with the the eigenvector solutions, and then plot > > > them in Matlab. > > Okay. If Matlab doesn't have any particular requirements for the > ordering of the points you plot, then it's easy: No, the ordering of the points is not important in matlab plotting, I think. Basically I loaded a matrix that contains x, y, z, eigenvectors as inividual columns and used surface/mesh/line plot. The only requirement is the each xyz physical location is correspondent to the eigenvector solution. Loop over all the elements. On each geometric element, reinit your FE > object with a grid quadrature rule whose order at least equals your > polynomial degree. Get the XYZ coordinates and the solution value at > each quadrature point, and output them. I do this after I load the eigenvector solutions back to libMesh, correct? If I reinit FE object with a grid quadrature rule, how can Imake sure the XYZ coordinates at each quadrature point are the ones correspondent to the loaded eigenvectors? Can I just ouput the xyz at each quadrature point at the element matrices (Ke, Me) assembly step? Output them to a file and concatenate with the eigenvector solutions? Will that work? That will output vertex and edge points multiple times, but the plot > should look the same. If your elements are so large that the plot > still looks faceted, use a quadrature rule with more points. Same question here, if I use a quadrature rule different from the one used to assemble Ke, Me, will the xyz coordinates at the each quadrature point be correctlycorrespondent to the eigenvector solutions with the size of global DOFs? Thanks, David ```
 Re: [Libmesh-users] Get XYZ location of global DOFs From: Roy Stogner - 2006-07-28 21:48:24 ```On Wed, 26 Jul 2006, David Xu wrote: > On 7/26/06, Roy Stogner wrote: > >> Loop over all the elements. On each geometric element, reinit your FE >> object with a grid quadrature rule whose order at least equals your >> polynomial degree. Get the XYZ coordinates and the solution value at >> each quadrature point, and output them. > > I do this after I load the eigenvector solutions back to libMesh, correct? Yes. > If I reinit FE object with a grid quadrature rule, how can Imake sure the > XYZ coordinates at each quadrature point are the ones correspondent to the > loaded eigenvectors? You don't. You're not plotting eigenvector coefficients, you're plotting eigenfunction points. Depending on the finite element space you use, your coefficients may correspond to function points, but they may also correspond to mixed second derivatives, projection magnitudes onto orthogonal function spaces, or the phase of the moon! So forget about trying to plot the coefficients themselves, and just worry about how to plot the function they represent. > Can I just ouput the xyz at each quadrature point at the element matrices > (Ke, Me) assembly step? Output them to a file and concatenate with the > eigenvector solutions? Will that work? No. >> That will output vertex and edge points multiple times, but the plot >> should look the same. If your elements are so large that the plot >> still looks faceted, use a quadrature rule with more points. > > Same question here, if I use a quadrature rule different from the one used > to assemble Ke, Me, will the xyz coordinates at the each quadrature point be > correctlycorrespondent to the eigenvector solutions with the size of global > DOFs? No, they won't. That's why you don't just get the xyz coordinates at each quadrature point, you get the solution value at each quadrature point too. --- Roy ```
 Re: [Libmesh-users] Get XYZ location of global DOFs From: David Xu - 2006-07-27 03:31:28 Attachments: Message as HTML ```On 7/26/06, Roy Stogner wrote: > > On Wed, 26 Jul 2006, David Xu wrote: > > > On 7/26/06, Roy Stogner wrote: > > > >> Loop over all the elements. On each geometric element, reinit your FE > >> object with a grid quadrature rule whose order at least equals your > >> polynomial degree. Get the XYZ coordinates and the solution value at > >> each quadrature point, and output them. I kinda get it, but still vague about how to implement it. Once I load the eigenfunction value points from file to libMesh using NumericVector<>::set(), how does libMesh provide me with the eigenfunction point at requested quadrature point? I think I'm missing something here. I know how to get xyz at requested quadrature point from the examples. > > > I do this after I load the eigenvector solutions back to libMesh, > correct? > > Yes. > > > If I reinit FE object with a grid quadrature rule, how can Imake sure > the > > XYZ coordinates at each quadrature point are the ones correspondent to > the > > loaded eigenvectors? > > You don't. You're not plotting eigenvector coefficients, you're > plotting eigenfunction points. Depending on the finite element space > you use, your coefficients may correspond to function points, but they > may also correspond to mixed second derivatives, projection > magnitudes onto orthogonal function spaces, or the phase of the moon! > So forget about trying to plot the coefficients themselves, and just > worry about how to plot the function they represent. > > > Can I just ouput the xyz at each quadrature point at the element > matrices > > (Ke, Me) assembly step? Output them to a file and concatenate with the > > eigenvector solutions? Will that work? > > No. > > >> That will output vertex and edge points multiple times, but the plot > >> should look the same. If your elements are so large that the plot > >> still looks faceted, use a quadrature rule with more points. > > > > Same question here, if I use a quadrature rule different from the one > used > > to assemble Ke, Me, will the xyz coordinates at the each quadrature > point be > > correctlycorrespondent to the eigenvector solutions with the size of > global > > DOFs? > > No, they won't. That's why you don't just get the xyz coordinates at > each quadrature point, you get the solution value at each quadrature > point too. > --- > Roy > ```
 Re: [Libmesh-users] Get XYZ location of global DOFs From: Roy Stogner - 2006-07-27 14:53:43 ```On Wed, 26 Jul 2006, David Xu wrote: > I kinda get it, but still vague about how to implement it. Once I load the > eigenfunction value points from file to libMesh using > NumericVector<>::set(), how does libMesh provide me with the eigenfunction > point at requested quadrature point? I think I'm missing something here. I > know how to get xyz at requested quadrature point from the examples. See example 13 for how to get solution values at quadrature points. You just sum the basis function falues weighted by the local coefficients from the solution. --- Roy ```