Phyth v0.1.0
A dimensional safe C++ header-only mechanics and electromagnetics simulation library.
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
Phyth::Electromagnetics::MagneticDipole Class Reference

Magnetic dipole with full electromagnetic field and dynamics. More...

#include <MagneticDipole.hpp>

Inheritance diagram for Phyth::Electromagnetics::MagneticDipole:
Inheritance graph
[legend]
Collaboration diagram for Phyth::Electromagnetics::MagneticDipole:
Collaboration graph
[legend]

Public Member Functions

 MagneticDipole (const Quantity< Kilogram > mass, const Vector3< Quantity< Meter > > &position, const Vector3< Quantity< AmpereMeterSquared > > &moment, const Quantity< KilogramMeterSquared > &moment_of_inertia=0_kgm2)
 Construct a magnetic dipole.
 
void SetComputeForcesFunction (const std::function< void(MagneticDipole *)> &func) noexcept
 Set the force computation function.
 
Vector3< Quantity< Tesla > > GetMagneticFieldAt (const Vector3< Quantity< Meter > > &point) const override
 Get the magnetic field at a point.
 
Vector3< Quantity< NewtonPerCoulomb > > GetElectricFieldAt (const Vector3< Quantity< Meter > > &point) const override
 Get the electric field at a point.
 
Quantity< Volt > GetElectricPotentialAt (const Vector3< Quantity< Meter > > &point) const override
 Get the electric potential at a point.
 
Quantity< Coulomb > GetTotalChargeValue () const override
 Get the total charge of the dipole.
 
Quantity< Meter > GetMinimumDistanceTo (const Vector3< Quantity< Meter > > &point) const override
 Get the minimum distance from a point to the dipole location.
 
Vector3< Quantity< CoulombMeter > > GetElectricDipoleMoment () const
 
void ApplyMagneticGradientForce (const MagneticSource &field_source)
 Apply force from magnetic field gradient.
 
void ApplyMagneticTorque (const MagneticSource &field_source)
 Apply torque from magnetic field.
 
void ApplyElectricGradientForce (const ChargeSource &field_source)
 Apply force from electric field gradient.
 
void ApplyElectricTorque (const ChargeSource &field_source)
 Apply torque from electric field.
 
void ApplyMagneticForce (const MagneticSource &field_source)
 Apply all magnetic forces (gradient + torque)
 
void ApplyElectricForce (const ChargeSource &field_source)
 Apply all electric forces (gradient + torque)
 
void ApplyElectromagneticForce (const MagneticSource &magnetic_source, const ChargeSource &electric_source)
 Apply both magnetic and electric forces.
 
void ApplyTorque (const Vector3< Quantity< NewtonMeter > > &torque)
 Apply a torque to the dipole.
 
void Integrate () noexcept override
 Integrate dynamics using velocity Verlet.
 
void SetMoment (const Vector3< Quantity< AmpereMeterSquared > > &m)
 Set the magnetic dipole moment.
 
const Vector3< Quantity< AmpereMeterSquared > > & GetMoment () const
 
const Quaternion< Scalar > & GetOrientation () const
 
void SetOrientation (const Quaternion< Scalar > &q)
 Set the orientation quaternion.
 
const Vector3< Quantity< RadianPerSecond > > & GetAngularVelocity () const
 
void SetAngularVelocity (const Vector3< Quantity< RadianPerSecond > > &omega)
 Set the angular velocity.
 
Quantity< KilogramMeterSquared > GetMomentOfInertia () const
 
void SetMomentOfInertia (const Quantity< KilogramMeterSquared > &I)
 Set the moment of inertia.
 
- Public Member Functions inherited from Phyth::Mechanics::Particle
 Particle (const Quantity< Kilogram > &mass, const Vector3< Quantity< Meter > > &position) noexcept
 Construct a particle with mass and initial position.
 
virtual ~Particle ()=default
 
void ApplyForce (const Vector3< Quantity< Newton > > &force)
 Accumulate an external force on the particle.
 
constexpr const auto & GetPosition () const noexcept
 
void SetPosition (const Vector3< Quantity< Meter > > &position) noexcept
 Set the particle position (m)
 
constexpr auto GetMass () const noexcept
 
void SetMass (const Quantity< Kilogram > &mass) noexcept
 Set the particle mass (kg)
 
constexpr const auto & GetVelocity () const noexcept
 
void SetVelocity (const Vector3< Quantity< MeterPerSecond > > &velocity) noexcept
 Set the particle velocity (m/s)
 
constexpr bool IsFixed () const noexcept
 
void SetFixed (const bool fixed) noexcept
 Set whether the particle is fixed (immovable)
 
constexpr const auto & GetExternalForce () const noexcept
 
void SetExternalForce (const Vector3< Quantity< Newton > > &external_force) noexcept
 Manually set the external force (N)
 
void SetComputeForcesFunction (const std::function< void(Particle *)> &func) noexcept
 Set the user-defined force computation function.
 
Quantity< Joule > GetPotentialEnergy (const Quantity< Meter > y_ref=0) const
 Compute gravitational potential energy relative to a reference height.
 
Quantity< Joule > GetKineticEnergy () const noexcept
 Compute kinetic energy.
 
Quantity< Joule > GetTotalEnergy (const Quantity< Meter > y_ref=0) const noexcept
 Compute total mechanical energy.
 
- Public Member Functions inherited from Phyth::Electromagnetics::MagneticSource
virtual ~MagneticSource ()=default
 
- Public Member Functions inherited from Phyth::Electromagnetics::ChargeSource
virtual ~ChargeSource ()=default
 
virtual Quantity< CoulombPerCubicMeter > GetChargeDensityAt (const Vector3< Quantity< Meter > > &point) const
 Get the charge density at a point.
 

Private Member Functions

Vector3< Quantity< CoulombMeter > > GetRelativisticDipoleMomentCurrent () const
 
Vector3< Quantity< Meter > > GetPositionAtOffset (const Quantity< Second > &offset) const
 Get position at a time offset in the past.
 
Vector3< Quantity< MeterPerSecond > > GetVelocityAtOffset (const Quantity< Second > &offset) const
 Get velocity at a time offset in the past.
 
Vector3< Quantity< MeterPerSecondSquared > > GetAccelerationAtOffset (const Quantity< Second > &offset) const
 Get acceleration at a time offset in the past.
 
Vector3< Quantity< AmpereMeterSquared > > GetMomentAtOffset (const Quantity< Second > &offset) const
 Get magnetic moment at a time offset in the past.
 
Vector3< Quantity< CoulombMeter > > GetElectricDipoleAtOffset (const Quantity< Second > &offset) const
 Get electric dipole moment at a time offset in the past.
 
Quantity< Second > SolveRetardedTimeOffset (const Vector3< Quantity< Meter > > &point) const
 Solve for the retarded time offset using Newton's method.
 
Quantity< Second > SolveRetardedTimeOffsetBisection (const Vector3< Quantity< Meter > > &point, Quantity< Second > dt_low, Quantity< Second > dt_high) const
 Solve for the retarded time offset using bisection method.
 
Vector3< decltype(0_Am2/1_s)> ComputeMomentFirstDerivative (const Quantity< Second > &retarded_dt) const
 Compute first time derivative of magnetic moment at retarded time.
 
Vector3< decltype(0_Am2/1_s/1_s)> ComputeMomentSecondDerivative (const Quantity< Second > &retarded_dt) const
 Compute second time derivative of magnetic moment at retarded time.
 
Vector3< decltype(1_Cm/1_s)> ComputeElectricDipoleFirstDerivative (const Quantity< Second > &retarded_dt) const
 Compute first time derivative of electric dipole moment at retarded time.
 
Vector3< decltype(1_Cm/1_s/1_s)> ComputeElectricDipoleSecondDerivative (const Quantity< Second > &retarded_dt) const
 Compute second time derivative of electric dipole moment at retarded time.
 
Vector3< decltype(1_mps2/1_s)> ComputeAccelerationFirstDerivative (const Quantity< Second > &retarded_dt) const
 Compute first time derivative of acceleration at retarded time.
 
Vector3< Quantity< Newton > > ComputeMagneticGradientForce (const MagneticSource &field_source) const
 Compute magnetic gradient force using finite differences.
 
Vector3< Quantity< Newton > > ComputeElectricGradientForce (const ChargeSource &field_source) const
 Compute electric gradient force using finite differences.
 

Static Private Member Functions

static Vector3< Quantity< CoulombMeter > > ComputeRelativisticDipoleMoment (const Vector3< Quantity< MeterPerSecond > > &v, const Vector3< Quantity< AmpereMeterSquared > > &m)
 Compute the relativistic electric dipole moment.
 

Private Attributes

Vector3< Quantity< AmpereMeterSquared > > moment_
 
Vector3< Quantity< AmpereMeterSquared > > initial_moment_
 
Quantity< KilogramMeterSquared > moment_of_inertia_
 
Quaternion< Scalar > orientation_ {}
 
Vector3< Quantity< RadianPerSecond > > angular_velocity_ {}
 
Vector3< Quantity< NewtonMeter > > external_torque_ {}
 
TimeHistory< Vector3< Quantity< Meter > > > position_history_
 
TimeHistory< Vector3< Quantity< MeterPerSecond > > > velocity_history_
 
TimeHistory< Vector3< Quantity< MeterPerSecondSquared > > > acceleration_history_
 
TimeHistory< Vector3< Quantity< AmpereMeterSquared > > > moment_history_
 
TimeHistory< Vector3< Quantity< CoulombMeter > > > electric_dipole_history_
 

Additional Inherited Members

- Protected Attributes inherited from Phyth::Mechanics::Particle
Quantity< Kilogram > mass_
 
Vector3< Quantity< MeterPerSecond > > velocity_ {}
 
bool fixed_ {false}
 
Vector3< Quantity< Newton > > external_force_ {}
 
Vector3< Quantity< Meter > > position_
 
std::function< void(Particle *)> compute_forces_func_
 

Detailed Description

Magnetic dipole with full electromagnetic field and dynamics.

MagneticDipole represents a moving magnetic dipole that produces both magnetic and electric fields. It inherits from Particle for dynamics, and implements both MagneticSource and ChargeSource interfaces.

The magnetic dipole moment m can rotate (with moment of inertia) and the moving dipole produces a relativistic electric dipole moment p = -(gamma / c^2) * v x m.

Example: auto dipole = std::make_shared<MagneticDipole>( 1.0_kg, Vector3<Quantity<Meter>>(0_m, 0_m, 0_m), Vector3<Quantity<AmpereMeterSquared>>(1.0_Am2, 0_Am2, 0_Am2) );

// Add a magnetic field source dipole->ApplyMagneticForce(magnetic_field);

// In simulation loop: dipole->Integrate();

Note
: The field computation uses retarded potentials. The field diverges at the dipole location.

Definition at line 39 of file MagneticDipole.hpp.

Constructor & Destructor Documentation

◆ MagneticDipole()

Phyth::Electromagnetics::MagneticDipole::MagneticDipole ( const Quantity< Kilogram >  mass,
const Vector3< Quantity< Meter > > &  position,
const Vector3< Quantity< AmpereMeterSquared > > &  moment,
const Quantity< KilogramMeterSquared > &  moment_of_inertia = 0_kgm2 
)
inlineexplicit

Construct a magnetic dipole.

Parameters
massMass of the dipole (kg)
positionInitial position (m)
momentMagnetic dipole moment (A*m^2)
moment_of_inertiaMoment of inertia (kg*m^2), default 0

The dipole moment can rotate if moment_of_inertia > 0. The initial orientation is aligned with the moment vector.

Definition at line 54 of file MagneticDipole.hpp.

Member Function Documentation

◆ ApplyElectricForce()

void Phyth::Electromagnetics::MagneticDipole::ApplyElectricForce ( const ChargeSource &  field_source)
inline

Apply all electric forces (gradient + torque)

Definition at line 336 of file MagneticDipole.hpp.

◆ ApplyElectricGradientForce()

void Phyth::Electromagnetics::MagneticDipole::ApplyElectricGradientForce ( const ChargeSource &  field_source)
inline

Apply force from electric field gradient.

F = grad(p dot E)

Parameters
field_sourceThe electric field source

Definition at line 310 of file MagneticDipole.hpp.

◆ ApplyElectricTorque()

void Phyth::Electromagnetics::MagneticDipole::ApplyElectricTorque ( const ChargeSource &  field_source)
inline

Apply torque from electric field.

tau = p x E

Parameters
field_sourceThe electric field source

Definition at line 322 of file MagneticDipole.hpp.

◆ ApplyElectromagneticForce()

void Phyth::Electromagnetics::MagneticDipole::ApplyElectromagneticForce ( const MagneticSource &  magnetic_source,
const ChargeSource &  electric_source 
)
inline

Apply both magnetic and electric forces.

Parameters
magnetic_sourceThe magnetic field source
electric_sourceThe electric field source

Definition at line 347 of file MagneticDipole.hpp.

◆ ApplyMagneticForce()

void Phyth::Electromagnetics::MagneticDipole::ApplyMagneticForce ( const MagneticSource &  field_source)
inline

Apply all magnetic forces (gradient + torque)

Definition at line 330 of file MagneticDipole.hpp.

◆ ApplyMagneticGradientForce()

void Phyth::Electromagnetics::MagneticDipole::ApplyMagneticGradientForce ( const MagneticSource &  field_source)
inline

Apply force from magnetic field gradient.

F = grad(m dot B)

Parameters
field_sourceThe magnetic field source

Definition at line 285 of file MagneticDipole.hpp.

◆ ApplyMagneticTorque()

void Phyth::Electromagnetics::MagneticDipole::ApplyMagneticTorque ( const MagneticSource &  field_source)
inline

Apply torque from magnetic field.

tau = m x B

Parameters
field_sourceThe magnetic field source

Definition at line 297 of file MagneticDipole.hpp.

◆ ApplyTorque()

void Phyth::Electromagnetics::MagneticDipole::ApplyTorque ( const Vector3< Quantity< NewtonMeter > > &  torque)
inline

Apply a torque to the dipole.

Parameters
torqueTorque vector (N*m)

The torque affects the dipole's orientation if moment_of_inertia > 0.

Definition at line 360 of file MagneticDipole.hpp.

◆ ComputeAccelerationFirstDerivative()

Vector3< decltype(1_mps2/1_s)> Phyth::Electromagnetics::MagneticDipole::ComputeAccelerationFirstDerivative ( const Quantity< Second > &  retarded_dt) const
inlineprivate

Compute first time derivative of acceleration at retarded time.

Definition at line 734 of file MagneticDipole.hpp.

◆ ComputeElectricDipoleFirstDerivative()

Vector3< decltype(1_Cm/1_s)> Phyth::Electromagnetics::MagneticDipole::ComputeElectricDipoleFirstDerivative ( const Quantity< Second > &  retarded_dt) const
inlineprivate

Compute first time derivative of electric dipole moment at retarded time.

Definition at line 681 of file MagneticDipole.hpp.

◆ ComputeElectricDipoleSecondDerivative()

Vector3< decltype(1_Cm/1_s/1_s)> Phyth::Electromagnetics::MagneticDipole::ComputeElectricDipoleSecondDerivative ( const Quantity< Second > &  retarded_dt) const
inlineprivate

Compute second time derivative of electric dipole moment at retarded time.

Definition at line 706 of file MagneticDipole.hpp.

◆ ComputeElectricGradientForce()

Vector3< Quantity< Newton > > Phyth::Electromagnetics::MagneticDipole::ComputeElectricGradientForce ( const ChargeSource &  field_source) const
inlineprivate

Compute electric gradient force using finite differences.

F = grad(p dot E)

Uses central differences with step epsilon_m.

Definition at line 804 of file MagneticDipole.hpp.

◆ ComputeMagneticGradientForce()

Vector3< Quantity< Newton > > Phyth::Electromagnetics::MagneticDipole::ComputeMagneticGradientForce ( const MagneticSource &  field_source) const
inlineprivate

Compute magnetic gradient force using finite differences.

F = grad(m dot B)

Uses central differences with step epsilon_m.

Definition at line 763 of file MagneticDipole.hpp.

◆ ComputeMomentFirstDerivative()

Vector3< decltype(0_Am2/1_s)> Phyth::Electromagnetics::MagneticDipole::ComputeMomentFirstDerivative ( const Quantity< Second > &  retarded_dt) const
inlineprivate

Compute first time derivative of magnetic moment at retarded time.

Definition at line 628 of file MagneticDipole.hpp.

◆ ComputeMomentSecondDerivative()

Vector3< decltype(0_Am2/1_s/1_s)> Phyth::Electromagnetics::MagneticDipole::ComputeMomentSecondDerivative ( const Quantity< Second > &  retarded_dt) const
inlineprivate

Compute second time derivative of magnetic moment at retarded time.

Definition at line 653 of file MagneticDipole.hpp.

◆ ComputeRelativisticDipoleMoment()

static Vector3< Quantity< CoulombMeter > > Phyth::Electromagnetics::MagneticDipole::ComputeRelativisticDipoleMoment ( const Vector3< Quantity< MeterPerSecond > > &  v,
const Vector3< Quantity< AmpereMeterSquared > > &  m 
)
inlinestaticprivate

Compute the relativistic electric dipole moment.

p = -(gamma / c^2) * v x m gamma = 1 / sqrt(1 - (v/c)^2)

For v near c, uses the ultra-relativistic limit: p = -v x m / c^2

Definition at line 481 of file MagneticDipole.hpp.

◆ GetAccelerationAtOffset()

Vector3< Quantity< MeterPerSecondSquared > > Phyth::Electromagnetics::MagneticDipole::GetAccelerationAtOffset ( const Quantity< Second > &  offset) const
inlineprivate

Get acceleration at a time offset in the past.

Definition at line 516 of file MagneticDipole.hpp.

◆ GetAngularVelocity()

const Vector3< Quantity< RadianPerSecond > > & Phyth::Electromagnetics::MagneticDipole::GetAngularVelocity ( ) const
inline
Returns
Current angular velocity (rad/s)

Definition at line 436 of file MagneticDipole.hpp.

◆ GetElectricDipoleAtOffset()

Vector3< Quantity< CoulombMeter > > Phyth::Electromagnetics::MagneticDipole::GetElectricDipoleAtOffset ( const Quantity< Second > &  offset) const
inlineprivate

Get electric dipole moment at a time offset in the past.

Definition at line 530 of file MagneticDipole.hpp.

◆ GetElectricDipoleMoment()

Vector3< Quantity< CoulombMeter > > Phyth::Electromagnetics::MagneticDipole::GetElectricDipoleMoment ( ) const
inline
Returns
The electric dipole moment p = -(gamma/c^2) * v x m (C*m)

Definition at line 274 of file MagneticDipole.hpp.

◆ GetElectricFieldAt()

Vector3< Quantity< NewtonPerCoulomb > > Phyth::Electromagnetics::MagneticDipole::GetElectricFieldAt ( const Vector3< Quantity< Meter > > &  point) const
inlineoverridevirtual

Get the electric field at a point.

For stationary dipoles, uses the static electric dipole formula: E = k_E * (3 * (p dot hat_r) * hat_r - p) / r^3 where p is the relativistic electric dipole moment.

For moving dipoles, uses retarded potentials with contributions from the electric dipole moment and its time derivatives.

Parameters
pointPosition to evaluate the field (meters)
Returns
Electric field intensity E (N/C)
Exceptions
std::runtime_errorIf point is at the dipole location

Implements Phyth::Electromagnetics::ChargeSource.

Definition at line 159 of file MagneticDipole.hpp.

◆ GetElectricPotentialAt()

Quantity< Volt > Phyth::Electromagnetics::MagneticDipole::GetElectricPotentialAt ( const Vector3< Quantity< Meter > > &  point) const
inlineoverridevirtual

Get the electric potential at a point.

For stationary dipoles, returns 0 (electric dipole potential is zero in the static limit).

For moving dipoles, uses the retarded potential: V = k_E * (p dot hat_R) / (R^2 * (1 - hat_R dot beta))

Parameters
pointPosition to evaluate the potential (meters)
Returns
Electric potential V (Volts)
Exceptions
std::runtime_errorIf point is at the dipole location or the denominator factor approaches zero

Implements Phyth::Electromagnetics::ChargeSource.

Definition at line 219 of file MagneticDipole.hpp.

◆ GetMagneticFieldAt()

Vector3< Quantity< Tesla > > Phyth::Electromagnetics::MagneticDipole::GetMagneticFieldAt ( const Vector3< Quantity< Meter > > &  point) const
inlineoverridevirtual

Get the magnetic field at a point.

For stationary or slowly moving dipoles, uses the static dipole formula: B = (mu_0 / (4 * pi)) * (3 * (m dot hat_r) * hat_r - m) / r^3

For moving dipoles, uses retarded potentials with contributions from the dipole moment and its time derivatives.

Parameters
pointPosition to evaluate the field (meters)
Returns
Magnetic flux density B (Tesla)
Exceptions
std::runtime_errorIf point is at the dipole location

Implements Phyth::Electromagnetics::MagneticSource.

Definition at line 101 of file MagneticDipole.hpp.

◆ GetMinimumDistanceTo()

Quantity< Meter > Phyth::Electromagnetics::MagneticDipole::GetMinimumDistanceTo ( const Vector3< Quantity< Meter > > &  point) const
inlineoverridevirtual

Get the minimum distance from a point to the dipole location.

Parameters
pointPosition to compute distance from
Returns
Distance to the dipole location (meters)

Implements Phyth::Electromagnetics::ChargeSource.

Definition at line 268 of file MagneticDipole.hpp.

◆ GetMoment()

const Vector3< Quantity< AmpereMeterSquared > > & Phyth::Electromagnetics::MagneticDipole::GetMoment ( ) const
inline
Returns
Current magnetic dipole moment (A*m^2)

Definition at line 414 of file MagneticDipole.hpp.

◆ GetMomentAtOffset()

Vector3< Quantity< AmpereMeterSquared > > Phyth::Electromagnetics::MagneticDipole::GetMomentAtOffset ( const Quantity< Second > &  offset) const
inlineprivate

Get magnetic moment at a time offset in the past.

Definition at line 523 of file MagneticDipole.hpp.

◆ GetMomentOfInertia()

Quantity< KilogramMeterSquared > Phyth::Electromagnetics::MagneticDipole::GetMomentOfInertia ( ) const
inline
Returns
Moment of inertia (kg*m^2)

Definition at line 446 of file MagneticDipole.hpp.

◆ GetOrientation()

const Quaternion< Scalar > & Phyth::Electromagnetics::MagneticDipole::GetOrientation ( ) const
inline
Returns
Current orientation quaternion

Definition at line 419 of file MagneticDipole.hpp.

◆ GetPositionAtOffset()

Vector3< Quantity< Meter > > Phyth::Electromagnetics::MagneticDipole::GetPositionAtOffset ( const Quantity< Second > &  offset) const
inlineprivate

Get position at a time offset in the past.

Definition at line 502 of file MagneticDipole.hpp.

◆ GetRelativisticDipoleMomentCurrent()

Vector3< Quantity< CoulombMeter > > Phyth::Electromagnetics::MagneticDipole::GetRelativisticDipoleMomentCurrent ( ) const
inlineprivate
Returns
Current relativistic electric dipole moment

Definition at line 496 of file MagneticDipole.hpp.

◆ GetTotalChargeValue()

Quantity< Coulomb > Phyth::Electromagnetics::MagneticDipole::GetTotalChargeValue ( ) const
inlineoverridevirtual

Get the total charge of the dipole.

Returns
0_C (a magnetic dipole has zero net charge)

Implements Phyth::Electromagnetics::ChargeSource.

Definition at line 257 of file MagneticDipole.hpp.

◆ GetVelocityAtOffset()

Vector3< Quantity< MeterPerSecond > > Phyth::Electromagnetics::MagneticDipole::GetVelocityAtOffset ( const Quantity< Second > &  offset) const
inlineprivate

Get velocity at a time offset in the past.

Definition at line 509 of file MagneticDipole.hpp.

◆ Integrate()

void Phyth::Electromagnetics::MagneticDipole::Integrate ( )
inlineoverridevirtualnoexcept

Integrate dynamics using velocity Verlet.

Overrides Particle::Integrate to also update dipole orientation, moment, and history buffers.

Reimplemented from Phyth::Mechanics::Particle.

Definition at line 370 of file MagneticDipole.hpp.

◆ SetAngularVelocity()

void Phyth::Electromagnetics::MagneticDipole::SetAngularVelocity ( const Vector3< Quantity< RadianPerSecond > > &  omega)
inline

Set the angular velocity.

Definition at line 441 of file MagneticDipole.hpp.

◆ SetComputeForcesFunction()

void Phyth::Electromagnetics::MagneticDipole::SetComputeForcesFunction ( const std::function< void(MagneticDipole *)> &  func)
inlinenoexcept

Set the force computation function.

Parameters
funcFunction that applies forces to the dipole via ApplyForce()

This wraps the Particle::SetComputeForcesFunction to accept MagneticDipole pointers directly.

Definition at line 80 of file MagneticDipole.hpp.

◆ SetMoment()

void Phyth::Electromagnetics::MagneticDipole::SetMoment ( const Vector3< Quantity< AmpereMeterSquared > > &  m)
inline

Set the magnetic dipole moment.

Parameters
mNew magnetic dipole moment (A*m^2)

The initial moment is updated and the current moment is aligned with the current orientation.

Definition at line 408 of file MagneticDipole.hpp.

◆ SetMomentOfInertia()

void Phyth::Electromagnetics::MagneticDipole::SetMomentOfInertia ( const Quantity< KilogramMeterSquared > &  I)
inline

Set the moment of inertia.

Definition at line 451 of file MagneticDipole.hpp.

◆ SetOrientation()

void Phyth::Electromagnetics::MagneticDipole::SetOrientation ( const Quaternion< Scalar > &  q)
inline

Set the orientation quaternion.

Parameters
qThe new orientation (will be normalized)

The magnetic moment is updated to align with the new orientation.

Definition at line 430 of file MagneticDipole.hpp.

◆ SolveRetardedTimeOffset()

Quantity< Second > Phyth::Electromagnetics::MagneticDipole::SolveRetardedTimeOffset ( const Vector3< Quantity< Meter > > &  point) const
inlineprivate

Solve for the retarded time offset using Newton's method.

Solves R(t_ret) = c * (t - t_ret) for t_ret. Falls back to bisection if Newton fails.

Definition at line 542 of file MagneticDipole.hpp.

◆ SolveRetardedTimeOffsetBisection()

Quantity< Second > Phyth::Electromagnetics::MagneticDipole::SolveRetardedTimeOffsetBisection ( const Vector3< Quantity< Meter > > &  point,
Quantity< Second >  dt_low,
Quantity< Second >  dt_high 
) const
inlineprivate

Solve for the retarded time offset using bisection method.

Fallback when Newton's method fails to converge.

Definition at line 588 of file MagneticDipole.hpp.

Member Data Documentation

◆ acceleration_history_

TimeHistory<Vector3<Quantity<MeterPerSecondSquared> > > Phyth::Electromagnetics::MagneticDipole::acceleration_history_
private

Definition at line 466 of file MagneticDipole.hpp.

◆ angular_velocity_

Vector3<Quantity<RadianPerSecond> > Phyth::Electromagnetics::MagneticDipole::angular_velocity_ {}
private

Definition at line 461 of file MagneticDipole.hpp.

◆ electric_dipole_history_

TimeHistory<Vector3<Quantity<CoulombMeter> > > Phyth::Electromagnetics::MagneticDipole::electric_dipole_history_
private

Definition at line 469 of file MagneticDipole.hpp.

◆ external_torque_

Vector3<Quantity<NewtonMeter> > Phyth::Electromagnetics::MagneticDipole::external_torque_ {}
private

Definition at line 462 of file MagneticDipole.hpp.

◆ initial_moment_

Vector3<Quantity<AmpereMeterSquared> > Phyth::Electromagnetics::MagneticDipole::initial_moment_
private

Definition at line 457 of file MagneticDipole.hpp.

◆ moment_

Vector3<Quantity<AmpereMeterSquared> > Phyth::Electromagnetics::MagneticDipole::moment_
private

Definition at line 456 of file MagneticDipole.hpp.

◆ moment_history_

TimeHistory<Vector3<Quantity<AmpereMeterSquared> > > Phyth::Electromagnetics::MagneticDipole::moment_history_
private

Definition at line 467 of file MagneticDipole.hpp.

◆ moment_of_inertia_

Quantity<KilogramMeterSquared> Phyth::Electromagnetics::MagneticDipole::moment_of_inertia_
private

Definition at line 459 of file MagneticDipole.hpp.

◆ orientation_

Quaternion<Scalar> Phyth::Electromagnetics::MagneticDipole::orientation_ {}
private

Definition at line 460 of file MagneticDipole.hpp.

◆ position_history_

TimeHistory<Vector3<Quantity<Meter> > > Phyth::Electromagnetics::MagneticDipole::position_history_
private

Definition at line 464 of file MagneticDipole.hpp.

◆ velocity_history_

TimeHistory<Vector3<Quantity<MeterPerSecond> > > Phyth::Electromagnetics::MagneticDipole::velocity_history_
private

Definition at line 465 of file MagneticDipole.hpp.


The documentation for this class was generated from the following file: