How do I apply filtering for dynamic Smagorinsky model for LBM?

I managed to implement my turbulence model using a constant Smagorinsky model which works at high Reynolds number. However, I am trying to implement the turbulence model but it requires me to filter my f-distribution first. How do I apply this filtering (trapezoidal) as I have no experience with the filtering process used in NS-LES? Do I have to apply the filtering at every timestep? Additionally, do I apply the filter on the microscopic or macroscopic variables?

In particular, how do I use this equation,
f_bar=\int{f*G_bar}dx
where f_bar is filtered quantities and G_bar is the filter transfer function.

Filtering is basically a weighted average on neighbors. Try to look in the litterature for how filtering works.