Rajat,
I don't know the answer to this question. You will need to construct a
small testcase with just a few cells that demonstrates the issue and
that people can look at.
> 2. I want to apply boundary conditions on my domain. Lets say that the
> domain is rectangular and I am solving for displacements on this domain.
> I want to fix dofs that correspond to bottom left corner (x and y both
> fixed), and "x dof" on bottom right corner is fixed. Without AMR, I
> get the 3 dofs by looping over cells and even when the mesh moves, the
> dofs are the same. But now, with AMR, the mesh moves as well the dofs
> are changed.
> So, I want to ask that is there any way I can know, the map from the
> vertex/dof in the old configuration to the vertex/dof in the new
> configuration. Configuration here refers to mesh+dofs before and after
> refinement.
You could store the cell->vertex_index() that corresponds to these
corner points at the beginning of the computation. Later, you would then
go over all cells, over all vertices of the cell, and compare the
vertex_index. The vertex_index is a piece of geometric information and
has nothing to do with the DoF index.
> 3. This is most important question of all (for me :), pardon me if I am
> unable to explain this well). [...]
> In such a case, we cannot say that the value at the hanging node (middle
> one) is just the average of the value at the end nodes of the
> single element to begin with.
The argument you are making above is the wrong one. You are thinking in
terms of nodal values and degrees of freedom, but you should be thinking
of functions of x,y that happen to be parameterized by nodal values but
at the end of the day are still just functions.
So, a constraint that says that the sum of the nodal values should be
zero does not make sense. What you want is that the *average* (or
integral) of the function is zero; this happens to be equivalent to the
sum of nodal values if you have a uniform mesh, but on adaptive meshes
the nodes are weighted differently (as are, by the way, nodes at the
boundary).
Similarly, if you want to think of the finite element function as
*continuous*, then the *only way of achieving this* is by requiring that
the hanging node in the middle is the average of the two adjacent ones.
If it does not satisfy this property, then the function is not continuous.
In your example, you are representing the *displacement* as a continuous
function, but the *traction* is related to the derivative of the
displacement and consequently is not, in general, continuous -- so it
should not have hanging nodes, and the 1/2 rule does not apply.