pyoculus 0.1.1
Loading...
Searching...
No Matches
pyoculus.problems.two_waves.TwoWaves Class Reference

A very simple (but still hard) problem for testing the tools and methods. More...

Inheritance diagram for pyoculus.problems.two_waves.TwoWaves:
pyoculus.problems.toroidal_bfield.ToroidalBfield pyoculus.problems.toroidal_problem.ToroidalProblem pyoculus.problems.bfield_problem.BfieldProblem pyoculus.problems.base_problem.BaseProblem

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
 

Detailed Description

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)

Constructor & Destructor Documentation

◆ __init__()

pyoculus.problems.two_waves.TwoWaves.__init__ ( self,
k = 0.002 )

Set up the problem.

Parameters
kthe value used in the Hamiltonian

Reimplemented from pyoculus.problems.toroidal_bfield.ToroidalBfield.

Member Function Documentation

◆ B()

pyoculus.problems.two_waves.TwoWaves.B ( self,
coords,
* args )

Returns magnetic fields.

Parameters
coordinates
*argsextra parameters
Returns
the contravariant magnetic fields

Reimplemented from pyoculus.problems.bfield_problem.BfieldProblem.

◆ B_many()

pyoculus.problems.two_waves.TwoWaves.B_many ( self,
x1arr,
x2arr,
x3arr,
input1D = True,
* args )

Returns magnetic fields, with multipy coordinate inputs.

Parameters
x1arrthe first coordinates. Should have the same length as the other two if input1D=True.
x2arrthe second coordinates. Should have the same length as the other two if input1D=True.
x3arrthe third coordinates. Should have the same length as the other two if input1D=True.
input1Dif False, create a meshgrid with sarr, tarr and zarr, if True, treat them as a list of points
*argsextra parameters
Returns
the contravariant magnetic fields

Reimplemented from pyoculus.problems.bfield_problem.BfieldProblem.

◆ convert_coords()

pyoculus.problems.two_waves.TwoWaves.convert_coords ( self,
incoords )

Convert coordinates for Poincare plots.

Parameters
incoords\((p,q,t)\)
Returns
\((p,q \ \mbox{mod} \ 2\pi,t \ \mbox{mod} \ 2\pi)\)

Reimplemented from pyoculus.problems.toroidal_problem.ToroidalProblem.

◆ dBdX()

pyoculus.problems.two_waves.TwoWaves.dBdX ( self,
coords,
* args )

Returns magnetic fields.

Parameters
coordinates
*argsextra parameters
Returns
B, dBdX, the contravariant magnetic fields, the derivatives of them

Reimplemented from pyoculus.problems.bfield_problem.BfieldProblem.

◆ dBdX_many()

pyoculus.problems.two_waves.TwoWaves.dBdX_many ( self,
x1arr,
x2arr,
x3arr,
input1D = True,
* args )

Returns magnetic fields.

Parameters
x1arrthe first coordinates. Should have the same length as the other two if input1D=True.
x2arrthe second coordinates. Should have the same length as the other two if input1D=True.
x3arrthe third coordinates. Should have the same length as the other two if input1D=True.
input1Dif False, create a meshgrid with sarr, tarr and zarr, if True, treat them as a list of points
*argsextra parameters
Returns
B, dBdX, the contravariant magnetic fields, the derivatives of them

Reimplemented from pyoculus.problems.bfield_problem.BfieldProblem.

◆ set_k()

pyoculus.problems.two_waves.TwoWaves.set_k ( self,
k )

Set the value of k.

Parameters
kthe value used in the Hamiltonian

Member Data Documentation

◆ has_jacobian

bool pyoculus.problems.two_waves.TwoWaves.has_jacobian = True

◆ k

pyoculus.problems.two_waves.TwoWaves.k = k

◆ Nfp

int pyoculus.problems.two_waves.TwoWaves.Nfp = 1

◆ poincare_plot_type

str pyoculus.problems.two_waves.TwoWaves.poincare_plot_type = "yx"

by default plotting the yx plane

◆ poincare_plot_xlabel

str pyoculus.problems.two_waves.TwoWaves.poincare_plot_xlabel = "q"

by default x axis has label q

◆ poincare_plot_ylabel

str pyoculus.problems.two_waves.TwoWaves.poincare_plot_ylabel = "p"

by default y axis has label p

◆ problem_size

int pyoculus.problems.two_waves.TwoWaves.problem_size = 2

the problem size, 2 for 1.5D/2D Hamiltonian system


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