This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Problem in setting BC

0 votes

Hi,

I am new to fenics and I am solving an elasticity problem. What I find weird is that some of nodes which should have a BC is not having any boundary condition set. This is hapazard and I don't see any reason why this must happen.

Here is an example code block:

interface = [CompiledSubDomain("(x[0] >= (xi-tol)) && (x[0] <= (xi+tol)) && (x[1] >= (yi-tol)) && (x[1] <= (yi+tol)) && (x[2] >= (zi-tol)) && (x[2] <= (zi+tol))", xi = pos[0], yi = pos[1], zi = pos[2], tol = tol) for pos in nodes[np.array([list(nodes[:,0]).index(i-1) for i in interface_atom_disp[:,0]]), 1:]]

I have checked that the bounds I am specifying in the Expression is correct and there are nodes within those bounds. Then I don't understand why some nodes are not set BC.

To investigate my problem, I wondered what values does 'x' take. So I did the following in another subdomain defination:

   coor = []

   """Sub domain for free surface boundary opposite to the interface"""
   def free_surface(x, on_boundary):
      coor.append(x)
      return isclose_mod(x[2], z_end_continuum)     

What I found is rather surprising. coor has different shapes in different runs of the same code. What I expect is coor to have the coordinates of all the nodes. Because this is what I expect fenics is doing: While applying boundary condition, it is looping over all nodes and seeing if it gets TRUE from any of the subdomain, and if so then assign the corresponding boundary value to that node. But what appears from my check that is not the case. I am utterly confused what is happening. NOTE: I am using method = 'pointwise'

I hope that is some serious fault in my understanding of what the code does and any assistance in this regard is greatly appreciated.

Hope to hear soon from the fenics community.

Related post: How to apply DirichletBC on selected nodes for a 3D Mesh

Sincerely,
Shankha

asked Jun 22, 2016 by shankha FEniCS Novice (220 points)
retagged Jun 22, 2016 by shankha
...