Zephyr Scientific Library (zscilib)
Files | Functions
Fluids

Fluids functions. More...

Files

file  fluids.h
 API header file for fluids in zscilib.
 

Functions

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...
 

Detailed Description

Fluids functions.

Function Documentation

◆ zsl_phy_fluid_bernoulli()

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.

Parameters
dDensity of the fluid in kilograms per meter cubed.
v1Velocity in the first section in meters per second.
p1Pressure in the first section in kilopascals.
v2Velocity in the second section in meters per second.
p2Pointer 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()

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.

Parameters
vVolume of the submerged body in meters cubed.
dDensity of the fluid in kilograms per meter cubed.
fPointer 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()

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.

Parameters
mMass of the material in kilograms.
vVolume of the body in meters cubed.
dPointer 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()

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'.

Parameters
a1Area of the first section of the pipe in meters squared.
v1Velocity of the fluid in 'a1' in meters per second.
a2Area of the second section of the pipe in meters squared.
v2Pointer 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()

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'.

Parameters
a1Area of the first section of the pipe in meters squared.
f1The force with which the fluid goes through 'a1' in newtons.
a2Area of the second section of the pipe in meters squared.
f2Pointer 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()

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.

Parameters
p0Pressure on the surface of the fluid in kilopascals.
hDistance to the surface of the fluid in meters.
dDensity of the fluid in kilograms per meter cubed.
pPointer 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()

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).

Parameters
fForce in newtons.
aArea in meters squared.
pPointer 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()

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).

Parameters
velVelocity of the fluid in meters per second.
aArea of the section in meters squared.
vPointer 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.