On Fri, Jun 8, 2012 at 7:42 AM, Jonathan Guyer <[email protected]> wrote:

>
> On Jun 8, 2012, at 4:13 AM, Yun Tao wrote:
>
> > However, I ran into problems trying to do the same for 2-D. Using the
> same template, I have
> >
> > >>> mesh = Grid2D(nx=nx, ny=ny, dx=dx, dy=dy)
> > >>> pos = FaceVariable(mesh=mesh, value=mesh.getFaceCenters(), rank=1)
> > >>> pos_x = pos[0]
> > >>> pos_y = pos[1]
> > >>> eq = TransientTerm() == DiffusionTerm(coeff=1.0) +
> convection(coeff=((np.tanh(pos[0])),(np.tanh(pos[0]))))
> >
> > I know it likely has to do with the way I defined pos_x and pos_y. But I
> can't figure out how to convert them into the usable MeshVariable for this
> case.
>
>
> ((np.tanh(pos[0])),(np.tanh(pos[0])))
>
> is equivalent to
>
> (np.tanh(pos[0]),np.tanh(pos[0]))
>
> due to the way Python tuples work.
>
> This is not oriented the right way for a FiPy vector.
>
> Either (note the commas)
>
> ((np.tanh(pos[0]),),(np.tanh(pos[0]),))
>
> or
>
> [[np.tanh(pos[0])],[np.tanh(pos[0])]]
>
> should work.
>

Hm. Tried both with no success (please see attachment). I noticed that
simply just defining the equation with the convection above without running
the solver on it (eq2) would freeze up python, sometimes to the point of
crashing it. I've also tried using different convection terms, but it seems
to make no difference.

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



-- 
Graduate Group of Ecology Doctoral Candidate
Department of Environmental Science and Policy
Center for Population Biology
University of California, Davis

Attachment: s-cd2d.py
Description: Binary data

_______________________________________________
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