## Conservation Laws **Derivative form:** $\boxed{\frac{ \partial \phi }{ \partial x }+\nabla\cdot \vec{F}=s}$ $\phi =$ conserved quantity $\vec{F} =$ flux of conserved quantity: $\phi$ is transported through boundaries $S =$ sink and source terms: $\phi$ is coming from outside **Integral form:** $\frac{d}{dt}\int_{V} \phi \, dV + \int _{ CS } \vec{F} \cdot \vec{n} \, dA = \int _{V}s \, dV$ **Discretized integral form:** $\boxed{V \frac{d\bar{\phi}}{dt}+\int _{S}\vec{F}_{\phi}\cdot \vec{n} \, dA = S_{\phi}}$ $\bar{\phi} = \frac{1}{V} \int _{V} \rho \phi \, dV$ $S_{\phi} = \int _{V}s_{\phi} \, dV$ | Conservation Law | Variables | Integral Form | | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------- | | **Mass** <br> $\frac{\partial \rho}{\partial t} + \nabla \cdot (\rho \vec{u}) = 0$ | ${} \phi = \rho {}$ <br> $\vec{F}_\phi = \rho \vec{u}$ <br> $s_\phi = 0$ | $V \frac{d\bar{\phi}}{dt} + \int_S \rho \vec{u} \cdot \vec{n} \, dA = 0$ | | **Momentum** <br> $\frac{\partial u}{\partial t} + \frac{\partial (u^2)}{\partial x} = -\frac{1}{\rho} \frac{\partial p}{\partial x} + \nu \frac{\partial^2 u}{\partial x^2}$ | $\phi = u$ <br> $\vec{F}_\phi = u^2 - \nu \frac{\partial u}{\partial x}$ <br> $s_\phi = -\frac{1}{\rho} \frac{\partial p}{\partial x}$ | ${} V \frac{d\bar{u}}{dt} + \int_S \left( u^2 - \nu \frac{\partial u}{\partial x} \right) n_x \, dA = S_{u} {}$ | | **Energy** <br> $\frac{\partial \theta}{\partial t} = \frac{\partial}{\partial x} \left( \alpha \frac{\partial \theta}{\partial x} \right)$ | $\phi = \theta$ <br> $\vec{F}_\phi = -\alpha \frac{\partial \theta}{\partial x}$ <br> $s_\phi = 0$ | $V \frac{d\bar{\theta}}{dt} + \int_S \left( -\alpha \frac{\partial \theta}{\partial x} \right) n_x \, dA = 0$ | ### Convective Fluxes - Aligned with flow $\vec{F} = \rho \vec{u}\phi$ ### Diffusive Fluxes - Molecular mixing - acts against gradient $\vec{F} = -D \nabla \phi$ ## Surface Integrals You don't know $\phi$ everywhere on the surface, only at nodal values - integral expressed in terms of symbolic values on the cell face - the cell face values are interpolated from nodal values ### General Forms Goal: estimate $F_{e} = \int _{S_{e}}f_{\phi} \, dA$ | | Accuracy | Approximation | | ----------- | -------- | ---------------------------------------------------- | | Midpoint | 2 | $F_{e} \approx f_{e}S_{e}$ | | Trapezoidal | 2 | ${} F_{e} \approx S_{e} \frac{f_{ne}+f_{se}}{2} {}$ | | Simpson's | 4 | $F_{e} \approx S_{e} \frac{f_{ne}+4f_{e}+f_{se}}{6}$ | ### Interpolation | Method | | Accuracy | Comments | | -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------- | | UDS (upwind) | $\phi_{e}=\begin{cases}\phi_{P} & \text{if }(\vec{v}.\vec{n})_{e}>0\\\phi_{E} & \text{if }(\vec{v}.\vec{n})_{e}<0\end{cases}$ | 1st Order | - Very stable and robust<br>- Highly diffusive<br> - Best for convection-dominated flows | | CDS (linear) | $\phi_{e}=\phi_{E}\lambda_{e}+\phi_{P}(1-\lambda_{e})$ <br>where $\lambda_{e}=\frac{x_{e}-x_{p}}{x_{E}-x_{P}}$ | 2nd Order | - Can oscillate when advection dominates <br> - Good at diffusion problems | | QUICK | $\phi_{e} = \phi_{U}+g_{1}(\phi_{D}-\phi_{U})+g_{2}(\phi_{U}-\phi_{UU})lt;br>For uniform grids,<br>${} \phi_{e}=\frac{6}{8}\phi_{U}+\frac{3}{8}\phi_{D}-\frac{1}{8}\phi_{UU} {}$… | 3rd Order | - Higher accuracy than CDS or UDS <br> - Some upwind bias for stability <br> - More complex stencil; may overshoot near discontinuities | | Compact / High-order | Polynomial-based (e.g., Hermite, Padé) | | - Very high accuracy <br> - Sensitive to nonuniform grids and BC's | ## Volume Integrals $S_{\phi} = \int _{V}s_{\phi}dV \, dx$ $\bar{\phi}=\frac{1}{V}\int _{V}\rho \phi \, dV$ #### Simplest approx: approximate mean value of the integrand as the value at the center of the control volume #### Higher Order Approximations: Interpolate centers, corners, midfaces Use those 9 points to fit the bi-quadratic shape function $s(x,y)$, where $s(x,y) = a_{0}+a_{1}x+a_{2}y+a_{3}x^{2}+a_{4}y^{2}+a_{5}xy+a_{6}x^{2}y+a_{7}xy^{2}+a_{8}x^{2}y^{2}$ 4th order approx ## FV Scheme 1. Grid generation 2. Discretize integral/conservation equation on FVs $V\frac{d\bar{\phi}}{dt} + \int _{S}\vec{F}_{\phi}\vec{n} \, dA = S_{\phi}$ 3. Solve resultant discrete integral/flux equations ![[Pasted image 20250408121026.png|375]] ### Approach 1 1. Evaluate integrals symbolically 2. Interpolate for unknowns using nodal values $\phi_{e}$ = value at face center $\phi_{E}$ = value at nearest node center | Method | | Accuracy | Comments | | ------------ | ------------------------------------------------------------------------------------------------------------------------------- | --------- | -------------------------------------------------------------- | | UDS (upwind) | $\phi_{e}=\begin{cases}\phi_{P} & \text{if }(\vec{v}.\vec{n})_{e}>0\\\phi_{E} & \text{if }(\vec{v}.\vec{n})_{e}<0\end{cases}$ | 1st Order | No oscillations, very diffusive, for convective fluxes | | CDS (linear) | $\phi_{e}=\phi_{E}\lambda_{e}+\phi_{P}(1-\lambda_{e})$ <br>where $\lambda_{e}=\frac{x_{e}-x_{p}}{x_{E}-x_{P}}$ | 2nd Order | centered differences<br>Can oscillate<br>For convective fluxes | | QUICK | $\phi_{e} = \phi_{U}+g_{1}(\phi_{D}-\phi_{U})+g_{2}(\phi_{U}-\phi_{UU})$ | 3rd Order | | ### Approach 2 1. Select shape of solution within CV (piecewise approximation $\xi = x - x_{j}$ $\phi(\xi) = a\xi^{2}+b\xi+c$ 2. Impose volume averaging constraints to express coefficients in terms of nodal values Express $a$, $b$, and $c$ in terms of $\phi_{i}$ such that: $\frac{1}{V} \int _{V_{p}} \phi_{a_{i}}(x) \, dV = \bar{\phi}_{P}$ 3. Integrate the fluxes and average the fluxes on the two sides for continuity 4. Substitute into integral equation ![[Pasted image 20250408115800.png]] $d \begin{bmatrix} 0 & 1 & \dots &0 & -1\\ -1 & 0 & 1 & \dots & 0\\ \dots & & & & 1 \\ 1 & \dots & -1 & 0 \end{bmatrix}\begin{bmatrix} \phi_{1} \\ \phi_{2} \\ \dots \\ \phi_{n} \end{bmatrix} = 0 $ Main difference between finite difference and finite volume? You use an average of points for finite volume and you use exact points for finite difference Use 4th order accurate surface/volume integrals Piece-wise quadratic Express $a$, $b$, and $c$ in terms of $\phi_{i}$ bruh all this is just centered differences… why finite volume? directly conservative higher dimension *irregular grids!*