From: Yuxiang W. <yw...@vi...> - 2018-11-03 05:01:43
|
Hi David, Thank you for your response! Yes I was indeed reading your example and thinking about it. Your insight helps a lot. Thank you so much! Since we are discussing on this topic, if you wouldn't mind, I'd like to ask one more question: During the L2 projection process, we solved the system per element. If we assemble the element mass matrices and the RHS to a global one with all elements, and similarly solve the global equation, would we be getting a globally smoothed stress distribution? I'd really love to hear your comment. Thanks in advance! Best, Shawn On Fri, Nov 2, 2018 at 7:27 PM David Knezevic <dav...@ak...> wrote: > On Fri, Nov 2, 2018 at 9:50 PM Yuxiang Wang <yw...@vi...> wrote: > >> Dear all, >> >> I have been using the matrix notation (following the Bathe textbook) with >> libmesh recently to code finite element solutions for basic continuum >> structural elements. I realized that I need to compute those matrices >> twice >> - once when I assemble the global stiffness matrix, and another time when >> I >> get the solutions and need to post-process to compute the >> stresses/strains. >> Being curious, do we have any best practices (or special considerations) >> to >> save those matrices so that we don't have to compute them twice? For >> example, should I just create a huge vector of DenseMatrix, and each >> matrix >> for each quadrature point? Or that libmesh has some tools for this book >> keeping? >> >> Explanation for what I meant by "matrix notation" and what are those >> finite >> element matrices: for example, for each quadrature point I have an >> interpolation matrix [H], a strain-displacement matrix [B] (constructed >> from derivatives of [H]). With the constitutive tensor matrix being [C], >> we >> can easily get the element stiffness matrix by [K] = >> integrate([B]^T[C][B]). After the solution [uhat] is obtained, we can also >> get the strain and stress by again [strain] = [B][uhat] or [stress] = >> [C][B][uhat]. >> >> Just wondering whether anyone else has done this before and whether there >> would be a better practice to do it more elegantly. Thanks :) >> >> Best, >> Shawn > > > See systems_of_equations_ex6 for an example of computing stresses in > libMesh. In that case we do not store and re-use the per-element strain and > stress matrices (C and B in your notation) You could store and reuse that > data, but it's not clear to me whether it'd be worth it. You'd presumably > get some speedup in the evaluation of the stress at the cost of extra > storage, so you'd have to decide if you want that or not (in my experience > I would not want that since memory is usually more of a limiting factor > than speed). > > Best, > David > -- Yuxiang "Shawn" Wang, PhD yw...@vi... +1 (434) 284-0836 |