# Divergence in COMSOL

I'm trying to calculate the divergence of a vector quantity $L(L_x, L_y, L_z)$ in COMSOL. I calculate it using the built-in differentiation operator as follow:

$$\nabla L = d(L_x,x)+d(L_y,y)+d(L_z,z)$$

I'm wondering what is the notation or the function for divergence. Does COMSOL calculate the divergence of $L$ correctly in the way that I did in above?

• Is $L$ a scalar or a vector in your case? – Wolfgang Bangerth Sep 21 '13 at 2:38

First of all, your definition of the divergence is different from the standard definition. (Assuming you are in cartesian coordinates $(x,y,z)$, and $d(\cdot,x)$ means the partial derivative wrt $x$.
Regarding Comsol. When in cartesian coordinates, $\nabla \cdot L$ always gives you the divergence of a vector quantity $L$ in the sense linked above.
In different coordinate systems, $\nabla \cdot$ acts differently depending on the interface where you apply it. I would love to link to the corresponding entries of the Comsol documentation, but it is not commonly available.