Dear Koki and Lawrence
Thanks for the detailed response. I would really appreciate it if you could take a quick look at this and tell me if I am subclassing DirichletBC properly. Here, I have a cylinder with an outer radius Ro and axial length Lz. The CollarDirichletBC class finds the nodes of the edge corresponding to radius Ro and z=0. 

class CollarDirichletBC(DirichletBC):
    @utils.cached_property
    def nodes(self):
        bcnodes=[]
        Ro=8.0
        atol=1e-3
        coords=self.function_space().mesh().coordinates.dat.data_ro
        rvec=np.linalg.norm(coords[:,0:2],axis=1)
        zvec=coords[:,2]
        for ind in range(coords.shape[0]):
            r=rvec[ind]
            z=zvec[ind]
            if np.isclose(z,0.0,atol=atol) and np.isclose(r,Ro,atol=atol):
                bcnodes.append(ind)
        return bcnodes

Also, Lawrence, Would you be able to give me an outline of the code that I would need to change? This is my first time working with open source software and would appreciate any help I could get. 
Thanks
--
Abhishek Venketeswaran
NETL Research Associate - ORISE
National Energy Technology Laboratory
Department of Energy
abhishek.venketeswaran@netl.doe.gov
Work: 412-386-4833
Mobile: 716-507-7890
www.netl.doe.gov


From: Sagiyama, Koki <k.sagiyama@imperial.ac.uk>
Sent: Friday, July 16, 2021 12:30 PM
To: Venketeswaran, Abhishek (FN) <Abhishek.Venketeswaran@netl.doe.gov>; firedrake <firedrake@imperial.ac.uk>
Subject: [EXTERNAL] Re: Problem with Dirichlet BC on edges in a 3D mesh
 
Hi Abhishek,

There seems to be a few missing pieces to naturally apply edge boundary conditions in Firedrake, for instance:
So I'm afraid subclassing DirichletBC probably is the best workaround to apply edge conditions at the moment.

Regards,
Koki



From: firedrake-bounces@imperial.ac.uk <firedrake-bounces@imperial.ac.uk> on behalf of Venketeswaran, Abhishek (FN) <Abhishek.Venketeswaran@netl.doe.gov>
Sent: Thursday, July 15, 2021 7:12 PM
To: firedrake <firedrake@imperial.ac.uk>
Subject: [firedrake] Problem with Dirichlet BC on edges in a 3D mesh
 
Hi,
I created a a couple of physical groups within GMSH with appropriate labels/tags. I then tried to use the same labels after importing the .msh file in firedrake. I got the following error:
Please find below the relevant section in the .py file that generates the gmsh mesh and saves it in .msh file
gmsh.option.setNumber("Mesh.MshFileVersion", 2)
# Physical curves defined with appropriate tags starting from 1000
gmsh.model.addPhysicalGroup(1, b_o_c_arcs,1001)
gmsh.model.addPhysicalGroup(1, b_i_c_arcs,1002)
gmsh.model.addPhysicalGroup(1, list(t_o_c_arcs),1003)
gmsh.model.addPhysicalGroup(1, list(t_i_c_arcs),1004)
# Physical surfaces defined with appropriate tags starting from 2000
gmsh.model.addPhysicalGroup(2, circ_pl_surf,2001)
gmsh.model.addPhysicalGroup(2, extsurfs,2002)
# Physical volumes defined with appropriate tags starting from 3000
gmsh.model.addPhysicalGroup(3, voltags,3001)
gmsh.model.mesh.generate(3)
gmsh.write("Pipe3D.msh")

Here is the snippet of the .py file executed within firedrake:
mesh=Mesh('Pipe3D.msh')
bc1=DirichletBC(V,zero,1003)

When I execute the solve command I get this error: 
Error: {1003} are not a valid markers (not in {2001,2002})

I think I have a workaround that is not yet giving me errors wherein I define a class derived from DirichletBC and redefine the @utils.cached_property nodes function. However, It would be great if I could do it using the existing DirichletBC class. 

I would be very grateful if you could help me out here. 
Thanks
--
Abhishek Venketeswaran
NETL Research Associate - ORISE
National Energy Technology Laboratory
Department of Energy
abhishek.venketeswaran@netl.doe.gov
Work: 412-386-4833
Mobile: 716-507-7890

********************************************************************
This message does not originate from a known Department of Energy email system.
Use caution if this message contains attachments, links or requests for information.

********************************************************************