Hi @abelthayil,
I think there has been a change in the way of defining custom Expressions, the Parent class now is UserExpression (instead of Expression). So the RandomPotential would then be:
class RandomPotential(UserExpression):
def __init__(self, **kwargs):
random.seed(2 + MPI.rank(MPI.comm_world) )
super().__init__(**kwargs)
def eval(self, values, x):
values[0] = random.randint(0,5)
def value_shape(self):
return ()
Sorry for pointing you to the outdated example!