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
|
struct ProprietatiAer{ double densitateAN; double cAm, double iA, double densitateA, double etaA, double niuA, double lambdaA, double aA, double PrA };
ProprietatiAer propA(double tempa)
{
double densitateAN{ 1.2928 };
//entalpia
double cAm = InterpolareEntalpieAer(tempa);
double iA = cAm*tempa;
//densitatea la o temperatura oarecare:
double densitateA = densitateAN*(273.15 / (tempa + 273.15));
//vascozitate cinematica
double etaA = InterpolareEtaAer(tempa);
double niuA = etaA/ densitateA;
//difuzivtatea termica a aerului
double lambdaA = InterpolareLambdaAer(tempa);
double aA = (lambdaA / (densitateA*cAm))*densitateAN;
//Prandtl pentru aer
double PrA = niuA / aA;
//return
ProprietatiAer ret;
ret.densitateAN;
ret.cAm;
ret.iA;
ret.densitateA;
ret.etaA;
ret.niuA;
ret.lambdaA;
ret.aA;
ret.PrA;
main()...
//1
std::cout << "1) temperatura aerului la intrare: tAprim = " << tAprim << "\n\n";
ProprietatiAer ret = propA(tAprim);
double aerprim0 = ret.densitateAN;
double aerprim1 = ret.cAm;
double aerprim2 = ret.iA;
double aerprim3 = ret.densitateA;
double aerprim4 = ret.etaA;
double aerprim5 = ret.niuA;
double aerprim6 = ret.lambdaA;
double aerprim7 = ret.aA;
double aerprim8 = ret.PrA;
std::cout << "entalpia:\n";
std::cout<<"cAmprim = " << aerprim[1] << " kJ / m3N*grad\n";
std::cout << "iAprim = " << aerprim[2] << " kJ/m3N\n\n";
std::cout << "densitatea la o temperatura oarecare:\n";
std::cout << "densitateAprim = " << aerprim[3] << " kg/m3\n\n";
std::cout << "vascozitate cinematica:\n";
std::cout << "etaAprim = " << aerprim[4] << " *10^-6 Pa*s\n";
std::cout << "niuAprim = " << aerprim[5] << " *10^-6 m2/s\n\n";
std::cout << "difuzivtatea termica a aerului:\n";
std::cout << "lambdaAprim = " << aerprim[6] << " *10^-3 W/m*K\n";
std::cout << "aAprim = " << aerprim[7] << " *10^-6 m2/s\n\n";
std::cout << "Prandtl pentru aer:\n";
std::cout << "PrAprim = " << aerprim[8] << "\n\n";
}
//functions for interpolation, only y changes for different ones
double InterpolareEntalpieAer(double tempea)
//please dissregard possible errors, it is still raw
{
std::vector<double> tempaer = { 0, 100, 200, 300 };
std::vector<double> y = { 1.297, 1.3, 1.307, 1.317 };
int i{ -1 };
double returni{ 0 };
if (tempea > 0 && tempea < 100) i = 0;
if (tempea > 100 && tempea < 200) i = 1;
if (tempea > 200 && tempea < 300) i = 2;
returni = ((tempea - tempaer[i]) / (tempaer[i + 1] - tempaer[i]))*(y[i + 1] - y[i]) + y[i];
return returni;
}
|