(vc_sem_reynolds_stress)= # SEM Inlet Reynolds-Stress Tensor and Spectrum ## Why this case matters The Synthetic Eddy Method (SEM) inlet is the workhorse turbulence generator for the solver's atmospheric-boundary-layer and built-environment studies: it injects a fluctuating velocity field at the inlet whose statistics are set by a prescribed mean profile, Reynolds-stress tensor and length scales {footcite:t}`jarrin2006synthetic`. The existing ABL case ({ref}`vc_atmospheric_boundary_layer`) only verifies that the inlet reproduces the mean profile and the streamwise turbulence intensity - that is, the diagonal of the target tensor. It never checks that the full sampled covariance tensor $\langle u'_i u'_j \rangle$ matches the prescribed $R_{ij}$, and in particular it never checks the **off-diagonal shear components** $R_{xz}$ and $R_{yz}$, nor that the injected spectrum follows a target turbulence spectrum. A wrong sign or magnitude of the shear stress, or a wrong spectral distribution, can pass the mean-and-intensity check yet produce wrong gust loads downstream. This case closes that gap - it is the regression check that would have caught issue #901. The setup is deliberately the simplest configuration in which the inlet statistics are exactly the thing measured. A short streamwise box (D3Q27, RRBGK collision, Smagorinsky LES) carries a SEM inlet on the West face and a regularized Neumann outlet on the East face. The spanwise and vertical directions are **periodic**, and the prescribed profile is **constant with height**, so the inlet plane is statistically homogeneous in both in-plane directions. A dense inlet-normal plane a few nodes downstream is sampled over time; the sampled second moments are pooled over the homogeneous $(y, z)$ and over time and compared, component by component, against the prescribed tensor. (vc_sem_reynolds_stress_setup)= ## Setup - **Fluid:** SEM inlet on the West ($x^-$) face, regularized Neumann outlet ($\rho = 1$) on the East ($x^+$) face. Spanwise $y$ and vertical $z$ are periodic. Initialised from the inlet field (`initialization.inlet_field`). - **Mean flow:** uniform with height, $u_x = 0.05$ lattice units, so $\mathrm{Ma} = u_x \sqrt{3} \approx 0.087 < 0.1$. - **Domain:** $64 \times 48 \times 48$ lattice units, single level, block size 8. No body. - **Turbulence model:** Smagorinsky LES, $C_s = 0.17$. - **SEM:** isotropic eddy length scale $\sigma = 8$ lattice units in all directions, eddy volume density 300, fixed random seed for reproducibility. (vc_sem_reynolds_stress_target)= ## Prescribed target The SEM profile (`reference/target_profile.csv`) prescribes, **constant with height**, the mean velocity and the full Reynolds-stress tensor: ```{math} --- label: vc_sem_reynolds_stress_target --- R_{ij} = \begin{bmatrix} R_{xx} & R_{xy} & R_{xz} \\ R_{xy} & R_{yy} & R_{yz} \\ R_{xz} & R_{yz} & R_{zz} \end{bmatrix} = \begin{bmatrix} 2.5\times 10^{-4} & 0 & -5\times 10^{-5} \\ 0 & 1.0\times 10^{-4} & 2\times 10^{-5} \\ -5\times 10^{-5} & 2\times 10^{-5} & 1.0\times 10^{-4} \end{bmatrix} ``` This corresponds to turbulence intensities $I_u = \sqrt{R_{xx}}/U = 31.6\%$ and $I_v = I_w = 20\%$, and a streamwise-vertical shear correlation $\rho_{uw} = R_{xz}/\sqrt{R_{xx} R_{zz}} = -0.316$ (the ABL-like negative sign). The tensor is symmetric positive-definite (all eigenvalues positive), so its Cholesky factor is real. ### Cholesky relation The SEM produces the correlated fluctuation by mapping an uncorrelated unit-variance field $\tilde{u}_b$ through the lower-triangular Cholesky factor $A_{ab}$ of the target tensor: ```{math} --- label: vc_sem_reynolds_stress_cholesky --- u'_a = A_{ab}\, \tilde{u}_b, \qquad A A^{\mathsf{T}} = R, \qquad \langle u'_a u'_b \rangle = A_{ac} \langle \tilde{u}_c \tilde{u}_d \rangle A_{bd}^{\mathsf{T}} = A_{ac} \delta_{cd} A_{bd} = R_{ab}. ``` The solver builds $A$ from the prescribed components as $A_{xx} = \sqrt{R_{xx}}$, $A_{xy} = R_{xy}/A_{xx}$, $A_{yy} = \sqrt{R_{yy} - A_{xy}^2}$, $A_{xz} = R_{xz}/A_{xx}$, $A_{yz} = (R_{yz} - A_{xy} A_{xz})/A_{yy}$, $A_{zz} = \sqrt{R_{zz} - A_{xz}^2 - A_{yz}^2}$ (Eq. 19 of {footcite:t}`jarrin2006synthetic`). The validation is therefore that the **sampled** $\langle u'_i u'_j \rangle$ recovers the **prescribed** $R_{ij}$ through this map and through the LBM transport from the inlet to the measurement plane. (vc_sem_reynolds_stress_params)= ## Simulation parameters A single simulation runs for 30,000 steps; the dense plane is sampled every 5 steps over the last 25,000 steps (after a 5,000-step development window), giving roughly 5,000 snapshots. Because the field is homogeneous in $(y, z)$, the second moments are pooled over the whole plane and over time, which converges the statistics at a modest sample count. | Parameter | Value | | ---------------------------- | --------------------------------------------------------------------- | | Fluid velocity set | D3Q27 | | Fluid collision operator | RRBGK | | Fluid relaxation time $\tau$ | 0.51 ($\nu = 1/300$, $\omega \approx 1.961$) | | LES model | Smagorinsky, $C_s = 0.17$ | | Mean inlet velocity $U$ | 0.05 (uniform with height) | | Domain (lattice) | $64 \times 48 \times 48$, block size 8 | | Boundary conditions | SEM inlet (W), regularized Neumann outlet (E); $y, z$ periodic | | SEM length scale $\sigma$ | 8 (isotropic), eddy volume density 300, seed 1 | | Measurement plane | $x = 8$, full $(y, z)$ span, spacing 1 | | Sampling | every 5 steps from step 5,000 to 30,000 ($\approx 5{,}000$ snapshots) | (vc_sem_reynolds_stress_metrics)= ## Validation metrics **Reynolds-stress tensor.** The notebook removes the homogeneous mean from each velocity component and forms the six independent sampled covariances over the pooled $(y, z, t)$ samples: ```{math} --- label: vc_sem_reynolds_stress_cov --- \langle u'_i u'_j \rangle = \frac{1}{N_{\text{samples}}} \sum_{y, z, t} \left(u_i - \overline{u_i}\right)\left(u_j - \overline{u_j}\right). ``` The pass criterion is **agreement within $\sim 10\%$ on every component** $R_{xx}, R_{yy}, R_{zz}, R_{xy}, R_{xz}, R_{yz}$, with special attention to the shear terms $R_{xz}$ and $R_{yz}$ (correct sign and magnitude). **Energy spectrum.** The 1D longitudinal energy spectrum $E_{11}(k)$ of the streamwise fluctuation, computed along the homogeneous in-plane directions and averaged over the plane and time, should follow the von Karman spectral form in the inertial range {footcite:t}`vonkarman1948progress`: ```{math} --- label: vc_sem_reynolds_stress_vonkarman --- \frac{k\, S_u(k)}{\sigma_u^2} = \frac{4\, (k L_u / U)}{\left[1 + 70.8\, (k L_u / U)^2\right]^{5/6}}, ``` where $S_u$ is the one-sided streamwise velocity spectrum, $\sigma_u^2 = R_{xx}$, $L_u$ the streamwise integral length scale (set by the SEM eddy size $\sigma$), and $k$ the wavenumber. The same comparison may be made against the Kaimal surface-layer spectrum {footcite:t}`kaimal1972spectral` for an ABL context. The expected behaviour is a $-5/3$ inertial-range slope rolling off into the energetic large scales near $k L_u / U \sim 1$. ````{note} **Results pending GPU execution.** This case has not yet been run; the analysis notebook is wired against the prescribed target and the export schema, but its figures and the quantitative pass/fail verdict will be filled in once the case is run on GPU. Run it with: ```bash uv run nassu run validation/inlet/01_sem_reynolds_stress/01_sem_reynolds_stress.nassu.yaml ``` ```` ```{toctree} --- hidden: --- 01_sem_reynolds_stress.ipynb ``` ```{footbibliography} ```