I have a simple domain having nodal coordinate as follows:
node 1: (0,0)
node 2: (1,0)
node 3: (1,1)
node 4: (0,1)
I want to fix node 1 in the x and y directions, and node 2 in only the y direction.

What you need to do is find out which vertex contains the node you care about, then which DoFs are associated with that vertex, and then which one of these corresponds to the x or y direction.

You'd do this as follows:

for(auto& cell: triangulation.active_cell_iterators())
  for (unsigned int v = 0; v<cell->n_vertices(); ++v)
    if (cell->vertex(v) = {0,0})
     {
       const types::global_dof_index i
         = cell->vertex_dof_index(v,0);    // x-DoF at that vertex
       constraints.add_line(i);
       constraints.add_inhomogeneity(i, 42); // constrain x-DoF to 42
     }
    else if (cell->vertex(v) = {1,0})
     {
       const types::global_dof_index i
         = cell->vertex_dof_index(v,1);    // y-DoF at that vertex
       constraints.add_line(i);
       constraints.add_inhomogeneity(i, 84); // constrain y-DoF to 84
     }

Best
 W.

--
------------------------------------------------------------------------
Wolfgang Bangerth          email:                 [email protected]
                           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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/dealii/a910d33d-4316-0a8f-2dfc-4ea338568f9b%40colostate.edu.

Reply via email to