@@ -14,21 +14,12 @@ _______
1414
1515 .. code-block :: pycon
1616
17- Descriptor objects that automate setting the elemental abundances.
18-
19- To understand this sorcery see:
20- https://docs.python.org/3/howto/descriptor.html
21-
22-
2317 Initialize self. See help(type(self)) for accurate signature.
2418
2519 .. py :class :: Network(pressure, temperature, input_species, metallicity = 0.0 , e_abundances = {}, e_scale = {}, e_ratio = {}, e_source = ' asplund_2021' , sources = [' janaf' , ' cea' ])
2620
2721 .. code-block :: pycon
2822
29- A chemcat chemical network object.
30-
31-
3223 Parameters
3324 ----------
3425 pressure: 1D float iterable
@@ -109,8 +100,9 @@ _______
109100 .. py :method :: heat_capacity(temperature = None )
110101 .. code-block :: pycon
111102
112- Evaluate the heat capacity of each species in the network
113- at the given temperature (default to self.temperature if needed).
103+ Compute Cp/R(temperature) for each species in the network,
104+ where Cp is the molar heat capacity at constant pressure and
105+ R is the universal gas constant (8.31 J mol-1 K-1).
114106
115107 .. py :method :: thermochemical_equilibrium(temperature = None , metallicity = None , e_abundances = None , e_scale = None , e_ratio = None , savefile = None )
116108 .. code-block :: pycon
@@ -165,6 +157,7 @@ ___________
165157 .. code-block :: pycon
166158
167159 Element-wise check whether species name exist in CEA database.
160+
168161 Parameters
169162 ----------
170163 species: 1D iterable of strings
@@ -192,6 +185,7 @@ ___________
192185
193186 Read data from NASA's CEA thermoBuild file.
194187 https://cearun.grc.nasa.gov/ThermoBuild/index_ds.html
188+ https://ntrs.nasa.gov/citations/20020085330
195189
196190 Parameters
197191 ----------
@@ -227,73 +221,17 @@ ___________
227221 >>> # Network will all species from the database:
228222 >>> all_thermo_data = cea.read_thermo_build(species=None)
229223
230- .. py :function :: heat_func(a_coeffs, t_coeffs)
231- .. code-block :: pycon
232-
233- Generate a callable that evaluates the molar heat capacity
234- at a given temperature array.
224+ .. py :class :: Heat(species = None , a_coeffs = None , t_coeffs = None )
235225
236- Parameters
237- ----------
238- a_coeffs: 2D float ndarray
239- Polynomial coefficients to reproduce the heat capacity data.
240- t_coeffs: 1D float ndarray
241- Temperature intervals of validity for each set of coefficients.
242-
243- Returns
244- -------
245- heat: Callable
246- A function heat(temperature) that evaluates the molar heat
247- capacity, cp(T)/R, for a given temperature input
248- (which can be a single value or a 1D iterable).
249-
250- Examples
251- --------
252- >>> import chemcat.cea as cea
253-
254- >>> data = cea.read_thermo_build(['H2O'])[0]
255- >>> heat = cea.heat_func(
256- >>> data['a_coeffs'], data['t_coeffs'])
257-
258- >>> print(heat(300.0))
259- [4.04063805]
260- >>> print(heat([300.0, 1000.0, 3000.0]))
261- [4.04063805 4.96614188 6.8342561 ]
262-
263- .. py :function :: gibbs_func(a_coeffs, b_coeffs, t_coeffs)
264- .. code-block :: pycon
265-
266- Generate a callable that evaluates the Gibbs free energy
267- for a given temperature array.
268-
269- Parameters
270- ----------
271- a_coeffs: 2D float ndarray
272- Polynomial coefficients to reproduce the heat capacity data.
273- b_coeffs: 2D float ndarray
274- Integration constants to obtain the enthalpy and entropy.
275- t_coeffs: 1D float ndarray
276- Temperature intervals of validity for each set of coefficients.
226+ .. code-block :: pycon
277227
278- Returns
279- -------
280- gibbs: Callable
281- A function gibbs(temperature) that evaluates the Gibbs free
282- energy, G(T)/RT, for a given temperature input (which can be
283- a single value or a 1D iterable).
228+ Initialize self. See help(type(self)) for accurate signature.
284229
285- Examples
286- --------
287- >>> import chemcat.cea as cea
230+ .. py :class :: Gibbs(species = None , a_coeffs = None , b_coeffs = None , t_coeffs = None )
288231
289- >>> data = cea.read_thermo_build(['H2O'])[0]
290- >>> gibbs = cea.gibbs_func(
291- >>> data['a_coeffs'], data['b_coeffs'], data['t_coeffs'])
232+ .. code-block :: pycon
292233
293- >>> print(gibbs(300.0))
294- [-119.66025955]
295- >>> print(gibbs([300.0, 1000.0, 3000.0]))
296- [-119.66025955 -53.94898416 -39.09425268]
234+ Initialize self. See help(type(self)) for accurate signature.
297235
298236 .. py :function :: setup_network(input_species)
299237 .. code-block :: pycon
@@ -675,7 +613,7 @@ _____________
675613 .. py :data :: ROOT
676614 .. code-block :: pycon
677615
678- '/Users/username/envs/proj/lib/python3.9/site-packages /chemcat/'
616+ '/home/pcubillos/Dropbox/IWF/projects/2022_chemcat /chemcat/'
679617
680618 .. py :data :: COLORS
681619 .. code-block :: pycon
@@ -685,7 +623,7 @@ _____________
685623 .. py :data :: COLOR_DICT
686624 .. code-block :: pycon
687625
688- {'H': 'blue', 'H2': 'deepskyblue', 'He': 'olive', 'C': 'coral', 'CH4': 'darkorange', 'CO': 'limegreen', 'CO2': 'red', 'HCN': 'dimgray', 'C2H2': 'pink', 'C2H4': 'deeppink', 'N': 'darkviolet', 'NH3': 'magenta', 'N2': 'gold', 'O': 'greenyellow', 'H2O': 'navy', 'OH': 'darkkhaki', 'Si': 'lightslategray', 'SiO': 'darkturquoise', 'SiH4': 'mediumvioletred', 'Na': 'silver', '(NaCl)2': 'maroon', '(NaOH)2': 'hotpink', 'NaCl': 'rosybrown', 'K': 'black', '(KCl)2': 'chocolate', '(KOH)2': 'darkslateblue', 'KOH': 'lightgreen', 'KCl': 'darksalmon', 'S': 'cornflowerblue', 'H2S': 'darkgoldenrod', 'HS': 'yellowgreen', 'SO': 'mediumseagreen', 'SO2': 'skyblue', 'Al': 'khaki', 'AlOH': 'steelblue', 'Al2O': 'seagreen', 'OAlOH': 'tomato', 'Ca': 'orange', 'Ca(OH)2': 'indigo', 'e': 'darkgreen', 'Ti': 'crimson', 'TiO': 'brown', 'TiO2': 'indianred', 'VO': 'aquamarine', 'VO2': 'mediumaquamarine', 'V': 'darkcyan', 'Mg': 'sandybrown', 'MgH': 'lawngreen', 'Mg(OH)2': 'orangered', 'Fe': 'royalblue', 'FeH': 'wheat', 'Fe(OH)2': 'tan', 'F': 'yellow', 'OAlF2': 'sienna', 'TiF3': 'saddlebrown', 'AlF': 'orange', 'HF': 'lightblue', 'MnH': 'lime', 'Mn': 'rebeccapurple', 'PN': 'palegoldenrod', 'P': 'peachpuff', '(P2O3)2': 'cadetblue'}
626+ {'H': 'blue', 'H2': 'deepskyblue', 'He': 'olive', 'C': 'coral', 'CH4': 'darkorange', 'CO': 'limegreen', 'CO2': 'red', 'HCN': 'dimgray', 'C2H2': 'pink', 'C2H4': 'deeppink', 'N': 'darkviolet', 'NH3': 'magenta', 'N2': 'gold', 'O': 'greenyellow', 'H2O': 'navy', 'OH': 'darkkhaki', 'Si': 'lightslategray', 'SiO': 'darkturquoise', 'SiH4': 'mediumvioletred', 'Na': 'silver', '(NaCl)2': 'maroon', '(NaOH)2': 'hotpink', 'NaCl': 'rosybrown', 'K': 'black', '(KCl)2': 'chocolate', '(KOH)2': 'darkslateblue', 'KOH': 'lightgreen', 'KCl': 'darksalmon', 'S': 'cornflowerblue', 'H2S': 'darkgoldenrod', 'SH': 'yellowgreen', 'SO': 'xkcd:green', 'SO2': 'skyblue', 'SiS': 'xkcd:wheat', 'Al': 'khaki', 'AlOH': 'steelblue', 'Al2O': 'seagreen', 'OAlOH': 'tomato', 'Ca': 'orange', 'Ca(OH)2': 'xkcd:blue', 'e': 'darkgreen', 'Ti': 'crimson', 'TiO': 'brown', 'TiO2': 'indianred', 'VO': 'aquamarine', 'VO2': 'mediumaquamarine', 'V': 'darkcyan', 'Mg': 'sandybrown', 'MgH': 'lawngreen', 'Mg(OH)2': 'orangered', 'Fe': 'royalblue', 'FeH': 'wheat', 'Fe(OH)2': 'tan', 'F': 'yellow', 'OAlF2': 'sienna', 'TiF3': 'saddlebrown', 'AlF': 'orange', 'HF': 'lightblue', 'MnH': 'lime', 'Mn': 'rebeccapurple', 'PN': 'palegoldenrod', 'P': 'peachpuff', '(P2O3)2': 'cadetblue'}
689627
690628 .. py :function :: thermochemical_equilibrium(pressure, temperature, element_rel_abundance, stoich_vals, gibbs_funcs, tolx = 2.22e-16 , tolf = 2.22e-16 )
691629 .. code-block :: pycon
@@ -890,12 +828,12 @@ _____________
890828 abundance in dex units relative to H=12.0.
891829 These values (if any) override metallicity.
892830 e_scale: Dictionary of element-scaling pairs
893- Set custom elemental abundances by scaling from its solar value.
831+ Set custom elemental abundances by scaling relative to solar
832+ values in dex units.
894833 The dict contains the name of the element and their custom
895- scaling factor in dex units, e.g., for 2x solar carbon set
896- e_scale = {'C': np.log10(2.0)}.
897- This argument modifies the abundances on top of any custom
898- metallicity and e_abundances.
834+ scaling factor in dex units, e.g., for 5x solar carbon set
835+ e_scale = {'C': 0.7}. # log10(5.0) = 0.7
836+ This argument modifies overrides metallicity and e_abundances.
899837 e_ratio: Dictionary of element-ratio pairs
900838 Set custom elemental abundances by scaling relative to another
901839 element.
@@ -1077,7 +1015,7 @@ _____________
10771015 'e': 'darkgreen',
10781016 'H3': 'royalblue'}
10791017
1080- .. py :function :: plot_vmr(pressure, vmr, species, colors = None , vmr_range = None , fignum = 320 , title = None , fontsize = 14 , linewidth = 2.0 , rect = None , axis = None , savefig = None )
1018+ .. py :function :: plot_vmr(pressure, vmr, species, colors = None , vmr_range = None , fignum = 320 , title = None , fontsize = 14 , linewidth = 2.0 , rect = None , axis = None , savefig = None , show_legends = True )
10811019 .. code-block :: pycon
10821020
10831021 Plot VMRs vs pressure.
@@ -1090,9 +1028,10 @@ _____________
10901028 Volume mixing ratios of shape [nlayers, nspecies].
10911029 species: 1D string iterable
10921030 Names of the species in vmr.
1093- colors: 1D iterable of strings
1094- Color names to assign (sequentially) to the species.
1031+ colors: 1D iterable of strings or dict
10951032 If None, default to chemcat.utils.COLOR_DICT values.
1033+ If list, color names to assign (sequentially) to the species.
1034+ If dict, the name--color pairs for each neutral species.
10961035 Note that different ionic variations of a same species
10971036 (e.g., H, H+, H-) are assigned a same color, but differ
10981037 in line style.
@@ -1113,6 +1052,8 @@ _____________
11131052 Axis where to draw the VMRs. If not None, overrides fignum.
11141053 savefig: String
11151054 If not None, file name where to save the figure.
1055+ show_legends: Bool
1056+ Flag indicating whether legends should be plotted.
11161057
11171058 Returns
11181059 -------
@@ -1133,7 +1074,7 @@ _____________
11331074 >>> 'H2O CH4 CO CO2 NH3 N2 H2 HCN C2H2 C2H4 OH H He C N O '
11341075 >>> 'e- H- H+ H2+ He+ '
11351076 >>> 'Na Na- Na+ K K- K+ '
1136- >>> 'Si S SiO SiH4 H2S HS SO SO2 SiS'
1077+ >>> 'Si S SiO SiH4 H2S SH SO SO2 SiS'
11371078 >>> ).split()
11381079
11391080 >>> net = cat.Network(pressure, temperature, molecs)
0 commit comments