Diagonalized Upwind Navier Stokes Code

Tutorial Page


5. INPUT FILES

Currently, input filenames are specified on the command line. If nothing is specified on the command line, the default rootname of duns is used in generating input filenames, and dunsout is used for generating output filenames. The command line options are:

duns.e [-g, --grid fname] [-c, --conn fname] [-ch, --chem fname] [rootname]

where the grid, connectivity, and chemistry files can be specified separately from the rootname. The default names are given below.

In general, input files can be interspersed with comment lines. All comment lines start with a number character (#) after which the text is ignored until the next line. This allows the user to include comments if he/she does not easily remember what certain inputs mean.

5.1 Run Script (duns.script2)

The new DUNS scripting method operates by defining a number of modes. There are currently 13 distinct modes. One enters each mode by a predefined keyword. Each mode has a set of commands that can be typed in order to set different variables or perform different actions. The mode can be exited by an end command or by entering a different mode. For some modes, upon exiting the mode, certain actions are taken (for instance, reading in the grid.) The 13 current modes are stated below:

grid
flow-field
gas-properties
turbulence
reactions
initialize
spatial-accuracy
time-accuracy
boundary-conditions
precondition
run
save-restart
save-plotting
movie-plotting

Each mode and its associated commands is described below. Most of the commands are self-explanatory, however, some require additional explanation. The action upon exiting the mode (either by an end command or by entering another mode) is also described.

grid mode

Commands:

single-precision
double-precision
formatted
gridfile $fname 
connfile $fname
interpfile $fname
x-scale $num
y-scale $num
z-scale $num
scale $num1 $num2 $num3

Exit action: Reads in the grid file and connectivity file.

flowfield mode

Commands:

inviscid
viscous
planar
axisymmetric
swirl
laminar
turbulent
non-reacting
reacting

Exit action: None

gas-properties mode

This mode is more complex than many of the other modes. Typically, the gas model is set first. Once that is set, various gas properties can be defined. A brief description of what needs to be defined for the different models is given below.

Commands:

For the incompressible model, you need to specify the density of the gas, as well as the viscosity and thermal conductivity. The incompressible model is a single-species model.

incompressible
density $num
viscosity $num
prandtl-number $num

For the compressible model, you need to specify either the molecular weight or the gas-constant of the gas, the specific heat ratio gamma, and the viscosity and thermal conductivity. This is a single-species model.

compressible
molecular-weight $num
gas-constant $num
gamma $num
viscosity $num
prandtl-number $num

If you select the multi-species model, you have to define the thermodynamic properties (again either molecular weight or the gas-constant, plus the specific heat ratio gamma) of each individual species separately. The specie $name command either selects $name as the current species, or adds a species to the species list and sets that species as the current specie. The transport properties (viscosity and thermal conductivity) are defined for the entire mixture.

multi-species
specie $name
molecular-weight $num
gas-constant $num
gamma $num
enthalpy-formation $num
entropy-formation $num
viscosity $num
prandtl-number $num
schmidt-number $num

If you select the variable-props model, you must select a filename for reading in the thermal and transport properties. The format for this file is discussed in more detail under the duns.chem file.

variable-props
filename $fname

If you select the chemkin model, you must select a filename for reading in the thermal and transport properties. The files it reads in are simply the chem.bin and tran.bin files generated by the chemkin interpreters, renamed to $fname.chem and $fname.tran where fname is specified under the filename $fname command.

chemkin
filename $fname

If you are using adaptive chemistry model, you will need to set the number of models and the last specie before specifying the filename. Similar to the chemkin model, it reads in a $fname-n.chem and $fname-n.tran file for each model n, where n is from 1 to the number of models. You should also select a last specie for the models. This specie should exist in all the models and be a stable specie, such as N2. After reading in the models (done by specifying the filename), you should set the validity criteria. This is done by first selecting the model number for which you want to specify the criteria, and then giving maximum or minimum validity criteria as appropriate. The $name of the criteria can either be temperature or a species name. Specifying epsilon selects a threshold value for considering species. Below this level, species will be ignored when selecting the correct model for a cell.

adaptive
last-specie $name
number-models $num
filename $fname
model $n
epsilon $num
maximum $name $num
minimum $name $num
Exit action: None.

turbulence mode

Commands:

prandtl-number $num
schmidt-number $num
time-step-scale $num

Exit action: None

reactions mode

Commands:

explicit
implicit
stiff
a-factor-scale $num
activation-scale $num
time-step-scale $num

You can also add reactions in this mode. The commands are:

reaction-number $num
forward-rate $A $n $Ea/R
backward-rate $Ab $nb $Eab/R
kof $kof1 $kof2 $kof3
coff $coff1 $coff2 $coff3
cofb $cofb1 $cofb2 $cofb3

You must first specify the reaction number with the reaction-number command, and then specify the forward (and if it has a reverse reaction, the backward) rate constants. Then you must specify the stoichiometry of the reaction. For instance, for CH4 + 2O2 = 2H2O + CO2, the coefficients line would look like kof -1 -2 2 1, but only if the species were ordered as CH4, O2, H2O, and CO2. The actual exponents used in the rate calculation is specified in coff and cofb. An example of this is given below:

        reaction-number 1
                forward-rate    8.3e5 0.0 -15098.138
                kof             -1.0 -2.0  2.0  1.0  0.0
                coff             1.0  1.0

This describes the reaction CH4+2O2=2H2O+CO2. It is only a forward reaction, with the rate given as wdot = 8.3e5*exp(-15098.138/temp)*cCH4*cO2.

Exit action: None

initialize mode

You can either read in the initial flow field from a data file, or you can specify uniform conditions.

Commands: Below are commands associated with reading in the file.

filename $fname
double-precision
single-precision
formatted
cell-vertex
cell-centered $offset
turbulence
species $num

Below are commands used to specify uniform conditions.

pressure $num
temperature $num
u-velocity $num
v-velocity $num
w-velocity $num
turbulent-intensity $num
turbulent-viscosity $num

Exit action: Read in data file if $fname has been specified.

spatial-accuracy mode

Commands:

first
second
third
fifth
tvd

Exit action: None.

temporal-accuracy mode

Commands:

steady-state
crank-nicholson
2nd-implicit
3rd-implicit
theta $num
time-step $num
inner-convergence $num
inner-iterations $num

Exit action: None.

boundary-conditions mode

This mode is also relatively complex. First you need to specify the surface (or surfaces) for which you want to specify boundary conditions. This is down by

surface $n1 $n2 ...

Next, you want to specify the general boundary condition type and then the actual boundary conditions. There are eight basic boundary condition types as described below, with the possible specifications.

Commands:

The first set of commands are for subsonic inflow. After specifying subsonic-inflow, you must specify either velocity, mass-flow, or stagnation-temperature. If you have specified either velocity or mass-flow, you must specify the temperature also. If you have specified stagnation-pressure, then you must specify a stagnation-temperature. The rest of the options are optional. $species will specify the mass-fraction for that particular specie.

subsonic-inflow
velocity $num
mass-flow $num
stagnation-pressure $num
temperature $num
stagnation-temperature $num
flow-angle $num
swirl $num
turbulent-intensity $num
turbulent-viscosity $num
$species $num

The only supersonic boundary condition currently implemented is a specified Mach number, temperature and pressure, all of which must be specified. Again, the remaining options are optional and follow the subsonic inflow style.

supersonic-inflow
mach-number $num
temperature $num
pressure $num
flow-angle $num
swirl $num
turbulent-intensity $num
turbulent-viscosity $num
$species $num

The only subsonic outflow boundary currently implemented is a back pressure boundary condition. Here you must specify the back pressure.

subsonic-outflow
pressure $num

Supersonic outflow is fully specified from within the flow domain, so no additional boundary conditions are required.

supersonic-outflow

A viscous wall can either be adiabatic or at a constant temperature.

viscous-wall
adiabatic
temperature $num

An inviscid wall can either be adiabatic or at a constant temperature.

inviscid-wall
adiabatic
temperature $num

The remaining boundary conditions are for symmetric flows. The non-sweep boundary condition can be used if you want to simulate one-dimensional flow with a two-dimensional grid. You must specify the cross-stream walls as being non-sweep walls.

centerline
symmetry-plane
non-sweep

Exit action: None.

precondition mode

This mode selects the type of preconditioning desired. It also sets some parameters related to the preconditioning.

Commands:

inviscid
viscous
pressure $num
velocity $num
length $num

Exit action: None

run mode

This mode sets variables such as the time-step and the number of steps to take. You can also specify when to print convergence data and restart files. The commands for this mode are:

Commands:

block-adi
diag-adi
constant-dt
max-cfl
min-cfl
max-vnn
min-vnn
cfl $num1 $num2
vnn $num1 $num2
print-conv $num
print-rstrt $num
steps $num

Exit action: Will run the code for the specified steps.

save-rstrt mode

Commands:

filename $fname

Exit action: Saves the restart file as $fname.rstrt.

save-plotting mode

Commands:

filename $fname
cell-vertices
cell-centered $num
variables $string

Exit action:

Saves the plotting files (*.g, *.q, *.v and *.tec). $string specifies a string of variables enclosed in quotes for plotting. See the section on plot files.

movie-plotting mode

Commands:

off
time-steps-per-frame $num
cell-vertices
cell-centered $num
variables $string

Exit action: Turns on or off movie-plotting, which saves a plotting file every $num steps, as determined by the time-steps-per-frame command. Same variable choices as for the save-plotting mode.

Example of a script file.

# This is the input deck for the DUNS-2.6
# Generated by Douglas Schwer 4/30/00
#
   grid
        formatted

   flow-field
        viscous

   gas-properties
        compressible
        gas-constant            287.
        gamma                   1.4
        viscosity               2.78e-4
        prandtl-number          0.7

   initialize
        temperature             300.
        u-velocity              0.475
        pressure                1e5

   boundary-conditions
        surface 6
           subsonic-inflow
           velocity                4.75
           temperature             300.
        surface 2
           viscous-wall
           adiabatic
        surface 3
           subsonic-outflow
           pressure                1e5
        surface 1 4 5 8
           viscous-wall
           adiabatic

   spatial-accuracy
        third

   precondition
        inviscid        on
        viscous         on
        pressure        1e5
        velocity        0.474

   run
        min-cfl
        max-vnn
        cfl             1.5
        vnn             1.0
        print-conv      5
        print-rstrt     100
        steps           1000

   save-restart
        filename        save

   save-plotting
        filename        save
        cell-centered   0
        variables       "p1 u v w t"

   quit

5.2 Grid file and connectivity file (duns.grid, duns.conn)

The grid file is written in unformatted multi-block plot3d format. Here is a snip of FORTRAN code that will write out a multi-block plot3d unformatted file:

      open(unit=11, file='duns.grid', form='unformatted')
      write(11) nblocks
      write(11) (imax(n),jmax(n),n=1,nblocks)
      do n = 1, nblocks
         write(11) ((x(i,j,n),i=1,imax(n)),j=1,jmax(n)),
     >             ((y(i,j,n),i=1,imax(n)),j=1,jmax(n))
      end do
      close(11)

Regardless of the precision of the solution procedure, the grid can either be single-precision or double-precision. This is controlled by the igrid parameter in the input deck. If igrid=0, the program tries to read in a double-precision grid, if igrid=1, the program tries to read in a single-precision grid. Formatted grids can also be read in if igrid=2. The form of a formatted grid file is as follows:

      open(unit=11, file='duns.grid')
      write(11,*) nblocks
      do n=1,nblocks
         write(11,*) imax(n),jmax(n)
         do j=1,jmax(n)
         do i=1,imax(n)
            write(11,*) x(i,j,n),y(i,j,n)
         end do
         end do
      end do 

The connectivity file takes a somewhat different form. It is a plain ASCII file, and for each block there is a corresponding line. For each block, you have four (or six for three-dimensional) sets of numbers and a letter corresponding to a particular boundary. Each boundary has 1 letter and 4 numbers describing it, as for example

b  0  2 123

The first letter indicates whether the boundary coincides with a surface (denoted by an s) or another block (denoted by a b). If it is a surface, the next number (0 for this case) is the number of the surface. If it is a block, the second number is the number of the block that it is adjacent to (in this case block 2). The next set of numbers (123) represent what's called an axis mapping. This is how the axis for the present block maps onto block 2. The first number represents what the i number maps to, the seocnd number represents what j maps to, and for three-dimensional cases the third number represents what k maps to. A 1 means that the given index maps to i on the other block, a 2 means j, a 4 means that the index maps inversely to i; 5 means inversely to j, etc.

As I mentioned previously, there are 4 or 6 sets of these numbers for each block in the grid. The first set of numbers represents the i=1 boundary, the second i=imax, the third j=1, the fourth, j=jmax, etc. For example the line

B 4   b  0  1 243 s  4  0 000 b  0 11 243 b  0  5 453

represents the connectivity for block 4 for our cylinder example in Figure 1. The first set of numbers b 0 1 243 means that the i=1 boundary of the block is connected to block 1. The axis mappings mean that the i direction for block 4 corresponds to the j direction in block 1, and the j direction in block 4 corresponds to the inverse of the i direction in block 1. These, the point x(1,5) in block 4 corresponds exactly to the point x(imax-4,1) in block 1. The boundary for i=imax is the surface #4 (no axis mappings are needed to describe this.) The j=1 boundary for block 4 corresponds to the i=imax surface of block 11. The rest is left as an excersize.

For most complex geometries, you will need some sort of a grid generator to generate the grid for a given geometry. These grid generation techniques should automatically write a connectivity file with the above information. However, it is good to know the format for the connectivity if you need to generate a simple grid without one of these multi-block grid generators.

5.3 Chemistry file (duns.chem)

There are several types of chemistry files that are used with the code. Chemistry files are used for multi-species variable-properties, and chemkin multi-species, with each chemistry file having a different format.

For variable-props gas model, the DUNS code uses 5th-order polynomial curve fits for the thermodynamic properties and transport properties. It then determines the mixture transport properties using Wilke's mixing rule. The two main formats can be seen in the test/serial/rbcc/ subdirectory under chem.iprop0 and chem.iprop1. The difference between the two formats is how they handle species diffusion.

For the chemkin gas model, you need to run the chemkin interpreter (chem.exe) on the initial input file chem.inp. This will generate a file called chem.bin. You also need to run the transport curve-fitting program, called tran.exe to generate a tran.bin file. These files should then be renamed to $fname.chem and $fname.tran which is then read in by DUNS. Be sure you have a therm.dat and tran.dat file in the current directory when running the interpreters, or else they will choke on the program. Please refer to the CHEMKIN-II documentation for information on specifying the initial chem.inp file.

5.4 Initial solution file (duns.qinit)

As noted previously, you can read in an initialization file instead of starting with uniform flow if you generate a duns.qinit file. The format is selected as either single-precision, double-precision or formatted. If it is single or double-precision, the file is in a plot3d style format, as follows.

      open(unit=11, file='duns.qinit', form='unformatted')
      write(11) nblocks
      write(11) (imax(n),jmax(n),n=1,nblocks)
      do n = 1, nblocks
         write(11) rtmp1, rtmp2, rtmp3, rtmp4
         write(11) ((p1(i,j,n),i=1,imax(n)),j=1,jmax(n)),
     >             ((u(i,j,n),i=1,imax(n)),j=1,jmax(n)),
     >             ((v(i,j,n),i=1,imax(n)),j=1,jmax(n)),
     >             ((w(i,j,n),i=1,imax(n)),j=1,jmax(n)),
     >             ((t(i,j,n),i=1,imax(n)),j=1,jmax(n)),
     >             ((q(i,j,n),i=1,imax(n)),j=1,jmax(n)),
     >             ((om(i,j,n),i=1,imax(n)),j=1,jmax(n)),
     >             (((yi(i,j,k,n),i=1,imax(n)),j=1,jmax(n)),k=1,nsread)
      end do
      close(11)

A formatted qinit file looks like:

      open(unit=11, file='duns.qinit')
      write(11,*) nblocks
      do n=1,nblocks
         write(11,*) imax(n),jmax(n)
         do j=1,jmax(n)
         do i=1,imax(n)
            write(11,*) p1(i,j,n),u(i,j,n),v(i,j,n),w(i,j,n),t(i,j,n),
     >                  q(i,j,n),om(i,j,n),(yi(i,j,k,n),k=1,nsread)
         end do
         end do
      end do 

p1, u, v, w, and t must always be specified in the qinit file. If you specify turbulence in the script file, the turbulent q and om values are also read. If you specify species in the script file, the species mass-fractions will also be read for $num species.

Values can be given either at the cell centers or at the cell vertices. If given at the cell centers, you must provide an offset number $offset. If $offset=0, you must specify values at all the cells including ghost cells. If $offset=1, you must specify values only at the cell centers within the domain.


Next Previous Contents