# two questions related to DG

Hello,
I have two questions related to DG.

Q1: what is the “density” argument rho in L2 space SolveM? In the attached testMass.py code, I found there is no difference changing rho when applying SolveM…
I thought the mass matrix should be (rho u, v)…

Q2: It seems there is a bug in the normal direction in 1D, as I found it is always equal to 0 on the interface…

best regards,
Guosheng

Attachment: testMass.py

Attachment: testNormal_2018-03-25.py

Hi,

[quote]Q1: what is the “density” argument rho in L2 space SolveM? In the attached testMass.py code, I found there is no difference changing rho when applying SolveM…
I thought the mass matrix should be (rho u, v)…[/quote]
As far as I know, the density was meant as you tried to use it. But up to now, nobody implemented it, thus the density is not used at all. I’ll see if we can add this functionality.

This just happens for “order=0”. I’ll check that.

Best,
Christoph

Hi again,

[quote] Q2: It seems there is a bug in the normal direction in 1D, as I found it is always equal to 0 on the interface…
[/quote]
The normals should be fine if your ngsolve version is new enough. There was a fix for the normals in 1d lately.
Assuming your version is new enough, your still gives a zero-matrix and that’s correct!

``a += SymbolicBFI(n*u*v, element_boundary = True)``

The BFI integrates over the two boundaries of each 1d element. For “order=0” this means it sums up a “+1” from the right and a “-1” from the left boundary.
In this case you could use the skeleton form.

``a += SymbolicBFI(n*u*v, skeleton = True)``

Best,
Christoph

Thanks. I haven’t update ngsolve for a while… The normal is working now.

Hi Guosheng,

the density coefficient rho was indeed not used. It is working now (i.e. in the coming nightly release).

Best, Joachim

Joachim,
Thanks for the info.
I am interested how it was solved when rho is a variable coefficient function, this shall be the same situation as curved mesh. In this case, mass matrix inversion might be expensive… Do you use the Jacobi preconditioner?

Best,
Guosheng

Hi Guosheng,

You are right, variable coefficients and curved elements (non-constant Jacobians) are treated the same way. Instead of solving with a mass matrix with coefficient rho, we apply a mass matrix with coefficient 1/rho. Everything is calculated on the fly without computing mass matrices. This trick is explained in this paper:

C Koutschan, C Lehrenfeld, J. Schöberl: Computer Algebra meets Finite Elements: an Efficient Implementation for Maxwell’s Equations in: Numerical and Symbolic Scientific Computing: Progress and Prospects, Ulrich Langer and Peter Paule (ed.), pp. 105-122. 2011. Springer, Wien, [1104.4208] Computer Algebra meets Finite Elements: an Efficient Implementation for Maxwell's Equations

Best,
Joachim

I see… very interesting! Thanks for the reference

This reminds me the low-storage DG or weight-adjusted DG method of Tim Warburton. Although he used a nodal basis…