Hypersonic flow over a cylinder - vonkarmaninstitute/pantera-pic-dsmc GitHub Wiki

Introduction

This is a basic tutorial on the use of the DSMC functionality of Pantera. For more tutorials, visit the tutorials page.

The test case under study is the 2D hypersonic flow of argon over a cylinder. It is inspired by the results shown in the PhD thesis of Andrew J. Lofthouse. The case selected has $\text{Kn}_\infty=0.25$, $\text{M}_\infty=25$. The simulation parameters and boundary conditions are summarized in the following tables.

Boundary conditions
$\text{Kn}_\infty$ 0.25
$n_\infty$ 1.699e19 m-3
$M_\infty$ 25
$U_\infty$ 6585 m/s
$T_\infty$ 200 K
$T_w$ 1500 K
Gas parameters
$d_\text{ref}$ 3.595e-10 m
$\omega$ 0.734
$T_\text{ref}$ 1000 K
Simulation parameters
Cylinder diameter 12 inches = 0.3048 m
Domain size 2 m × 1 m
Number of cells 400 × 200
Time step 1e-6 s
Particle weight 1e13

Considering that a density ratio of about 30 and a maximum translational temperature of 30000 K are expected, we can compute the worst-case gas collisional parameters:

The mean free path, (computed ''a posteriori'' in Paraview using the final result):

$\lambda = \dfrac{1}{\sqrt{2}\pi d_\text{ref}^2 n \left( \dfrac{T_\text{ref}}{T_\text{tr}} \right)^{\omega-\frac{1}{2}}} \approx 5\text{ mm}$

The mean collision time:

$\tau = \dfrac{1}{\sqrt{2}\pi d_\text{ref}^2 n \left( \dfrac{T_\text{ref}}{T_\text{tr}} \right)^{\omega-1} \sqrt{\dfrac{8kT_\text{ref}}{\pi m}} } \approx 5\times 10^{-6}\text{ s}$

We can verify that our numerical parameters can guarantee accurate results:

$\Delta x = 5 \text{ mm} \approx \lambda$ ! Should actually be a bit finer.

$\Delta t = 10^{-6} \text{ s} < \tau/5$

$U_\infty \Delta t = 6.5 \text{ mm} \approx \Delta x$

Pantera input files

Pantera needs a main input file that contains the setup for the simulation, including numerical parameters, emitting surfaces and species properties and it also requires a .su2 file with generated mesh for the simulation.

The file is read line-by-line. Lines that start with "!" are considered comments and are therefore discarded. Generally the order in which the lines appear doesn't matter, but there are some exceptions, so try to keep the ordering shown in this example.

We can now go through the file one section at the time.

Mesh generation

We first build the mesh using GMSH. Assuming the domain+cylinder paramterers and the numerical constraint for the cell size, we can generate the 2D mesh with the following input in .geo file:

// INPUT FOR A .GEO FILE
cell_size = 0.005; // Set the cell size for the domain

Point(1) = {-1, 0, 0, cell_size};
Point(2) = {1, 0, 0, cell_size};
Point(3) = {1, 1, 0, cell_size};
Point(4) = {-1, 1, 0, cell_size};
Point(5) = {-0.1522, 0, 0, cell_size};
Point(6) = {0, 0.1522, 0, cell_size};
Point(7) = {0.1522, 0., 0, cell_size};
Point(8) = {0, 0, 0, cell_size};

Line(1) = {7, 2};
Line(2) = {2, 3};
Line(3) = {3, 4};
Line(4) = {4, 1};
Line(5) = {1, 5};

Circle(6) = {5, 8, 6};
Circle(7) = {6, 8, 7};

Curve Loop(1) = {3, 4, 5, 6, 7, 1, 2};
Plane Surface(1) = {1};

Physical Curve("Inlet", 8) = {4};
Physical Curve("Outlet", 9) = {2};
Physical Curve("Side", 10) = {3};
Physical Curve("Axis", 11) = {5, 1};
Physical Curve("Cylinder", 12) = {6, 7};
Physical Surface("Domain", 13) = {1};

where the physical groups will be used for boundary condition definition.

Computational domain and grid

We can now proceed to the actual input file as follows

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!                 Input file for PANTERA                                !!!!
!!!!                                                                       !!!!
!!!! The program reads is line by line, and when it finds a known line, it !!!!
!!!! reads and saves the value in the next one.                            !!!!
!!!! All other lines are ignored (you can comment etc).                    !!!!
!!!! You can put trailing comments on lines, starting with "!" symbol:     !!!!
!!!! the program will remove them before checking the content of a line.   !!!!
!!!!                                                                       !!!!
!!!! All units are SI [m, kg, s, ...]                                      !!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

! ========= Computational domain and grid ===========

Dimensions:
2
Axisymmetric:
.FALSE.
Number_of_cells: ! Only for structured grids
1    1    1
Domain_limits:
-1.    1.    0.    1.    -0.5   0.5 ! xmin xmax ymin ymax zmin zmax
Domain_periodicity:
.FALSE.   .FALSE.   .TRUE.   ! Z is periodic in 2D
Domain_specular:
.FALSE.    .FALSE.    .FALSE.    .FALSE.
Domain_diffuse:
.FALSE.    .FALSE.    .FALSE.   .FALSE.


! Setup for PIC. Since we simulate neutrals only we choose 'none'
PIC_type:
none

! Load mesh from file
Mesh_file_SU2:
'./mesh.su2'

! specify all paths or just "All_output_path:" + path
All_output_path:
'./dumps/'

Dimensions: input the dimensions of the simulation: 1 for 1D or 2 for 2D/2D-axi

Domain_limits: input the limits of the simulation box in the order xmin, xmax, ymin, ymax, zmin, zmax. For 2D-axi, these become: zmin zmax, rmin, rmax, thetamin, thetamax.

Domain_periodicity: input whether the domain should be periodic in the x, y, and z dimensions.

Domain_specular:, Domain_diffuse: input whether the boundaries at xmin, xmax, ymin, ymax, should be specular or diffuse.
These are mainly used for structured grids, but we will use unstructured grid.

The rest is self-explanatory. Watch out for the quotes in the specified paths.

Numerical parameters

! ========= Numerical parameters ====================

Fnum:  ! Ratio of real-to-simulated particles
1e13
Timestep:
1e-6
Number_of_timesteps:
10000
Stats_every: ! screen output every th timestep
1

RNG_seed:
65344

Binary_output:
.TRUE.

Dump_grid_start:
0
Dump_grid_avgevery: !average every th time step
10
Dump_grid_numavgs: ! how many averages before saving
50

Dump_bound_start:
0
Dump_bound_avgevery:
10
Dump_bound_numavgs:
50

Dump_part_start: ! start dumping particles
1000000
Dump_part_every: ! dumping particles every th timestep
1000000

Perform_checks: !50 .csv files -- saves integral quantitites (moments, etc)
.FALSE.

! We can setup a domain type if needed (usually for PIC =/= none)
! Domain_type:
! Domain fluid 1.0

Fnum: specify the macroparticle weight (how many real particles a simulated particle represents).

Stats_every: input the interval at which you want information printed to stdout.

Dump_part_every: input the interval at which you want to dump all simulated particles to file (careful! the file could be very large).

Dump_grid_start:, Dump_grid_avgevery: Dump_grid_numavgs: specify at which time step you want the averaging to start, the interval at which it should happen, and the number of time steps that should be averaged before the result is written to file. In the example, the first file will be written at time step 6000, and will be the result of the average of timesteps 2000, 2010, 2020, 2030,..., 5990, 6000. Thus a total of 400 averaged fields.

Dump_grid_start:, Dump_grid_avgevery: Dump_grid_numavgs: specify at which time step you want the averaging to start at physical boundaris, the interval follows exactly the same rule as for Dump_grid_start:

Dump_domain: selects the type of a domain in which particles are simulated.

Gas properties

! ========= Species and mixtures ==============================

Species_file:
    ar.species
    
Def_mixture:
    argon Ar 1.0
    
! ========= Collisions ==============================

! Choose DSMC collisions using VSS parameters
Collision_type: ! [MCC / DSMC / BGK / NONE]
DSMC

! Choose a mixture for collisions (only argon in this case)
DSMC_collisions_mixture:
argon

! VSS parameters for argon-argon collision
VSS_parameters_file:
arlofthouse.vss

Species_file: specify the file name of the file containing species properties. For our example, the file contains just one species called Ar, and reads:

Ar  40.00  6.63E-26  0   0.0   0   0.0    0.0    1.0   0.0

Where the values are in order:

  • Name of the species
  • Molecular mass in amu
  • Molecular mass in kg
  • Number of rotational DOF
  • Rotational relaxation number
  • Number of vibrational DOF
  • Vibrational relaxation number
  • Characteristic vibrational temperature
  • Relative species weight (leave at 1)
  • Electric charge (expressed as a multiple of the proton's charge)

Def_mixture: specify a mixture from its individual species and their molar fractions. Mixtures are later used in different procedures for convenience. The format is always:

  • Name of the mixture
  • Name of the first component
  • Molar fraction of the first component
  • ...
  • Name of the Nth component
  • Molar fraction of the Nth component

DSMC_collisions_mixture: specify the name of a previously defined mixture that contains all the species that undergo DSMC collisions.

VSS_parameters_file: specify the file name of the file containing collision properties. For our example, the file contains just one species called Ar, and reads:

Ar   3.595E-10    0.734  1000.0  1.0

Where the parameters are:

  • Name of the species (as previously defined in the species file)
  • $d_\text{ref}$
  • $\omega$
  • $T_\text{ref}$
  • $\alpha$
! ========= Initial particle seed ===================
! If we want to start with initially full domain, uncomment Initial_particles block

! mixture   density     3 components velocity   3 components temperature    rotational_temp     vibrational_temp
! Initial_particles:
! argon   1.699e19    6585.    0.    0.    200.    200.    200.    0.    0.


! ========= Emission from boundaries + Boundary conditions =====================
! This is a setup of boundary conditions for unstructured grid (loaded from .su2 file)

! Inlet and Side (top) will emit particles according to given parameters
Boundary_emit:
Inlet   argon    1.699e19  6585.  0.  0.  200.   0. 0.

Boundary_emit:
Side   argon    1.699e19  6585.  0.  0.  200.   0. 0.


! Diffusive boundary condition on the cylinder with a given surface temperature
Boundary_condition:
Cylinder diffuse 1500.0

! Specular boundary condition on the axis of symmetry
Boundary_condition:
Axis specular


! For MPI parallelization
Partition_style:
stripsx !strips in x direction

Initial_particles: specify the initially sampled particles in the whole domain, where the values are in order:

  • Name of the mixture to be sampled
  • Density in $\mathrm{m^{-3}}$
  • 3 components of velocity in $\mathrm{m \ s^{-1}}$ in order - x y z
  • 3 components of translational temperature in $\mathrm{K}$ in order - x y z
  • Vibrational temperature in $\mathrm{K}$
  • Rotational temperature in $\mathrm{K}$

Boundary_emit: specify the emission of particles from a physical boundary, where the values are in order:

  • Name of the physical boundary
  • Name of the mixture to be sampled
  • Density in $\mathrm{m^{-3}}$
  • 3 components of velocity in $\mathrm{m \ s^{-1}}$ in order - x y z
  • Translational temperature in $\mathrm{K}$ (for emission only one value)
  • Vibrational temperature in $\mathrm{K}$
  • Rotational temperature in $\mathrm{K}$

Boundary_condition: specify the boundary condition with order:

  • Name of the physical boundary
  • Type of a boundary condition
  • < additional parameters for specific type of the boundary condition >

Running the simulation

You should have a version of MPI installed on your machine and compiled Pantera.

In the same folder where you have pantera.exe, you should also have a folder named "dumps", and the three input files "input", "ar.species", and "arlofthouse.vss" and the generated ".su2" mesh file. You can then run the simulation with

mpirun -np [number of processes] ./pantera.exe

Results

The flow field quantities are written directly in the VTK format, and can be visualized using Paraview. The results should be in very good agreement with those of Lofthouse.

⚠️ **GitHub.com Fallback** ⚠️