### 4 Three-dimensional Channel flow

Now that we have presented the various stability-analysis tools present in Nektar++ , we conclude showing the capabilities of the code in three spatial dimensions. In the folder
`\$NEKTUTORIAL/Channel-3D/Stability` there are the files that are required for the stability analysis - note that we do not show the geometry and the base flow generation (we will be using the exact solution) since we have already presented these features in the previous tutorials.

The case considered is similar to the channel flow presented in section 1. However, in this case the Reynolds number is set to 10000. In order to run a three-dimensional simulation, we can either run the full 3D solver by creating a 3D geometry or use a 2D geometry and specify the use of a Fourier expansion in the third direction. The last method is also known as 3D homogenous 1D approach. Here we will present this approach.

Specifically, we use a 2D geometry and we add the various parameters necessary to use the Fourier expansion. Note that in the 2D plane we will use a `MODIFIED` expansion basis with `NUMMODES=11`.

Task 4.1 In the file `\$NEKTUTORIAL/Channel-3D/Stability/PPF_R10000_3D.xml`, make the following changes:
• Add a `SOLVERINFO` tag called `HOMOGENEOUS` and set it to `1D`.
• Add two additional `SOLVERINFO` tags called `ModeType` and `BetaZero` and set them to `SingleMode` and `True`, respectively.
• Add two `PARAMETERS` called `HomModesZ` and `LZ` and set them to `2` and `1`, respectively.
• Add two other `PARAMETERS` called `realShift` and `imagShift` and set them to `0.003` and `0.2`, respectively.

Now run the solver - the terminal screen should look like this:

=======================================================================
Solver Type: Coupled Linearised NS
=======================================================================
Arnoldi solver type    : Modified Arnoldi
Single Fourier mode    : true
Beta set to Zero       : true (overrides LHom)
Shift (Real,Imag)      : 0.003,0.2
Krylov-space dimension : 64
Number of vectors      : 2
Max iterations         : 500
Eigenvalue tolerance   : 1e-06
======================================================
Initial Conditions:
- Field u: 0 (default)
- Field v: 0 (default)
- Field w: 0 (default)
Writing: "PPF_R10000_3D_0.chk"
Matrix Setup Costs: 1.97987
Multilevel condensation: 0.427631
Inital vector       : random
Iteration: 0
Iteration: 1 (residual : 4.89954)
Iteration: 2 (residual : 3.64295)
Iteration: 3 (residual : 2.54314)
....
Iteration: 20 (residual : 1.35156e-05)
Iteration: 21 (residual : 1.64786e-06)
Iteration: 22 (residual : 1.92473e-07)
Writing: "PPF_R10000_3D.fld"
L 2 error (variable u) : 3.01846
L inf error (variable u) : 2.25716
L 2 error (variable v) : 1.8469
L inf error (variable v) : 0.985775
L 2 error (variable w) : 5.97653e-06
L inf error (variable w) : 1.2139e-05
EV:  0      0.518448      -26.6405    0.00373022      0.162477
Writing: "PPF_R10000_3D_eig_0.fld"
EV:  1      0.518448       26.6405    0.00373022      0.237523
Writing: "PPF_R10000_3D_eig_1.fld"
Warning: Level 0 assertion violation
Complex Shift applied. Need to implement Ritz re-evaluation of eigenvalue.
Only one half of complex value will be correct

Now convert the two files containing the eigenvectors and visualise them in Paraview or VisIt - the solution should look like the one below:

Task 4.2 The complete input file `\$NEKTUTORIAL/Channel-3D/Stability/PPF_R15000_3D.xml` has been provided to show a full 3D unstable eigenmode where β is not zero. Run this file and see that you obtain the eigenvalue 0.00248682 ±−0.158348i

Task 4.3 You can now see what the difference when not using an imaginary shifting. Set the parameters imagShift=0, kdim=384 and nvec=196.

This should take 195 iterations to complete and hidden in the list of eigenvalues should be the unstable values 0.00248662 ± 0.158347i. They were eigevalues 152 and 153 in my run.