Defining weighted averages

If you consistently mark the domains \Omega_e with a cell function, the the restrictions s("+") and s("-") is consistently ordered, as shown in:

and therefore you can define

def avg_gamma(u, gamma):
     return (0.5+gamma)*u("+") + (0.5-gamma)*u("-")
3 Likes