Regarding boundary conditions

So i am trying to implement topology implementation in 3d (2d works fine) the problem is boundary condition idk if my conditions are acting correctly here is a small snippet

Boundary conditions and load

class LeftFace(SubDomain):
def inside(self, x, on_boundary):
return near(x[0], 0.0, DOLFIN_EPS)

class RightFace(SubDomain):
def inside(self, x, on_boundary):
return near(x[0], 6.0, DOLFIN_EPS)

class TopFace(SubDomain):
def inside(self, x, on_boundary):
return (on_boundary and near(x[1], 1.0, DOLFIN_EPS) and
(0.10 <= x[0] <= 5.90) and (0.1 <= x[2] <= 0.9))

facets = MeshFunction(“size_t”, mesh, mesh.topology().dim() - 1, 0)
TopFace().mark(facets, 3)

facets = MeshFunction(“size_t”, mesh, mesh.topology().dim() - 1, 0)
LeftFace().mark(facets, 1)
RightFace().mark(facets, 2)
TopFace().mark(facets, 3)

Apply boundary conditions

bc_left = DirichletBC(V_u, Constant((0.0, 0.0, 0.0)), facets, 1) # Fixed left face
bc_right_y = DirichletBC(V_u.sub(1), Constant(0.0), facets, 2) # Restrict y motion
bc_right_z = DirichletBC(V_u.sub(2), Constant(0.0), facets, 2) # Restrict z motion
bcs = [bc_left, bc_right_y, bc_right_z]

Load definition

ds = Measure(“ds”, domain=mesh, subdomain_data=facets)
load = Constant((0.0, -10.0 , 0.0)) # Load applied in negative y-direction
L = inner(load, v) * ds(3)

We don’t know what boundary conditions you are expecting, so it’s hard for us to say whether what you do is correct or not.

Please make sure to include your snippets in ```, otherwise they are not correctly formatted.

I apologize for the misunderstanding what i am trying to do is creating a beam of size 611 with left side having fixed support and right side having roller support and load is applied somewhere in between, but i dont know if the boundary conditions are working perfectly or not

# Create Mesh and Function Spaces
mesh = BoxMesh(Point(0, 0, 0), Point(6.0, 1.0, 1.0), 60, 10, 10)
V_d = FunctionSpace(mesh, "P", 1)
V_u = VectorFunctionSpace(mesh, "P", 1)


# Boundary conditions and load
class LeftFace(SubDomain):
    def inside(self, x, on_boundary):
        return near(x[0], 0.0, DOLFIN_EPS)

class RightFace(SubDomain):
    def inside(self, x, on_boundary):
        return near(x[0], 6.0, DOLFIN_EPS)

class TopFace(SubDomain):
    def inside(self, x, on_boundary):
        return (on_boundary and near(x[1], 1.0, DOLFIN_EPS) and 
                (0.10 <= x[0] <= 5.90) and (0.1 <= x[2] <= 0.9))

facets = MeshFunction("size_t", mesh, mesh.topology().dim() - 1, 0)
LeftFace().mark(facets, 1)
RightFace().mark(facets, 2)
TopFace().mark(facets, 3)

# Apply boundary conditions
bc_left = DirichletBC(V_u, Constant((0.0, 0.0, 0.0)), facets, 1)  # Fixed left face
bc_right_y = DirichletBC(V_u.sub(1), Constant(0.0), facets, 2)  # Restrict y motion
bc_right_z = DirichletBC(V_u.sub(2), Constant(0.0), facets, 2)  # Restrict z motion
bcs = [bc_left, bc_right_y, bc_right_z]

# Load definition
ds = Measure("ds", domain=mesh, subdomain_data=facets)
load = Constant((0.0, -100.0, 0.0))  # Load applied in negative y-direction
L = inner(load, v) * ds(3)