Also you can try this using cacheMatrix() and getMatrix():

In [1]: from fipy import *

In [2]: m = Grid1D(nx=2)

In [3]: v = CellVariable(mesh=m)

In [4]: e = DiffusionTerm()

In [5]: e.cach
e.cacheMatrix     e.cacheRHSvector

In [5]: e.cacheMatrix()

In [6]: e.solve(v)
/users/wd15/work/matforge/fipy/trunk/fipy/solvers/pysparse/preconditioners/ssorPreconditioner.py:52:
DeprecationWarning: Call to deprecated method 'ssor'. Use
pysparse.precon.precon.ssor instead.
  return precon.ssor(A), A
/users/wd15/work/matforge/fipy/trunk/fipy/solvers/pysparse/pysparseSolver.py:76:
DeprecationWarning: Call to deprecated method 'pcg'. Use
pysparse.itsolvers.Pcg instead.
  self.iterations, P)

In [7]: e.getMatrix()
/users/wd15/.virtualenvs/trunk/bin/ipython:1: DeprecationWarning:
:func:`getMatrix` is deprecated, use the :attr:`matrix` property instead!
  #!/users/wd15/.virtualenvs/trunk/bin/python
Out[7]: <ll_mat object at 0x34a9e48>

In [8]: print e.getMatrix()
-1.000000   1.000000
 1.000000  -1.000000

This was done on trunk. I noticed a bug in version-2_1 whereby if the
equation is just the DiffusionTerm then it doesn't cache the matrix even
after it's told. To get this to work in version-2_1 you'll need to have a
binary term i.e. add in another term such as a transient term with zero
coefficient.

Cheers.

On Fri, Mar 23, 2012 at 11:21 AM, Jonathan Guyer <[email protected]> wrote:

>
> On Mar 23, 2012, at 10:50 AM, Fausto Arinos de A. Barbuto wrote:
>
> >
> > Hello,
> >
> > To solve a steady-state diffusion-convection problem such as the one
> presented in
> > pg. 83 of FiPy Manual Release 2.1.3
> (examples.convection.exponential1D.mesh1D)
> > a tridiagonal and a column matrix must be put together. I was wondering
> if there
> > isn't a way to display these matrices using some FiPy built-in function.
>  Is that
> > possible?  I did a quick (and unsuccessful) search in the manual but
> didn't find
> > anything specifically related to that.
>
> For a graphical display, see
>
>
> http://www.ctcms.nist.gov/fipy/documentation/FAQ.html#envvar-FIPY_DISPLAY_MATRIX
>
>
> _______________________________________________
> fipy mailing list
> [email protected]
> http://www.ctcms.nist.gov/fipy
>  [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
>



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

Reply via email to