[deal.II] Re: How to perform polar decomposition for a Tensor<2,dim> in DealII?
On 1/13/23 05:59, 王昆 wrote: Happy new year! I am a DealII amateur from China and need your help! Recently, I want to perform the polar decomposition for a Tensor<2,dim> using DealII. I have searched all the methods provided in Tensor and Physics::Elasticity::Kinematics. But no method could directly perform such operation. It is known that the singular value decomposition could be used for such operation. However, I cannot find similar method for the Tensor, too. Could you give me some tips on how to solve this problem? Dear K. Wang: if I understand you right, for a given d x d tensor A, you want to find factors U and P so that A = UP ? That might indeed not be implemented so far, but it should not be very difficult to do. You will need to write something like this: // 1d case std::pair,Tensor<2,1>> polar_decomposition (const Tensor<2,1> &A) { const Tensor<2,1> U = {{ (A[0][0]>0 ? 1 : -1) }}; const Tensor<2,1> P = {{ std::fabs(A[0][0]) }}; return {U,P}; } // 2d case std::pair,Tensor<2,2>> polar_decomposition (const Tensor<2,2> &A) { Tensor<2,2> U; Tensor<2,2> P; ...compute U, P... return {U,P}; } // 3d case std::pair,Tensor<2,3>> polar_decomposition (const Tensor<2,3> &A) { Tensor<2,3> U; Tensor<2,3> P; ...compute U, P... return {U,P}; } I don't know what algorithms exist for the 2d and 3d cases, but I assume that there is literature. If you were interested in implementing these functions above, we would be very happy to add them to the library! Best Wolfgang -- Wolfgang Bangerth email: bange...@colostate.edu www: http://www.math.colostate.edu/~bangerth/ -- The deal.II project is located at http://www.dealii.org/ For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en --- You received this message because you are subscribed to the Google Groups "deal.II User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to dealii+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/3b390a5f-3736-f1fd-8ccc-661ed7b1e12d%40colostate.edu.
Re: [deal.II] Importing nodal BCs and accessing vertices
On 1/13/23 09:55, Alex Quinlan wrote: Is there a good way to find the global_dof numbers for a vertex/node? No, and it's not just because of mesh refinement, but also because you may want to renumber degrees of freedom as implemented in the DoFRenumbering namespace. For example, if you have a vector displacement problem, you may want to number DoFs in such a way that the three displacements at each node are numbered consecutively, or you may want all x-displacements to be numbered before all y-displacements before all z-displacements. In other words, at least *in general*, there is no way to tell what the mapping from vertex to DoF index is. There is of course also the issue that DoFs live on only vertices only if you are using linear elements. For quadratic elements, they also live on edge and face midpoints. If not, can I iterate through all of the vertices directly (rather than going through the cell)? Something like: for (const auto &vertex : dof_handler.vertex_iterators()) { if (vertex.distance(proot1) < 0.001) { constraints.add_line(vertex->vertex_dof_index(0) ); }} I'm afraid there is no such way, though you can make your life a bit cheaper if you do something along the lines of std::vector vertex_already_handled (triangulation.n_vertices(), false); // loop through all cells for (const auto &cell : dof_handler.active_cell_iterators()) { // loop through all of the vertices in a given cell for (unsigned int v = 0; vn_vertices() ; v++) if (vertex_already_handled[cell->vertex_index(v)] == false) { if (condition) register constraint; vertex_already_handled[cell->vertex_index(v)] = true; } } There is of course also the question of whether you have to do the code snippet above for every imported node, i.e., whether all of the above is enclosed in a loop of the form for (unsigned int boundary_node=0; boundary_nodeIt may be cheaper to move that loop into the loop over all cells, but you're still ending up with a quadratic complexity in the number of cells/boundary nodes. If that turns out to be too expensive, you need to sort your boundary nodes into something like an rtree or similar data structure so that looking up which boundary nodes are close to a cell's vertex becomes substantially cheaper. Best W. -- Wolfgang Bangerth email: bange...@colostate.edu www: http://www.math.colostate.edu/~bangerth/ -- The deal.II project is located at http://www.dealii.org/ For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en --- You received this message because you are subscribed to the Google Groups "deal.II User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to dealii+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/fecc2d5a-d0c6-25fb-9e00-11231d27b403%40colostate.edu.
[deal.II] Importing nodal BCs and accessing vertices
Hi everyone, I am working on adapting some abaqus jobs for deal.ii. In the abaqus format, It is typical to specify boundary conditions in terms of (node number, dof number, magnitude). I have found a working approach for doing this, but I am looking to find a more efficient way as I may end up with millions of nodes and thousands of vertices. Here's an example of how I have been applying nodal displacement BCs: // define a "node" by the coordinates const Point proot1(0., 0.0209, -0.0101); // loop through all cells for (const auto &cell : dof_handler.active_cell_iterators()) { // loop through all of the vertices in a given cell for (unsigned int v = 0; vn_vertices() ; v++) { // check if a vertex is near to the node. if (cell->vertex(v).distance(proot1) < 0.001) // { // apply a constraint constraints.add_line(cell->vertex_dof_index(v,0, cell->active_fe_index() )); } } } In an ideal world, I could compute the global dof number based on the node number and local dof number. Something like: global_dof = node_number * 3 + local_dof constraints.add_line(global_dof) However, I understand that this approach isn't implemented in deal.ii because it would be useless after mesh refinement. Is there a good way to find the global_dof numbers for a vertex/node? If not, can I iterate through all of the vertices directly (rather than going through the cell)? Something like: for (const auto &vertex : dof_handler.vertex_iterators()) { if (vertex.distance(proot1) < 0.001) { constraints.add_line(vertex->vertex_dof_index(0) ); }} I'm interested on your thoughts on how to efficiently import nodal boundary conditions from an external file. I couldn't find any other posts on this specific topic, but I apologize if this is a duplicate. Thanks, Alex -- The deal.II project is located at http://www.dealii.org/ For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en --- You received this message because you are subscribed to the Google Groups "deal.II User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to dealii+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/7a0ff20d-7d25-4b2d-a094-5bccc1388a5fn%40googlegroups.com.