As opposed to structured meshes - follows regular pattern (structure) - typically quads, but shape doesn't matter Advantages: - allows mixing of cell types - quads with tets, hex, poly cells # Finite Volume Method Example: heat diffusion equation $ \begin{equation} 0 = \nabla\cdot(k\nabla T ) +S \end{equation} $ - $T$ - static temperature (K) - $k$ - thermal conductivity - $S$ - heat source per unit volume (W/m<sup>3</sup>) Integrate over cell volume: $ 0 = \int_V\nabla\cdot(k\nabla T)+S\,dV $ Separate source term and integrate: $ \int_{V_p}S_p\,dV=S_pV_p $ Simple because linear variation across cell volume $V_p$ Substitute back in: $ 0 = \int_V\nabla\cdot(k\nabla T)\,dV+S_pV_p $ Simplify with [[Gauss Divergence Theorem]]: $ 0 = \int_A(k\nabla T\cdot\vec{n})\,dA+S_pV_p $ We know that cells have a finite number of flat faces, so we can split the integral up for each face: $ 0 =\sum_\text{faces}\int_A(k\nabla T\cdot\vec{n})\,dA+S_pV_p $ Since flow quantities vary linearly across cell faces, the diffusion term can be pulled out of the integral: $ 0=\sum_\text{faces}(k_f(\nabla T)_f\cdot\vec{n}_f)\int_AdA.+S_pV_p $ Where subscript $f$ denotes the flow quantity at the cell face centroid, rather than the cell volume centroid ($p$). Simplify the integral to get the discretized heat diffusion equation for a general cell volume: $ \boxed{0=\sum_\text{faces}k_fA_f((\nabla T)_f\cdot\vec{n})+S_pV_p} $ In the case of a 2D rectangle: $ 0 = \left(kA\frac{\partial T}{\partial x}\right)_\text{right}-\left(kA\frac{\partial T}{\partial x}\right)_\text{left}+\left(kA\frac{\partial T}{\partial y}\right)_\text{top}-\left(kA\frac{\partial T}{\partial y}\right)_\text{bottom}+S_pV_p $ # Faces ## Interior Connected to other cells on each side: ![[Pasted image 20230805113129.png]] Using the discretized heat diffusion equation, we need to express the dot product of the temperature gradient and the unit normal vector $\left(\nabla T\right)_f\cdot\vec{n}_f$ in terms of the temperatures at the owner and neighbor cell centroids $T_p$ and $T_n$: ![[Pasted image 20230805114002.png]] Decompose the unit normal vector into a component parallel to the vector connecting centroids $P$ and $N$ $(\vec{n}_1$) and the remaining component: $ \vec{n}_f=\vec{n}_1+\vec{n}_2 $ Substitute this into the gradient term: $ \left(\nabla T\right)_f\cdot\vec{n}_f=\left(\nabla T\right)_f\cdot\vec{n}_1+\left(\nabla T\right)_f\cdot\vec{n}_2 $ Since $\vec{n}_1$ is parallel with $\vec{d}_{PN}$ and the temperature gradient over a straight line is approximated by: $ \nabla T\approx\frac{\Delta T}{\Delta x} $ The temperature gradient is parallel to $\vec{n}_1$, so the dot product simplifies to multiplying by the magnitude of $\vec{n}_1$: $ \left(\nabla T\right)_f\cdot\vec{n}_f=\frac{T_P-T_N}{\lvert\vec{d}_{PN}\rvert}\lvert\vec{n}_1\rvert+\left(\nabla T\right)_f\cdot\vec{n}_2 $ Substituting back into the discretized heat diffusion equation: $ 0 = \sum_\text{faces}\left[k_fA_f\left(\frac{T_N-T_P}{\lvert\vec{d}_{PN}\rvert}\right)\lvert\vec{n}_1\rvert\right]+\underbrace{\sum_\text{faces}\left[k_fA_f\left(\left(\nabla T\right)_f\cdot\vec{n}_2\right)\right]}_\text{non-orthogonal term}+S_pV_p $ The non-orthogonal term is equal to zero if the vector connecting owner and neighbor cell centroids is parallel with the face unit normal vector. In this case: $ 0 = \sum_\text{faces}\left[k_fA_f\left(\frac{T_N-T_P}{\lvert\vec{d}_{PN}\rvert}\right)\lvert\vec{n}_1\rvert\right]+S_pV_p $