TODO: Does not seem to be linked anywhere

Line spectra postprocessing

With prodimopy and FLiTs, lines not included in the heating and cooling balance in ProDiMo model can be postprocessed to produce the spectra. This can be very useful in cases where the molecules do not contribute much to the heating and cooling balance, but would affect the model computation time, or the species is not included in ProDiMo (e.g. isotopologues such as 13CO2). In such cases the ProDiMoForFLiTs.fits file can be modified to include the level populations of user defined molecules. This however requires line spectroscopic data in HITRAN format, along with the partition sums.

To do this one needs to have the full output of a ProDiMo model with .true. ! FLiTs, i.e., the directory should contain the .out and ProDiMoForFLiTs.fits files. The HITRAN partition sums 2021 must be downloaded from HITRAN website and the path to the sudirectory QTpy is to be passed to the postprocessing routine. Partition sums can be also provided in a textfile with 2 columns, the temperature and the partition sum.

The new lines to be calculated are to be specified using the LineSelection.in file format (see mid_IR_lines). Following shows an example file LineSelection_new.in.

CO2_H ! custom_molecule 
1   ! iso 
44  ! mass
1   ! waveSelection
13.0 18.0
1   ! ESelection
0 30000 
5   ! bandSelection
'0 1 1 01' '0 0 0 01'
'0 2 2 01' '0 1 1 01'
'1 0 0 01' '0 1 1 01'
'1 0 0 02' '0 1 1 01'
'1 1 1 02' '1 0 0 02'
1e-60 ! hitran_min_strength
'/Users/users/arabhavi/prodimo_git/data/HITRAN2020/CO2.par' ! file
'CO2_C_Lambda.dat' ! output_file 

The species name is defined by ! custom_molecule tag, it can be followed by an underscore and then additional characters. prodimopy only uses the characters before the first underscore as the species name. This can be useful if one wants to have different line selections for the same molecule.

The postprocessing can then be done in a python environment as below:

import prodimopy.postprocessing as pp
pp.postprocess_lines(QTpath = '/path/to/HITRAN/QTpy/', 
                     directory = '/path/to/full/prodimo/model/', 
                     input_file='ProDiMoForFLiTs.fits', 
                     output_file = 'ProDiMoForFLiTs_new.fits',
                     linemode = 'replace',
                     lineselection='LineSelection_new.in')

This produces a new .fits file called ProDiMoForFLiTs_new.fits containing the new level populations and densities of CO2. Here, it automatically searches in the prodimo model output for the abundance of the molecule and the HITRAN partition sum using the name before the underscore. If the name in prodimo is different, then the user can also specify before hand in the LineSelection_new.in what the prodimo name is by the tag ! prodimo_name. For e.g. C2H6 is called CH3CH3 in prodimo, and this can be passed using CH3CH3 ! prodimo_name. The post processing also produces the corresponding LAMDA formatted file containing line and level data whose file name is specified by ! output_file tag.

FLiTs can then be run using this fits file and the lamda file.

This way we can also produce spectra of some molecules not present in ProDiMo. e.g. 13CO2. The following line selection file shows how to include C2H6, 13CO2, and C6H6. C2H6 has a different prodimo name, 13CO2 is not a species in ProDiMo, and C6H6 requires custom partition sums outside HITRAN.

------------------------------------------------------------------------
C2H6_C ! custom_molecule 
1   ! iso 
30  ! mass
1   ! waveSelection
10.0 13.5
1   ! ESelection
0 30000 
1   ! bandSelection
'V9' 'GROUND'
1e1 ! hitran_min_strength
'/Users/users/arabhavi/prodimo_git/data/HITRAN2020/C2H6.par' ! file
'C2H6_C_Lambda.dat' ! output_file 
CH3CH3 ! prodimo_name 
------------------------------------------------------------------------
CO2_C_I ! custom_molecule 
  2   ! iso 
45 ! mass
1 ! waveSelection
13.0 18.0
1 ! ESelection
0 30000 
5 ! bandSelection
'0 1 1 01' '0 0 0 01'
'0 2 2 01' '0 1 1 01'
'1 0 0 01' '0 1 1 01'
'1 0 0 02' '0 1 1 01'
'1 1 1 02' '1 0 0 02'
1e-60 ! hitran_min_strength
'/Users/users/arabhavi/prodimo_git/data/HITRAN2020/CO2.par' ! file
'13CO2_C_Lambda.dat' ! output_file 
CO2 ! prodimo_name 
0.013333 ! abundance_fraction
------------------------------------------------------------------------
C6H6_C ! custom_molecule 
  1   ! iso 
78 ! mass
1 ! ESelection
0 30000 
1e-60 ! hitran_min_strength
'/Users/users/arabhavi/prodimo_git/data/HITRAN2020/C6H6_agnes.par' ! file
'C6H6_C_Lambda.dat' ! output_file 
C6H6 ! prodimo_name 
'/Users/users/arabhavi/PhD/project1/C6H6_partition_sums.dat' ! custom_partition_sum 
------------------------------------------------------------------------

Here, ! abundance_fraction tag is used to scale the number density of the molecule. For 13CO2, the above selection specifies 0.01333 (or 1/75) as the abundance fraction and points to use the ProDiMo abundance of CO2.