Skip to content

Input Files

nabajour edited this page Aug 10, 2020 · 7 revisions

Alfrodull can use 3 input files:

  • opacities (mandatory)
  • stellar spectrum (optional)
  • cloud data (optional)

Some example tools and functions are provided to generate those files. They are provided as a basis for further customisation, but provide the functions to have the correct input format for Alfrodull. They might need more testing for physical validity.

Opacity file

This is the file defining the wavelength bins used in the simulation, and the gas property grid per temperature and pressure. This file is the same as HELIOS’s opac_sample input file. Only change is that it can be the one generated by HELIOS in CGS units, or the same, converted to SI.

Format

Its an HDF5 file containing:

  • a grid of points in kpoints dataset (cm2/g or m2/kg), matching each temperature, pressure and wavelength.
  • a temperature scale in temperatures (linearly spaced), describing the grid points
  • a pressure scale in pressures (log10 spaced), describing the grid points
  • ypoints: if using ktable, this gives the number of weights per sample in the grid. (This needs to be tested, as ktable are not currently generated by helios’ ktable generator). By default, this is 1, and using sampling mode.
  • weighted Rayleigh cross-sections in weighted Rayleigh cross-sections in [cm-2 or m-2]
  • mean molecular mass Temperature/pressure grid in meanmolmass in atomic mass unit.
  • center wavelengths for bins in center wavelengths or wavelengths [cm or m]
  • bin interface wavelengths in interface wavelengths (marks the borders of each bin), [cm or m] (optional, is computed from bin center wavelength if absent)
  • bin width in wavelength width of bins, [cm or m] (optional, is computed from bin center wavelength if absent)

Indexing

with

  • N_T: number of temperature points (length of temperatures)
  • N_P: number of pressure points (length of pressures)
  • N_L: number of wavelength points (length of wavelengths)
  • N_Y: number of weights if using ktables, 1 if using sampling mode.
  • i_T: temperature index
  • i_P: pressure index
  • i_L: wavelength index
  • i_Y: weight index. In sampling mode, this is always 0.

opacity value for temperature matching index i_T, pressure i_P, wavelength i_L, weight i_Y:

opacity(i_T, i_P, i_L, i_Y) = ktable[i_Y + N_Y * i_L + N_Y * N_L * i_P + N_Y * N_L * N_P * i_T]

Scattering:

scattering(i_T, i_P, i_L, i_Y) = rayleight_crosstable[i_L + N_L * i_P + N_L * N_P * i_T]

meanmolmass value:

meanmolmass(i_T, i_P, i_L, i_Y) = meanmolmass[i_P + N_P * i_T]

So, for e.g. an opacity file showing those tables:

kpoints                  Dataset {1076236}
meanmolmass              Dataset {3332}
pressures                Dataset {28}
temperatures             Dataset {119}
wavelengths              Dataset {323}
weighted\ Rayleigh\ cross-sections Dataset {1076236}  

There is no ypoints table, so this file is in sampling mode. There are 119 temperature points, 28 pressure points and 323 wavelength points.

  • kpoints is 3 dimensional: 323 wavelength * 28 pressure * 119 temperature = 1076236 points
  • meanmolmass is 2 dimensional: 28 pressure * 119 temperature = 3332 points
  • weighted Rayleigh cross-sections is 3 dimensional: 323 wavelength * 28 pressure * 119 temperature = 1076236 points

generation

The opacity sample files have been generated with HELIOS’ k-table generator. It needs opacity files from HELIOS-K, with the correct paths set in HELIOS/ktable/input/sampling_species/sample.dat, using this param_ktable.dat:

##############################################
# Parameters for the K-table generator #
##############################################

################## 1ST STAGE --- INDIVIDUAL MOLECULES ##################

### OPACITY FORMAT ###                                                             ### INFO ###
                                                            
format =                                ktable                                  (ktable, sampling)
individual species calculation =        yes                                        (yes, no)

--> only relevant if above is set to 'ktable' and 'no' <--                                     
path to HELIOS-K output =               /helios-k/

--> only relevant if above is set to 'sampling' and 'yes' <--
path to sampling param file =           ./input/sampling_species/sample.dat
sampling wavelength grid =              5    0.34  200                         (resolution, limits in micron [lower, upper])
--------

################## 2ND STAGE --- COMBINING INDIVIDUAL FILES TO MIXED TABLE ##################

### COMBINING / WEIGHTING ###

path to sampling output =               ./output/kr500/
path to species file =                  ./input/final_species/sample.dat
path to FastChem output =               ./input/chemistry/asplund_m0/
path to condensation curves =           ./input/stability_curves/m0/
path to final output (mixed table) =    ./output/kr500/mixed_sample/
--------

################### DANGER ZONE ################### PROCEED UPON OWN RISK ###################

### EXPERIMENTAL ###

special abundance =                     none                                     (none, no_H2O, pure_H2O, pure_CO2, venus)
####################

It can be launched on slurm with the following job, with sbatch ktable.dat

#!/bin/bash
#SBATCH -D /home/<username>/prog/HELIOS/ktable
#SBATCH -J ktablegen
#SBATCH -n 1 --gres gpu:1 -p production
#SBATCH --time 3-2
#SBATCH --mem-per-cpu=16G
#SBATCH --mail-type=ALL
#SBATCH --mail-user=<user_email>
#SBATCH --output="/home/<username>/slurm-ktable-%j.out"

python3 ktable.py

After that, they were converted from CGS to SI with:

python3 tools/opacities_to_si.py input/opac_sample_r500.h5 input/opac_sample_SI_r500.h5

Tools

HELIOS’ file in CGS unit can be converted to SI using the tools/opacities_to_si.py python script.

Example files

Some example files are provided in the input directory, from 0.35um to 200um:

  • opac_sample_r5.h5: resolution R5 sample from Helios default mixture. 35 wavelength bins.
  • opac_sample_r50.h5: resolution R50 sample from Helios default mixture. 323 wavelength bins.
  • opac_sample_r500.h5: resolution R500 sample from Helios default mixture. 3192 wavelength bins. (stored externally, does not fit on GitHub)

And same as above, in SI units:

  • opac_sample_SI_r5.h5
  • opac_sample_SI_r50.h5
  • opac_sample_SI_r500.h5 (stored externally, does not fit on GitHub)

Stellar Spectrum

A stellar spectrum template can be used as input to Alfrodull, instead of the black-body spectrum.

Format

The HDF5 file contains two tables, in SI units:

  • wavelength: center of wavelength bins. Must match opacity table wavelength bins. [m]
  • flux: stellar flux per bin [J s-1 m-2 m-1]

Tools

There is a tool (tools/download_and_prepare_phoenix_spectrum.py) provided loading HiRes fluxes tables from PHOENIX database and doing some interpolation and rebinning to the opacity’s file bins.

To get a spectrum for Teff, logg, FeH and Alpha, for an opacity sample, stored to an output file, and also storing the intermediate interpolated stellar spectrum:

$ python3 tools/download_and_prepare_phoenix_spectrum.py <spectrum_output_name> -o <opacity_file_input> -i <intermediate_file_output>  -t <Teff> -l <logg> -Z <FeH> -a <Alpha>

For example for a Wasp43 profile:

$ python3 tools/download_and_prepare_phoenix_spectrum.py input/stellar_spectrum_wasp43.h5 -o input/opac_sample_SI_r50.h5 -i input/intermediate_sample_wasp43.h5  -t 4798 -l 4.55 -Z -0.13 -a 0.0

The same operation can be done interactively with the jupyter notebook tools/create_alf_stellar_spectrum.ipynb which also plots the spectrum before storage, for visual inspection.

Examples

  • input/stellar_spectrum_wasp43_r5.h5: stellar spectrum for Wasp43, resolution R=5
  • input/stellar_spectrum_wasp43_r50.h5: stellar spectrum for Wasp43, resolution R=50
  • stellar_spectrum_wasp43_r500.h5 input/stellar_spectrum_wasp43_r500.h5: stellar spectrum for Wasp43, resolution R=500

Clouds

Optional cloud file.

Format

HDF5 file in SI units, containing linear tables of values per wavelength bin, also matching opacity binning:

  • wavelength: wavelength bins centers [m]
  • asymmetry: cloud particle g0
  • absorption: cloud particle absorption cross section [m-2]
  • scattering: cloud particle scattering cross section [m-2]

Tools

A script is provided to convert a file from Daniel Kitzmann’s files to Alfrodull input.

To convert input/cross_sections_mgsio3_r1mu.dat to input/clouds_enstatite_r5.h5 using input/opac_sample_SI_r5.h5 bins:

$ python3 tools/make_alf_cloud_data_from_dk.py input/cross_sections_mgsio3_r1mu.dat input/clouds_enstatite_r5.h5 -o input/opac_sample_SI_r5.h5    

Again, the same can be done in a jupyter notebook interactively with plots using tools/create_cloud_file.ipynb.

Example

  • input/cross_sections_mgsio3_r1mu.dat: example DK source file for enstatite.
  • input/clouds_enstatite_r5.h5: cloud input file for enstatite, R=5
  • input/clouds_enstatite_r5.h5: cloud input file for enstatite, R=50
  • input/clouds_enstatite_r5.h5: cloud input file for enstatite, R=500