Hi FEniCS Community,
I am solving a mixed problem for nonlinear elasticity, I have defined my exact solution as bellow:
Ke_1 = as_vector((sin(2*x[0]/R)pow(sin(x[1]/R),2) , sin(2x[1]/R)*pow(sin(x[0]/R),2) , 0.0)) # the first row of displacement gradient
Ke_2 = as_vector(( 0.0, sin(2*x[1]/R)pow(sin(x[2]/R),2), sin(2x[2]/R)*pow(sin(x[1]/R),2))) # the second row of displacement gradient
Ke_3 = as_vector((sin(2*x[0]/R)pow(sin(x[2]/R),2), 0.0, sin(2x[2]/R)*pow(sin(x[0]/R),2))) # 3rd row of displacement gradient
def_grad = as_tensor([[1.0 + Ke_1[0], Ke_1[1], Ke_1[2]], [Ke_2[0], 1.0 + Ke_2[1], Ke_2[2]], [Ke_3[0], Ke_3[1], 1.0 + Ke_3[2]]]) # deformation gradient
Stress_ES = mudef_grad + (2lamln(det(def_grad.Tdef_grad)) - mu)*inv(def_grad.T) #stress tensor
Pe_1 = Stress_ES[0,:] # Extract 1st row of stress
Pe_2 = Stress_ES[1,:] # Extract 2nd row of stress
Pe_3 = Stress_ES[2,:] # Extract 3st row of stress
Pe_1, Pe_2 and Pe_3 are three rows of my stress tensor. (“stress” belongs to “BDM” and ““displacement”” belongs to ““N2curl””.
After computing my approximate solution regarding stress, I am going to pass both exact solutions and approximate solutions to “errornorm” function to obtain my error. But Pe_1, Pe_2, Pe_3 are not UFL functions, so I interpolate them to specific Function Space but I am getting this error:
TypeError: in method ‘Function_interpolate’, argument 2 of type ‘dolfin::GenericFunction const &’
Aborted (core dumped)
So I have two questions:
- Is there a way that I can define Pe_1, Pe_2, Pe_3 as Expression?
- How should fix the error I am getting?
Thank you in advance.