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. Anandita Gautam/
  3. Project 1 - Parsing NASA thermodynamic data

Project 1 - Parsing NASA thermodynamic data

  PARSING NASA THERMODYNAMIC DATA   OBJECTIVES   1. Write a function that extracts the 14 co-efficients and calculates the enthalpy, entropy and specific heats for all the species in the data file. Here R is the universal gas constant, T is the temeprature 2.  Calculate the molecular weight of each…

    • Anandita Gautam

      updated on 22 Sep 2020

     

    PARSING NASA THERMODYNAMIC DATA

     

    • OBJECTIVES

     

    1. Write a function that extracts the 14 co-efficients and calculates the enthalpy, entropy and specific heats for all the species in the data file.

    Here R is the universal gas constant, T is the temeprature

    2.  Calculate the molecular weight of each species and display it in the command window.3. Plot the Cp, Enthalpy and Entropy for the local temperature range (low temperature : high temperature) specific for each species.

    3. Save the plots as images with appropriate names and dump them in separate folders for each species with suitable name. All these should be generated automatically.

     

    • MATLAB Code

    MAIN PROGRAM

    clear all 
    close all 
    clc
    
    R = 8.31490;
    
    %To ready the THERMO.dat file
    f1 = fopen('THERMO.dat','r'); 
    fgetl(f1)
    tempL = str2num(fgetl(f1));
    
    % global_low_temperature = tempL(1) 
    % global_mid_temperature = tempL(2) 
    % global_high_temperature = tempL(3) 
    %for skipping the unwanted lines
    
    for i = 1:3
        fgetl(f1);
    end
    
    
    for y=1:53
    %for reading local temperatures 
    line0 = fgetl(f1);
    a = strfind(line0,'.'); 
    tlin0= strtok(line0);
    lt1 = line0(52-3:a(1)+3);
    lt2 = line0(a(1)+4:62+3);
    lt3 = line0(a(2)+4:72+3); 
    Local_Temp_low = str2num(lt1); 
    Local_Temp_high = str2num(lt2); 
    Local_Temp_mid = str2num(lt3);
    %To read the lines for coefficient %Reading the first line of Coefficient
    linel = fgetl(f1);
    b = findstr(linel,'E');
    a1 = str2num(linel(1:b(1)+3));
    a2 = str2num(linel(b(1)+4:b(2)+3));
    a3 = str2num(linel(b(2)+4:b(3)+3));
    a4 = str2num(linel(b(3)+4:b(4)+3)); 
    a5 = str2num(linel(b(4)+4:b(5)+3));
    
    %reading the second line of coefficient 
    line2 = fgetl(f1);
    c = findstr(line2,'E');
    a6 = str2num(line2(1:c(1)+3));
    a7 = str2num(line2(c(1)+4:c(2)+3));
    a8 = str2num(line2(c(2)+4:c(3)+3));
    a9 = str2num(line2(c(3)+4:c(4)+3)); 
    a10= str2num(line2(c(4)+4:c(5)+3));
    
    %Reading the third line of coefficient 
    
    line3 = fgetl(f1);
    d = findstr(line3,'E');
    a11 = str2num(line3(1:d(1)+3));
    a12 = str2num(line3(d(1)+4:d(2)+3));
    a13 = str2num(line3(d(2)+4:d(3)+3));
    a14 = str2num(line3(d(3)+4:d(4)+3));
    
    Lower_Temp = linspace(Local_Temp_low,Local_Temp_mid,100);
    Higher_Temp = linspace(Local_Temp_mid,Local_Temp_high,100);
    %Cp of the given data
    Cp_High = (a1 + a2*Higher_Temp + a3*Higher_Temp.^2 + a4*Higher_Temp.^3 + a5*Higher_Temp.^4 + a6*Higher_Temp.^5 + a7*Higher_Temp.^6 )*R ;
    Cp_Low = (a8 + a9*Lower_Temp + a10*Lower_Temp.^2 + a11*Lower_Temp.^3 + a12*Lower_Temp.^4 + a13*Lower_Temp.^5 + a14*Lower_Temp.^6)*R ;
    %Enthalphy of the given data
    H_High = (a1 + a2 * (Higher_Temp/2) + a3 * ((Higher_Temp).^2)/3 + a4 * ((Higher_Temp).^3)/4 + a5 * ((Higher_Temp).^4)/5 + a6 *((Higher_Temp).^5)/6 + a7 * ((Higher_Temp).^6)/7)*R.*Higher_Temp;
    H_Low = (a8 + a9 * (Lower_Temp/2) + a10 * ((Lower_Temp).^2)/3 + a11 * ((Lower_Temp).^3)/4 + a12 * ((Lower_Temp).^4)/5 + a13 * ((Lower_Temp).^5)/6 + a14 * ((Lower_Temp).^6)/7)*R.*Lower_Temp;
    %Entrophy Calculation for the given data
    S_High = (a1*log(Higher_Temp) + a2*Higher_Temp + (a3*Higher_Temp)/2 + (a4*Higher_Temp)/3 + (a5*Higher_Temp)/4 + a7)*R;
    S_Low = (a8*log(Lower_Temp) + a9*Lower_Temp + (a10*Lower_Temp)/2 + (a11*Lower_Temp)/3 + (a12*Lower_Temp)/4 + a14)*R;
    
    MolW(y) = molecular_weight(tlin0) 
    cd('D:/Project1/species')
    mkdir(tlin0)
    cd(tlin0)
    
    figure(1)
    plot(Lower_Temp,Cp_Low,'linewidth',3)
    hold on
    plot(Higher_Temp,Cp_High,'linewidth',3)
    hold off
    saveas(gcf,'file1.png')
    figure(2)
    plot(Lower_Temp,H_Low,'linewidth',3 ) 
    hold on
    plot(Higher_Temp,H_High,'linewidth',3)
    hold off
    saveas(gcf,'file2.png')
    
    figure(3)
    plot(Lower_Temp,S_Low,'linewidth',3)
    hold on
    plot(Higher_Temp,S_High,'linewidth',3)
    hold off
    saveas(gcf,'file3.png')
    cd('D:/Project1')
    
    
    end
     
    

     EXPLAINATION OF CODE

    1. Open and read the ‘THERMO.dat’ file using fopen command and store data in f1.
    2. Skip unnecessary lines using fgetl command and saving needed lines in tempL.
    3. Skip first 3 lines using fgetl command in a FOR loop
    4. To collect data of 53 elements in the file, start a FOR loop .
    5. Findstr command is used to finding the numbers and the local temperature is saved in line0.
    6. Get the required temperature data by using logical operators and str2num command to change strings into numbers.
    7. We use the same reasoning to find all the coefficients from a1 to a14
    8. Differentiate the high and low temperatures using linspace command
    9. Using the given formulas and applying the valid arthemtic operation to get the required output
    10. Create a new folder using mkdir command and change directories with cd command
    11. Plot the data using plot command using hold on and off to not open many windows.
    12. Use saveas command to save the figures in png format

     

    2. FUNCTION TO CALCULATE MOLECULAR MASS

    function MW = molecular_weight(line0)
    
    elements = ['H','C','O','N','A','S'];
    atomic_wt = [1.00 12.01 15.99 14.00 39.94 32.06];
    MW = 0;
    
    for i = 1:length(line0)
        for j = 1:length(elements)
            if strcmp(line0(i),elements(j))
                MW = MW + atomic_wt(j); 
                a = j;
            end
        end
        n = str2num(line0(i));
        
        if n>1
            MW=MW+atomic_wt(a)*(n-1);
        end
    
    end
    

     

    EXPLAINATION OF CODE

    1. We create a function molecular_weight function MW and assign tlin0 input to it.
    2. We define elements and atomic weight in arrays elements and atomic_weight..
    3. We create a FOR Loop which runs till length of line0 and nested loop which runs till lenth of elements.
    4. We create a IF condition and strcmp command to compare the species and calculate the molecular masses by comparison.
    5. We apply another IF condition to find if the species has more than one element and if yes then increment in the molecular mass calculation.

     

    3. OUTPUTS

    • PLOTS

    a. O2

     

     

     

     

    b. N2

     

     

    c. CO2

     

     

     

    • FOLDER LOCATION

     

     

    • COMMAND WINDOW DISPLAY

     

     

    Google Drive LINK :

    https://drive.google.com/drive/folders/1PXNrSC-KQDJ96zFnnAUSOdOt8OuqPLO3?usp=sharing

    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 Anandita Gautam (8)

    Frequency Analysis of a rotating shaft

    Objective:

    Introduction: An object's natural frequency is the frequency or rate that it vibrates naturally when disturbed. Objects can possess more than one natural frequency and we typically use harmonic oscillators as a tool for modeling the natural frequency of a particular object. We can apply an unnatural or forced frequency…

    calendar

    09 Sep 2022 01:53 PM IST

    • FEA
    Read more

    MBD Simulation on IC Engine Valve Train

    Objective:

    Aim: To model and perform motion analysis on Valve Train   Introduction: A valvetrain is a component that is designed to open and close the intake and exhaust valves so that air/fuel mixture can enter and leave the combustion chamber as gases. Nowadays, engines are designed with overhead cam assemblies which are known…

    calendar

    22 Dec 2020 04:18 PM IST

      Read more

      MBD Simulation on a Piston Assembly

      Objective:

      Aim: To model and perform motion analysis with different piston positions   Introduction: A piston is a component of reciprocating engines, reciprocating pumps, gas compressors, hydraulic cylinders and pneumatic cylinders, among other similar mechanisms. It is the moving component that is contained by a…

      calendar

      20 Dec 2020 07:37 PM IST

        Read more

        Planetary Gear

        Objective:

        Aim: To model and run a motion analysis on Planetary Gear System.   Introduction: An epicyclic gear train or planetary gear consists of 2-4 gears mounted so that the center of one gear revolves around the center of the other. The planet and sun gears mesh so that their pitch circles roll…

        calendar

        15 Dec 2020 03:36 PM IST

          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.