You should always use fipy.numerix instead of importing numpy directly with FiPy. fipy.numerix is a superset of numpy that accommodates FiPy's data layout. dot'ing fields of vectors is precisely something that numpy doesn't understand, but fipy.numerix does.
See: - http://www.ctcms.nist.gov/fipy/fipy/generated/fipy.tools.html?highlight=numerix#fipy.tools.numerix.dot - the "attention" at the top of http://www.ctcms.nist.gov/fipy/fipy/generated/fipy.tools.html?highlight=numerix#module-fipy.tools.numerix. - http://www.ctcms.nist.gov/fipy/examples/diffusion/generated/examples.diffusion.anisotropy.html?highlight=dot [note that `numerix.NUMERIX.dot` is identical to `numpy.dot`] On Feb 5, 2015, at 1:44 PM, Zebo LI <[email protected]> wrote: > Here is my problem: > The diffusion problem is set up in a Cartesian coordinate system (2D). But > due to the singularity behavior at the origin point, we need to solve the > equation in a Polar coordinate system. > So I created two meshes in the code: one is the ordinary Grid2D mesh for the > cartesian system, and the other is a PeriodicTopBottom2D mesh for the Polar > system (x=ln(r),y=theta. During the calculation we need to do some matrix > transformation from Cartesian system to the Polar system: > > M(Polar) = O^{T} *M(Cartesian)*O > > where > > O= [(cos(\theta),sin(\theta))\\(-sin(\theta),cos(\theta))]. > > Is there an easy way to realize this operation? Since both O and M depend on > position, (We expressed M(Cartesian) and O as functions of r and \theta, and > wanted to get M(Polar).) the numpy.dot does not works while. > > > best, > Zebo > _______________________________________________ > fipy mailing list > [email protected] > http://www.ctcms.nist.gov/fipy > [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ] _______________________________________________ fipy mailing list [email protected] http://www.ctcms.nist.gov/fipy [ NIST internal ONLY: https://email.nist.gov/mailman/listinfo/fipy ]
