The simulation proceeds in stages:
Move into the mb_cns/work/sod2 directory and copy the files sod2.p and sod2.bez from the mb_cns/examples/sod2 directory. The files sod2.p and sod2.bez contain the input parameters for the simulation and the Bezier geometry data as discussed above. They could be generated from the sod2.sit script by the scriptit program.
Assuming that your path includes the directory $HOME/cfd_bin, invoke the preprocessor with the command
% mb_prep.exe -f sod2to generate the grid and initial solution files. Invoke the flow solver using
% mb_cns.exe -f sod2Run time should be a few seconds. It is approximately 20 seconds on a Toshiba T2130CS laptop running Win-95 and the GNU C compiler. If all goes well, a total of 118 steps should be taken to reach a simulation time of 0.4ms.
The flow solution will be written to the file sod2.s and a history file sod2.h will also be written. The postprocessor mb_post.exe may be used to reformat the flow solution for plotting.
Alternatively, mb_prof.exe may be used to extract a profile of the flow solution (from sod.s) along one of the coordinate directions. The data for the plots in Report 10/96 were obtained by asking for two strips, one from block 0 and the other from block 1, but both with iy=1.
% mb_prof.exe -fp sod2.p -fg sod2.g -fs sod2.s -fo sod2.dat \
-yline 0 1 -yline 1 1
This is a good example for exercising the codes when first installing them on a new machine. The simulation is short, on the order of a few seconds, and the output graphic is produced as a GIF file which can be viewed with a Web browser. If all goes well, you should see an image as shown below.
The simulation is of the transient flow following a shock as it travels over a 20 degree cone. The simulation is stopped after 300 steps, shortly after the shock has passed out of the right-most boundary. The flow should eventually settle to a conically-symmetric flow but, because the simulation has been stopped short, the bow shock propagating from the apex is clearly curved near the right boundary.
Move into the mb_cns/work/cone20 directory and copy the files cone20.sit and cone20.sh from the mb_cns/examples/cone20 directory.
The following figure, showing coloured pressure contours for the cone20 test case, was produced by running the shell script cone20.sh
#! /bin/sh # cone20.sh # exercise the Navier-Stokes solver for the Cone20 test case. # It is assumed that the path is set correctly. # Generate the Bezier and Input parameter files from the Script File. scriptit.exe < cone20.sit > cone20.log # Generate the Grid and Initial Solution Files. mb_prep.exe -f cone20 # Integrate the solution in time. mb_cns.exe -f cone20 # Extract the solution data and reformat. mb_post.exe -fp cone20.p -fg cone20.g -fs cone20.s \ -fo cone20 -generic # Pick up the reformatted data and make a contour plot. mb_cont.exe -fi cone20.gen -fo cone20.gif -var 6 -gif \ -colour -mirror -xrange 0.0 1.0 0.5 -yrange -1.0 1.0 0.5 echo At this point, we should have a plotted solution in cone20.gif
CPU times for the 300-step version of this test case:
The following figure, showing coloured density contours at an early time (5 microseconds) in the a98 simulation, was produced by running the shell script a98.bat on a Pentium based computer with MS-Windows-95.
Move into the mb_cns\work\a98 directory and copy the files a98.sit and a98_run.bat from the mb_cns\examples\a98 directory. The batch file to run the example contains the following text.
Rem a98_run.bat Rem Exercise the Navier-Stokes solver for Amberyn's cylinder. Rem It is assumed that the path is set and that Rem the script file "a98.sit" has been correctly written. Rem Stage 1: Rem Generate the input parameter and Bezier files Rem (a98.p and a98.bez respectively) from the script file. Rem A record of the transactions is recorded in the log file Rem "a98.log" so that, if anything goes wrong, you can browse Rem the log file and diagnose the problem. scriptit < a98.sit > a98.log Rem Stage 2: Rem Pick up the input parameter and Bezier files Rem and generate the grid and initial solution files Rem (a98.g and a98.s0). Rem Write these files as binary data. mb_prep -wb -f a98 Rem Stage 3: Rem Pick up the grid and initial solution files as Rem binary data and integrate the solution in time. Rem The solution data at later times will be written Rem to the solution output file "a98.s" mb_cns -rb -wb -f a98 Rem Stage 4: Rem At this point, we have a number of solution "frames" Rem in the solution output file "a98.s". Rem Extract the solution data at t = 5 microseconds Rem and reformat so that the generic contour plotting Rem program can be used to generate an image. mb_post -rb -fp a98.p -fg a98.g -fs a98.s -fo a98_05 -t 5.0e-6 -generic Rem Stage 5: Rem Pick up the reformatted data and make a contour plot. mb_cont -fi a98_05.gen -fo a98_05.gif -gif -colour -mirror -xrange -0.005 0.015 0.005 -yrange -0.015 0.015 0.005 Rem Finished: Rem At this point, we should have a density contour plot Rem as a GIF image in in the file "a98_05.gif". Rem This GIF image can be viewed with any web browser.
CPU times for this test case:
The following animation, showing coloured density contours every 5 microseconds) in the a98 simulation, was produced by running the shell script a98_animate.bat to produce several GIF files which were then pasted together as an animated GIF image.
Further postprocessing can be done. For example, the following batch file produces a set of Tecplot data files, one for each time instant stored in the solution file, and then extracts the flow data along the stagnation streamline.
Rem a98_post.bat Rem Further post-processing of the simulation of Amberyn's cylinder. Rem It is assumed that the solution files from the simulation Rem are in the current directory. Rem Pick up the solution data, extract the data for individual times Rem and generate a set of TECPLOT files mb_post -rb -fp a98.p -fg a98.g -fs a98.s -t 5.0e-6 -fo a98_05 -tecplot mb_post -rb -fp a98.p -fg a98.g -fs a98.s -t 10.0e-6 -fo a98_10 -tecplot mb_post -rb -fp a98.p -fg a98.g -fs a98.s -t 15.0e-6 -fo a98_15 -tecplot mb_post -rb -fp a98.p -fg a98.g -fs a98.s -t 20.0e-6 -fo a98_20 -tecplot mb_post -rb -fp a98.p -fg a98.g -fs a98.s -t 25.0e-6 -fo a98_25 -tecplot mb_post -rb -fp a98.p -fg a98.g -fs a98.s -t 30.0e-6 -fo a98_30 -tecplot mb_post -rb -fp a98.p -fg a98.g -fs a98.s -t 35.0e-6 -fo a98_35 -tecplot mb_post -rb -fp a98.p -fg a98.g -fs a98.s -t 40.0e-6 -fo a98_40 -tecplot Rem Pick up the solution and extract the data along the Rem stagnation steamline at t = 40 microseconds. Rem This line is close to the iy=1 line of cells in block 0. mb_prof -rb -fp a98.p -fg a98.g -fs a98.s -t 40.0e-6 -fo a98_40.dat -yline 0 1The extracted data is stored as ASCII text and can be plotted using any standard graphing package. The following file shows the commands needed to use GNU-Plot to produce a postscript figure of the temperature along the stagnation line.
# a98_stag.gnu # GNU Plot commands to produce a graph of temperature # along the stagnation line. set output "a98_stag.ps" set terminal postscript eps set title "Stagnation line Temperature" set xlabel "x, metres" set xrange [-0.005:0.0] set xtics -0.004,0.002,0.0 set ylabel "T, degrees K" set yrange [1500:4500] plot "a98_40.dat" using 1:10
The following figure shows coloured Mach number contours over a period of 80 microseconds for a Ben Stewart's Muses-C model in the X-2 expansion tube. The flow domain includes the last few centimetres of the expansion tube and part of the test section/dump tank. The gas is assumed to be inviscid, ideal air with a ratio of specific heats equal to 1.3. Note that the flow over the blunt nose of the capsule is established within 15 microseconds of shock arrival while the wake region is still developing slowly at the final time of 80 microseconds.
The simulation takes 4886 steps and requires the following CPU times:
The script files can be found in the mb_cns/examples/cap directory.
An attempt has been made to adhere to ONE set of physical dimensions. Although the use of dimensional quantities within a CFD code is viewed as a weakness (and impure) by some CFD people, I made too many mistakes when converting between physical quantites and nondimensional parameters. The code therefore uses the SI-MKS unit system (i.e. metres, kilograms, seconds). However, the only place where units are encountered is in the gas.c module (where the physical properties of each gas are defined).