Add a nodal value of unknown in weak form

Hello,

I have an 1D problem defining in x = [0,1]. The solution of this problem are the velocity u and displacement D along with an extra unknown l defined in space “R”. I concern about the equation of l given by an integral as

l = \int^{1}_{0} u \ D_{|x=1} \ dx

where term D_{|x=1} is the nodal value of D at x = 1.

I made a try by defining the weak form as

Res = ( l - u*D*ds(1) )*phi*dx

where ds(1) is integration measurement on x = 1, phi is the basis function and dx is the integration measurement of the whole domain. By writing the above form I get the error

unsupported operand type(s) for +: ‘Indexed’ and ‘Form’

The question is how can I write this form properly?

Hi, so you have a mixed function space involving both u, D and an extra scalar l as problem unknowns, is that right ? If so I don’t think that you can easily define the above nonlinear equation as u(x) and D(x=1) involve a product of fields evaluated at different locations. You would have a “non-local” integral kernel which is not natively supported in FEniCS.
A way around would be to define an extra scalar unknown D1 which we enforce to be equal to D(x=1). Something as follows:

u, D, D1, l = split(Function(V))
u_, D_, D1_, l_ = TestFunctions(V)
# D(x=1)=D1 constraint
c1 = D1_*D*ds(1) - D1_*D1*dx
# l constraint
c2 = l_*(l-u*D1)*dx
1 Like

Thanks for your reply. Yes I use a mixed function space. I will follow your instructions, thanks.