IDAES / examples

IDAES platform examples and tutorials
https://idaes-examples.readthedocs.io
Other
17 stars 36 forks source link

Fix Reactor Examples Properties #95

Closed bpaul4 closed 1 month ago

bpaul4 commented 6 months ago

Addresses https://github.com/IDAES/idaes-pse/discussions/1376

Correct some property values in the property package used by the CSTR, Plug Flow Reactor, Stoichiometric Reactor and Skeleton Unit Model notebooks.


Legal Acknowledgement

By contributing to this software project, I agree to the following terms and conditions for my contribution:

I agree my contributions are submitted under the license terms described in the LICENSE.txt file at the top level of this directory.
I represent I am authorized to make the contributions and grant the license. If my employer has rights to intellectual property that includes these contributions, I represent that I have received permission to make contributions and grant the required license on behalf of that employer.

📚 Documentation preview 📚: https://idaes-examples--95.org.readthedocs.build/en/95/

bpaul4 commented 6 months ago

The test failures are expected failures (only Keras examples).

andrewlee94 commented 6 months ago

@bpaul4 Where did you find your copy of The Properties of Gases and Liquid (and which edition did you use)? It would be good to get someone to double check the values.

bpaul4 commented 4 months ago

@andrewlee94 the main changes here are in eg_h2o_ideal.py and egprod_ideal.py. The cstr, plug_flow_reactor, stoichiometric_reactor, and skeleton_unit examples have updates related to the property changes. Some of the supporting files for the notebooks became corrupted due to merge conflicts, including for the equlibrium_reactor and gibbs_reactor examples, and needed to be regenerated to resolve parsing issues from merge conflicts.

bpaul4 commented 3 months ago

@andrewlee94 I added cp_mol_liq_comp as Perrys to the config dictionary itself in the properties, which seemed to provide a method for the property to be created. I plan to check the other sources for reference data to validate as many of the remaining properties as possible.

andrewlee94 commented 3 months ago

@bpaul4 I do not think we should be adding cp_mol to the supported properties just for the sake of testing - this implies that cp is not required in the main model so we should not be adding it. For testing, you should instead test for what is used - enthalpy. So, instead of writing tests for cp write them instead in terms of entahlpy (h = integral(cp dT))

bpaul4 commented 3 months ago

@andrewlee94 I've tested some different ways to approximate the integral manually to calculate cp_mol from enth_mol against the literature values, and the results are close but not within 1e-4. Is there a function within idaes, pyomo, or another package which could provide a more precise calculation of the integral?

andrewlee94 commented 3 months ago

@bpaul4 When you say "approximate the integral" what exactly do you mean? If you are referring to the published corrleation you should be able to calculate that analytically, and it you are working from data then the issue is the data and not the integral. Note that any experimental data will have an error in it, and that will generally be on the order of 1% (so a relative tolerance of 1e-4 is unlikely to pass).

Note that this might be a dead-end quest. Depending on what data you have, the answer might be that we need to add cp as a property is we want to verify the results.

bpaul4 commented 3 months ago

@andrewlee94 Calculating from the expression directly using the coefficients seems like a redundant test, since we'd basically be checking if a value calculated from the formula in the test equals a value calculated from that same formula in IDAES properties. I used a trapezoid rule between the test points and public data from NIST Webbook.

As you mentioned, it may be better to add cp_mol as a property, or to just set up a test for enth_mol at the reference temperature (298.15 K) since we have those values already.

andrewlee94 commented 3 months ago

@bpaul4 What difference/error between the literature data and the model results did you get when using the trapezoid rule? Expecting a tolerance of 1e-4 is unrealistic, but if the error is on the order of 1% then it is probably good.

andrewlee94 commented 1 month ago

@bpaul Did you resolve the question about testing enthalpy values and how good (or bad) the comparison between the model and integrated data was?

bpaul4 commented 1 month ago

@andrewlee94 An error validation within 1% ended up being appropriate for most of the checks, as you indicated would most likely be the case in your earlier comment. Checking enthalpy directly instead of heat capacity works well and is implemented in the latest commits.