gmarkall / manycore_form_compiler

MCFC is deprecated. See https://code.launchpad.net/~grm08/ffc/pyop2
https://code.launchpad.net/~grm08/ffc/pyop2
GNU General Public License v3.0
3 stars 1 forks source link

Transformations by J, invJ, detJ in the frontend AST #37

Closed kynan closed 12 years ago

kynan commented 13 years ago

To treat the transformation from physical to reference space in a more natural way, global derivatives and the measures dx/ds are replaced by their local equivalents transformed through J/invJ/detJ.

This process involves the following steps:

  1. The Transformation class

    • Transformation is a class with a singleton instance T defined in the transformation module
    • T has the attributes J, invJ, detJ, after it has been initialised with the coordinate field (via init)
    • transform(coordinates) returns T initialised with coordinates
    • UFL code is prepended by

      x = state.vector_field['Coordinates']
      T = transform(x)

      in a preprocessing step

  2. UFL derivation and measure operators are overridden in the namespace the UFL code is exectued:

    grad = lambda u: inner(T.invJ, ufl.grad(u))
    div = lambda u: ufl.div(inner(T.invJ, u))
    dx = T.detJ * ufl.dx

This results in a natural integration of all transformations by simply executing the UFL code with these operators brought into the namespace.

gmarkall commented 12 years ago

This (or a similar solution) was implemented in the generate-transforms branch before it was merged (e739ee4bf).