Preparation#
Generate random realizations.
Functions
|
Generate IO files, and compute and write initial states. |
|
Upgrade data to the current version. |
|
Check that the data is of the correct version. |
|
Allocate the system. |
|
Check that all datasets in |
|
Compute the distance to yielding. |
|
Convert number of blocks that yielded at least once to a proxy for the linear extent. |
|
Add/overwrite snapshot of the current state (fully recoverable). |
|
Read the current data version from the file. |
|
Read the dynamics from the file. |
|
Recover system from a snapshot. |
|
Return the propagator and the distances. |
|
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
--helpfor 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_fileis 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
Noneif executed, parser ifreturn_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
--helpfor details. Default:sys.argv[1:]is used._return_parser – Return parser instead of executing (for documentation).
- Returns
Noneif executed, parser ifreturn_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_stress –
Trueif 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
srcare also indst(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 (
Noneif 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.