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

> On May 30, 2023, at 11:10 AM, Rahul Gopalan Ramachandran 
> <grrahul...@gmail.com> wrote:
> 
> 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
> 
> -- 
> 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+unsubscr...@googlegroups.com 
> <mailto:dealii+unsubscr...@googlegroups.com>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/dealii/ae68eb86-8512-430e-b17a-feed87c1a52en%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/dealii/ae68eb86-8512-430e-b17a-feed87c1a52en%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
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/7525778A-CD22-4CF4-9070-429E0911F378%40gmail.com.

Reply via email to