# Turbulent Channel Flow with NekRS + Ginkgo Simulates turbulent channel flow at $Re_\tau = 590$ using NekRS for the spectral element discretization and time stepping, with Ginkgo replacing NekRS's built-in PCG for the pressure Poisson solve at every time step. Compatible with NekRS v26+. ## Integration Overview This example extends the [NekRS Poisson example](../poisson/doc) to a full time-dependent simulation. The Ginkgo solver is called at every time step within NekRS's operator-splitting scheme. The same `NekRSOperator` wrapper from `nekrs/nekrs_ginkgo.hpp` is reused. ## Key Integration Points ### Setup ```{literalinclude} turbulent_channel.cpp :language: cpp :start-after: [udf-setup-channel] :end-before: [/udf-setup-channel] ``` ### Per-Timestep Solve Ginkgo's CG replaces NekRS's built-in PCG at every time step: ```{literalinclude} turbulent_channel.cpp :language: cpp :start-after: [udf-execute-channel] :end-before: [/udf-execute-channel] ``` ## Building NekRS UDFs compile as shared libraries (plugins): ```bash cmake -S . -B build --preset default \ -DNEKRS_DIR=/path/to/nekrs \ -DGinkgo_DIR=/path/to/ginkgo cmake --build build ``` ## Running **Note:** Running has not been tested end-to-end. The code compiles against the NekRS v26 API, validating the integration pattern, but actually executing it requires a full NekRS case setup. To run, copy the built shared library into a NekRS turbulent channel case directory (e.g., the `channel` example bundled with NekRS): ```bash cp -r /path/to/nekrs/examples/channel /tmp/test-channel cp build/libturbulent_channel.so /tmp/test-channel/ cd /tmp/test-channel && mpirun -np 4 nekrs --setup channel ``` As with the Poisson example, a production integration would need to disable NekRS's built-in pressure solve and route it through Ginkgo. ## Expected Output (approximate) ```text [Ginkgo] Turbulent channel flow setup [Ginkgo] Pressure DOFs: 262144 [Ginkgo] Step 500, time = 1.0, total Ginkgo solves: 500 [Ginkgo] Step 1000, time = 2.0, total Ginkgo solves: 1000 ```