# 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.

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.
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$.