Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: pde toolbox
Replies: 13   Last Post: Apr 23, 2013 4:29 PM

 Messages: [ Previous | Next ]
 srao Rao Posts: 29 Registered: 7/16/10
Re: pde toolbox
Posted: Mar 16, 2013 1:10 PM

Hi Bill,

There is a follow up question to the one listed below. I am using the following method to solve my elliptic problem:

I create a geometry 'g'.
I then mesh it: [p,e,t] = initmesh(g);
Then I create my boundary matrix using [Q,G,H,R] = pdebound(p2,e2);
I then assemble other matrices using [K,M,F] = assema(p,t,c,a,f);
Finally I solve the problem using u = assempde(K,M,F,Q,G,H,R);

I get the following error from assempde
------------------------------------------
??? Error using ==> plus
Matrix dimensions must agree.

Error in ==> assempde at 245
KK=K+M+Q;
------------------------------------------
As per the link below the size of the Q matrix in the boundary file is (N^2 ne) which for a one-dimensional system is (1 ne), where ne is the number of edges in the mesh.

http://www.mathworks.com/help/pde/ug/boundary-conditions-for-scalar-pde.html

However the size for the K and M matrices is (Np Np) where Np is the number of nodes in the matrix.

So I see that the K matrix and Q matrix are not of the same dimensions and hence the error. I am not able to figure out how to fix this problem. Any help will be appreciated very much.

Thank you.

"Bill Greene" wrote in message <khfgev\$sgb\$1@newscl01ah.mathworks.com>...
> Hi,
>
> "Sashankh Rao" wrote in message <khdu9o\$j3c\$1@newscl01ah.mathworks.com>...

> > Using the Matlab pde toolbox I obtain a solution to the Poisson equation for a given geometry using dirichlet boundary conditions. First, I want to determine the gradient at all the boundary nodes. Is this possible using the toolbox? Second, I want to use these gradient values as an input boundary condition for the same boundary to solve a different equation (same geometry). Is this possible to do using the toolbox? Thanks.
>
> Yes, this is definitely possible. I'll try to point you in the right direction.
>
> The function pdegrad can be used to calculate the gradient of the solution at the
> element centroids.
> Then the function pdeprtni can be used to interpolate these centroid values back
> to the nodes.
> http://www.mathworks.com/help/pde/ug/pdeprtni.html
>
> Using these gradient values in the boundary conditions will require you to write your
> own boundary condition function, referred to as a "boundary file" in the PDE
> Toolbox documentation.
> http://www.mathworks.com/help/pde/ug/pdebound.html
>
> This documentation page has some examples of how to write such a function.
> http://www.mathworks.com/help/pde/ug/boundary-conditions-for-scalar-pde.html
>
> Bill

Date Subject Author
3/8/13 srao Rao
3/9/13 Bill Greene
3/11/13 srao Rao
3/16/13 srao Rao
3/16/13 Bill Greene
3/17/13 srao Rao
3/25/13 srao Rao
3/25/13 srao Rao
3/28/13 Alan Weiss
4/22/13 srao Rao
4/23/13 Alan Weiss
4/23/13 srao Rao
4/23/13 Bill Greene
4/23/13 srao Rao