ThermoFun
Details on the API functionality can be found by searching the documentation. The naming is the same in C++ and Python.
Using ThermoFun is as simple as loading a database initializing a ThermoEngine/ThermoBatch and calling the function to calculate the properties for given substance(s)/reaction(s) at given T-P condition(s).
import thermofun as fun
database = fun.Database('aq17-thermofun.json')
engine = fun.ThermoEngine(database)
# T(K) P(Pa) symbol
Ca_ion = engine.thermoPropertiesSubstance(473, 2000e5, 'Ca+2')
print(f'G0 {Ca_ion.gibbs_energy.val} J/mol')
# T(K) P(Pa) reaction equation
calcite_dissolution = engine.thermoPropertiesReaction(348.15, 1e5, 'Calcite = Ca+2 + CO3-2')
print(f'drS0 of (Cal = Ca+2 + CO3-2) is {calcite_dissolution.reaction_entropy.val}')
print(f'drG0 of (Cal = Ca+2 + CO3-2) is {calcite_dissolution.reaction_gibbs_energy.val}')
print(f'logK0 of (Cal = Ca+2 + CO3-2) is {calcite_dissolution.log_equilibrium_constant.val}')
In Python using the help
function can provide hints on the usability.
help(fun.ThermoEngine)
Help on class ThermoEngine in module thermofun.PyThermoFun:
class ThermoEngine(pybind11_builtins.pybind11_object)
| Contains methods for calculating the thermodynamic properties of the substances and reactions
...
Try the ThermoFun examples in your browser:
The main ThermoFun classes
- Database: The Database class stores maps of elements, substances and reactions. A database instance can be used to create a ThermoEngine instance which can be further used to calculate the standard thermodynamic properties of substances and reactions at T and P
- ThermoEngine: The main ThermoFun class for doing calculations. It calculates the thermodynamic properties of the substances from the database. It also calculates the electro-chemical and other physico-chemical properties of the solvent.
- ThermoBatch: The Batch class is useful for doing batch calculations for a given list of substances, reactions, properties, and temperature and pressure grid. Options to set the input and output properties units are available.