I want to use the expression function to express a complex boundary condition. But I don’t know how to make the expression more concise?
Here is the function I am using, it looks very bulky.
Ux = dl.Expression(‘K1/(2*mu)*sqrt(sqrt(x[0]*x[0]+x[1]x[1])/2/pi)(kappa-x[0]/(sqrt(x[0]*x[0]+x[1]*x[1]))) * (1/2)sqrt(1/2(1+(x[0]-0)/sqrt(x[0]*x[0]+x[1]x[1])))',K1=K1,mu=mu,pi=np.pi,kappa=kappa,degree=2);
Uy = dl.Expression('K1/(2mu)*sqrt(sqrt(x[0]*x[0]+x[1]x[1])/2/pi)(kappa-x[0]/(sqrt(x[0]*x[0]+x[1]*x[1]))) * (1/2)sqrt(1/2(1-(x[0]-0)/sqrt(x[0]*x[0]+x[1]*x[1])))’,K1=K1,mu=mu,pi=np.pi,kappa=kappa,degree=2);
BC_u = [dl.DirichletBC(V_u.sub(0),Ux, boundaries, 1),
dl.DirichletBC(V_u.sub(0),Ux, boundaries, 2),
dl.DirichletBC(V_u.sub(0),Ux, boundaries, 4),
dl.DirichletBC(V_u.sub(0),Ux, boundaries, 5),
dl.DirichletBC(V_u.sub(1),Uy, boundaries, 1),
dl.DirichletBC(V_u.sub(1),Uy, boundaries, 2),
dl.DirichletBC(V_u.sub(1),Uy, boundaries, 4),
dl.DirichletBC(V_u.sub(1),Uy, boundaries, 5)];
Do you know of any good ways to express this boundary condition more concisely?