# Kelvin-Helmholtz Instability (khInstability.pre)¶

Keywords:

hydrodynamics, Kelvin-Helmholtz Instability

## Problem description¶

This problem demonstrates the Kelvin-Helmholtz instability for the case of a velocity difference across the interface between two different fluids that differ in density by a factor 2. A finite-width shear layer is used to ensure results converge at finite resolution. For the two-dimensional version of the problem setup considered here, we use a domain

$$(-PAR_{LENGTH}/2,-PERP_{LENGTH}/2) \times (PAR_{LENGTH}/2,PERP_{LENGTH}/2)$$

with periodic boundary conditions in the PAR direction and reflecting wall boundary conditions in the PERP direction. For the three-dimensional version of the problem setup considered here, we use a domain

$$(-PAR_{LENGTH}/2,-PERP_{LENGTH}/2,-PAR_{LENGTH}/2) \times (PAR_{LENGTH}/2,PERP_{LENGTH}/2,PAR_{LENGTH}/2)$$

with periodic boundary conditions in the PAR directions and reflecting wall boundary conditions in the PERP direction. A single mode perturbation is used to seed the instability.

This simulation can be performed with a USimBase license.

## Creating the run space¶

The Kelvin-Helmholtz Instability example is accessed from within USimComposer by the following actions:

• Select the New from Template menu item in the File menu.
• In the resulting New from Template dialog, expand USimBase: Basic Physics Capabilities.
• Select Kelvin-Helmholtz Instability and press the Choose button.
• In the Choose a name for the new runspace dialog, press the Save button to create a copy of this example in your run area.
• Press the Save And Process Setup button in the upper right corner of the Editor pane.

The basic example variables are editable in the Editor pane of the Setup window as shown below. After any change is made, the Save and Process Setup button must be pressed again before a new run may commence.

## Input file features¶

The input file allows the user to set a variety of problem parameters related to the physics, initial conditions, domain and solver used for the Kelvin-Helmholtz instability.

The following parameters control the physics of the Kelvin-Helmholtz instability:

• MHD = False,True selects whether to evolve the problem in the inviscid hydrodynamic limit (MHD = False) or the ideal magnetohydrodynamic limit (MHD = True).
• MACH_NUM sets the ratio of the flow velocity to the sound speed (the Mach number). Note that the Kelvin-Helmholtz instability is stabilized for Mach Numbers greater than unity.
• BETA controls the ratio of the gas pressure to the magnetic pressure for problems solved in the magnetohydrodynamic limit (i.e. when MHD = True). Note that, for strong enough magnetic fields (small enough BETA), the Kelvin-Helmholtz instability is stabilized.
• GAS_GAMMA sets the adiabatic index (ratio of specific heats) of the fluid.

The following parameters control the shear layer that drives Kelvin-Helmholtz instability and the perturbation used to seed the Kelvin-Helmholtz instability:

• SHEAR_LAYER_WIDTH sets the width of the shear layer. This should be resolved by 2-3 cells on the mesh in order for the instability to grow.
• PERTURB_AMP sets the strength of the perturbation, seeding the instability relative to the flow velocity.
• PERTURB_WIDTH sets the spatial width of the perturbation that seeds the instability.

The following parameters control the dimensionality, domain size and resolution of the simulation:

• NDIM = 2,3 selects whether to run the problem in two- or three-dimensions.
• PAR_LENGTH sets the size of the domain in the direction parallel to the shear layer.
• PERP_LENGTH sets the size of the domain in the direction perpendicular to the shear layer.
• PAR_ZONES sets the number of zones in the direction parallel to the shear layer.
• PERP_ZONES sets the number of zones in the direction perpendicular to the shear layer.

The following parameters the length of the simulation and data output:

• TEND sets the end time for the simulation.
• NUMDUMPS sets the number of data dumps during the simulation
• WRITE_RESTART = False,True tells USim to output data necessary to restart the simulation. If this parameter is set to False then the Restart at Dump Number functionality in the Standard tab under Runtime Options in the Run window will not be available.

The following parameters control the USim solvers used to evolve the Kelvin-Helmholtz instability:

• TIME_ORDER = first,second,third,fourth sets the order of accuracy for the time-integration.
• DIFFUSIVE = False,True sets whether to use diffusive (but robust!) spatial integration schemes.
• DEBUG = False,True sets whether to output data for debugging a run. Warning: this will output A LOT of information!

## Running the simulation¶

After performing the above actions, continue as follows:

• Proceed to the Run window as instructed by pressing the Run icon in the workflow panel.
• To run the simulation, click on the Run button in the upper right corner of the Logs and Output Files pane.

You will also see the engine log output in the Logs and Output Files pane. The run has completed when you see the output, “Engine completed successfully.”

## Visualizing the results¶

After performing the above actions, continue as follows:

• Proceed to the Visualize window as instructed by pressing the Visualize icon in the workflow panel.
• Press the Open button to begin visualizing.
• Expand Scalar Data and click the check box for fluids/density to visualize fluid densities.
• Drag the slider at the bottom of the Visualization Results pane to move through the simulation in time. The density of the Kelvin-Helmholtz instability at the end of the simulation is shown in Fig. 76.

Figure 76: Visualization of the density in the Kelvin-Helmholtz Instability example

## Further experiments¶

• Set MHD to True to solve the magnetized Kelvin-Helmholtz instability, which demonstrates USim capabilities to amplify magnetic fields.
• Set TIME_ORDER to third or fourth to see the effect of increased temporal accuracy on the Kelvin-Helmholtz instability.
• Set NDIM to 3 to solve the Kelvin-Helmholtz instability in 3D. The increased computational requirements of such a simulation means that you should enable Run with MPI in the MPI tab under Runtime Options in the Run Window.