Equivalent to Expression for a vector valued function in dolfinx?

Hello,

I would like to define the exact solution for a time dependent stokes problem. I used to use Expression in fenics to do this. How can I define a vector valued function in fenicsx?

I have written the following code but it does not work

class exact_solution1():
def init(self):
self.t = 0.0
def eval(self, x):
print(x.shape[1])
t = self.t
return np.full(x.shape[1], (pow(t,2)(pow(x[0],4)-2pow(x[0],3)+ pow(x[0],2))(4pow(x[1],3)-6pow(x[1],2)+ 2x[1]), -pow(t,2)(pow(x[1],4)-2pow(x[1],3)+ pow(x[1],2))(4pow(x[0],3)-6pow(x[0],2)+ 2x[0])))

I would be grateful if someone can help me with this!

Thank you in advance!
Fotini

See e.g: This vector function definition which is interpolated into an appropriate space for error computation.

1 Like

Thank you so much! Very helpful!