MATLAB Answers

Why use triangular mesh when solving poisson equation in pde toolbox?

4 views (last 30 days)
Max
Max on 30 Dec 2013
Commented: Max on 27 Jan 2014
Hello guys. I have this question when I am trying to solve poisson equation in matlab. Why use triangular mesh when solving poisson equation in pde toolbox? e.g. poisolv And how do I convert my data in rectangular mesh to triangular mesh? Because I only found the reverse, which is tri2grid(). The problem I have now is that I do not have a closed expression for the function on the right hand side. What I have is numerical, i.e. a matrix in rectangular mesh. How could I modify the fast poisson solver to satisfy my needs? Thanks!

  0 Comments

Sign in to comment.

Accepted Answer

Bill Greene
Bill Greene on 30 Dec 2013
Hi,
Because your domain is rectangular, you can use the poimesh function to generate a "regular" triangular mesh on that domain-- i.e. one that looks like your rectangular mesh except each cell has a diagonal across it.
Since your f-coefficient is defined from numerical data, you will need to write a MATLAB function to define f. That is described on this page:
That page also describes how to use the pdeintrp to interpolate your numerical data from the nodes (i.e. your rectangular grid) to the centroids of the triangular elements where f must be defined.
Bill

  3 Comments

Max
Max on 30 Dec 2013
Hi Bill,
Thank you very much for the response! I think I am getting to understand the idea, but may I avoid defining a fixed function from the beginning? Because the right hand side is not fixed, but is gotten from measurement.
Thanks!
Bill Greene
Bill Greene on 31 Dec 2013
You can certainly define your f-coefficient matrix and then pass that to poisolv, if you like. Or you can create a function that poisolv will call. That is described on the documentation page I listed above. For this particular example, I think one approach will work as well as the other.
Bill
Max
Max on 27 Jan 2014
Hi Bill,
I ended up using the assempde function because the equation that i was trying to solve was exactly that form. Your answer helped a lot.
Now I am trying to define my own Dirichlet boundary condition based, again, on numerical data. The function assempde only accepts boundary condition matrix or boundary condition file, but I am confused how to customize it. Do you know how i can customize that? Thank you!
Max

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!