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

Project 1 - Parsing NASA thermodynamic data

AIM : 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. You will be reading this file NASA thermodynamic data(Tip: use fopen and fgetl). The formulae are shown below.  Here R is the universal gas constant,…

    • Shaik Faraz

      updated on 13 Jun 2022

    AIM :

    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. You will be reading this file NASA thermodynamic data(Tip: use fopen and fgetl). The formulae are shown below.

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

    The FIRST 7 coefficients are HIGH-temperature coefficients and the SECOND 7 coefficients are LOW-temperature coefficients.

    Also use the LOCAL TEMPERATURE RANGES which is unique for each individual species, not the GLOBAL TEMPERATURE RANGE.

    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.

    4. 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.

    THEORY :

    Parsing: Parsing a file means reading in a data stream and building a memory model of the content of that data. This aims at facilitating perfoming some kind of transformation on the data. Parsing splits a file or other input into pieces of data that can be easily stored or manipulated.

    DATA SOURCE :

    Link to thermodynamic data file,

    NASA thermodynamic data

    FORMULAE USED :

    MAIN code :

    %writing code for file parsing
    clear all
    close all
    clc
     
    % here we are opening the file
    % reading the header
    F1=fopen('THERMO.dat','r')
    first_line=fgetl(F1);
     
    %defining the values for R which is gas constant
    R=8.314;
     
    % know taking tempreture from the file
    % readingsecond line
    % knowing and dividing the tempreture
    % converting the string into number
    temp=fgetl(F1);
    A=strsplit(temp,' ');
     
    % assigning the temperatures
    globel_low_tempreture=str2num(A{2});
    globel_middle_tempreture=str2num(A{3});
    globel_high_tempreture=str2num(A{4});
     
    % define the tempreture range
    tempreture=linspace(globel_low_tempreture,globel_high_tempreture,globel_middle_tempreture);
     
    %we have to skip the 3lines of comments
    third_line=fgetl(F1);
    fourth_line=fgetl(F1);
    fifth_line=fgetl(F1);
     
    %now running the the for loop for 53 different species
    for i=1:53
     
    %taking 1st species
    sixth_line=fgetl(F1);
    M=strsplit(sixth_line,' ');
    species_name=M{1};
     
    %know finding the coefficents from the 1st line of the taken species
    sixth_line_one=fgetl(F1);
    a=findstr(sixth_line_one,'E');
     
    %there fore we have 5 coefficents in our 1st line so we have to find the 5 coefficents
    a1=sixth_line_one(1:a(1)+3);
    a1=str2num(a1);
    a2=sixth_line_one(a(1)+4:a(2)+3);
    a2=str2num(a2);
    a3=sixth_line_one(a(2)+4:a(3)+3);
    a3=str2num(a3)
    a4=sixth_line_one(a(3)+4:a(4)+3);
    a4=str2num(a4);
    a5=sixth_line_one(a(4)+4:a(5)+3);
    a5=str2num(a5);
     
    % we have to move to next line for further coefficents here we have 5 coefficents
    sixth_line_sec=fgetl(F1)
    a=findstr(sixth_line_sec,'E')
    a6=sixth_line_sec(1:a(1)+3);
    a6=str2num(a6);
    a7=sixth_line_sec(a(1)+4:a(2)+3);
    a7=str2num(a7);
    a8=sixth_line_sec(a(2)+4:a(3)+3);
    a8=str2num(a8)
    a9=sixth_line_sec(a(3)+4:a(4)+3);
    a9=str2num(a9);
    a10=sixth_line_sec(a(4)+4:a(5)+3);
    a10=str2num(a10);
     
    % we have to move to next line for further coefficents here we have 5 coefficents
    sixth_line_third=fgetl(F1)
    a=findstr(sixth_line_sec,'E')
    a11=sixth_line_sec(1:a(1)+3);
    a11=str2num(a11);
    a12=sixth_line_sec(a(1)+4:a(2)+3);
    a12=str2num(a12);
    a13=sixth_line_sec(a(2)+4:a(3)+3);
    a13=str2num(a13)
    a14=sixth_line_sec(a(3)+4:a(4)+3);
    a14=str2num(a14);
     
    %know we have to find the entropy enthalpy and specific heat
     
    % calling the function for entropy
    A=entropy(a1,a2,a3,a4,a5,a7,a8,a9,a10,a11,a12,a14,tempreture,globel_middle_tempreture,R);
     
    % calling the function for enthalphy
    B=enthalphy(a1,a2,a3,a4,a5,a6,a8,a9,a10,a11,a12,a13,tempreture,globel_middle_tempreture,R)
     
    %calling the function for specific heat
    C=speciofic_heat(a1,a2,a3,a4,a5,a8,a9,a10,a11,a12,tempreture,globel_middle_tempreture,R)
     
    % calling the function for moleculer weigth
    molecular_w(i) = molecular_weight(species_name)
     
    %writting the moleculer weight into a file
    molecular_weight_of_the_species=fopen('molecular_weight.txt','w');
    fprintf(molecular_weight_of_the_species,'molecular weight of the %s is %f \n',species_name,molecular_w);
    fclose( molecular_weight_of_the_species)
     
    % making a file directory
    derectory_curr=pwd;
    mkdir(species_name);
    cd(species_name);
     
    %plotting
     
    %tempreture vs entropy
    figure(1)
    plot(tempreture,A,'color','r',LineWidth=2)
    xlabel('tempreturess')
    ylabel('entropys')
    grid on
    title(sprintf('variation in entropy wrt tempreture in %s',species_name))
    saveas(figure(1),'entrogy.jpg')
     
    %tempreture vs enthalpy
    figure(2)
    plot(tempreture,B,'color','b',LineWidth=2)
    xlabel('tempreture')
    ylabel('enthalpy')
    grid on
    title(sprintf('variation in enthalpy wrt tempreture in %s',species_name))
    saveas(figure(2),'enthalpy.jpg')
     
    %tempreture vs specific heat
    figure(3)
    plot(tempreture,C,'color','k',LineWidth=2)
    xlabel('tempreture')
    ylabel('specific_heat')
    grid on
    title(sprintf('variation in specific heat wrt tempreture in %s',species_name))
    saveas(figure(3),'specificheat.jpg')
    cd(derectory_curr)
     
    % end the loop
    end
    project 1 parsing main code 1
    project 1 parsing main code 2
    project 1 parsing main code 3
    project 1 parsing main code 4
     
     
    Function Molecular Weight code :
     
    function molecular_w = molecular_weight(species_name)
    %creating array of elements
    key_possion=['O','H','C','N','A']
    %storing the atomic mass into an array
    compounds_value= [15.999,1.008,12.011,14.007,39.948];
    molecular_w= 0;
    %creating the loop
    for i = 1:length(species_name)
    for j = 1:length(key_possion)
    if strcmp(species_name(i),key_possion(j))
    %if above statement is truw then calculate
    molecular_w= molecular_w+compounds_value(j);
    poss = j;
    end
    end
    %converting the string into the number
    K= str2num(species_name(i));
    %comparing if the value for K is greter then excicuted the further
    %statements
    if (K>1)
    molecular_w = molecular_w+compounds_value(j)*(K-1);
    end
    fprintf('molecular weight of the species %s',species_name)
    fprintf('%f',molecular_w)
    disp(' ')
    end
    project 1 parsing function mol weight code
     
    Function Entropy code :
     
    % writting the function for entropy
    function [A]=entropy(a1,a2,a3,a4,a5,a7,a8,a9,a10,a11,a12,a14,tempreture,globel_middel_temp,R)
    %as mensioned in the question 1st 7 coeeficents are high temp and secound 7
    %coefficents are low tempreture
    % creating loop to divede this cofficents
    if (tempreture>=globel_middel_temp)
    A=R*(a1.*log(tempretur)+a2.*(tempreture)+(a3.*(tempreture).^2/2)+(a4.*(tempreture.^3)/3)+(a5.*(tempreture).^4/4)+a7);
    else
    A=R.*(a8.*log(tempreture)+a9.*(tempreture)+(a10.*(tempreture).^2/2)+(a11.*(tempreture.^3)/3)+(a12.*(tempreture).^4/4)+a14);
    end
    end
    project 1 parsing function entropy code
     
    Function Enthalpy code :
     
    % writting the function for enthalphy
    function [B]=enthalphy(a1,a2,a3,a4,a5,a6,a8,a9,a10,a11,a12,a13,tempreture,globel_middel_temp,R)
    %as mensioned in the question 1st 7 coeeficents are high temp and secound 7
    %coefficents are low tempreture
    % creating loop to divede this cofficents
    if (tempreture>=globel_middel_temp)
    B=R.*tempreture.*(a1+(a2.*tempreture/2)+(a3.*(tempreture).^2/3)+(a4.*(tempreture).^3/4)+(a5.*(tempreture).^4/5)+(a6.*(tempreture).^5/6));
    else
    B=R.*tempreture.*(a8+(a9.*tempreture/2)+(a10.*(tempreture).^2/3)+(a11.*(tempreture).^3/4)+(a12.*(tempreture).^4/5)+(a13.*(tempreture).^5/6));
    end
    end
    project 1 parsing function enthalpy code
     
    Function Specific Heat code :
     
    % writting the function for enthalphy
    function [C]=speciofic_heat(a1,a2,a3,a4,a5,a8,a9,a10,a11,a12,tempreture,globel_middel_temp,R)
     
    %as mensioned in the question 1st 7 coeeficents are high temp and secound 7
    %coefficents are low tempreture
    % creating loop to divede this cofficents
    if (tempreture>=globel_middel_temp)
    C=R.*(a1+(a2.*(tempreture))+(a3.*(tempreture).^2)+(a4.*(tempreture).^3)+(a5.*(tempreture).^4));
    else
    C=R.*(a8+(a9.*(tempreture))+(a10.*(tempreture).^2)+(a11.*(tempreture).^3)+(a12.*(tempreture).^4));
    end
    end
    project 1 parsing function specific heat code
     
    Result :
     
    The plots are saved with there respecive species folders
    saved plots in respective folders
    The molecular wieght is also saved and dispalyed in the command window
    molecular weight
     
    Some of the plots with species
     
    1. O
     
    2. OH
     
     

    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 Shaik Faraz (27)

    Project 1 : CFD Meshing for Tesla Cyber Truck

    Objective:

    Aim: Performing topological cleanup and surface mesh on tesla cyber truck and on a wind tunnel based on selected target length values of its different components using element type as Tria, as well as appropriate selection of the volume that contains the vehicle and its surroundings with the wind tunnel for volumetric…

    calendar

    15 Nov 2022 04:17 AM IST

    • ANSA
    • CFD
    Read more

    Week 5 Challenge : Surface wrap on Automotive Assembly

    Objective:

    Aim: Perforform Topo cleanup and delete unwanted surfaces for Surface wrap. After Topo cleanup, Merge all 3 models and perform surface wrap. Target length for Wrap = 3 mm   1. Engine:    2. Gear box:   3. Transmission:   Procedure: 1. Topo Cleanup : (Engine, Transmission & Gear Box)…

    calendar

    10 Nov 2022 08:22 AM IST

      Read more

      Week 4 Challenge : CFD Meshing for BMW car

      Objective:

      Aim: To perform topological clean-up, and carry out the surface meshing of a BMW M6 car model and create a wind tunnel surrounding the same. Objectives: For the given model, check and solve all geometrical errors on half portion and Assign appropriate PIDs. Perform meshing with the given Target length and element Quality…

      calendar

      07 Nov 2022 11:33 AM IST

        Read more

        Week 3 Challenge : CFD meshing on Turbocharger

        Objective:

        Aim: Performing CFD meshing on Turbocharger using ANSA Objective: For the given model, check for the geometrical errors to make appropriate volumes. Create and assign PIDs as shown in the video. Perform surface mesh with the given target lengths as per PIDs. Blade stage-1 = 1 mm Blade stage-2 = 1 mm Impeller = 2 mm…

        calendar

        03 Nov 2022 08:06 AM IST

        • ANSA
        • CFD
        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.