Module for handeling alloying and particle content.
Class representing the chemical composition (including particles) of an alloying system.
| Parameters : | symbols : string | sequence of strings | record array
weight_fractions : floats array
atom_fractions : floats array
balance : int | string
particles : sequence of Particle instances
kw : keyword_arguments
|
|---|
Examples
>>> chem = Chemistry(symbols=['Al', 'Si', 'Mg', 'Fe'],
... weight_fractions=[0., 0.0043, 0.0048, 0.0020])
>>> chem.weight_fractions
array([ 0.9889, 0.0043, 0.0048, 0.002 ])
Same example, weight percent is assumed
>>> chem = Chemistry('AlSi0.43Mg0.48Fe0.2')
>>> chem.weight_fractions
array([ 0.9889, 0.0043, 0.0048, 0.002 ])
Add array to atom arrays with name name. If an array of the same name already exists, it is replaced.
Add element. Default amount is zero. Keyword arguments must correspond to additional arrays.
Array of atom fractions.
Index of dependent element.
Return a record array with the chemistry. Fields gives the fields to include. It defaults to [‘Element’, ‘C0(wt%)’] followed by all additional arrays.
The following fields are recognised:
- element/symbol/atom :
- Atomic symbols.
- c0/c/conc :
- Nominal concentration. Recognised units are “at%”, “wt%”, “at fraction”, “wt fraction”. Default unit is at fraction.
- M/molar_mass :
- Molar mass.
Returns element table with columns given by fields. Defaults to [‘Element’, ‘C0(wt%)’] plus all added arrays. See also get_element_record().
Returns information on all particles as a record array with columns given by fields. Defaults to [‘Particle’, ‘f’] plus additional scalar information common to all particles.
If fields is None and shortname is True, the shortest alias is used for column names.
Returns particle table with columns given by fields. Defaults to [‘Particle’, ‘f’] plus additional scalar information common to all particles.
Returns an array with solute solution amounts. Valid units are “at_fractions”, “at%”, “wt_fractions” and , “wt%”.
Returns Zener drag in Pascal for all particles. gamma_GB is the grain boundary energy in J/m^2. C_PZ is an array of pre-factors for each particle. If not given it defaults to unity.
Direct access to list of Particle objects.
Remove atom array. If name is None, all atom arrays are removed.
Set atom fraction given element. element might be the atomic symbol of an existing element or its index.
Set weight fraction given element. element might be the atomic symbol of an existing element or its index.
List of atomic symbols.
Array of particle volume fractions.
Array of weight fractions.
Class representing a particle.
| Parameters : | name : string
composition : None, string | dict | record_array | sequence_of_tuples
volume_fraction : float
sizes : float | array
relative_standard_deviation : None | float
size_distribution : None | “lognormal” | “lognorm” | “exp”
number_density : float | array
kw : keyword_arguments
|
|---|
Examples
>>> p = Particle('Al3Ti', f=0.011, molar_volume=26.21e-5)
>>> print(p.composition)
[('Al', 3) ('Ti', 1)]
>>> p.composition.dtype.names
('species', 'amounts')
>>> p.info
{'molar_volume': 0.0002621}
Amount of each species in atom fractions.
Returns an array with the atom fraction of each specie in symbols. If symbols is None, self.species is used.
Examples
>>> p = Particle('Al3Ti')
>>> p.atom_fractions(['Ti', 'Al', 'Cu'])
array([ 0.25, 0.75, 0. ])
Direct access to record array with composition.
Returns a copy of self.
Returns a list of units for attributes associated with the info property. An empty string is returned for attributes without unit.
Returns Zener drag in Pascal for this particle. gamma_GB is the grain boundary energy in J/m^2 and C_PZ is a pre-factor that defaults to unity.
Dict with additional properties assigned to the particle.
Name of particle type.
Direct access to array of particle number density for each size class, #/m^3.
Returns a matplotlib figure object with size distributions plotted.
Set particle name. If defines_composition is true, the composition is updated based on the name.
Direct access to array of size class midpoints, m.
List of atom species the particle is composed of.
Particle volume fraction.
Converts atom fractions to weight fractions.
Examples
>>> at2wt(['Al', 'Si', 'Mg', 'Fe'], [0.0, 0.0043, 0.0048, 0.0020]) # AA6060
array([ 0.98708433, 0.00446772, 0.00431591, 0.00413204])
Returns a list of Particle objects from Numpy record array particle_table.
Read chemistry from filename. Returns a Chemistry object.
Return a Chemistry object from numpy record array.
Recognised fields (case insensitive):
- element/ele/symbol/atom :
- Atomic symbols.
- c0/conc/nominal conc :
- Nominal concentration. Recognised units are “at%”, “wt%”, “at fraction”, “wt fraction”. Default unit is at fraction.
Other fields are simply added to the chemistry as-is.
Parse string with an Alpack ELEMENT_TABLE and return a Chemistry object.
Returns a sequence of (symbol, number)-tuples from parsing the particle name name.
Examples
>>> parse_composition('Al6Mn')
[('Al', 6), ('Mn', 1)]
>>> parse_composition('He')
[('He', 1)]
>>> parse_composition('H2')
[('H', 2)]
>>> parse_composition('K')
[('K', 1)]
>>> parse_composition('AlMg0.5Si0.6')
[('Al', 1), ('Mg', 0.5), ('Si', 0.6)]