CalebBell / fluids

Fluid dynamics component of Chemical Engineering Design Library (ChEDL)
MIT License
350 stars 76 forks source link

C and epsilon mixed up in return from differential_pressure_meter_C_epsilon #27

Closed InvncibiltyCloak closed 5 years ago

InvncibiltyCloak commented 5 years ago

In the differential_pressure_meter_solver function, the return from differential_pressure_meter_C_epsilon is assigned to (epsilon, C) while the return from the function is the same order as the function's title, which is (C, epsilon).

This could lead to large error in the calculated flow rate across the orifice plate. (The error was only 1% in my test case)

InvncibiltyCloak commented 5 years ago

See pull request for fix: #28

InvncibiltyCloak commented 5 years ago

So, there is no error resulting from this bug to this because the two just get multiplied together in the final flow_meter_discharge function. The 1% error I mentioned above must have been from plugging in slightly different numbers.

Still, it would be best to fix this. I was confused when I was stepping through and the solver had different values for epsilon on each iteration, when it should be constant.

CalebBell commented 5 years ago

Hi Mark,

Thank you for the pull request! I appreciate it. A little embarrassing, but I'm extra glad the results for the function was always correct in the end. I can't remember now but I think when I first coded the function differential_pressure_meter_C_epsilon, I might have been returning them in the order (epsilon, C); then I changed it, but didn't change the place calling it. Because all the results were still the same, the unit tests didn't show any errors and I didn't notice.

Nice work! I hope fluids has been helpful for you.

Cheers, Caleb