Different subdomain_data objects / Two Neumann-like terms on different boundary parts

Hi everyone,

I want to solve a nonlinear static elasticity problem where, on the distinct part of the boundary defined by
ds3 = ds(subdomain_data=mf[3], subdomain_id=3)
I have a follower load, and on the distinct part
ds0 = ds(subdomain_data=mf[0], subdomain_id=0)
a Robin condition.

So, my weak form / Res expression looks like

Res =
0.5 inner(PK2_stress(u),derivative(C, u, v)) dx -
dot(b0, v) dx +
pres J dot(dot(inv(F).T,n0), v) ds3 +
springstiff dot(u,v) ds0,

with F, C, J being deformation grad, right Cauchy Green, determinant of defgrad…
So, if I leave away the last term and replace it by a Dirichlet condition, it perfectly works. However, including the last term yields the error message
“ufl.log.UFLException: Integrals in form have different subdomain_data objects”.

So it seems to me that you cannot have Neumann-like terms over two different parts of the boundary in the weak form? Can somebody help me how to achieve this? I haven’t found a solution.

I’m working with the latest Fenics/Dolfin developer version. Not with Dolfinx.

Would be great if someone had an idea on this!

Best,
Marc

Please format your code properly encapsulating code with ``` .
As the Error message suggests, and you two different definitions of ds0 and ds3 shows, is that you are using different subdomain data functions in the same form, which is not allowed. Is there a specific reason for the two mesh function not being merged into one function?
Additionally, I would strongly advise you against using 0 as a subdomain id, as that tends to be what people use as the default value for unmarked facets.

Ok thanks! Meanwhile, I figured it out. Indeed one has to use the same mesh function, just with different ids. Works!
Thanks! :slight_smile: