Hello, I’m working on an optimization algorithm that minimizes some non linear energy functional with inequality constraints, such as non negativity for the solution, I’m trying to implement a naive approach for pointwise non negativity that is simply projecting at each newton step with max(0,gfu) pointwise but I’m not sure if there is a function built in ngsolve that does this, I’ve tried with .numpy() but looks like it isn’t the most efficient.
Hi Sebastian,
you want to take the positive part in the integration points, right ?
You can do so with
IfPos(u, u, 0)
if u is positive, it takes u, otherwise 0
Joachim
Hi, this worked well, thanks!