Placement 2025 Scholarship: Your Future Starts Here | 6 Guaranteed Job Interviews | Limited to 100 seats. Apply Now

00D 00H 00M 00S

Menu

Executive Programs

Workshops

Projects

Blogs

Careers

Placements

Student Reviews


For Business


More

Academic Training

Informative Articles

Find Jobs

We are Hiring!


All Courses

Choose a category

Mechanical

Electrical

Civil

Computer Science

Electronics

Offline Program

All Courses

All Courses

logo

CHOOSE A CATEGORY

Mechanical

Electrical

Civil

Computer Science

Electronics

Offline Program

Top Job Leading Courses

Automotive

CFD

FEA

Design

MBD

Med Tech

Courses by Software

Design

Solver

Automation

Vehicle Dynamics

CFD Solver

Preprocessor

Courses by Semester

First Year

Second Year

Third Year

Fourth Year

Courses by Domain

Automotive

CFD

Design

FEA

Tool-focused Courses

Design

Solver

Automation

Preprocessor

CFD Solver

Vehicle Dynamics

Machine learning

Machine Learning and AI

POPULAR COURSES

coursePost Graduate Program in Hybrid Electric Vehicle Design and Analysis
coursePost Graduate Program in Computational Fluid Dynamics
coursePost Graduate Program in CAD
coursePost Graduate Program in CAE
coursePost Graduate Program in Manufacturing Design
coursePost Graduate Program in Computational Design and Pre-processing
coursePost Graduate Program in Complete Passenger Car Design & Product Development
Executive Programs
Workshops
For Business

Success Stories

Placements

Student Reviews

More

Projects

Blogs

Academic Training

Find Jobs

Informative Articles

We're Hiring!

phone+91 9342691281Log in
  1. Home/
  2. Amit Kumar/
  3. Project 1 - Parsing NASA thermodynamic data

Project 1 - Parsing NASA thermodynamic data

      AIM:- calculates the enthalpy, entropy and specific heats for all the species in the data file. To display T vs Cp, T vs Enthalpy, T vs Entropy plots and display molecular weight for the  required species   OBJECTIVE:- Write a function that extracts the 14 coefficients and calculates the enthalpy,entropy and specific…

    • Amit Kumar

      updated on 17 Jan 2021

     

     

     

    AIM:-

    calculates the enthalpy, entropy and specific heats for all the species in the data file.

    To display T vs Cp, T vs Enthalpy, T vs Entropy plots and display molecular weight for the  required species

     

    OBJECTIVE:-

    • Write a function that extracts the 14 coefficients and calculates the enthalpy,entropy and specific heats for all the species in the data file.
    • Calculating molecular weight of each species.
    • Plotting the specific heat,enthalpy and entropy for the local temperature range.
    • Saving the plots as images with appropriate names and dumping them in seperate folders for each species.

    FILE PARSING:-

    Parsing in computer languages refers to syntactic analysis of the input data normally from a file into its components parts in order to facilitate the writing of compilers and interpreters. It can be used to describe split or separation

    Parsing a file means reading in a data stream of some sort and building an in memory model of the semantic content of that data. This aims at facilitating performing some kind of transformation on the data.

    PARSER:-

    A parser is a software component that takes input data (frequently text) and builds a data structure often some kind of parse tree, abstract syntax tree or other hierarchical structure, giving a structural representation of the input while checking for correct syntax. The parsing may be preceded or followed by other steps, or these may be combined into a single step.

     

    MOLECULAR WEIGHT:-

    Molecular weight is a measure of the sum of the atomic weight values of the atoms in a molecule. Molecular weight is used in chemistry to determine stoichiometry in chemical reactions and equations. Molecular weight is commonly abbreviated by M.W. or MW. Molecular weight is either unitless or expressed in terms of atomic mass units (amu) or Daltons (Da).

    ENTROPY:-

    entropy is a scientific concept, as well as a measurable physical property that is most commonly associated with a state of disorder, randomness, or uncertainty. The term and the concept are used in diverse fields.

     

    SPECIFIC HEAT CAPACITY:-

    specific heat capacity (symbol cp) of a substance is the heat capacity of a sample of the substance divided by the mass of the sample. Informally, it is the amount of energy that must be added

    Enthalpy

    enthalpy is a property of a thermodynamic system, defined as the sum of the system's internal energy and the product of its pressure and volume.

     

    Function coding for Formula calculating the Cp, H, S:

    In this coding using function command, the formula is developed.

    Here temperatures vary from each species where the first 7 will be local high temperature and the rest 7 species will the local low temperature. So here we use if and else command to calculate both temperatures. 

    Formula:

     

     

     

    PROGRAM:-

       

    % Specific heat, Enthalpy & Entropy Calculation
    
    function [Cp,H,S] = inputs(T,R,Tm1,c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14)
    
    for i = 1:length(T)
        if T(i)>Tm1
    
    Cp(i)= (c1 + c2.*T(i) + c3.*T(i).^2 + c4.*T(i).^3 +c5.*T(i).^4).*R;
    
    H(i) = (c1 + (c2.*T(i))./2 + (c3.*T(i).^2)./3 + (c4.*T(i).^3)./4 +(c5.*T(i).^4)./5 + c6./T(i)).*T(i)*R;
    S(i) = (c1.*log(T(i)) + c2.*T(i) + (c3.*T(i).^2)./2 + (c4.*T(i).^3)./3 +(c5.*T(i).^4)./4  + c7).*R;
    
    else
    Cp (i)= (c8 + c9.*T(i) + c10.*T(i).^2 + c11.*T(i).^3 +c12.*T(i).^4).*R;
    H(i) = (c8 + (c9.*T(i))./2 + (c10.*T(i).^2)./3 + (c11.*T(i).^3)./4 +(c12.*T(i).^4)./5 + c13./T(i)).*T(i)*R;
    S (i)= (c8.*log(T(i)) + c9.*T(i) + (c10.*T(i).^2)./2 + (c11.*T(i).^3)./3 +(c12.*T(i).^4)./4  + c14).*R;
    
        end
    end
    end

     

    Function coding for calculating the Molecular Weight:-

    In this molecular weight is calculated using function command here atomic name and atomic weight are given as inputs to the species. A loop is created for calculating molecular weight of species individually,strcmp is used to compare species with the elements and calculate their molecular weight. Then string is converted in to number using str2double command.

     Main Code explained:-

    -Initially we will opening the given THERMO.dat file using fopen command and then we will extract all the information provided in the file using fgetl command.

    -First we we will get the global temperature by using strslplit command and then we skip some lines using the fget command.

    -Now we make use of for loop command to get all temperature and coefficients that are presnt in our file.

    -For getting temperature and coefficients we use finstr command inorder to input the accurate spot and specifying it so that we can get all the data.

    -Now the datas which are obtanied from the file will be of string format which we need to convert into numbers by using str2num command.and by this we will get the temperature and coefficient of all the species.

    -Now we make use of if command to create file for each species, in case if the folder exist it will simply save as plot or else it   will create a folder to save the plot.

    -Now the specific heat,enthalpy ,entropy function is calculated and gets plotted.

    -The three figures are plotted using plot command and each species name is displayed using title command.And further it will named using xlabel  and ylabel command.

    -Now we are changing the dierectory using cd command and then we will save the plots as our images using save command.

    -Finally we will again change the dierectory using cd command to calculate molecular weight of each species using the function program and closing the file using fclose command.

      

     

    clear all
    close all
    clc
    
    f1= fopen('THERMO.dat','r');
    
    fgetl(f1);
    tline = fgetl(f1);
    A = strsplit(tline,'.');
    Global_low_temp = str2num(A{2});
    Global_mid_temp = str2num(A{3});
    Global_high_temp = str2num(A{4});
    
    %LINES
    for i = 3:5
        g =fgetl(f1);
    end
    %tempeature
    for j = 1:53
        species =fgetl(f1);
       t= strfind(species,'.');
        
        %local tempeature
       T1= species(52-3:t(1)+3);
        T11 =str2num(T1);
        
        species(t(1)+6:62+3);
        Th = species(t(1)+ 6:t(2)+3);
        Th1 = str2num(Th);
        
        species(t(2) +6:72+3);
        Tm = species(t(2)+6:t(3)+3);
        Tm1 = str2num(Tm);
        
        h=strsplit(species,' ')
        sp_name = h{1}
        
       
        %co-efficentent
        coeff_line_1 = fgetl(f1);
        A11 = strfind(coeff_line_1,'E');
        coeff_line_1(1:12+3);
        
        a1 = coeff_line_1(1:A11(1)+3);
        c1 = str2num(a1);
        
        a2 = coeff_line_1(A11(1)+4:A11(2)+3);   
        c2 = str2num(a2);
        
        a3 = coeff_line_1(A11(2)+4:A11(3)+3);
        c3 = str2num(a3);
        
        a4 = coeff_line_1(A11(3)+4:A11(4)+3);
        c4 = str2num(a4);
        
        a5 = coeff_line_1(A11(4)+4:A11(5)+3);
        c5 = str2num(a5);
        
       % coefficent 1
       coeff_line_2 = fgetl(f1);
       A12 = strfind(coeff_line_2,'E');
       coeff_line_2(1:12+3);
       a6 = coeff_line_2(1:A12(1)+3);
       c6 = str2num(a6);
       a7 = coeff_line_2(A12(1)+4:A12(2)+3);
       c7 = str2num(a7);
       a8 = coeff_line_2(A12(2)+4:A12(4)+3);
       c8 = str2num(a8);
       a9 = coeff_line_2(A12(3)+4:A12(4)+3);
       c9 = str2num(a9);
       a10 = coeff_line_2(A12(4)+4:A12(5)+3);
       c10 = str2num(a10);
       
       %coefficent 2
       coeff_line_3 = fgetl(f1);
       A13 = strfind(coeff_line_3,'E');
       coeff_line_3(1+13+3);
       
       a11 = coeff_line_3(1:A13(1)+3);
       c11 = str2num(a11);
       a12 = coeff_line_3(A13(1)+4:A13(2)+3);
       c12 = str2num(a12);
       a13 = coeff_line_3(A13(2)+4:A13(3)+3);
       c13 =str2num(a13);
       a14 = coeff_line_3(A13(2)+4:A13(4)+3);
       c14 = str2num(a14);
       R = 8.314
       T =linspace(T11,Th1,100);
    
    %   cd(['C:\Users\Student\Desktop\file parsing\'])
       
       [CP,H,S] = inputs(T,R,Tm,c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11,c12,c13,c14);
        
      
    % Plotting
    
    figure(1)
    plot(T,CP,'linewidth',2,'color','r')
    grid on
    title(sp_name)
    xlabel('Temperature')
    ylabel('Specific Heat')
    
    figure(2)
    plot(T,H,'linewidth',2,'color','b')
    grid on
    title(sp_name)
    xlabel('Temperature')
    ylabel('Enthalpy')
    
    figure(3)
    plot(T,S,'linewidth',2,'color','y')
    grid on
    title(sp_name)
    xlabel('Temperature')
    ylabel('Entropy')
    % program = (['D:\matlab programs\NASA File parsing\species\',sp_name'])
    
    
     mkdir(['C:\Users\Student\Desktop\file parsing\plots\',sp_name])
     cd(['C:\Users\Student\Desktop\file parsing\plots\',sp_name])
    %    
       
    %saving the plot
    
    saveas(1,'specific Heat.jpg')
    saveas(2,'Enthalpy.jpg')
    saveas(3,'Entropy.jpg')
     
    %  cd('D:\matlab programs\NASA file parsing')
    species = sp_name;
    elements = ['H','C','O','N','A','S'];
    atomic_weight = [1.007 12.0107 15.999 14.0067 39.948 32.065];
    molecular_weight_calculation = 0;
    for i = 1:length(species)
        for j = 1:length(elements)
            if strcmp(species(i),elements(j))
                molecular_weight_calculation = molecular_weight_calculation+atomic_weight(j);
                a = j;
            end
        end
        n = str2num(species(i));
    if n>1; 
        molecular_weight_calculation = molecular_weight_calculation+atomic_weight(a)*(n-1)
    end
    end
    
    
    
    %  cd(['C:\Users\Student\Desktop\file parsing\plots',sp_name])
    end
    fclose(f1)
    
    
    
    

     ERRORS:-

      OUTPUTS:-

     Screenshot containing the plots for all the species:-

        

           

     

          O2 PLOTS:-

            

          

           

          

             

          

           N2 PLOTS:-

       

           

           

          

          

         

         CO2 PLOT:-

         

          

         

        

        

     

       Molecular weight of species in command window:-

        

       RESULT:-

      The code to prase the NASA thermodynamic data file has been programmed and the thermodynamic properties and molecular      weight of species has been calculated and plotted.

    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.

    Please  login to add a comment

    Other comments...

    No comments yet!
    Be the first to add a comment

    Read more Projects by Amit Kumar (52)

    Week - 9 Material Modeling from Raw Data

    Objective:

    AIM:- Material Modeling from Raw Data OBJECTIVE:-  Using the given video link, extract the data from the figure, and used it for validation. Create a material model for the Dogbone specimen using the diagram of the true stress-strain curve (graphite iron). From the above condition simulate…

    calendar

    29 Oct 2023 12:33 PM IST

    • CSS
    • FEA
    Read more

    Week-6 Calculate the Stretch Ratio by comparing the ELFORM (-2,-1,1,2) with Ogden_Material Model.

    Objective:

    AIM:-calculate the Stretch Ratio by comparing the ELFORM OBJECTIVE:- Create a block of 10mmx10mmx10mm dimension with 10 elements for each direction and use the material card attached (Ogden_Material.k) that is representative of the material properties from the above figure. Use appropriate boundary conditions to simulate…

    calendar

    27 Oct 2023 05:47 PM IST

      Read more

      Week - 5 - Modelling Spotwelds

      Objective:

      AIM:-Modelling SpotweldsOBJECTIVE:-In this assignment, you will model spot welds for the given assembly of parts and run a crash test similar to the one in assignment 4. Details about the spotweld location is in the image below. The yellow line signifies the spotweld directions. You need to use 3-7 spot welds along this…

      calendar

      26 Oct 2023 08:40 PM IST

        Read more

        Week - 4 - Crash Box Simulation

        Objective:

        AIM:- Crash Box Simulation OBJECTIVE:-In this assignment, the student needs to simulate a crash test for a crash box for which mesh is given. A crash box is a highly energy-absorbing structure that crashes on application of loads and reduces impact on other components nearby. A full-fledges crashbox is a highly sophisticated…

        calendar

        26 Oct 2023 02:15 PM IST

        • BIM
        • CAE
        • CFD
        • CSS
        • DEM
        • FEA
        • GIS
        • HEV
        • LS-DYNA
        • MBD
        Read more

        Schedule a counselling session

        Please enter your name
        Please enter a valid email
        Please enter a valid number

        Related Courses

        coursecard

        Design loads considered on bridges

        Recently launched

        10 Hours of Content

        coursecard

        Design of Steel Superstructure in Bridges

        Recently launched

        16 Hours of Content

        coursecard

        Design for Manufacturability (DFM)

        Recently launched

        11 Hours of Content

        coursecard

        CATIA for Medical Product Design

        Recently launched

        5 Hours of Content

        coursecardcoursetype

        Accelerated Career Program in Embedded Systems (On-Campus) Courseware Partner: IT-ITes SSC nasscom

        Recently launched

        0 Hours of Content

        Schedule a counselling session

        Please enter your name
        Please enter a valid email
        Please enter a valid number

        logo

        Skill-Lync offers industry relevant advanced engineering courses for engineering students by partnering with industry experts.

        https://d27yxarlh48w6q.cloudfront.net/web/v1/images/facebook.svghttps://d27yxarlh48w6q.cloudfront.net/web/v1/images/insta.svghttps://d27yxarlh48w6q.cloudfront.net/web/v1/images/twitter.svghttps://d27yxarlh48w6q.cloudfront.net/web/v1/images/youtube.svghttps://d27yxarlh48w6q.cloudfront.net/web/v1/images/linkedin.svg

        Our Company

        News & EventsBlogCareersGrievance RedressalSkill-Lync ReviewsTermsPrivacy PolicyBecome an Affiliate
        map
        EpowerX Learning Technologies Pvt Ltd.
        4th Floor, BLOCK-B, Velachery - Tambaram Main Rd, Ram Nagar South, Madipakkam, Chennai, Tamil Nadu 600042.
        mail
        info@skill-lync.com
        mail
        ITgrievance@skill-lync.com

        Top Individual Courses

        Computational Combustion Using Python and CanteraIntroduction to Physical Modeling using SimscapeIntroduction to Structural Analysis using ANSYS WorkbenchIntroduction to Structural Analysis using ANSYS Workbench

        Top PG Programs

        Post Graduate Program in Hybrid Electric Vehicle Design and AnalysisPost Graduate Program in Computational Fluid DynamicsPost Graduate Program in CADPost Graduate Program in Electric Vehicle Design & Development

        Skill-Lync Plus

        Executive Program in Electric Vehicle Embedded SoftwareExecutive Program in Electric Vehicle DesignExecutive Program in Cybersecurity

        Trending Blogs

        Heat Transfer Principles in Energy-Efficient Refrigerators and Air Conditioners Advanced Modeling and Result Visualization in Simscape Exploring Simulink and Library Browser in Simscape Advanced Simulink Tools and Libraries in SimscapeExploring Simulink Basics in Simscape

        © 2025 Skill-Lync Inc. All Rights Reserved.

                    Do You Want To Showcase Your Technical Skills?
                    Sign-Up for our projects.