How to visit every x in finite element space ？
6 months ago by
Here I used a 3*3*1 bar as a 3D mesh.the mym_coords and mym_value are read from other data file. The mym_value(i) is the vector value to mym_coords(i).They are not in the finite element space .By this ,I write a class to find the vertices in V which near mym_coords，However,It can only find one x coordinates in my plot .when I print x,there are 220 lines x showed.It means that I can't visit every x in my class.How should I modify my codes?
mx=[1,2,3,4] my=[1,2,3,4] mz=[1,2,3,4] mym_value=np.zeros((linenumber,3)) mym_coords=np.zeros((linenumber,3)) class MySigma(Expression): def set_sigma(self,mx,my,mz): self.mx,self.my,self.mz= mx,my,mz def eval(self,value,x): tol = 0.01 for i in range(0,linenumber-1): if(sqrt(np.inner(x-mym_coords[i,0:3],x-mym_coords[i,0:3]))<=tol): value=mym_value[i,2] else value=2 sigma=MySigma(degree=1) sigma.set_sigma(mx,my,mz)
Community: FEniCS Project
Please login to add an answer/comment or follow this question.