← Back to team overview

dolfin team mailing list archive

[Bug 785192] [NEW] Taking the gradient of an expression with a Constant crashes

 

Public bug reported:

Since a Constant does not have any way to provide a cell, PyDOLFIN
forces me to use python floats instead as coefficients in some forms,
thereby significantly increasing the amount of recompilation I have to
do. PyDOLFIN therefore does not support the full range of expressions
possible to express in UFL. This can be remedied by adding an optional
cell or mesh argument to Constant.__init__ in PyDOLFIN. Mesh is probably
more convenient/consistent in a PyDOLFIN setting.

# This currently crashes:
    from dolfin import Constant, grad
    grad(Constant(1e-1))

# This syntax would make it possible to express fully ufl compliant constant coefficients in PyDOLFIN
    from dolfin import Constant, grad, UnitSquare
    mesh = UnitSquare(3,3)
    grad(Constant(1e-1, mesh))

** Affects: dolfin
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of DOLFIN
Team, which is subscribed to DOLFIN.
https://bugs.launchpad.net/bugs/785192

Title:
  Taking the gradient of an expression with a Constant crashes

Status in DOLFIN:
  New

Bug description:
  Since a Constant does not have any way to provide a cell, PyDOLFIN
  forces me to use python floats instead as coefficients in some forms,
  thereby significantly increasing the amount of recompilation I have to
  do. PyDOLFIN therefore does not support the full range of expressions
  possible to express in UFL. This can be remedied by adding an optional
  cell or mesh argument to Constant.__init__ in PyDOLFIN. Mesh is
  probably more convenient/consistent in a PyDOLFIN setting.

  # This currently crashes:
      from dolfin import Constant, grad
      grad(Constant(1e-1))

  # This syntax would make it possible to express fully ufl compliant constant coefficients in PyDOLFIN
      from dolfin import Constant, grad, UnitSquare
      mesh = UnitSquare(3,3)
      grad(Constant(1e-1, mesh))


Follow ups

References