Skip to main content

simulation

Simulation

A single dataset/simulation. Used to write to it, read from it or append.

Simulation (
uid: str,
path: str,
comm: mpi4py.MPI.Comm = <mpi4py.MPI.Intracomm object>
)
Parameters:
  • uid : <class 'str'>

    unique identifier

  • path : <class 'str'>

    path to parent/database folder

  • comm : <class 'mpi4py.MPI.Comm'>

    MPI communicator (default=MPI.COMM_WORLD)

Variables:

fromUID

fromUID (cls, full_uid: str) -> Self

Return the `Simulation` with given UID.

Parameters:
  • cls : Any

  • full_uid : <class 'str'>

    the full id (Database uid : simulation uid)

Returns:
    typing.Self

Simulation[key]

__getitem__ (self, key) -> bamboost.common.hdf_pointer.BasePointer

Direct access to HDF5 file.

Parameters:
  • self : Any

  • key : Any

files

files (self, filename: str) -> str

Get the path to the file.

Parameters:
  • self : Any

  • filename : <class 'str'>

    name of the file

Returns:
    <class 'str'>

show_files

show_files (
self,
level=-1,
limit_to_directories=False,
length_limit=1000,
printit=True
) -> str

Show the file tree of the simulation directory.

Parameters:
  • self : Any

  • level : Any

    how deep to print the tree

  • limit_to_directories : Any

    only print directories

  • length_limit : Any

    cutoff

  • printit : Any

Returns:
    <class 'str'>

open_in_file_explorer

open_in_file_explorer (self) -> None

Open the simulation directory. Uses `xdg-open` on linux systems.

Parameters:
  • self : Any

Returns:
    None

get_full_uid

get_full_uid (self) -> str

Returns the full uid of the simulation (including the one of the database)

Parameters:
  • self : Any

Returns:
    <class 'str'>

change_status

change_status (self, status: str) -> None

Change status of simulation.

Parameters:
  • self : Any

  • status : <class 'str'>

    new status

Returns:
    None

update_metadata

update_metadata (self, update_dict: dict) -> None

Update the metadata attributes.

Parameters:
  • self : Any

  • update_dict : <class 'dict'>

    dictionary to push

Returns:
    None

update_parameters

update_parameters (self, update_dict: dict) -> None

Update the parameters dictionary.

Parameters:
  • self : Any

  • update_dict : <class 'dict'>

    dictionary to push

Returns:
    None

create_xdmf_file

create_xdmf_file (self, fields: list = None, nb_steps: int = None) -> None

Create the xdmf file to read in paraview.

Parameters:
  • self : Any

  • fields : <class 'list'>

    fields for which to write timeseries information, if not specified, all fields in data are written.

  • nb_steps : <class 'int'>

    number of steps the simulation has

Returns:
    None

create_batch_script

create_batch_script (
self,
commands: list = None,
nnodes=1,
ntasks=4,
ncpus=1,
time='04:00:00',
mem_per_cpu=2048,
tmp=8000,
euler=True
) -> None

Create a batch job and put it into the folder.

Parameters:
  • self : Any

  • commands : <class 'list'>

    A list of strings being the user defined commands to run

  • nnodes : Any

    nb of nodes (default=1)

  • ntasks : Any

    nb of tasks (default=4)

  • ncpus : Any

    nb of cpus per task (default=1)

  • time : Any

    requested time (default=4 hours)

  • mem_per_cpu : Any

    memory (default=2048)

  • tmp : Any

    temporary storage, set None to exclude option (default=8000)

  • euler : Any

    If false, a local bash script will be written

Returns:
    None

submit

submit (self) -> None

Submit the job for this simulation.

Parameters:
  • self : Any

Returns:
    None

change_note

change_note (self, note) -> None

None

Parameters:
  • self : Any

  • note : Any

Returns:
    None

open

open (
self,
mode: str = 'r',
driver=None,
comm=None
) -> bamboost.common.file_handler.FileHandler

Use this as a context manager in a `with` statement. Purpose: keeping the file open to directly access/edit something in the HDF5 file of this simulation.

Parameters:
  • self : Any

  • mode : <class 'str'>

    file mode (see h5py docs)

  • driver : Any

    file driver (see h5py docs)

  • comm : Any

    mpi communicator

get_mesh

get_mesh (self, mesh_name: str = None) -> Tuple[numpy.ndarray, numpy.ndarray]

Return coordinates and connectivity. Currently returns numpy arrays.

Parameters:
  • self : Any

  • mesh_name : <class 'str'>

    optional, name of mesh to read (default = mesh)

Returns:
    typing.Tuple[numpy.ndarray, numpy.ndarray]

    Tuple of np.arrays (coordinates, connectivity)

get_data_interpolator

get_data_interpolator (self, field: str, step: int)

Get Linear interpolator for data field at step. Uses the linked mesh.

Parameters:
  • self : Any

  • field : <class 'str'>

  • step : <class 'int'>

    step

Returns:

show_h5tree

show_h5tree (self) -> None

Print the tree inside the h5 file.

Parameters:
  • self : Any

Returns:
    None

Link group. Used to create and access links. I don't know how to distribute this to its own file in the accessors directory, due to circular imports.

Links (file_handler: bamboost.common.file_handler.FileHandler)
Variables:

    Links[key]

    __getitem__ (self, key) -> bamboost.simulation.Simulation

    Returns the linked simulation object.

    Parameters:
    • self : Any

    • key : Any

    Links[key] = ...

    __setitem__ (self, key, newvalue)

    Creates the link.

    Parameters:
    • self : Any

    • key : Any

    • newvalue : Any

    Returns:
      <class 'inspect._empty'>

    all_links (self) -> dict

    None

    Parameters:
    • self : Any

    Returns:
      <class 'dict'>