Data API Reference¶
This subpackage contains data generation functions for testing and examples.
Data Subpackage¶
data ¶
Implementations of data generation and handling functions.
KS_1D ¶
KS_1D(tN: Float, u0: Array = None, dt: Float = 0.25, domain: tuple[Float, Float] = (0, 22), Nx: int = 64) -> tuple[Float, Float]
Solve the Kuramoto-Sivashinsky equation in 1D with periodic boundary conditions.
The KS PDE solved is: u_t + u*u_x + u_xx + u_xxxx = 0
The solver uses a fixed time-step ETDRK4 (Kassam & Trefethen 2005) method for handling the stiffness of the PDE. Dealiasing (2/3 rule) is applied.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tN
|
float
|
The final time to solve the PDE to. |
required |
u0
|
ndarray
|
The initial condition for the PDE (shape (Nx,)). Default is None, which
initializes u0 to |
None
|
dt
|
float
|
The time step size for the solution. Default is 0.25. |
0.25
|
domain
|
tuple[float, float]
|
The spatial domain (x_min, x_max). Default is (0, 22). |
(0, 22)
|
Nx
|
int
|
The number of spatial grid points. Default is 64. |
64
|
Returns:
| Name | Type | Description |
|---|---|---|
U |
ndarray
|
The solution array with shape (Nt, Nx+1), where Nt is the number of time steps. Includes the periodic boundary point. |
t |
ndarray
|
The time vector corresponding to the solution steps. |
colpitts ¶
colpitts(tN: Float, dt: Float, u0: Float[Array, 3] = (1.0, -1.0, 1.0), alpha: Float = 5.0, gamma: Float = 0.0797, q: Float = 0.6898, eta: Float = 6.2723, **diffeqsolve_kwargs) -> tuple[Float, Float]
Solve the Colpitts oscillator system of ODEs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tN
|
float
|
The final time to solve the ODEs to. |
required |
dt
|
float
|
The time step size for the interpolated solution. Will be overridden if
|
required |
u0
|
ndarray
|
The initial conditions for the ODEs. Default is (1.0, -1.0, 1.0). |
(1.0, -1.0, 1.0)
|
alpha
|
float
|
The alpha parameter for the Colpitts oscillator system. Default is 5.0 (Platt, 2020). |
5.0
|
gamma
|
float
|
The gamma parameter for the Colpitts oscillator system. Default is 0.0797 (Platt, 2020). |
0.0797
|
q
|
float
|
The q parameter for the Colpitts oscillator system. Default is 0.6898 (Platt, 2020). |
0.6898
|
eta
|
float
|
The eta parameter for the Colpitts oscillator system. Default is 6.2723 (Platt, 2020). |
6.2723
|
diffeqsolve_kwargs
|
dict
|
Additional keyword arguments to pass to the |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
us |
ndarray
|
The solution array with shape (Nt, 3), where Nt is the number of time steps. |
ts |
ndarray
|
The time vector corresponding to the solution steps. |
double_pendulum ¶
double_pendulum(tN: Float, dt: Float, u0: Float[Array, 4] = (pi / 4, -1.0, pi / 2, 1.0), m1: Float = 1.0, m2: Float = 1.0, L1: Float = 1.0, L2: Float = 1.0, g: Float = 9.81, damping: Float = 0.0, **diffeqsolve_kwargs) -> tuple[Float, Float]
Solve the equations of motion for a damped double pendulum.
The state u is represented as a 4-tuple (theta1, omega1, theta2, omega2) where: - theta1 is the angle of the first pendulum from vertical (in radians). - omega1 is the angular velocity of the first pendulum (in radians/s). - theta2 is the angle of the second pendulum from vertical (in radians). - omega2 is the angular velocity of the second pendulum (in radians/s).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tN
|
float
|
The final time to solve the ODEs to. |
required |
dt
|
float
|
The time step size for the interpolated solution. Will be overridden if
|
required |
u0
|
ndarray
|
The initial conditions for the ODEs. Default is (jnp.pi/4, -1.0, jnp.pi/2, 1.0). |
(pi / 4, -1.0, pi / 2, 1.0)
|
m1
|
float
|
The mass of the first pendulum bob. Default is 1.0. |
1.0
|
m2
|
float
|
The mass of the second pendulum bob. Default is 1.0. |
1.0
|
L1
|
float
|
The length of the first pendulum rod. Default is 1.0. |
1.0
|
L2
|
float
|
The length of the second pendulum rod. Default is 1.0. |
1.0
|
g
|
float
|
The acceleration due to gravity. Default is 9.81. |
9.81
|
damping
|
float
|
The damping coefficient for the pendulum system. Default is 0.0 (no damping). |
0.0
|
diffeqsolve_kwargs
|
(dict, optional)
|
Additional keyword arguments to pass to the |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
us |
ndarray
|
The solution array with shape (Nt, 4), where Nt is the number of time steps. |
ts |
ndarray
|
The time vector corresponding to the solution steps. |
hyper_lorenz63 ¶
hyper_lorenz63(tN: Float, dt: Float, u0: Float[Array, 4] = (-10.0, 6.0, 0.0, 10.0), a: Float = 10.0, b: Float = 28.0, c: Float = 8.0 / 3.0, d: Float = -1.0, **diffeqsolve_kwargs) -> tuple[Float, Float]
Solve the Hyper-Lorenz 63 system of ODEs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tN
|
float
|
The final time to solve the ODEs to. |
required |
dt
|
float
|
The time step size for the interpolated solution. Will be overridden if
|
required |
u0
|
ndarray
|
The initial conditions for the ODEs. Default is (-10.0, 6.0, 0.0, 10.0). |
(-10.0, 6.0, 0.0, 10.0)
|
a
|
float
|
The a parameter for the Hyper-Lorenz system. Default is 10.0. |
10.0
|
b
|
float
|
The b parameter for the Hyper-Lorenz system. Default is 28.0. |
28.0
|
c
|
float
|
The c parameter for the Hyper-Lorenz system. Default is 8.0/3.0. |
8.0 / 3.0
|
d
|
float
|
The d parameter for the Hyper-Lorenz system. Default is -1.0. |
-1.0
|
diffeqsolve_kwargs
|
dict
|
Additional keyword arguments to pass to the |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
us |
ndarray
|
The solution array with shape (Nt, 4), where Nt is the number of time steps. |
ts |
ndarray
|
The time vector corresponding to the solution steps. |
hyper_xu ¶
hyper_xu(tN: Float, dt: Float, u0: Float[Array, 4] = (-2.0, -1.0, -2.0, -10.0), a: Float = 10.0, b: Float = 40.0, c: Float = 2.5, d: Float = 2.0, e: Float = 16.0, **diffeqsolve_kwargs) -> tuple[Float, Float]
Solve the Hyper-Xu system of ODEs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tN
|
float
|
The final time to solve the ODEs to. |
required |
dt
|
float
|
The time step size for the interpolated solution. Will be overridden if
|
required |
u0
|
ndarray
|
The initial conditions for the ODEs. Default is (-2.0, -1.0, -2.0, -10.0). |
(-2.0, -1.0, -2.0, -10.0)
|
a
|
float
|
The a parameter for the Hyper-Xu system. Default is 10.0. |
10.0
|
b
|
float
|
The b parameter for the Hyper-Xu system. Default is 40.0. |
40.0
|
c
|
float
|
The c parameter for the Hyper-Xu system. Default is 2.5. |
2.5
|
d
|
float
|
The d parameter for the Hyper-Xu system. Default is 2.0. |
2.0
|
e
|
float
|
The e parameter for the Hyper-Xu system. Default is 16.0. |
16.0
|
diffeqsolve_kwargs
|
dict
|
Additional keyword arguments to pass to the |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
us |
ndarray
|
The solution array with shape (Nt, 4), where Nt is the number of time steps. |
ts |
ndarray
|
The time vector corresponding to the solution steps. |
lorenz63 ¶
lorenz63(tN: Float, dt: Float, u0: Float[Array, 3] = (-10.0, 1.0, 10.0), rho: Float = 28.0, sigma: Float = 10.0, beta: Float = 8.0 / 3.0, **diffeqsolve_kwargs) -> tuple[Float, Float]
Solve the Lorenz 63 system of ODEs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tN
|
float
|
The final time to solve the ODEs to. |
required |
dt
|
float
|
The time step size for the interpolated solution. Will be overridden if
|
required |
u0
|
ndarray
|
The initial conditions for the ODEs. Default is (-10, 1, 10). |
(-10.0, 1.0, 10.0)
|
rho
|
float
|
The rho parameter for the Lorenz system. Default is 28.0. |
28.0
|
sigma
|
float
|
The sigma parameter for the Lorenz system. Default is 10.0. |
10.0
|
beta
|
float
|
The beta parameter for the Lorenz system. Default is 8.0/3.0. |
8.0 / 3.0
|
diffeqsolve_kwargs
|
dict
|
Additional keyword arguments to pass to the |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
us |
ndarray
|
The solution array with shape (Nt, 3), where Nt is the number of time steps. |
ts |
ndarray
|
The time vector corresponding to the solution steps. |
lorenz96 ¶
lorenz96(tN: Float, dt: Float, u0: Array = None, N: Float = 10, F: Float = 8.0, **diffeqsolve_kwargs) -> tuple[Float, Float]
Solve the Lorenz 96 system of ODEs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tN
|
float
|
The final time to solve the ODEs to. |
required |
dt
|
float
|
The time step size for the interpolated solution. Will be overridden if
|
required |
u0
|
ndarray
|
The initial conditions for the ODEs. Default is None, which initializes y0
to |
None
|
N
|
int
|
The number of variables in the Lorenz 96 system. Default is 10. |
10
|
F
|
float
|
The forcing parameter for the Lorenz 96 system. Default is 8.0. |
8.0
|
diffeqsolve_kwargs
|
dict
|
Additional keyword arguments to pass to the |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
us |
ndarray
|
The solution array with shape (Nt, N), where Nt is the number of time steps. |
ts |
ndarray
|
The time vector corresponding to the solution steps. |
rossler ¶
rossler(tN: Float, dt: Float, u0: Float[Array, 3] = (1.0, 1.0, 1.0), a: Float = 0.1, b: Float = 0.1, c: Float = 14.0, **diffeqsolve_kwargs) -> tuple[Float, Float]
Solve the Rossler system of ODEs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tN
|
float
|
The final time to solve the ODEs to. |
required |
dt
|
float
|
The time step size for the interpolated solution. Will be overridden if
|
required |
u0
|
ndarray
|
The initial conditions for the ODEs. Default is (1.0, 1.0, 1.0). |
(1.0, 1.0, 1.0)
|
a
|
float
|
The a parameter for the Rössler system. Default is 0.1. |
0.1
|
b
|
float
|
The b parameter for the Rössler system. Default is 0.1. |
0.1
|
c
|
float
|
The c parameter for the Rössler system. Default is 14.0. |
14.0
|
diffeqsolve_kwargs
|
dict
|
Additional keyword arguments to pass to the |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
us |
ndarray
|
The solution array with shape (Nt, 3), where Nt is the number of time steps. |
ts |
ndarray
|
The time vector corresponding to the solution steps. |
sakaraya ¶
sakaraya(tN: Float, dt: Float, u0: Float[Array, 3] = (-2.8976045, 3.8877978, 3.07465), a: Float = 1.0, b: Float = 1.0, m: Float = 1.0, **diffeqsolve_kwargs) -> tuple[Float, Float]
Solve the Sakaraya system of ODEs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tN
|
float
|
The final time to solve the ODEs to. |
required |
dt
|
float
|
The time step size for the interpolated solution. Will be overridden if
|
required |
u0
|
ndarray
|
The initial conditions for the ODEs. Default is (-2.8976045, 3.8877978, 3.07465). |
(-2.8976045, 3.8877978, 3.07465)
|
a
|
float
|
The a parameter for the Sakaraya system. Default is 1.0. |
1.0
|
b
|
float
|
The b parameter for the Sakaraya system. Default is 1.0. |
1.0
|
m
|
float
|
The m parameter for the Sakaraya system. Default is 1.0. |
1.0
|
diffeqsolve_kwargs
|
dict
|
Additional keyword arguments to pass to the |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
us |
ndarray
|
The solution array with shape (Nt, 3), where Nt is the number of time steps. |
ts |
ndarray
|
The time vector corresponding to the solution steps. |
Lorenz63 System¶
lorenz63 ¶
lorenz63(tN: Float, dt: Float, u0: Float[Array, 3] = (-10.0, 1.0, 10.0), rho: Float = 28.0, sigma: Float = 10.0, beta: Float = 8.0 / 3.0, **diffeqsolve_kwargs) -> tuple[Float, Float]
Solve the Lorenz 63 system of ODEs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tN
|
float
|
The final time to solve the ODEs to. |
required |
dt
|
float
|
The time step size for the interpolated solution. Will be overridden if
|
required |
u0
|
ndarray
|
The initial conditions for the ODEs. Default is (-10, 1, 10). |
(-10.0, 1.0, 10.0)
|
rho
|
float
|
The rho parameter for the Lorenz system. Default is 28.0. |
28.0
|
sigma
|
float
|
The sigma parameter for the Lorenz system. Default is 10.0. |
10.0
|
beta
|
float
|
The beta parameter for the Lorenz system. Default is 8.0/3.0. |
8.0 / 3.0
|
diffeqsolve_kwargs
|
dict
|
Additional keyword arguments to pass to the |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
us |
ndarray
|
The solution array with shape (Nt, 3), where Nt is the number of time steps. |
ts |
ndarray
|
The time vector corresponding to the solution steps. |
Source code in src/orc/data/integrators.py
Kuramoto-Sivashinsky Equation¶
KS_1D ¶
KS_1D(tN: Float, u0: Array = None, dt: Float = 0.25, domain: tuple[Float, Float] = (0, 22), Nx: int = 64) -> tuple[Float, Float]
Solve the Kuramoto-Sivashinsky equation in 1D with periodic boundary conditions.
The KS PDE solved is: u_t + u*u_x + u_xx + u_xxxx = 0
The solver uses a fixed time-step ETDRK4 (Kassam & Trefethen 2005) method for handling the stiffness of the PDE. Dealiasing (2/3 rule) is applied.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tN
|
float
|
The final time to solve the PDE to. |
required |
u0
|
ndarray
|
The initial condition for the PDE (shape (Nx,)). Default is None, which
initializes u0 to |
None
|
dt
|
float
|
The time step size for the solution. Default is 0.25. |
0.25
|
domain
|
tuple[float, float]
|
The spatial domain (x_min, x_max). Default is (0, 22). |
(0, 22)
|
Nx
|
int
|
The number of spatial grid points. Default is 64. |
64
|
Returns:
| Name | Type | Description |
|---|---|---|
U |
ndarray
|
The solution array with shape (Nt, Nx+1), where Nt is the number of time steps. Includes the periodic boundary point. |
t |
ndarray
|
The time vector corresponding to the solution steps. |
Source code in src/orc/data/integrators.py
638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 | |
Rössler System¶
rossler ¶
rossler(tN: Float, dt: Float, u0: Float[Array, 3] = (1.0, 1.0, 1.0), a: Float = 0.1, b: Float = 0.1, c: Float = 14.0, **diffeqsolve_kwargs) -> tuple[Float, Float]
Solve the Rossler system of ODEs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tN
|
float
|
The final time to solve the ODEs to. |
required |
dt
|
float
|
The time step size for the interpolated solution. Will be overridden if
|
required |
u0
|
ndarray
|
The initial conditions for the ODEs. Default is (1.0, 1.0, 1.0). |
(1.0, 1.0, 1.0)
|
a
|
float
|
The a parameter for the Rössler system. Default is 0.1. |
0.1
|
b
|
float
|
The b parameter for the Rössler system. Default is 0.1. |
0.1
|
c
|
float
|
The c parameter for the Rössler system. Default is 14.0. |
14.0
|
diffeqsolve_kwargs
|
dict
|
Additional keyword arguments to pass to the |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
us |
ndarray
|
The solution array with shape (Nt, 3), where Nt is the number of time steps. |
ts |
ndarray
|
The time vector corresponding to the solution steps. |
Source code in src/orc/data/integrators.py
Lorenz96 System¶
lorenz96 ¶
lorenz96(tN: Float, dt: Float, u0: Array = None, N: Float = 10, F: Float = 8.0, **diffeqsolve_kwargs) -> tuple[Float, Float]
Solve the Lorenz 96 system of ODEs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tN
|
float
|
The final time to solve the ODEs to. |
required |
dt
|
float
|
The time step size for the interpolated solution. Will be overridden if
|
required |
u0
|
ndarray
|
The initial conditions for the ODEs. Default is None, which initializes y0
to |
None
|
N
|
int
|
The number of variables in the Lorenz 96 system. Default is 10. |
10
|
F
|
float
|
The forcing parameter for the Lorenz 96 system. Default is 8.0. |
8.0
|
diffeqsolve_kwargs
|
dict
|
Additional keyword arguments to pass to the |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
us |
ndarray
|
The solution array with shape (Nt, N), where Nt is the number of time steps. |
ts |
ndarray
|
The time vector corresponding to the solution steps. |