The S matrix is a diagonal matrix. The value of this matrix depends on the selected moments. In general, the moments can be classified into three groups: conserved, quasi-conserve, and non-conserved.
-The relaxation values in the S matrix that are related to conserved moments can be set to zero.
-The relaxation values in the S matrix that are related to quasi-conserved moments can be related to macroscopic transport coefficients, such as thermal diffusivity or kinematic viscosity.
-The relaxation values in the S matrix that are related to non-conserved moments can be set close to 1.
In some cases, the stability of the method can be improved by imposing constraints on the relaxation values related to non-conserved moments. These constraints result in relations between the relaxation of the non-conserved moments and the relaxation of the quasi-conserve moments.
For preliminary stability analyses, look at my master thesis.
For more advanced stability analyses, look at the pioneer work of Alexandre Dupuis or Pierre Lallemand.
In addition to what has been said before, the matrix S can of course be set manually. More technically, it can be fixed theoretically through the equivalent partial differential equations resulting from the discrete Boltzmann equation.
You can look at the article below for the explanation of how to obtain the equivalent partial differential equations and the calibration of the relaxation times to improve the consistency of the scheme.