← Back to team overview

ufl team mailing list archive

[Question #215432]: True User-defined Operators for UFL

 

New question #215432 on UFL:
https://answers.launchpad.net/ufl/+question/215432

Drs. Alnaes and Logg,

  I would like to create an interface between the Cantera chemical equilibrium code and Fenics in order to solve transport problems in nonideal solutions.  My problem is a nonlinear Poisson equation div ( p(c)  grad c ) = 0.

  The trouble I'm having is in implementing the (horribly complicated, nonlinear) p(c) part, since this involves a call-out to an external code.  The difficulty here is implementing a nonlinear coefficient field, p, that is a function of the object to be solved for rather than simply a function of position.
# nonlin_coef :: (x -> current solution at x) -> (x -> result at x)

 It can be curried, with the type
# nonlin_coef :: (x -> current solution at x) -> x -> result at x
but then will have to be re-compiled for each 'current solution' trial mesh function.

 The correct resolution would be to add a user-defined Expr type that returns a Function object as a function of some other
Function object, but that is currently not possible, since UFL's user guide,  2.12 "User-defined operators" can only be defined
with respect to already existing UFL operators.

  This leads to the advice in UFL's user guide sec. 4.6 "Extending UFL", which appears less hopeful.  In theory, it should be possible to implement this sort of functionality by requiring a series of callback functions from the user to represent successive derivatives.  How difficult would this be to implement?

  Also, the networkx toolkit (http://networkx.lanl.gov/examples/drawing/unix_email.html) has some really nice options for displaying graphs.

Sincerely,
~ David M. Rogers
  Postdoc, Nanobiology Department
  Sandia National Labs

-- 
You received this question notification because you are a member of UFL
Team, which is an answer contact for UFL.