Evaluate ufl product - what do the variables mean?

Hi there,

Apologies if this is very obvious, but I have been looking everywhere and cannot find an answer!

I have a ufl.algebra.Product object and I would like access it’s data. From the documentation (ufl package — Unified Form Language (UFL) 2021.1.0 documentation) it seems like I can do

object.evaluate(x, mapping, component, index_values)

which looks ideal.

My question is: what are ‘x’, ‘mapping’, ‘component’ and ‘index_values’? I’m guessing that ‘x’ is a ufl.SpatialCoordinate() of some kind, but I have no idea what ‘mapping’ is. There doesn’t seem to be a definition anywhere.

Thank you in advance,


You would need to interpolate (works in DOLFINx not legacy DOLFIN) or project (works in both versions) the ufl.algebra.Product into a suitable function space, and then use the eval function.

Ah thank you, I will try that!