I have a partial differential equatons as shown below. $$\dfrac{d}{dx}((1+x)\dfrac{du(x)}{dx})=0$$ With the following boundary conditions. $$u(0)=0, u(3)=10$$ To solve it using FEM, I multiplied the PDE with residual function then converted it to its weak form.

Then constructed to global matrices using three elements within the global boundary.

Remember that, to solve the matrix system we need to solve following equation. $$[A][u]=[b]+[D]$$ $[D]$ corresponds to the matrix who includes the information about boundary conditions.

Since we do not have a constant on the right hand side on the first equation, we do not have the $[b]$ matrix.

I constructed $[D]$ matrix, as shown below. $$D=\left(\begin{array}{c}(1+x)B \\0 \\0 \\-(1+x)B\end{array}\right)$$

After this point what should I do? How should $1+x$ term affect the imposing Dirichlet BCs to this system?

  • $\begingroup$ you could "enforce" the condition by changing last and first row of the system such that $u_1=0, u_N=10$. Otherwise, you can eliminate the first and last row, as you do in finite differences when you have dirichlet b.c's. In pratcice, this approach would add some term in the second and the $M-1$-row $\endgroup$ – VoB May 3 at 11:04
  • $\begingroup$ But, what about the D matrix? Where will I use the D matrix if I am just using the boundary conditions which are $u(0)=0$ and $u(3)=10$ @VoB $\endgroup$ – Aldrich Taylor May 3 at 11:06
  • $\begingroup$ I was assuming you have the form $Au=b$, storing this additional vector (not matrix) it's not necessary. Anyway, you can write down the first row of the matrix, see what you have to neglect to impose the homogeneous condition. You want to obtain $u_1 =0$ from that row. Same argument applies in the last row $\endgroup$ – VoB May 3 at 11:09
  • $\begingroup$ So you are saying that, if I would have different type of BCs, for example if I would have Neuman BCs then D vector would be important and would be included to the calculations. But in Dirichlet BCs, I dont have to make involve D vector to the calculations. Am I right? @VoB $\endgroup$ – Aldrich Taylor May 3 at 11:15
  • $\begingroup$ For Neumann b.c's, you will find a relation on the first components of the solution vector $u$. You can therefore change the matrix, and some cases (inhomogeneous) you may add some term in the rhs $b$, without any additional vector. Coming back to Dirichlet, what you want is that $u_1=0$. So, make sure that the what comes out from the first row is this condition. For $u_M=10$, you could set to $0$ everything but the last component of the last row of the matrix, and the put $b(M)=10$. This will lead to $u_M=10$ $\endgroup$ – VoB May 3 at 11:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.