Skip to content

Matrix-Data and Matrix-Equation

Choose a tag to compare

@sinagilassi sinagilassi released this 15 Dec 03:59
· 1803 commits to main since this release

We are excited to announce a new feature in this release—support for defining matrix data, including critical use cases such as the interaction parameters of the NRTL (Non-Random Two-Liquid) equation.

We’d love to hear your feedback! If you encounter issues or have suggestions, feel free to contribute or open an issue in the repository.

# ====================================
# COMPONENTS
# ====================================
# comp1
comp1 = "methanol"
# comp2
comp2 = "ethanol"
# comp3
comp3 = 'benzene'

# ====================================
# BUILD MATRIX DATA
# ====================================
# build data
nrtl_alpha = thermo_db.build_matrix_data(
    [comp1, comp2], 'NRTL', "Non-randomness parameters of the NRTL equation")
print(nrtl_alpha.matrix_data_structure())

print(nrtl_alpha.get_property('Alpha_i_1', comp1))

print(nrtl_alpha.get_matrix_property("Alpha_i_j",
                                     [comp1, comp2], symbol_format='alphabetic'))

# property name
prop_name_lists = ["Alpha", comp1, comp3]
prop_name = "_".join(prop_name_lists)
print(prop_name)
print(nrtl_alpha.get_matrix_property_by_name(prop_name).get('value'))

# ====================================
# BUILD MATRIX EQUATION
# ====================================
# ! equation 1
# build equation
nrtl_tau_eq = thermo_db.build_matrix_equation(
    [comp1, comp2, comp3], 'NRTL', 'Interaction parameters of the NRTL equation-2')

# load parms
pp(nrtl_tau_eq.parms)
pp(nrtl_tau_eq.parms_values)
# equation details
pp(nrtl_tau_eq.equation_parms())
pp(nrtl_tau_eq.equation_args())
pp(nrtl_tau_eq.equation_body())
pp(nrtl_tau_eq.equation_return())

# cal
tau_cal = nrtl_tau_eq.cal(T=298.15)
pp(tau_cal)