vulcan.store
store
Module that contains classes that store all the variables used in VULCAN.
Copyright (C) 2016 Shang-Min Tsai (Shami)
There are three classes: Variables, AtmData, and Parameters, which store the main physical variables, atmospheric variables, and numerical parameters, respectively.
Imports
vulcan.config:Configclass for handling configuration settings.vulcan.chem_funs:ni,spec_list: number of species and the species list of the network.
Array conventions shared by all three classes: index 0 of the vertical axis is the bottom
of the atmosphere; nz is the number of layers (Config.nz) and ni the number of species.
Quantities with nz - 1 values sit on the interior interfaces between layers.
AtmData(vulcan_cfg)
Bases: object
Atmospheric structure: pressure, temperature, heights, mixing and boundary conditions.
One instance (usually atm or data_atm) is filled by the methods of build_atm.Atm
and read by the solver. Layer i lies between the interfaces i and i + 1.
Attributes:
| Name | Type | Description |
|---|---|---|
pco |
ndarray
|
Pressure at the layer centres, log-spaced from |
pico |
ndarray
|
Pressure at the interfaces, shape (nz + 1,) [dyn cm-2]; set by |
Tco |
ndarray
|
Temperature at the layer centres, shape (nz,) [K]; set by |
M, n_0 |
ndarray
|
Total number density p / (k_B T), shape (nz,) [cm-3]. |
Kzz |
ndarray
|
Eddy diffusion coefficient at the interior interfaces, shape (nz - 1,) [cm2 s-1]. |
vz |
ndarray
|
Vertical advection velocity at the interior interfaces, shape (nz - 1,) [cm s-1]; positive is upward. |
dz |
ndarray
|
Layer thickness, shape (nz,) [cm]. |
dzi |
ndarray
|
Distance between the centres of adjacent layers, shape (nz - 1,) [cm]. |
zco |
ndarray
|
Height of the interfaces, shape (nz + 1,) [cm]. Zero at the bottom, or for a gas
giant with |
zmco |
ndarray
|
Height of the layer centres, shape (nz,) [cm]. |
Hp |
ndarray
|
Pressure scale height, shape (nz,) [cm]. |
mu |
ndarray
|
Mean molar mass, shape (nz,) [g mol-1]. |
ms |
ndarray
|
Molar mass of each species, shape (ni,) [g mol-1]. |
gs |
float
|
Gravity at the surface, or at 1 bar for a gas giant [cm s-2]. |
g |
ndarray
|
Gravity in each layer, shape (nz,) [cm s-2]. |
Dzz |
ndarray
|
Molecular diffusion coefficient at the interior interfaces, shape (nz - 1, ni)
[cm2 s-1]; set by |
Dzz_cen |
ndarray
|
Shape (nz, ni); not used by the current code. |
vm |
ndarray
|
Molecular diffusion velocity read by |
vs |
ndarray
|
Settling velocity of the non-gaseous species at the interior interfaces, shape (nz - 1, ni) [cm s-1]; negative is downward. |
alpha |
ndarray
|
Thermal diffusion factor of each species, shape (ni,) [dimensionless]; set by
|
top_flux |
ndarray
|
Flux at the top boundary, shape (ni,) [cm-2 s-1]; positive into the atmosphere, negative for escape. |
bot_flux |
ndarray
|
Flux at the bottom boundary, shape (ni,) [cm-2 s-1]; positive into the atmosphere. |
bot_vdep |
ndarray
|
Deposition velocity at the bottom boundary, shape (ni,) [cm s-1]; the surface loss
is |
bot_fix_sp |
ndarray
|
Fixed bottom mixing ratios read by |
sat_p |
dict
|
Saturation vapour pressure per condensing species, shape (nz,) [dyn cm-2]. |
sat_mix |
dict
|
Saturation mixing ratio |
gas_indx |
list of int
|
Species indices that are not in |
fix_sp_indx |
dict
|
Per species in |
fix_e_indx |
ndarray
|
The same indices for the electron; only with |
r_p |
dict
|
Particle radius per condensate [cm]. |
rho_p |
dict
|
Particle density per condensate [g cm-3]. |
vulcan_cfg : Config
Run configuration; reads nz, P_b, P_t, gs, non_gas_sp, fix_species,
use_ion, use_condense, r_p and rho_p.
Source code in src/vulcan/store.py
358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 | |
Parameters(vulcan_cfg)
Bases: object
Counters and switches of the numerical integration.
Attributes:
| Name | Type | Description |
|---|---|---|
count |
int
|
Number of steps taken. |
delta |
float
|
Relative truncation error of the last step [dimensionless]; a step with
|
nega_count |
int
|
Steps rejected because of negative number densities. |
loss_count |
int
|
Steps rejected because the element conservation changed too much. |
delta_count |
int
|
Steps rejected because of the truncation error. |
small_y |
float
|
Running sum of the small positive number densities clipped to 0 [cm-3]. |
nega_y |
float
|
Running sum of the magnitudes of the negative number densities clipped to 0 [cm-3]. |
end_case |
int
|
Why the integration stopped: 0 not set, 1 steady state, 2 runtime limit,
3 step limit ( |
climate_count |
int
|
Step count at the latest climate update that changed the temperature by more than
|
climate_iter |
int
|
Number of climate updates made at a chemical steady state. |
climate_dT |
list of float
|
Largest relative temperature change, max |dT| / T, of each climate update [dimensionless]. |
solver_str |
str
|
Name of the solver method that |
switch_final_photo_frq |
bool
|
True once the photochemistry update interval has switched to
|
where_varies_most |
ndarray
|
|
pic_count |
int
|
Number of live-plot frames written. |
fix_species_start |
bool
|
True once the condensed species in |
tableau20 |
list of tuple
|
The 20 "Tableau 20" colours as RGB in [0, 1]. |
vulcan_cfg : Config
Run configuration; reads nz.
Source code in src/vulcan/store.py
481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 | |
Variables(vulcan_cfg)
Bases: object
Composition, rate coefficients and time-stepping state of a run.
One instance is passed through the whole run (usually as var or data_var) and is
updated in place by the solver. Photochemistry attributes such as bins, sflux_top,
tau, aflux and cross are added later by op.ReadRate.make_bins_read_cross and
op.ODESolver.compute_tau / compute_flux.
Attributes:
| Name | Type | Description |
|---|---|---|
y |
ndarray
|
Number densities, shape (nz, ni) [cm-3]. |
y_prev |
ndarray
|
Number densities at the previous accepted step, shape (nz, ni) [cm-3]. |
y_ini |
ndarray
|
Initial number densities, shape (nz, ni) [cm-3]. |
ymix |
ndarray
|
Mixing ratios, shape (nz, ni) [dimensionless]. With condensation, normalised by the
sum over the gas species only ( |
k |
dict
|
Rate coefficients keyed by reaction number, each of shape (nz,): [s-1] for unimolecular and photochemical reactions, [cm3 s-1] for two-body reactions and [cm6 s-1] for three-body reactions. |
t |
float
|
Integration time [s]. |
dt |
float
|
Current time step [s]; starts at |
dy, dy_prev, dydt |
float
|
Largest relative change of y over the last step and the step before
[dimensionless], and |
longdy, longdydt |
float
|
Largest relative change of the mixing ratios over the convergence window [dimensionless], and that change per second [s-1] (eqs. 10 and 11 of Tsai et al. 2017). |
aflux_change |
float
|
Largest relative change of the actinic flux at the last photochemistry update [dimensionless]; stays 0 without photochemistry. |
y_time, t_time |
list
|
|
atom_loss_time |
list
|
|
atom_ini, atom_sum |
dict
|
Per element, the number of atoms summed over all species and layers, initially and now [cm-3, summed over layers; not a column density]. |
atom_loss, atom_loss_prev |
dict
|
Relative change |
atom_conden |
dict
|
Per element; set to 0 by |
Rf |
dict
|
Reaction equation string keyed by reaction number. |
Rindx |
dict
|
Reaction number as written in the network file, keyed by the internal number. |
a, n, E |
dict
|
Arrhenius parameters of k = a T^n exp(-E/T), keyed by reaction number: a in the units of k, n [dimensionless], E [K]. |
a_inf, n_inf, E_inf |
dict
|
The same parameters for the high-pressure limit of three-body reactions. |
k_fun |
dict
|
Callables |
kinf_fun |
dict
|
Callables returning the high-pressure-limit rate coefficient [cm3 s-1]. |
k_fun_new |
dict
|
Pressure-dependent |
k_inf |
dict
|
Not filled by the current code. |
photo_sp |
set
|
Species with photodissociation reactions in the network. |
pho_rate_index |
dict
|
Reaction number keyed by (species, branch index) for photodissociation. |
n_branch |
dict
|
Number of photodissociation branches per species. |
ion_sp |
set
|
Species with photoionisation reactions in the network. |
ion_rate_index, ion_branch |
dict
|
As |
charge_list |
list
|
Species with non-zero charge, excluding the electron 'e'. |
def_bin_min, def_bin_max |
float
|
Wavelength range of the stellar spectrum, clipped to 2 to 700 nm [nm]; the limits of the photochemistry grid. |
threshold |
dict
|
Photodissociation threshold wavelength per species [nm], set by
|
cross_T_sp_list |
dict
|
Temperatures with tabulated cross sections, per species [K]. |
conden_re_list |
list
|
Reaction numbers of the condensation reactions. |
var_save |
list of str
|
Names of the attributes written to the output file. |
var_evol_save |
list of str
|
Names of the time series written to the output when |
vulcan_cfg : Config
Run configuration; reads nz, dttry, sflux_file, use_photo,
T_cross_sp and use_ion.
Source code in src/vulcan/store.py
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 | |