Re: [deal.II] How to find the cell index by using global dof index

2023-12-06 Thread Wolfgang Bangerth

On 12/6/23 15:06, Lance Zhang wrote:
My question is whether I can use NURBS to create the same grids and how I 
could create the grids with the NURBS.


Can you explain what you mean by this? NURBS are basis functions, a mesh is a 
subdivision of a domain into cells. These are not the same thing, so it is not 
clear to me what exactly it is you want to do.


Best
 WB

--

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/602a6874-bf2d-71e2-e226-33f1511cf79b%40colostate.edu.


Re: [deal.II] How to find the cell index by using global dof index

2023-12-06 Thread Lance Zhang
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 
  Point grid_y_transform (const Point _in)
  {
const double  = pt_in[0];
const double  = pt_in[1];
Point pt_out = pt_in;
return pt_out;
  }

  template 
  void Solid::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 top_right =Point(0.0, 0.0, -10);
const Point bottom_left =Point(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::active_cell_iterator cell =
  triangulation.begin_active(), endc = triangulation.end();


for (; cell != endc; ++cell)
  for (unsigned int face = 0;
   face < GeometryInfo::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(_y_transform, 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  于 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  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
>> 
>> .
>>
> --
> 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
> 

Re: [deal.II] How to find the cell index by using global dof index

2023-12-04 Thread Daniel Arndt
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  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
> 
> .
>

-- 
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/CAOYDWbJLsBk2D45tHF4grTeHT%3DejkqQqXMtkLBqB1K-b%3DHbh%2BA%40mail.gmail.com.


[deal.II] How to find the cell index by using global dof index

2023-12-03 Thread Lance Zhang
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.