In addition to this, if you define an environment variable FIPY_DISPLAY_MATRIX, 
then FiPy will display the matrix and RHS vector. If FIPY_DISPLAY_MATRIX 
contains "terms", then the contribution of each term will be displayed before 
the aggregate matrix and vector are displayed. 
If FIPY_DISPLAY_MATRIX contains "print", then the numerical values of the 
matrix and vector will be printed to the shell. This is overwhelmingly useless 
for any but very tiny meshes.

> On Jan 12, 2017, at 10:27 AM, Daniel Wheeler <daniel.wheel...@gmail.com> 
> wrote:
> 
> 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 ]


_______________________________________________
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