Dengo Documentation
Contents
Dengo Documentation¶
- class dengo.chemical_network.ChemicalNetwork(write_intermediate=False, stop_time=31557000000000.0)[source]¶
A chemical network that gathers all the species and reactions.
- reactions¶
the dictionary that holds the reactions added through self.add_reaction
- Type
dict
- cooling_actions¶
the dictionary that tracks the cooling tracked by the ChemicalNetwork
- Type
dict
- required_species¶
the set of chemical species tracked by ChemicalNetwork
- add_cooling(cooling_term, auto_add=True)[source]¶
Add cooling to the ChemicalNetwork
- Parameters
term (cooling) – the string that corresponds to the cooling that are previously registered in cooling_registry
- Return type
None
- add_reaction(reaction, auto_add=True)[source]¶
Add reaction to the ChemicalNetwork
- Parameters
reaction – the string of the reactions that are previously registered in reaction_registry
- Return type
None
- property chemical_species¶
helper function for code generation
- init_redshift(z_bounds=(0.0, 10.0), n_z_bins=100)[source]¶
Initialize the range of redshift over which the rate tables are generated
- Parameters
z_bounds (List[Float, Float], optional (default=(0.0,10.0))) – the range over which the rates table is interpolated
n_bins (int, optional (default=1024)) –
- init_temperature(T_bounds=(1, 100000000.0), n_bins=1024)[source]¶
Initialize the range of temperature over which the rate tables are generated
- Parameters
T_bounds (List[Float, Float], optional (default=(1,1e8))) – the range over which the rates table is interpolated
n_bins (int, optional (default=1024)) –
- print_JacTimesVec_component(s1, assign_to=None)[source]¶
Compute the product of Jacobian * Vec for a given Vec Might be useful when we use the CVSpils solver
- print_conserved_species(s, assign_to, is_mass_density=True)[source]¶
Calculate the total {H, He, …} atoms locked in species considered
- species_total(species)[source]¶
Output the RHS function of the given species
- Parameters
species (str,) –
- Returns
eq – the dydt (RHS function) in sympy expressions
- Return type
Sympy.symbols
- write_solver(solver_name, solver_template='rates_and_rate_tables', ode_solver_source='BE_chem_solve.C', output_dir='.', init_values=None, main_name='main', input_is_number=False)[source]¶
Write the chemistry solver, based on the specified solver templates
- Parameters
solver_name (str) – the name of the solver
solver_template (str, default = rate_and_rate_tables) – the jinja2 template the ChemicalNetwork populates, read dengo/templates for examples
ode_solver_source (str, default = BE_chem_solve.C) – the ODE solver used
output_dir (str, deafault = .) – the directory at which these files would be generated
- class dengo.reaction_classes.AtomicSpecies(atom_name, free_electrons)[source]¶
Initialize the atomic species
- Parameters
atom_name (str) – name of the atom
free_electrons (int) – number of free electron
Note
since it is an atom, the weight is taken directly from the periodic table.
- class dengo.reaction_classes.ChemicalSpecies(name, weight, free_electrons=0.0, pretty_name=None)[source]¶
initialize chemical species object
- Parameters
name (str) – name of the chemical species
weight (float) – the weight of the species in terms of atomic mass unit
free_electrons (int) – the number of free electrons of the species
- class dengo.reaction_classes.MolecularSpecies(molecule_name, weight, free_electrons, original_name=None)[source]¶
Initialize molecular species
- Parameters
molecule_name (str) – the name of the molecules
weight (float) – weight of the molecule in amu
free_electrons (int) – free electron in molecules
- class dengo.reaction_classes.ReactionCoefficient(name, **assumptions)[source]¶
- property free_symbols¶
Return from the atoms of self those which are free symbols.
For most expressions, all symbols are free symbols. For some classes this is not true. e.g. Integrals use Symbols for the dummy variables which are bound variables, so Integral has a method to return all symbols except those. Derivative keeps track of symbols with respect to which it will perform a derivative; those are bound variables, too, so it has its own free_symbols method.
Any other method that uses bound variables should implement a free_symbols method.
- dengo.reaction_classes.reaction(name, left_side, right_side)¶
Initialize Reaction, the chemical reactions between species
- Parameters
name (str) – name of the reaction
left_side – left hand side of the chemical reaction
right_side – right hand side of the chemical reaction
f – a function that takes state, and returns the reaction coefficient