bird.utilities package
Submodules
bird.utilities.mathtools module
- bird.utilities.mathtools.conditional_average(x: ndarray, y: ndarray, nbins: int = 32) tuple[ndarray, ndarray]
Compute a 1D conditional average of y with respect to x The conditional average is distributed to neighbors of the binned array when needed
- Parameters:
x (np.ndarray) – 1D array with respect to which conditional averaged is performed
y (np.ndarray) – 1D array conditioned
nbins (int) – Number of bins through x
- Returns:
x_cond (np.ndarray) – The binned array of values conditioned againsts
y_cond (np.ndarray) – The conditional averages at each bin
bird.utilities.ofio module
- bird.utilities.ofio.get_case_times(case_folder: str, remove_zero: bool = False) tuple[list[float], list[str]]
Get list of all time folders from an OpenFOAM case
- bird.utilities.ofio.get_species_name(case_folder: str, phase: str = 'gas') list[str]
Get list of species name in a phase
- bird.utilities.ofio.readSizeGroups(file)
- bird.utilities.ofio.read_bubble_diameter(case_folder: str, time_folder: str | None = None, n_cells: int | None = None, field_dict: dict | None = None) tuple[ndarray | float, dict]
Read bubble diameter at a given time and store it in dictionary for later reuse. A specific function is constructed so that if d.gas is not available, the bubble diameter is read from phaseProperties.
- Parameters:
case_folder (str) – Path to case folder
time_folder (str | None) – Name of time folder to analyze. If None, it will be found automatically
n_cells (int | None) – Number of cells in the domain. If None, it will deduced from the field reading
field_dict (dict | None) – Dictionary of fields used to avoid rereading the same fields to calculate different quantities
- Returns:
cell_volumes (np.ndarray | float) – Field of cell volumes
field_dict (dict) – Dictionary of fields read
- bird.utilities.ofio.read_cell_centers(case_folder: str, cell_centers_file: str | None = None, field_dict: dict | None = None) tuple[ndarray, dict]
Read field of cell centers and store it in dictionary for later reuse
- Parameters:
- Returns:
cell_centers (np.ndarray) – cell centers read from file
field_dict (dict) – Dictionary of fields read
- bird.utilities.ofio.read_cell_volumes(case_folder: str, time_folder: str | None = None, n_cells: int | None = None, field_dict: dict | None = None) tuple[ndarray | float, dict]
Read volume at a given time and store it in dictionary for later reuse
- Parameters:
case_folder (str) – Path to case folder
time_folder (str | None) – Name of time folder to analyze. If None, it will be found automatically
n_cells (int | None) – Number of cells in the domain. If None, it will deduced from the field reading
field_dict (dict | None) – Dictionary of fields used to avoid rereading the same fields to calculate different quantities
- Returns:
cell_volumes (np.ndarray | float) – Field of cell volumes
field_dict (dict) – Dictionary of fields read
- bird.utilities.ofio.read_field(case_folder: str, time_folder: str, field_name: str, n_cells: int | None = None, field_dict: dict | None = None) tuple[ndarray | float, dict]
Read field at a given time and store it in dictionary for later reuse
- Parameters:
case_folder (str) – Path to case folder
time_folder (str) – Name of time folder to analyze
field_name (str) – Name of the field file to read
n_cells (int | None) – Number of cells in the domain. If None, it will deduced from the field reading
field_dict (dict | None) – Dictionary of fields used to avoid rereading the same fields to calculate different quantities
- Returns:
field (np.ndarray | float) – Field read
field_dict (dict) – Dictionary of fields read
- bird.utilities.ofio.read_global_vars(case_folder: str | None = None, filename: str | None = None, cross_ref: bool = True) dict
Read globalVars into a python dictionary
- Parameters:
case_folder (str | None) – Path to case folder If None, using filename
filename (str | None) – Path to the globalVars file If None, using case_folder
cross_ref (bool) – Do cross referencing or no If True, all the #calc values from the python dict are replaced by their numeral values If False, all the #calc values are stored as string
- Returns:
globalVars_dict – Dictionary that contains the globals vars variable values
- Return type:
- bird.utilities.ofio.read_mu_liquid(case_folder: str, time_folder: str | None = None, n_cells: int | None = None, field_dict: dict | None = None) tuple[ndarray | float, dict]
Read liquid viscosity at a given time and store it in dictionary for later reuse. A specific function is constructed so that if thermo:mu.liquid is not available, the liquid viscosity is read from globalVars
- Parameters:
case_folder (str) – Path to case folder
time_folder (str | None) – Name of time folder to analyze. If None, it will be found automatically
n_cells (int | None) – Number of cells in the domain. If None, it will deduced from the field reading
field_dict (dict | None) – Dictionary of fields used to avoid rereading the same fields to calculate different quantities
- Returns:
cell_volumes (np.ndarray | float) – Field of cell volumes
field_dict (dict) – Dictionary of fields read
- bird.utilities.ofio.read_openfoam_dict(filename: str) dict
Parse OpenFOAM dictionary into a python dictionary
- bird.utilities.ofio.species_name_to_mw(case_folder: str, species_name: str) float
Get molecular weight in \(kg/mol\) from the species name. In order of availability, the molecular weight is read from the thermophysicalProperties.XXX, and globalVars. If nothing is found in globalVars (last resort) an error is raised. This function is primarily useful to compute concentrations
bird.utilities.parser module
bird.utilities.stl_plotting module
- bird.utilities.stl_plotting.plotSTL(stl_file)