Closed sashahafner closed 1 year ago
No problem at all to use normalized flow. Yes, ssa is the specific surface area of the filter material in m2/m3 total filter volume
I've made these and some other changes in 0f35f5e75e4f91df7f5c5f4c7c628fe5e2e27793 . See demo 5. We can discuss these.
@sashahafner: Not sure how to access the value of Kga estimated by Onda correlation, in order to compare with my own calculation. Must be something really simple...
@afeilberg I just added a demo subdirectory for this: demos/08... You can edit the inputs in demo.py and run the whole script and find the result in Kga_output.txt, or else run the py file contents interactively and check the Kga value in the console:
I was just thinking that this function should be "vectorized" so any of the inputs could have more than one value. I have to think/learn how to do this in Python.
I also added it to the output from tfmod()
so if you run the 07... demo lines in demo.py interactively you can see the value calculated by tfmod()
:
I should have the demos export this and probably some other information to a file.
Note that I had to move the Kga function to the same script as the model function. See here https://github.com/sashahafner/pystupid/issues/3
OK
I found the reason for the high mass transfer coefficients. In the Onda correlations, densities are divided by viscosity in units of kg/(m*sec). Therefore, densities should be provided in kg/m3 to give the correct units of kga and kla. I don't think we are using densities except in the Onda correlations...?
I think that unit is right. But that is what is already used in demo 08:
# Set input values in function call
Kga = Kga_onda(pH = 7, temp = 20, henry = (0.1, 2000.), pKa = 7., pres = 1., ssa = 1084., v_g = 0.03, v_l = 0.003, por_g = 0.28, dens_l = 1000.)
And defined in model:
# dens_l = solution (liquid) density (kg/m3)
Line 132 here https://github.com/AU-BCE-EE/tric-fil-mod/blob/d8c7431904e495c902e12eda9ce224276a536754/mod_funcs.py
Oh!
But now I see dens_l
isn't actually used for viscosity conversion in the Onda function.
Instead it has rho_l
hard-wired to 1E6 on line 133 here https://github.com/AU-BCE-EE/tric-fil-mod/blob/d8c7431904e495c902e12eda9ce224276a536754/mod_funcs.py.
I'll fix it.
Fixed in 543a5325fa59536b445f5054db1f00fdfae511b4 but have not tested.
Note that air density is also in g/m3. We probably need to change that too right?
Do we want gas density set to air only? Here is an function that could possibly be converted from the biogas package:
> biogas:::gasDens('20O2:80N2')
[1] 0.00128613
> biogas:::gasDens('0.01O2:0.99N2')
[1] 0.001252195
(All g/mL, for common biogas units.) From here https://github.com/sashahafner/biogas/blob/dev/R/gasDens.R
It is for 0C, so would need temperature and pressure correction as in stdVol()
https://github.com/sashahafner/biogas/blob/dev/R/stdVol.R
Almost certainly not worth the effort, but fun to think about.
Fixed in 543a532 but have not tested.
Note that air density is also in g/m3. We probably need to change that too right?
Yes, both should be in kg/m3
Oh! But now I see
dens_l
isn't actually used for viscosity conversion in the Onda function. Instead it hasrho_l
hard-wired to 1E6 on line 133 here https://github.com/AU-BCE-EE/tric-fil-mod/blob/d8c7431904e495c902e12eda9ce224276a536754/mod_funcs.py.I'll fix it.
Yes, we have used both dens_l and rho_l, the latter for the onda calculation. I guess we can just use one of them...
Do we want gas density set to air only? Here is an function that could possibly be converted from the biogas package:
> biogas:::gasDens('20O2:80N2') [1] 0.00128613 > biogas:::gasDens('0.01O2:0.99N2') [1] 0.001252195
(All g/mL, for common biogas units.) From here https://github.com/sashahafner/biogas/blob/dev/R/gasDens.R
It is for 0C, so would need temperature and pressure correction as in
stdVol()
https://github.com/sashahafner/biogas/blob/dev/R/stdVol.RAlmost certainly not worth the effort, but fun to think about.
As a starting point we are focusing on air matrices, but you never know; there could also be other applications for biogas or N2. But it is not urgent to make flexible with respect to gas matrix.
I've tested updated function in demo 08 and get
Kga(onda) = 9.33e-02 sec-1
Does that look correct now @afeilberg?
63f1b78f0c7cbea57d391e862efe2581ff7c5e68
Oh! But now I see
dens_l
isn't actually used for viscosity conversion in the Onda function. Instead it hasrho_l
hard-wired to 1E6 on line 133 here https://github.com/AU-BCE-EE/tric-fil-mod/blob/d8c7431904e495c902e12eda9ce224276a536754/mod_funcs.py. I'll fix it.Yes, we have used both dens_l and rho_l, the latter for the onda calculation. I guess we can just use one of them...
I switched everything to dens_l
because it was the variable name used in the other functions (beyond Onda stuff, it is just used for converting units on Henry's law constant I think).
But let me know if you want to switch dens
to rho
throughout.
Would be fine with me.
@sashahafner Now we get the same with 4 significant digits. Found a few issues in my spreadsheet such as using the same gas constant and the same enthalpy for the Henrys law coefficient. This is great!
Great! I'll close this issue for now then.
Idea is to call Kga_onda function from tfmod function.
Some issues to sort out first: