[DifferentialEquations.jl] Resolution of time variant exitation term

Hi all, my question may be somewhat related to this thread.

I want to solve a FEM second-order differential equation with DifferentialEquations.jl using a constant and given time-step \Delta t. The problem is basically expressed as:

\mathbf{M} \ddot{\mathbf{x}}(t) + \mathbf{C}\dot{\mathbf{x}}(t) + \mathbf{Kx}(t) = \mathbf{F}(t)
where \mathbf{M} is the mass matrix, \mathbf{C} is the damping matrix, \mathbf{K} is the stiffness matrix and \mathbf{F}(t) is the force vector.

To solve this problem with DifferentialEquations.jl, I have to:

  • Form the corresponding first-order sytem (which is straightforward)
  • Define the solver with the desired time-step. From the DiffEq doc, I think it can be implemented this way:
sol = solve(prob, Tsit5(), dt = Δt)

However, I don’t figure out how to use a time-variant excitation term \mathbf{F}(t), which is given as a matrix of dimensions (number of degrees of freedom)x(number of time steps). This is rather classical in the FEM softwares I use such as Nastran.

My question is, what is the recommended way to do this with DifferentialEquations.jl?

Should I use DataInterpolations.jl to transform my time series into a function and use it as in Example 3 of the Getting started section of the doc ? Or is there a more direct way ?

Thanks for your help.

Just make it a function call. You’re allowed to use t inside of the function. DataInterpolations.jl is a good choice here, since you can give it a bunch of matrices in time and then interp(t) will be the interpolated matrix.

Try it in a simple example first. What have you tried?

Thank you for your answer @ChrisRackauckas. I haven’t tried to implement it yet, but I will try soon.