OrbitKS¶
Overview¶
-
class
orbithunter.
OrbitKS
(state=None, basis=None, parameters=None, discretization=None, constraints=None, **kwargs)[source]¶ Base class for orbits of the Kuramoto-Sivashinsky equation.
The Kuramoto-Sivashinsky equation is a fourth order partial differential equation that serves as a simplified testing ground for the more complicated Navier-Stokes equation. It’s form in configuration space, where the state variable \(u(t,x)\) is typically imagined as a velocity field of a laminar flame front. It’s spatiotemporal version with doubly periodic boundary conditions takes the form
\(u_t + u_{xx} + u_{xxxx} + 1/2(u^2)_x = 0\)
with boundary conditions
\(u(t, x) = u(t + T, x) = u(t, x+L) = u(t+T, x+L)\).
This class and its subclasses is used to find solutions to the system of differential algebraic equations (DAEs) which result from applying a discrete Fourier transform in both space and time.
The ‘state’ in configuration space is ordered such that when in the physical basis, the last row corresponds to ‘t=0’. This results in an extra negative sign when computing time derivatives. This convention was chosen because it is conventional to display positive time as ‘up’. This convention prevents errors due to flipping fields up and down.
To define an orbit, the configuration space (spatiotemporal dimensions) or tile must be defined. The unconventional approach of this package is to keep these domain dimensions as free variables.
The only additional parameter beyond the dimensions is a spatial shift parameter for solutions with continuous spatial translation symmetry; it only applies to
orbithunter.ks.orbits.RelativeOrbitKS
andorbithunter.ks.orbits.RelativeEquilibriumOrbitKS
. Its inclusion in the classorbithunter.ks.orbits.OrbitKS
is due to the ability to convert between Orbit types. The various subclasses represent symmetry invariant subspaces. Due to the nature of subspaces, it is numerically possible to find, for example, solutions with spatial reflection symmetry using OrbitKS. The discrete symmetry invariant orbits are literaly subspaces of solutions; any subclass member can be found using its parent class.Historically, only adj and lstsq were used, in combination, for OrbitKS and its subclasses: All possible methods include:
‘adj’
‘newton_descent’
‘lstsq’
‘lsqr’
‘lsmr’
‘bicg’
‘bicgstab’
‘gmres’
‘lgmres’
‘cg’
‘cgs’
‘qmr’
‘minres’
‘gcrotmk’
‘cg_min’
‘bfgs’
‘newton-cg’
‘l-bfgs-b’
‘tns’
‘slsqp’
Warning
If dimensions change by dramatic/nonsensible amounts then preconditioning=True can be used with certain methods (most notably, ‘adj’) to account for very large parameter gradients.
Warning
The following are supported but NOT recommended for the KSE.
‘nelder-mead’ (very very slow)
‘powell’ (very slow)
‘cobyla’ (slow),
See also
Methods¶
Initialization¶
|
Initialize self. |
|
Initialize random parameters or state or both. |
|
Initialize a set of random spatiotemporal Fourier modes |
|
Should only be accessed through |
Special Methods¶
“Special” methods also known as “magic” or “dunder” (double underscore) methods account for most basic Math operations and other operations pertaining to NumPy arrays.
Note
See Orbit
for more details.
Properties¶
Current state array’s shape |
|
Current state array’s dimensionality |
|
Current state array’s number of dimensions |
Discretization and Dimensions¶
State array shapes in different bases; determined by symmetry selection rules. |
|
Tile dimensions. |
|
|
Strategy for combining tile dimensions in gluing; default is arithmetic averaging. |
Return discretization size according to orbithunter conventions for the KSe. |
|
Dimensions according to plot labels; used in clipping. |
Math Functions¶
Vector representation of Orbit instance; constants all variables required to define the Orbit instance. |
|
Orbit instance with absolute value of state. |
|
|
Return the L_2 inner product of two orbits |
|
Norm of spatiotemporal state via numpy.linalg.norm |
|
Spatial derivative of the current state. |
|
Spectral time derivatives of the current state. |
|
Instance whose state is the Kuramoto-Sivashinsky equation evaluated at the current state |
|
Matrix-vector product of a vector with the Jacobian of the current state. |
|
Matrix-vector product with the adjoint of the Jacobian |
|
Rescale a vector with the inverse (absolute value) of linear spatial terms |
|
Jacobian matrix evaluated at the current state. |
Visualization¶
|
Plot the velocity field as a 2-d density plot using matplotlib’s imshow |
|
Plot the spatiotemporal Fourier spectrum as a 2-d density plot using matplotlib’s imshow |
State Transformations¶
|
Transform current state to a different basis. |
|
Rediscretize the current state typically via zero padding or interpolation. |
|
Reflect the velocity field about the spatial midpoint |
|
Apply numpy roll along specified axis. |
|
Rotate by fraction of the period in either axis; nearest discrete approximate is taken. |
|
Rotate the velocity field in either space or time. |
Return a OrbitKS with shift-reflected velocity field |
|
|
Placeholder/signature for possible symmetry subclasses. |
|
Placeholder/signature for possible symmetry subclasses. |
|
Increase the size of the discretization via zero-padding |
|
Decrease the size of the discretization via truncation |
Static¶
Labels of the different bases produced by transforms. |
|
The smallest possible compatible discretization to have full functionality. |
|
The smallest valid increment to change the discretization by. |
|
Strings to use to label dimensions/periods |
|
Labels of all parameters |
|
Strings to use to label dimensions/periods. |
|
Bools indicating whether or not dimension is periodic. |
|
Indicates whether numpy indexing corresponds to increasing or decreasing values configuration space variable |
Other¶
Return an instance with copies of copy-able attributes. |
|
|
Return an Orbit instance with a numpy masked array state |
|
Set self constraints based on labels provided. |
Check whether the orbit converged to an equilibrium or close-to-zero solution |
Defaults¶
Dict of default values for constraints, parameter ranges, sizes, etc. |
|
The default array shape when dimensions are not specified. |
|
Default parameter ranges. |
|
Defaults for whether or not parameters are constrained. |
Reading and Writing Data¶
|
Method for convenience and consistent/conventional file naming. |
|
Export current state information to HDF5 file. |