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

Applying different Direchlet BCs to different nodes on a boundary

–1 vote

I am solving a 3D linear elasticity problem.

On one boundary, I have different [ux, uy, uz] BCs on the different nodes. How to accomplish this in fenics.

It would be of great help if anyone can help.

Sincerely,
Shankha

asked Jun 4, 2016 by shankha FEniCS Novice (220 points)

1 Answer

0 votes

If you have an analytical expression for the components you can use an a vector expression, i.e.

bc = DirichletBC(V,Expression(("x[0]","x[1]","x[2]")), bnd_func)
answered Jun 7, 2016 by KristianE FEniCS Expert (12,900 points)

Hi,

Thanks for you response. But this is not the answer to my question.

However I hope I solved it by myself (it would be nice if you can have a look and confirm). This is how I define the list of subdomains

interface = [CompiledSubDomain("x[0] == xi && x[1] == yi && x[2] == zi", xi = pos[0], yi = pos[1], zi = pos[2]) for pos in interface_nodes]

where interface_nodes stores the coordinates of the interface node. This mean each of these interface node is a subdomain by itself.

There I define the Direchlet BC for each of the interface nodes as follows:

u0_interface = [Constant(disp) for disp in interface_node_disp]
bc_interface = [DirichletBC(V, u0_interface[count] , interface[count]) for count in range(0, np.shape(interface_node_disp)[0])]

where interface_node_disp has the displacements BC values [ux, uy, uz] for each of the interface nodes.

Hope to hear your opinion soon.

Sincerely,
Shankha.

...