Skip to main content

libICEpost

Postprocessing of data sampled from internal combustion engines (Experimental, 1D/0D (Gasdyn/GT-Power), 3D (LibICE-OpenFOAM/commercial codes), etc.)

Installation

Requirements

Conda

It is suggested to use Anaconda python environment manager to use the library, so that the correct python version can be used in a dedicated environment. Currently working on python version 3.11.4.

Open a new terminal in the folder and execute the following line to install Python 3.11, which is required.

conda install python==3.11

You may want to install it in a dedicated environment, to prevent conflicts between packages and python versions. Here is an example to create the dedicated environment ICE:

conda create --name ICE python==3.11

Then you can activate the environment with:

conda activate ICE

From now, you should see the (ICE) entry at the beginning of the command line, showing you are in the python environment ICE.

Visual Studio Code

Installation of Visual Studio Code (VS Code) is suggested. Follow the instructions to install the program. The following extension for Python has to be installed Python Extension Pack.

GIT

GIT is necessary to download the repository. Follow the instructions to install the program. No further action are necessary.

Downloading and installing the source code of LibICE-post

Download

In order to download the source code of LibICE-post proceed as follows:

  1. Create a new folder in your home directory (C:\Users\<username> on Windows OS, /home/<username> on Debian) called LibICE_repo, where the various libraries will be stored;
  2. Now open VS Code and with the Open Folder command, under the File tab open the folder you just created;
  3. You should find yourself in VS Code with the Explorer bar on the left that has the name of the folder you created as title.

screenshot

Now open a new terminal by clicking on New Terminal in the Terminal menu (Ctrl+shitf+ò keyboard shortcut on Windows OS). A window on the bottom of VS Code should have appeared. In the terminal, copy the following command to download LibICE-post:

git clone https://github.com/RamogninoF/LibICE-post.git

You should now see in the explorer bar that a new LIBICE-POST tab has appeared, like so

screenshot

Installing LibICE-post

Now that LibICE-post is downloaded, it is to be installed. First, activate the conda environment where you want to install the libraries (in this example ICE).

conda activate ICE

Then you can install it:

pip install ./LibICE-post

Follow the instruction on the terminal and you should see the following line as a result.

Successfully installed libICEpost

Usage

Now that libICEpost is installed, you can start to use it. To do so, under LibICE-post\tutorials\sparkIgnition you find a simple case intended to be used as base to understand the usage of this tool. Please duplicate the sparkIgnition folder in another location of your choice and the open that folder in VS Code. You should find yourself in this image.

screenshot

Setting the dictionaries

In the dictionaries folder you find four different Python scripts that will be used to compose the dictionary used by the post-processing tool. In particular these are:

  • combustionProperties.py, used to specify the initial mixture of the charge trapped inside the cylinder;
  • dataDict.py, used to determine the pre-processing of the data that will be used in the tool;
  • thermophysicalProperties.py used to choose the models to compute the various thermodynamic quantities;
  • controlDict.py, acts as wrapper of the previous three files and allows the specification of engine-specific features and the crank angle period of interest to be processed.

The user is highly encouraged to read and understand each of these files as they greatly influence the results of the post-processing.

Additional documentation will be provided in later releases.

Including the data

The data folder contains the experimental/simulated data that will be imported by the tool to be processed. The minimum requirement is to have a in-cylinder pressure file (in this case the p.cyl file). It is not necessary that your data is formatted in the same way as the one in the tutorial case. You can specify the reading of a given format in the dataDict.py script. In the proposed case the reading of pressure is performed as follow in dataDict.py:

#Pressure (mandatory)
"p":\ #specify how the variables will be called in runtime
{
    #The format of the data to load
    "format":"file",    #Retrieve from file
    
    #The parameters to use
    "data":
    {
        #Name of the file
        "fileName":"p.Cyl",
        
        #Options to apply (scaling, shifting, etc.)
        "opts":\
            {
                #"delimiter":",",   #Delimiter in file, in this case there was no delimiter !
                # "varScale":1.0,   #Scaling variable
                # "varOff":0.0,     #Offset to variable
                # "CAscale":1.0,    #Scaling CA
                # "CAoff":0.0,      #Offset to CA
            }
    }
},

As specified before, the pressure is the only mandatory data needed as import. However, other quantities can and have to specified, such as the mass at IVC, the wall temperatures and others. The user can decide to specify any variable of interest by reading those from files, by considering them constant or by defining a specific function.

Running the main.py script

After having set-up the files in the dictionaries folder and having made sure to include in the data folder the required quantities, you can open the main.py file in which you'll find the main script to postprocess the data.

The main.py script is mainly divided of two parts: data processing and post-processing. The former is composed of the loading of the model from the various dictionaries stored in the dictionariesdirectory, plus the call to the processing of the data.

#Load the model
model = loadModel("./dictionaries/")

#Process the data in the engine model
model.process()

The following part of the code is intended to post-process the data that was processed by the tool. Here you can define some specific plots you want to see like a p-V diagram, which is already implemented as part of the model class:

#Plotting p-V diagram
ax = model.plotPV(label="CFD", timingsParams={"markersize":120, "linewidth":2})
plt.tight_layout()

It is possible to produce user-defined plots with the model.data.plot() function, like done here:

#Plotting ROHR vs CA diagram
model.data.plot(x = "CA", y="ROHR", label="CFD", legend=True, c="k", figsize=(10,10))
plt.xlabel("Crank angle [CA]")
plt.ylabel("Rate of heat release [J/deg]")
plt.tight_layout()

You can change the x and y axes as you wish, paying attention that they are defined in the model.data structure.

To launch the script use the Run Python File command on the upper-right corner.

screenshot

A terminal should open and two plots should appear.

From this simple case setup you can explore and expand to run the postprocess you wish. A brief documentation (that will be expanded) is reported in each of the files under the dictionaries folder.

In the data folder, the data that has to be processed has to be included.

Additional documentation can be found in references

Troubleshooting

Sometimes, for Windows user, when reopening VS Code the following orange warning may appear in the terminal tab

screenshot

If this happens, please click on Relaunch Terminal with hovering (not clicking) on cmd. The next time you reopen the folder it should not happen again.

Installation

  • Ubuntu 18.04: Installation may fail when compiling CANTERA due to missing BLAS library. If so, install an older version of CANTERA:
pip install cantera==3.0.0

Installing from PyPI (skip for ICEGroup)

Installation from PyPI repositories (not up-to-date):

pip install libICEpost

Contributing

  • Federico Ramognino - Code development (all of it)
  • Alberto Ballerini - Testing and documentation

License

libICEpost was created by Federico Ramognino. It is licensed under the terms of the MIT license.

Credits

libICEpost was created with cookiecutter and the py-pkgs-cookiecutter template.

Metadata

Release files for libICEpost 0.10.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for libICEpost 0.10.4
File Size Uploaded Provenance Actions
libicepost-0.10.4.tar.gz 135.2 kB Without provenance Details for libicepost-0.10.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for libICEpost 0.10.4
File Interpreter ABI Platform Actions
libicepost-0.10.4-py3-none-any.whl Python 3 none any Details for libicepost-0.10.4-py3-none-any.whl

Total release size: 326.6 kB

Release files / libicepost-0.10.4.tar.gz

Download URL libicepost-0.10.4.tar.gz
Size 135.2 kB
Tags Source
SHA-256 checksum
How to use checksums
4d3822f572163eb16c8200477d9835e9bae806284048a756240bb2dc39e44b2a
BLAKE2b-256 checksum
How to use checksums
431438f8552c33b71b0332892a02debb1244ac8ad970c278d30a18de6f9a9693
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.0

Release files / libicepost-0.10.4-py3-none-any.whl

Download URL libicepost-0.10.4-py3-none-any.whl
Size 191.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a49eb4487988af813425a3048c3c0464f30d91e4b711cc562b88113b71ac19d0
BLAKE2b-256 checksum
How to use checksums
803c5a9fb1b61375257a0d7b8e144079b8c574f66201a48ac26c4c926c5e5953
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.0

Security for libICEpost 0.10.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page