Closed yalinli2 closed 4 years ago
Addition I further found that for the second set of codes, if I use:
append_new_single_phase_chemical('chemical_2', chems=chems_2, MW=1)
(i.e., do not set the phase_ref), then it works fine.
Alternatively, if I do not set the phase in the append_new_single_phase_chemical
function, then no error will be triggered in the second set of code.
Or, if I keep the function unchanged, still use the second set of code, but change phase_ref='s'
to phase_ref='l'
, then no error will be triggered.
An error about missing properties is first raised, but then there is an internal error with thermosteam that prevents the original error from showing up. I just fixed this bug in thermosteam.
I suggest you run <Chemicals>
.compile() before you use set_thermo
. The set_thermo
method forces the input to become a Thermo object, so it might be easier to debug if you compile
the chemicals first.
Also, the try-exception block with the at_state
method may be stopping some important errors from showing up. You may want to check that out too.
Great suggestions! The compile
function is super helpful, and I got rid of the try-exception block.
A little suggestion that you can see whether it makes sense: in the following error message, it will be even more awesome if "key thermodynamic properties" can be explicitly defined, maybe add parentheses like "key thermodynamic properties (need MW, Cn, V, blah blah... for compiling)". The message doesn't need to be for the specific chemical
object. Just to give the user a clue on what to look for from <Chemical>.get_missing_slots()
output (since there can be a lot of missing properties but not all of them are needed).
Though what properties are needed will certainly depend on what process the user will simulate (missing Tb will not prevent compiling, but it can cause problems if modeling a something like a Distillation
unit)...
Thanks!
For sure! I'm still thinking of some good algorithms to figure out which are the key thermodynamic properties that are needed depending on the chemical, and give an error message that lists out which are the ones that are missing (instead of telling you use get_missing_slots
). ~Feel free to email me a reminder if I dont get to it within a couple of weeks.~ I just implemented a temporary algorithm for this in the latest update. Now you should get the properties listed out. Tb and Psat are also key properties when the phase is not locked and its not a solid.
Yep the algorithm is working! Thanks!!!
Description See the two sets of codes below, I'm not sure why the first one works fine but the second one would raise the error as in the title
To Reproduce First define the function needed for both sets of codes:
Below codes work fine
But below ones will raise the error
Screenshot
Environment OS: macOS Catalina 10.15.3 thermosteam: 0.3.0 python: 3.7.1
Thanks!!!