All Courses
All Courses
Courses by Software
Courses by Semester
Courses by Domain
Tool-focused Courses
Machine learning
POPULAR COURSES
Success Stories
*NOT ABLE TO UPLOAD IN HTML LAST 10 LINES ARE NOT PASTING clear all close all clc file = fopen(\'THERMO.dat\',\'r\'); line1 = fgetl(file); line2 = fgetl(file); split_temp = findstr(line2, \' \'); t_gmin = str2num(line2(split_temp(1):split_temp(4))); t_gmid = str2num(line2(split_temp(5):split_temp(6))); t_gmax = str2num(line2(split_temp(7):end));…
Gokulkumar M
updated on 07 Feb 2020
clear all
close all
clc
file = fopen(\'THERMO.dat\',\'r\');
line1 = fgetl(file);
line2 = fgetl(file);
split_temp = findstr(line2, \' \');
t_gmin = str2num(line2(split_temp(1):split_temp(4)));
t_gmid = str2num(line2(split_temp(5):split_temp(6)));
t_gmax = str2num(line2(split_temp(7):end));
%skipping line 3 to 5
fgetl(file);
fgetl(file);
fgetl(file);
for i = 1:53
line3 = fgetl(file);
element = line3(1:6);
temp = line3((49):end);
split_temp =strsplit(temp,\' \');
t_lmin = str2num(split_temp{1});
t_lmax = str2num(split_temp{2});
t_lmid = str2num(split_temp{3});
coefficient_line1 = fgetl(file);
coefficient_line2 = fgetl(file);
coefficient_line3 = fgetl(file);
split_coefficientl1 = findstr(coefficient_line1, \'E\');
split_coefficientl2 = findstr(coefficient_line2, \'E\');
split_coefficientl3 = findstr(coefficient_line3, \'E\');
c1 = str2num(coefficient_line1(1:(split_coefficientl1(1)+3)));
c2 = str2num(coefficient_line1((split_coefficientl1(1)+4):(split_coefficientl1(2)+3)));
c3 = str2num(coefficient_line1((split_coefficientl1(2)+4):(split_coefficientl1(3)+3)));
c4 = str2num(coefficient_line1((split_coefficientl1(3)+4):(split_coefficientl1(4)+3)));
c5 = str2num(coefficient_line1((split_coefficientl1(4)+4):(split_coefficientl1(5)+3)));
c6 = str2num(coefficient_line2(1:(split_coefficientl2(1)+3)));
c7 = str2num(coefficient_line2((split_coefficientl2(1)+4):(split_coefficientl2(2)+3)));
c01 = str2num(coefficient_line2((split_coefficientl2(2)+4):(split_coefficientl2(3)+3)));
c02 = str2num(coefficient_line2((split_coefficientl2(3)+4):(split_coefficientl2(4)+3)));
c03 = str2num(coefficient_line2((split_coefficientl2(4)+4):(split_coefficientl2(5)+3)));
c04 = str2num(coefficient_line3(1:(split_coefficientl3(1)+3)));
c05 = str2num(coefficient_line3((split_coefficientl3(1)+4):(split_coefficientl3(2)+3)));
c06 = str2num(coefficient_line3((split_coefficientl3(2)+4):(split_coefficientl3(3)+3)));
c07 = str2num(coefficient_line3((split_coefficientl3(3)+4):(split_coefficientl3(4)+3)));
%folder for the element
mkdir(\'C:\\Users\\91882\\Desktop\\matlab\\1\\\',element)
% w K T gas constant R
R = 8.31446261815324;
t = linspace(t_lmin,t_lmax,100);
for k = 1:length(t)
if t1
d = d + (c(e)*(n-1));
end
end
molecular_mass = d;
display(element)
display(molecular_mass)
end
fclose(file)
{error faced: In line 26 where instead of 49 i used position of (G+3) G which works fine till CH2O. IN next element CH2OH there is another G available.
so i found the position of 1st number of local temperature
temp = line3((49):end);
in line 63 to 69 loop i used cp(k)
for k = 1:length(t)
if t<t_gmid
Cp(k) = (c1+(c2.*t)+(c3*(t.^2))+(c4*(t.^3))+(c5(t.^4)))*R;
H(k) = (c1+(c2.*t/2)+(c3*(t^2)/3)+(c4*(t^3)/4)+(c5*(t^4)/5)+(c6/t)).*t.*R;
S(k) = ((c1.*log(t))+(c2.*t)+(c3.*(t.^2)/2)+(c4.*(t.^3)/3)+(c.*(t.^4)/4)+c7)*R;
else
Cp(k) = (c01+(c02.*t)+(c03.*(t.^2))+(c04*(t.^3))+(c05*(t.^4)))*R;
H(k) = (c01+(c02.*t/2)+(c03.*(t.^2)/3)+(c04.*(t.^3)/4)+(c05.*(t.^4)/5)+(c06./t)).*t.*R;
S(k) = ((c01.*log(t))+(c02.*t)+(c03*(t.^2)/2)+(c04*(t.^3)/3)+(c05*(t.^4)/4)+c07)*R;
end
end}
Before the for loop i find the three global temperature using the following syntax :- fopen, fgetl, findstr , str2num
In the loop fgetl will gives the next line which consist of element, local temperature of the element.
next 3 lines give the coefficient position of first element is identified using letter E.
line55 open a folder in the name of element.
line 37 to 52 used to seperate the value of coefficient (1 to 14)
in line 61 to 71 using for loop and if condition,( cp , h & s value is determined for the maximum temp to minimum temp. )
in if condtion when the temperature value reaches mid local temperature it uses the next 7 coefficient.
plotting is done in the next line (73 to 92)
in next 5 lines directory is created and stored the plot in jpg format in that file .
line 102 to 121 molecular mass for the element is calculated
for example of H2O
loop of i = 1:length(element) H molar mass is found
molecular mass of H is stored in a variable named -\'d\'
then second index of \'2\' is converted to integer in line 114
then using the formula on line116 molar mass H2 is found
then smilarlymolar mass of O is added to variable
thus H2O molar mass is determined
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...
Week 3 - Adiabatic Flame Temperature calculation
Objective: To calculate Adiabatic Flame Temperature for combustion with variation in equivalence ratio, type of fuel, with heat loss using the Newton-Raphson method and Cantera. Theory: Adiabatic flame temperature(AFT): The final temperature of the product, When the combustion takes place…
23 Mar 2021 05:17 AM IST
Week 10 - Simulating Combustion of Natural Gas.
Objective: To simulate the combustion in Ansys fluent with the parametric study. Theory: Combustion is a chemical process during which heat energy is generated. During combustion, the Hydro-carbon and Oxygen combined when a spark is introduced chemical reaction takes…
03 Mar 2021 10:35 AM IST
Week 9 - Parametric study on Gate valve.
Objective: To simulate the Gate valve with different opening positions using parametric study in Ansys fluent. Theory: Flow coefficient: Cv=Q√(SG∇P) where, Q is the rate of flow (expressed in US gallons per minute),…
26 Feb 2021 03:46 PM IST
Week 8 - Simulating Cyclone separator with Discrete Phase Modelling
Objective: To simulate cyclone separator with Discrete Phase Modelling in Ansys fluent. Theory: Empirical models used to calculate the cyclone separator efficiency: 1.Iozia and Leith Model Iozia and Leith logistic model is a modified version of…
24 Feb 2021 02:43 PM IST
Related Courses
0 Hours of Content
Skill-Lync offers industry relevant advanced engineering courses for engineering students by partnering with industry experts.
© 2025 Skill-Lync Inc. All Rights Reserved.