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

How to apply a DirichletBC to a dof based on its index?

+5 votes

I can't figure out from the documentation how to specify that a DirichletBC should be applied to the DoFs having a particular set of indices. To be clear, by index I mean the number displayed by DofMapPlotter from the fenicstools package.

I would like to do something like:

  dofList = [1,20,21]
  bc =  DirichletBC(V,Constant(0),dofList,'pointwise')

I would produce the dofList using a MeshFunction and the DofMap. It would be a list of all points which do not lie inside or on the boundary of a particular subdomain.

Thanks for your help!

Colin

asked Sep 13, 2015 by 9954colinr FEniCS Novice (290 points)

1 Answer

0 votes
 
Best answer

Yes, that would be very usefull, but I think is currently not implemented.

You could do this with extracting and working with the underlying PETSc objects though.... (assuming that you use the PETSc backend)

answered Oct 27, 2015 by simon_funke FEniCS Novice (690 points)
selected Jun 6, 2016 by 9954colinr

Hi Simon,

thanks for clarifying that it is not yet in fenics.

I am using PETSc - any chance you could give some pointers on how I could go about doing this?

Regards,

Colin

...