Dear Fenics users,
I need to define a 2-d vector function from an analytical expression with a variable parameter. I am currently using the class Expression
with
class MyFunctionExpression(Expression):
def eval(self, values, x):
values[0] = 1+((x[0]**2 +x[1]**2)**0.5 - 0.5)**2
values[1] = 1+((x[0]**2 +x[1]**2)**0.5 - 0.5)**2
def value_shape(self):
return (2,)
V = VectorFunctionSpace(MyMesh, "Lagrange", 1)
f = MyFunctionExpression(element=V.ufl_element())
f_u = interpolate(f,V)
Now I need to make the expression in MyFunctionExpression
dependent on a parameter p
that I will change during computation... like in
ParamExpression = Expression('param',param=Constant(0.),degree = 0)
that I update with
ParamExpression.user_parameters["param"] = Constant(1.)
I don't know how to adapt this last syntax with my previous definition of MyFunctionExpression
...
Many thank in advance for your help !
Claire