Magnetics functions.
More...
|
file | magnetics.h |
| API header file for magnetics in zscilib.
|
|
|
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...
|
|
Magnetics functions.
◆ zsl_phy_magn_flux()
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
-
a | Surface in meters squared. |
b | Module of the magnetic field vector in teslas. |
theta | Angle between the vector normal to the surface and the magnetic field vector in radians. |
fl | Pointer 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()
Calculates the module of the magnetic force in newtons that experiences a charged body moving in a magnetic field.
- Parameters
-
q | Charge of the body in coulombs. |
v | Module of the velocity vector in meters per second. |
b | Module of the magnetic field vector in teslas. |
theta | Angle between the velocity and magnetic field vectors in radians. |
f | Pointer 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()
Calculates the module of the magnetic force in newtons that experiences an electric wire.
- Parameters
-
i | Intensity running through the wire in amperes. |
l | Lenght of the wire in meters. |
b | Module of the magnetic field vector in teslas. |
theta | Angle between the vector parallel to the wire and the magnetic field vector in radians. |
f | Pointer 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()
Calculates the magnetic momentum of a wire loop in amperes and meters squared based on its intensity (i) and surface (a).
- Parameters
-
i | Intensity running through the wire loop in amperes. |
a | Surface of the loop in meters squared. |
mom | Pointer 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()
Calculates the radius of the circular trajectory a charged object descrives when entering a magnetic field.
- Parameters
-
q | Charge of the object in coulombs. |
v | Module of the velocity vector in meters per second. |
b | Module of the magnetic field vector in teslas. |
m | Mas of the object in kilograms. |
r | Pointer 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()
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
-
mom | Module of the magnetic momentum of the dipole in amperes and meters squared. |
b | Module of the magnetic field vector in teslas. |
theta | Angle between the magnetic momentum and the magnetic field vectors in radians. |
u | Pointer 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()
Calculates the torque in newtons and meters that experiences a wire loop with intensity 'i' and area 'a' under a magnetic field 'b'.
- Parameters
-
i | Intensity running through the wire loop in amperes. |
a | Surface of the loop in meters squared. |
b | Module of the magnetic field vector in teslas. |
theta | Angle between the vector normal to the surface of the loop and the magnetic field vector in radians. |
tor | Pointer 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.