## simulations.objects Class CurrentRing

```java.lang.Object simulations.objects.BaseObject simulations.objects.CurrentRing
```

public class CurrentRing
extends BaseObject

A ring carrying current. CurrentRing is an EMSource object that computes the electric and magnetic field of a moving circular ring of current. The adjustable parameters are the position, orientation, radius, and velocity of the ring, the current and its time rate of change. To compute the fields, elliptic integrals must be performed, and so using a CurrentRing will slow down computations.

Documentation for the expressions used herein in calculating the magnetic field can be found in the TEAL_Physics_Math document (see Section 3.2.2). This link will work if you have installed the SundquistDLIC code base and documentation as instructed.

Version:
1.0
Author:
Andreas Sundquist

 Field Summary ` Vec3` `c`           center of the ring ` Vec3` `d`           unit vector along the direction of the rings axis, defines the direction of positive current ` double` `dIdt`           time rate of change of current ` double` `I`           current in ring (positive current is right handed with respect to the axis of the ring) `private  Vec3` `LastB`           the last calculated B field value, stored to avoid unnecessary calculations `private  Vec3` `LastE`           the last calculated E field value, stored to avoid unnecessary calculations `private  Vec3` `LastX`           the last calculated location, stored to avoid unnecessary calculations ` Vec3` `omega`           the angular velocity vector of the ring, omega cross r from center gives the angular speed ` Vec3` `p`           the observer"s location where we are going to calculate the fields ` double` `R`           R = radius of the ring ` Vec3` `v`           the velocity of the ring

 Constructor Summary ```CurrentRing(Vec3 p, Vec3 d, double R, double I)```           Constructs a new Current ring. ```CurrentRing(Vec3 p, Vec3 d, double R, double I, double dIdt)```           Constructs a new Current ring. ```CurrentRing(Vec3 p, Vec3 d, double R, double I, Vec3 v)```           Constructs a new Current ring. ```CurrentRing(Vec3 p, Vec3 d, double R, double I, Vec3 v, Vec3 omega)```           Constructs a new Current ring.

 Method Summary ` Vec3` ```Bfield(Vec3 x, Vec3 B)```           Sets "B" to the value of the magnetic field at "x". `private  void` `CalculateFields(Vec3 x)`           Computes both the electric and magnetic fields at the observer"s position. ` Vec3` ```Efield(Vec3 x, Vec3 E)```           Sets "E" to the value of the electric field at "x". ` void` `Evolve(double dt)`           A very simple evolution of the CurrnetRing by amount of time "dt".

 Methods inherited from class simulations.objects.BaseObject `Bfield, Efield, Pfield, Pfield`

 Methods inherited from class java.lang.Object `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

 Field Detail

### I

`public double I`
current in ring (positive current is right handed with respect to the axis of the ring)

### dIdt

`public double dIdt`
time rate of change of current

### R

`public double R`
R = radius of the ring

### p

`public Vec3 p`
the observer"s location where we are going to calculate the fields

### c

`public Vec3 c`
center of the ring

### d

`public Vec3 d`
unit vector along the direction of the rings axis, defines the direction of positive current

### v

`public Vec3 v`
the velocity of the ring

### omega

`public Vec3 omega`
the angular velocity vector of the ring, omega cross r from center gives the angular speed

### LastX

`private Vec3 LastX`
the last calculated location, stored to avoid unnecessary calculations

### LastB

`private Vec3 LastB`
the last calculated B field value, stored to avoid unnecessary calculations

### LastE

`private Vec3 LastE`
the last calculated E field value, stored to avoid unnecessary calculations

 Constructor Detail

### CurrentRing

```public CurrentRing(Vec3 p,
Vec3 d,
double R,
double I)```
Constructs a new Current ring. The velocity and the angular velocity and // * the rate of current change are initialized to zero.

Parameters:
`p` - the position of the center of the ring
`d` - the axis of the ring
`R` - the radius of the ring
`I` - the current in the ring

### CurrentRing

```public CurrentRing(Vec3 p,
Vec3 d,
double R,
double I,
Vec3 v)```
Constructs a new Current ring. The angular velocity and the rate of current change are initialized to zero.

Parameters:
`p` - the position of the center of the ring
`d` - the axis of the ring
`R` - the radius of the ring
`I` - the current in the ring *
`v` - the velocity of the ring

### CurrentRing

```public CurrentRing(Vec3 p,
Vec3 d,
double R,
double I,
double dIdt)```
Constructs a new Current ring. The angular velocity is initialized to zero, as is the speed, but we allow a time rate of change dIdt.

Parameters:
`p` - the position of the center of the ring
`d` - the axis of the ring
`R` - the radius of the ring
`I` - the current in the ring *
`dIdt` - the time rate of change of current in the ring

### CurrentRing

```public CurrentRing(Vec3 p,
Vec3 d,
double R,
double I,
Vec3 v,
Vec3 omega)```
Constructs a new Current ring. The rate of current change is initialized to zero.

Parameters:
`p` - the position of the center of the ring
`d` - the axis of the ring
`R` - the radius of the ring
`I` - the current in the ring *
`v` - the velocity of the ring
`omega` - the angular velocity of the ring
 Method Detail

### Evolve

`public void Evolve(double dt)`
A very simple evolution of the CurrnetRing by amount of time "dt". For simplicity, it assumes zero second-order rate of changes and therefore uses simple Euler integration. This method should be overridden or replaced in more complicated situations.

Overrides:
`Evolve` in class `BaseObject`
Parameters:
`dt` - the time step

### CalculateFields

`private void CalculateFields(Vec3 x)`
Computes both the electric and magnetic fields at the observer"s position. This method is used by both Efield() and Bfield().

Parameters:
`x` - the position of the observer

### Efield

```public Vec3 Efield(Vec3 x,
Vec3 E)```
Sets "E" to the value of the electric field at "x". "x" is not modified. Returns: resulting "E". This uses the CalculateFields method.

Specified by:
`Efield` in class `BaseObject`
Parameters:
`x` - the position of the observer
`E` - the electric field at the observer (calculated)
Returns:
E the electric field at the observer

### Bfield

```public Vec3 Bfield(Vec3 x,
Vec3 B)```
Sets "B" to the value of the magnetic field at "x". "x" is not modified. Returns: resulting "B" * This uses the CalculateFields method.

Specified by:
`Bfield` in class `BaseObject`
Parameters:
`x` - the position of the observer
`B` - the magnetic field at the observer (calculated)
Returns:
B the magnetic field at the observer