Preparation#

Generate random realizations.

Functions

Generate([cli_args, _return_parser])

Generate IO files, and compute and write initial states.

UpgradeData([cli_args, _return_parser, ...])

Upgrade data to the current version.

VerifyData([cli_args, _return_parser])

Check that the data is of the correct version.

allocate_System(group[, random_stress, ...])

Allocate the system.

check_copy(src, dst[, rename, shallow, ...])

Check that all datasets in src are also in dst (check that "!=" and "->" are empty).

compute_x(dynamics, sigma, sigmay)

Compute the distance to yielding.

convert_A_to_ell(A, dim)

Convert number of blocks that yielded at least once to a proxy for the linear extent.

dump_snapshot(index, group, system)

Add/overwrite snapshot of the current state (fully recoverable).

get_data_version(file)

Read the current data version from the file.

get_dynamics(group)

Read the dynamics from the file.

load_snapshot(index, group, system)

Recover system from a snapshot.

propagator(group)

Return the propagator and the distances.

store_histogram(group, hist)

Store the histogram.

Details

depinning_creep_2024.Preparation.Generate(cli_args: list = None, _return_parser: bool = False) None#

Generate IO files, and compute and write initial states. In addition, write common simulation files.

depinning_creep_2024.Preparation.UpgradeData(cli_args: list = None, _return_parser: bool = False, _module: str = 'Preparation', _upgrade_function=<function _upgrade_data>, _combine: bool = False) None#

Upgrade data to the current version.

Parameters
  • cli_args – Command line arguments, see --help for details. Default: sys.argv[1:] is used.

  • _return_parser – Return parser instead of executing (for documentation).

  • _module – Name of the module calling this function.

  • _upgrade_function – Function that upgrades the data.

  • _combine

    Combine two data-files.

    • If _combine=False:

      temp_file = _upgrade_function(filename, temp_dir)
      
    • If _combine=True:

      temp_file = _upgrade_function(filename, temp_dir, args.insert)
      

    The return value temp_file is then handled as follows:

    • If ret is None: The file is not upgraded.

    • Otherwise a backup is created, and the file is replaced by temp_file.

Returns

None if executed, parser if return_parser.

depinning_creep_2024.Preparation.VerifyData(cli_args: list = None, _return_parser: bool = False) None#

Check that the data is of the correct version. Filenames of incorrect files are printed to stdout.

Parameters
  • cli_args – Command line arguments, see --help for details. Default: sys.argv[1:] is used.

  • _return_parser – Return parser instead of executing (for documentation).

Returns

None if executed, parser if return_parser.

depinning_creep_2024.Preparation.allocate_System(group: Group, random_stress: bool = True, loading: str = 'stress', thermal: bool = False, **kwargs) SystemClass#

Allocate the system.

Note

You need to additionally restore a state if so desired.

Parameters
  • group – Opened group "param".

  • random_stressTrue if a random, compatible, stress should be generated.

  • loading – Loading type.

  • thermal – Simulate at finite temperature.

Returns

Allocated system.

depinning_creep_2024.Preparation.check_copy(src: File, dst: File, rename: list = None, shallow: bool = True, attrs: bool = True, allow: dict = {}) None#

Check that all datasets in src are also in dst (check that "!=" and "->" are empty).

Parameters
  • src – Source file.

  • dst – Destination file.

  • rename – List of renamed datasets.

  • shallow – Do not check the contents of the datasets.

  • attrs – Check (existence of) attributes.

  • allow – List of datasets (regex) that are allowed to be different.

depinning_creep_2024.Preparation.compute_x(dynamics: str, sigma: ArrayLike, sigmay: ArrayLike) ndarray#

Compute the distance to yielding.

Parameters
  • dynamics – Dynamics ("default" or "depinning")

  • sigma – Stresses.

  • sigmay – Yield stresses.

Returns

Distance to yielding.

depinning_creep_2024.Preparation.convert_A_to_ell(A: ndarray, dim: int) ndarray#

Convert number of blocks that yielded at least once to a proxy for the linear extent. :param A: Number of blocks that yielded at least once. :param dim: Dimension.

depinning_creep_2024.Preparation.dump_snapshot(index: int, group: Group, system: SystemClass)#

Add/overwrite snapshot of the current state (fully recoverable).

Note

The snapshot is added to a multi-dimensional dataset containing all snapshots.

Parameters
  • index – Index of the snapshot to overwrite.

  • group – Group to store the snapshot in.

  • system – System.

depinning_creep_2024.Preparation.get_data_version(file: File) str#

Read the current data version from the file.

Parameters

file – Opened file.

Returns

Data version.

depinning_creep_2024.Preparation.get_dynamics(group: Group) str#

Read the dynamics from the file.

Parameters

group – Opened group "param" (read "dynamics").

Returns

Dynamics ("default" or "depinning")

depinning_creep_2024.Preparation.load_snapshot(index: int, group: Group, system: SystemClass) SystemClass#

Recover system from a snapshot.

Parameters
  • index – Index of the snapshot to read (None if snapshots are plain datasets).

  • group – Group of the snapshots.

  • system – System (modified).

Returns

System (modified).

depinning_creep_2024.Preparation.propagator(group: Group) tuple[numpy.ndarray, list[numpy.ndarray]]#

Return the propagator and the distances.

Parameters

group – Opened group "param" (read "interactions").

Returns

Propagator and distances.

depinning_creep_2024.Preparation.store_histogram(group: Group, hist: histogram) None#

Store the histogram.

Parameters
  • group – Data group.

  • hist – Histogram.