Hi,

I am trying to solve the wave equation using explicit Euler time stepping (for the sake of simplicity) by substituting $\dot{p}= q$.

Thus, I am solving the set of equations summarized in the

attached PDF-file
.

For 1D, I am running the

attached (executable) code
, where at the Dirichlet boundary, the pressure $p(t)=\sin(2 \pi f t)$ with $f=1$Hz is prescribed.

The plots of the

solution of the FEM simulation
and of the

extracted time signals at the Dirichlet BC
at x=0 for $p(t)$ (which is prescribed) and $q(t)$ which is obtained from the simulation look good at first sight. The solution of the wave propagation, i.e. pressure field $p(t)$ is as expected. However, the FEM solution of the auxiliary quantity $q$ is not. But when I am computing the difference quotient from $p(t)$, I get the correct (target) solution for $q(t)$.

Thus, I am wondering if I am using some of the NGSolve utilities wrong or if there is any other reason for that.

I also added results of alternative excitation functions for the Dirichlet BC to the

attachments
. (Somehow I was not able to upload any attechment. Therefore, all I am providing all these hyperlinks. Sorry for that.)

For the 2D case and also for an initial condition (instead of excitation by Dirichlet BC), I get the same behavior (Primary quantity $p(t)$ is right, but the auxiliary quantity $q(t)$ is wrong. However, computing the difference quotient from $p(t)$ yields the correct result.

Best,

Paul