I want to define a vector function depend on time wih userexpression. This function will appear in the right hand.And i need to update this function with time step.
code:
class Coeff(UserExpression):
def init(self, t, **kwargs):
super().init(kwargs)
self.t = t
def eval_cell(self, t, value, ufl_cell):
if self.t <= 2.0:
value[0] = 2.0
value[1] = 0.0
else:
value[0] = 0.0
value[1] = 0.0
def value_shape(self):
return (2,)
errors: UFLException: UFL conditions cannot be evaluated as bool in a Python context.