Fluids functions.
More...
|
file | fluids.h |
| API header file for fluids in zscilib.
|
|
|
int | zsl_phy_fluid_dens (zsl_real_t m, zsl_real_t v, zsl_real_t *d) |
| Calculates the density of a material based on its mass and volume. More...
|
|
int | zsl_phy_fluid_simple_press (zsl_real_t f, zsl_real_t a, zsl_real_t *p) |
| Calculates the pressure in pascals based on a force (f) against a surface (a). More...
|
|
int | zsl_phy_fluid_press (zsl_real_t p0, zsl_real_t h, zsl_real_t d, zsl_real_t *p) |
| Calculates pressure in pascals of a body submerged 'h' meters down the surface of a fluid, given the pressure of the fluid at its surface and its density. More...
|
|
int | zsl_phy_fluid_bouyant_force (zsl_real_t v, zsl_real_t d, zsl_real_t *f) |
| Calculates the module of the upwards force experienced by a body submerged into a fluid, AKA bouyant force. More...
|
|
int | zsl_phy_fluid_flow_rate (zsl_real_t a1, zsl_real_t v1, zsl_real_t a2, zsl_real_t *v2) |
| Given two sections of a pipe with different surfaces 'a1' and 'a2' and knowing the value of the velocity of the fluid when passing through 'a1', this function calculates the velocity of the fluid in 'a2'. More...
|
|
int | zsl_phy_fluid_force_prop (zsl_real_t a1, zsl_real_t f1, zsl_real_t a2, zsl_real_t *f2) |
| Given two sections of a pipe with different surfaces 'a1' and 'a2' and knowing the value of the force with which the fluid goes through 'a1', this function calculates the force with which the fluid goes through 'a2'. More...
|
|
int | zsl_phy_fluid_bernoulli (zsl_real_t d, zsl_real_t v1, zsl_real_t p1, zsl_real_t v2, zsl_real_t *p2) |
| Given a pipe in which a fluid flows at different velocities 'v1' and 'v2' in two different sections and knowing the pressure of the fluid in the first section (p1), this function calculates the pressure of fluid in the second section. More...
|
|
int | zsl_phy_fluid_volume_flow_rate (zsl_real_t vel, zsl_real_t a, zsl_real_t *v) |
| Calculates the volume flow rate of a flowing fluid based on its velocity (vel) in a section of surface (a). More...
|
|
Fluids functions.
◆ zsl_phy_fluid_bernoulli()
Given a pipe in which a fluid flows at different velocities 'v1' and 'v2' in two different sections and knowing the pressure of the fluid in the first section (p1), this function calculates the pressure of fluid in the second section.
- Parameters
-
d | Density of the fluid in kilograms per meter cubed. |
v1 | Velocity in the first section in meters per second. |
p1 | Pressure in the first section in kilopascals. |
v2 | Velocity in the second section in meters per second. |
p2 | Pointer to the output pressure in kilopascals. Will be set to NAN ifany of the input values is negative. |
- Returns
- 0 if everything executed properly, error code on failure.
◆ zsl_phy_fluid_bouyant_force()
Calculates the module of the upwards force experienced by a body submerged into a fluid, AKA bouyant force.
- Parameters
-
v | Volume of the submerged body in meters cubed. |
d | Density of the fluid in kilograms per meter cubed. |
f | Pointer to the output bouyant force in kilonewtons. Will be set to NAN if any of the input values is negative. |
- Returns
- 0 if everything executed properly, error code on failure.
◆ zsl_phy_fluid_dens()
Calculates the density of a material based on its mass and volume.
- Parameters
-
m | Mass of the material in kilograms. |
v | Volume of the body in meters cubed. |
d | Pointer to the output density in kilograms per meter cubed. Will be set to NAN if any of the input values is negative. |
- Returns
- 0 if everything executed properly, error code on failure.
◆ zsl_phy_fluid_flow_rate()
Given two sections of a pipe with different surfaces 'a1' and 'a2' and knowing the value of the velocity of the fluid when passing through 'a1', this function calculates the velocity of the fluid in 'a2'.
- Parameters
-
a1 | Area of the first section of the pipe in meters squared. |
v1 | Velocity of the fluid in 'a1' in meters per second. |
a2 | Area of the second section of the pipe in meters squared. |
v2 | Pointer to the output velocity in meters per second. Will be set to NAN if any of the input values is negative or if a2 = 0. |
- Returns
- 0 if everything executed properly, error code on failure.
◆ zsl_phy_fluid_force_prop()
Given two sections of a pipe with different surfaces 'a1' and 'a2' and knowing the value of the force with which the fluid goes through 'a1', this function calculates the force with which the fluid goes through 'a2'.
- Parameters
-
a1 | Area of the first section of the pipe in meters squared. |
f1 | The force with which the fluid goes through 'a1' in newtons. |
a2 | Area of the second section of the pipe in meters squared. |
f2 | Pointer to the output force in newtons. Will be set to NAN if any of the input values is negative or if a1 = 0. |
- Returns
- 0 if everything executed properly, error code on failure.
◆ zsl_phy_fluid_press()
Calculates pressure in pascals of a body submerged 'h' meters down the surface of a fluid, given the pressure of the fluid at its surface and its density.
- Parameters
-
p0 | Pressure on the surface of the fluid in kilopascals. |
h | Distance to the surface of the fluid in meters. |
d | Density of the fluid in kilograms per meter cubed. |
p | Pointer to the output pressure in kilopascals. Will be set to NAN if any of the input values is negative. |
- Returns
- 0 if everything executed properly, error code on failure.
◆ zsl_phy_fluid_simple_press()
Calculates the pressure in pascals based on a force (f) against a surface (a).
- Parameters
-
f | Force in newtons. |
a | Area in meters squared. |
p | Pointer to the output pressure in pascals. Will be set to NAN if any of the input values is negative or if a = 0. |
- Returns
- 0 if everything executed properly, error code on failure.
◆ zsl_phy_fluid_volume_flow_rate()
Calculates the volume flow rate of a flowing fluid based on its velocity (vel) in a section of surface (a).
- Parameters
-
vel | Velocity of the fluid in meters per second. |
a | Area of the section in meters squared. |
v | Pointer to the output volume flow rate in meters cubed per second. Will be set to NAN if any of the input values is negative. |
- Returns
- 0 if everything executed properly, error code on failure.