exoclime / vulcan Goto Github PK
View Code? Open in Web Editor NEWChemical Kinetics For Exoplanetary Atmospheres
Chemical Kinetics For Exoplanetary Atmospheres
Running VULCAN using the sample Earth vulcan_cfg file and condensation set to "True" leads to the following error message:
File "vulcan.py", line 178, in <module>
integ(data_var, data_atm, data_para, make_atm)
File "/home/tessa/Downloads/VULCAN-master/op.py", line 694, in __call__
if vulcan_cfg.use_condense == True and vulcan_cfg.use_relax_water == True and var.t > vulcan_cfg.start_conden_time:
AttributeError: module 'vulcan_cfg' has no attribute 'use_relax_water'
As the error message says, the current vulcan_cfg file doesn't include a setting called "use_relax_water" (which I'm assuming has to do with relaxing boundary conditions with respect to condensation). Is this a relic of an earlier version of VULCAN? And what's the best work-around for it?
In a number of runs I've encountered the following error, which crashes the VULCAN run. Will try to diagnose.
...
Equilibrium calculation (Fastchem) finished.
S8_l_s not included in fastchem.
/home/exolab/vulcan/build_atm.py:533: RuntimeWarning: divide by zero encountered in double_scalars
Hp[i] = kb*Tco[i]/(mu[i]/Navo*gz[i])
Input stellar spectrum from 2.0 to 700.0
Photodissociation threshold: 655.5
Using wavelength bins from 2.0 to 655.5
The stellar flux is interpolated onto uniform grid of 0.1 (<240.0 nm) and 2.0 (>=240.0 nm) and conserving 100.11 % energy.
/home/exolab/vulcan/op.py:2162: RuntimeWarning: invalid value encountered in multiply
var.tau[j] += var.y[j,species.index(sp)] * atm.dz[j] * var.cross[sp] # only the j-th laye
Traceback (most recent call last):
File "/home/exolab/vulcan/vulcan.py", line 177, in <module>
solver.compute_flux(data_var, data_atm)
File "/home/exolab/vulcan/op.py", line 2305, in compute_flux
var.aflux_change = np.nanmax( np.abs(var.aflux-var.prev_aflux)[var.aflux>vulcan_cfg.flux_atol]/var.aflux[var.aflux>vulcan_cfg.flux_atol] )
File "<__array_function__ internals>", line 180, in nanmax
File "/home/exolab/anaconda3/lib/python3.9/site-packages/numpy/lib/nanfunctions.py", line 476, in nanmax
res = np.fmax.reduce(a, axis=axis, out=out, **kwargs)
ValueError: zero-size array to reduction operation fmax which has no identity
I ran vulcan with "python vulcan.py" and it ran successfully, producing output/test.vul. Then I tried
"python plot_vulcan.py output/test.vul CH4,CO,CO2,H2O,C2H2 hd189" in the same folder and I get:
Traceback (most recent call last):
File "plot_vulcan.py", line 34, in
data = pickle.load(handle)
File "/usr/lib/python2.7/pickle.py", line 1384, in load
return Unpickler(file).load()
File "/usr/lib/python2.7/pickle.py", line 864, in load
dispatchkey
KeyError: '{'
I got someone else to run these two commands on their computer and they ran into exactly the same error.
What are we doing wrong, or is this a bug?
Hey Shami,
The NaOH thermodynamic file does not agree with the nasa9 file.
File location:
Expected content:
3.442036740E+04 -7.923218180E+02 8.997932300E+00 -4.079844520E-03 3.065783937E-06
-5.119189340E-10 -1.541016409E-13 0.000000000E+00 -2.086951091E+04 -2.510590090E+01
8.753787760E+05 -2.342514649E+03 7.978469890E+00 1.016451512E-04 -6.268531950E-08
1.022715136E-11 -5.713286410E-16 0.000000000E+00 -9.509901710E+03 -2.202310401E+01
Cheers,
Noah
I commented out the problematic line that keeps me from plotting and replaced it as follows.
I hope this helps.
if color_index == len(tableau20): # when running out of colors
Cheers
Hi,
I've set up VULCAN to run on my university's supercomputing cluster in batches via slurm--essentially, I run an sbatch script that tells slurm to run VULCAN using a set of parameters (const_kzz, para_warm, out_name, and out_dir) read from a text input file; each run in a particular batch is read from a different input file.
Previously, I'd been running atm_profile set to 'isothermal'--however, we've recently discovered that isn't producing as accurate a representation of the systems we're modeling at lower temperatures, so we've since switched it to 'analytical'.
However, since that switch, whenever I run the batches, I get one of the two following error messages:
rm: cannot remove ‘vulcan_EQ.dat’: No such file or directory
or
Traceback (most recent call last):
File "vulcan_batch.py", line 142, in
data_var = ini_abun.ini_y(data_var, data_atm)
File "/home/tfisher4/VULCAN-master/build_atm.py", line 129, in ini_y
fc = np.genfromtxt('fastchem_vulcan/output/vulcan_EQ.dat', names=True, dtype=None, skip_header=0)
File "/usr/lib64/python2.7/site-packages/numpy/lib/npyio.py", line 1317, in genfromtxt
fhd = iter(np.lib._datasource.open(fname, 'rbU'))
File "/usr/lib64/python2.7/site-packages/numpy/lib/_datasource.py", line 145, in open
return ds.open(path, mode)
File "/usr/lib64/python2.7/site-packages/numpy/lib/_datasource.py", line 479, in open
raise IOError("%s not found." % path)
IOError: fastchem_vulcan/output/vulcan_EQ.dat not found.
Any idea what might be causing these problems, and how to resolve them?
(Weirdly, the code still runs for ~5 minutes, and sometimes even produces .vul output files--but I can't say I particularly trust them, given the frequency of the error messages)
Thanks!
Hi!
I'm running VULCAN via Python3 on Linux Mint using Geany. for reasons of expediency, I have photochemistry, molecular diffusion, and topflux/bottomflux off, and use_kzz on (set to const)-see the attached config file for full details. However, when I run it, I get the following error message:
File "vulcan.py", line 171, in <module>
integ(data_var, data_atm, data_para, make_atm)
File "/home/tessa/Downloads/VULCAN-master/op.py", line 583, in __call__
while not self.stop(var, para, atm): # Looping until the stop condition is satisfied
File "/home/tessa/Downloads/VULCAN-master/op.py", line 753, in stop
if var.t > vulcan_cfg.trun_min and para.count > vulcan_cfg.count_min and self.conv(var, para, atm):
File "/home/tessa/Downloads/VULCAN-master/op.py", line 720, in conv
slope_min = min( np.amin(atm.Kzz/(0.1*atm.Hpi)**2) , 1.e-8)```
And I'm not sure what's causing it? Hpi seems pretty clearly defined in op.py as far as I can tell.
```# =============================================================================
# Configuration file of VULCAN:
# =============================================================================
# ====== Setting up the elements included in the network ======
atom_list = ['H', 'O', 'C', 'He', 'N']
# ====== Setting up paths and filenames for the input and output files ======
# input:
network = 'thermo/NCHO_photo_network.txt'
gibbs_text = 'thermo/gibbs_text.txt' # (all the nasa9 files must be placed in the folder: thermo/NASA9/)
cross_folder = 'thermo/photo_cross/'
com_file = 'thermo/all_compose.txt'
atm_file = 'atm/atm_HD189_Kzz.txt'
sflux_file = 'atm/stellar_flux/sflux-HD189_Moses11.txt' # This is the flux density at the stellar surface
top_BC_flux_file = 'atm/BC_top.txt'
bot_BC_flux_file = 'atm/BC_bot.txt'
vul_ini = 'output/moses_HD189.vul'
# output:
output_dir = 'output/'
plot_dir = 'plot/'
movie_dir = 'plot/movie/new-HD189/'
out_name = 'HD189.vul'
met=0.1
# ====== Setting up the elemental abundance ======
use_solar = False # True: using the solar abundance from Table 10. K.Lodders 2009; False: using the customized elemental abundance.
# customized elemental abundance (only reads when use_solar = False)
O_H = 6.0618E-4 *(0.793)
C_H = 2.7761E-4
N_H = 8.1853E-5
He_H = 0.09691
ini_mix = 'EQ' # Options: 'EQ', 'const_mix', 'vulcan_ini' (for 'vulcan_ini, the T-P grids have to be exactly the same)
# Initialsing uniform (constant with pressure) mixing ratios (only reads when ini_mix = const_mix)
const_mix = {'CH4':2.7761E-4*2, 'O2':4.807e-4, 'He':0.09691, 'N2':8.1853E-5, 'H2':1. -2.7761E-4*2*4/2}
# ====== Setting up photochemistry ======
use_photo = False
# astronomy input
r_star = 0.752 # stellar radius in solar radius
orbit_radius = 0.03142 # planet-star distance in A.U.
sl_angle = 48 /180.*3.14159 # the zenith angle of the star in degree
# radiation parameters
excit_sp = ['O_1', 'CH2_1'] # N_D not included due to lack of NASA9 Gibbs energy
scat_sp = ['H2', 'He'] # the bulk compositions that contribute to Rayleigh scattering
edd = 0.669 #(cos(48 deg) ) # the Eddington coefficient
dbin = 0.2 # the uniform bin width
# frequency to update the flux and optical depth
ini_update_photo_frq = 100
final_update_photo_frq = 10
# ====== Setting up parameters for the atmosphere ======
atm_base = 'H2' #Options: 'H2', 'N2', 'O2', 'CO2 -- the bulk gas of the atmosphere: affects molecular diffsion
nz = 120 # number of vertical layers
P_b = 1.E9 # pressure at the bottom (dyne/cm^2)
P_t = 1.e-2 # pressure at the top (dyne/cm^2)
use_Kzz = True
use_moldiff = False
use_vz = False
atm_type = 'isothermal' # Options: 'isothermal', 'analytical', or 'file'
Kzz_prof = 'const' # Options: 'const' or 'file'
vz_prof = 'const' # Options: 'const' or 'file'
g = 2140. # gravity (cm/s^2) (HD189:2140 HD209:936)
Tiso = 500. # only reads when atm_type = 'isothermal'
# setting the parameters for the analytical T-P from (126)in Heng et al. 2014. Only reads when atm_type = 'analytical'
# T_int, T_irr, ka_L, ka_S, beta_S, beta_L
para_warm = [120., 1500., 0.1, 0.02, 1., 1.]
para_anaTP = para_warm
const_Kzz = 1e9 # (cm^2/s) Only reads when use_Kzz = True and Kzz_prof = 'const'
const_vz = 0 # (cm/s) Only reads when use_vz = True and vz_prof = 'const'
# frequency for updating dz and dzi due to change of mu
update_frq = 100
# ====== Setting up the boundary conditions ======
# Boundary Conditions:
use_topflux = False
use_botflux = False
#use_fix_all_bot = True
use_fix_sp_bot = False
# ====== Reactions to be switched off ======
remove_list = [] # in pairs e.g. [1,2]
# == Condensation (Ongoing testing!) ======
use_condense = False
use_settling = False
#start_conden_time = 1e10
condesne_sp = ["H2O"] # , 'NH3'
non_gas_sp = ["H2O_l_s"]
# ====== steady state check ======
st_factor = 0.5
# ====== Setting up numerical parameters for the ODE solver ======
ode_solver = 'Ros2' # case sensitive
use_print_prog = True
print_prog_num = 500 # every x steps to print progress
dttry = 1.E-10
trun_min = 1e2
runtime = 1.E22
dt_min = 1.E-14
dt_max = runtime*1e-5
dt_var_max = 2.
dt_var_min = 0.5
count_min = 120
count_max = int(2E5)
atol = 1.E-2 # Try decreasing this if the solutions are not stable
mtol = 1.E-24
mtol_conv = 1.E-20
pos_cut = 0
nega_cut = -1.
loss_eps = 1e-1
yconv_cri = 0.01 # for checking steady-state
slope_cri = 1.e-4
yconv_min = 0.1
flux_cri = 5.e-2
flux_atol = 1. # the tol for actinc flux (# photons cm-2 s-1 nm-1)
# ====== Setting up numerical parameters for Ros2 ODE solver ======
rtol = 0.1
# ====== Setting up numerical parameters for SemiEu/SparSemiEU ODE solver (Not used) ======
PItol = 0.1
# ====== Setting up for output and plotting ======
# plotting:
plot_TP = True
use_live_plot = False
use_live_flux = False
use_plot_end = True
use_plot_evo = True
use_save_movie = False
use_flux_movie = False
plot_height = False
use_PIL = True
live_plot_frq = 10
save_movie_rate = live_plot_frq
y_time_freq = 1 # storing data for every 'y_time_freq' step
plot_spec = ['H', 'CH4', 'CO', 'CO2','C2H2', 'NH3', 'HCN']
# output:
output_humanread = False
use_shark = False
save_evolution = False
save_evo_frq = 10
I had noticed that within the photochemical network files there is no listing for any reactions with Iron, Magnesium, Calsium etc. that are otherwise listed in the all_compose file. I was wondering whether this is to be implemented, and if not where one could source more such networks. There is also no specifics as to what equation in what form is being used for said network files.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.