Kspectrum computes the synthetic absorption spectrum for a gas mixture in arbitrary thermodynamic conditions (pressure, temperature and molar composition) from public spectroscopic databases. The main and only purpose of the code is to produce high-resolution absorption spectra for a given set of thermodynamic conditions; in particular, Kspectrum will NOT perform the following tasks:
- compute molecular absorption for any other source than allowed energetic transitions: even if some limited effort has been put into the representation of collision-induced absorption and continua, these sources of opacity will have to be computed separately for each application in a separate step.
- perform radiative transfer computations: one of the main ideas behind Kspectrum is that the resulting absorption spectra can be used for a wide variety of applications, possibly in complex 3D scenes (as, for instance, in combustion engines). Dedicated tools will have to be used in order to solve radiative transfer; Kspectrum by itself will only be used to produce the input spectral data.
Kspectrum uses the HITRAN spectroscopic database in order to retrieve transition parameters (versions 2004, 2008 and 2012). Additionally, it can use the HITEMP-2010 and CDSD-4000 databases (respectively for water and carbon dioxide) at high-temperature levels. Further development would be required for additional databases (HITRAN-2016 ? GEISA ?)
The main idea behind Kspectrum was initially to develop a code that would not need to use numerical simplifications such as a line profile truncation (assuming the distant line-wing profile is well known, which is obviously not the case). The resulting code was therefore capable of adding the contribution of every known transition at every wavenumber, in order to produce a value of the absorption coefficient with a known accuracy; also, a custom spectral discretisation algorithm was implemented in order to produce a non-uniform spectral grid according to a second accuracy criteria. Further versions quickly acquired the possibility to perform a line-wings truncation and use a specified constant spectral step, but the original algorithms that give the possibility to compute reference results (in the sense that a numerical accuracy is provided over resulting spectra) are still available.
This code can take into account the Lorentz and the Voigt line profiles, as well as common sub-lorentzian corrective profiles. The isotopic composition can be specified, making this code suitable for non-terrestrial applications. The code was mainly thought for thermal infrared applications, but absorption spectra can be produced for any spectral range as long as transition parameters are available. As a general rule, Kspectrum was designed to remain as polyvalent as possible; one immediate disadvantage is that special sources of opacity, such as collision-induced absorption or continua, should be computed separately for any given application. Also, line-mixing processes have not yet been taken into consideration, and require further developments.
Some neat features
Every time-consuming step of the computation has been parallelised, even though the parallel architecture is far from optimal and should require a major revision: the computation time does not scale very well with the number of processes because of inter-processes communication, and also it was not thought for multi-node clusters. But at least Kspectrum will run faster on a reasonably good single node (approx. 20 cores). Also, the code has been implemented with the obsessions of:
- working with arbitrary large numbers of transitions. For instance, the CDSD-4000 database holds the parameters for more than 6 hundred millions of transitions for carbon dioxide; Kspectrum will, in time, eventually compute the contribution of every transition at every wavenumber of the spectrum.
- being able to resume interrupted runs: whether your PC crashes or Kspectrum reaches the maximum computation time allowed by the cluster's queue, it will be possible to resume an interrupted computation instead of starting over from scratch: as in a video game, Kspectrum performs frequent backups of the current run.
You will have to download both the
.tgz file and the
installation script, and place both files in the same directory. Then run the
installation script. This will uncompress the archive, compile and run a small
program that will generate an example composition file (for Venus' atmosphere).
The installation script will also try to link Line-by-Line spectroscopic
databases to your new installation of Kspectrum, but will most probably fail if
you are not a frequent Kspectrum user, and you will have to read the
documentation in order to link LBL databases yourself (and probably download
then first if you have not already done so). Please contact us if you want a specific
setup script for your machine so that the linking step is performed when you
download the next version.
Prerequisites: all you need is a fortran compiler. We are using gfortran for development, but it should also work with other fortran compilers (ifort, pgfortran, etc.). You should export the name of your fortran compiler into the F77 environment variable; for instance, using the bash interpreter:
Then you can try to compile Kspectrum: go to the main Kspectrum directory,
then use the
make all command to compile. The most common sources
of failure can be fixed by editing the "Makefile" file in order to check
compilation options (and more specifically options related to the target
architecture and optimisations). Whenever you modify a source file, you can
re-compile using the
make all command. But in the case you have to
modify an include file, you will have to erase all existing object files first
make clean command, before recompiling from scratch
make all command again.
Kspectrum is free software released under the CeCILL v2.1 license. You are welcome to redistribute it under certain conditions; refer to the license for details.