Overview of Running the L1d Programs
L1d is actually the middle element of a larger package that
includes pre- and post-processing programs.
These programs are:
- l_script.py
for the translation of the Python script into the classic
input parameter file (.Lp).
- l_prep
for the preparation of a starting flow solution and
tube definition.
- l1d
the main simulation code.
This picks up the starting solution and integrates in time
for a fixed number of steps or until a specified time is
reached.
While it does the integration, it also writes solution data
to a number of files at specified time increments.
- l_post
which can be used to extract a flow solution at a particular
time and write it to another file.
This can be used to restart the simulation (again using l1d)
or, if the solution data is reformatted appropriately, can be
used as input to a plotting program.
- l_trim can be used to
trim cells from a single gas slug.
Files containing single gas slugs can be obtained by using
l_post with the -split option.
- l_hist
for the extraction of history data at particular x-locations
or gas cells.
- piston
for the extraction of piston data.
- sptime
for the extraction of flow state at a number of times and
the assembly of that data into a format suitable for producing
an x-t diagram via the contouring package.
- mb_view
is the generic contouring package.
Other 2-dimensional plotting can be done with GNU-Plot or any
other convenient package.
Data is exchanged between the programs via ASCII data files with
particular extensions to the file name.
These extensions are:
- .py for the user-written Python script
that defines the simulation.
- .Lp for and input parameter file.
This file can be prepared with any text editor but
it is probably easier to generate it from a Python script.
It contains the parameter values which define the
simulation.
(further detail...)
- .La for the tube definition.
This file is generated by l_prep and is subsequently read
by l1d.
- .L0 for the starting solution.
This file is generated by l_prep and is subsequently read
by l1d.
- .Ls for solution data at subsequent times.
This file is generated by l1d as it integrates the solution
forward in time.
The file may contain the flow state at a number of times.
- .hx for the history data at particular x-locations.
This file is generated by l1d as it integrates the solution
forward in time.
The file may contain the flow state at a number of times.
- .hc for the history data at particular x-locations.
This file is generated by l1d as it integrates the solution
forward in time.
The file may contain the flow state at a number of times.
- .dat for plotting data that has been generated
by l_hist.
This data should be in a format suitable for GNU-Plot.
- .gen for plotting data that has been generated
by sptime.
This data is intended for input to the contouring program
mb_cont.
Check List for Running a Simulation
- Define tube geometry
- Define gas-slug, piston and diaphragm configuration.
- Determine initial conditions for gas-slugs, pistons
and diaphragms.
- Determine suitable discretization and time-step parameters
for the gas-slugs.
- Encode the data from items 1--4 into the Python script
that defines the simulation
(further detail)
and use l_script to create the classic input parameter file.
It is still possible to manually edit that
input parameter file
but the Python script should be more convenient.
- If any special coding is needed, it may be added directly
to the source code and selectively activated via the
case index read from the start of the parameter file.
This should (hopefully) be seldom required now that the
parameter input more fully describes the facility
configuration.
If special code is added, you will need to recompile the
executables.
- Use l_prep to generate a starting solution and discrete tube
description.
% l_prep.exe -f base_file_name -echo
This is a good time to check that the input data is complete
and consistent.
With -echo option specified on the command line,
all of the input
parameters are echoed as the parameter file is read.
This makes the console output verbose but it is easier to
see what the code thinks the configuration is
(as opposed to what you think it is).
- Use l1d to time-step the solution to a specified end-point.
% l1d.exe -f base_file_name
Check the early time steps to ensure that the CFL limits are
reasonable and that the magnitude of the time step is reasonable.
If trouble is going to occur, it will usually occur within
the first few steps.
- Extract specific data from the solution files using l_hist,
l_post and sptime as appropriate.
To get a hint on what each program does and what command-line
parameters are required, enter the name of the executable with
no other command-line parameters.
A short set of instructions will then be written to the
console.
Examples
- Sod's classic shock tube problem
- This is the simplest example as it includes two gas slugs only.
The simulation is defined in the input parameter file sod.Lp
and the process of running the simulation (and producing the plots)
is coordinated by the shell-script file sod.sh.
Look at the shell script file to get an idea of the sequence of
preparation, simulation and postprocessing.
- Ideal piston being driven by air
- This example considers the motion of a piston within
a constant-area tube.
The piston is acted upon by a single gas slug whose right-end
pushes on the left-face of the piston.
The simulation definition is in the parameter file
piston.py and
the entire simulation and plotting process can be coordinated
from a single script file piston.sh.
- Drummond shock tunnel
- Now we get to the simulation of a real facility.
The Drummond tunnel is a small, shock tube with a Mach 4 nozzle.
This simulation is of the over-tailored operation of the facility
with a nitrogen driver gas driving a nitrogen test gas.
The simulation definition is set up in
dn2.Lp while the shell-script
file dn2_run.sh coordinates
the simulation and dn2_post.sh coordinates
the postprocessing.
-
T4 free-piston shock tunnel, Shot 1098 (pre-2001 geometry)
- This example puts quite a few of the program's elements together
with a piston, 4 gas slugs of various compositions and a couple
of diaphragms to control the processing of the gases.
Because of the large difference in time scales for the piston stroke and
the shock-processing of the test gas, this simulation is run in two
stages.
First, the compression stroke until just prior to the main diaphragm
rupture is defined by the input parameter file t4_1.Lp
and the script file t4_stage_1_run.sh.
Second, the state of the system is extracted at t=214ms and the simulation
restarted under the control of t4_2.Lp and
t4_stage_2_run.sh.
The script file t4_stage_2_post.sh coordinates the production
of an (x,t)-diagram for the shock tube and some pressure histories
to compare with experimental data.
-
T4 free-piston shock tunnel, Shot 7864 (new geometry)
- The T4 facility was upgraded to include a larger, higher pressure,
secondary reservoir.
This example runs the whole simulation in one go, making use of the
ability of L1d to change plotting frequency.
We no longer need to run simulations in two stages as was
originally done for Shot 1098.
-
HEG free-piston shock tunnel, operating condition III
- This simulates the Goettingen facility, nominally for Shot 615.
Nominal conditions are 50MPa, 13MJ/kg with nitrogen as the test gas.
Last Updated: 21-Aug-1999, 30-Nov-02, 15-Jul-2005