本文整理汇总了C++中Param::GetVelocity方法的典型用法代码示例。如果您正苦于以下问题:C++ Param::GetVelocity方法的具体用法?C++ Param::GetVelocity怎么用?C++ Param::GetVelocity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Param
的用法示例。
在下文中一共展示了Param::GetVelocity方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
double MWmix = 0.0;
std::cout << "\nMole fractions" << std::endl;
std::cout << "========================= " << std::endl;
double massfrac[chem.nspecies];
for(int i = 0; i < chem.nspecies; ++i){
massfrac[i] = param.massfractions[i];
}
chem.MassFractionToMoleFraction(massfrac, molfrac);
for(int i = 0; i < chem.nspecies; ++i){
MWmix += molfrac[i] * chem.species[i].MW;
std::cout << "xi[" << chem.species[i].symbol << "]: " << molfrac[i] << std::endl;
}
std::cout << "\nMass fractions" << std::endl;
std::cout << "========================= " << std::endl;
for(int i = 0; i < chem.nspecies; ++i){
std::cout << "Yi[" << chem.species[i].symbol << "]: " << param.massfractions[i] << std::endl;
}
std::cout << std::endl;
std::cout << "Mixture properties at " << TGiven << " (K)" << std::endl;
std::cout << "=======================================" << std::endl;
std::cout << "rho: " << rho << " kg/m^3" << std::endl;
std::cout << "Rmix: " << R << " J/kg.K" << std::endl;
std::cout << "Static pressure (EOS only): " << P << " Pa" << std::endl;
std::cout << "cvmix: " << cv << " (J/kg.K)" << std::endl;
std::cout << "cpmix: " << cp << " (J/kg.K)" << std::endl;
std::cout << "mwmix: " << MWmix << " (kg/mol)" << std::endl;
std::cout << "gammamix: " << gamma << std::endl;
std::cout << "Thermal conductivity: " << chem.GetThermalConductivity(rhoi, TGiven) << " (W/m.K)" << std::endl;
std::cout << "Viscosity: " << chem.GetThermalConductivity(rhoi, TGiven) << " (Pa.s)" << std::endl;
double c = sqrt(gamma*R*TGiven);
std::cout << "c (speed of sound): " << c << " m/s" << std::endl;
double u = param.flowdir[0]*param.GetVelocity(1)*param.ref_velocity;
double v = param.flowdir[1]*param.GetVelocity(1)*param.ref_velocity;
double w = param.flowdir[2]*param.GetVelocity(1)*param.ref_velocity;
double v2 = u*u + v*v + w*w;
std::cout << "U: " << u << " m/s" << std::endl;
std::cout << "V: " << v << " m/s" << std::endl;
std::cout << "W: " << w << " m/s" << std::endl;
std::cout << "Mach: " << sqrt(v2/(c*c)) << std::endl;
double Ht = rho*chem.GetSpecificEnthalpy(X, TGiven, hi) + 0.5*rho*v2;
double Et = rho*chem.GetSpecificEnthalpy(X, TGiven, hi) - P + 0.5*rho*v2;
std::cout << "Total enthalpy: " << Ht/1000.0 << " (kJ)" << std::endl;
std::cout << "Total energy: " << Et/1000.0 << " (kJ)" << std::endl;
std::cout << "Total internal energy: " << (Et - 0.5*rho*v2)/1000.0 << " (kJ)" << std::endl;
std::cout << "Total pressure (gamma-1.0 formula): " << ((gamma - 1.0)*(Et - 0.5*rho*v2)/param.ref_enthalpy)*
param.ref_pressure << " Pa" << std::endl;
std::cout << "Total temperature (gamma-1.0 formula): " << TGiven*(1.0 + (gamma-1.0)/2.0*(v2/(c*c))) << " (K) " << std::endl;
std::cout << "\nAt given temperature of " << TGiven << "K production rates are: " << std::endl;
std::cout << "===================================================" << std::endl;
chem.GetMassProductionRates(rhoi, TGiven, wdot);
for(i = 0; i < chem.nspecies; i++){
std::cout << chem.species[i].symbol << ": " << wdot[i] << " kg/(m^3 s)" << std::endl;
}
Real sum = 0.0;
for(i = 0; i < chem.nspecies; i++){
sum += wdot[i];
}
std::cout << "Mass blanance: " << sum << " kg/(m^3 s)" << std::endl;
std::cout << "\nDerivatives at given temp: " << TGiven << std::endl;
std::cout << "===================================================" << std::endl;