[firedrake] Applying Dirichlet Boundary conditions in certain regions

Lawrence Mitchell lawrence.mitchell at imperial.ac.uk
Thu Nov 5 20:18:30 GMT 2015


> On 5 Nov 2015, at 19:33, Justin Chang <jychang48 at gmail.com> wrote:
> 
> Hi all,
> 
> I think I asked a similar question a couple months ago, but say I want to solve the advection equation. From what I understand, boundary conditions should only be applied in the "upstream" regions (i.e., regions where the velocity is flowing into the domain).
> 
> Say on a unit cube, i know that on plane x-y at z = 0, only the quadrants (x[0] < 0.5 && x[1] < 0.5) and (x[0] >= 0.5 && x[1] >= 0.5) will have the influx and the other two are either zero flux or have outflux. 

I recommend doing this by asking your mesh generator to mark the appropriate boundary facets. These will then be available as sub domain ids for the normal dirichletbc object (this is indeed all we do for the built in utility meshes). 

Lawrence


> Last time I asked how to constrain a point on the bottom left corner, and I think one of you (David?) said to use something like:
> 
> 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]
> 
> I am guessing that I would need to modify that last line somehow so that it . What routines would I need in order to achieve this? Or is there a better of doing this?
> 
> Thanks,
> Justin
> _______________________________________________
> firedrake mailing list
> firedrake at imperial.ac.uk
> https://mailman.ic.ac.uk/mailman/listinfo/firedrake



More information about the firedrake mailing list