Suppose I have a VectorCoefficient (think a velocity field for an advection equation, $\mathbf{v}\cdot\nabla$). Is there anything built into MFEM to get an adjacency matrix for this coefficient on the mesh, that is, a matrix that shows which elements are connected to which through the coefficient? I want to get an advective-ordering of the mesh, that is, an ordering of elements that the advection field would follow.
Terry and Milan can correct me if I'm wrong, but I don't think there is any built-in functions that are directly useful for this. In the high-order case, the question of ordering may not even be well-posed.
That being said, one way to get a reasonable ordering may be to project the vector coefficient on the lowest-order RT space, whose DOFs are the dot products in with the normals in the centers of the faces. Then you can loop over the shared faces, and use the DOF sign to determine the relative ordering of the two elements.
One easy "out-of-the-box" way of doing this is to assemble the DG advection matrix (just like in example 9) with order = 0 (make sure to use skip_zeros = 1 when assembling).
The graph of the resulting matrix will be the upwind connectivity graph of the mesh.
Thanks guys, both good ideas and good way to test the algorithm
Most helpful comment
One easy "out-of-the-box" way of doing this is to assemble the DG advection matrix (just like in example 9) with
order = 0(make sure to useskip_zeros = 1when assembling).The graph of the resulting matrix will be the upwind connectivity graph of the mesh.