# Integrating an Ordinary Differential Equation over a domain in Finite Element Methods

I'm trying to get a deeper understanding of the Finite Element Method (FEM) to better understand what I do in COMSOL and FEniCS.

The sketch below shows the problem that I want to solve in FEM. The rectangular domain resembles a flow reactor. In the flow reactor there is a laminar velocity field in the z direction, $U_Z$. Particles of the diameter D are traveling along this flow field.

The particles change in size according to the relation:

$$\frac{d D}{dz} = \frac{1}{D U_Z} exp (\alpha / D)$$

I do know the size of the particles at the left side of the domain, i.e. I have their initial values.

What I would actually like to find is the size of the particles at the right side of the domain (labeled outlet).

Now this is the my question: I'm not sure if FEM is actually suitable to solve such a problem, which may be due to my (possibly wrong?) understanding of the method. My current understanding of FEM is that in setting up the matrix equation that solves the system, I need to specify all boundary conditions. Since in my case, I'm actually trying to find D (i.e. the particle diameters) on the right boundary of the domain, my problem seems to be ill-conditioned for FEM.

I've solved this problem in finite differences, where I just started on the left side of the domain and integrated a system of equations (corresponding to the above equation) in the z direction. This was much more straight-forward than FEM (it seems).

Please let me know, if my understanding is correct or incorrect. I'd be more than happy to get references to read up on this.

## 2 Answers

FEM is for solving boundary value problems. What you have here is an initial value problem (assuming $\alpha$ and $U_z$ are constant or functions of $z$), the same as solving a time-dependent ODE, except here $z$ is your time-like coordinate. The appropriate way to solve this kind of problem is with time-integration methods, e.g. Runge-Kutta schemes.

In FEM applications where time-accuracy is required, the FEM aspect only handles the spatial discretization, while time-integration methods handle the time-dependent aspects -- they're distinct parts.

You seem to be confused about which equation to solve. You have two: (i) the flow equations, (ii) the equations for your particle property $D$.

The finite element method is suitable for part 1 of this. Or, if you really just have a pipe with laminar flow, then you actually know what the flow field is (namely, Poisseuille flow) and you don't need to solve anything at all.

For the second part, you just need the ability to integrate along the trajectory of a particle. For Poisseuille flow, this is a straight line with constant velocity depending on the spanwise position of the line within the pipe, but in general you will need to be able to evaluate your flow field at arbitrary points. This is equally simple or difficult in the finite element or finite difference context, depending on whether you have a uniform or unstructured mesh. In any case, if you can evaluate the velocity field, then you know the trajectory of the particle and you can integrate your ODE along it.