Applying pointsource at two different vectors?

Hi,

I’m currently writing a beam deflection code and I have used pointsources which act as point forces in the y direction along the beam. I’m now wishing to develop this further and add point forces at an angle.

I’m assuming there’s a way to do this by splitting the force into its x and y components but I’m struggling to see how to apply forces in the x direction as well as in y.

Any suggestions will be extremely appreciated!

Cheers.

1 Like

You can apply scalar point sources to sub-spaces. Take a look at the following example, which applies a vector-valued point load to the corner of a linear-elastic square:

from dolfin import *

mesh = UnitSquareMesh(10,10)
VE = VectorElement("Lagrange",mesh.ufl_cell(),1)
V = FunctionSpace(mesh,VE)

# Constrain normal displacement on two sides:
def boundary1(x, on_boundary):
    return on_boundary and near(x[1],0.0)
bc1 = DirichletBC(V.sub(1), Constant(0.0), boundary1)

def boundary2(x, on_boundary):
    return on_boundary and near(x[0],0.0)
bc2 = DirichletBC(V.sub(0), Constant(0.0), boundary2)
bcs=[bc1,bc2]

# Solve linear elasticity with point load at upper-right corner:
u = TrialFunction(V)
v = TestFunction(V)

eps = 0.5*(grad(u) + grad(u).T)
BULK_MOD = 1.0
SHEAR_MOD = 1.0
I = Identity(2)
sigma = BULK_MOD*tr(eps)*I + 2.0*SHEAR_MOD*(eps - tr(eps)*I/3.0)

a = inner(sigma,grad(v))*dx
L = inner(Constant((0,0)),v)*dx

# Assemble:
A = assemble(a)
B = assemble(L)

####### Interesting part #######

# Apply point sources:
ptSrcLocation = Point(1.0-DOLFIN_EPS,1.0-DOLFIN_EPS)

# Vectorial point load:
f = [0.03,0.07]

# Distinct point sources for x- and y-components
ptSrc_x = PointSource(V.sub(0),ptSrcLocation,f[0])
ptSrc_y = PointSource(V.sub(1),ptSrcLocation,f[1])
ptSrcs = [ptSrc_x,ptSrc_y]

# Apply to RHS of linear system:
for ptSrc in ptSrcs:
    ptSrc.apply(B)

################################
    
# Apply BCs:
for bc in bcs:
    bc.apply(A)
    bc.apply(B)

# Solve:
u = Function(V)
solve(A,u.vector(),B)

# Plot results:
import matplotlib.pyplot as plt
plot(u,mode='displacement')
plt.show()

Perfect, thanks for the clear example.

Much appreciated.