My apologies for asking a question that has been answered previously more than once (see here and here), but is there an easier way of doing this in case of many subdomains?
I would find it easier to write
f = Expression(expr_1, subdomain=domain_1,
expr_2, subdomain=domain_2,
...
expr_n, subdomain=domain_n)
and a single expression for the linear/bilinear form than having to break up the integrand on each subdomain.
Moreover, suppose I need to evaluate multiple times expressions involving f
(for instance $f\cdot u$ and $f\cdot \nabla u$)?
I would like to add that I am a GMSH user, and the routine dolfin-convert
makes it very easy to work with subdomains (even more so now that there is no need any longer to start the numering of the physical entities from 0).