Kelvin-Helmholtz Setup
Problem setup: Kelvin-Helmholtz instability
The initial condition is defined in GenerateProblem in main.f90.
Hydrodynamic variables
Uniform density and pressure are set as
A shear flow is imposed in the \(x\)-direction with two shear layers centered at \(y=\pm 0.5\). The main parameters are:
- \(\Delta v = 2.0\)
- shear-layer width \(w = 0.05\)
The initial \(x\)-velocity is
A small perturbation is added in the \(y\)-direction to seed KH roll-up. It is sinusoidal in \(x\) and localized around the two shear layers. The parameters are:
- amplitude \(10^{-2}\)
- localization width \(\sigma = 0.2\)
The perturbation is
The \(z\)-velocity is initially
Additionally, the code contains a random perturbation term for \(v_x\), but in the current setup it is disabled:
- \(\mathrm{rrv}=0.0\times 10^{-2}\)
If enabled, the perturbation is
Magnetic field
In the current KH setup, the magnetic field is initialized to zero:
Tracer / composition field
Xcomp(1,...) is initialized as a smooth step-like tracer associated with the two layers, useful for visualizing mixing:
Boundary conditions
Boundary conditions are applied in config.f90. In the default setup, reflection boundary conditions are used in the \(y\)-direction and periodic boundary conditions are used in the other directions.
integer,parameter:: periodicb=1,reflection=2,outflow=3
integer,parameter:: boundary_xin=periodicb , boundary_xout=periodicb
integer,parameter:: boundary_yin=reflection, boundary_yout=reflection
integer,parameter:: boundary_zin=periodicb , boundary_zout=periodicb
Real-time analysis
RealTimeAnalysis in src_f90_acc_device/main.f90 evaluates bulk diagnostics during the run and writes them to t-prof.csv.
For each cell, the cell volume is computed as
The routine then performs MPI reductions for
The reported diagnostics are
and
Here, mix is a simple mixing indicator based on the tracer field. It is close to zero in unmixed regions where \(X_{\mathrm{comp}}\) is near 0 or 1, and becomes larger as the two layers mix.
The file t-prof.csv contains four columns:
timemixsqrt(<v_y^2>)A*exp(Gamma*time)
The fourth column is a reference exponential growth curve:
The growth rate is \(\Gamma\).
with the hard-coded parameters
- \(A = 1.2\times 10^{-3}\)
- \(\Gamma = 1.49\)
These values are used as a practical comparison metric for KH growth in this setup. The source comment notes that this is not a general analytic growth rate for finite-width shear layers, but an empirical reference value for this problem.