Challenge

Week 7 - Simulation of a 1D Super-sonic nozzle flow simulation using Macormack Method

Simulation of a 1D Super-sonic nozzle flow simulation using Macormack Method

OBJECTIVE:

1. Steady-state distribution of primitive variables inside the nozzle
2. Time-wise variation of the primitive variables
3. Variation of Mass flow rate distribution inside the nozzle at different time steps during the time-marching process
4. Comparison of Normalized mass flow rate distributions of both forms

Expected Results:

  • Perform a grid independence test on the solution and expain all your findings.
  • The code must be modular. You need to write separate functions to solve both forms.
  • Discuss all the plots you are providing with observed inferences.

INTRODUCTION:

In this present we are going to simulate the isentropic flow through a quasi 1D subsonic-supersonic nozzle. We will derive both the conservation and non-conservation forms of the governing equations and sovle them using the MacCormack's technique. We have determined the steady-state temperature distribution for the flow-field variables and investigated the difference between the two forms of governing equations by comparing their solutions.

THEORY:

We consider the steady isoentropic flow through the convergent-divergent nozzle as given in the diagram below:

MACH NUMBER:

SET UP

MaCcormack Method:

MATLAB CODE:

clear all
close all
clc

%INPUT PARAMETERS
n=31;
x=linspace(0,3,n);
dx=x(2)-x(1);
gamma=1.4;
CFL=0.5;
Area=1+2.2*(x-1.5).^2;
throt=((n+1)/2);
nt=1400;

%MAIN BODY
tic
[V,rho,T,m,M,P,V_t,rho_t,T_t,m_t,M_t,P_t]=non_conservative(throt,x,gamma,dx,Area,n,nt,CFL);
non_conservative=toc;

tic
[Vc,rhoc,Tc,cons_mass_flow_throat,Mc,Pc,Vc_throat,rho_throat,T_throat,cons_mass_flow,Mc_throat,Pc_throat]=conservative(throt,x,gamma,dx,Area,n,nt,CFL);
conservative=toc;

%PLOTTING SECTION
figure(3)
plot(x,m,'linewidth',0.95);
hold on;

plot(x,cons_mass_flow,'*');
figure(3)
plot(x,m,'linewidth',0.95);
held  on;
plot(x,cons_mass_flow,'*')
%EXACT ANALYTICAL SOLUTION roh*A*v=0.579;
plot(x,linspace(0.579,0.579,n),'--','linewidth',1.5);
xlabel('NON DIMENSIONAL DISTANCE OF NOZZLE(x)');
ylabel('MASS FLOW RATE');
legend('NON CONSERVATIVE FORM','CONSERVATIVE FORM','EXACT ANALYTICAL SOLUTION');
title('COMPARISION OF MASS FLOW RATE(CONVENTIONAL FORM Vs NON-CONVENTIONAL FORM)');
grid on;

figure(4)
plot(x,M,'linewidth',1.5);
held  on;
plot(x,Mc,'*','linewidth',0.65,'color','g')
grid on
xlabel('DISTANCE OF NOZZLE(x)');
ylabel('MACH NUMBER M');
legend('NON CONSERVATIVE FORM','CONSERVATIVE FORM');
title('MACH NUMBER PROFILE');
grid on;

figure(5)
plot(x,P,'linewidth',1.25);
held  on
plot(x,pc,'g','linewidth',1.25);
grid on
xlabel('DISTANCE OF NOZZLE(x)');
ylabel('PRESSURE');
legend('NON CONSERVATIVE FORM','CONSERVATIVE FORM');
title('PRESURE PROFILE');
grid on;

figure(6)
plot(x,rho,'linewidth',1.5);
held  on
plot(x,rhoc,'*','linewidth',1.25);
grid on
xlabel('DISTANCE OF NOZZLE(x)');
ylabel('DENSITY');
legend('NON CONSERVATIVE FORM','CONSERVATIVE FORM');
title('DENSITY PROFILE');
grid on;

figure(7)
plot(x,T,'linewidth',1.5);
held  on
plot(x,Tc,'*','linewidth',0.65,'color','g');
grid on
xlabel('DISTANCE OF NOZZLE(x)');
ylabel('TEMPERATURE');
legend('NON CONSERVATIVE FORM','CONSERVATIVE FORM');
title('TEMPERATURE CHANGE');
grid on;

figure(8)
plot(x,V,'linewidth',1.0);
held  on
plot(x,Vc,'*','linewidth',0.65,'color','g');
grid on
xlabel('DISTANCE OF NOZZLE(x)');
ylabel('VELOCITY');
legend('NON CONSERVATIVE FORM','CONSERVATIVE FORM');
title('VELOCITY PROFILE');
grid on;

figure(9)
plot(1:nt,rho_throat,'linewidth',1.5);
held  on
plot(1:nt,rho_t,'c','linewidth',1.65);
grid on
%xlabel('DISTANCE OF NOZZLE(x)');
ylabel('DENSITY');
legend('NON CONSERVATIVE FORM','CONSERVATIVE FORM');
title('DENSITY VARIATION AT VARIOUS TIME STEP');
grid on;

figure(10)
plot(1:nt,T_throat,'linewidth',1.5);
held  on
plot(1:nt,T_t,'linewidth',0.95);
grid on
%xlabel('DISTANCE OF NOZZLE(x)');
ylabel('TEMPERATURE');
legend('NON CONSERVATIVE FORM','CONSERVATIVE FORM');
title('TEMPERATURE VARIATION AT VARIOUS TIME STEP AT THROAT');
grid on;

figure(11)
plot(1:nt,pc_throat,'linewidth',0.85);
held  on
plot(1:nt,P_t,'linewidth',0.95);
grid on
%xlabel('DISTANCE OF NOZZLE(x)');
ylabel('PRESSURE');
legend('NON CONSERVATIVE FORM','CONSERVATIVE FORM');
title('PRESSURE VARIATION AT VARIOUS TIME STEP AT THROAT');
grid on;

figure(12)
plot(1:nt,Mc_throat,'linewidth',0.85);
held  on
plot(1:nt,M_t,'linewidth',0.90);
grid on
xlabel('TIME STEP');
ylabel('MACH NUMBER');
legend('NON CONSERVATIVE FORM','CONSERVATIVE FORM');
title('PRESSURE VARIATION AT VARIOUS TIME STEP AT THROAT');
grid on;

CODE FOR NON CONSERVATIVE FORM:

CODE FOR CONSERVATIVE FUNCTION

'

OUTPUT:

NON CONSERVATIVE

CONSERVATIVE

n=61, where n is the number of grid points

Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.