ppModule package
Subpackages
Main Interface Module
ppModule.binFiles package
Submodules
ppModule.binFiles.read_grid module
Module to read grid files from Musicaa. The grid files are in binary file format.
The grid files are read from the repository and a tuple containing the grid data is returned. The grid data is stored in dictionnaries containing x, y, z coordinates.
The grid data is read from the binary file using the numpy.fromfile() function. The grid data is reshaped to the correct dimensions using the numpy.reshape() function.
Classes:
- ReadGrid: class to read grid from binary files, this clss also handles
old classes without ghost points.
- class ppModule.binFiles.read_grid.ReadGrid(directory: str, config: dict)[source]
Bases:
object
Abstract class to implement some common methods and attributes for reading grid files.
Attributes:
dir (str): Directory containing the grid files. nbloc (int): Number of blocks in the domain. info (dict): Dictionary containing information about the grid. ngh (int): Number of ghost cells.
- property directory
Property to get the directory where the grid can be found.
ppModule.binFiles.read_snapshots module
Module to read Musicaa’s snapshots from binary files.
The snapshots are returned in a dictionary with block IDs, variable names, and arrays. The module is used by the ppModule to read the snapshots from the binary files. It also provides a static method to read 2D binary data, which can be used to read statistics or other related data.
Classes
- ReadSnapshots
Abstract class to read snapshots from binary files.
- ReadPlanes
Class to read planes from binary files.
- ReadLines
Class to read lines from binary files.
- ReadPoints
Class to read points from binary files.
- class ppModule.binFiles.read_snapshots.ReadLines(repo: str, info: dict, snapshots_info: dict)[source]
Bases:
ReadSnapshots
Class to read lines from binary files.
This class is used by the ppModule to read lines from binary files.
Attributes:
- dirstr
Directory where the binary files are located.
- infodict
Dictionary containing information from the info.ini file.
- snapshots_infodict
Dictionary containing information about the snapshots.
- read_line()
Read lines from binary files.
- read_line_block(filename, n1, nvar)[source]
Read lines from binary files for one block, is called by the read_line method.
- class ppModule.binFiles.read_snapshots.ReadPlanes(repo: str, info: dict, snapshots_info: dict)[source]
Bases:
ReadSnapshots
Class to read planes from binary files.
This class is used by the ppModule to read planes from binary files. It also provides a static method to read 2D binary data, which can be used to read statistics or other related data.
Attrblock_idutes
- dirstr
Directory where the binary files are located.
- infodict
Dictionary containing information from the info.ini file.
- snapshots_infodict
Dictionary containing information about the snapshots.
- read_2d(filename, n1, n2, nvar)[source]
Read 2D binary data in a block. Used to read planes, stats, etc.
- class ppModule.binFiles.read_snapshots.ReadPoints(repo: str, info: dict, snapshots_info: dict)[source]
Bases:
ReadSnapshots
Class to read points from binary files.
This class is used by the ppModule to read points from binary files.
Attributes:
- dirstr
Directory where the binary files are located.
- infodict
Dictionary containing information from the info.ini file.
- snapshots_infodict
Dictionary containing information about the snapshots.
- class ppModule.binFiles.read_snapshots.ReadSnapshots(repo: str, info: dict, snapshots_info: dict)[source]
Bases:
object
Abstract class to read snapshots from binary files.
This class implements common methods to read snapshots from bianry files.
Attributes:
- infodict
Dictionary containing information from the info.ini file.
- directorystr
Directory where the binary files are located.
- snapshots_infodict
Dictionary containing information about the snapshots.
- self.info_planedict
Dictionary containing information about the planes.
- self.info_pointdict
Dictionary containing information about the points.
- self.info_linedict
Dictionary containing information about the lines.
- self.info_volume: dict
Dictionary containing information about the volumes.
- _process_planes(block_id, snapshot_id)
(private) Process information of a plane and return a dictionary with the information.
- _process_lines(block_id, snapshot_id)
(private) Process information of a line and return a dictionary with the information.
- _process_points(block_id, snapshot_id)
(private) Process information of a point and return a dictionary with the information.
- _process_volumes(block_id, snapshot_id)
(private) Process information of a volume and return a dictionary with the information.
- process_lines(block_id: int, snapshot_id: int) dict [source]
Methods to process information of a line and return a dictionary with the information.
Args:
- block_idint
block id in which the line information are being processed.
- snapshot_idint
ID of the snapshot being processed, corresponds to its order in the param_blocks.ini .
- self.info_linedict
Dictionary containing information about the lines.
- returns:
Dictionary with the processed information of the line.
- rtype:
dict
- process_planes(block_id: int, snapshot_id: int) dict [source]
Methods to process information of a plane and return a dictionary with the information.
Args:
- block_idint
block id in which the plane information are being processed.
- snapshot_idint
ID of the snapshot being processed, corresponds to its order in the param_blocks.ini .
- self.info_planedict
Dictionary containing information about the planes.
- returns:
Dictionary with the processed information of the plane.
- rtype:
dict
- process_points(block_id: int, snapshot_id: int) dict [source]
Process points information. Similar to _process_planes, but for points.
- process_snapshots() tuple [source]
Process snapshots information to get planes’ information.
Useful if the number of snapshots is not equal to the number of planes. For example, when saving lines or points along with planes.
- Returns:
Dictionary containing processed information about planes.
- Return type:
ppModule.binFiles.read_stats module
Module to read stats from Musicaa simulation. The stats are used for all post-processing modules.
The steady simulations are also postprocessed using the statistics.
- class ppModule.binFiles.read_stats.ReadStats(directory: str, case: str, info: dict)[source]
Bases:
object
Class to read post-processing statistics from Musicaa simulation. The correct methods are in utils_stats.py. The methods must be named as follow: stats_{case_name} where case_name is the name of the case specified in the param.ini file. The case name is converted to lower case. The case name is used to select the correct method to read the statistics.
The stats are returned as a dictionary with the following structure: [<block_id>][<variable_name>] = <value>
- property case
Define a case property, it is the case specified in Musicaa simulation in the param.ini file.
It allows to read the correct statistics files.
ppModule.compute package
Submodules
ppModule.compute.compute_2d_curv module
ppModule.iniFiles package
Submodules
ppModule.iniFiles.read_ini module
Module to read *.ini file, which contains information about simulations
Classes:
ParamBlockReader: This class reads the param_blocks file, it helps get information about
snapshots and boundary conditions. * InfoReader: This class reads the info file, it helps get information about the grid and the simulation parameters. * FeosReader: This class reads the feos file, it helps get information about the fluid properties. * Reader: This is an abstract class that contains shared methods and attributes for all the classes above.
- class ppModule.iniFiles.read_ini.FeosReader(file_path: str, fluid: str)[source]
Bases:
Reader
Class to read feos_{fluid}.ini file, which containts information about the fluid properties. This is useful to compute Flow-Through domaine Time and other characteristis of each simulation.
It is mainly useful to run unsteady simulations using Musicaa’s wrapper.
fluid (str): fluid name
feos (dict): dictionnary containing all information data
- class ppModule.iniFiles.read_ini.InfoReader(file_path: str)[source]
Bases:
Reader
Class to read info.ini file, which contains generic information about the simulation. It returns a dictionary containing all necessary information.
- Attributes:
file_path (str): path to info.ini file
- Methods:
_read_ini_file: (private), method to read info.ini file
get_value: returns value of a specific key
is_valid_key: checks if the key given in get_value is valid or not.
TypeError: if the key given is not a string
- class ppModule.iniFiles.read_ini.ParamBlockReader(file_path: str)[source]
Bases:
Reader
Class to read param_blocks.ini file, which contains information about mesh: * Number of blocks * Number of points in each direction * Number of processors in each direction * Boundary conditions * Sponge zone * Snapshots
- Attributes:
file_path (str): path to param_blocks.ini file
block_info (dict): dictionnary containing all information data.
- The block_info dictionnary has the following structure:
- {
- block_id: {
‘Nb points’: {‘I’: int, ‘J’: int, ‘K’: int}, ‘Nb procs’: {‘I’: int, ‘J’: int, ‘K’: int}, ‘Boundary conditions’: [list], ‘Sponge zone’: [list], ‘Snapshots’: [list] (this list is empy, the snapshots are read in the read_snapshots methos)
}
}
snapshots_info (dict): dictionnary containing all snapshots information.
- The snapshots_info dictionnary has the following structure:
- {
block_id: { [ number of snapshots, {
‘I1’: int, ‘I2’: int, ‘J1’: int, ‘J2’: int, ‘K1’: int, ‘K2’: int, ‘freq’: int, ‘nvar’: int, ‘list_var’: [list of variables]
}, … there are as many dictionnaries as the number of snapshots in the list ]
}
- Methods:
read_block_info: Read block information from param_blocks.ini file. read_snapshots: Read snapshots information from param_blocks.ini file. process_points_procs: (private), Process number of points and processors in each direction. process_boundary_conditions: (private), Process boundary conditions. process_sponge_zone: (private), Process sponge zone.
- property actions
Actions to perform based on the line content.
- Returns:
dict: Actions to perform based on the line content.
- read_block_info() dict [source]
Initialize the ParamBlockReader with the path to the param_blocks.ini file.
- Args:
file_path (str): Path to the param_blocks.ini file.
- Returns:
dict: Block information, contains number of points in each direction for each block, number of procs in each direction, boundary conditions, sponge zone information if it exists and snapshots. The dictionnary has the following structure:
ppModule.utils package
Submodules
ppModule.utils.preprocess_snapshots module
This module contains utilities to preprocess snapshots before plotting them.
- class ppModule.utils.preprocess_snapshots.PreProcessLines(snapshot_info: dict, info: dict, config: dict)[source]
Bases:
object
Class to preprocess lines to get coordinates and appropriate values of the line in space, takes into consideration the grid type and the solver used (cartesian 2D curvliniear, full 3D curvlinear).
- class ppModule.utils.preprocess_snapshots.PreProcessPlanes(snapshot_info: dict, info: dict, config: dict)[source]
Bases:
object
This class contains methods to preprocess Planes before plotting them.
- grid(plane_id: int, block_id: int)[source]
Method to preprocess grid to return appropriate coordinates to plot planes
Takes into consideration
- class ppModule.utils.preprocess_snapshots.PreprocessPoints(snapshot_info: dict, info: dict, config: dict)[source]
Bases:
object
Class to preprocess points to get coordinates of the point in space, takes into consideration the grid type and the solver used (cartesian 2D curvliniear, full 3D curvlinear).
ppModule.utils.stats_reader module
Utils file containts routines to read stats for different cases from Musicaa output files The functions are called in read_stats module depending on the case.
- class ppModule.utils.stats_reader.StatsReader[source]
Bases:
object
Class containing static methods only to read statistic for different musicaa cases
- static stats_chan(directory: str, info=None) dict [source]
Function to read stats of the channel flow case. The stats are read from the stats.dat file
Args: directory: str
The directory where the stats files are located
- kwargs: dict containing the following keys
None
Returns: _stats: dict
A dictionary containing the stats of the simulation
- static stats_stbl(directory: str, info: dict) dict [source]
Function to read stats of the stbl case. The stats are read from the file stats_bl%{i}.bin files
Args: directory: str
The directory where the stats files are located
- kwargs: dict containing the following keys
- nbloc: int
The number of blocks in the simulation
- nx: dict
The number of cells in x direction for each block
- ny: dict
The number of cells in y direction for each block
Returns: _stats: dict
A dictionary containing the stats of the simulation
- static stats_turb(directory: str, info: dict) dict [source]
Function to read stats of the turb case. The stats are read from the file stats_bl%{i}.bin files
Args: directory: str
The directory where the stats files are located
- kwargs: dict containing the following keys
- nbloc: int
The number of blocks in the simulation
- nx: dict
The number of cells in x direction for each block
- ny: dict
The number of cells in y direction for each block
Returns: _stats: dict
A dictionary containing the stats of the simulation