How to put a sum integral to the power

Hello, I have defined a run_lagrangien function in order to define a LAgrangien in a topology optimization problem. My simplified code is the following :

  • run_lagrangien() :

a=CoefficientFunction(0)*dx
a+=gfLambda *(Integrate(gfRho, mesh) - vol_limit )*dx
T = ((( gfRho ** exp * test(Sym(Grad(gfu))) ** exp )) *dx)**(1/exp)
Lag = T - a
return Lag

What I want then is to differentiate the integrale with the .Diff tool from NGSolve :

dJdrho = LinearForm(pwc)
gfpwcTest = pwc.TestFunction()
dJdrho += Lag.Diff(gfRho, gfpwcTest) # differentiate the integral form
dJdrho.Assemble()

The error is the following : Unsupported operand type(s) for ** or pow(): ‘ngsolve.comp.SumOfIntegrals’ and ‘float’, in the line where I define T in run_lagrangien

I know I can’t put the whole thing at the power 1/exp, but i also can’t defined T as :

T = ((( gfRho ** exp * test(Sym(Grad(gfu))) ** exp ))**(1/exp) *dx)

Because it won’t be the integral at the power, but only the inside of it (and we would be allowed to simplified).

If you have any clue on what I wan’t to achieve, or the solution, it would be a pleasure :slight_smile:
Thanks !!

It might be helpful to show what your expression should like look in mathematical notation (e.g. LaTeX or written on paper).