Hi Krishna,

Yes you can do this, see

https://github.com/usnistgov/fipy/blob/develop/fipy/terms/term.py#L332

The following should work,

    equation.cacheMatrix()
    equation.solve(...)
    the_matrix = equation.matrix

The cacheMatrix is require because otherwise the reference to the
matrix is lost.

I'm not exactly certain on the matrix format, but you should be able to do

   np.arrray(the_matrix)

to make it into a 2D numpy array.

Hope that helps.

On Wed, Jan 11, 2017 at 3:39 PM, Gopalakrishnan, Krishnakumar
<krishnaku...@imperial.ac.uk> wrote:
> Hi,
>
> I was wondering if there is a way to access the internal matrices of the
> system of equations formulated by Fipy , given the coefficient terms of the
> general conservation equation.
>
> Let's say I have a simple diffusion equation (eg. Heat equation). I can
> hand-code the differentiation matrix and BC vector for a constant dx using
> the 2nd order central difference formula.
>
> Is there a way to see the matrix/vector system of the discretised system
> that FiPy has internally formed before we call solve() or sweep() ? I am
> still learning basics of discretisarion schemes and it will be helpful to
> visualise how FiPy internally forms the matrices, and how they compare to
> the hand-derived matrices/vectors
>
> Regards,
>
> Krishna
>
>
> _______________________________________________
> fipy mailing list
> fipy@nist.gov
> http://www.ctcms.nist.gov/fipy
>   [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
>



-- 
Daniel Wheeler
_______________________________________________
fipy mailing list
fipy@nist.gov
http://www.ctcms.nist.gov/fipy
  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]

Reply via email to