How to create the advection matrix

Isn’t this question very similar to: Is it possible to create a matrix with linear form - #4 by dokken

I.e. use trial functions for f instead of a Function. Then you can post-multiply by the f coefficients.