Great, in that case it's working fine - the interfacing with the jdsym module 
is straightforward.

Thanks!
John

On May 11, 2010, at 3:58 PM, Daniel Wheeler wrote:

> 
> It's a FV matrix. It's integrated over space. Space, in this case, is 1D.
> 
> On Tue, May 11, 2010 at 3:41 PM, John Gamble <[email protected]> wrote:
>> 
>> Hi again,
>> 
>> When using the getMatrix() routine as Daniel suggested, I'm not sure exactly 
>> what difference matrix fipy is pulling. As a simplified 1D example of a 
>> particle in an infinite well:
>> 
>> nx = 5
>> dx = 1
>> mesh = Grid1D(nx = nx, dx = dx)
>> psi = CellVariable(name='solution variable', mesh = mesh, value = 0.)
>> valueLeft = 0
>> valueRight = 0
>> BCs = (FixedValue(faces=mesh.getFacesRight(), value=valueRight),\
>>                FixedValue(faces=mesh.getFacesLeft(), value=valueLeft))
>> eqn = -ImplicitDiffusionTerm(coeff=mass)==0
>> eqn.cacheMatrix()
>> eqn.solve(var = psi, boundaryConditions=BCs)
>> pymat = eqn.getMatrix().matrix
>> 
>> gives the correct sparse differencing matrix:
>> 
>> 3.000000 -1.000000  --------  --------  --------
>> -1.000000  2.000000 -1.000000  --------  --------
>> -------- -1.000000  2.000000 -1.000000  --------
>> --------  -------- -1.000000  2.000000 -1.000000
>> --------  --------  -------- -1.000000  3.000000
>> 
>> However, if I turn the step size to dx=0.1, I get:
>> 
>> 30.00000 -10.00000  --------  --------  --------
>> -10.00000  20.00000 -10.00000  --------  --------
>> -------- -10.00000  20.00000 -10.00000  --------
>> --------  -------- -10.00000  20.00000 -10.00000
>> --------  --------  -------- -10.00000  30.00000
>> 
>> The actual difference matrix should have a factor of (1/dx^2), not (1/dx) in 
>> front of it, which results in eigenvalues that have to be rescaled. Of 
>> course, the problem is easy to fix, but I would love to know where the 
>> factor of 1/dx is going.
>> 
>> Many thanks,
>> John
>> 
>> On May 3, 2010, at 2:59 PM, John Gamble wrote:
>> 
>>> 
>>> Thanks, Daniel. I'll give that a try!
>>> 
>>> On Mon, 2010-05-03 at 11:03 -0400, Daniel Wheeler wrote:
>>>> Hi John, You'll need to interface with pysparse directly. Using
>>>> 
>>>>   <http://pysparse.sourceforge.net/jdsym.html#eigenvalue-solver>
>>>> 
>>>> You can get the pysparse matrix for you problem by doing
>>>> 
>>>>   eqn.cacheMatrix()
>>>>   eqn.solve(...)
>>>>   pysparseMatrix = eqn.getMatrix().matrix
>>>> 
>>>> You'll have to figure how to pass it to the jdsym module. I am not
>>>> sure how to do that. Hope this helps. Cheers.
>>>> 
>>>> On Sun, May 2, 2010 at 11:31 PM, John Gamble <[email protected]> wrote:
>>>>> 
>>>>> Dear all,
>>>>> 
>>>>> I am attempting to use fipy to solve a coupled system consisting of the
>>>>> Poisson and Schroedinger equations. To solve the Schroedinger equation,
>>>>> I need to solve an eigenvalue problem to find allowed energies. Is there
>>>>> a way to tell fipy to search for the required eigenvalues?
>>>>> 
>>>>> Many thanks,
>>>>> John Gamble
>>>>> 
>>>>> 
>>>>> 
>>>> 
>>>> 
>>>> 
>>> 
>>> 
>>> 
>> 
>> 
>> 
> 
> 
> 
> -- 
> Daniel Wheeler
> 
> 



Reply via email to