Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
[TOC]
KiThe
This is a package of structures, functions and databases useful for such areas as chemical thermodynamics, chemical kinetics, as well as modeling of chemical reactors, combustion, processes in shock tubes and rocket engines, propulsion.
PROJECT NEWS: CHEMICAL EQUILIBRIUM calculations added
Content
Features
When install as library:
- Chemical kinetics
- crate is equipped with a libraries of kinetic parameters of chemical reactions obtained as a result of parsing publicly available databases;
- searching inside local kinetic libraries by reagents, products, etc.
- parsing reaction equations into a list of substances;
- parsing reaction equations into a stoichiometric matrix, matrix of coefficients of direct reactions and matrix of coefficients of reverse reactions, matrix of degrees of concentration for the kinetic function;
- calculation of atomic composition, molar masses and matrix of atomic composition;
- Automatic (for found in libs reactions) and by function call constucting of kinetic functions of all main types (elemntary, fall-off, troe, etc) - both rust functions and symbolic expressions;
- Automatic chemical mechanism constructor (say you have some reagents and want to find all possible reactions between original species and all their products)
- Thermodynamics
- many libraries on board with thermodynamics and transport properties (NASA, NASA-CEA, NIST, Aramco transport, etc.) and handlers for them;
- search substances thermodynamics and heat-mass transfer data through all libraries with storing of data in a structure;
- Calculaton of Gibbs free energy of a given mixure of substances (numerical result at given T, P, concentration) and symbolic Gibbs free energy of a given mixure of substances (symbolic result at given T, P, concentration).
- automatic NIST parser for thermochemical data;
- CHEMICAL EQUILIBRIUM calculation
- Gaseos combustion/Plug-flow steady-state 1D boundary value problem.
- IVP problem for multiple solid state kinetic models with constant or linear increasing temperature
- condended phase combustion IVP problem (under development)
- Experimental Kinetics - data processing pipeline for Thermogravimetric Analysis TGA
- raw data manupulations via Polars crate
- smothing and filtering: Hampel/MAD, savitzky–golay, LOWESS, splines
When install as executable: CLI instrument to solve some of the heat-mass transfer, combustion, chemical engeneering problems. Now available:
- BVP solver for gas phase steady-state combustion/plug-flow with constant mass velocity BVP problem
- IVP problem for multiple solid state kinetic models with constant or linear increasing temperature.
pretty GUI menues:
* Main menu
* Menu for gas phase steady-state combustion/plug-flow with constant mass velocity BVP problem;
* Chemical kinetics menu: searching reactions in kinetics libraries, kinetic paramters display;
* Thermodynamics menu: Cp, dH, dS and Cp = Cp(T) polynoms for many substances;
* Transport properies: Diffusion, viscosity, thermal condusctivity for many substances;
* solid state kinetics models
Kinetics
- parse reaction equations into a list of substances
- parse reaction equations into a stoichiometric matrix, matrix of coefficients of direct reactions and matrix of coefficients of reverse reactions, matrix of degrees of concentration for the kinetic function,
- calculate of atomic composition, molar masses and matrix of atomic composition.
Let us observe the main structure realizing that features
usage
use StoichAnalyzer;
let mut StoichAnalyzer_instance = new;
let reactions_: = vec!;
let reaction = reactions_.iter.map.collect;
StoichAnalyzer_instance.reactions = reaction;
StoichAnalyzer_instance.search_substances;
StoichAnalyzer_instance.analyse_reactions;
let stecheo_matrx = StoichAnalyzer_instance.stecheo_matrx;
let result = ;
let result: = result.iter.map.collect;
assert_eq!;
println!;
println!;
- Calculation of atomic composition, molar masses and matrix of atomic composition. We can use struct StoichAnalyzer or just use the more low-level functions
use ;
let formula = "C6H8O6";
let = calculate_molar_mass;
println!;
println!;
let formula = "Na(NO3)2".to_string;
let atomic_composition = parse_formula;
println!;
let vec_of_formulae = vec!;
let expected_molar_masses = vec!;
let = create_elem_composition_matrix;
for in expected_molar_masses.iter.enumerate
let vec_of_formulae = vec!; // 5 elements
let matrix = create_elem_composition_matrix;
println!;
- crate is equipped with a libraries of kinetic parameters of chemical reactions obtained as a result of parsing publicly available databases, so you can view all libraries and all reactions in every library of kinetic DB, search reactions by substances and so on. Most important methods below
use KineticData;
let mut kin_instance = new;
// collecting reaction data for library name lib
let lib = "NUIG";
kin_instance.open_json_files;
// veiew all reactions in library
kin_instance.print_all_reactions;
let reaction1 = kin_instance.search_reactdata_by_reaction_id;
println!;
// search reactions by substances
kin_instance.search_reaction_by_reagents_and_products;
println!;
println!;
Kinetic data (Arrhenius parameters, etc) are parsed into stuctures
where ReactionType is enum for concrete type of reaction (elementary, fall-off, etc)
- The module is automatic chemical mechanism constructor and takes as input the name of the library and the vector of substances and then produces the following data:
- all reactions of starting substances with each other, and all reactions of all their possible products with each other and with original substances.
- HashMap with kinetic data of all found reactions
use crateMechanism_search;
let mut mech_search = new;
let = mech_search.mechfinder_api;
println!;
println!;
println!;
println!;
The most general approach is to use stuct KinData whin aggregates the most features of Kinetics module: library parsing, mechanism construction, structures for different reaction types, stoichiometric calculations, saving and reading data
examples of usage
use crateKinData;
// let our journey begin with a new instance of KinData
let mut kd = new;
// set the shortcut reactions for our KineticData instance
// it means we want reactions from Cantera sub-librarie from number 1 to number 10
kd.set_reactions_from_shortcut_range;
// searching for reactions in data base
kd.get_reactions_from_shortcuts;
kd.kinetic_main; // parsing reaction data into structures and stoichometric calculations under one hood
kd.pretty_print_kindata; // pretty print the reaction data
mechsnism constracting
use KinData;
let mut kd = new;
let task_substances = vec!;
let task_library = "NUIG".to_string;
kd.construct_mechanism;
kd.kinetic_main; // parsing reaction data into structures and stoichometric calculations under one hood
kd.pretty_print_kindata;
println!;
println!;
Thermodynamics
search data: Cp, dH, dS, thermal conductivity, viscosity, diffusion coefficient, etc
use ThermoData;
let mut thermo_data = new;
println!;
let this_lib_subs = thermo_data.subs_of_this_lib;
println!;
// you may want to search only in chosen libs
let allowed_libs: = vec!;
// let us find out what info we have about CO
thermo_data.search_libs_for_subs;
println!;
thermo_data.pretty_print_thermo_data;
NASA-CEA lib contains info for calculating thermal dependence of thermal conductivity and viscosity. CEAdata module contains corresponding structures and methods for calculating this values.
use CEAdata;
let thermo_data = new;
let sublib = thermo_data.LibThermoData.get.unwrap;
let CO_data = sublib.get.unwrap;
let mut CEA = new;
CEA.from_serde.unwrap;
CEA.set_lambda_unit.unwrap;
CEA.set_V_unit.unwrap;
CEA.parse_coefficients.unwrap;
CEA.extract_coefficients.unwrap;
let lambda = CEA.calculate_Lambda.unwrap;
let visc = CEA.calculate_Visc.unwrap;
println!;
Aramco_transport lib contains info for calculating thermal dependence of thermal conductivity, viscosity and diffusion coefficient. TRANSPORTdata module contains corresponding structures and methods for calculating this values.
use TransportData;
use NASAdata;
let thermo_data = new;
let sublib = thermo_data.LibThermoData.get.unwrap;
let CO_data = sublib.get.unwrap;
println!;
// creating instance of the transport TransportData structure
let mut tr = TransportData new;
// filling transport data from serde json
tr.from_serde;
// setting units
tr.set_M_unit;
tr.set_P_unit;
tr.set_V_unit;
tr. set_lambda_unit;
let T = 473.15; // K
tr.P = 1.0;
tr.M = 28.0; // g/mol
// calculate viscosity
tr.calculate_Visc;
assert_relative_eq!;
println!;
// we need heat capacity - so we shall take it from another library
let sublib = thermo_data.LibThermoData.get.unwrap;
let CO_data = sublib.get.unwrap;
let mut NASA = new;
NASA.from_serde;
NASA.extract_coefficients;
NASA.calculate_Cp_dH_dS;
let Cp = NASA.Cp;
println!;
// for density calculation we use now ideal gas equations
let ro = */;
// thermal conductivity
let L = tr.calculate_Lambda;
println!;
NASA _gas lib contains info for calculating thermal dependence of heat capacity, enthalpy and entropy.
use NASAdata;
let thermo_data = new;
let sublib = thermo_data.LibThermoData.get.unwrap;
let CO_data = sublib.get.unwrap;
let mut NASA = new;
NASA.calculate_Cp_dH_dS;
let Cp = NASA.Cp;
let dh = NASA.dh;
let ds = NASA.ds;
println!;
let t = 400.0;
NASA.create_closures_Cp_dH_dS;
let Cp_fun = &NASA.C_fun;
let dh_fun = &NASA.dh_fun;
let ds_fun = &NASA.ds_fun;
assert_relative_eq!;
assert_relative_eq!;
assert_relative_eq!;
// symbolic expressions
NASA.create_sym_Cp_dH_dS;
let Cp_sym = &NASA.Cp_sym;
let Cp_T = Cp_sym.lambdify1D;
let Cp_value = Cp_T;
assert_relative_eq!;
let dh_sym = &NASA.dh_sym;
let dh_T = dh_sym.lambdify1D;
let dh_value = dh_T;
assert_relative_eq!;
let ds_sym = &NASA.ds_sym;
let ds_T = ds_sym.lambdify1D;
let ds_value = ds_T;
assert_relative_eq!;
Chemical_thermodynamics
- calculating Gibbs free energy for gasess and solids (and their mixtures). Only ideal gases are supported now.
// calculating Gibbs free energy withoun concentration correction RT*ln(P/P°) + RT*ln(w_i)
let subs = vec!;
// calling instance of strucutre SubsData created to search substances data in the databases, store
// search results and calculate thermo properties
let mut subdata = new;
// Set up library priorities
subdata.set_multiple_library_priorities;
subdata.substances = subs.clone;
// Perform the search
subdata.search_substances;
// Calling instance of structure Thermodynamics to calculate thermo dG
let mut thermo = new;
// Set up basic parameters
thermo.set_T;
thermo.set_P;
let concentration = Some;
// Add test substances
thermo.vec_of_substances = subs.clone;
// Set up phases
thermo.vec_of_phases.insert;
thermo.vec_of_phases.insert;
// savng the search results in the structure Thermodynamics
thermo.subdata = subdata;
// Calculate Gibbs free energy
thermo.calculate_Gibbs_free_energy;
// Calculate symbolic Gibbs free energy
thermo.calculate_Gibbs_sym;
thermo.set_P_to_sym;
// getting the results of the calculation
thermo.calculate_Gibbs_fun;
let map_of_gibbs = thermo.dG.clone;
let map_of_gibbs_sym = thermo.dG_sym.clone;
let map_of_gibbs_fun = thermo.clone.dG_fun;
for substance in &thermo.vec_of_substances
for substance in &thermo.vec_of_substances
let _ = thermo.pretty_print;
NIST_scrapper
NIST Chemistry WebBook contains huge amount of thermochemical data. This module can scrap data automatically and use it
use ;
let parser = new;
// Example usage
let substance = "CH4";
match parser.get_data
let parser = new;
let substance = "NaCl";
match parser.get_data
Testing
Our project is covered by tests and you can run them by standard command
Contributing
If you have any questions, comments or want to contribute, please feel free to contact us at https://github.com/
To do
- Add libraries of chemical reactions with appropriate methods for processing, searching, and retrieving data.
- Add libraries of chemical substances...
- Add numerical methods (may be cpp open source...)