Assembling functionals that are not expressed as differential forms.

Issue #475 new
Corrado Maurini created an issue

This issue refers to the QA http://fenicsproject.org/qa/6580/spring-functionals-assembling-non-integral-functional?show=6604#c6604

Currently there is no way in UFL/Dolfin to assemble a form of the type:

f = u(x1)*v(x2)

where u is a trial function, v a test function, x1 and x2 two points in the mesh. I report below the comment by @martinal on QA that pinpoint the key issues:

[The problem is that] there is no 'apply' operator in UFL, so there's currently no way to represent u(x1). What's missing is not a purely UFL feature either, the fundamental issue is that apply is not a local operation so it doesn't fit into the "for each cell: compute local contribution && add to global value" assembly framework.

The problem is quite relevant in general for applications. All commercial FE packages provide specific elements for that. Think to all type of 'discrete' elements as springs in elastic solids or or discrete circuital elements in electromagnetism.

Comments (3)

  1. Martin Sandve Alnæs

    What you want involves a few different issues:

    # 1) A non-integral functional
    # 2) involving functions evaluated at points
    F = (u(x1) - u(x0))**2
    
    # 3) Differentiation wouldn't be hard to do, the result being:
    derivative(F, u, v)dF/du = (u(x1) - u(x0)) * (v(x1) - v(x0))
    
    1. involves some plumbing through the ufl-ffc-ufc-dolfin pipeline to add a new "integral" type which is not an integral (not very hard but some work)
    2. involves (a) the addition of an apply operator to ufl (easy on the symbolic side) and (b) figuring out a way to extend the fenics assembly process to global operators in an efficient and generic way (harder)
    3. involves adding a new rule or two to differentiation (easy)

    Where 2b is the hardest part.

  2. Jan Blechta

    Wouldn't be a better abstraction for f = u(x1)*v(x2)

    # pseudocode
    f = u(x)*v(x1+x2-x)*dP(sitting_at=x1, integration_variable=x)
    

    i.e. usage of two features

    1. Dirac measure (which we currently support only at vertices, AFAIK)
    2. composition of terminal with something else (here v is composed with affine function (UFL expression)), which we don't have
  3. Martin Sandve Alnæs

    Possibly. The challenge is still the global nature of evaluation of functions in arbitrary points.

    Global evaluation of a Function in dolfin is somewhat supported by wrapping it in an Expression, however that looses information so differentiation becomes tricky. I can see ways to improve on that.

    However test and trial functions are harder.

  4. Log in to comment