Move vertices in P::D::Triangulation

59 views
Skip to first unread message

RAJAT ARORA

unread,
Nov 16, 2016, 8:19:45 PM11/16/16
to deal.II User Group

Hello all,

I am using parallel::distributed::triangulation, P4est, and Petsc to solve a 3D solid mechanics problem using deal.ii

I am moving my mesh after every time step using the below written code. I have 2 questions regarding this.

template <int dim>
void
PlasticityContactProblem<dim>::
move_mesh
(const TrilinosWrappers::MPI::Vector &displacement) const
{
 std
::vector<bool> vertex_touched(triangulation.n_vertices(), false);
 
for (typename DoFHandler<dim>::active_cell_iterator cell =
 dof_handler
.begin_active();
 cell
!= dof_handler.end(); ++cell)
 
if (cell->is_locally_owned())
 
for (unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell; ++v)
 
if (vertex_touched[cell->vertex_index(v)] == false)
 
{
 vertex_touched
[cell->vertex_index(v)] = true;
 
Point<dim> vertex_displacement;
 
for (unsigned int d = 0; d < dim; ++d)
 vertex_displacement
[d] = displacement(cell->vertex_dof_index(v, d));
 cell
->vertex(v) += vertex_displacement;
 
}
}
 

Deal.ii keeps a full copy of the coarse mesh on each processor.


1. After the p:d:triangulation is created and triangulation.global_refine(2) is used, the locally owned cells on each mesh will divide in 2^dim elements each but does that also mean that the ghost cells or artificial cells on each processor also gets  refined ?

2. To move the ghost cells on the domain as well, is it just sufficient to replace the if condition above  with

if (cell->is_locally_owned())  => if (cell->is_ghost())   ?

and the displacement is a ghosted vector.






Daniel Arndt

unread,
Nov 17, 2016, 7:15:24 AM11/17/16
to deal.II User Group
Rajat,


1. After the p:d:triangulation is created and triangulation.global_refine(2) is used, the locally owned cells on each mesh will divide in 2^dim elements each but does that also mean that the ghost cells or artificial cells on each processor also gets  refined ?
All ghost cells look the same as on the owning processor while this is not true for artificial cells. When the mesh is refined a new partitioning between processors is used. Therefore, ghost cells and artificial are not really refined but set accordingly after the mesh is refined.
 
2. To move the ghost cells on the domain as well, is it just sufficient to replace the if condition above  with
if (cell->is_locally_owned())  => if (cell->is_ghost())   ?
and the displacement is a ghosted vector.
You don't need to do this yourself. If you are using a parallel::distributed Triangulation and move vertices that are in someone's ghost layer, you should call
Triangulation::communicate_locally_moved_vertices [1] to have a consistent mesh. You need to be careful if you want to refine the mesh
after you have moved vertices as noted in the documentary of that function.

Best,
Daniel

[1] https://www.dealii.org/8.4.1/doxygen/deal.II/classparallel_1_1distributed_1_1Triangulation.html#a247598f1323a9f847832e60d6c840469

RAJAT ARORA

unread,
Nov 22, 2016, 2:01:35 PM11/22/16
to deal.II User Group

Thanks Daniel,

I implemented this and it solved the issue that I was having.

Just a small question, instead of using Triangulation::communicate_locally_moved_vertices , there is no harm in moving
all locallyOwnedCells and ghost cells by one self. Right ?

huyanzhuo

unread,
Oct 5, 2019, 11:40:49 AM10/5/19
to deal.II User Group
hello!

in the documentation , it's said in the case of mesh with moved vertices is refined a few step later, should do as follows:
1. save the offset applied to every vertex,
2. call communicate_locally_moved_vertices function
3. apply the opposite offset
4. call communicate_local refining or coarsening the meshly_moved_vertices function
5.  refining or coarsening the mesh

i don't quite understand the 5 step. 
1. what's the meaning of offset here? is it the move vector for every vectices in this step, or the whole move vector which will make the mesh return to original mesh?
2. we add the opposite offset , does this means we need apply the offset again after  refining or coarsening ?
在 2016年11月17日星期四 UTC+8下午8:15:24,Daniel Arndt写道:

Daniel Arndt

unread,
Oct 5, 2019, 12:13:52 PM10/5/19
to dea...@googlegroups.com
huyanzhou,

in the documentation , it's said in the case of mesh with moved vertices is refined a few step later, should do as follows:
1. save the offset applied to every vertex,
2. call communicate_locally_moved_vertices function
3. apply the opposite offset
4. call communicate_local refining or coarsening the meshly_moved_vertices function
5.  refining or coarsening the mesh

i don't quite understand the 5 step. 
1. what's the meaning of offset here? is it the move vector for every vectices in this step, or the whole move vector which will make the mesh return to original mesh?
 
The offset is the total move vector that will make the mesh return to its original state. Only the mesh without any displacements has valid positions for all the cells (including artificial ones).

2. we add the opposite offset , does this means we need apply the offset again after  refining or coarsening ?

Yes. The offset vector should be transferred to the new mesh via SolutionTransfer. Then you can apply it again.

An alternative to moving the vertices is using MappingFEField or MappingQEulerian.

Best,
Daniel
Reply all
Reply to author
Forward
0 new messages