Re: derivative boundary condition in 2D problem

2017-01-24 Thread Daniel Wheeler
On Tue, Jan 24, 2017 at 4:33 AM, Francisco Vega Reyes  wrote:
> How do I implement a boundary condition \partial T /\partial y = 0 at
> facesTop (for instance)?

In that case, I don't believe that you need to add any constraints as
that is the natural boundary condition for a diffusion term. It might
depend on the equation being solved though in FiPy.

> It seems to me that doing var.faceGrad.constrain(((0,),(0,)),
> where=mesh.facesTop) (the initial example in the manual) I would be like
> doing \partial T /\partial x + \partial T /\partial y = 0...

This might be nonsensical, but I think that the constraints have no
impact for any quantity that is tangential to the direction of the
outbound normal only the normal direction. That could well be a
weakness with the notation as we currently have it in 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 ]


Re: Question on accessing internal matrices of the system being solved

2017-01-24 Thread Daniel Wheeler
Hi Ian,

Sorry for the slow response.

On Thu, Jan 12, 2017 at 12:20 PM, Campbell, Ian
 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 ]


derivative boundary condition in 2D problem

2017-01-24 Thread Francisco Vega Reyes
How do I implement a boundary condition \partial T /\partial y = 0 at
facesTop (for instance)?

It seems to me that doing var.faceGrad.constrain(((0,),(0,)),
where=mesh.facesTop) (the initial example in the manual) I would be like
doing \partial T /\partial x + \partial T /\partial y = 0...

Thanks a lot

Francisco Vega

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