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

Ideal electric dipole with zero net charge. More...

#include <DipoleCharge.hpp>

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

Public Member Functions

 DipoleCharge (const Vector3< Quantity< Meter > > &position, const Vector3< Quantity< CoulombMeter > > &dipole_moment)
 Construct an electric dipole.
 
Vector3< Quantity< NewtonPerCoulomb > > GetElectricFieldAt (const Vector3< Quantity< Meter > > &point) const override
 Compute the electric field of the dipole.
 
Quantity< Volt > GetElectricPotentialAt (const Vector3< Quantity< Meter > > &point) const override
 Compute the electric potential of the dipole.
 
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 > > GetDipoleMoment () const
 
- 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 Attributes

Vector3< Quantity< Meter > > position_
 
Vector3< Quantity< CoulombMeter > > p_
 

Detailed Description

Ideal electric dipole with zero net charge.

DipoleCharge represents an ideal point electric dipole. It has zero net charge (total charge = 0) but produces a non-zero electric field and potential due to the separation of positive and negative charges.

The dipole is defined by its position and dipole moment vector p, which points from the negative to the positive charge.

Example: auto pos = Vector3<Quantity<Meter>>(0_m, 0_m, 0_m); auto p = Vector3<Quantity<CoulombMeter>>(1.0_C*m, 0_C*m, 0_C*m); DipoleCharge dipole(pos, p);

auto point = Vector3<Quantity<Meter>>(1.0_m, 0_m, 0_m); auto E = dipole.GetElectricFieldAt(point); auto V = dipole.GetElectricPotentialAt(point);

Note
: The field diverges at the dipole location. Querying the field at the dipole position throws an exception.

Definition at line 30 of file DipoleCharge.hpp.

Constructor & Destructor Documentation

◆ DipoleCharge()

Phyth::Electromagnetics::DipoleCharge::DipoleCharge ( const Vector3< Quantity< Meter > > &  position,
const Vector3< Quantity< CoulombMeter > > &  dipole_moment 
)
inline

Construct an electric dipole.

Parameters
positionLocation of the dipole (meters)
dipole_momentDipole moment vector p (C*m)

Definition at line 38 of file DipoleCharge.hpp.

Member Function Documentation

◆ GetDipoleMoment()

Vector3< Quantity< CoulombMeter > > Phyth::Electromagnetics::DipoleCharge::GetDipoleMoment ( ) const
inline
Returns
The dipole moment vector p (C*m)

Definition at line 110 of file DipoleCharge.hpp.

◆ GetElectricFieldAt()

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

Compute the electric field of the dipole.

The field at point r (relative to the dipole) is: E = k_E * (3 * (p dot hat_r) * hat_r - p) / r^3

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 55 of file DipoleCharge.hpp.

◆ GetElectricPotentialAt()

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

Compute the electric potential of the dipole.

The potential at point r (relative to the dipole) is: V = k_E * (p dot hat_r) / r^2

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

Implements Phyth::Electromagnetics::ChargeSource.

Definition at line 78 of file DipoleCharge.hpp.

◆ GetMinimumDistanceTo()

Quantity< Meter > Phyth::Electromagnetics::DipoleCharge::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 from the point to the dipole location (meters)

Implements Phyth::Electromagnetics::ChargeSource.

Definition at line 105 of file DipoleCharge.hpp.

◆ GetTotalChargeValue()

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

Get the total charge of the dipole.

Returns
0_C (an ideal dipole has zero net charge)

Implements Phyth::Electromagnetics::ChargeSource.

Definition at line 94 of file DipoleCharge.hpp.

Member Data Documentation

◆ p_

Vector3<Quantity<CoulombMeter> > Phyth::Electromagnetics::DipoleCharge::p_
private

Definition at line 116 of file DipoleCharge.hpp.

◆ position_

Vector3<Quantity<Meter> > Phyth::Electromagnetics::DipoleCharge::position_
private

Definition at line 115 of file DipoleCharge.hpp.


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