The following is a set of instructions for building the
compressible-flow simulation program mb_cns.exe
and its pre- and post-processors.
The package should work on any UNIX-like platform with
an ANSI C compiler.
The original development was done in a SUN OS environment at ICASE with
the vectorisation tuned for Cray Y/MP and Cray 2 supercomputers.
Further development was done under IBM AIX, HP/UX, Fujitsu VCC, IRIX,
OS/2, Win32 systems, and (most recently) Linux.
As of August, 1998, the mb_cns, L1d, and ssp
packages have been rearranged into a unified directory tree
as described below.
The zip, tar and make files are set up assuming the following
directory arrangement within the top level directory $HOME/cfd.
Within that directory, mb_cns, L1d, nm,
gas_models, util and plot
packages each have a directory.
Within the mb_cns directory the following subdirectories will exist:
- source
- unix
- borland
- tools
- examples
- sod
- sod2
- cyl50
- cone20
- hemi2
- a98
- ...
- doc
The other packages will have similar collections of subdirectories.
Set up a home directory named cfd and,
put the tarred and gzipped files (mb_cns.tar.gz,
cfd_util.tar.gz and cfd_plot.tar.gz)
into the directory containing that cfd directory.
Unzip this tar file and then extract all of the
source and documentation files into their destination directories using
% gzip -d mb_cns.tar
% tar -xvf mb_cns.tar
or
% tar --gunzip -xvf mb_cns.tar.gz
Do the same for the other tar balls (cfd_util.tar.gz, cfd_plot.tar.gz).
At this point, you should have all of the source code for
the MB_CNS package, the (postscript and hypertext) documentation
and a few example data files.
Within the directory, set up the other subdirectories
as described above.
It will be convenient to have $HOME/cfd_bin as part of your
search path.
Up until the end of March 1998, source code development
was done mainly on OS/2 and Win32 systems.
If your computer doesn't like carriage returns and the
Control-Z (end-of-file) character in the source files of
earlier distributions,
there is a shell script mb_cns/script/sc.sh that will remove
these characters from text files. All of the files in the
source directory can be processed using
% cd source
% ../script/sc.sh *
Current distributions are prepared on a Linux system and so
may suffer the inverse problem of not having carriage returns
as required for DOS based systems.
This does not seem to worry the GNU C compiler on DOS or the Borland C/C++
compiler on Win32 systems.
The executable files need to be built but, before doing so,
check to see that
the code is configured correctly and create the $HOME/cfd_bin
directory if it is not already present.
Set the relevant macro-definitions in the header file
compiler.h to
reflect the compiler/ operating-system environment that you are using.
Since many compilers now support the ANSI standard, there is little to
choose from here.
If one of the workstations is selected, that will probably cover most
situations.
The only special environments to note are the
- CRAY_C
- Cray vectorising compiler
- VP_2600_C
- Fujitsu VCC vectorising compiler
- SGI_CHALLENGE
- Power C analyser for the Silicon Graphics Power Challenge
(shared memory).
Don't pick any of the MS-DOS environments;
they are not supported any more.
Definitions in mb_cns.h
which may need to be changed occasionally...
- DEBUG_LEVEL
- Set to 1 for occasional messages
Set to 2 for entry messages to all subroutines
Set to 3 dump detailed data as well
Set to 4 dump data within the flux calculation routines.
- ECHO_ALL
- Set to 1 to echo all input parameters as they are read
Set to 0 to NOT echo parameters.
- INTERP_TYPE
- Set to 0 for the high-order reconstruction to be third-order
upwind-biased.
Set to 1 for fully-upwind high-order reconstruction.
- STRINGENT_CFL
- Normally set to 0.
However, for some viscous calculations with high aspect-ratio
cells, it may need to be set to 1 to enforce a more restrictive
CFL check on the time step.
- PRINT_COUNT
- Normally set to 20.
This is the number of time-steps between printing a status message
to the console.
- CFL_COUNT
- Normally set to 10.
This is the number of time-steps between checking the size of the
time-step.
Some definitions that should be left alone unless they cause trouble...
- DOUBLE_PTR
- When set to 1, two-dimensional arrays are allocated as pointers to pointers.
This is the preferred option as the size of the data will
adjust, at run time, to fit the size of grid requested.
When set to 0, two-dimensional arrays are allocated as single pointers.
This is really only required for the Fujitsu VCC compiler
which doesn't vectorise across rows of an array.
This parameter is set to 1 on selection of the Fujitsu VCC
compiler in compiler.h.
- NXDIM
- Set to maximum size in ix index.
This is needed only if DOUBLE_PTR == 0.
- NYDIM
- Set to maximum size in iy index.
This is needed only if DOUBLE_PTR == 0.
- NSPECD
- Set to the maximum number of species used in the gas model.
For single species calculations,
leave it as 2 if memory is not a problem.
- NGHOST
- Default value = 2.
Number of ghost (or buffer) cells surrounding the active
cells within a block.
- NDIM
- Length of temporary vectors.
It needs to be large enough to accommodate the largest
grid dimension (plus 4 elements for ghost cells).
On Intel (PC) class machines, this dimension should be kept
as small as reasonable because of the small cache size and
slow main memory.
For example, running the cone20 test case with NDIM=504 rather
than NDIM=204 resulted in a 37% increase in CPU time.
- BLOCK_DIM
- Maximum number of blocks that will be used.
- NL
- Number of levels in the time-stepping procedure.
Leave as 2 for the standard predictor-corrector scheme.
- VERY_SMALL (in cns_visc.c)
- Smallest value of y for the axisymmetric terms.
- QUICK_AND_DIRTY (in rivp.c)
- Use the approximate power macro
qd_power.h
- LINEAR (in rivp.c)
- Type of interpolation used within the rarefactions.
- NN (in mb_hist.c)
- The maximum number of history events that can be picked
up by mb_hist.
The value 10000 should be enough for most applications.
- BEZIER_DIM (in mb_prep.c)
- Maximum number of Bezier segments in a Bezier polyline.
The value 20 should be plenty for most applications.
- MAX_LINES (in mb_prof.c)
- The maximum number of strips that can be pasted together
when extracting a flow profile.
- RHOMIN, EMIN, PMIN, TMIN, AMIN (in gas.c)
- As a brute-force way of making the code robust in
extreme flow situations, certain elements of the gas
state are limited to small positive
(and physically meaningful) values.
These lower limits are set in gas.c
and may need to be adjusted if you are simulating (what may be)
unusual flow conditions.
One such condition might be a rarefied flow where all of
the densities are very small.
This is one of the disadvantages of using
dimensional quantities within the code.
- CHECK_RECONSTRUCTION_FAILURE
(in mb_cns.h)
- If set to 1, the high-order reconstruction will be checked
to see if it has provided reasonable estimates for the
Left and Right cell interface properties.
The loops in this section of code are not easy to vectorise
so, for vector computers such as Cray C90 and Fujitsu VP,
it may be preferable to turn this checking off.
- WARN_RECONSTRUCTION_FAILURE (in mb_cns.h)
- If set to 1 (and high-order reconstructions are checked),
warnings will be logged whenever the high-order
reconstruction fails to give reasonable estimates.
- CHECK_FOR_VALID_DATA, MAX_INVALID_CELLS
(in mb_cns.h)
- When decoding the array of conserved quantities,
the specific internal energy or the density may try to go
negative.
If it does, the value is reset to small positive value inside
decode_conserved() and, if CHECK_FOR_VALID_DATA == 1, the number
of cells in which this happens is counted.
MAX_INVALID_CELLS is the maximum number of cells (per block)
for which this event will be tolerated.
If this symptom occurs, your best bet is to refine the
grid so that the cells are not too elongated and that
sharp expansion corners are avoided.
- DT_REDUCTION_FACTOR (in mb_cns.h)
- If an attempt at a time step fails because of invalid cells,
the time step is re-attempted with a smaller time step.
A reduction factor of 0.2 is somewhat arbitrary.
A factor of 0.5 would seem to be not enough but a factor of
0.1 would seem too expensive.
Change to the source directory and build the executable programs
by invoking the make file and specifying the target computer.
For example, the programs can be built for a UNIX workstation
with the GNU C compiler using
% make for_gnu
To make the program for a multiprocessor Origin 2000 use
% make for_sg_mp
And then install the executable files using
% make install
For further target architectures, see the makefile.
You should also build the plotting programs by going into their
build directory (cfd/plot/unix) and invoking the make utility
in a similar manner.
At this point you should have a complete set of executables
in the $HOME/cfd_bin directory and you are now ready
to try running them.
MB_CNS (C) P. A. Jacobs
Last Updated 21-Sep-1999, 27-May-2001