Hello,
I’m trying to solve a advection equation \partial_t f+\nabla f=0
after apply FEM, we obtain the weak form (\partial_t f,\phi_i)+(\nabla f,\phi_i)=0
Usually, the second term is assembled as a vector in the linear form.
But I want to use this advection matrix, whose element is computed as a_{ij}=\int_{\Omega}\nabla\phi_j\phi_i\ {\rm d}x
so I create the bilinear form (I work in 2D)
f = TrialFunction(V)
w = TestFunction(V)
C = f.dx(0) * w * dx + f.dx(1) * w * dx
Then I assemble the matrix as I do for the Mass matrix, but the obtained matrix is not correct,
I used a coarse mesh and compute the matrix using my pen, and I think the elements of the matrix are not the correct number
Does anyone have any idea about this question?
Yes this is the same question actually,
now I have obtained this matrix, without any coefficient, but I think the numbers are not correct, so I wonder if that I made any mistake.
I would start with a single cell problem (Unit square with single quadrilateral cell). Then you can verify that a single cell contribution in your assembly is the same.
Note that no-one can really help you debug this as long as you are only sharing snippets of code.