Changeset 3671 for trunk/UTIL
- Timestamp:
- Mar 5, 2025, 5:54:17 PM (4 months ago)
- Location:
- trunk/UTIL/corrk_exo_k
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/UTIL/corrk_exo_k/Exomol_species.dat ¶
r3605 r3671 1 K/ 39K 39K__Kurucz-Allard-K K//39K/Kurucz-Allard-K 0 1 0 2 Na/ 23Na 23Na__Kurucz-Allard-Na Na//23Na/Kurucz-Allard-Na 0 1 0 1 3 MgH/ 24Mg-1H 24Mg-1H__Yadin MgH//24Mg-1H/Yadin 0 1 0 2 4 MgH/ 24Mg-1H 24Mg-1H__UGAMOP MgH//24Mg-1H/UGAMOP 0 1 0 -
TabularUnified trunk/UTIL/corrk_exo_k/dace_to_corrk.py ¶
r3633 r3671 3 3 import matplotlib.pyplot as plt 4 4 import astropy.units as u 5 import astropy.constants as cst 5 6 import glob 6 7 from chemistry import isotopologue_to_species, species_name_to_common_isotopologue_name 7 8 8 9 ### choose spectral resolution for corrk 9 R= 2000010 R=10000 10 11 wnedges=xk.wavenumber_grid_R(10000/100, 10000/.3, R) 11 12 print("Spectral resolution asked: wn=", wnedges.min(), wnedges.max(), ", R =", R) 12 13 13 14 ### set data paths 14 dace_path = "datadir/dace/" 15 # dace_path = "datadir/cold/" 16 dace_path = "datadir/hot/" 15 17 corrk_dir = "datadir/corrk_data/" 16 18 dir_out = corrk_dir+f"/R{R}_from_dace/" … … 26 28 27 29 ### select (output) molecules and their corresponding (input) isotopologues 30 ### set value to 'None' to get common isotopologue 28 31 molecules = { 29 #"CO": "12C-16O",30 # "CO2": "12C-16O2",32 "CO": "12C-16O", 33 "CO2": None, 31 34 # "H2O": "1H2-16O", 32 35 # # "C2H2":"12C2-1H2", 33 36 # # "C2H4":"12C2-1H4", 34 "CH4": "12C-1H4",37 # "CH4": "12C-1H4", 35 38 # "TiO": "48Ti-16O", 36 39 # "VO": "51V-16O", … … 61 64 tmp_ktab=xk.hires_to_ktable(path=mol_corrk, helios=True, wnedges=wnedges, mol=molecule, order=order) # test conversion from a whole folder to tmp 62 65 63 tmp_ktab.kdata = tmp_ktab.kdata * 10 * xk.Molar_mass().fetch(molecule) / xk.N_A66 tmp_ktab.kdata = tmp_ktab.kdata * 10 * xk.Molar_mass().fetch(molecule) / cst.N_A 64 67 # cm^2/g * 10000/1000 * kg/mol / (molecule/mol) -> m^2/molecule 65 68 tmp_ktab.kdata_unit = "m^2/molecule" -
TabularUnified trunk/UTIL/corrk_exo_k/download_dace.py ¶
r3605 r3671 1 1 from dace import * 2 2 3 # output_dir = "datadir/hot" 4 # temperature_range=[50,3000] 5 # pressure_range=[-8,5] 6 7 output_dir = "datadir/cold" 3 8 temperature_range=[50,300] 4 pressure_range=[ 1e-8,1e2]9 pressure_range=[-8,2] 5 10 6 11 ### select linelist for each molecule … … 9 14 10 15 molecules = { 11 #"C2H2": default_linelist,12 #"C2H4": default_linelist,16 "C2H2": default_linelist, 17 "C2H4": default_linelist, 13 18 "CH4": default_linelist, 19 "CO": default_linelist, 14 20 # "CO2": default_linelist, 15 # "CO": default_linelist,16 21 # "H2O": default_linelist, 17 22 # "H2S": default_linelist, … … 33 38 } 34 39 for mol in molecules: 35 download_molecule(molecule=mol,temperature_range=temperature_range,pressure_range=pressure_range, line_list=molecules[mol], output_dir= "datadir/dace")40 download_molecule(molecule=mol,temperature_range=temperature_range,pressure_range=pressure_range, line_list=molecules[mol], output_dir=output_dir) 36 41 37 42 -
TabularUnified trunk/UTIL/corrk_exo_k/lmdz_corrk_using_exo_k.py ¶
r3633 r3671 1 1 import exo_k as xk 2 2 import numpy as np 3 import matplotlib.pyplot as plt 3 4 4 5 ### folder with corrk data for each molecule (see 'xsec_to_corrk.py' to convert cross-sections to correlated-k tables) … … 42 43 43 44 VI_grid = np.array([ 1670., 2080., 2220., 2450., 2750., 2920., 3200., 3750., 4000., 4180., 4260., 4460., 4700., 5000., 5400., 5730., 5930., 6300., 6700., 7700., 8200., 8750., 9250., 35000.]) 45 res=f"{len(IR_grid)-1}x{len(VI_grid)-1}" 46 print(res) 44 47 45 48 wnedges = np.unique(np.concatenate([IR_grid,VI_grid])) … … 62 65 xk.Settings().set_case_sensitive(True) 63 66 64 kdata = xk.Kdatabase(gases) 65 for gas in kdata.ktables: 66 # convert Xtables to Ktables 67 if type(kdata.ktables[gas]) is xk.Xtable: 68 kdata.ktables[gas] = xk.Ktable(wnedges=wnedges, xtable=kdata.ktables[gas]) 67 ### select pressure, temperature, and mixing ratio to plot 68 p=1 69 t=300 70 x=1e-4 71 72 fig, ax = plt.subplots() 73 kdata = xk.Kdatabase(molecules=None) 74 ktables = [] 75 for gas in gases: 76 try: 77 ktable = xk.Ktable(mol=gas) 78 except: 79 ktable = xk.Ktable(wnedges=wnedges, xtable=xk.Xtable(mol=gas)) 80 ktable.plot_spectrum(ax=ax,p=p,t=t,x=x,g=1,label=gas) 81 ktable.bin_down(wnedges) 82 ktables.append(ktable) 83 kdata.add_ktables(*ktables) 69 84 70 85 mix_var_gas=kdata.create_mix_ktable5d(vgas_comp=vgas,bg_comp=bg_gas,x_array=x_array)
Note: See TracChangeset
for help on using the changeset viewer.