Hello Daniel,

thanks for your message.

I know how to find the cell index.



Could I ask one more question?

The question is about the grid.

In code I used the function below to create the grid.

 template <int dim>
  Point<dim> grid_y_transform (const Point<dim> &pt_in)
  {
    const double &x = pt_in[0];
    const double &y = pt_in[1];
    Point<dim> pt_out = pt_in;
    return pt_out;
  }

  template <int dim,typename NumberType>
  void Solid<dim,NumberType>::make_grid()
  {
    // Divide the beam, but only along the x- and y-coordinate directions
    std::vector< unsigned int > repetitions(dim,
parameters.elements_per_edge);
    // Only allow one element through the thickness
    // (modelling a plane strain condition)
    if (dim == 3){
     repetitions[dim-1] = 8;

    //repetitions[0] = 0;
    //repetitions[1] = 2;
    //repetitions[2] = 2;
    }

    repetitions[1] = 8;
    repetitions[2] = 8;
        const Point<dim> top_right =Point<dim>(0.0, 0.0, -10);
        const Point<dim> bottom_left =Point<dim>(40,20, 10);
        GridGenerator::subdivided_hyper_rectangle(triangulation,
                                              repetitions,
                                              bottom_left,
                                              top_right);

    // Since we wish to apply a Neumann BC to the right-hand surface, we
    // must find the cell faces in this part of the domain and mark them
with
    // a distinct boundary ID number. The faces we are looking for are on
the
    // +x surface and will get boundary ID 11.
    // Dirichlet boundaries exist on the left-hand face of the beam (this
fixed
    // boundary will get ID 1) and on the +Z and -Z faces (which correspond
to
    // ID 2 and we will use to impose the plane strain condition)
    const double tol_boundary = 1e-6;
    typename Triangulation<dim>::active_cell_iterator cell =
      triangulation.begin_active(), endc = triangulation.end();


for (; cell != endc; ++cell)
      for (unsigned int face = 0;
           face < GeometryInfo<dim>::faces_per_cell; ++face)
        if (cell->face(face)->at_boundary() == true)
          {
            if (std::abs(cell->face(face)->center()[0] - 0.0) <
tol_boundary)
              cell->face(face)->set_boundary_id(1); // -X faces
            else if (std::abs(cell->face(face)->center()[0] - 40.0) <
tol_boundary)
              cell->face(face)->set_boundary_id(11); // +X faces
            else if (dim == 3 &&
std::abs(std::abs(cell->face(face)->center()[2]) - 10) < tol_boundary)
              cell->face(face)->set_boundary_id(2); // +Z and -Z faces
          }


    // Transform the hyper-rectangle into the beam shape
    GridTools::transform(&grid_y_transform<dim>, triangulation);

    GridTools::scale(parameters.scale, triangulation);

    vol_reference = GridTools::volume(triangulation);
    vol_current = vol_reference;
    std::cout << "Grid:\n\t Reference volume: " << vol_reference <<
std::endl;
  }


My question is whether I can use NURBS to create the same grids and how I
could create the grids with the NURBS.


Thanks in advance!

Best regards
Lance

Daniel Arndt <d.arndt.m...@gmail.com> 于 2023年12月4日周一 16:08写道:

> Lance,
>
> Have a look at GridTools::vertex_to_cell_map(
> https://www.dealii.org/current/doxygen/deal.II/namespaceGridTools.html#a9b7e2ca8ecd26a472e5225ba91a58acb
> ).
>
> Best,
> Daniel
>
> On Sun, Dec 3, 2023 at 11:38 PM Lance Zhang <dimo...@gmail.com> wrote:
>
>> Hello team,
>>
>> may I know how to find the cell index with the information of its global
>> Dofs index?
>>
>> I have the global dofs index ,I would like to find which cell this global
>> dof belongs to.
>>
>> Thanks in advance!
>> Best regards
>> Lance
>>
>> --
>> 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/4453e03d-2511-43c4-a05d-71e695a9276cn%40googlegroups.com
>> <https://groups.google.com/d/msgid/dealii/4453e03d-2511-43c4-a05d-71e695a9276cn%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 a topic in the
> Google Groups "deal.II User Group" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/dealii/U7Il_6jPOCQ/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> dealii+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/dealii/CAOYDWbJLsBk2D45tHF4grTeHT%3DejkqQqXMtkLBqB1K-b%3DHbh%2BA%40mail.gmail.com
> <https://groups.google.com/d/msgid/dealii/CAOYDWbJLsBk2D45tHF4grTeHT%3DejkqQqXMtkLBqB1K-b%3DHbh%2BA%40mail.gmail.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/CADwW6PmWW7%2BtK%2BLe_oWmEQ0rWG51%3DV0E_%3D4i4_NKEqCRjHcFfQ%40mail.gmail.com.

Reply via email to