All Courses
All Courses
Courses by Software
Courses by Semester
Courses by Domain
Tool-focused Courses
Machine learning
POPULAR COURSES
Success Stories
AIM: Parsing NASA thermodynamic data using MATLAB programming. THEORY: NASA came up with polynomials that can be used to evaluate thermodynamic properties such as Cp, H and S. They have also documented the coefficients that are required to evaluate these polynomials for 1000+ species. Below figure shows the structure…
Kishoremoorthy SP
updated on 06 Aug 2022
AIM:
Parsing NASA thermodynamic data using MATLAB programming.
THEORY:
NASA came up with polynomials that can be used to evaluate thermodynamic properties such as Cp, H and S. They have also documented the coefficients that are required to evaluate these polynomials for 1000+ species. Below figure shows the structure of the file format that includes the values of the individual species coefficients along with their local temperature ranges.
Although the file looks incomprehensible, it provides many important details of the individual behaviour of the species. So, the main motive of this project is to make a program in Matlab that can extract all the coefficients of the species and make their relation with given thermodynamic properties.
The above formula are used calculate specific heat 'Cp', Enthapy 'H' and Entropy 'S'
THIS IS THE MAIN SCRIPT OF THE PROGRAMME:
clear
close
clc
F=fopen('THERMO.dat','r');
fgetl(F);
G_temp = str2num(fgetl(F));
%Global temparture
G_low = G_temp(1);
G_mid = G_temp(2);
G_high= G_temp(3);
%%skipping 3 line because my 4th line is the species strating
for i=1:3
fgetl(F);
end
for K=1:53
A=fgetl(F);
%using strsplit command because it is string type so, spliting by space because it common in this line
a = strsplit(A,' ');
species_name = a{1};
%TO CACLULATE THE MOLECULAR WEIGHT OF EACH SPECIES CREATED A FUNCTION TO
%FIND ALL MOLECULAR WEIGHT
Molecular_wt = calc_of_molecular_weight(species_name)
%Local temparture
L_low = str2double(a{end-3});
L_high= str2double(a{end-2});
L_mid = str2double(a{end-1});
%now we can extract the coefficent values
B=fgetl(F);
pos=strfind(B,'E');
% variable "a" represents the coefficent values.
A1 = B(1:pos(1)+3);
A1=str2double(A1);
A2 = B(pos(1)+4:pos(2)+3);
A2=str2double(A2);
A3 = B(pos(2)+4:pos(3)+3);
A3=str2double(A3);
A4 = B(pos(3)+4:pos(4)+3);
A4=str2double(A4);
A5 = B(pos(4)+4:pos(5)+3);
A5=str2double(A5);
C=fgetl(F);
pos1=strfind(C,'E');
A6 = C(1:pos1(1)+3);
A6=str2double(A6);
A7 = C(pos1(1)+4:pos(2)+3);
A7=str2double(A7);
A8 = C(pos1(2)+4:pos(3)+3);
A8=str2double(A8);
A9 = C(pos1(3)+4:pos(4)+3);
A9=str2double(A9);
A10 = C(pos1(4)+4:pos(5)+3);
A10=str2double(A10);
D=fgetl(F);
pos2=strfind(D,'E');
A11= D(1:pos2(1)+3);
A11=str2double(A11);
A12 = D(pos2(1)+4:pos2(2)+3);
A12=str2double(A12);
A13 = D(pos2(2)+4:pos2(3)+3);
A13=str2double(A13);
A14 = D(pos2(3)+4:pos2(4)+3);
A14=str2double(A14);
%R is the universal gas numbers
% R=8.3145; %J/Mol*Km (units)
%Specific heat, Enthalpy, Entropy @ High temparture
T = linspace(L_low,L_high,500);
for i = 1:length(T)
[cp,h,s] = calc_therm_properties(A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,T,L_mid);
end
mkdir(['/Users/kishoremoorthysp/Desktop/species/',species_name])
cd(['//Users/kishoremoorthysp/Desktop/species/',species_name])
%Temperature v/s Specific Heat
figure(1)
plot(T,cp,'linewidth',2,'color','r')
title(species_name)
xlabel('Local Temperature (K)')
ylabel('Specific Heat (kJ/K)')
grid on
saveas(1,'specific heat','jpg')
%Temperature v/s Enthalpy
figure(2)
plot(T,h,'linewidth',2,'color','b')
title(species_name)
xlabel('Local Temperature (K)')
ylabel('Enthalpy (kJ/K)')
grid on
saveas(2,'Enthalpy','jpg')
%Temperature v/s Entropy
figure(3)
plot(T,s,'linewidth',2,'color','k')
title(species_name)
xlabel('Local Temperature (K)')
ylabel('Entropy (kJ/K)')
grid on
saveas(3,'Entropy','jpg')
end
THIS USER DEFIND FUNCTION FOR THE MOLECULAR WEIGHT OF THE EACH SPECIES WHICH IS USED IN THE ABOVE MAIN SCRIPT PROGRAMME ARE BELOW:
%Function for calculating the molecular weignt
function [Molecular_wt] = calc_of_molecular_weight(species_name)
Elements = ['H','C','N','O','A'];
Atomic_wt = [1,12,14,16,40];
Molecular_wt = 0;
for i = 1:length(species_name)
for j= 1:length(Elements)
if strcmpi(species_name (i),Elements (j))
Molecular_wt = Molecular_wt + Atomic_wt(j);
P=j;
end
end
G = str2double (species_name(i));
if G>1
Molecular_wt=Molecular_wt+Atomic_wt(P)*(G-1);
end
end
sprintf('The molecular weight of %s is %d', species_name, Molecular_wt)
end
THIS USER DEFIND FUNCTION FOR CALCULATING THE COEFFECIENT VALUES OF THE EACH SPECIES WHICH IS USED IN THE ABOVE MAIN SCRIPT PROGRAMME ARE BELOW:
function [cp,h,s] = calc_therm_properties(A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,T,L_mid)
R = 8.314;
if (T>=L_mid)
cp = (A1+(A2.*T)+(A3.*T.^2)+(A4.*T.^3)+(A5.*T.^4))*R;
h = (A1+(A2.*T/2)+(A3.*(T.^2)/3)+(A4.*(T.^3)/4)+(A5.*(T.^4)/5)+A6.*T)*R;
s = (A1*log(T)+(A2.*T)+(A3.*(T.^2)/2)+(A4.*(T.^3)/3)+(A5.*(T.^4)/4)+A7)*R;
else
cp = (A8+(A9.*T)+(A10.*T.^2)+(A11.*T.^3)+(A12.*T.^4))*R;
h = (A8+(A9.*T/2)+(A10.*(T.^2)/3)+(A11.*(T.^3)/4)+(A12.*(T.^4)/5)+A13.*T)*R;
s = (A8*log(T)+(A9.*T)+(A10.*(T.^2)/2)+(A11.*(T.^3)/3)+(A12.*(T.^4)/4)+A14)*R;
end
end
EXPLANATION OF CODE:
Output results
MOLECULAR WEIGHT FOR THE 53 SPECIES ARE THERE BELOW SNAP.
OUTPUT WORKSPACE OF THE PROGRAMME.
THE BELOW IS THE FOLDER WHICH HAVE BEEN AUTOMATICALLY CREATED FROM THE CODE HAVE PRAGRAMMED ABOVE, IS BELOW.
THIS IS PLOT FOR O2 SPECIES.
THIS IS PLOT FOR N2 SPECIES.
THIS IS PLOT FOR CO2 SPECIES.
CONCULUSION:
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 4 Challenge : CFD Meshing for BMW car
AIM: FOR THE GIVE MODEL, CHECK AND SOLVE ALL GEOMETRICAL ERRORS ON HALF PORTION AND ASSIGN APPROPRITATE PIDS. PERFORMS MESHING WITH GIVEN TARGET LENGTH AND ELEMENT QUALITY CRITERIA. AFTER MESHING THE HALF MODEL,DO SYMMETRY TO THE OTHER SIDE. PRODECURE: INITIALLY, OPEN THE GIVEN BMW MODEL IN ANSA SOFTWARE.…
20 Oct 2023 11:25 AM IST
Week 12 - Validation studies of Symmetry BC vs Wedge BC in OpenFOAM vs Analytical H.P equation
Aim: employing the symmetry boundary condition to simulate an axis-symmetric laminar flow through the pipe's constant cross-section. Using both symmetry and wedge boundary conditions, simulate the aforementioned angles—10, 25, and 45 degrees—and evaluate your results using HP equations. Introduction: Hagen-Poiseuille's…
04 May 2023 03:14 PM IST
Week 11 - Simulation of Flow through a pipe in OpenFoam
Aim: Simulate axisymmetric flow in a pipe through foam. Objective: Verify the hydrodynamic length using the numerical result Verify a fully developed flow rate profile with its analytical profile Verify the maximum velocity and pressure drop for fully developed flow Post-process Shear Stress and verify wall shear stress…
04 May 2023 03:04 PM IST
Week 9 - FVM Literature Review
AIM To describe the need for interpolation schemes and flux limiters in Finite Volume Method (FVM). OBJECTIVE To study and understand What is Finite Volume Method(FVM) Write down the major differences between FDM & FVM Describe the need for interpolation schemes and flux limiters in FVM INTRODUCTION …
03 May 2023 05:47 AM 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.