src.utils.io#
Functions
|
|
|
Argument parser for initial conditions and ensemble size. |
|
|
|
|
|
Function to restart simulation from a saved file. |
Classes
|
The year, month and day arguments are required. |
|
HDF5 writer class. |
|
- class src.utils.io.init(ud, restart=False)#
HDF5 writer class. Contains methods to create HDF5 file, create data sets and populate them with output variables.
- __init__(ud, restart=False)#
Creates HDF5 file based on filename given attribute OUTPUT_FILENAME.
Parameters#
- ud
inputs.user_data.UserDataInit
Data container for the initial conditions
- ud
- io_create_file(paths, restart)#
Helper function to create file.
Parameters#
- pathslist
List of strings containing the name of the data sets. For now,
PATH = [‘dp2_nodes’, ‘drhoY’, ‘dT’, ‘dY’, ‘p2_nodes’, ‘rho’, ‘rhoY’, ‘Y’]
Notes#
Currently, if the filename of the HDF5 file already exists, this function will append the existing filename with ‘_old’ and create an empty HDF5 file with the same filename in its place.
- write_all(Sol, mpv, elem, node, th, name)#
At a given time, write output from Sol and mpv to the HDF5 file.
Parameters#
- Sol
management.variable.Vars
Solution data container
- mpv
physics.low_mach.mpv.MPV
Variables relating to the elliptic solver
- elem
discretization.kgrid.ElemSpaceDiscr
Cells grid
- node
discretization.kgrid.NodeSpaceDiscr
Nodes grid
- th
physics.gas_dynamics.thermodynamic.init
Thermodynamic variables of the system
- name: str
The time and additional suffix label for the dataset, e.g. “_10.0_after_full_step”, where 10.0 is the time and “after_full_step” denotes when the output was made.
- Sol
- vortz(Sol, elem, node)#
Calculate the vorticity of the solution in the x-y plane.
Parameters#
- Sol
management.variable.Vars
Solution data container
- elem
discretization.kgrid.ElemSpaceDiscr
Cells grid
- node
discretization.kgrid.NodeSpaceDiscr
Nodes grid
Returns#
- ndarray
An ndarray with the vorticity of the solution and with the shape of node.
- Sol
- vorty(Sol, elem, node)#
Calculate the vorticity of the solution in the x-z plane.
Parameters#
- Sol
management.variable.Vars
Solution data container
- elem
discretization.kgrid.ElemSpaceDiscr
Cells grid
- node
discretization.kgrid.NodeSpaceDiscr
Nodes grid
Returns#
- ndarray
An ndarray with the vorticity of the solution and with the shape of node.
- Sol
- dpress_dim(mpv, ud, th)#
- populate(name, path, data, options=None)#
Helper function to write data into HDF5 dataset.
Parameters#
- namestr
The time and additional suffix label for the dataset
- pathstr
Path of the dataset, e.g. rhoY.
- datandarray
The output data to write to the dataset
- optionslist
default == None. Additional options to write to dataset, currently unused.
- write_attrs()#
Method to write all attributes in the userdata initial condition to HDF5 file.
- write_da_attrs(params)#
Method to write all data-assimilation attributes in the userdata initial condition to HDF5 file.
- close_everything()#
In parallel, some workers do not close file correctly, this function forces the program to close the HDF file before exiting.
- check_jar()#
- jar(content=None)#
- class src.utils.io.read_input(fn, path)#
- __init__(fn, path)#
- get_data(Sol, mpv, time_tag, half=False)#
- src.utils.io.get_args()#
Argument parser for initial conditions and ensemble size.
- src.utils.io.sim_restart(path, name, elem, node, ud, Sol, mpv, restart_touts)#
Function to restart simulation from a saved file. Dataset has to be structured in the same way as the output format of this file.
Parameters#
- pathstr
path to the hdf5 file for simulation restart.
- src.utils.io.fn_gen(ud, dap, N)#
- src.utils.io.mkdir_p(path)#
- src.utils.io.init_logger(ud)#