implement a limiter in c++

Hi guys,

I am playing with DG methods for compressible flow.
As a first step, to make the code work, I am implementing the positivity-preserving limiter of Zhang and Shu

For this limiter, I need to loop over the elements, and access grid function’s cell-average and its evaluation at certain quadrature points, and modify the high-order d.o.fs properly to avoid negativity.
In the attached file, I am solving the double mach reflection problem, the pp limiter is naively implemented in python, which is very slow.

I am hoping a c++ implementation of the loop will speed-up the code, but do not have a clear idea how to proceed, given my limited c++ experience. Any suggestion is welcome.



Hi Guosheng,

yes you are right, working with shape functions in Python is extremely slow.

the best start into NGSolve C+±programming are the MyLittleNGSolve tutorials from here:

start with 1_Basic.

the one best suited for you is 3_Legacy, linhypDG.cpp, where a DG time-stepping is implemented.

best, Joachim