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>
)
- uid :
<class 'str'>
unique identifier
- path :
<class 'str'>
path to parent/database folder
- comm :
<class 'mpi4py.MPI.Comm'>
MPI communicator (default=MPI.COMM_WORLD)
- uid :
: str
- path_database :
: str
- path :
: str
- h5file :
: str
- xdmffile :
: str
- meshes :
bamboost.accessors.meshes.MeshGroup
- data :
bamboost.accessors.fielddata.DataGroup
- userdata :
bamboost.common.hdf_pointer.MutableGroup
- links :
bamboost.simulation.Links
- parameters :
: dict
- metadata :
: dict
- mesh :
: Tuple[numpy.ndarray, numpy.ndarray]
Return coordinates and connectivity of default mesh.
- globals :
: pandas.core.frame.DataFrame
Return global data.
- data_info :
: 'pd.Dataframe'
View the data stored.
- git :
: dict
Get Git information.
fromUID
fromUID (cls, full_uid: str) -> Self
Return the `Simulation` with given UID.
- cls :
Any
- full_uid :
<class 'str'>
the full id (Database uid : simulation uid)
typing.Self
Simulation[key]
__getitem__ (self, key) -> bamboost.common.hdf_pointer.BasePointer
Direct access to HDF5 file.
- self :
Any
- key :
Any
files
files (self, filename: str) -> str
Get the path to the file.
- self :
Any
- filename :
<class 'str'>
name of the file
<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.
- self :
Any
- level :
Any
how deep to print the tree
- limit_to_directories :
Any
only print directories
- length_limit :
Any
cutoff
- printit :
Any
<class 'str'>
open_in_file_explorer
open_in_file_explorer (self) -> None
Open the simulation directory. Uses `xdg-open` on linux systems.
- self :
Any
None
get_full_uid
get_full_uid (self) -> str
Returns the full uid of the simulation (including the one of the database)
- self :
Any
<class 'str'>
change_status
change_status (self, status: str) -> None
Change status of simulation.
- self :
Any
- status :
<class 'str'>
new status
None
update_metadata
update_metadata (self, update_dict: dict) -> None
Update the metadata attributes.
- self :
Any
- update_dict :
<class 'dict'>
dictionary to push
None
update_parameters
update_parameters (self, update_dict: dict) -> None
Update the parameters dictionary.
- self :
Any
- update_dict :
<class 'dict'>
dictionary to push
None
create_xdmf_file
create_xdmf_file (self, fields: list = None, nb_steps: int = None) -> None
Create the xdmf file to read in paraview.
- 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
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.
- 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
None
submit
submit (self) -> None
Submit the job for this simulation.
- self :
Any
None
change_note
change_note (self, note) -> None
None
- self :
Any
- note :
Any
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.
- 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.
- self :
Any
- mesh_name :
<class 'str'>
optional, name of mesh to read (default = mesh)
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.
- self :
Any
- field :
<class 'str'>
- step :
<class 'int'>
step
<class 'inspect._empty'>
show_h5tree
show_h5tree (self) -> None
Print the tree inside the h5 file.
- self :
Any
None
Links
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)
- file_handler :
bamboost.common.file_handler.FileHandler
Links[key]
__getitem__ (self, key) -> bamboost.simulation.Simulation
Returns the linked simulation object.
- self :
Any
- key :
Any
Links[key] = ...
__setitem__ (self, key, newvalue)
Creates the link.
- self :
Any
- key :
Any
- newvalue :
Any
<class 'inspect._empty'>
all_links
all_links (self) -> dict
None
- self :
Any
<class 'dict'>