pyoculus 0.1.1
|
A very simple (but still hard) problem for testing the tools and methods. More...
Public Member Functions | |
__init__ (self, k=0.002) | |
Set up the problem. | |
set_k (self, k) | |
Set the value of k. | |
B (self, coords, *args) | |
Returns magnetic fields. | |
dBdX (self, coords, *args) | |
Returns magnetic fields. | |
convert_coords (self, incoords) | |
Convert coordinates for Poincare plots. | |
B_many (self, x1arr, x2arr, x3arr, input1D=True, *args) | |
Returns magnetic fields, with multipy coordinate inputs. | |
dBdX_many (self, x1arr, x2arr, x3arr, input1D=True, *args) | |
Returns magnetic fields. | |
Public Member Functions inherited from pyoculus.problems.toroidal_bfield.ToroidalBfield | |
f (self, zeta, st, *args) | |
Returns ODE RHS. | |
f_tangent (self, zeta, st, *args) | |
Returns ODE RHS, with tangent. | |
Public Member Functions inherited from pyoculus.problems.toroidal_problem.ToroidalProblem | |
Public Member Functions inherited from pyoculus.problems.base_problem.BaseProblem | |
Public Member Functions inherited from pyoculus.problems.bfield_problem.BfieldProblem |
Public Attributes | |
k = k | |
int | Nfp = 1 |
bool | has_jacobian = True |
int | problem_size = 2 |
the problem size, 2 for 1.5D/2D Hamiltonian system | |
str | poincare_plot_type = "yx" |
by default plotting the yx plane | |
str | poincare_plot_xlabel = "q" |
by default x axis has label q | |
str | poincare_plot_ylabel = "p" |
by default y axis has label p | |
Public Attributes inherited from pyoculus.problems.toroidal_problem.ToroidalProblem | |
int | problem_size = 2 |
str | poincare_plot_type = "yx" |
str | poincare_plot_xlabel = "x" |
str | poincare_plot_ylabel = "y" |
Public Attributes inherited from pyoculus.problems.base_problem.BaseProblem | |
int | problem_size = 2 |
str | poincare_plot_type = "yx" |
str | poincare_plot_xlabel = "y" |
str | poincare_plot_ylabel = "x" |
Public Attributes inherited from pyoculus.problems.bfield_problem.BfieldProblem | |
bool | has_jacobian = False |
if the output magnetic field contains the jacobian factor or not | |
A very simple (but still hard) problem for testing the tools and methods.
Details in S.R. Hudson, Phys. Plasmas 11, 677 (2004).
The magnetic field is given by
\[ \mathbf{B} = \nabla s \times \nabla \theta - \nabla \chi(s, \theta, \zeta) \times \nabla \zeta \]
The Hamiltonian of the magnetic field is given by
\[ \chi(s, \theta,\zeta) = \frac{s^2}{2} - k \left[ \frac{1}{2} \cos (2\theta - \zeta) + \frac{1}{3} \cos(3\theta - 2\zeta) \right] \]
The magnetic fields are given by
\[ B^s = - k \left[ \sin (2\theta - \zeta) + \sin(3\theta - 2\zeta)\right], \quad B^\theta = s , \quad B^\zeta = 1 \]
To use the class:
ps = TwoWaves(k=0.002)
pyoculus.problems.two_waves.TwoWaves.__init__ | ( | self, | |
k = 0.002 ) |
Set up the problem.
k | the value used in the Hamiltonian |
Reimplemented from pyoculus.problems.toroidal_bfield.ToroidalBfield.
pyoculus.problems.two_waves.TwoWaves.B | ( | self, | |
coords, | |||
* | args ) |
Returns magnetic fields.
coordinates | |
*args | extra parameters |
Reimplemented from pyoculus.problems.bfield_problem.BfieldProblem.
pyoculus.problems.two_waves.TwoWaves.B_many | ( | self, | |
x1arr, | |||
x2arr, | |||
x3arr, | |||
input1D = True, | |||
* | args ) |
Returns magnetic fields, with multipy coordinate inputs.
x1arr | the first coordinates. Should have the same length as the other two if input1D=True. |
x2arr | the second coordinates. Should have the same length as the other two if input1D=True. |
x3arr | the third coordinates. Should have the same length as the other two if input1D=True. |
input1D | if False, create a meshgrid with sarr, tarr and zarr, if True, treat them as a list of points |
*args | extra parameters |
Reimplemented from pyoculus.problems.bfield_problem.BfieldProblem.
pyoculus.problems.two_waves.TwoWaves.convert_coords | ( | self, | |
incoords ) |
Convert coordinates for Poincare plots.
incoords | \((p,q,t)\) |
Reimplemented from pyoculus.problems.toroidal_problem.ToroidalProblem.
pyoculus.problems.two_waves.TwoWaves.dBdX | ( | self, | |
coords, | |||
* | args ) |
Returns magnetic fields.
coordinates | |
*args | extra parameters |
Reimplemented from pyoculus.problems.bfield_problem.BfieldProblem.
pyoculus.problems.two_waves.TwoWaves.dBdX_many | ( | self, | |
x1arr, | |||
x2arr, | |||
x3arr, | |||
input1D = True, | |||
* | args ) |
Returns magnetic fields.
x1arr | the first coordinates. Should have the same length as the other two if input1D=True. |
x2arr | the second coordinates. Should have the same length as the other two if input1D=True. |
x3arr | the third coordinates. Should have the same length as the other two if input1D=True. |
input1D | if False, create a meshgrid with sarr, tarr and zarr, if True, treat them as a list of points |
*args | extra parameters |
Reimplemented from pyoculus.problems.bfield_problem.BfieldProblem.
pyoculus.problems.two_waves.TwoWaves.set_k | ( | self, | |
k ) |
Set the value of k.
k | the value used in the Hamiltonian |
bool pyoculus.problems.two_waves.TwoWaves.has_jacobian = True |
pyoculus.problems.two_waves.TwoWaves.k = k |
int pyoculus.problems.two_waves.TwoWaves.Nfp = 1 |
str pyoculus.problems.two_waves.TwoWaves.poincare_plot_type = "yx" |
by default plotting the yx plane
str pyoculus.problems.two_waves.TwoWaves.poincare_plot_xlabel = "q" |
by default x axis has label q
str pyoculus.problems.two_waves.TwoWaves.poincare_plot_ylabel = "p" |
by default y axis has label p
int pyoculus.problems.two_waves.TwoWaves.problem_size = 2 |
the problem size, 2 for 1.5D/2D Hamiltonian system