1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114
|
#include <iostream>
#include <math.h>
//#include <stdio.h>
#include <string>
using namespace std;
int main()
{
double Pt1, Tt1, Tt1R,Tt2R,Ts25R,Tt4,Ts5,Tt2,Tt5,Ps1,Ps2, Ps3;
double Ps5,Pt2,Pt25,D1, D3,D5,DP25, Kloss, LD, Aratio, Cps,gamma1,flowparam;
double Length, A1,/*A4*/A3,A25,Wa1, Wa2, Wa2factor,Wa3factor, Vmix,PtPsSec,Pmixin,TtTsRatio;
double Mach1,Mach2,/*Mach3,*/Mach4,Mach3sec,Mach5,Cpcalc,Ps5calc,Mach3pri,Ts3Sec;
double A5,PtPsRatio,Pt1Ps3Ratio,A3Astar,A5Astar,mu,Vav,Accel,Blockage75;
double Ts1R,Rho1,Rho2,Rho3,Rho4,Rho5,Vel1,Vel2,Vel3,Vel5;
double Wa1check,Wa2check,Wa3check,Wa4check,Wa4factor,DP15,Wa3,Asec3,TtTs3Sec,Aprimary3;
double Tsmixed,Psmixed,DPerror,Dpsec,Pt5Ps5,lambda,Re,FfAt,Pexit,DPtPsdiff,Ptmixed,Ptideal,H;
int Npass,Npass2;
//Inputs are below
cout << "Enter the Tt1 for the parameters: ";
cin >> Tt1;
cout << "Enter the Tt2 for the parameters: ";
cin >> Tt2;
cout << "Enter the L/D for the parameters: ";
cin >> LD;
cout << "Enter the Nozzle Exit Diameter for the parameters: ";
cin >> D1;
cout << "Enter the D3 for the parameters: ";
cin >> D3;
cout << "Enter the Aratio for the parameters: ";
cin >> Aratio;
cout << "Enter the Pt1 for the parameters: ";
cin >> Pt1;
cout << "Enter the Pt2 for the parameters: ";
cin >> Pt2;
cout << "Enter the Ps5 for the parameters: ";
cin >> Ps5;
cout << "Enter the Kloss for the parameters: ";
cin >> Kloss;
cout << "Enter the Cps for the parameters: ";
cin >> Cps;
//Inputs End
Tt1R = Tt1 + 460;
Tt2R = Tt2 + 460;
gamma1 = 0.000000000014 * (Tt1R*Tt1R*Tt1R) - 0.00000005575 * (Tt1R*Tt1R) + 0.00001864338 * Tt1R + 1.402579277865;
Mach1 = 1;
flowparam = Mach1 / pow((1 + (gamma1 - 1) / 2 * Mach1*Mach1), ((gamma1 + 1) / 2 / (gamma1 - 1)));
A1 = 3.14159 / 4 * D1*D1;
Length = LD * D3;
A3 = 3.14159 / 4 * D3 * D3;
A25 = 3.14159 / 4 * (D3 * D3 - D1 * D1);
D5 = pow((Aratio * 4 * A3 / 3.14159), 0.5);
A5 = 3.14159 / 4 * D5 * D5;
Wa1 = flowparam * Pt1 * A1 / pow((53.353 * Tt1R / 1.4 / 32.171), 0.5);
DP25 = Ps5 - Pt2;
Wa2 = 0.1 * Wa1;
Ps2 = 0.9 * Pt2;
Ps3 = Ps2;
mylabelhere:
Vmix = 0.3 * pow((1.4 * 53.35 * 32.174 * Tt2R), 0.5);
Wa2 = 0.003;
//Ps2 = 13.47;
Wa2factor = 0.0001;
//Ps3 = 13.4094;
Vmix = 514.5177;
Npass = 1;
Mach1 = 1;
TtTsRatio = 1.2;
PtPsRatio = pow(TtTsRatio, 3.5);
Ts1R = Tt1R / TtTsRatio;
Ps1 = Pt1 / PtPsRatio;
Rho1 = 144 * Ps1 / 53.353 / Ts1R;
Vel1 = Mach1 * pow((1.4 * 32.174 * 53.353 * Ts1R),0.5);
Wa1check = Rho1 * A1 * Vel1 / 144;
DP15 = Ps5 - Pt1;
cout<<"Wa2: "<<Wa2<<"\n";
cout<<"Mach1: "<<Mach1<<"\n";
Wa2 = Wa2 * (1 + Wa2factor);
double newWa2 = Wa2;
cout<<"newWa2: "<<newWa2<<"\n";
cout<<"Wa2factor before the loop: "<<Wa2factor<<"\n";
cout <<endl;
mylabel://Section 1
Npass ++; //counts the number of passes
cout << "Ps2: " <<Ps2<<"\n";
Tt4 = (Wa1 * Tt1R + Wa2 * Tt2R) / (Wa2 + Wa1);
Wa3 = Wa1 + Wa2;
Pt25 = (Pt2 + Kloss * Ps2) / (1 + Kloss);
Ts25R = Tt2R * pow((Ps2 / Pt25), (1 / 3.5));
Rho2 = 144 * Ps2 / 53.353 / Ts25R;
Vel2 = pow((2 * 32.174 * 778.17 * 0.24 * (Tt2R - Ts25R)), 0.5);
Mach2 = Vel2 / pow((1.4 * 32.174 * 53.353 * Ts25R), 0.5);
cout << "Mach2 inside the first section (1): " <<Mach2<<"\n";
Wa2check = Rho2 * A25 * Vel2 / 144;
Wa2factor = Wa2check / Wa2 - 1;
cout<<"Wa2factor after Wa2check: "<<Wa2factor<<"\n";
Ps2 = Ps2 * (1 + Wa2factor / 50);
cout<<"New Ps2: "<<Ps2<<"\n";
if(Ps2 != 13.4701)
{ //checks to see if Ps2 is 13.470
Ps2=Ps2 + .0001;
goto mylabelhere;
}
else
|