All Courses
All Courses
Courses by Software
Courses by Semester
Courses by Domain
Tool-focused Courses
Machine learning
POPULAR COURSES
Success Stories
I. Introduction : In this project, we use a data file obtained during an Internal Combustion engine simulation using Converge software. The simulation creates a large amount of data amounting to thousands of lines and to analyse such data we create a Data visualizer tool, scripting it in python. Since the data produces…
Aadil Shaikh
updated on 18 Sep 2020
I. Introduction :
In this project, we use a data file obtained during an Internal Combustion engine simulation using Converge software. The simulation creates a large amount of data amounting to thousands of lines and to analyse such data we create a Data visualizer tool, scripting it in python. Since the data produces a number of properties of an Ic engine, this tool helps us visualize exactly the property we need, its behaviour and allows the flexibility to perform calculations on this data set with individual properties.
Data file from Converge software : engine_data.out
II. Data Visualizer :
"""
File parsing in python
Code by : Aadil Shaikh
"""
import matplotlib.pyplot as plt
import numpy as np
import math
line_count = 1
crank = []
pressure = []
max_press = []
min_press = []
mean_temp = []
max_temp = []
min_temp = []
mass = []
density = []
temperature = []
volume=[]
integrated_hr=[]
hr_rate = []
c_p = []
c_v = []
gamma = []
kin_visc = []
dyn_visc = []
column_no=[]
properties=[]
units=[]
data_file = input('Type the file name : ')
try:
file_data = open(data_file,'r')
# File parsing starts here
for line in file_data:
if line_count is 2:
for i in range(2,18):
column_no.append(line.split()[i])
#print(column_no)
if line_count is 3:
for k in range(0,18):
properties.append(line.split()[k])
#print(properties)
if line_count is 4:
for p in range(0,18):
units.append(line.split()[p])
#print(units)
line_count = line_count + 1
if '#' not in line:
crank.append(float(line.split()[0]))
pressure.append(float(line.split()[1]))
max_press.append(float(line.split()[2]))
min_press.append(float(line.split()[3]))
mean_temp.append(float(line.split()[4]))
max_temp.append(float(line.split()[5]))
min_temp.append(float(line.split()[6]))
volume.append(float(line.split()[7]))
mass.append(float(line.split()[8]))
density.append(float(line.split()[9]))
integrated_hr.append(float(line.split()[10]))
hr_rate.append(float(line.split()[11]))
c_p.append(float(line.split()[12]))
c_v.append(float(line.split()[13]))
gamma.append(float(line.split()[14]))
kin_visc.append(float(line.split()[15]))
dyn_visc.append(float(line.split()[16]))
column_nos = np.array([[0],crank,pressure,max_press,min_press,mean_temp,max_temp,min_temp,volume,mass,density,integrated_hr,hr_rate,c_p,c_v,gamma,kin_visc,dyn_visc])
print('n Choose Simulation parameters to Generate plot : ')
print('n 1. Crank n 2. Pressure n 3. max_press n 4. min_press n 5. mean_temp n 6. max_temp n 7. min_temp n 8. volume n 9. mass n 10. density n 11. integrated_hr n 12. hr_rate n 13. c_p n 14. c_v n 15. gamma n 16. kin_visc n 17. dyn_visc')
x_value = int(input('n Choose parameter on X-axis : '))
y_value = int(input('n Choose parameter on Y-axis : '))
plt.plot(column_nos[x_value],column_nos[y_value],color="red",linewidth = 2)
plt.xlabel(str(properties[x_value]) + ' ' + str(units[x_value]))
plt.ylabel(str(properties[y_value]) + ' ' + str(units[y_value]))
plt.title(str(properties[x_value]) + ' '+'vs'+ ' ' + properties[y_value])
plt.savefig(str(properties[x_value]) + ' '+'vs'+ ' ' + properties[y_value])
plt.show()
if x_value == 2 and y_value == 8 or x_value == 8 and y_value == 2:
rpm = 1500
fuel_consumed_perstroke = 20 #micrograms
N = np.trapz(column_nos[x_value],column_nos[y_value])
p = (2*math.pi*rpm*N)/(60)
sfc = ((fuel_consumed_perstroke*rpm)*(pow(10,-6))*(3600))/(p*1000*60)
plt.fill_between(column_nos[x_value],column_nos[y_value],linewidth = 2 , color = 'red' , alpha = 0.35)
plt.show()
print('n Engine Performance Calculation')
print('n Area under the pV plot = ', N , 'N-m')
print('n Power output = ', p, 'MW')
print('n sfc = ',sfc, 'g/kW-h')
except FileNotFoundError:
print("File not recognized. Please provide a valid CONVERGE output file")
finally:
print("n code exiting")
1. The Data visualizer script asks for a converge output file name, and starts appending all the Column Numbers which represent different thermodynamic properties of the IC engine simulation. Then the Property header names and units.
2. The data is in a column format, hence we append all the values of the data as per each column in its respective property after splitting it.
3. The array of all properties is created using numpy module, to call each property data set according to its column number inside the data.
4. Then the program asks for the user to input in X and Y axis column number, representing the property needed to visualize.
5.
6. Once the user inputs the property required to be visualized, the program generates its plot and extracts the Property names, units & its title automatically from the header information and saves the Plot by its name.
6. Few plots Generated :
7 .
8.
9.
III. Performance Calculation :
Demonstration of how this data set can be utilized in perfomance calculation from these properties . Here, the calculation of Area under the PV diagram, Power output and specific fuel consumption of the engine is calculated.
The code has been modfied to give the performance results only when selecting the properties - Pressue and volume in either order.
Assumptions :
1500 rpm, Fuel consumed per stroke = 20 micrograms
IV. Compability check :
Code gives an error when non-compatible file is provided as an input and exits.
keyword - PYTHON, PYTHON-BASICS, CFD, IC-ENGINE-CFD
Leave a comment
Thanks for choosing to leave a comment. Please keep in mind that all the comments are moderated as per our comment policy, and your email will not be published for privacy reasons. Please leave a personal & meaningful conversation.
Other comments...
Flow over a Throttle body - Using CONVERGE CFD
I. Introduction: In this Project, A Steady & Transient state simulation is done of a Flow through an Elbow joint consisting of a throttle valve. The steady state case is solved with the Throttle valve fully open until convergence is reached. While the Transient case is ran with the throttle valve rotating i.e…
18 Sep 2020 08:29 PM IST
Literature review – RANS Derivation and analysis
Introduction: The Reynolds-averaged Navier–Stokes equations (or RANS equations) are time-averaged equations of motion for fluid flow. The idea behind the equations is Reynolds decomposition, whereby an instantaneous quantity is decomposed into its time-averaged and fluctuating quantities,…
18 Sep 2020 08:28 PM IST
C.H.T Analysis on a Graphic card using ANSYS FLUENT
I. Introduction : In this project, A steady state conjugate heat transfer analysis on a Graphic card model is done. Graphic card has become an everyday used object and a very importat part of any computer system, laptops etc. This product is mass produced daily in millions and has made computers exceptionally efficient.…
18 Sep 2020 08:23 PM IST
Aerodynamics : Flow around the Ahmed Body using ANSYS FLUENT
I. Introduction : Automotive aerodynamics comprises of the study of aerodynamics of road vehicles. Its main goals are reducing drag, minimizing noise emission, improving fuel economy, preventing undesired lift forces and minimising other causes of aerodynamic instability at high speeds. Also, in order to maintain…
18 Sep 2020 08:21 PM IST
Related Courses
Skill-Lync offers industry relevant advanced engineering courses for engineering students by partnering with industry experts.
© 2025 Skill-Lync Inc. All Rights Reserved.