Skip to content

1D Sod shock tubes

Oleg Korobkin edited this page Jun 3, 2020 · 1 revision

Problem description

The Sod shock tubes provide standard tests with a classical Riemann problem for accuracy in computational fluid dynamics.

Generate initial data

First, we need to generate initial data. In this example, we use the standard test 1 and 10,000 particles. Copy the following parameter settings into a parameter file, e.g. sod_test1_n10000.par:

# Sodtube test #1 for 10000 particles in linear dimension

# initial data
  initial_data_prefix = "sod_test1_n10000"
  lattice_nx = 10000      # particle lattice linear dimension
  poly_gamma = 1.4        # polytropic index
  sodtest_num  = 1        # which test to generate (1..5)
  equal_mass = yes        # determines whether equal mass particles are used or equal separation
  sph_eta = 1.5
  lattice_type = 0        # only matters for dimensions > 1; in 3D: 0=rectangular, 1=hcp, 2=fcc lattice
  domain_type = 0         # 0:cube, 1:sphere
  box_length = 6.0

# evolution
  sph_kernel = "Wendland C6"
  initial_dt = 1e-12
  sph_variable_h = yes
  adaptive_timestep = yes
  timestep_cfl_factor = 0.75
  #thermokinetic_formulation = no
  final_iteration = 5000
  out_screen_every = 1
  out_scalar_every = 1
  out_h5data_every = 10
  out_diagnostic_every = 1
  output_h5data_prefix = "ev_sod_test1_n10000"

Generate initial data using the 1D generator:

mpirun -np 1 ./sodtube_1d_generator sod_test1_n10000.par

The file sodtube_1d_generator can be found in your build directory at ${PATH_TO_FLECSPH}/flecsph/build/app/id_generators, or in the install directory, ${CMAKE_PREFIX_PATH}/bin. The command above will produce a particle file sod_test1_n10000.h5part.

Run the test

Use the following command to produce hydrodynamic evolution:

mpirun -np 1 ./hydro_1d sod_test1_n10000.par

This will produce evolution files: ev_sod_test1_n10000.h5part contain particle data, and scalar_reductions.dat contain various scalar reductions: total mass, energy, internal energy, total momentum etc.

Plotting the data

There are several different ways to plot the results. We encourage user to use whatever user's convenient way but please contact flecsph-support@lanl.gov if you would like to get plotting script from us.