Applying a displacement on a single vertex

30 views
Skip to first unread message

Rahul Gopalan Ramachandran

unread,
May 30, 2023, 5:10:34 AM5/30/23
to deal.II User Group
Hello All,

I was trying to displace one vertex by a small value. Here is what I thought will work:

dealii::Point<dim> target_point(0,0,0);
double delta = 0.00001;
unsigned int component_num = 0
      unsigned int vertices_per_cell=GeometryInfo<dim>::vertices_per_cell;
     
      // Loop over each locally owned cell
      typename DoFHandler<dim>::active_cell_iterator cell = dof_handler.begin_active(),
                                                     endc = dof_handler.end();
      for (; cell!=endc; ++cell)
        if (cell->is_locally_owned())
          for (unsigned int i=0; i<vertices_per_cell; ++i)
          // Check if the vertex is the target vertex
            if (target_point.distance (cell->vertex(i)) < 1e-2 * cell->diameter())
              {
                unsigned int nodeID=cell->vertex_dof_index(i,component_num);
                constraints.add_line(nodeID);
                constraints.add_entry(nodeID,component_num,delta);
               }  

Is this the right approach? Thanks for any feedback.

Regards,
Rahul

Rahul Gopalan Ramachandran

unread,
May 30, 2023, 9:38:06 AM5/30/23
to dea...@googlegroups.com
I happened to find the solution to my problem also! Sharing in case it is useful for someone else. “set_inhomogeneity” does what I want.

                          constraints.add_line(nodeID);
                          constraints.set_inhomogeneity(nodeID,delta);

I apologize for spaming!

Thank you,
Rahul G. Ramachandran
MPI-pks
Dresden

--
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 a topic in the Google Groups "deal.II User Group" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/dealii/mQV06HcKGv4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to dealii+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/ae68eb86-8512-430e-b17a-feed87c1a52en%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages