Hi Francis, Usually we use the boundary markers on the incoming mesh. Where are you getting your more general mesh from? Regards, David On Wed, 10 May 2017 at 15:37 Francis Poulin <fpoulin@uwaterloo.ca> wrote:
Hello,
We are trying to translate part of the mixed-poisson Fenics demo into Firedrake. I know that there is already a Firedrake demo that does this but for the special case of a square. I am hoping we can do this more generally.
Below are the lines of code from Fenics. Can someone suggest how this could be implemented in Firedrake?
Cheers, Francis
https://fenics.readthedocs.io/projects/dolfin/en/latest/demos/mixed-poisson/...
# Define function G such that G \cdot n = gclass BoundarySource(Expression): def __init__(self, mesh, **kwargs): self.mesh = mesh def eval_cell(self, values, x, ufc_cell): cell = Cell(self.mesh, ufc_cell.index) n = cell.normal(ufc_cell.local_facet) g = sin(5*x[0]) values[0] = g*n[0] values[1] = g*n[1] def value_shape(self): return (2,) G = BoundarySource(mesh, degree=2) # Define essential boundarydef boundary(x): return x[1] < DOLFIN_EPS or x[1] > 1.0 - DOLFIN_EPS
bc = DirichletBC(W.sub(0), G, boundary)
------------------ Francis Poulin Associate Professor Department of Applied Mathematics University of Waterloo
email: fpoulin@uwaterloo.ca Web: https://uwaterloo.ca/poulin-research-group/ Telephone: +1 519 888 4567 x32637 <(519)%20888-4567>
-- Dr David Ham Department of Mathematics Imperial College London