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

Abstract base class for all charge distributions. More...

#include <ChargeSource.hpp>

Inheritance diagram for Phyth::Electromagnetics::ChargeSource:
Inheritance graph
[legend]

Public Member Functions

virtual ~ChargeSource ()=default
 
virtual Vector3< Quantity< NewtonPerCoulomb > > GetElectricFieldAt (const Vector3< Quantity< Meter > > &point) const =0
 Compute the electric field at a point.
 
virtual Quantity< Volt > GetElectricPotentialAt (const Vector3< Quantity< Meter > > &point) const =0
 Compute the electric potential at a point.
 
virtual Quantity< Coulomb > GetTotalChargeValue () const =0
 Get the total charge of this source.
 
virtual Quantity< CoulombPerCubicMeter > GetChargeDensityAt (const Vector3< Quantity< Meter > > &point) const
 Get the charge density at a point.
 
virtual Quantity< Meter > GetMinimumDistanceTo (const Vector3< Quantity< Meter > > &point) const =0
 Get the minimum distance from a point to this charge source.
 

Detailed Description

Abstract base class for all charge distributions.

ChargeSource defines the interface for any charge distribution that produces an electric field and potential. Subclasses represent specific geometries such as point charges, line charges, surface charges, volume charges, or dipoles.

The interface provides methods for computing:

Example: class PointCharge : public ChargeSource { // Implements GetElectricFieldAt, GetElectricPotentialAt, // GetTotalChargeValue, GetMinimumDistanceTo };

Definition at line 30 of file ChargeSource.hpp.

Constructor & Destructor Documentation

◆ ~ChargeSource()

virtual Phyth::Electromagnetics::ChargeSource::~ChargeSource ( )
virtualdefault

Member Function Documentation

◆ GetChargeDensityAt()

virtual Quantity< CoulombPerCubicMeter > Phyth::Electromagnetics::ChargeSource::GetChargeDensityAt ( const Vector3< Quantity< Meter > > &  point) const
inlinevirtual

Get the charge density at a point.

Parameters
pointPosition in 3D space (meters)
Returns
Charge density (C/m^3)

The default implementation returns zero for non-distributed sources (point charges, dipoles). Subclasses for distributed sources (line, surface, volume charges) should override this.

Reimplemented in Phyth::Electromagnetics::VolumeCharge.

Definition at line 79 of file ChargeSource.hpp.

◆ GetElectricFieldAt()

virtual Vector3< Quantity< NewtonPerCoulomb > > Phyth::Electromagnetics::ChargeSource::GetElectricFieldAt ( const Vector3< Quantity< Meter > > &  point) const
pure virtual

Compute the electric field at a point.

Parameters
pointPosition in 3D space (meters)
Returns
Electric field intensity E (N/C) as a Vector3

For point charges, this uses Coulomb's law. For distributed charges, this integrates over the source geometry.

Implemented in Phyth::Electromagnetics::DipoleCharge, Phyth::Electromagnetics::LineCharge, Phyth::Electromagnetics::MagneticDipole, Phyth::Electromagnetics::PointCharge, Phyth::Electromagnetics::SurfaceCharge, and Phyth::Electromagnetics::VolumeCharge.

◆ GetElectricPotentialAt()

virtual Quantity< Volt > Phyth::Electromagnetics::ChargeSource::GetElectricPotentialAt ( const Vector3< Quantity< Meter > > &  point) const
pure virtual

Compute the electric potential at a point.

Parameters
pointPosition in 3D space (meters)
Returns
Electric potential V (Volts)

For point charges, this uses V = k * q / r. For distributed charges, this integrates over the source geometry.

Implemented in Phyth::Electromagnetics::DipoleCharge, Phyth::Electromagnetics::LineCharge, Phyth::Electromagnetics::MagneticDipole, Phyth::Electromagnetics::PointCharge, Phyth::Electromagnetics::SurfaceCharge, and Phyth::Electromagnetics::VolumeCharge.

◆ GetMinimumDistanceTo()

virtual Quantity< Meter > Phyth::Electromagnetics::ChargeSource::GetMinimumDistanceTo ( const Vector3< Quantity< Meter > > &  point) const
pure virtual

Get the minimum distance from a point to this charge source.

Parameters
pointPosition in 3D space (meters)
Returns
Minimum distance (meters)

This is used for regularization in field computations to avoid singularities. For point charges, this returns the distance to the point charge location. For extended sources, this returns the distance to the nearest point on the source geometry.

Implemented in Phyth::Electromagnetics::DipoleCharge, Phyth::Electromagnetics::LineCharge, Phyth::Electromagnetics::MagneticDipole, Phyth::Electromagnetics::PointCharge, Phyth::Electromagnetics::SurfaceCharge, and Phyth::Electromagnetics::VolumeCharge.

◆ GetTotalChargeValue()

virtual Quantity< Coulomb > Phyth::Electromagnetics::ChargeSource::GetTotalChargeValue ( ) const
pure virtual

Get the total charge of this source.

Returns
Total charge (Coulombs)

For point charges, this is the charge value itself. For distributed charges, this is the integral of charge density.

Implemented in Phyth::Electromagnetics::DipoleCharge, Phyth::Electromagnetics::LineCharge, Phyth::Electromagnetics::MagneticDipole, Phyth::Electromagnetics::PointCharge, Phyth::Electromagnetics::SurfaceCharge, and Phyth::Electromagnetics::VolumeCharge.


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