Dear Firedrakers, I've been recently revisiting the "algebraic flux correction" schemes of Dmitri Kuzmin, with the aim of getting a conservative+bounded advection scheme for temperature in our NWP setup. These schemes involve the following steps: 1) Forming the consistent mass matrix (which is column-diagonal) M_C for the temperature space. 2) Constructing the following matrix with the same sparsity as M_C: A_{ij} = (M_C)_{ij}(T_i-T_j) where T_i is the value of temperature at node i. 3) "Limiting" the matrix by replacing A_{ij} -> A_{ij}\alpha_{ij} where \alpha_{ij} depends on various field values at nodes i and j (only needs to be evaluated when nodes i and j share an element). 4) Evaluating Ax where x is the vector containing 1s, and adding x to the RHS of mass-matrix projection equation before solving. My question is: how to implement this in an efficient and parallel-safe way in the Firedrake/PyOP2 framework? In particular, step (3) involves looping over elements, and correcting matrix entries. Also, I'm not sure of the best way to assemble A. all the best --Colin