Hello,

Thank you for the reply. I'm not sure I follow though. 


*This will not work unless you have a discontinuous FE because you will 
betouching DoFs twice.*
What is meant by touching the dofs twice?
The general idea was:
1. The mesh is comprised of stationary and rotary parts. For example, a 2D 
cylinder is the stationary part and the inner circle of the cylinder is the 
rotary part. 
2. Vertices on the rotating boundary are spaced equidistant along the 
boundary.
3. For all cells that have vertices on the rotating boundary, and that are 
part of the either stationary or rotary part of the mesh, remap the 
local_dof_index to correspond to a dof_index on the rotating boundary an 
integer *offset *away from the local_dof_index when numbered along the 
periphery of the rotating boundary. This is done during assembly into the 
global matrix. 

Visualization: https://www.youtube.com/watch?v=Vk__d9avLyE . The 
visualization of the solution on the first layer of elements on the 
rotating boundary that are found in the stationary part is in this case 
incorrect. This is due to no local_dof_index remapping implemented during 
visualization. Never though, the field is correct in all other cells.
The concept described works but has drawbacks and is hard to debug. One 
drawback is that the resolution of the rotation is prescribed by the 
distance between vertices on the rotary boundary and the distances have to 
be equidistant. Next I will next try to simplify the process by having 2 
separated triangulations, performing rotation on one, merging and 
proceeding as usual. This should work correctly as a reference solution 
before trying more advanced methods. Eventually, I'd like to have as an 
input a rotation angle of the rotating mesh, rather than an integer offset. 


*A better way is to simply set up a permutation vector mapping old to new 
DoFindices and calling DoFHandler::renumber_dofs().*
In this context I think this wouldn't work, since this would renumber the 
dofs for both the outside and inside cells sharing the vertex. If I'm not 
mistaken.

Is there any standard way of implementing wanted behavior without touching 
the mesh?

Best regards!
- Gordan


On Monday, July 24, 2023 at 5:10:22 AM UTC+2 Wolfgang Bangerth wrote:

> On 7/23/23 06:16, Gordan Šegon wrote:
> > 
> > I am trying to remap dof indices of certain cells before assembly using 
> the 
> > following (sketch code):
> > 
> >     ...
> >     const unsigned int dofs_per_cell = fe.n_dofs_per_cell();
> >     // Iterate over cells and remap dofs on marked cells
> >     for (auto& cell : dof_handler.active_cell_iterators()) {
> >         std::vector<types::global_dof_index> 
> local_dof_indices(dofs_per_cell);
> > 
> >         if ( /* cell marked for remapping */ ){
> >             fe_values.reinit(cell);
> >             cell->get_dof_indices(local_dof_indices);
> > 
> >     for (auto &local_dof_index: local_dof_indices)
> > local_dof_index = custom_remap_function(local_dof_index);
> > 
> >             cell->set_dof_indices(local_dof_index);
> >         }
> >     }
>
> This will not work unless you have a discontinuous FE because you will be 
> touching DoFs twice.
>
> A better way is to simply set up a permutation vector mapping old to new 
> DoF 
> indices and calling DoFHandler::renumber_dofs().
>
> Best
> W.
>
> -- 
> ------------------------------------------------------------------------
> Wolfgang Bangerth email: bang...@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/9317105c-24e5-4371-9c77-4861fc4fbbc1n%40googlegroups.com.

Reply via email to