Solving lumped Parameter ODE's

Is it possible to model non-spatial ODE’s in Fenics?

For example can I model the following ODE

dx_1/dt = -k*x_2
dx_2/dt = x_1

I want to know this because I need to couple a similar lumped parameter ODE system of equations to the boundary of a wave equation model. (The ODE is going to be dependent on the boundary values of the wave equation).

This question response explains a possible method

However, I don’t understand why the ODE residual has all terms integrated over the boundary ds

F_r = (q_t + c2*u)*r*ds

Many thanks

The boundary term comes from the fact that the source term of the ODE on the example is precisely given by u at the boundary

But shouldn’t that mean that only the source term is multiplied by ds?

Why is q_t multiplied by ds?

q_t is a scalar value (obtained from a "Real" function space). It must be integrated over some measure, can be dxor ds. The latter is useful since when integrating over ds you obtain q_t |\partial \Omega| which corresponds to the term of the formulation.

1 Like