Sum Of Integrals on NGSolve


What I want to do is to create an integral and then set the whole integral to a certain power (I don’t want the interior of the integral to the power but the integral itself)
Here is what I want to do:
T = (gfRho**exp * test() ** exp * dx) ** (1/exp)

Also, I want to do the same for a LinearFunction, for exemple :
L= LinearForm(gfRho ** exp * test(u_trial) ** exp *dx) ** (1/exp)

But as soon as I do that, the error is either :

TypeError: unsupported operand type(s) for ** or pow(): ‘ngsolve.comp.SumOfIntegrals’ and ‘int’


TypeError: unsupported operand type(s) for ** or pow(): ‘ngsolve.comp.LinearForm’ and ‘int’

Do you have any clue on how to achieve this ?

Thank you for your help :slight_smile:

short answer: what you have is not a ‘linear’ form anymore

You can evaluate an integral for a given GridFunction, and take this number to a certain power:

Integrate (gfu*dx, mesh)**2.7

If you want to have the power in your variational formulation, you can spend an additional number variable:

fes = H1(mesh) * NumberSpace(mesh)
(u, p), (v,q) = fes.TnT()
a = BilinearForm( (p - test(u))*q*dx  + p**2.7 * ... *dx)


Thanks a lot for your reply.

Unfortunately, I don’t understand the second part of your answer. How can this Bilinear Form be with a power factor. For me, you just changed the value inside that BilinearForm but I want the whole integral with a certain power