Skip to content

Commit

Permalink
Moved fpi content over here, as there are too many interdependencies;…
Browse files Browse the repository at this point in the history
… reliced project under MIT license; 0.1.51 release.
  • Loading branch information
CalebBell committed Sep 9, 2016
1 parent a283a5b commit edf84ba
Show file tree
Hide file tree
Showing 29 changed files with 2,328 additions and 898 deletions.
693 changes: 19 additions & 674 deletions LICENSE.txt

Large diffs are not rendered by default.

12 changes: 10 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,24 @@ fluids
.. image:: http://img.shields.io/pypi/v/fluids.svg?style=flat
:target: https://pypi.python.org/pypi/fluids
:alt: Version_status
.. image:: http://img.shields.io/badge/docs-latest-brightgreen.svg?style=flat
:target: https://fluids.readthedocs.io/en/latest/
:alt: Documentation
.. image:: http://img.shields.io/travis/CalebBell/fluids/master.svg?style=flat
:target: https://travis-ci.org/CalebBell/fluids
:alt: Build_status
.. image:: http://img.shields.io/badge/license-GPL3-blue.svg?style=flat
.. image:: http://img.shields.io/badge/license-MIT-blue.svg?style=flat
:target: https://github.com/CalebBell/fluids/blob/master/LICENSE.txt
:alt: license
.. image:: https://img.shields.io/coveralls/CalebBell/fluids.svg
:target: https://coveralls.io/github/CalebBell/fluids
:alt: Coverage

.. image:: https://img.shields.io/pypi/pyversions/fluids.svg
:target: https://pypi.python.org/pypi/fluids
:alt: Supported_versions
.. image:: https://zenodo.org/badge/doi/10.5281/zenodo.59769.svg
:alt: Zendo
:target: http://dx.doi.org/10.5281/zenodo.59769

.. contents::

Expand Down
7 changes: 7 additions & 0 deletions docs/fluids.drag.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
fluids.drag module
==================

.. automodule:: fluids.drag
:members:
:undoc-members:
:show-inheritance:
2 changes: 2 additions & 0 deletions docs/fluids.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Submodules
fluids.compressible
fluids.control_valve
fluids.core
fluids.drag
fluids.filters
fluids.fittings
fluids.friction
Expand All @@ -20,4 +21,5 @@ Submodules
fluids.piping
fluids.pump
fluids.safety_valve
fluids.saltation
fluids.two_phase_voidage
7 changes: 7 additions & 0 deletions docs/fluids.saltation.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
fluids.saltation module
=======================

.. automodule:: fluids.saltation
:members:
:undoc-members:
:show-inheritance:
38 changes: 26 additions & 12 deletions fluids/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,23 @@
'''Chemical Engineering Design Library (ChEDL). Utilities for process modeling.
Copyright (C) 2016, Caleb Bell <Caleb.Andrew.Bell@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.'''
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.'''



Expand All @@ -32,6 +37,10 @@
from . import safety_valve
from . import packed_tower
from . import two_phase_voidage
from . import drag
from . import saltation



from .compressible import *
from .control_valve import *
Expand All @@ -48,11 +57,14 @@
from .safety_valve import *
from .packed_tower import *
from .two_phase_voidage import *
from .drag import *
from .saltation import *


__all__ = ['compressible', 'control_valve', 'core', 'filters', 'fittings',
'friction', 'geometry', 'mixing', 'open_flow', 'packed_bed', 'piping',
'pump', 'safety_valve', 'packed_tower', 'two_phase_voidage']
'pump', 'safety_valve', 'packed_tower', 'two_phase_voidage', 'drag',
'saltation']


__all__.extend(compressible.__all__)
Expand All @@ -70,6 +82,8 @@
__all__.extend(safety_valve.__all__)
__all__.extend(packed_tower.__all__)
__all__.extend(two_phase_voidage.__all__)
__all__.extend(drag.__all__)
__all__.extend(saltation.__all__)


__version__ = '0.1.50'
__version__ = '0.1.51'
29 changes: 17 additions & 12 deletions fluids/compressible.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,23 @@
'''Chemical Engineering Design Library (ChEDL). Utilities for process modeling.
Copyright (C) 2016, Caleb Bell <Caleb.Andrew.Bell@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.'''
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.'''

from __future__ import division
__all__ = ['T_critical_flow', 'P_critical_flow', 'is_critical_flow',
Expand Down
29 changes: 17 additions & 12 deletions fluids/control_valve.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,23 @@
'''Chemical Engineering Design Library (ChEDL). Utilities for process modeling.
Copyright (C) 2016, Caleb Bell <Caleb.Andrew.Bell@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.'''
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.'''

from __future__ import division
from math import log10
Expand Down
81 changes: 59 additions & 22 deletions fluids/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,23 @@
'''Chemical Engineering Design Library (ChEDL). Utilities for process modeling.
Copyright (C) 2016, Caleb Bell <Caleb.Andrew.Bell@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.'''
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.'''

from __future__ import division
from math import sin, exp, pi
Expand All @@ -26,7 +31,7 @@
'Jakob', 'Power_number', 'Drag', 'Capillary', 'Bejan_L', 'Bejan_p', 'Boiling',
'Archimedes', 'Ohnesorge', 'thermal_diffusivity', 'c_ideal_gas',
'relative_roughness', 'nu_mu_converter', 'gravity',
'K_from_f', 'K_from_L_equiv', 'dP_from_K', 'head_from_K', 'head_from_P',
'K_from_f', 'K_from_L_equiv', 'L_equiv_from_K', 'dP_from_K', 'head_from_K', 'head_from_P',
'P_from_head', 'Eotvos']


Expand Down Expand Up @@ -1889,16 +1894,16 @@ def gravity(latitude, H):

### Friction loss conversion functions

def K_from_f(f, L, D):
def K_from_f(fd, L, D):
r'''Calculates loss coefficient, K, for a given section of pipe
at a specified friction factor.
.. math::
K = fL/D
K = f_dL/D
Parameters
----------
f : float
fd : float
friction factor of pipe, []
L : float
Length of pipe, [m]
Expand All @@ -1917,24 +1922,24 @@ def K_from_f(f, L, D):
Examples
--------
>>> K_from_f(f=0.018, L=100., D=.3)
>>> K_from_f(fd=0.018, L=100., D=.3)
6.0
'''
K = f*L/D
K = fd*L/D
return K


def K_from_L_equiv(L_D, f=0.015):
def K_from_L_equiv(L_D, fd=0.015):
r'''Calculates loss coefficient, for a given equivalent length (L/D).
.. math::
K = f \frac{L}{D}
K = f_d \frac{L}{D}
Parameters
----------
L_D : float
Length over diameter, []
f : float, optional
fd : float, optional
Darcy friction factor, [-]
Returns
Expand All @@ -1952,10 +1957,42 @@ def K_from_L_equiv(L_D, f=0.015):
>>> K_from_L_equiv(240.)
3.5999999999999996
'''
K = f*L_D
K = fd*L_D
return K


def L_equiv_from_K(K, fd=0.015):
r'''Calculates equivalent length of pipe (L/D), for a given loss
coefficient.
.. math::
\frac{L}{D} = \frac{K}{f_d}
Parameters
----------
K : float
Loss coefficient, []
fd : float, optional
Darcy friction factor, [-]
Returns
-------
L_D : float
Length over diameter, []
Notes
-----
Assumes a default friction factor for fully turbulent flow in steel pipes.
Examples
--------
>>> L_equiv_from_K(3.6)
240.00000000000003
'''
L_D = K/fd
return L_D


def dP_from_K(K, rho, V):
r'''Calculates pressure drop, for a given loss coefficient,
at a specified density and velocity.
Expand Down
Loading

0 comments on commit edf84ba

Please sign in to comment.