Hi Dan,

Thanks a lot for your reply. Based on this, Ian and I have a further question.

Is it possible to instruct FiPy to discretise only the spatial domain, leaving 
the time-domain continuous?
Ian and I are planning to implement the standard method of lines for our 
problem at hand. Although we have derived the Ax=b system matrices and vectors 
by hand-derivation for a fixed-spaced 2D mesh, this becomes messy and 
intractable for higher dimensions and non-uniformly spaced Cartesian meshes.

Thus, our plan is to get FiPy generate the matrices for us, and we can use 
standard ode/dae adaptive time-stepping solvers for the actual simulation of 
the system.

Can FiPy return the system matrices and RHS vector by discretising only the 
spatial domain?

Best Regards,

Krishna

________________________________
From: fipy-boun...@nist.gov <fipy-boun...@nist.gov> on behalf of Daniel Wheeler 
<daniel.wheel...@gmail.com>
Sent: Tuesday, January 24, 2017 5:00:23 PM
To: Multiple recipients of list
Subject: Re: Question on accessing internal matrices of the system being solved

Hi Ian,

Sorry for the slow response.

On Thu, Jan 12, 2017 at 12:20 PM, Campbell, Ian
<i.campbel...@imperial.ac.uk> wrote:
>
> 1) Applying numerix.array() to ‘L’, when ’L’ is of type
> 'fipy.matrices.scipyMatrix._ScipyMeshMatrix', creates a zero-dimensional
> ndarray, with no shape. This isn’t what we expected because L has diagonal
> numerical values & ‘---‘ where its sparse “entries” are.
> Our goal is to obtain ‘L’ using your suggested method and then to convert it
> into the SciPy sparse.csc_matrix format for further processing. The input to
> SciPy’s csc_matrix function must be a rank-2 ndarray, but (reasonably
> enough!) this fails when we pass csc_matrix a zero-dimensional ‘L’ matrix.

See,

    
https://github.com/usnistgov/fipy/blob/develop/fipy/matrices/scipyMatrix.py#L266

I think you need the "matrix" attribute of
"fipy.matrices.scipyMatrix._ScipyMeshMatrix" and I think that is the
raw Scipy version of the matrix (whatever format that is). You can
then call "toarray()" on that is seems. My previous instructions were
wrong. So just using "L.numpyArray" should also achieve the same.

> 2) We see from the 2009 paper that it’s a three-point stencil used for the
> generation of the discretisation matrix in a first order scheme. What
> stencil is used for 2nd order schemes?

Depends on the term of course, but for a diffusion term on a square
grid it is the same as finite difference which would be a 5 point
stencil. The convection terms are mostly first order as currently
implemented in FiPy.

This is a good book for FV method,
http://www.springer.com/us/book/9783319168739, which describes some of
the schemes.

> 3) How do we implement a higher (e.g. 8th & 12th order central-difference)
> order schemes in FiPy?

That's not easy at all. I don't think it is designed well enough for
that. It would require a major rewrite to easily add new convection
schemes.

Cheers,

Daniel

--
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