[firedrake] Specify boundary conditions at a corner

David Ham David.Ham at imperial.ac.uk
Fri Aug 21 11:52:25 BST 2015


Hi Justin,

The nice way of doing this would require better subdomain support than we
have right now. However there is a slightly hacky way of doing it which I
think will cover your case nicely.

If you take a look at the DirichletBC class (in bcs.py), you'll notice that
the set of nodes at which the BC should be applied is calculated in
DirichletBC.nodes . So you could simply subclass DirichletBC and replace
nodes with a function which returns the index of the zero node. For example
(and I confess this is a sketch code which I haven't tried to run):

class PointDirichletBC(DirichletBC):
    @utils.cached_property
    def nodes(self):
        # Find the array of coordinate values.
        x = self.function_space().mesh().coordinates.dat.data_ro
        # Find the location of the zero rows in that
        return np.where(~x.any(axis=1))[0]

Does that work for you?

Cheers,

David

On Fri, 21 Aug 2015 at 03:32 Justin Chang <jychang48 at gmail.com> wrote:

> Hi all,
>
> If I create a mesh using UnitSquareMesh or UnitCubeMesh, is there a
> way to subject a single point (as opposed to an entire edge/face) to a
> DirichletBC? I want to subject the the location x=0,y=0 to some value.
>
> Thanks,
> Justin
>
> _______________________________________________
> firedrake mailing list
> firedrake at imperial.ac.uk
> https://mailman.ic.ac.uk/mailman/listinfo/firedrake
>
-------------- next part --------------
HTML attachment scrubbed and removed


More information about the firedrake mailing list