2.4. drrc.kuramoto_sivashinsky module

Generates training data for a Kuramoto-Sivashinsky system.

Code author: Gerrit Wellecke

class KuramotoSivashinsky(config: Config, method: str, nu: float, L: float, nx: int, dt: float, t0: float = 0, tN: float = 0, task_id: int = 0, Filepath: str = 'Data/1D_KuramotoSivashinsky/', cluster_save: bool = False, **kwargs)[source]

Bases: object

The Kuramoto-Sivashinsky-equation as

\[\partial_t u(x,t) = -\frac{1}{2} \nabla\left[ u^2(x,t)\right] - \nabla^2 u(x,t) - \nu \nabla^4 u(x,t)\,,\]

where \(u\) is a one-dimensional field.

Todo

Update documentation!

Parameters:
  • config (Config) – configuration YAML object referring to the KS system

  • method (str) – method of integration.

  • nu (float) – prefactor of 4th derivative in KS equation

  • L (float) – domain length, i.e. domain is [0, L]

  • nx (int) – number of gridpoints in spatial domain

  • dt (float) – time step size

  • t0 (float) – time before is integrated but discarded

  • tN (float) – final time point

  • task_id (int) – SGE_TASK_ID of the current execution

  • cluster_save (bool) – Set to true if you wish to save data with an absolute path. In this case Jobscript-Datadir is interpreted absolute, which is useful when you want to use the cluster’s data server.

Example

This best used by dictionary unpacking, e.g.

KuramotoSivashinsky(
    config=conf,
    **conf["System"]["Parameters"],
    **conf.param_scan_list(task_id),
    task_id=task_id
)

Note

The drrc.config.Config for this look as follows:

System:
  Name: "KuramotoSivashinsky"
  Parameters:
    # nu: 1
    L: 60
    nx: 128
    t0: 0
    tN: 30000
    dt: 0.25
  Method: "spectral"  # spectral or py-pde

Saving:
  # this must be absolute paths with respect to the repository root
  Name: "KS_t"
  PlotPath: "Figures/"

Jobscript:
  Name: "Example-2023"
  Datadir: "~"  # this has to be an absolute path on the executing system
  Cores: 4

ParamScan:
  nu: [0.1, 1.1, 0.2]
generate_timeseries(**kwargs)[source]

Integrate KS system with the integrator specified in the config YAML

Parameters:

**kwargs

Can include and overwrite

t0 (float):

time before is integrated but discarded

tN (float):

final time point

generate_timeseries_spectral()[source]

Integrate the KS system using a spectral method

generate_timeseries_pypde()[source]

Integrate the KS system using py-pde.

Note

py-pde is much better tested than the code of generate_timeseries_spectral(). Also it solves the system in real space. However, this comes at a much slower speed!

save(filename: str | None = None)[source]

Save time series to .npy file

Parameters:

filename (str) – If specified, this is the resulting file without the extension. Otherwise the filename from the config YAML is used.

plot_conservation()[source]

Plot field conversation for quick sanity checks

Attention

This method does not yet allow for writing the resulting plot to file.

plot_kymograph(SavingPath: str | None = None)[source]

Plot kymograph of the system.

Parameters:

save (str) – If set the result are not shown but instead saved to a png at the given location.