Skip to content

Commit

Permalink
move examples to docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
HugoMVale committed Jan 8, 2024
1 parent 0e5f9d3 commit d696902
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,3 @@
options:
members:
- DHVL_Kistiakowsky_Vetere

## Examples

Estimate the vaporization enthalpy of butadiene at the normal boiling temperature.

```python exec="on" source="material-block"
from polykin.properties.vaporization_enthalpy import DHVL_Kistiakowsky_Vetere

DHVL = DHVL_Kistiakowsky_Vetere(Tb=268.6, M=54.1e-3, kind='hydrocarbon')

print(f"{DHVL/1e3:.1f} kJ/mol")
```
12 changes: 0 additions & 12 deletions docs/reference/properties/vaporization_enthalpy/DHVL_Pitzer.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,3 @@
options:
members:
- DHVL_Pitzer

## Examples

Estimate the vaporization enthalpy of vinyl chloride at 50°C.

```python exec="on" source="material-block"
from polykin.properties.vaporization_enthalpy import DHVL_Pitzer

DHVL = DHVL_Pitzer(T=273.15+50, Tc=425., w=0.122)

print(f"{DHVL/1e3:.1f} kJ/mol")
```
12 changes: 0 additions & 12 deletions docs/reference/properties/vaporization_enthalpy/DHVL_Vetere.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,3 @@
options:
members:
- DHVL_Vetere

## Examples

Estimate the vaporization enthalpy of vinyl chloride at the normal boiling temperature.

```python exec="on" source="material-block"
from polykin.properties.vaporization_enthalpy import DHVL_Vetere

DHVL = DHVL_Vetere(Tb=259.8, Tc=425., Pc=51.5e5)

print(f"{DHVL/1e3:.1f} kJ/mol")
```
13 changes: 0 additions & 13 deletions docs/reference/properties/vaporization_enthalpy/DHVL_Watson.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,3 @@
options:
members:
- DHVL_Watson

## Examples

Estimate the vaporization enthalpy of vinyl chloride at 50°C from the known value at the normal
boiling temperature.

```python exec="on" source="material-block"
from polykin.properties.vaporization_enthalpy import DHVL_Watson

DHVL = DHVL_Watson(hvap1=22.9, T1=258., T2=273.15+50, Tc=425.)

print(f"{DHVL:.1f} kJ/mol")
```
40 changes: 40 additions & 0 deletions src/polykin/properties/vaporization_enthalpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,15 @@ def DHVL_Pitzer(T: FloatOrArray,
-------
FloatOrArray
Vaporization enthalpy. Unit = J/mol.
Examples
--------
Estimate the vaporization enthalpy of vinyl chloride at 50°C.
>>> from polykin.properties.vaporization_enthalpy import DHVL_Pitzer
>>> DHVL = DHVL_Pitzer(T=273.15+50, Tc=425., w=0.122)
>>> print(f"{DHVL/1e3:.1f} kJ/mol")
17.5 kJ/mol
"""
Tr = T/Tc
return R*Tc*(7.08*(1 - Tr)**0.354 + 10.95*w*(1 - Tr)**0.456)
Expand Down Expand Up @@ -93,6 +102,16 @@ def DHVL_Vetere(Tb: float,
-------
float
Vaporization enthalpy at the normal boiling point. Unit = J/mol.
Examples
--------
Estimate the vaporization enthalpy of vinyl chloride at the normal boiling
temperature.
>>> from polykin.properties.vaporization_enthalpy import DHVL_Vetere
>>> DHVL = DHVL_Vetere(Tb=259.8, Tc=425., Pc=51.5e5)
>>> print(f"{DHVL/1e3:.1f} kJ/mol")
21.6 kJ/mol
"""
Tbr = Tb/Tc
return R*Tc*Tbr*(0.4343*log(Pc/1e5) - 0.69431 + 0.89584*Tbr) \
Expand Down Expand Up @@ -133,6 +152,16 @@ def DHVL_Watson(hvap1: float,
-------
float
Vaporization temperature at `T2`. Unit = [hvap1].
Examples
--------
Estimate the vaporization enthalpy of vinyl chloride at 50°C from the known
value at the normal boiling temperature.
>>> from polykin.properties.vaporization_enthalpy import DHVL_Watson
>>> DHVL = DHVL_Watson(hvap1=22.9, T1=258., T2=273.15+50, Tc=425.)
>>> print(f"{DHVL:.1f} kJ/mol")
19.0 kJ/mol
"""
return hvap1*((1 - T2/Tc)/(1 - T1/Tc))**0.38

Expand Down Expand Up @@ -171,6 +200,17 @@ def DHVL_Kistiakowsky_Vetere(
-------
float
Vaporization enthalpy at the normal boiling point. Unit = J/mol.
Examples
--------
Estimate the vaporization enthalpy of butadiene at the normal boiling
temperature.
>>> from polykin.properties.vaporization_enthalpy \
... import DHVL_Kistiakowsky_Vetere
>>> DHVL = DHVL_Kistiakowsky_Vetere(Tb=268.6, M=54.1e-3, kind='hydrocarbon')
>>> print(f"{DHVL/1e3:.1f} kJ/mol")
22.4 kJ/mol
"""

if kind == 'any':
Expand Down

0 comments on commit d696902

Please sign in to comment.