feos-org/feos

FeOs: Defining parameters including kij for general fitting of cubic EoS

ErichMace opened this issue · 1 comments

Hello,

I would like to fit other cubic EoS to experimental data using FeOs. For this I have used as a starting point core_user_define_eos.ipynb and binary_parameter_optimization.ipynb. This works fine for PC-SAFT, but reading multiple *.json files including binary parameters for a general EoS is causing an error which I do not understand. Do you have any insights? I am working with the Peng-Robinson example to start. Please refer to the attachment and the following section of code.

Code

parameters = PengRobinsonParameters.from_multiple_json(
[
(['argon'], file_pure),
(['ammonia'], file_pure)
],
binary_path=file_binary,
)
parameters

Code-generated Error

RuntimeError Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_3844\3446048090.py in
----> 1 parameters = PengRobinsonParameters.from_multiple_json(
2 [
3 (['argon'], file_pure),
4 (['ammonia'], file_pure)
5 ],

RuntimeError: invalid type: map, expected f64 at line 19 column 25

T=374K.zip

Hi Erich,

the error message hints to an error in your input file (the binary parameter file, line 19, col 25). Instead of a map (key: value), it expects a single floating point number for the binary parameter (we implemented this a differently than for PC-SAFT). You can make it work by changing the binary parameter entries to:

{
        "id1": {
            "cas": "7727-37-9",
            "name": "nitrogen",
            "iupac_name": "molecular nitrogen",
            "smiles": "N#N",
            "inchi": "InChI=1/N2/c1-2",
            "formula": "N2"
        },
        "id2": {
            "cas": "74-82-8",
            "name": "methane",
            "iupac_name": "methane",
            "smiles": "C",
            "inchi": "InChI=1/CH4/h1H4",
            "formula": "CH4"
        },
        "model_record": 0.0
    }