gcmotion.Profile#
- class gcmotion.Profile(tokamak: Tokamak, species: SupportedSpecies, mu: Quantity = None, Pzeta: Quantity = None, E: Quantity = None)#
A Profile entity describes an unperturbed equilibrium with a given Tokamak configuration.
By fixing 2 COMs and letting the other one be variable, we can perform many useful analyses.
Note that even if specified, the 3rd COM will be ignored in an analysis that by its nature lets it vary. For example, contouring over Energy levels, will simply ignore the E parameter.
- Parameters:
- tokamak
Tokamak The Tokamak entity.
- species{‘p’, ‘e’, ‘D’, ‘T’, ‘He3’, ‘He4’}
The particle’s species. This field is case-insensitive.
- muQuantity
The Magnetic Moment COM \(\mu\).
- PzetaQuantity
The Canonical Momentum COM \(P_\zeta\).
- EQuantity
The E COM \(E\).
- tokamak
- Attributes:
- species: str
The profile’s particle species
- mi, qi, miNU, qiNUQuantities
The profile’s particle mass and charge in SI/NU.
- mu, muNU: Quantities
The magnetic moment \(\mu\) in SI/NU. Must have dimensionality of [current]x[area].
- Pzeta, PzetaNU: Quantities
The \(P_\zeta\) canonical momentum in SI/NU. Must have dimensionality of magnetic flux.
- E, ENU: Quantities
The Energy constant of motion in SI/NU.
Methods
findEnergy(psi, theta, units[, potential])Calculates the Energy of a particle characterized by a (psi, theta) pair.
findPtheta(psi, units)Calculates Pθ(ψ).
Examples
How to create a Profile object.
>>> import gcmotion as gcm >>> >>> # Quantity Constructor >>> Rnum = 1.65 >>> anum = 0.5 >>> B0num = 1 >>> species = "p" >>> Q = gcm.QuantityConstructor(R=Rnum, a=anum, B0=B0num, species=species) >>> >>> # Intermediate Quantities >>> R = Q(Rnum, "meters") >>> a = Q(anum, "meters") >>> B0 = Q(B0num, "Tesla") >>> i = Q(0, "NUPlasma_current") >>> g = Q(1, "NUPlasma_current") >>> Ea = Q(73500, "Volts/meter") >>> >>> # Construct a Tokamak >>> tokamak = gcm.Tokamak( ... R=R, ... a=a, ... qfactor=gcm.qfactor.Hypergeometric(a, B0, q0=1.1, q_wall=3.8, n=2), ... bfield=gcm.bfield.LAR(B0=B0, i=i, g=g), ... efield=gcm.efield.Radial(a, Ea, B0, peak=0.98, rw=1 / 50), ... ) >>> >>> # Create a Profile >>> profile = gcm.Profile( ... tokamak=tokamak, ... species=species, ... mu=Q(1e-5, "NUMagnetic_moment"), ... Pzeta=Q(-0.015, "NUCanonical_momentum") ... )
- findEnergy(psi: Quantity, theta: float, units: str, potential: bool = True)#
Calculates the Energy of a particle characterized by a (psi, theta) pair. Both Pzeta and mu must be defined.
- Parameters:
- psiQuantity
The particle’s psi Quantity.
- thetafloat
The particle’s \(\theta\) angle.
- unitsstr
The returned Energy units.
- potentialbool, optional
Whether or not to add the electric potential term in the energy. Defaults to True.
- Returns:
- Quantity
The calculated Energy Quantity in the specified units.
- findPtheta(psi: Quantity, units: str) Quantity#
Calculates Pθ(ψ). “Pzeta” must be defined.
Only applicable in the absence of perturbations.
- Parameters:
- psiQuantity
The psi Quantity.
- unitsstr
The Ptheta units. Must have dimensionality of canonical momentum (orbital momentum = [energy] * [time]),
- Returns:
- Quantity
The calculated Ptheta Quantity.
Note
The private methods _findPthetaNU and _findEnergyNU are also available. They inputs and outputs are pure numbers in NU, and therefore are considerably faster. The public methods findEnergy() and findPtheta() use these too internally as well, and only handle the units.
|
Calculates Pθ(ψ). |
|
Calculates E(ψ, θ). |