Persson shock sensor, implementation and config


I have a question about the shock detector in FR, I know the method is from “P. O. Persson and J. Peraire. Sub-cell shock capturing for discontinuous Galerkin methods. 44th AIAA Aerospace Sciences Meeting and Exhibit, 2006”. For 1D, Se = log10(<(u - û)²>/<u²>), u is the solution based on orthogonal polynomials, and û is the same solution with one lower truncated order. However, for 2D quadrilateral elements, the solution polynomials are approximated by the tensor product. How to calculate the Se in 2D? where could I find the code to calculate Se in pyFR?


In pyfr these terms are calculated here: PyFR/shocksensor.mako at d311d855418fa62d10f7a99c3de43b898af35a72 · PyFR/PyFR · GitHub

In higher dimensions, I can think of a couple of alternative ways you could do it, but the standard approach is for u\in P^k then u\in P^{k-1}, ie you just compute the energy compared to the basis that you would use for one order lower.

Thank you for your kind reply! However, I still can’t understand the code that calculate Se, i.e.,

. In a 2D cell, should I calculate two values of Se (x direction and y direction)?

No just one is necessary, ivdm is the inverse of the Vandermonde matrix, which is how you can calculate the modal coefficients from the nodal values.

So Se is calculating the energy just in those highest order modes in both x and y combined.

If you have your own code you could try defining different Se values in x and y and using that to make different mu values, but I that isn’t considered the standard Persson approach.

As a side note, @tdzanic’s entropy filtering approach is much better so it might be worth checking out the code in his pull request.