> /This will not work unless you have a discontinuous FE because you will be
> touching DoFs twice./
> What is meant by touching the dofs twice?
In your original code snippet, you loop over all cells and on each cell
you renumber all DoF indices of DoFs that live on that cell.
But take a mesh with 4 cells and a Q1 element as an example. Now
consider the following picture:
0--1--2
| | |
3--4--5
| | |
6--7--8
Say you're starting with the bottom left cell. Then you're renumbering
DoFs 3,4,6,7 to whatever new numbers you want to assign them. Say it is
0,1,2,3, and you get the following picture:
0--1--2
| | |
0--1--5
| | |
2--3--8
The next cell is the bottom right cell. Note that if you apply the same
algorithm again, you would renumber the two DoFs on the interface
(originally 4,7, now 1,3) *a second time*.
This is not correct. You have to keep track which DoFs you have already
translated -- which is of course exactly what
DoFHandler::renumber_dofs() does.
> 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.
I don't understand how that is supposed to work. You assume that there
is an abstract degree of freedom and that cells can arbitrarily
reference that degree of freedom. But that is not the case in deal.II.
For continuous elements such as Q1, the degree of freedom is associated
with a specific vertex, and each of the adjacent cells use this DoF. If
two cells share a vertex, then they also share a unique DoF -- you
cannot break this.
There are ways to work around this. For example, you could use the hp
framework (step-46) and use one field on the inside and one field on the
outside, and then compute constraints that ensure what you want to do.
Or you use discontinuous elements right away. But you can't use a single
field with continuous elements for both inside and outside.
> /A better way is to simply set up a permutation vector mapping old to
> new DoF
> indices 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.
Yes. But as I mention above, you can't do it separately.