fonsim.fluid package
Submodules
fonsim.fluid.fallback module
Tool to easily select the most appropriate fallback fluid
2020, September 10
- fonsim.fluid.fallback.get_fluid(fluid, fluids_desired)[source]
- Parameters
fluid – Fluid instance
fluids_desired – Ordered iterable (e.g. list, tuple) of Fluid types
- Returns
Fluid instance
- fonsim.fluid.fallback.select_fallback(fluid, fluids_desired)[source]
Return given fluid if its type is in fluids_desired. Otherwise, from all its fallback fluids return the fluid that is first in fluids_desired.
Note: returns tuple
- Parameters
fluid – fluid object
fluids_desired – ordered iterable (e.g. list, tuple) of fluid types
- Returns
(fluid object, index of type of fluid object in fluids_desired)
fonsim.fluid.fluid module
Fluid classes for keeping fluid properties
Currently supported types:
IdealIncompressible
newtonian
IdealCompressible
newtonian, ideal gas
Types in progress:
Bingham - example of a non-newtonian one
2019, September 7
- class fonsim.fluid.fluid.Bingham(name, rho, mu_p, tau_y, fallbacks=None)[source]
Bases:
object
Note: in progress!
- Parameters
name – name of fluid
rho – density [kg/m**3]
mu_p – plastic viscosity [Pa s] (sometimes called Poise, [P])
tau_y – yield point (YP) (yield shear stress) [Pa]
fallback – fallback fluid
- class fonsim.fluid.fluid.Fluid(name)[source]
Bases:
object
- Parameters
name – name of fluid
- select_object_by_fluid(object_by_fluids_compatible)[source]
Rely on fluid fallback functionality.
Note: select_fallback expects an ordered iterable by making it a list the dict fluids_desired becomes ordered, yet a dict has no order of it keys. The made order is thus not the same as the one defined in the components.
Solution: use OrderedDict in the component definition, those remember the order of the keys like they were defined.
The function does not crash when giving a standard Dict, but it won’t be able to respect the order.
- Parameters
object_by_fluids_compatible – OrderedDict with (type(fluid), object) pairs
- Returns
object