src.utils.io#

Functions

fn_gen(ud, dap, N)

get_args()

Argument parser for initial conditions and ensemble size.

init_logger(ud)

mkdir_p(path)

http://stackoverflow.com/a/600612/190597 (tzot)

sim_restart(path, name, elem, node, ud, Sol, ...)

Function to restart simulation from a saved file.

Classes

datetime(year, month, day[, hour[, minute[, ...)

The year, month and day arguments are required.

init(ud[, restart])

HDF5 writer class.

read_input(fn, path)

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#

udinputs.user_data.UserDataInit

Data container for the initial conditions

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#

Solmanagement.variable.Vars

Solution data container

mpvphysics.low_mach.mpv.MPV

Variables relating to the elliptic solver

elemdiscretization.kgrid.ElemSpaceDiscr

Cells grid

nodediscretization.kgrid.NodeSpaceDiscr

Nodes grid

thphysics.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.

vortz(Sol, elem, node)#

Calculate the vorticity of the solution in the x-y plane.

Parameters#

Solmanagement.variable.Vars

Solution data container

elemdiscretization.kgrid.ElemSpaceDiscr

Cells grid

nodediscretization.kgrid.NodeSpaceDiscr

Nodes grid

Returns#

ndarray

An ndarray with the vorticity of the solution and with the shape of node.

vorty(Sol, elem, node)#

Calculate the vorticity of the solution in the x-z plane.

Parameters#

Solmanagement.variable.Vars

Solution data container

elemdiscretization.kgrid.ElemSpaceDiscr

Cells grid

nodediscretization.kgrid.NodeSpaceDiscr

Nodes grid

Returns#

ndarray

An ndarray with the vorticity of the solution and with the shape of node.

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)#

http://stackoverflow.com/a/600612/190597 (tzot)

src.utils.io.init_logger(ud)#