Hypersonic flow over a cylinder - vonkarmaninstitute/pantera-pic-dsmc GitHub Wiki
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
Boundary conditions | |
---|---|
0.25 | |
1.699e19 m-3 | |
25 | |
6585 m/s | |
200 K | |
1500 K |
Gas parameters | |
---|---|
3.595e-10 m | |
0.734 | |
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):
The mean collision time:
We can verify that our numerical parameters can guarantee accurate results:
Pantera needs a main input file that contains the setup for the simulation, including numerical parameters, emitting surfaces, walls and species properties.
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.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!! 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.
Domain_limits:
-1.0 1.0 0.0 1.0 -0.5 0.5
Number_of_cells:
400 200 1
Domain_periodicity:
.FALSE. .FALSE. .TRUE.
Domain_specular:
.FALSE. .FALSE. .TRUE. .FALSE.
Domain_diffuse:
.FALSE. .FALSE. .FALSE. .FALSE.
Boundary_temperature:
300.0
Bool_dump_moments:
.FALSE.
Bool_dump_fluxes:
.FALSE.
Flowfield_output:
'./dumps/'
Particle_dump_output:
'./dumps/'
Fluxes_dump_output:
'./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.
The rest is self-explanatory. Watch out for the quotes in the specified paths.
! ========= Numerical parameters ====================
Fnum: ! Ratio of real-to-simulated particles
1.0e13
Timestep:
1.0e-6
Number_of_timesteps:
100000
Stats_every:
1
RNG_seed:
65344
Dump_part_every:
100001
Dump_grid_start:
2000
Dump_grid_avgevery:
10
Dump_grid_numavgs:
400
Perform_checks:
.FALSE.
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.
! ========= Species and mixtures ==============================
Species_file:
ar.species
Def_mixture:
argon Ar 1.0
! ========= Collisions ==============================
Collision_type: ! [MCC / DSMC / NONE]
DSMC
MCC_background_dens:
1.0e20
MCC_cross_section:
1.0e-18
DSMC_collisions_mixture:
argon
VSS_parameters_file:
arlofthouse.vss
Thermal_bath_bool:
.FALSE.
Thermal_bath_Ttr:
20000.0
! ========= Reactions ==============================
!Reactions_file:
! ar.react
!Wall_reactions_file:
! ar.wall
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 ===================
Initial_particles_bool:
.FALSE.
Initial_particles_dens:
1.e6
Initial_particles_vel:
0. 0. 0.
Initial_particles_Ttra:
300.0 300.0 300.0
Initial_particles_Trot:
0.
Initial_particles_Tvib:
0.
Initial_particles_mixture:
argon
! ========== Injection from line sources =============
! x1 y1 x2 y2 density velocity xyz Ttr Trot mix
Linesource:
-1.0 0.0 -1.0 1.0 1.699e19 6585.0 0.0 0.0 200.0 0.0 argon
Linesource:
-1.0 1.0 1.0 1.0 1.699e19 6585.0 0.0 0.0 200.0 0.0 argon
Linesource:
1.0 1.0 1.0 0.0 1.699e19 6585.0 0.0 0.0 200.0 0.0 argon
! ========== Walls =============
x1 y1 x2 y2 T specular diffuse porous tau react
Wall:
0.152400000000000 0.000000000000000 0.149069694351832 0.031685741680627 1500. .FALSE. .TRUE. .FALSE. 0. .FALSE.
Wall:
0.149069694351832 0.031685741680627 0.139224327744732 0.061986664404752 1500. .FALSE. .TRUE. .FALSE. 0. .FALSE.
Wall:
0.139224327744732 0.061986664404752 0.123294189942742 0.089578472449373 1500. .FALSE. .TRUE. .FALSE. 0. .FALSE.
Wall:
0.123294189942742 0.089578472449373 0.101975504409090 0.113255271402755 1500. .FALSE. .TRUE. .FALSE. 0. .FALSE.
Wall:
0.101975504409090 0.113255271402755 0.076200000000000 0.131982271536748 1500. .FALSE. .TRUE. .FALSE. 0. .FALSE.
Wall:
0.076200000000000 0.131982271536748 0.047094189942742 0.144941013083381 1500. .FALSE. .TRUE. .FALSE. 0. .FALSE.
Wall:
0.047094189942742 0.144941013083381 0.015930137801990 0.151565136854125 1500. .FALSE. .TRUE. .FALSE. 0. .FALSE.
Wall:
0.015930137801990 0.151565136854125 -0.015930137801990 0.151565136854125 1500. .FALSE. .TRUE. .FALSE. 0. .FALSE.
Wall:
-0.015930137801990 0.151565136854125 -0.047094189942742 0.144941013083381 1500. .FALSE. .TRUE. .FALSE. 0. .FALSE.
Wall:
-0.047094189942742 0.144941013083381 -0.076200000000000 0.131982271536748 1500. .FALSE. .TRUE. .FALSE. 0. .FALSE.
Wall:
-0.076200000000000 0.131982271536748 -0.101975504409090 0.113255271402755 1500. .FALSE. .TRUE. .FALSE. 0. .FALSE.
Wall:
-0.101975504409090 0.113255271402755 -0.123294189942742 0.089578472449373 1500. .FALSE. .TRUE. .FALSE. 0. .FALSE.
Wall:
-0.123294189942742 0.089578472449373 -0.139224327744732 0.061986664404752 1500. .FALSE. .TRUE. .FALSE. 0. .FALSE.
Wall:
-0.139224327744732 0.061986664404752 -0.149069694351832 0.031685741680627 1500. .FALSE. .TRUE. .FALSE. 0. .FALSE.
Wall:
-0.149069694351832 0.031685741680627 -0.152400000000000 0.000000000000000 1500. .FALSE. .TRUE. .FALSE. 0. .FALSE.
! ========= MPI parallelization =====================
! == Style for MPI domain partition can be:
! ==
! == 0: longitudinal strips (along x)
! == 1: blocks (equally sized)
!
! For "blocks" style, provide "Domain_partition_num_blocks", giving
! the number of blocks along x and y.
! We expect the number of processes to be N_BLOCKS_X*N_BLOCKS_Y
Partition_style:
0
Partition_num_blocks:
3 3
Line sources and Walls have a side that should face towards the flow part of the domain. Specifically, if a segment is defined by the points
Coordinates for wall points can be generated, for instance, using a Python script. The example was generated using the following:
import numpy as np
import matplotlib.pyplot as plt
d = 0.3048
Nsegments = 15
r = d/2
theta = np.linspace(0, np.pi, Nsegments+1)
for p1, p2 in zip(theta[0:-1], theta[1:]):
print('Wall:')
print(' {x1:2.15f} {y1:2.15f} {x2:2.15f} {y2:2.15f} 1500. .FALSE. .TRUE. .FALSE. 0. .FALSE.'.format(x1=r*np.cos(p1), y1=r*np.sin(p1), x2=r*np.cos(p2), y2=r*np.sin(p2)))
plt.plot([r*np.cos(p1), r*np.cos(p2)], [r*np.sin(p1), r*np.sin(p2)])
plt.show()
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". You can then run the simulation with
mpirun -np [number of processes] ./pantera.exe
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.