Dear FiPyers,

A few problems/confusions I am having:

1) I am a bit confused about using ImplicitSourceTerm. I thought the idea was that you could linearize a non-linear term and have control over what parts were placed in the matrix. Thus, I would have thought that if I set:

K = DiffusionTerm()
A = CellVariable(...)
B = CellVariable(...)
..
X = CellVariable(..., hasOld=1)

eq = K + A*X == B

then eq.solve(X) solve etc. would do something like

X -> K^{-1}(B - A*X)

but

eq = K + ImplicitSourceTerm(A) == B

would do

X -> (K + A)^{-1}B

(However, it does not seem to do this: A still gets put on the RHS...)

How do I get control over the formation of the matrix so I can explicitly solve the linear portion of the problem?

2) The ability to couple equations with & (or possibly +), and by specifying variables looks really nice, but does not seem to appear anywhere in the documentation. Is there anything I should be aware about trying to use this?

I.e.

eq_x = DiffusionTerm(var=X) + ImplicitSourceTerm(B,var=Y) == D
eq_y = DiffusionTerm(var=Y) + ImplicitSourceTerm(C,var=Y) == E
eqs = eq_x & eq_y
eqs.solve()

Again, I was hoping to have enough control to ensure that this would try to solve

[X] = [K, B]^{-1} [D]
[Y]   [C, K]      [E]

3) If FiPy itself cannot do this, is there an easy way of extracting the matrices so I can solve them myself? In particular, I don't really want to have to run through a whole solver iteration to generate the matrix in the usual way. Is there some way of calling something like eqs.buildMatrix() to just get the matrix so I can solve it outside of FiPy? Related question: once I have the matrix, is there a simpler way of getting the full non-sparse array?

Basically, what is the most efficient way of doing something like:

eqs.cacheMatrix()
eqs.solve()  # but don't actually do any solving!
M = pysparse.sparse.PysparseMatrix(matrix=eqs.matrix.matrix).getNumpyArray()

where

M = [K, B]
    [C, K]

(As it stands, I think M = diag(K, K)*dx with B and C being combined with D and E...)

I would like to formulate the problem in fipy (because later I will use it for time evolution) but need to solve for the static configurations first. (Also, is there a way of not using sparse solvers and just using numpy arrays? For debugging small systems this would be very useful...)

Thanks for any pointers,
Michael.


Reply via email to