Zephyr Scientific Library (zscilib)
Files | Functions
Magnetics

Magnetics functions. More...

Files

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

Functions

int zsl_phy_magn_force (zsl_real_t q, zsl_real_t v, zsl_real_t b, zsl_real_t theta, zsl_real_t *f)
 Calculates the module of the magnetic force in newtons that experiences a charged body moving in a magnetic field. More...
 
int zsl_phy_magn_force_wire (zsl_real_t i, zsl_real_t l, zsl_real_t b, zsl_real_t theta, zsl_real_t *f)
 Calculates the module of the magnetic force in newtons that experiences an electric wire. More...
 
int zsl_phy_magn_torque_loop (zsl_real_t i, zsl_real_t a, zsl_real_t b, zsl_real_t theta, zsl_real_t *tor)
 Calculates the torque in newtons and meters that experiences a wire loop with intensity 'i' and area 'a' under a magnetic field 'b'. More...
 
int zsl_phy_magn_pot_dipole (zsl_real_t mom, zsl_real_t b, zsl_real_t theta, zsl_real_t *u)
 Calculates the potential energy in joules of a magnetic dipole with magnetic momentum 'mom' under a magnetic field 'b' that has been rotated an angle 'theta' from its resting position. More...
 
int zsl_phy_magn_orb_radius (zsl_real_t q, zsl_real_t v, zsl_real_t b, zsl_real_t m, zsl_real_t *r)
 Calculates the radius of the circular trajectory a charged object descrives when entering a magnetic field. More...
 
int zsl_phy_magn_flux (zsl_real_t a, zsl_real_t b, zsl_real_t theta, zsl_real_t *fl)
 Calculates the magnetic flux in webers that flows across a surface based on the area (a), the magnetic field (b) and the angle they form. More...
 
int zsl_phy_magn_mom (zsl_real_t i, zsl_real_t a, zsl_real_t *mom)
 Calculates the magnetic momentum of a wire loop in amperes and meters squared based on its intensity (i) and surface (a). More...
 

Detailed Description

Magnetics functions.

Function Documentation

◆ zsl_phy_magn_flux()

int zsl_phy_magn_flux ( zsl_real_t  a,
zsl_real_t  b,
zsl_real_t  theta,
zsl_real_t fl 
)

Calculates the magnetic flux in webers that flows across a surface based on the area (a), the magnetic field (b) and the angle they form.

Parameters
aSurface in meters squared.
bModule of the magnetic field vector in teslas.
thetaAngle between the vector normal to the surface and the magnetic field vector in radians.
flPointer to the output magnetic flux in webers. Will be set to NAN if either the area or the magnetic field are negative values.
Returns
0 if everything executed properly, error code on failure.

◆ zsl_phy_magn_force()

int zsl_phy_magn_force ( zsl_real_t  q,
zsl_real_t  v,
zsl_real_t  b,
zsl_real_t  theta,
zsl_real_t f 
)

Calculates the module of the magnetic force in newtons that experiences a charged body moving in a magnetic field.

Parameters
qCharge of the body in coulombs.
vModule of the velocity vector in meters per second.
bModule of the magnetic field vector in teslas.
thetaAngle between the velocity and magnetic field vectors in radians.
fPointer to the output magnetic force in newtons. Will be set to NAN if either the velocity or the magnetic field are negative values.
Returns
0 if everything executed properly, error code on failure.

◆ zsl_phy_magn_force_wire()

int zsl_phy_magn_force_wire ( zsl_real_t  i,
zsl_real_t  l,
zsl_real_t  b,
zsl_real_t  theta,
zsl_real_t f 
)

Calculates the module of the magnetic force in newtons that experiences an electric wire.

Parameters
iIntensity running through the wire in amperes.
lLenght of the wire in meters.
bModule of the magnetic field vector in teslas.
thetaAngle between the vector parallel to the wire and the magnetic field vector in radians.
fPointer to the output magnetic force in newtons. Will be set to NAN if either the length or the magnetic field are negative values.
Returns
0 if everything executed properly, error code on failure.

◆ zsl_phy_magn_mom()

int zsl_phy_magn_mom ( zsl_real_t  i,
zsl_real_t  a,
zsl_real_t mom 
)

Calculates the magnetic momentum of a wire loop in amperes and meters squared based on its intensity (i) and surface (a).

Parameters
iIntensity running through the wire loop in amperes.
aSurface of the loop in meters squared.
momPointer to the output magnetic momentum in amperes and meters squared. Will be set to NAN if the area is negative.
Returns
0 if everything executed properly, error code on failure.

◆ zsl_phy_magn_orb_radius()

int zsl_phy_magn_orb_radius ( zsl_real_t  q,
zsl_real_t  v,
zsl_real_t  b,
zsl_real_t  m,
zsl_real_t r 
)

Calculates the radius of the circular trajectory a charged object descrives when entering a magnetic field.

Parameters
qCharge of the object in coulombs.
vModule of the velocity vector in meters per second.
bModule of the magnetic field vector in teslas.
mMas of the object in kilograms.
rPointer to the output radius in meters. Will be set to NAN if either the mass or the radius itself are negative values, or if the charge or the magnetic field are zero.
Returns
0 if everything executed properly, error code on failure.

◆ zsl_phy_magn_pot_dipole()

int zsl_phy_magn_pot_dipole ( zsl_real_t  mom,
zsl_real_t  b,
zsl_real_t  theta,
zsl_real_t u 
)

Calculates the potential energy in joules of a magnetic dipole with magnetic momentum 'mom' under a magnetic field 'b' that has been rotated an angle 'theta' from its resting position.

Parameters
momModule of the magnetic momentum of the dipole in amperes and meters squared.
bModule of the magnetic field vector in teslas.
thetaAngle between the magnetic momentum and the magnetic field vectors in radians.
uPointer to the output potential energy in joules. Will be set to NAN if either the magnetic momentum or the magnetic field are negative values.
Returns
0 if everything executed properly, error code on failure.

◆ zsl_phy_magn_torque_loop()

int zsl_phy_magn_torque_loop ( zsl_real_t  i,
zsl_real_t  a,
zsl_real_t  b,
zsl_real_t  theta,
zsl_real_t tor 
)

Calculates the torque in newtons and meters that experiences a wire loop with intensity 'i' and area 'a' under a magnetic field 'b'.

Parameters
iIntensity running through the wire loop in amperes.
aSurface of the loop in meters squared.
bModule of the magnetic field vector in teslas.
thetaAngle between the vector normal to the surface of the loop and the magnetic field vector in radians.
torPointer to the output torque in newtons and meters. Will be set to NAN if either the area or the magnetic field are negative values.
Returns
0 if everything executed properly, error code on failure.