Applying dynamic loads to given points in the structural dynamic analysis

Hi, I’m new on Fenics. Now I’m encountering a problem in the structural dynamic analysis.
As for the loads are applied to several interior points (the coordinates are given) as below and are a discrete value at every timestep, they cannot be uniformly described by Expressions.

*Amplitude, Name=N1_X
          0.02,   -0.000602584839,          0.04,     -0.0973661804,          0.06,       -2.63061237,          0.08,       -34.7715683,
           0.1,        -292.87326,          0.12,       -1759.55915,          0.14,       -8015.15675,          0.16,       -28724.2546,
          0.18,       -82932.8842,           0.2,       -196220.825,          0.22,       -387184.113,          0.24,       -656762.817,
          0.26,       -1019174.46,          0.28,       -1597426.06,           0.3,        -2720511.2,          0.32,       -4893093.11,
          0.34,       -8597781.18,          0.36,       -14063301.1,          0.38,       -21133379.0,           0.4,       -29211088.2,
          0.42,       -37278133.4,          0.44,       -44185226.4,          0.46,       -49219863.9,          0.48,       -52382289.9,
           0.5,       -53873630.5

I referred to the case here:How can point loads be applied to the end of the cantilever beam? But in this case the load is constant and the code is for dolfin rather than dolfinx.

Is there any similar cases for dolfinx that I can refer to?
Can you provide any effective ideas? Thank you very much!

In legacy FEniCS there was a method called PointSource() that was used to do this. Unfortunately, PointSource() has not yet be reimplemented in FEniCSx.

However, you can implement point loads by simply modifying your RHS vector, provided your load is applied directly on a node. Here is some starter code that might help.

instead of the simplified:

from dolfinx.fem.petsc import LinearProblem

uh = Function(FXNSPACE)
problem = LinearProblem(a,L, u=uh, bcs=[bc1,bc2,....])
uh = self.problem.solve()

you would use something like:

from dolfinx.fem.petsc import (assemble_matrix, create_vector, assemble_vector, 
                               apply_lifting, set_bc, create_vector)
from petsc4py import PETSc 

A =assemble_matrix(form(a),bcs=[bc1,bc2,....])
A.assemble()

b = create_vector(form(
with b.localForm() as b_loc:
                    b_loc.set(0)
assemble_vector(b,form(L))

apply_lifting(b,[form(a)],bcs=[self.bcs])
b.ghostUpdate(addv=PETSc.InsertMode.ADD, mode=PETSc.ScatterMode.REVERSE)
set_bc(b,[bc1,bc2,....])

def locate_dofs(x):
    return *some np boolean based on spatial coords*

f_dofs = locate_dofs_geometrical(FXNSPACE,locate_dofs)
b.arrayp[f_dofs[0]] = f

uh = Function(FXNSPACE)
uvec = self.uh.vector
uvec.setUp()
ksp = PETSc.KSP().create()
ksp.setType(PETSc.KSP.Type.CG)
ksp.setTolerances(rtol=1e-15)
ksp.setOperators(self.A_mat)
ksp.solve(self.b,uvec)