Hello,
I just stumbled across something (for me) unexpected in 2019.2.0.dev0 (so I don’t know if it is still relevant in DolfinX).
I have a domain with a lot of subdomains defined via a mesh function. Integrating over each of these subdomains always triggers an ffc recompile while I would not expect that. More specifically I define my measure as below and with that I can integrate over a subdomain with id subdomain_id via
ds = df.Measure("ds")(subdomain_data=mesh_function, domain=mesh)
df.assemble(df.Constant(1) * ds(subdomain_id))
but this will trigger a new compiliation for each new subdomain_id as the ID goes into the form signature as can be seen here in the UFL source code.
As a workaround I now create a subdomain mask mesh function that is 1 inside the subdomain and 0 outside which triggers the jit only once as the ID doesn’t change anymore. This creates some overhead but is fast enough for me.
I found an older related question here. I would however expect that the jit does not run again just because the ID changed. Is there a reason it is like that or is there a better way as a work around?
Many thanks,
Jo