How to address point boundary condition?

Hello
Lets say you want to apply a point load equal to 100 N downward in Y direction at coordinate (5,5):

class Load(UserExpression):

    def __init__(self, **kwargs):
        super().__init__(degree=kwargs["degree"])

        self.point = kwargs['point']
        self.value = kwargs['value']

    def eval(self, value, x):

        if near(x[0], self.point[0]) and near(x[1], self.point[1]):
            value[0] = self.value[0]
            value[1] = self.value[1]
        else:  
            value[0] = 0
            value[1] = 0

    def value_shape(self):
        return (2,)

You can call it by:

T = Load(point=(5, 5), value=(0, -100), degree=1)

Regarding applying boundary condition at a specific point:

Lest say you want to fix a point at coordinate (0,0). You can do as following:

def point(x, on_boundary):
    tol = DOLFIN_EPS
    return (abs(x[0] - 0) < tol) and (abs(x[1] -0) < tol)

BC_POINT = DirichletBC(V, Constant((0., 0.)), point,method="pointwise")
1 Like