Take the 2-minute tour ×
Computational Science Stack Exchange is a question and answer site for scientists using computers to solve scientific problems. It's 100% free, no registration required.

I'm having trouble understanding how to code 2-D Poisson's Equation with Dirichlet boundary conditions. What I have thus far is

  1. Constructed square mesh with triangular elements
  2. Assembled stiffness matrix. The function for this also gives the area of each element (all same, since square).
  3. Use Gaussian Quadrature to construct the right hand side.

edit: I may have been a little vague in my question. Hopefully this is a better rephrasing: Separate from FE, my code for gaussian quadrature works just fine. However, I don't understand how gaussian quadrature can even be relevant/involved with obtaining a solution to 2D Poisson; hence, I don't know how to continue coding.

share|improve this question
    
It would be helpful to have more information on what you have tried and what exactly you can't make work. –  Wolfgang Bangerth Feb 19 '13 at 5:04
    
@WolfgangBangerth Well, my question isn't so much coding. I'm not sure how Gaussian quadrature is involved, i.e. how or even why it plays a role. –  AlanH Feb 19 '13 at 5:08
    
This is a different question but may be helpful (also on Dirichlet conditions): scicomp.stackexchange.com/questions/5072/… –  Nathan Collier Feb 19 '13 at 10:29
1  
Well, what I'm saying is that I simply don't understand your question. You say you have Gaussian quadrature working but that you don't know how to "implement that into 2D Poisson". Would it be correct to say that you know how Gaussian quadrature works but you simply don't know how quadrature is relevant to the solution of PDEs with the finite element method? –  Wolfgang Bangerth Feb 20 '13 at 0:12
    
@WolfgangBangerth Ah. I apologize. I wasn't sure how to phrase the question accurately to begin with. So, separate from FE, my code for Gaussian quadrature works. However, in regards to 2D Poisson, as you put, I'm not sure how it is relevant to the solution of 2D Poisson. I hope that clarifies my issues. –  AlanH Feb 20 '13 at 2:18

1 Answer 1

up vote 2 down vote accepted

In the finite element method, you need to compute matrix entries (here in the case of the Laplace equation) $$ A_{ij} = \sum_K \int_K \nabla\varphi_i \cdot \nabla \varphi_j $$ and right hand side entries $$ F_{i} = \sum_K \int_K \varphi_i(x) f(x) $$ where $K$ are the cells of the mesh. The former can sometimes be computed analytically, but depending on the form of $f(x)$ in the latter, you may not be able to do that. If you can't analytically compute an integral, you use quadrature.

I don't know if it's a shameless plug, but I've actually recorded a video lecture on this topic -- see lecture 4 here: http://www.math.tamu.edu/~bangerth/videos.html

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.