Use of viscosity data in matrix-free stokes implementation


I am looking to use deal.ii’s multigrid implementation in my own project in a similar way to ASPECT.

I have several finite elements on a cell, and while I want to use matrix-free multi-grid to perform one inverse, I need information from another finite element on the same cell, similarly to how viscosity is used in Stokes here.

I saw there was an “OperatorCellData” Struct that I think plays a role, but I have not seen where it gets used. Could someone point me in the right direction?

Thank you,

This is more a deal.II question, than an ASPECT question, so you might have more luck on the deal.II mailing list.

That said:

  • All code of the matrix-free Stokes solver is in a single .cc file, so you should be able to find where OperatorCellData is used.
  • The access of the data like this works only in our particular case where both matrix-free objects (velocity and pressure) are set up to use the same number of quadrature points and also happen to be iterated over in the same order (this is not guaranteed).
  • A more generic approach would be to use a single MatrixFree object initialized with two DoFHandlers. You can then evaluate coefficients from the second DoFHandler inside the operator.


To give context to Justin’s question (which may indeed be better suited for the deal.II forums, but we’re here already): He needs to build and evaluate a matrix-free representation of the elasticity operator where the coefficients depend on a previous solution. What he needs for that is to be able to say which cell he’s currently on. But what he found so far is only a cell_index, which identifies the cell in “some” way, but doesn’t provide a cell_iterator by which one could query what the coefficient for that cell is.

My extent of knowledge of the matrix-free framework is such that I don’t even know how one would ask a more detailed question :slight_smile:


That is easy, check MatrixFree::get_cell_iterator().

Thank you! I was searching around FEEvaluation.