AguaClara / aguaclara

An open-source Python package for designing and performing research on AguaClara water treatment plants.
https://aguaclara.github.io/aguaclara/
MIT License
24 stars 13 forks source link

Discrepancies between Mathcad code and python functions #33

Closed zoemaisel closed 6 years ago

zoemaisel commented 6 years ago

@monroews @ethan92429 Nominal diameter in pipe_database and area_orifices_top in LFOM are two functions that give different results in Mathcad vs python.

Are these discrepancies an issue or if they are acceptable? We are writing test cases for LFOM code and have been comparing our calculations to Mathcad.

eak24 commented 6 years ago

nominal pipe diameter gives different values because python calculates the thickness based on SDR and MathCAD uses tabulated values... it should be no more than 3% different. How large are the discrepancies you are seeing?

In what way do the two LFOM equations yield different results? what are some example params?

fletchapin commented 6 years ago

I'll have to check tomorrow on Mathcad what the output of the area of the orifices equation was in order to compare the two outpus.

For the nominal diameter equation, when a flow of 60 L/s and headloss of 20 cm are input the nominal diameter in Mathcad is 18 inches whereas in Python it's 16 inches. The calculation of the inner diameter is the same so the difference stems from the nominal diameter function in pipedatabase

eak24 commented 6 years ago

Hmmm... interesting! maybe you could present the two alternative calculations here and we could say which one is correct... These should definitely be the same! Unless maybe 20cm with 60 L/s is right next to a transition in pipe sizes... what does 61 L/s in python yield?

monroews commented 6 years ago

This is likely because Mathcad pipe database doesn't include 16 inch pipes and apparently the AIDE pipe database does include 18" pipes.

Cheers,

Monroe Weber-Shirk

AguaClara http://aguaclara.cornell.edu/ at Cornell Civil and Environmental Engineering http://www.cee.cornell.edu/ Cornell University http://www.cornell.edu/ Hollister Hall 265 (607) 216-8445 http://aguaclara.cornell.edu/

On Thu, Mar 1, 2018 at 5:36 PM, Ethan Keller notifications@github.com wrote:

Hmmm... interesting! maybe you could present the two alternative calculations here and we could say which one is correct... These should definitely be the same! Unless maybe 20cm with 60 L/s is right next to a transition in pipe sizes... what does 61 L/s in python yield?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/AguaClara/aide_design/issues/33#issuecomment-369755367, or mute the thread https://github.com/notifications/unsubscribe-auth/AbN_6xu7-zsmcwdGkFX5WXKSj1SYPoDQks5taHfugaJpZM4SXXNb .

zoemaisel commented 6 years ago

For area_lfom_orifices_top, the results for 20 L/s and 20 cm headloss are:

Python: 0.001317 m^2 Mathcad: 0.001778 m^2

This is a 35% difference assuming that Python is the more accurate output.

zoemaisel commented 6 years ago

@monroews We checked the pipe databases. Python does not include "Country Database" information. Mathcad indicates that Honduras does not have 16'' pipes so it chooses 18" but Python has only one database which doesn't distinguish between countries.

Is this a problem? Do we need to include the country database information in Python?

monroews commented 6 years ago

For orifice area of the top row.

Presumably the diameter of the drill was different for python and mathcad. Thus the real question is whether the drill diameters are reasonable for fabrication.

For country database

Country databases aren't a priority at this time. If needed an expert can edit the database for a particular country. Creating country databases could be something to add for a future release.

zoemaisel commented 6 years ago

@monroews We checked; both Python and Mathcad are using the same drill series.

monroews commented 6 years ago

What is the Number of orifices per row for each of the designs? Perhaps there is a difference in the logic used to get the number of orifices in each row. Perhaps the real question is how close is the flow to the theoretical value for each design. If the flow is close (5%), then perhaps the change in logic is okay.

Monroe Weber-Shirk

AguaClara http://aguaclara.cornell.edu/ at Cornell Civil and Environmental Engineering http://www.cee.cornell.edu/ Cornell University http://www.cornell.edu/ Hollister Hall 265 (607) 216-8445 http://aguaclara.cornell.edu/

On Mon, Mar 5, 2018 at 3:00 PM, Zoe Maisel notifications@github.com wrote:

@monroews https://github.com/monroews We checked; both Python and Mathcad are using the same drill series.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/AguaClara/aide_design/issues/33#issuecomment-370544073, or mute the thread https://github.com/notifications/unsubscribe-auth/AbN_6zdtF_oQWPJr9ut575XZETeOfv1cks5tbZisgaJpZM4SXXNb .

fletchapin commented 6 years ago

We have added modifying this function to future work since the error is relatively small. This will also be tested more thoroughly once the workflow between Design, Template, and Draw is more fine-tuned.