So-called "free space" boundary conditions

89 views
Skip to first unread message

smolloy

unread,
Mar 1, 2011, 7:16:54 AM3/1/11
to pyamg-user
I am trying to use a multi-grid technique to solve Poisson's equation
with so-called "free space" boundary conditions. In this calculation,
it is assumed that all of the sources of the potential are contained
within the mesh, and that LaPlace's equation is applicable in the
region outside.

The technique I would like to use may be found here --->
http://ptsg.berkeley.edu/~jhammel/presentation.pdf

In this case, the boundary conditions are not that the potential goes
to zero at the edge of the mesh, but rather that the derivate of the
field matches that found from a truncated solution of Laplace's
equation in the source-free region outside the mesh.

As a newcomer to multigrid techniques, I have no idea how this might
be implemented in PyAMG. Can anyone provide any guidance?

Thanks.

Jacob Schroder

unread,
Mar 2, 2011, 1:00:41 PM3/2/11
to pyamg...@googlegroups.com
Hi,

I believe that the boundary conditions that you're describing should
be handled fine by PyAMG. If you end up only enforcing a condition on
the normal derivative over the domain boundary for Poisson's equation,
the matrix will be singular. But, you should be able to project out
the constant from the current solution guess during each solver
iteration.

With respect to constructing the matrix, PyAMG doesn't do that. PyAMG
only solves resulting linear systems. If you can construct the matrix
in Matlab, then you can save it as a .mat and use scipy.io.loadmat to
get it into Python. Also, you could just convert your Matlab script
to Python to construct your matrix using SciPy/NumPy. If you use
C/C++ to construct your matrix, I'd suggest using Swig to call your
C/C++ routine from Python.

Jacob

> --
> You received this message because you are subscribed to the Google Groups "pyamg-user" group.
> To post to this group, send email to pyamg...@googlegroups.com.
> To unsubscribe from this group, send email to pyamg-user+...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/pyamg-user?hl=en.
>
>

smolloy

unread,
Mar 3, 2011, 3:55:06 AM3/3/11
to pyamg...@googlegroups.com
Jacob,
Thanks for your reply.  It's great to hear the PyAMG should be able to solve my problem.
Unfortunately I am not an expert in solving such problems computationally, and am not really sure how to start.  The example on the top page of the PyAMG Google Code project -- solving a random Poisson problem on a 500x500 grid -- seems very closely related to the problem I want to solve, and your suggestion that I project out the normal derivative from the current solution of each iteration seems like exactly the problem I need to solve.  However, I have no idea how to start with this!!
I am very familiar with Python, and so would really appreciate it if you could point me at the class or method that you think might help me.
With thanks,
Steve

Jacob Schroder

unread,
Mar 4, 2011, 12:47:09 PM3/4/11
to pyamg...@googlegroups.com
Hi Steve,

With respect to solving the matrix, I would suggest following some of
the examples and using the smoothed_aggregation_solver to generate an
AMG hierarchy. When you solve for a given right-hand-side though,
you'll need to set the callback parameter to a function that will
project out the constant (that is, if you only enforce Neumann style
boundary conditions everywhere when you discretize.)

Jacob

smolloy

unread,
Mar 7, 2011, 8:58:26 AM3/7/11
to pyamg...@googlegroups.com
Hi Jacob,
A callback function sounds like exactly the functionality I'll need to solve this.  I'll have a look at some of those examples, and see if smoothed_aggregation_solver can do what I need.
Many thanks for your very useful replies.  I really appreciate your help.
Steve
Reply all
Reply to author
Forward
0 new messages