libICEpost
@author: F. Ramognino <federico.ramognino@polimi.it> Last update: 9/03/2023
- Package with useful classes and executables and function for pre/post processing of data in the context of internal combustion engines and CFD simulations”
-> Processing of experimental measurements on ICEs -> Processing of results of CFD simulations -> Computation of mixture compositions (external/internal EGR, thermophysical properties) -> Processing of laminar flame speed correlations and OpenFOAM tabulations -> Handling, reading/writing, and assessment of OpenFOAM tabulations
Content of the package: TODO: Add description
Submodules
Attributes
Classes
Class wrapping useful methods for base virtual classes (e.g. run-time selector) |
|
Ordered dictionary embedding some useful OpenFOAM-like methods. |
Package Contents
- libICEpost.database
- class libICEpost.BaseClass[source]
Bases:
libICEpost.src.base.Utilities.UtilitiesClass wrapping useful methods for base virtual classes (e.g. run-time selector)
- classmethod selectionTable() SelectionTable[source]
The run-time selection table associated to this class.
- classmethod selector(typeName: str, dictionary: dict) BaseClassType[source]
Construct an instance of a subclass of this that was added to the selection table.
- Parameters:
typeName (str) – Name of the subclass to instantiate
dictionary (dict) – Dictionary containing the data to construct the class.
- Returns:
Instance of the specific class.
- Return type:
BaseClassType
- classmethod fromDictionary(dictionary: dict) BaseClassType[source]
- Abstractmethod:
Construct an instance of this class from a dictionary. To be overwritten by derived class.
- Parameters:
dictionary (dict) – Dictionary containing the data to construct the class.
- Returns:
Instance of the specific class.
- Return type:
BaseClassType
- classmethod addToRuntimeSelectionTable(childClass: BaseClassType, *, overwrite: bool = True) None[source]
Add the subclass to the database of available subclasses for runtime selection.
- Parameters:
childClass (BaseClassType) – Subclass to add to the selection table
overwrite (bool, optional) – Overwrite if present? Defaults to True.
- class libICEpost.Dictionary(*args, _fileName: str = None, **argv)[source]
Bases:
collections.OrderedDict,libICEpost.src.base.Utilities.UtilitiesOrdered dictionary embedding some useful OpenFOAM-like methods.
- path: str | None
- file: str | None
- classmethod fromFile(fileName: str)[source]
- fileName: str
Path of the file
Read the variables stored in a python file (Runs the code in the file and retrieves the local variables)
NOTE: local variable ‘this’ for this file. You can access the local folder as ‘this.path’ within the dictionary.
- lookup(entryName: str, *, varType: T | Iterable[type] = None) T | Any[source]
Same as __getitem__ but embeds error handling and type checking.
- Parameters:
entryName (str) – Name of the entry to look for
varType (type|Iterable[type], optional) – Type of the variable to lookup for. Performes type-checking if it is given. Defaults to None.
- Raises:
KeyError – If the entry is not found
TypeError – If the type is not consistent with varType
- Returns:
self[entryName]
- Return type:
varType|Any
- pop(entryName: str)[source]
- entryName: str
Name of the entry to look for
Same as dictionary.pop but custom error message
- lookupOrDefault(entryName: str, default: T, fatal: bool = True) T[source]
Lookup of give a default value if not found
- Parameters:
entryName (str) – Name of the entry to look for
default (T) – Instance to return in case the value is not found. It is also used for typeChecking
fatal (bool, optional) – If the type is not consistent rise a TypeError. Defaults to True.
- Returns:
self[entryName] if entryName is found, else default
- Return type:
T