New answers tagged

3

The correct way is to average the source term which you can do easily in this case as you have a polynomial. In general you can do the average with a quadrature. For second order accuracy if the source term is smooth as in your case, you can also just evaluate it at the cell center, which is like mid-point quadrature. It should not matter much in your ...


0

The finite difference scheme also gives exact solution at the nodes to the problem $-u''=1$ because $$ \frac{u_{j-1} - 2 u_j + u_{j+1}}{h^2} $$ is exact for a quadratic function. For the more general case $$ -u''(x) = f(x) $$ if you compute the integral $(f,\phi_i)$ exactly in $P_1$ FEM, it gives exact solution at the nodes. The FD scheme will not be exact ...


Top 50 recent answers are included