Skip to content

Commit

Permalink
Update docs and bump to version 23.2
Browse files Browse the repository at this point in the history
  • Loading branch information
wigging committed Feb 15, 2023
1 parent ddc6cbb commit 5969aa8
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 37 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

Version numbers use calendar versioning based on `YY.MM.MICRO`. See the [CalVer](https://calver.org) website for more information about this versioning convention. The format of this changelog follows the approach outlined on the [Keep a Changelog](https://keepachangelog.com) website.

## 23.2

This version has breaking changes so please upgrade from previous versions.

#### Changed

- Gas density, heat capacity, thermal conductivity, and viscosity functions are now methods in the `Gas` class
- Liquid heat capacity function is now a method in the `Liquid` class
- Wood heat capacity and thermal conductivity functions are now in the wood module

## 23.1

#### Changed
Expand Down
File renamed without changes.
22 changes: 14 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Chemics

The chemics package is a collection of Python functions for performing calculations in the field of chemical engineering. Source code for the package is available on GitHub and contributions from the community are encouraged.
Chemics is a Python package for chemistry and chemical engineering applications. It is open-source and contributions from the scientific community are encouraged.

## Installation

Expand All @@ -12,25 +12,31 @@ $ pip install chemics

## Usage

The example below imports the chemics package then uses the `rhog()` function to calculate the density of a gas based on its molecular weight, pressure, and temperature.
The example below imports the chemics package and creates a `Gas` class to calculate the density of nitrogen gas at a pressure of 101,325 Pa and 773 K.

```python
import chemics as cm
cm.rhog(28, 101325, 773) # returns 0.4414

gas = cm.Gas('N2')
rho = gas.rho(101325, 773)
print(rho)

# This prints a value of 0.4416
```

Use the `ChemicalEquation` class to get properties of the reactants and products from a given chemical equation.
This example uses the `ChemicalEquation` class to get properties of the reactants and products from a given chemical equation.

```python
import chemics as cm

ce = cm.ChemicalEquation('2 HCl + 2 Na -> 2 NaCl + H2')

ce.balance
# returns True for balanced equation

# Returns True for balanced equation

ce.rct_properties
# returns a dataframe of the reactant properties

# Returns a dataframe of the reactant properties
# HCl Na
# moles 2 2
# species HCl Na
Expand All @@ -40,7 +46,7 @@ ce.rct_properties
# massfrac 0.613275 0.386725
```

More examples are available in the `examples` directory.
More examples are available in the `examples` directory and in the documentation.

## Documentation

Expand Down
10 changes: 6 additions & 4 deletions chemics/wood.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ def cp_wood(x, tk):
References
----------
.. [1] Samuel V. Glass and Samuel L. Zelinka. Moisture Relations and
Physical Properties of Wood. Ch. 4 in Wood Handbook, pp. 1-19, 2010.
Physical Properties of Wood. Chapter 4 in Wood Handbook, pp. 1-19,
2010.
"""

cpw = 4.18 # heat capacity of water, kJ/(kg K)
Expand Down Expand Up @@ -85,7 +86,7 @@ def k_wood(gb, so, x):
.. math:: S_x = S_o \\left(1 - \\frac{x}{MC_{fs}} \\right)
where :math:`S_o` is volumetric shrinkage [%] from Table 4-3 [1]_ and :math:`MC_{fs}`
where :math:`S_o` is volumetric shrinkage [%] from Table 4-3 [2]_ and :math:`MC_{fs}`
is the fiber saturation point assumed to be 30% moisture content.
Parameters
Expand All @@ -109,8 +110,9 @@ def k_wood(gb, so, x):
References
----------
.. [1] Samuel V. Glass and Samuel L. Zelinka. Moisture Relations and
Physical Properties of Wood. Ch. 4 in Wood Handbook, pp. 1-19, 2010.
.. [2] Samuel V. Glass and Samuel L. Zelinka. Moisture Relations and
Physical Properties of Wood. Chapter 4 in Wood Handbook, pp. 1-19,
2010.
"""

mcfs = 30 # fiber staturation point estimate [%]
Expand Down
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
author = 'Gavin Wiggins'

# The short X.Y version
version = '23.1'
version = '23.2'

# The full version, including alpha/beta/rc tags
release = '23.1'
release = '23.2'


# -- General configuration ---------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion docs/gas.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Gas
===

Gas properties such as density, heat capacity, thermal conductivity, and viscosity can be calculated using the methods available in the :code:`Gas()` class. Some methods are based on correlations and are named accordingly; for example, the :code:`cp_yaws()` method uses Yaws' coefficients to calculate the heat capacity for a range of temperatures.
Gas properties such as density, heat capacity, thermal conductivity, and viscosity can be calculated using the methods available in the :code:`Gas` class. Some methods are based on correlations and are named accordingly; for example, the :code:`cp_yaws()` method uses Yaws' coefficients to calculate the heat capacity for a range of temperatures.

.. automodule:: chemics.gas
:members:
43 changes: 23 additions & 20 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,37 +23,40 @@ Install Chemics using the pip package manager:
Usage
-----

The example below imports the Chemics package then uses the :code:`rhog()`
function to calculate the density of a gas based on its molecular weight,
pressure, and temperature.
The example below imports the chemics package and creates a :code:`Gas` class to calculate the density of nitrogen gas at a pressure of 101,325 Pa and 773 K.

.. code-block:: python
import chemics as cm
import chemics as cm
cm.rhog(28, 170100, 773)
gas = cm.Gas('N2')
rho = gas.rho(101325, 773)
print(rho)
Use the :code:`ChemicalEquation` class to get properties of the reactants and
products from a given chemical equation.
# This prints a value of 0.4416
This example uses the :code:`ChemicalEquation` class to get properties of the reactants and products from a given chemical equation.

.. code-block:: python
import chemics as cm
import chemics as cm
ce = cm.ChemicalEquation('2 HCl + 2 Na -> 2 NaCl + H2')
ce.balance
ce = cm.ChemicalEquation('2 HCl + 2 Na -> 2 NaCl + H2')
# Returns True for balanced equation
ce.balance
# returns True for balanced equation
ce.rct_properties
ce.rct_properties
# returns a dataframe of the reactant properties
# HCl Na
# moles 2 2
# species HCl Na
# molwt 36.458 22.99
# mass 72.916 45.98
# molfrac 0.5 0.5
# massfrac 0.613275 0.386725
# Returns a dataframe of the reactant properties
# HCl Na
# moles 2 2
# species HCl Na
# molwt 36.458 22.99
# mass 72.916 45.98
# molfrac 0.5 0.5
# massfrac 0.613275 0.386725
See the `examples <https://github.com/wigging/chemics>`_ directory in the GitHub repository for more examples.

Expand Down
2 changes: 1 addition & 1 deletion docs/liquid.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Liquid
======


Liquid properties such as heat capacity can be calculated using the method available in the :code:`Liquid()` class. The method is based on a correlation and is named accordingly; for example, the :code:`cp_yaws()` method uses Yaws' coefficients to calculate the heat capacity for a range of temperatures.
Liquid properties such as heat capacity can be calculated using the method available in the :code:`Liquid` class. The method is based on a correlation and is named accordingly; for example, the :code:`cp_yaws()` method uses Yaws' coefficients to calculate the heat capacity for a range of temperatures.

.. automodule:: chemics.liquid
:members:
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name='chemics',
version='23.1',
version='23.2',
author='Gavin Wiggins',
description='A Python package for chemical engineering',
long_description=long_description,
Expand Down

0 comments on commit 5969aa8

Please sign in to comment.