├── .gitignore ├── docs └── SieCompressorLibUml.dia └── src ├── AirfoilSectionConfiguration.cpp ├── AirfoilSectionConfiguration.h ├── AirfoilSectionResult.cpp ├── AirfoilSectionResult.h ├── AnnulusPoint.cpp ├── AnnulusPoint.h ├── CartesianPoint.cpp ├── CartesianPoint.h ├── Compressor.cpp ├── Compressor.h ├── CompressorAirfoilConfiguration.cpp ├── CompressorAirfoilConfiguration.h ├── CompressorAnnulus.cpp ├── CompressorAnnulus.h ├── CompressorEnumerations.h ├── CompressorLeakage.cpp ├── CompressorLeakage.h ├── CompressorLeakagePerformance.cpp ├── CompressorLeakagePerformance.h ├── CompressorOperatingPoint.cpp ├── CompressorOperatingPoint.h ├── CompressorSpeedLine.cpp ├── CompressorSpeedLine.h ├── CompressorStage.cpp ├── CompressorStage.h ├── CompressorStagePerformance.cpp ├── CompressorStagePerformance.h ├── CompressorTwoDAirfoilConfiguration.cpp ├── CompressorTwoDAirfoilConfiguration.h ├── Diffuser.cpp ├── Diffuser.h ├── DiffuserPerformance.cpp ├── DiffuserPerformance.h ├── Info.h ├── Inlet.cpp ├── Inlet.h ├── InletGuideVane.cpp ├── InletGuideVane.h ├── InletGuideVanePerformance.cpp ├── InletGuideVanePerformance.h ├── InletPerformance.cpp ├── InletPerformance.h ├── LossCorrelationData.cpp ├── LossCorrelationData.h ├── Polynomial.cpp ├── Polynomial.h ├── StringTokenizer.cpp ├── StringTokenizer.h ├── StringTrimmers.h ├── ThermodynamicPoint.cpp └── ThermodynamicPoint.h /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | #add Debug and Release folders 3 | /Debug 4 | /Release 5 | 6 | #other files to ignore 7 | radial_ratios.inp 8 | 9 | #ignore backup files 10 | *~ 11 | -------------------------------------------------------------------------------- /docs/SieCompressorLibUml.dia: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jonnybach/compressor_types/25cd5d267dc2ab5eff9ae66e139b2b138893bae7/docs/SieCompressorLibUml.dia -------------------------------------------------------------------------------- /src/AirfoilSectionConfiguration.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * AirfoilSectionConfiguration.cpp 3 | * 4 | * Created on: Sep 11, 2012 5 | * Author: bachm03j 6 | */ 7 | 8 | #include "AirfoilSectionConfiguration.h" 9 | #include 10 | #include 11 | 12 | AirfoilSectionConfiguration::AirfoilSectionConfiguration() 13 | { 14 | // TODO Auto-generated constructor stub 15 | } 16 | 17 | AirfoilSectionConfiguration::AirfoilSectionConfiguration(double radius, double pqc, double tqc, double aqc 18 | , double chord, double stagrAng, double betaMtlIn, double betaMtlOut 19 | , double beta1, double delBeta, double avdr, double machInRel, double delDevn, double delLoss ) 20 | { 21 | //_radius = radius; 22 | _pqc = pqc; 23 | _tqc = tqc; 24 | _aqc = aqc; 25 | _chord = chord; 26 | _stagrAng = stagrAng; 27 | _betaMin = betaMtlIn; 28 | _betaMout = betaMtlOut; 29 | _beta1 = beta1; 30 | _delBeta = delBeta; 31 | _avdr = avdr; 32 | _machInRel = machInRel; 33 | _delDevn = delDevn; 34 | _delLoss = delLoss; 35 | } 36 | 37 | AirfoilSectionConfiguration::AirfoilSectionConfiguration(AnnulusPoint lePoint, AnnulusPoint tePoint, 38 | double pqc, double tqc, double aqc, double chord, double stagrAng, double betaMtlIn, double betaMtlOut, 39 | double beta1, double delBeta, double avdr, double machInRel, double delDevn, double delLoss ) 40 | { 41 | _lePnt = lePoint; 42 | _tePnt = tePoint; 43 | _pqc = pqc; 44 | _tqc = tqc; 45 | _aqc = aqc; 46 | _chord = chord; 47 | _stagrAng = stagrAng; 48 | _betaMin = betaMtlIn; 49 | _betaMout = betaMtlOut; 50 | _beta1 = beta1; 51 | _delBeta = delBeta; 52 | _avdr = avdr; 53 | _machInRel = machInRel; 54 | _delDevn = delDevn; 55 | _delLoss = delLoss; 56 | } 57 | 58 | AirfoilSectionConfiguration::~AirfoilSectionConfiguration() 59 | { 60 | // TODO Auto-generated destructor stub 61 | } 62 | 63 | void AirfoilSectionConfiguration::setHpaConfig(double beta1, double delBeta 64 | , double tqc, double avdr, double machInRel) 65 | { 66 | _beta1 = beta1; 67 | _delBeta = delBeta; 68 | _tqc = tqc; 69 | _avdr = avdr; 70 | _machInRel = machInRel; 71 | } 72 | 73 | AirfoilSectionResult AirfoilSectionConfiguration::getResult() const { return m_result; }; 74 | void AirfoilSectionConfiguration::setResult(AirfoilSectionResult newResult) { 75 | m_result = newResult; 76 | } 77 | 78 | AnnulusPoint AirfoilSectionConfiguration::getLePoint() const { return _lePnt; } 79 | void AirfoilSectionConfiguration::setLePoint( AnnulusPoint newLePnt ) 80 | { 81 | //delete(_lePnt); 82 | _lePnt = newLePnt; 83 | } 84 | 85 | AnnulusPoint AirfoilSectionConfiguration::getTePoint() const { return _tePnt; } 86 | void AirfoilSectionConfiguration::setTePoint( AnnulusPoint newTePnt ) 87 | { 88 | //delete(_tePnt); 89 | _tePnt = newTePnt; 90 | } 91 | 92 | double AirfoilSectionConfiguration::getRadiusDelta() const { 93 | double r_le = _lePnt.getRadius(); 94 | double r_te = _tePnt.getRadius(); 95 | double delR = std::abs(r_le - r_te); 96 | return delR; 97 | } 98 | 99 | double AirfoilSectionConfiguration::getRadiusMean() const 100 | { 101 | double r_le = _lePnt.getRadius(); 102 | double r_te = _tePnt.getRadius(); 103 | double r_mean = (r_le + r_te)/2; 104 | return r_mean; 105 | } 106 | 107 | //double AirfoilSectionConfiguration::getRadius() const { return _radius; } 108 | 109 | double AirfoilSectionConfiguration::getPqC() const { return _pqc; } 110 | double AirfoilSectionConfiguration::getTqC() const { return _tqc; } 111 | double AirfoilSectionConfiguration::getAqC() const { return _aqc; } 112 | 113 | double AirfoilSectionConfiguration::getThickness() const { return _tqc * _chord; } 114 | double AirfoilSectionConfiguration::getChord() const { return _chord; } 115 | double AirfoilSectionConfiguration::getAxialChord() const { 116 | double axChrd = std::abs( _tePnt.getX() - _lePnt.getX() ); 117 | return axChrd; 118 | } 119 | 120 | double AirfoilSectionConfiguration::getStagrAng() const { return _stagrAng; } 121 | double AirfoilSectionConfiguration::getBetaMtlIn() const { return _betaMin; } 122 | double AirfoilSectionConfiguration::getBetaMtlOut() const { return _betaMout; } 123 | 124 | double AirfoilSectionConfiguration::getBeta1() const { return _beta1; } 125 | double AirfoilSectionConfiguration::getDelBeta() const { return _delBeta; } 126 | double AirfoilSectionConfiguration::getAvdr() const { return _avdr; } 127 | double AirfoilSectionConfiguration::getMachInRel() const { return _machInRel; } 128 | 129 | double AirfoilSectionConfiguration::getDelDevn() const { return _delDevn; } 130 | double AirfoilSectionConfiguration::getDelLoss() const { return _delLoss; } 131 | -------------------------------------------------------------------------------- /src/AirfoilSectionConfiguration.h: -------------------------------------------------------------------------------- 1 | /* 2 | * AirfoilSectionConfiguration.h 3 | * 4 | * Created on: Sep 11, 2012 5 | * Author: bachm03j 6 | * 7 | * This class represents the input values into STARMEP (or other meridional flow solver) that have been 8 | * interpolated or re-calculated at the last solved streamline location. This is different from the original 9 | * user inputs b/c the original inputs do not necessarily lie along a the solved streamline locations but rather 10 | * arbitrary locations based on geometrical requirements. 11 | * 12 | */ 13 | 14 | #ifndef AIRFOILSECTIONCONFIGURATION_H_ 15 | #define AIRFOILSECTIONCONFIGURATION_H_ 16 | 17 | #include "CompressorEnumerations.h" 18 | #include "AirfoilSectionResult.h" 19 | #include "AnnulusPoint.h" 20 | 21 | class AirfoilSectionConfiguration { 22 | 23 | public: 24 | AirfoilSectionConfiguration(); 25 | 26 | AirfoilSectionConfiguration(double radius, 27 | double pqc, 28 | double tqc, 29 | double aqc, 30 | double chord, 31 | double stagrAng, 32 | double betaMtlIn, 33 | double betaMtlOut, 34 | double beta1, 35 | double delBeta, 36 | double avdr, 37 | double machIn, 38 | double delDevn, 39 | double delLoss 40 | ); 41 | 42 | AirfoilSectionConfiguration(AnnulusPoint lePoint, AnnulusPoint tePoint, 43 | double pqc, 44 | double tqc, 45 | double aqc, 46 | double chord, 47 | double stagrAng, 48 | double betaMtlIn, 49 | double betaMtlOut, 50 | double beta1, 51 | double delBeta, 52 | double avdr, 53 | double machInRel, 54 | double delDevn, 55 | double delLoss 56 | ); 57 | 58 | virtual ~AirfoilSectionConfiguration(); 59 | 60 | AirfoilSectionResult getResult() const; 61 | void setResult(AirfoilSectionResult newResult); 62 | 63 | AnnulusPoint getLePoint() const; 64 | void setLePoint(AnnulusPoint newLePnt); 65 | 66 | AnnulusPoint getTePoint() const; 67 | void setTePoint(AnnulusPoint newTePnt); 68 | 69 | void setHpaConfig(double beta1, double delBeta, double tqc, double avdr, double machIn); 70 | 71 | double getRadiusDelta() const; 72 | double getRadiusMean() const; 73 | 74 | double getPqC() const; 75 | double getTqC() const; 76 | double getAqC() const; 77 | 78 | double getThickness() const; 79 | double getChord() const; 80 | double getAxialChord() const; 81 | 82 | double getStagrAng() const; 83 | double getBetaMtlIn() const; 84 | double getBetaMtlOut() const; 85 | 86 | double getBeta1() const; 87 | double getDelBeta() const; 88 | double getAvdr() const; 89 | double getMachInRel() const; 90 | 91 | double getDelDevn() const; 92 | double getDelLoss() const; 93 | 94 | private: 95 | 96 | AnnulusPoint _lePnt; // x, Rad (meters) 97 | AnnulusPoint _tePnt; // x, Rad (meters) 98 | 99 | AirfoilSectionResult m_result; 100 | 101 | //double _radius; //radial location of airfoil section 102 | 103 | //NOTE: values below represent inputs defined by the user of STARMEP. A set of results should exists that represent the true values used from the calculation 104 | 105 | double _pqc; //pitch to chord 106 | double _tqc; //thickness to chord 107 | double _aqc; //relative CG to chord 108 | 109 | double _chord; //absolute chord (meters) 110 | 111 | double _stagrAng; //stagger angle (deg) - NOTE: output for HPA airfoils 112 | double _betaMin; //in metal angle (deg) - NOTE: output for HPA airfoils 113 | double _betaMout; //out metal angle (deg) - NOTE: output for HPA airfoils 114 | 115 | double _machInRel; //inlet relative mach number 116 | 117 | double _beta1; //relative inlet flow angle (deg) 118 | double _delBeta; //change in flow angle in to out (deg) 119 | double _avdr; //axial velocity density ratio 120 | 121 | double _delDevn; //Comp1D specific deviation correction adder 122 | double _delLoss; //Comp1D specific loss correction adder 123 | 124 | }; 125 | 126 | #endif /* AIRFOILSECTIONCONFIGURATION_H_ */ 127 | -------------------------------------------------------------------------------- /src/AirfoilSectionResult.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * AirfoilSectionResult.cpp 3 | * 4 | * Created on: May 30, 2013 5 | * Author: bachm03j 6 | */ 7 | 8 | #include "AirfoilSectionResult.h" 9 | 10 | AirfoilSectionResult::AirfoilSectionResult() { 11 | // TODO Auto-generated constructor stub 12 | 13 | } 14 | AirfoilSectionResult::~AirfoilSectionResult() { 15 | // TODO Auto-generated destructor stub 16 | } 17 | 18 | 19 | double AirfoilSectionResult::getAlphaLe() const 20 | { 21 | return m_alphaLe; 22 | } 23 | 24 | double AirfoilSectionResult::getAlphaTe() const 25 | { 26 | return m_alphaTe; 27 | } 28 | 29 | double AirfoilSectionResult::getBetaLe() const 30 | { 31 | return m_betaLe; 32 | } 33 | 34 | double AirfoilSectionResult::getBetaTe() const 35 | { 36 | return m_betaTe; 37 | } 38 | 39 | double AirfoilSectionResult::getMachAbsLe() const 40 | { 41 | return m_machAbsLe; 42 | } 43 | 44 | double AirfoilSectionResult::getMachAbsTe() const 45 | { 46 | return m_machAbsTe; 47 | } 48 | 49 | double AirfoilSectionResult::getMachRelLe() const 50 | { 51 | return m_machRelLe; 52 | } 53 | 54 | double AirfoilSectionResult::getMachRelTe() const 55 | { 56 | return m_machRelTe; 57 | } 58 | 59 | double AirfoilSectionResult::getPressLe() const 60 | { 61 | return m_pressLe; 62 | } 63 | 64 | double AirfoilSectionResult::getPressTe() const 65 | { 66 | return m_pressTe; 67 | } 68 | 69 | double AirfoilSectionResult::getPressTotAbsLe() const 70 | { 71 | return m_pressTotAbsLe; 72 | } 73 | 74 | double AirfoilSectionResult::getPressTotAbsTe() const 75 | { 76 | return m_pressTotAbsTe; 77 | } 78 | 79 | double AirfoilSectionResult::getPressTotRelLe() const 80 | { 81 | return m_pressTotRelLe; 82 | } 83 | 84 | double AirfoilSectionResult::getPressTotRelTe() const 85 | { 86 | return m_pressTotRelTe; 87 | } 88 | 89 | double AirfoilSectionResult::getTempLe() const 90 | { 91 | return m_tempLe; 92 | } 93 | 94 | double AirfoilSectionResult::getTempRecov() const 95 | { 96 | return m_tempRecov; 97 | } 98 | 99 | double AirfoilSectionResult::getTempTe() const 100 | { 101 | return m_tempTe; 102 | } 103 | 104 | double AirfoilSectionResult::getTempTotAbsLe() const 105 | { 106 | return m_tempTotAbsLe; 107 | } 108 | 109 | double AirfoilSectionResult::getTempTotAbsTe() const 110 | { 111 | return m_tempTotAbsTe; 112 | } 113 | 114 | double AirfoilSectionResult::getTempTotRelLe() const 115 | { 116 | return m_tempTotRelLe; 117 | } 118 | 119 | double AirfoilSectionResult::getTempTotRelTe() const 120 | { 121 | return m_tempTotRelTe; 122 | } 123 | 124 | 125 | void AirfoilSectionResult::setAlphaLe(double m_alphaLe) 126 | { 127 | this->m_alphaLe = m_alphaLe; 128 | } 129 | 130 | void AirfoilSectionResult::setAlphaTe(double m_alphaTe) 131 | { 132 | this->m_alphaTe = m_alphaTe; 133 | } 134 | 135 | void AirfoilSectionResult::setBetaLe(double m_betaLe) 136 | { 137 | this->m_betaLe = m_betaLe; 138 | } 139 | 140 | void AirfoilSectionResult::setBetaTe(double m_betaTe) 141 | { 142 | this->m_betaTe = m_betaTe; 143 | } 144 | 145 | void AirfoilSectionResult::setMachAbsLe(double m_machAbsLe) 146 | { 147 | this->m_machAbsLe = m_machAbsLe; 148 | } 149 | 150 | void AirfoilSectionResult::setMachAbsTe(double m_machAbsTe) 151 | { 152 | this->m_machAbsTe = m_machAbsTe; 153 | } 154 | 155 | void AirfoilSectionResult::setMachRelLe(double m_machRelLe) 156 | { 157 | this->m_machRelLe = m_machRelLe; 158 | } 159 | 160 | void AirfoilSectionResult::setMachRelTe(double m_machRelTe) 161 | { 162 | this->m_machRelTe = m_machRelTe; 163 | } 164 | 165 | void AirfoilSectionResult::setPressLe(double m_pressLe) 166 | { 167 | this->m_pressLe = m_pressLe; 168 | } 169 | 170 | void AirfoilSectionResult::setPressTe(double m_pressTe) 171 | { 172 | this->m_pressTe = m_pressTe; 173 | } 174 | 175 | void AirfoilSectionResult::setPressTotAbsLe(double m_pressTotAbsLe) 176 | { 177 | this->m_pressTotAbsLe = m_pressTotAbsLe; 178 | } 179 | 180 | void AirfoilSectionResult::setPressTotAbsTe(double m_pressTotAbsTe) 181 | { 182 | this->m_pressTotAbsTe = m_pressTotAbsTe; 183 | } 184 | 185 | void AirfoilSectionResult::setPressTotRelLe(double m_pressTotRelLe) 186 | { 187 | this->m_pressTotRelLe = m_pressTotRelLe; 188 | } 189 | 190 | void AirfoilSectionResult::setPressTotRelTe(double m_pressTotRelTe) 191 | { 192 | this->m_pressTotRelTe = m_pressTotRelTe; 193 | } 194 | 195 | void AirfoilSectionResult::setTempLe(double m_tempLe) 196 | { 197 | this->m_tempLe = m_tempLe; 198 | } 199 | 200 | void AirfoilSectionResult::setTempRecov(double m_tempRecov) 201 | { 202 | this->m_tempRecov = m_tempRecov; 203 | } 204 | 205 | void AirfoilSectionResult::setTempTe(double m_tempTe) 206 | { 207 | this->m_tempTe = m_tempTe; 208 | } 209 | 210 | void AirfoilSectionResult::setTempTotAbsLe(double m_tempTotAbsLe) 211 | { 212 | this->m_tempTotAbsLe = m_tempTotAbsLe; 213 | } 214 | 215 | void AirfoilSectionResult::setTempTotAbsTe(double m_tempTotAbsTe) 216 | { 217 | this->m_tempTotAbsTe = m_tempTotAbsTe; 218 | } 219 | 220 | void AirfoilSectionResult::setTempTotRelLe(double m_tempTotRelLe) 221 | { 222 | this->m_tempTotRelLe = m_tempTotRelLe; 223 | } 224 | 225 | void AirfoilSectionResult::setTempTotRelTe(double m_tempTotRelTe) 226 | { 227 | this->m_tempTotRelTe = m_tempTotRelTe; 228 | } 229 | 230 | double AirfoilSectionResult::getMassFlow() const 231 | { 232 | return m_massFlow; 233 | } 234 | 235 | void AirfoilSectionResult::setMassFlow(double m_massFlow) 236 | { 237 | this->m_massFlow = m_massFlow; 238 | } 239 | 240 | 241 | 242 | 243 | -------------------------------------------------------------------------------- /src/AirfoilSectionResult.h: -------------------------------------------------------------------------------- 1 | /* 2 | * AirfoilSectionResult.h 3 | * 4 | * Created on: May 30, 2013 5 | * Author: bachm03j 6 | */ 7 | 8 | #ifndef AIRFOILSECTIONRESULT_H_ 9 | #define AIRFOILSECTIONRESULT_H_ 10 | 11 | class AirfoilSectionResult { 12 | 13 | public: 14 | AirfoilSectionResult(); 15 | 16 | virtual ~AirfoilSectionResult(); 17 | 18 | 19 | //properties 20 | double getAlphaLe() const; 21 | double getAlphaTe() const; 22 | double getBetaLe() const; 23 | double getBetaTe() const; 24 | double getMachAbsLe() const; 25 | double getMachAbsTe() const; 26 | double getMachRelLe() const; 27 | double getMachRelTe() const; 28 | double getPressLe() const; 29 | double getPressTe() const; 30 | double getPressTotAbsLe() const; 31 | double getPressTotAbsTe() const; 32 | double getPressTotRelLe() const; 33 | double getPressTotRelTe() const; 34 | double getTempLe() const; 35 | double getTempRecov() const; 36 | double getTempTe() const; 37 | double getTempTotAbsLe() const; 38 | double getTempTotAbsTe() const; 39 | double getTempTotRelLe() const; 40 | double getTempTotRelTe() const; 41 | double getMassFlow() const; 42 | 43 | void setAlphaLe(double m_alphaLe); 44 | void setAlphaTe(double m_alphaTe); 45 | void setBetaLe(double m_betaLe); 46 | void setBetaTe(double m_betaTe); 47 | void setMachAbsLe(double m_machAbsLe); 48 | void setMachAbsTe(double m_machAbsTe); 49 | void setMachRelLe(double m_machRelLe); 50 | void setMachRelTe(double m_machRelTe); 51 | void setPressLe(double m_pressLe); 52 | void setPressTe(double m_pressTe); 53 | void setPressTotAbsLe(double m_pressTotAbsLe); 54 | void setPressTotAbsTe(double m_pressTotAbsTe); 55 | void setPressTotRelLe(double m_pressTotRelLe); 56 | void setPressTotRelTe(double m_pressTotRelTe); 57 | void setTempLe(double m_tempLe); 58 | void setTempRecov(double m_tempRecov); 59 | void setTempTe(double m_tempTe); 60 | void setTempTotAbsLe(double m_tempTotAbsLe); 61 | void setTempTotAbsTe(double m_tempTotAbsTe); 62 | void setTempTotRelLe(double m_tempTotRelLe); 63 | void setTempTotRelTe(double m_tempTotRelTe); 64 | void setMassFlow(double m_massFlow); 65 | 66 | 67 | private: 68 | 69 | double m_massFlow; 70 | 71 | double m_machAbsLe; 72 | double m_machRelLe; 73 | 74 | double m_machAbsTe; 75 | double m_machRelTe; 76 | 77 | double m_pressLe; 78 | double m_pressTe; 79 | double m_pressTotAbsLe; 80 | double m_pressTotAbsTe; 81 | double m_pressTotRelLe; 82 | double m_pressTotRelTe; 83 | 84 | double m_tempLe; 85 | double m_tempTe; 86 | double m_tempTotAbsLe; 87 | double m_tempTotAbsTe; 88 | double m_tempTotRelLe; 89 | double m_tempTotRelTe; 90 | 91 | double m_tempRecov; 92 | 93 | double m_alphaLe; 94 | double m_alphaTe; 95 | 96 | double m_betaLe; 97 | double m_betaTe; 98 | 99 | }; 100 | 101 | #endif /* AIRFOILSECTIONRESULT_H_ */ 102 | -------------------------------------------------------------------------------- /src/AnnulusPoint.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * AnnulusPoint.cpp 3 | * 4 | * Created on: Aug 27, 2012 5 | * Author: bachm03j 6 | */ 7 | 8 | #include "AnnulusPoint.h" 9 | #include 10 | 11 | AnnulusPoint::AnnulusPoint() { 12 | // TODO Auto-generated constructor stub 13 | 14 | } 15 | 16 | AnnulusPoint::AnnulusPoint(std::string labelIn, double Xin, double RadiusIn) { 17 | _label = labelIn; 18 | _X = Xin; 19 | _Y = RadiusIn; 20 | } 21 | 22 | AnnulusPoint::AnnulusPoint(AnnulusPoint *pntToCopy) { 23 | _label = pntToCopy->getLabel(); 24 | _X = pntToCopy->getX(); 25 | _Y = pntToCopy->getY(); 26 | _Z = pntToCopy->getZ(); 27 | } 28 | 29 | AnnulusPoint::~AnnulusPoint() { 30 | // TODO Auto-generated destructor stub 31 | } 32 | 33 | /* 34 | Originally meant to overload the CartesianPoint methods but seems that static overloading doesn't work as 35 | initially expected, using static_cast<> in places where an AnnulusPoint object must be returned. 36 | static AnnulusPoint *interpolatePointAtX( double X, AnnulusPoint *firstPnt, AnnulusPoint *secndPnt) { 37 | AnnulusPoint *interpPoint; 38 | interpPoint = static_cast( CartesianPoint::interpolatePointAtX(X, firstPnt, secndPnt ) ); 39 | return interpPoint; 40 | } 41 | 42 | static AnnulusPoint *interpolatePointAtFrac( double distFraction, AnnulusPoint *firstPnt, AnnulusPoint *secndPnt ) { 43 | AnnulusPoint *interpPoint; 44 | interpPoint = static_cast( CartesianPoint::interpolatePointAtFrac(distFraction, firstPnt, secndPnt ) ); 45 | return interpPoint; 46 | } 47 | */ 48 | 49 | double AnnulusPoint::getX() const { return _X; } 50 | double AnnulusPoint::getRadius() const { return _Y; } 51 | 52 | std::string AnnulusPoint::getLabel() const { return _label; } 53 | void AnnulusPoint::setLabel( std::string newLabel ) 54 | { 55 | _label = std::string( newLabel ); 56 | } 57 | 58 | double AnnulusPoint::axialAreaTo(AnnulusPoint *otherPoint ) 59 | { 60 | 61 | double MyRad, OtherRad; 62 | MyRad = this->getRadius(); 63 | OtherRad = otherPoint->getRadius(); 64 | 65 | double axialArea = M_PI * ( pow(OtherRad,2) - pow(MyRad,2) ); 66 | return axialArea; 67 | 68 | } 69 | 70 | double AnnulusPoint::frustumAreaTo(AnnulusPoint *otherPoint ) 71 | { 72 | 73 | double MyRad, OtherRad; 74 | MyRad = this->getRadius(); 75 | OtherRad = otherPoint->getRadius(); 76 | 77 | double delX = std::abs( _X - otherPoint->getX() ); 78 | double frustArea = M_PI * (MyRad + OtherRad) * sqrt( pow( (MyRad - OtherRad),2) + pow(delX, 2) ); 79 | return frustArea; 80 | 81 | } 82 | 83 | double AnnulusPoint::angleBetween(AnnulusPoint *otherPoint) { 84 | double ang = this->angleInXyPlane(otherPoint); 85 | return ang; //radians 86 | } 87 | -------------------------------------------------------------------------------- /src/AnnulusPoint.h: -------------------------------------------------------------------------------- 1 | /* 2 | * AnnulusPoint.h 3 | * 4 | * Created on: Aug 27, 2012 5 | * Author: bachm03j 6 | */ 7 | 8 | #ifndef ANNULUSPOINT_H_ 9 | #define ANNULUSPOINT_H_ 10 | 11 | #include "CartesianPoint.h" 12 | #include 13 | 14 | class AnnulusPoint: public CartesianPoint { 15 | public: 16 | AnnulusPoint(); 17 | AnnulusPoint(std::string labelIn, double Xin, double RadiusIn); 18 | AnnulusPoint(AnnulusPoint *pntToCopy); 19 | virtual ~AnnulusPoint(); 20 | 21 | //accessors (properties) 22 | double getX() const; 23 | double getRadius() const; 24 | std::string getLabel() const; 25 | void setLabel(std::string newLabel); 26 | 27 | double axialAreaTo(AnnulusPoint *otherPoint); 28 | double frustumAreaTo(AnnulusPoint *otherPoint); 29 | double angleBetween(AnnulusPoint *otherPoint); 30 | 31 | 32 | private: 33 | std::string _label; 34 | 35 | }; 36 | 37 | #endif /* ANNULUSPOINT_H_ */ 38 | 39 | -------------------------------------------------------------------------------- /src/CartesianPoint.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * CartesianPoint.cpp 3 | * 4 | * Created on: Aug 27, 2012 5 | * Author: bachm03j 6 | */ 7 | 8 | #include "CartesianPoint.h" 9 | #include 10 | 11 | CartesianPoint::CartesianPoint() { 12 | _X = 0.0; 13 | _Y = 0.0; 14 | _Z = 0.0; 15 | } 16 | 17 | CartesianPoint::CartesianPoint(double Xin, double Yin, double Zin) { 18 | _X = Xin; 19 | _Y = Yin; 20 | _Z = Zin; 21 | } 22 | 23 | CartesianPoint::CartesianPoint(double Xin, double Yin) { 24 | _X = Xin; 25 | _Y = Yin; 26 | _Z = 0.0; 27 | } 28 | 29 | CartesianPoint::CartesianPoint(CartesianPoint *pntToCopy) { 30 | _X = pntToCopy->getX(); 31 | _Y = pntToCopy->getY(); 32 | _Z = pntToCopy->getZ(); 33 | } 34 | 35 | CartesianPoint::~CartesianPoint() { 36 | // TODO Auto-generated destructor stub 37 | } 38 | 39 | double CartesianPoint::getX() { return _X; } 40 | double CartesianPoint::getY() { return _Y; } 41 | double CartesianPoint::getZ() { return _Z; } 42 | 43 | double CartesianPoint::radius() { 44 | return ( std::sqrt( pow(_Y, 2) + pow(_Z, 2) ) ); 45 | } 46 | 47 | double CartesianPoint::axialArea() { 48 | return ( M_PI * pow(this->radius(), 2) ); 49 | } 50 | 51 | double CartesianPoint::distanceTo(CartesianPoint *otherPnt) { 52 | double delX = (this->_X - otherPnt->getX()); 53 | double delY = (this->_Y - otherPnt->getY()); 54 | double delZ = (this->_Z - otherPnt->getZ()); 55 | double dist = sqrt( pow(delX,2.0) + pow(delY,2.0) + pow(delZ,2.0) ); 56 | return dist; 57 | } 58 | 59 | double CartesianPoint::angleInXyPlane(CartesianPoint *otherPnt) { 60 | double delX = (otherPnt->getX() - this->_X); 61 | double delY = (otherPnt->getY() - this->_Y); 62 | double ang = atan2(delY, delX); //this will calculate the true angle considering the quadrant location 63 | return ang; //radians 64 | } 65 | 66 | double CartesianPoint::angleInXzPlane(CartesianPoint *otherPnt) { 67 | double delX = (this->_X - otherPnt->getX()); 68 | double delZ = (this->_Z - otherPnt->getZ()); 69 | double ang = atan2(delZ, delX); 70 | return ang; //radians 71 | } 72 | 73 | bool CartesianPoint::equals(CartesianPoint *pntToCompare) { 74 | 75 | double Tol = 0.00000005; 76 | 77 | bool Xeql = false; 78 | bool Yeql = false; 79 | bool Zeql = false; 80 | 81 | 82 | if ( std::abs( _X - pntToCompare->getX() ) < Tol ) { 83 | Xeql = true; 84 | } 85 | 86 | if ( std::abs( _Y - pntToCompare->getY() ) < Tol ) { 87 | Yeql = true; 88 | } 89 | 90 | if ( std::abs( _Z - pntToCompare->getZ() ) < Tol ) { 91 | Zeql = true; 92 | } 93 | 94 | return (Xeql && Yeql && Zeql); 95 | 96 | } 97 | 98 | CartesianPoint *CartesianPoint::interpolatePointAtX( double X, CartesianPoint *firstPnt, CartesianPoint *secndPnt ) { 99 | 100 | double X1, X2; 101 | double Y1, Y2, Yintrp; 102 | double Z1, Z2, Zintrp; 103 | double m; 104 | 105 | X1 = firstPnt->getX(); 106 | X2 = secndPnt->getX(); 107 | 108 | m = (X - X1) / (X2 - X1); 109 | 110 | Y1 = firstPnt->getY(); 111 | Y2 = secndPnt->getY(); 112 | Z1 = firstPnt->getZ(); 113 | Z2 = secndPnt->getZ(); 114 | 115 | Yintrp = Y1 + m * (Y2 - Y1); 116 | Zintrp = Z1 + m * (Z2 - Z1); 117 | 118 | CartesianPoint *intrpPnt = new CartesianPoint(X, Yintrp, Zintrp); 119 | return intrpPnt; 120 | 121 | } 122 | 123 | CartesianPoint *CartesianPoint::interpolatePointAtFrac( double distFraction, CartesianPoint *firstPnt, CartesianPoint *secndPnt ) { 124 | 125 | double X1, X2, Xintrp; 126 | double Y1, Y2, Yintrp; 127 | double Z1, Z2, Zintrp; 128 | double m; 129 | 130 | m = distFraction; 131 | 132 | X1 = firstPnt->getX(); 133 | X2 = secndPnt->getX(); 134 | Y1 = firstPnt->getY(); 135 | Y2 = secndPnt->getY(); 136 | Z1 = firstPnt->getZ(); 137 | Z2 = secndPnt->getZ(); 138 | 139 | Xintrp = X1 + m * (X2 - X1); 140 | Yintrp = Y1 + m * (Y2 - Y1); 141 | Zintrp = Z1 + m * (Z2 - Z1); 142 | 143 | CartesianPoint *intrpPnt = new CartesianPoint(Xintrp, Yintrp, Zintrp); 144 | return intrpPnt; 145 | 146 | } 147 | 148 | double CartesianPoint::polygonArea(double *X, double *Y, int points) { 149 | // Public-domain function by Darel Rex Finley, 2006. 150 | // http://alienryderflex.com/polygon_area/ 151 | 152 | double area=0.0; 153 | int i, j = points-1; 154 | 155 | for (i=0; i 11 | #include 12 | 13 | #include "Inlet.h" 14 | #include "InletGuideVane.h" 15 | #include "Diffuser.h" 16 | #include "CompressorStage.h" 17 | #include "CompressorAnnulus.h" 18 | #include "LossCorrelationData.h" 19 | #include "StringTrimmers.h" 20 | 21 | Compressor::Compressor() : _annulus(NULL), _inlet(NULL), _igv(NULL), _diffuser(NULL), _lossCorrData(NULL) 22 | , _desPnt(NULL) { 23 | // TODO Auto-generated constructor stub 24 | } 25 | 26 | Compressor::~Compressor() { 27 | // TODO Auto-generated destructor stub 28 | } 29 | 30 | 31 | CompressorAnnulus *Compressor::getAnnulus() { 32 | if (!_annulus) { 33 | _annulus = new CompressorAnnulus(); 34 | } 35 | return _annulus; 36 | } 37 | 38 | void Compressor::setAnnulus(CompressorAnnulus *newAnnulus) { 39 | delete(_annulus); // I think you have to destroy the original data pointed to otherwise a memory leak occurs 40 | _annulus = newAnnulus; 41 | } 42 | 43 | 44 | Inlet *Compressor::getInlet() { 45 | if (!_inlet) { 46 | _inlet = new Inlet(); 47 | } 48 | return _inlet; 49 | } 50 | 51 | void Compressor::setInlet(Inlet *newInlet) { 52 | delete(_inlet); // I think you have to destroy the original data pointed to otherwise a memory leak occurs 53 | _inlet = newInlet; 54 | } 55 | 56 | 57 | InletGuideVane *Compressor::getIgv() { 58 | if (!_igv) { 59 | _igv = new InletGuideVane(); 60 | } 61 | return _igv; 62 | } 63 | 64 | void Compressor::setIgv(InletGuideVane *newIgv) { 65 | delete(_igv); // I think you have to destroy the original data pointed to otherwise a memory leak occurs 66 | _igv = newIgv; 67 | } 68 | 69 | 70 | Diffuser *Compressor::getDiffuser() { 71 | if (!_diffuser) { 72 | _diffuser = new Diffuser(-9999, -9999); //set to dummy values for aid in debugging 73 | } 74 | return _diffuser; 75 | } 76 | 77 | void Compressor::setDiffuser(Diffuser *newDiffuser) { 78 | delete(_diffuser); // I think you have to destroy the original data pointed to otherwise a memory leak occurs 79 | _diffuser = newDiffuser; 80 | } 81 | 82 | 83 | CompressorOperatingPoint *Compressor::getDesignPnt() { 84 | return _desPnt; 85 | } 86 | 87 | void Compressor::setDesignPnt(CompressorOperatingPoint *newDesignPnt) { 88 | delete (_desPnt); 89 | _desPnt = newDesignPnt; 90 | } 91 | 92 | 93 | LossCorrelationData *Compressor::getLossCorrData() { 94 | if (!_lossCorrData) { 95 | _lossCorrData = new LossCorrelationData(); 96 | } 97 | return _lossCorrData; 98 | } 99 | 100 | void Compressor::setLossCorrData(LossCorrelationData *newLossData) { 101 | delete(_lossCorrData); // I think you have to destroy the original data pointed to otherwise a memory leak occurs 102 | _lossCorrData = newLossData; 103 | } 104 | 105 | 106 | std::vector Compressor::getLeakages() { 107 | return m_leaks; 108 | } 109 | 110 | void Compressor::setLeakages(std::vector newLeakages) { 111 | m_leaks = newLeakages; 112 | } 113 | 114 | 115 | TipClearanceSpecification Compressor::getClearanceSpec() { return _clearncSpec; } 116 | void Compressor::setClearnaceSpec(TipClearanceSpecification clearncSpec) { 117 | if (clearncSpec < TIP_CLEARANCE_NONE || clearncSpec > TIP_CLEARANCE_ABSOLUTE ) throw std::exception(); 118 | _clearncSpec = clearncSpec; 119 | } 120 | 121 | 122 | std::vector Compressor::getStages() { 123 | return _stages; 124 | } 125 | 126 | void Compressor::insertStageAtIndex(int stageIndex, CompressorStage *newStage ) { 127 | _stages.insert(_stages.begin(), newStage); 128 | } 129 | 130 | CompressorStage *Compressor::stageWithNumber(int stageNumber) { 131 | 132 | //convert number to string 133 | std::stringstream ssStgNmbr; 134 | ssStgNmbr << stageNumber; 135 | std::string strStgNmbr = ssStgNmbr.str(); 136 | 137 | //search for stage by string representation of stage number 138 | CompressorStage *stageRef = 0; 139 | stageRef = this->stageWithName(strStgNmbr); 140 | return stageRef; 141 | 142 | } 143 | 144 | CompressorStage *Compressor::stageWithName(std::string stageName) { 145 | 146 | bool foundStage = false; 147 | CompressorStage *stageRef = 0; 148 | 149 | std::string lowStgName(stageName); 150 | stolower(lowStgName); 151 | 152 | std::vector::iterator it; 153 | for ( it=_stages.begin() ; it < _stages.end(); it++) { 154 | stageRef = *it; 155 | if ( stageRef->getStageName().find(lowStgName, 0 ) != std::string::npos ) { 156 | foundStage = true; 157 | break; //end looping 158 | } else { 159 | stageRef = 0; 160 | } 161 | } 162 | 163 | return stageRef; 164 | 165 | } 166 | 167 | CompressorStage *Compressor::findOrCreateStageWithName(std::string stageName) { 168 | //loop through stages and compare stage name with argument. If exists return the stage, 169 | // if not create a new stage and to the _stages vector and return the pointer 170 | 171 | bool foundStage = false; 172 | CompressorStage *stageRef = 0; 173 | 174 | std::string lowStgName(stageName); 175 | stolower(lowStgName); 176 | 177 | std::vector::iterator it; 178 | for ( it=_stages.begin() ; it != _stages.end(); it++) { 179 | stageRef = *it; 180 | if ( stageRef->getStageName().find(lowStgName, 0 ) != std::string::npos ) { 181 | foundStage = true; 182 | break; //end looping 183 | } else { 184 | stageRef = 0; 185 | } 186 | } 187 | 188 | if ( !foundStage ) { 189 | stageRef = new CompressorStage(lowStgName); 190 | //add newly created stage to stages vector 191 | _stages.push_back(stageRef); 192 | } 193 | 194 | return stageRef; 195 | 196 | } 197 | 198 | 199 | void Compressor::setVgvRuleAtStage(int stageNumber, double ruleFactor) { 200 | 201 | //keep track of the igv in this vane schedule, therefore increase stageNumber by 1 when resizing the vector 202 | if ( _vaneSchedule.size() < size_t(stageNumber+1) ) { 203 | _vaneSchedule.resize(stageNumber+1); 204 | } 205 | 206 | _vaneSchedule.insert(_vaneSchedule.begin()+stageNumber, ruleFactor); 207 | 208 | } 209 | 210 | double Compressor::getVgvRuleAtStage(int stageNumber) { 211 | double vgvRule = _vaneSchedule.at(stageNumber); 212 | return vgvRule; 213 | } 214 | 215 | 216 | void Compressor::addTwoDAirfoilConfig(CompressorTwoDAirfoilConfiguration newConfig ) { _airflTwoDConfigs.push_back(newConfig); } 217 | 218 | std::vector Compressor::getAirfoilTwoDConfigs() { return _airflTwoDConfigs; } 219 | 220 | CompressorTwoDAirfoilConfiguration *Compressor::getAirfoilTwoDConfigAtIndex(int index) { 221 | return &_airflTwoDConfigs.at(index); 222 | } 223 | 224 | CompressorTwoDAirfoilConfiguration *Compressor::getAirfoilTwoDConfigWithName(std::string name) 225 | { 226 | 227 | /* 228 | CompressorTwoDAirfoilConfiguration *ptr_af = 0; 229 | std::vector::const_iterator it; 230 | for ( it=_airflTwoDConfigs.begin() ; it != _airflTwoDConfigs.end(); it++) { 231 | //af = *it; 232 | if ( (*it).getName().find(name, 0 ) != std::string::npos ) { 233 | //ptr_af = ⁡ 234 | //foundConfig = true; 235 | break; //end looping 236 | } else { 237 | ptr_af = 0; 238 | } 239 | } COMMENTED THIS OUT DUE TO WEIRD BUGS OCCURING WHEN RETURNING REFERNCES USING THIS 240 | I SEEM TO BE HAVING CONSISTENT ISSUES WITH THE AIRFOIL 2D VECTOR AND SECTION CONFIGS VECTOR */ 241 | 242 | bool foundConfig = false; 243 | size_t iCnfg; 244 | size_t numConfigs = _airflTwoDConfigs.size(); 245 | for ( iCnfg = 0; iCnfg < numConfigs; ++iCnfg ) { 246 | if ( _airflTwoDConfigs.at(iCnfg).getName().find(name, 0 ) != std::string::npos ) { 247 | foundConfig = true; 248 | break; //end looping 249 | } 250 | } 251 | 252 | CompressorTwoDAirfoilConfiguration *ptr_af = 0; 253 | if ( foundConfig ) { 254 | ptr_af = &_airflTwoDConfigs.at(iCnfg); 255 | } 256 | 257 | return ptr_af; 258 | 259 | } 260 | -------------------------------------------------------------------------------- /src/Compressor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Compressor.h 3 | * 4 | * Created on: Aug 27, 2012 5 | * Author: bachm03j 6 | */ 7 | 8 | #ifndef COMPRESSOR_H_ 9 | #define COMPRESSOR_H_ 10 | 11 | #include "CompressorStage.h" 12 | #include "CompressorOperatingPoint.h" 13 | #include "CompressorEnumerations.h" 14 | #include "CompressorTwoDAirfoilConfiguration.h" 15 | #include "CompressorLeakage.h" 16 | 17 | class CompressorAnnulus; 18 | class Inlet; 19 | class InletGuideVane; 20 | class Diffuser; 21 | class LossCorrelationData; 22 | 23 | class Compressor { 24 | public: 25 | Compressor(); 26 | virtual ~Compressor();; 27 | 28 | CompressorAnnulus *getAnnulus(); 29 | void setAnnulus(CompressorAnnulus *newAnnulus); 30 | 31 | Inlet *getInlet(); 32 | void setInlet(Inlet *newInlet); 33 | 34 | InletGuideVane *getIgv(); 35 | void setIgv(InletGuideVane *newIgv); 36 | 37 | Diffuser *getDiffuser(); 38 | void setDiffuser(Diffuser *newDiffuser); 39 | 40 | CompressorOperatingPoint *getDesignPnt(); 41 | void setDesignPnt(CompressorOperatingPoint *newDesignPnt); 42 | 43 | LossCorrelationData *getLossCorrData(); 44 | void setLossCorrData(LossCorrelationData *newLossCorrData); 45 | 46 | std::vector getLeakages(); 47 | void setLeakages(std::vector newLeakages); 48 | 49 | TipClearanceSpecification getClearanceSpec(); 50 | void setClearnaceSpec(TipClearanceSpecification clearncSpec); 51 | 52 | void insertStageAtIndex(int stageIndex, CompressorStage *newStage ); 53 | std::vector getStages(); 54 | CompressorStage *stageWithNumber(int stageNumber); 55 | CompressorStage *stageWithName(std::string stageName); 56 | CompressorStage *findOrCreateStageWithName(std::string stageName); 57 | 58 | void setVgvRuleAtStage(int stageNumber, double ruleFactor); 59 | double getVgvRuleAtStage(int stageNumber); 60 | 61 | void addTwoDAirfoilConfig(CompressorTwoDAirfoilConfiguration newConfig ); 62 | CompressorTwoDAirfoilConfiguration *getAirfoilTwoDConfigAtIndex(int index); 63 | CompressorTwoDAirfoilConfiguration *getAirfoilTwoDConfigWithName(std::string name); 64 | std::vector getAirfoilTwoDConfigs(); 65 | 66 | 67 | private: 68 | CompressorAnnulus *_annulus; 69 | Inlet *_inlet; 70 | InletGuideVane *_igv; 71 | Diffuser *_diffuser; 72 | LossCorrelationData *_lossCorrData; 73 | 74 | std::vector m_leaks; 75 | 76 | CompressorOperatingPoint *_desPnt; 77 | 78 | std::vector _stages; 79 | std::vector _opPnts; 80 | std::vector _vaneSchedule; 81 | 82 | TipClearanceSpecification _clearncSpec; 83 | 84 | std::vector _airflTwoDConfigs; 85 | 86 | }; 87 | 88 | #endif /* COMPRESSOR_H_ */ 89 | -------------------------------------------------------------------------------- /src/CompressorAirfoilConfiguration.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * CompressorAirfoilConfiguration.cpp 3 | * 4 | * Created on: Aug 27, 2012 5 | * Author: bachm03j 6 | */ 7 | 8 | #include "CompressorAirfoilConfiguration.h" 9 | #include "AnnulusPoint.h" 10 | #include 11 | 12 | CompressorAirfoilConfiguration::CompressorAirfoilConfiguration() { 13 | // TODO Auto-generated constructor stub 14 | } 15 | 16 | /* 17 | CompressorAirfoilConfiguration::CompressorAirfoilConfiguration( 18 | AirfoilType airfoilType, int numBlades, double sqc, double tqc, double aqc, double oqs, double shapeK 19 | , double stagrAng, double betaMtlIn, double betaMtlOut, double tipClrToHgt 20 | , double delBetaM, double avdr, double machIn, double delDevn, double delLoss 21 | , double dsnStagePratio, double dsnAlphaExit, double bleedFrac ) { 22 | */ 23 | CompressorAirfoilConfiguration::CompressorAirfoilConfiguration( 24 | AirfoilType airfoilType, int numBlades, double sqc, double tqc, double aqc, double oqs, double shapeK 25 | , double stagrAng, double betaMtlIn, double betaMtlOut, double tipClrToHgt 26 | , double betaInAir, double delBetaAir, double avdr, double machIn, double delDevn, double delLoss 27 | , double bleedFrac ) { 28 | 29 | m_airfoilType = airfoilType; 30 | m_numBlades = numBlades; 31 | m_sqc = sqc; 32 | m_tqc = tqc; 33 | m_aqc = aqc; 34 | m_oqs = oqs; 35 | m_shapeK = shapeK; 36 | m_stagrAng = stagrAng; 37 | m_betaMin = betaMtlIn; 38 | m_betaMout = betaMtlOut; 39 | m_tipClrToHgt = tipClrToHgt; 40 | 41 | m_betaIn = betaInAir; 42 | m_delBeta = delBetaAir; 43 | m_avdr = avdr; 44 | m_machIn = machIn; 45 | m_delDevn = delDevn; 46 | m_delLoss = delLoss; 47 | 48 | //m_bleedFrac = bleedFrac; 49 | //if (bleedFrac != 0.0) { 50 | //using property so that the hasBleed flag is also set to true 51 | this->setBleedFrac(bleedFrac); 52 | //} 53 | } 54 | 55 | CompressorAirfoilConfiguration::~CompressorAirfoilConfiguration() { 56 | // TODO Auto-generated destructor stub 57 | } 58 | 59 | void CompressorAirfoilConfiguration::setDesignedParams(double sqc, double tqc, double betaMtlIn, double betaMtlOut, double cambrAng, double stagrAng) { 60 | m_sqc = sqc; 61 | m_tqc = tqc; 62 | m_betaMin = betaMtlIn; 63 | m_betaMout = betaMtlOut; 64 | m_camberAng = cambrAng; 65 | m_stagrAng = stagrAng; 66 | } 67 | 68 | void CompressorAirfoilConfiguration::setHpaConfig(double betaInAir, double delBetaAir, double tqc, double avdr, double machIn) { 69 | m_betaIn = betaInAir; 70 | m_delBeta = delBetaAir; 71 | m_tqc = tqc; 72 | m_avdr = avdr; 73 | m_machIn = machIn; 74 | } 75 | 76 | AirfoilType CompressorAirfoilConfiguration::getAirfoilType() { return m_airfoilType; } 77 | 78 | int CompressorAirfoilConfiguration::getNumBlades() { return m_numBlades; } 79 | 80 | double CompressorAirfoilConfiguration::getSqc() { return m_sqc; } 81 | double CompressorAirfoilConfiguration::getTqc() { return m_tqc; } 82 | double CompressorAirfoilConfiguration::getAqc() { return m_aqc; } 83 | double CompressorAirfoilConfiguration::getOqs() { return m_oqs; } 84 | 85 | double CompressorAirfoilConfiguration::getShapeK() { return m_shapeK; } 86 | 87 | double CompressorAirfoilConfiguration::getStagrAng() { return m_stagrAng; } 88 | double CompressorAirfoilConfiguration::getBetaMtlIn() { return m_betaMin; } 89 | double CompressorAirfoilConfiguration::getBetaMtlOut() { return m_betaMout; } 90 | 91 | double CompressorAirfoilConfiguration::getTipClrToHgt() { return m_tipClrToHgt; } 92 | 93 | double CompressorAirfoilConfiguration::getBetaIn() { return m_betaIn; } 94 | double CompressorAirfoilConfiguration::getDelBetaM() { return m_delBeta; } 95 | double CompressorAirfoilConfiguration::getAvdr() { return m_avdr; } 96 | double CompressorAirfoilConfiguration::getMachIn() { return m_machIn; } 97 | 98 | double CompressorAirfoilConfiguration::getDelDevn() { return m_delDevn; } 99 | double CompressorAirfoilConfiguration::getDelLoss() { return m_delLoss; } 100 | 101 | //double CompressorAirfoilConfiguration::getDsnStagePratio() { return _stagePratio; } 102 | //double CompressorAirfoilConfiguration::getDsnAlphaExit() { return _alphaExit; } 103 | 104 | bool CompressorAirfoilConfiguration::hasBleed() { return m_hasBleed; } 105 | double CompressorAirfoilConfiguration::getBleedFrac() { return m_bleedFrac; } 106 | void CompressorAirfoilConfiguration::setBleedFrac(double bleedFraction) { 107 | if (bleedFraction != 0.0) { 108 | m_bleedFrac = bleedFraction; 109 | m_hasBleed = true; 110 | } else { 111 | m_bleedFrac = 0.0; 112 | m_hasBleed = false; 113 | } 114 | } 115 | 116 | AnnulusPoint *CompressorAirfoilConfiguration::getHubLe() { return m_hubLe; } 117 | AnnulusPoint *CompressorAirfoilConfiguration::getHubTe() { return m_hubTe; } 118 | AnnulusPoint *CompressorAirfoilConfiguration::getCaseLe() { return m_caseLe; } 119 | AnnulusPoint *CompressorAirfoilConfiguration::getCaseTe() { return m_caseTe; } 120 | 121 | void CompressorAirfoilConfiguration::setSailPoints( AnnulusPoint *hubLe, AnnulusPoint *hubTe, AnnulusPoint *caseLe, AnnulusPoint *caseTe ) { 122 | //delete(_hubLe); 123 | //delete(_hubTe); 124 | //delete(_caseLe); 125 | //delete(_caseTe); 126 | m_hubLe = hubLe; 127 | m_hubTe = hubTe; 128 | m_caseLe = caseLe; 129 | m_caseTe = caseTe; 130 | } 131 | 132 | double CompressorAirfoilConfiguration::calcXnull() { 133 | 134 | if ( !m_hubTe || !m_hubLe || !m_caseTe || !m_caseLe ) { throw std::exception(); } 135 | 136 | double xh1, xh2, xc1, xc2; //axial location of hub and casing sail points 137 | xh1 = m_hubLe->getX(); 138 | xh2 = m_hubTe->getX(); 139 | xc1 = m_caseLe->getX(); 140 | xc2 = m_caseTe->getX(); 141 | 142 | double xavg = (xh1 + xh2 + xc1 + xc2)/4; 143 | return xavg; 144 | } 145 | -------------------------------------------------------------------------------- /src/CompressorAirfoilConfiguration.h: -------------------------------------------------------------------------------- 1 | /* 2 | * CompressorAirfoilConfiguration.h 3 | * 4 | * Created on: Aug 27, 2012 5 | * Author: bachm03j 6 | */ 7 | 8 | #ifndef COMPRESSORAIRFOILCONFIGURATION_H_ 9 | #define COMPRESSORAIRFOILCONFIGURATION_H_ 10 | 11 | #include "CompressorEnumerations.h" 12 | 13 | class AnnulusPoint; 14 | 15 | class CompressorAirfoilConfiguration { 16 | public: 17 | CompressorAirfoilConfiguration(); 18 | 19 | CompressorAirfoilConfiguration( 20 | AirfoilType airfoilType, 21 | int numBlades, 22 | double sqc, 23 | double tqc, 24 | double aqc, 25 | double oqs, 26 | double shapeK, 27 | double stagrAng, 28 | double betaMtlIn, 29 | double betaMtlOut, 30 | double tipClrToHgt, 31 | double betaInAir, 32 | double delBetaAir, 33 | double avdr, 34 | double machIn, 35 | double delDevn, 36 | double delLoss, 37 | double bleedFrac 38 | ); 39 | 40 | virtual ~CompressorAirfoilConfiguration(); 41 | 42 | void setDesignedParams(double sqc, double tqc, double betaMtlIn, double betaMtlOut 43 | , double cambrAng, double stagrAng); 44 | void setHpaConfig(double betaInAir, double delBetaAir, double tqc, double avdr, double machIn); 45 | 46 | AirfoilType getAirfoilType(); 47 | 48 | int getNumBlades(); 49 | 50 | double getSqc(); 51 | double getTqc(); 52 | 53 | double getAqc(); 54 | double getOqs(); 55 | double getShapeK(); 56 | 57 | double getCamberAng(); 58 | double getStagrAng(); 59 | 60 | double getBetaMtlIn(); 61 | double getBetaMtlOut(); 62 | 63 | double getTipClrToHgt(); 64 | 65 | double getBetaIn(); 66 | double getDelBetaM(); 67 | double getAvdr(); 68 | double getMachIn(); 69 | 70 | double getDelDevn(); 71 | double getDelLoss(); 72 | 73 | //double getDsnStagePratio(); 74 | //double getDsnAlphaExit(); 75 | 76 | bool hasBleed(); 77 | double getBleedFrac(); 78 | void setBleedFrac(double bleedFraction); 79 | 80 | AnnulusPoint *getHubLe(); 81 | AnnulusPoint *getHubTe(); 82 | AnnulusPoint *getCaseLe(); 83 | AnnulusPoint *getCaseTe(); 84 | 85 | void setSailPoints( AnnulusPoint *hubLe, AnnulusPoint *hubTe, AnnulusPoint *caseLe, AnnulusPoint *caseTe ); 86 | 87 | double calcXnull(); 88 | 89 | private: 90 | 91 | AirfoilType m_airfoilType; 92 | 93 | int m_numBlades; 94 | 95 | double m_sqc; //pitch to chord 96 | double m_tqc; //thickness to chord 97 | double m_aqc; //location max thickness to chord 98 | double m_oqs; //throat to pitch 99 | 100 | double m_shapeK; //shape coeff. Consult NACA SP 36. 101 | // Related to how similar the airfoil is to the standard NACA/DCA airfoils 102 | // from the correlations 103 | 104 | double m_camberAng; //camber angle (deg) 105 | double m_stagrAng; //stagger angle (deg) 106 | double m_betaMin; //in metal angle (deg) 107 | double m_betaMout; //out metal angle (deg) 108 | 109 | double m_tipClrToHgt; //ratio of tip clearance to height 110 | 111 | //HPA specific parameters 112 | double m_betaIn; //relative air inlet angle 113 | double m_delBeta; //change in air angle in to out (flow turning) 114 | double m_avdr; //axial velocity density ratio 115 | double m_machIn; //approach mach number 116 | 117 | double m_delDevn; //Comp1D specific deviation correction adder 118 | double m_delLoss; //Comp1D specific loss correction adder 119 | 120 | double m_bleedFrac; //fraction amount of inlet mass flow extracted just upstream of airfoil row 121 | bool m_hasBleed; //boolean to indicate whether stage has bleed extraction just upstream 122 | 123 | AnnulusPoint *m_hubLe, *m_hubTe; 124 | AnnulusPoint *m_caseLe, *m_caseTe; 125 | 126 | }; 127 | 128 | #endif /* COMPRESSORAIRFOILCONFIGURATION_H_ */ 129 | -------------------------------------------------------------------------------- /src/CompressorAnnulus.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * CompressorAnnulus.cpp 3 | * 4 | * Created on: Aug 27, 2012 5 | * Author: bachm03j 6 | */ 7 | 8 | #include "CompressorAnnulus.h" 9 | #include 10 | 11 | CompressorAnnulus::CompressorAnnulus() { 12 | // TODO Auto-generated constructor stub 13 | 14 | } 15 | 16 | CompressorAnnulus::~CompressorAnnulus() { 17 | // TODO Auto-generated destructor stub 18 | } 19 | 20 | void CompressorAnnulus::insertHubPointAtIndex(size_t pntIndex, AnnulusPoint * newHubPnt) { 21 | _hubProfile.insert( _hubProfile.begin()+pntIndex, newHubPnt); 22 | } 23 | 24 | void CompressorAnnulus::insertCasePointAtIndex(size_t pntIndex, AnnulusPoint * newCasePnt) { 25 | _caseProfile.insert( _caseProfile.begin()+pntIndex, newCasePnt); 26 | } 27 | 28 | void CompressorAnnulus::addHubPoint(AnnulusPoint * newHubPnt) { 29 | _hubProfile.push_back(newHubPnt); 30 | } 31 | 32 | void CompressorAnnulus::addCasePoint(AnnulusPoint * newCasePnt) { 33 | _caseProfile.push_back(newCasePnt); 34 | } 35 | 36 | std::vector CompressorAnnulus::getHubProfile() { return _hubProfile; } 37 | std::vector CompressorAnnulus::getCaseProfile() { return _caseProfile; } 38 | size_t CompressorAnnulus::getNumProfilePnts() { 39 | size_t numHubPnts = _hubProfile.size(); 40 | size_t numCasePnts = _hubProfile.size(); 41 | if ( numHubPnts != numCasePnts ) { throw std::exception(); } 42 | return numHubPnts; 43 | } 44 | 45 | AnnulusPoint* CompressorAnnulus::hubPointAtIndex(int index) { 46 | 47 | AnnulusPoint *hubPnt =_hubProfile.at(index); 48 | return hubPnt; 49 | 50 | } 51 | 52 | AnnulusPoint* CompressorAnnulus::casePointAtIndex(int index) { 53 | AnnulusPoint *casePnt =_caseProfile.at(index); 54 | return casePnt; 55 | } 56 | -------------------------------------------------------------------------------- /src/CompressorAnnulus.h: -------------------------------------------------------------------------------- 1 | /* 2 | * CompressorAnnulus.h 3 | * 4 | * Created on: Aug 27, 2012 5 | * Author: bachm03j 6 | */ 7 | 8 | #ifndef COMPRESSORANNULUS_H_ 9 | #define COMPRESSORANNULUS_H_ 10 | 11 | enum AnnulusLocation { 12 | ANNULUS_LOCATION_NONE = 0, 13 | ANNULUS_LOCATION_HUB = 1, 14 | ANNULUS_LOCATION_CASE = 2 15 | }; 16 | 17 | #include 18 | #include "AnnulusPoint.h" 19 | 20 | class CompressorAnnulus { 21 | public: 22 | CompressorAnnulus(); 23 | virtual ~CompressorAnnulus(); 24 | 25 | void insertHubPointAtIndex(size_t pntIndex, AnnulusPoint * newHubPnt); 26 | void insertCasePointAtIndex(size_t pntIndex, AnnulusPoint * newCasePnt); 27 | 28 | void addHubPoint(AnnulusPoint * newHubPnt); 29 | void addCasePoint(AnnulusPoint * newCasePnt); 30 | 31 | std::vector getHubProfile(); 32 | std::vector getCaseProfile(); 33 | size_t getNumProfilePnts(); 34 | 35 | AnnulusPoint* hubPointAtIndex(int index); 36 | AnnulusPoint* casePointAtIndex(int index); 37 | 38 | private: 39 | std::vector _hubProfile; 40 | std::vector _caseProfile; 41 | 42 | }; 43 | 44 | #endif /* COMPRESSORANNULUS_H_ */ 45 | -------------------------------------------------------------------------------- /src/CompressorEnumerations.h: -------------------------------------------------------------------------------- 1 | /* 2 | * CompressorEnumerations.h 3 | * 4 | * Created on: Sep 11, 2012 5 | * Author: bachm03j 6 | */ 7 | 8 | #ifndef COMPRESSORENUMERATIONS_H_ 9 | #define COMPRESSORENUMERATIONS_H_ 10 | 11 | #include 12 | 13 | enum AirfoilAxialLocation { 14 | AIRFOIL_AXI_LOCATION_NONE = 0, 15 | AIRFOIL_AXI_LOCATION_LE = 1, 16 | AIRFOIL_AXI_LOCATION_MID = 2, 17 | AIRFOIL_AXI_LOCATION_TE = 3, 18 | }; 19 | 20 | enum AirfoilRadialLocation { 21 | AIRFOIL_RADIAL_LOCATION_NONE = 0, 22 | AIRFOIL_RADIAL_LOCATION_ID = 1, 23 | AIRFOIL_RADIAL_LOCATION_MID = 2, 24 | AIRFOIL_RADIAL_LOCATION_OD = 3, 25 | }; 26 | 27 | enum AirfoilType { 28 | AIRFOIL_TYPE_NONE = -1, 29 | AIRFOIL_TYPE_NACA = 0, 30 | AIRFOIL_TYPE_DCA = 1, 31 | AIRFOIL_TYPE_CDA = 2, 32 | AIRFOIL_TYPE_HPA = 3 33 | }; 34 | 35 | enum AirfoilBehavior { 36 | AIRFOIL_BEHAVIOR_NONE = 0, 37 | AIRFOIL_BEHAVIOR_ROTOR = 1, 38 | AIRFOIL_BEHAVIOR_STATOR = 2, 39 | AIRFOIL_BEHAVIOR_IGV = 3, 40 | AIRFOIL_BEHAVIOR_OGV = 4 41 | }; 42 | 43 | enum TipClearanceSpecification { 44 | TIP_CLEARANCE_NONE = 0, 45 | TIP_CLEARANCE_RATIO = 1, // ratio of clearance to height 46 | TIP_CLEARANCE_ABSOLUTE = 2 // absolute values specified in millimeters 47 | }; 48 | 49 | enum RootType { 50 | ROOT_TYPE_NONE = 0, 51 | ROOT_TYPE_TR = 1, // t root - blades 52 | ROOT_TYPE_SH = 2, // dove tail root - blades 53 | ROOT_TYPE_SG = 3, // dove tail root - 1st stage blades 54 | ROOT_TYPE_SX = 4, // dove tail "x-shaped" root - blades 55 | ROOT_TYPE_SF = 5, // dove tail root - blades and vanes 56 | ROOT_TYPE_SFM = 6, // dove tail root trapezoidal - vanes 57 | ROOT_TYPE_SW = 7, // dove tail root variation - vanes 58 | ROOT_TYPE_SWM = 8, // dove tail root trapezoidal variation - vanes 59 | ROOT_TYPE_HR = 9, // h root - vanes 60 | ROOT_TYPE_VGV = 10 // vgv attachment 61 | }; 62 | 63 | namespace sie_comp { 64 | 65 | inline std::string getAirfoilAxialLocationString(AirfoilAxialLocation enumValue) 66 | { 67 | std::string strType; 68 | switch (enumValue) 69 | { 70 | case AIRFOIL_AXI_LOCATION_LE: 71 | strType = "LE"; 72 | break; 73 | case AIRFOIL_AXI_LOCATION_MID: 74 | strType = "MID"; 75 | break; 76 | case AIRFOIL_AXI_LOCATION_TE: 77 | strType = "TE"; 78 | break; 79 | default: 80 | strType = "NOT SET"; 81 | break; 82 | } 83 | return strType; 84 | } 85 | 86 | inline std::string getAirfoilRadialLocationString(AirfoilRadialLocation enumValue) 87 | { 88 | std::string strType; 89 | switch (enumValue) 90 | { 91 | case AIRFOIL_RADIAL_LOCATION_ID: 92 | strType = "ID"; 93 | break; 94 | case AIRFOIL_AXI_LOCATION_MID: 95 | strType = "MID"; 96 | break; 97 | case AIRFOIL_RADIAL_LOCATION_OD: 98 | strType = "OD"; 99 | break; 100 | default: 101 | strType = "NOT SET"; 102 | break; 103 | } 104 | return strType; 105 | } 106 | 107 | inline std::string getAirfoilTypeString(AirfoilType airfoilTypeValue) 108 | { 109 | std::string strType; 110 | switch (airfoilTypeValue) 111 | { 112 | case AIRFOIL_TYPE_NACA: 113 | strType = "NACA"; 114 | break; 115 | case AIRFOIL_TYPE_DCA: 116 | strType = "DCA"; 117 | break; 118 | case AIRFOIL_TYPE_CDA: 119 | strType = "CDA"; 120 | break; 121 | case AIRFOIL_TYPE_HPA: 122 | strType = "HPA"; 123 | break; 124 | default: 125 | strType = "NOT SET"; 126 | break; 127 | } 128 | return strType; 129 | } 130 | 131 | inline std::string getAirfoilBehaviorString(AirfoilBehavior airfoilBehaviorValue) 132 | { 133 | std::string strType; 134 | switch (airfoilBehaviorValue) 135 | { 136 | case AIRFOIL_BEHAVIOR_ROTOR: 137 | strType = "ROTOR"; 138 | break; 139 | case AIRFOIL_BEHAVIOR_STATOR: 140 | strType = "STATOR"; 141 | break; 142 | case AIRFOIL_BEHAVIOR_IGV: 143 | strType = "IGV"; 144 | break; 145 | case AIRFOIL_BEHAVIOR_OGV: 146 | strType = "OGV"; 147 | break; 148 | default: 149 | strType = "NOT SET"; 150 | break; 151 | } 152 | return strType; 153 | } 154 | 155 | inline std::string getRootTypeString(RootType rootTypeValue) 156 | { 157 | std::string strType; 158 | switch (rootTypeValue) 159 | { 160 | case ROOT_TYPE_TR: 161 | strType = "TR (t-design)"; 162 | break; 163 | case ROOT_TYPE_SH: 164 | strType = "SH (dovetail)"; 165 | break; 166 | case ROOT_TYPE_SG: 167 | strType = "SG (dovetail)"; 168 | break; 169 | case ROOT_TYPE_SX: 170 | strType = "SX (x shaped dovetail)"; 171 | break; 172 | case ROOT_TYPE_SF: 173 | strType = "SF (dovetail)"; 174 | break; 175 | case ROOT_TYPE_SFM: 176 | strType = "SFM (trapezoid dovetail)"; 177 | break; 178 | case ROOT_TYPE_SW: 179 | strType = "SW (dovetail)"; 180 | break; 181 | case ROOT_TYPE_SWM: 182 | strType = "SWM (trapezoid dovetail)"; 183 | break; 184 | case ROOT_TYPE_HR: 185 | strType = "HR (h-design)"; 186 | break; 187 | default: 188 | strType = "NOT SET"; 189 | break; 190 | } 191 | return strType; 192 | } 193 | 194 | } // end sie_comp namespace 195 | 196 | #endif /* COMPRESSORENUMERATIONS_H_ */ 197 | -------------------------------------------------------------------------------- /src/CompressorLeakage.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * CompressorLeakage.cpp 3 | * 4 | * Created on: Dec 12, 2013 5 | * Author: bachm03j 6 | */ 7 | 8 | #include 9 | 10 | #include "CompressorLeakage.h" 11 | #include "Compressor.h" 12 | #include "CompressorStage.h" 13 | #include "CompressorStagePerformance.h" 14 | 15 | 16 | CompressorLeakage::CompressorLeakage() { 17 | // TODO Auto-generated destructor stub 18 | } 19 | 20 | CompressorLeakage::CompressorLeakage(std::string stage, AirfoilBehavior afBehavior, AirfoilAxialLocation axiLocation) 21 | { 22 | m_stage = stage; 23 | m_afBhvr = afBehavior; 24 | m_afAxiLoc = axiLocation; 25 | } 26 | 27 | CompressorLeakage::~CompressorLeakage() { 28 | // TODO Auto-generated destructor stub 29 | } 30 | 31 | void CompressorLeakage::setLeakageProperties(Compressor* compressor) 32 | { 33 | 34 | //using locally stored stage name, get the compressor stage instance containing the 35 | // needed data 36 | CompressorStage *stage = compressor->stageWithName(m_stage); 37 | if ( !stage ) { throw std::exception(); } 38 | 39 | //from the specified axial location, set the appropriate performance point properties (LE, MID, TE) 40 | // iterate through all operating point performance instances and create new compressor leakage 41 | // performance instances, store in local performance vector 42 | 43 | double ptIn, psIn, ttIn, tsIn; 44 | double ptOut, psOut, ttOut, tsOut; 45 | double pt, ps, tt, ts; 46 | 47 | std::vector vStgPrf = stage->getOpPntPerf(); 48 | std::vector::iterator it; 49 | int i = 0; 50 | for (it = vStgPrf.begin(); it != vStgPrf.end(); ++it, ++i) { 51 | 52 | if (m_afBhvr == AIRFOIL_BEHAVIOR_ROTOR) { 53 | ptIn = (*it).getRotorPt1Rel(); 54 | psIn = (*it).getRotorPs1(); 55 | ttIn = (*it).getRotorTt1Rel(); 56 | tsIn = (*it).getRotorTs1(); 57 | 58 | ptOut = (*it).getRotorPt2Rel(); 59 | psOut = (*it).getRotorPs2(); 60 | ttOut = (*it).getRotorTt2Rel(); 61 | tsOut = (*it).getRotorTs2(); 62 | 63 | } else if (m_afBhvr == AIRFOIL_BEHAVIOR_STATOR) { 64 | ptIn = (*it).getStatorPt1(); 65 | psIn = (*it).getStatorPs1(); 66 | ttIn = (*it).getStatorTt1(); 67 | tsIn = (*it).getStatorTs1(); 68 | 69 | ptOut = (*it).getStatorPt2(); 70 | psOut = (*it).getStatorPs2(); 71 | ttOut = (*it).getStatorTt2(); 72 | tsOut = (*it).getStatorTs2(); 73 | 74 | } 75 | 76 | // determine final properties to be included based on choice of axial location of leakage with 77 | // respect to the airfoil 78 | pt = -9999.9; 79 | ps = -9999.9; 80 | tt = -9999.9; 81 | ts = -9999.9; 82 | if (m_afAxiLoc == AIRFOIL_AXI_LOCATION_LE) { 83 | pt = ptIn; 84 | ps = psIn; 85 | tt = ttIn; 86 | ts = tsIn; 87 | 88 | } else if (m_afAxiLoc == AIRFOIL_AXI_LOCATION_TE) { 89 | pt = ptOut; 90 | ps = psOut; 91 | tt = ttOut; 92 | ts = tsOut; 93 | 94 | } else if (m_afAxiLoc == AIRFOIL_AXI_LOCATION_MID) { 95 | pt = (ptIn + ptOut) / 2.0; 96 | ps = (psIn + psOut) / 2.0; 97 | tt = (ttIn + ttOut) / 2.0; 98 | ts = (tsIn + tsOut) / 2.0; 99 | 100 | } else { 101 | throw std::exception(); 102 | } 103 | 104 | // create a new diffuser performance instance 105 | CompressorLeakagePerformance* newPrf = new CompressorLeakagePerformance( i+1, pt, ps, tt, ts); 106 | 107 | // replace the operating point performance instance at this op pnt number 108 | // with the newly created diffuser performance instance 109 | this->addPerformancePoint(i, *newPrf); 110 | } 111 | 112 | } 113 | 114 | void CompressorLeakage::addPerformancePoint(int index, CompressorLeakagePerformance perfPntToAdd) { 115 | std::vector::iterator it; 116 | it = m_optPntPerf.begin(); 117 | m_optPntPerf.insert(it+index, perfPntToAdd); 118 | } 119 | 120 | std::vector CompressorLeakage::getOpPntPerf() { return m_optPntPerf; } 121 | 122 | CompressorLeakagePerformance CompressorLeakage::getOpPntPerfAtIndex(int index) { return m_optPntPerf.at(index); } 123 | 124 | void CompressorLeakage::replaceOpPntPerfAtIndex(int index, CompressorLeakagePerformance newPerfPnt) { 125 | m_optPntPerf.at(index) = newPerfPnt; 126 | } 127 | 128 | std::string CompressorLeakage::getStageName() { return m_stage; } 129 | AirfoilBehavior CompressorLeakage::getAirfoilBehavior() { return m_afBhvr; } 130 | AirfoilAxialLocation CompressorLeakage::getAirfoilAxialLocation() { return m_afAxiLoc; } 131 | -------------------------------------------------------------------------------- /src/CompressorLeakage.h: -------------------------------------------------------------------------------- 1 | /* 2 | * CompressorLeakage.h 3 | * 4 | * Created on: Dec 12, 2013 5 | * Author: bachm03j 6 | */ 7 | 8 | #ifndef COMPRESSORLEAKAGE_H_ 9 | #define COMPRESSORLEAKAGE_H_ 10 | 11 | #include 12 | #include 13 | #include "CompressorLeakagePerformance.h" 14 | #include "CompressorEnumerations.h" 15 | 16 | //forward declarations 17 | class Compressor; 18 | 19 | class CompressorLeakage { 20 | public: 21 | CompressorLeakage(); 22 | CompressorLeakage(std::string stage, AirfoilBehavior afBehavior, AirfoilAxialLocation axiLocation); 23 | virtual ~CompressorLeakage(); 24 | 25 | void setLeakageProperties(Compressor* compressor); 26 | 27 | void addPerformancePoint(int index, CompressorLeakagePerformance perfPntToAdd); 28 | void replaceOpPntPerfAtIndex(int index, CompressorLeakagePerformance newPerfPnt); 29 | 30 | CompressorLeakagePerformance getLeakPerfForPressureRatio(double pressRatio, const double &pRatio); 31 | 32 | std::vector getOpPntPerf(); 33 | CompressorLeakagePerformance getOpPntPerfAtIndex(int index); 34 | 35 | std::string getStageName(); 36 | AirfoilBehavior getAirfoilBehavior(); 37 | AirfoilAxialLocation getAirfoilAxialLocation(); 38 | 39 | private: 40 | std::string m_stage; 41 | AirfoilBehavior m_afBhvr; 42 | AirfoilAxialLocation m_afAxiLoc; 43 | std::vector m_optPntPerf; 44 | 45 | }; 46 | 47 | #endif /* COMPRESSORLEAKAGE_H_ */ 48 | -------------------------------------------------------------------------------- /src/CompressorLeakagePerformance.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * CompressorLeakagePerformance.cpp 3 | * 4 | * Created on: Dec 12, 2013 5 | * Author: bachm03j 6 | */ 7 | 8 | #include "CompressorLeakagePerformance.h" 9 | 10 | CompressorLeakagePerformance::CompressorLeakagePerformance() { 11 | // TODO Auto-generated constructor stub 12 | 13 | } 14 | 15 | CompressorLeakagePerformance::CompressorLeakagePerformance(int opPntNumber, 16 | double Pt, 17 | double Ps, 18 | double Tt, 19 | double Ts 20 | ) { 21 | m_opPntNmbr = opPntNumber; 22 | m_Pt = Pt; 23 | m_Ps = Ps; 24 | m_Tt = Tt; 25 | m_Ts = Ts; 26 | } 27 | 28 | CompressorLeakagePerformance::~CompressorLeakagePerformance() { 29 | // TODO Auto-generated destructor stub 30 | } 31 | 32 | int CompressorLeakagePerformance::getOptPntNmbr() const { return m_opPntNmbr; } 33 | double CompressorLeakagePerformance::getPt() const { return m_Pt; } 34 | double CompressorLeakagePerformance::getPs() const { return m_Ps; } 35 | double CompressorLeakagePerformance::getTt() const { return m_Tt; } 36 | double CompressorLeakagePerformance::getTs() const { return m_Ts; } 37 | -------------------------------------------------------------------------------- /src/CompressorLeakagePerformance.h: -------------------------------------------------------------------------------- 1 | /* 2 | * CompressorLeakagePerformance.h 3 | * 4 | * Created on: Dec 12, 2013 5 | * Author: bachm03j 6 | */ 7 | 8 | #ifndef COMPRESSORLEAKAGEPERFORMANCE_H_ 9 | #define COMPRESSORLEAKAGEPERFORMANCE_H_ 10 | 11 | class CompressorLeakagePerformance { 12 | public: 13 | 14 | CompressorLeakagePerformance(); 15 | 16 | CompressorLeakagePerformance(int opPntNumber, 17 | double Pt, 18 | double Ps, 19 | double Tt, 20 | double Ts 21 | ); 22 | 23 | virtual ~CompressorLeakagePerformance(); 24 | 25 | int getOptPntNmbr() const; 26 | 27 | double getPt() const; 28 | double getPs() const; 29 | double getTt() const; 30 | double getTs() const; 31 | 32 | private: 33 | int m_opPntNmbr; 34 | double m_Pt; 35 | double m_Ps; 36 | double m_Tt; 37 | double m_Ts; 38 | 39 | }; 40 | 41 | #endif /* COMPRESSORLEAKAGEPERFORMANCE_H_ */ 42 | -------------------------------------------------------------------------------- /src/CompressorOperatingPoint.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * CompressorOperatingPoint.cpp 3 | * 4 | * Created on: Apr 30, 2012 5 | * Author: bachm03j 6 | */ 7 | 8 | #include 9 | #include "CompressorOperatingPoint.h" 10 | 11 | CompressorOperatingPoint::CompressorOperatingPoint() { 12 | // TODO Auto-generated constructor stub 13 | } 14 | 15 | CompressorOperatingPoint::CompressorOperatingPoint(int opPntNmbr, double inletTemp, double inletPress 16 | , double phi, double pressRatio, double delTqT, double etaAdi, double etaPoly, double wCorct 17 | , double wCorctOut, double wInlet, double speed) { 18 | 19 | _opPntNmbr = opPntNmbr; 20 | _tempIn = inletTemp; 21 | _pressIn = inletPress; 22 | _pressRatio = pressRatio; 23 | _phi = phi; 24 | _delTqT = delTqT; 25 | _etaAdi = etaAdi; 26 | _etaPoly = etaPoly; 27 | _wCorct = wCorct; 28 | _wCorctOut = wCorctOut; 29 | _wInlet = wInlet; 30 | _speed = speed; 31 | 32 | } 33 | 34 | CompressorOperatingPoint::~CompressorOperatingPoint() { 35 | // TODO Auto-generated destructor stub 36 | //printf("called compressor operating point destructor\n\n"); 37 | } 38 | 39 | void CompressorOperatingPoint::setOperatingPoint(int opPntNmbr, double inletTemp, double inletPress 40 | , double pressRatio, double phi, double delTqT, double etaAdi, double etaPoly, double wCorct, double wCorctOut 41 | , double wInlet, double speed) { 42 | 43 | _opPntNmbr = opPntNmbr; 44 | _tempIn = inletTemp; 45 | _pressIn = inletPress; 46 | _pressRatio = pressRatio; 47 | _phi = phi; 48 | _delTqT = delTqT; 49 | _etaAdi = etaAdi; 50 | _etaPoly = etaPoly; 51 | _wCorct = wCorct; 52 | _wCorctOut = wCorctOut; 53 | _wInlet = wInlet; 54 | _speed = speed; 55 | 56 | } 57 | 58 | double CompressorOperatingPoint::getTamb() const { return _tempIn; } 59 | double CompressorOperatingPoint::getPamb() const { return _pressIn; } 60 | double CompressorOperatingPoint::getPhi() const { return _phi; } 61 | double CompressorOperatingPoint::getShaftSpeed() const { return _speed; } 62 | double CompressorOperatingPoint::getWcorct() const { return _wCorct; } 63 | double CompressorOperatingPoint::getWcorctOut() const { return _wCorctOut; } 64 | double CompressorOperatingPoint::getWin() const { return _wInlet; } 65 | double CompressorOperatingPoint::getEtaAdi() const { return _etaAdi; } 66 | double CompressorOperatingPoint::getEtaPoly() const { return _etaPoly; } 67 | double CompressorOperatingPoint::getPressRatio() const { return _pressRatio; } 68 | double CompressorOperatingPoint::getDelTqT() const { return _delTqT; } 69 | -------------------------------------------------------------------------------- /src/CompressorOperatingPoint.h: -------------------------------------------------------------------------------- 1 | /* 2 | * CompressorOperatingPoint.h 3 | * 4 | * Created on: Apr 30, 2012 5 | * Author: bachm03j 6 | */ 7 | 8 | #ifndef COMPRESSOROPERATINGPOINT_H_ 9 | #define COMPRESSOROPERATINGPOINT_H_ 10 | 11 | class CompressorOperatingPoint { 12 | 13 | public: 14 | //methods 15 | CompressorOperatingPoint(); 16 | CompressorOperatingPoint(int opPntNmbr 17 | , double inletTemp 18 | , double inletPress 19 | , double pressRatio 20 | , double phi 21 | , double delTqT 22 | , double etaAdi 23 | , double etaPoly 24 | , double wCorct 25 | , double wCorctOut 26 | , double wInlet 27 | , double speed); 28 | virtual ~CompressorOperatingPoint(); 29 | 30 | void setOperatingPoint(int opPntNmbr 31 | , double inletTemp 32 | , double inletPress 33 | , double pressRatio 34 | , double phi 35 | , double delTqT 36 | , double etaAdi 37 | , double etaPoly 38 | , double wCorct 39 | , double wCorctOut 40 | , double wInlet 41 | , double speed); 42 | 43 | double getTamb() const; 44 | double getPamb() const; 45 | double getPhi() const; 46 | double getShaftSpeed() const; 47 | double getWcorct() const; 48 | double getWcorctOut() const; 49 | double getWin() const; 50 | double getEtaAdi() const; 51 | double getEtaPoly() const; 52 | double getPressRatio() const; 53 | double getDelTqT() const; 54 | 55 | private: 56 | //members 57 | int _opPntNmbr; 58 | double _tempIn; //compressor inlet temperatur - kelvin 59 | double _pressIn; //compressor inlet pressure - Pa 60 | double _pressRatio; //pressure ratio from IGV in to OGV out 61 | double _phi; //retlative humidity; 62 | double _delTqT; //non-dim temp change from IGV in to OGV out 63 | double _etaAdi; //adiabatic efficiency from IGV in to OGV out 64 | double _etaPoly; //polytropic efficiency from IGV in to OGV out 65 | double _wCorct; //inlet corrected flow - kg/s 66 | double _wCorctOut; //outlet corrected flow - kg/s 67 | double _wInlet; //absolute mass flow at inlet - kg/s 68 | double _speed; //shaft speed - RPM 69 | 70 | }; 71 | 72 | #endif /* COMPRESSOROPERATINGPOINT_H_ */ 73 | -------------------------------------------------------------------------------- /src/CompressorSpeedLine.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * CompressorSpeedLine.cpp 3 | * 4 | * Created on: May 1, 2012 5 | * Author: bachm03j 6 | */ 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | //UNCOMMENT TO USE GNU SCIENTIFIC LIBRARY SPLINE INTERPOLATION METHODS 13 | //#include 14 | //#include 15 | //#include 16 | 17 | //UNCOMMENT TO USE WILD MAGIC GEOMETRY LIBRARY INTERPOLATION METHODS 18 | //#include "Wm5IntpAkimaNonuniform1.h" 19 | 20 | #include "CompressorAirfoilConfiguration.h" 21 | #include "CompressorSpeedLine.h" 22 | #include "CompressorOperatingPoint.h" 23 | #include "CompressorStage.h" 24 | #include "DiffuserPerformance.h" 25 | #include "InletPerformance.h" 26 | #include "InletGuideVanePerformance.h" 27 | #include "CompressorLeakage.h" 28 | #include "CompressorLeakagePerformance.h" 29 | 30 | extern "C" { 31 | #include "Interpolation.h" 32 | } 33 | 34 | CompressorSpeedLine::CompressorSpeedLine() { 35 | // TODO Auto-generated constructor stub 36 | } 37 | 38 | CompressorSpeedLine::~CompressorSpeedLine() { 39 | // TODO Auto-generated destructor stub 40 | //printf("called compressor speed line destructor\n\n"); 41 | } 42 | 43 | 44 | void CompressorSpeedLine::addOperatingPoint(CompressorOperatingPoint opPntToAdd) { _opPnts.push_back(opPntToAdd); } 45 | 46 | void CompressorSpeedLine::addStage(CompressorStage stageToAdd) { _stages.push_back(&stageToAdd); } 47 | 48 | 49 | void CompressorSpeedLine::setStages(std::vector stages) { _stages = stages; } 50 | 51 | void CompressorSpeedLine::setDiffuserPerformance(std::vector diffPerf) { m_diffPerf = diffPerf; } 52 | 53 | void CompressorSpeedLine::setInletPerformance(std::vector inletPerf) { m_inletPerf = inletPerf; } 54 | 55 | void CompressorSpeedLine::setInletGuideVanePerformance(std::vector igvPerf) { m_igvPerf = igvPerf; } 56 | 57 | void CompressorSpeedLine::setLeakages(std::vector leaks) { m_leaks = leaks; } 58 | 59 | 60 | CompressorOperatingPoint CompressorSpeedLine::getOpPntForPressureRatio(double pressureRatio) { 61 | 62 | //interpolates the mass flow and efficiency for a given pressure ratio 63 | 64 | //create arrays of pressure ratio and mass flow 65 | int numElems = _opPnts.size(); 66 | double inletTemp[numElems]; 67 | double inletPress[numElems]; 68 | double phi[numElems]; 69 | double delTqT[numElems]; 70 | double pRatio[numElems]; 71 | double wInlet[numElems]; 72 | double wInCorr[numElems]; 73 | double wOutCorr[numElems]; 74 | double etaAdi[numElems]; 75 | double etaPoly[numElems]; 76 | 77 | double pRatioMin = 1e9; 78 | double pRatioMax = -1e9; 79 | 80 | int i = 0; 81 | std::vector::iterator it; 82 | for ( it=_opPnts.begin() ; it < _opPnts.end(); it++, i++) { 83 | inletTemp[i] = (*it).getTamb(); 84 | inletPress[i] = (*it).getPamb(); 85 | phi[i] = (*it).getPhi(); 86 | delTqT[i] = (*it).getDelTqT(); 87 | pRatio[i] = (*it).getPressRatio(); 88 | wInlet[i] = (*it).getWin(); 89 | wInCorr[i] = (*it).getWcorct(); 90 | wOutCorr[i] = (*it).getWcorctOut(); 91 | etaAdi[i] = (*it).getEtaAdi(); 92 | etaPoly[i] = (*it).getEtaPoly(); 93 | 94 | pRatioMin = ((pRatio[i] < pRatioMin) ? pRatio[i] : pRatioMin); 95 | pRatioMax = ((pRatio[i] > pRatioMax) ? pRatio[i] : pRatioMax); 96 | 97 | } 98 | 99 | double inletTempInterp; 100 | double inletPressInterp; 101 | double phiInterp; 102 | double delTqTInterp; 103 | //double pRatioInterp; 104 | double wInterp; 105 | double wInCorrInterp; 106 | double wOutCorrInterp; 107 | double etaAdiInterp; 108 | double etaPolyInterp; 109 | 110 | //check if pressureRatio is outside min and max bounds of pRatio array 111 | // if so use linear interpolation, else use higher order interpolation 112 | bool onlyLinrIntrp = true; 113 | if ( (pressureRatio > pRatioMax) || (pressureRatio < pRatioMin) || onlyLinrIntrp ) { 114 | //pressureRatio is below min pRatio from array, use linear extrapolation 115 | 116 | inletTempInterp = LinearInterpUnsorted(numElems, pRatio, inletTemp, pressureRatio, 1); 117 | inletPressInterp = LinearInterpUnsorted(numElems, pRatio, inletPress, pressureRatio, 1); 118 | phiInterp = LinearInterpUnsorted(numElems, pRatio, phi, pressureRatio, 1); 119 | delTqTInterp = LinearInterpUnsorted(numElems, pRatio, delTqT, pressureRatio, 1); 120 | 121 | wInterp = LinearInterpUnsorted(numElems, pRatio, wInlet, pressureRatio, 1); 122 | wInCorrInterp = LinearInterpUnsorted(numElems, pRatio, wInCorr, pressureRatio, 1); 123 | wOutCorrInterp = LinearInterpUnsorted(numElems, pRatio, wOutCorr, pressureRatio, 1); 124 | 125 | etaAdiInterp = LinearInterpUnsorted(numElems, pRatio, etaAdi, pressureRatio, 1); 126 | etaPolyInterp = LinearInterpUnsorted(numElems, pRatio, etaPoly, pressureRatio, 1); 127 | 128 | 129 | } else { 130 | // place holder for spline fit, but splines do not work well for extrapolation so be careful 131 | throw std::exception(); 132 | } 133 | 134 | //assign each part of the line data to the operating point 135 | CompressorOperatingPoint tmpOpPnt = CompressorOperatingPoint( 99 136 | , inletTempInterp 137 | , inletPressInterp 138 | , phiInterp 139 | , pressureRatio 140 | , delTqTInterp 141 | , etaAdiInterp 142 | , etaPolyInterp 143 | , wInCorrInterp 144 | , wOutCorrInterp 145 | , wInterp 146 | , this->getShaftSpeed()); 147 | 148 | return tmpOpPnt; 149 | 150 | } 151 | 152 | CompressorStagePerformance CompressorSpeedLine::getStagePerfForPressureRatio(int stageNmbr, double pressureRatio) { 153 | 154 | //create arrays of pressure ratio and mass flow 155 | CompressorStage crntStage = *( _stages[stageNmbr-1] ); 156 | int numElems = crntStage.getOpPntPerf().size(); 157 | 158 | //get the number of airfoils for the stages rotor-stator. Check if the stage is an OGV first 159 | int numRotorAfs = -1; 160 | int numStatorAfs = -1; 161 | std::string stgName = crntStage.getStageName(); 162 | if (stgName.find("ogv", 0) != std::string::npos) { 163 | numRotorAfs = 0; 164 | numStatorAfs = crntStage.getStator()->getNumBlades(); 165 | } else { 166 | numRotorAfs = crntStage.getRotor()->getNumBlades(); 167 | numStatorAfs = crntStage.getStator()->getNumBlades(); 168 | } 169 | 170 | double pRatio[numElems]; 171 | 172 | double tmpStgPi[numElems]; 173 | double tmpStgEtaAdi[numElems]; 174 | double tmpStgWrk[numElems]; 175 | double tmpStgRct[numElems]; 176 | double tmpWheelSpd[numElems]; 177 | 178 | double tmpRtrPhi[numElems]; 179 | double tmpStrPhi[numElems]; 180 | 181 | double tmpRtrDf[numElems]; 182 | double tmpStrDf[numElems]; 183 | 184 | double tmpRtrDeq[numElems]; 185 | double tmpStrDeq[numElems]; 186 | 187 | double tmpRtrDh[numElems]; 188 | double tmpStrDh[numElems]; 189 | 190 | double tmpRtrPt1Abs[numElems]; 191 | double tmpRtrPt1Rel[numElems]; 192 | double tmpRtrPt2Rel[numElems]; 193 | 194 | double tmpRtrPs1[numElems]; 195 | double tmpRtrPs2[numElems]; 196 | 197 | double tmpStrPt1[numElems]; 198 | double tmpStrPt2[numElems]; 199 | 200 | double tmpStrPs1[numElems]; 201 | double tmpStrPs2[numElems]; 202 | 203 | double tmpRtrTt1Abs[numElems]; 204 | double tmpRtrTt1Rel[numElems]; 205 | double tmpRtrTt2Rel[numElems]; 206 | 207 | double tmpStrTt1[numElems]; 208 | double tmpStrTt2[numElems]; 209 | 210 | double tmpRtrBetaIn[numElems]; 211 | double tmpRtrBetaOut[numElems]; 212 | 213 | double tmpStrAlpIn[numElems]; 214 | double tmpStrAlpOut[numElems]; 215 | 216 | double tmpRtrAR[numElems]; 217 | double tmpStrAR[numElems]; 218 | 219 | double tmpRtrInc[numElems]; 220 | double tmpStrInc[numElems]; 221 | 222 | double tmpRtrDev[numElems]; 223 | double tmpStrDev[numElems]; 224 | 225 | double pRatioMin = 1e9; 226 | double pRatioMax = -1e9; 227 | 228 | int i = 0; 229 | int opPntNmbr = -1; 230 | std::vector vStgPrf = crntStage.getOpPntPerf(); 231 | std::vector::iterator it; 232 | for ( it = vStgPrf.begin() ; it != vStgPrf.end(); ++it, ++i) { 233 | opPntNmbr = (*it).getOptPntNmbr(); 234 | pRatio[i] = _opPnts[opPntNmbr-1].getPressRatio(); 235 | 236 | tmpStgPi[i] = (*it).getStagePi(); 237 | tmpStgEtaAdi[i] = (*it).getStageEtaAdiab(); 238 | tmpStgWrk[i] = (*it).getStageWork(); 239 | tmpStgRct[i] = (*it).getStageReaction(); 240 | tmpWheelSpd[i] = (*it).getWheelSpeed(); 241 | 242 | tmpRtrPhi[i] = (*it).getRotorPhi(); 243 | tmpStrPhi[i] = (*it).getRotorPhi(); 244 | 245 | tmpRtrDf[i] = (*it).getDiffLiebRotor(); 246 | tmpStrDf[i] = (*it).getDiffLiebStator(); 247 | 248 | tmpRtrDeq[i] = (*it).getDiffEqRatRotor(); 249 | tmpStrDeq[i] = (*it).getDiffEqRatStator(); 250 | 251 | tmpRtrDh[i] = (*it).getDeHallerRotor(); 252 | tmpStrDh[i] = (*it).getDeHallerStator(); 253 | 254 | tmpRtrPt1Abs[i] = (*it).getRotorPt1Abs(); 255 | tmpRtrPt1Rel[i] = (*it).getRotorPt1Rel(); 256 | tmpRtrPt2Rel[i] = (*it).getRotorPt2Rel(); 257 | 258 | tmpRtrPs1[i] = (*it).getRotorPs1(); 259 | tmpRtrPs2[i] = (*it).getRotorPs2(); 260 | 261 | tmpStrPt1[i] = (*it).getStatorPt1(); 262 | tmpStrPt2[i] = (*it).getStatorPt2(); 263 | 264 | tmpStrPs1[i] = (*it).getStatorPs1(); 265 | tmpStrPs2[i] = (*it).getStatorPs2(); 266 | 267 | tmpRtrTt1Abs[i] = (*it).getRotorTt1Abs(); 268 | tmpRtrTt1Rel[i] = (*it).getRotorTt1Rel(); 269 | tmpRtrTt2Rel[i] = (*it).getRotorTt2Rel(); 270 | 271 | tmpStrTt1[i] = (*it).getStatorTt1(); 272 | tmpStrTt2[i] = (*it).getStatorTt2(); 273 | 274 | tmpRtrBetaIn[i] = (*it).getRotorBeta1(); 275 | tmpRtrBetaOut[i] = (*it).getRotorBeta2(); 276 | 277 | tmpStrAlpIn[i] = (*it).getStatorAlpha1(); 278 | tmpStrAlpOut[i] = (*it).getStatorAlpha2(); 279 | 280 | tmpRtrAR[i] = (*it).getRotorAspRatio(); 281 | tmpStrAR[i] = (*it).getStatorAspRatio(); 282 | 283 | tmpRtrInc[i] = (*it).getRotorIncidence(); 284 | tmpStrInc[i] = (*it).getStatorIncidence(); 285 | 286 | tmpRtrDev[i] = (*it).getRotorDeviation(); 287 | tmpStrDev[i] = (*it).getStatorDeviation(); 288 | 289 | pRatioMin = ((pRatio[i] < pRatioMin) ? pRatio[i] : pRatioMin); 290 | pRatioMax = ((pRatio[i] > pRatioMax) ? pRatio[i] : pRatioMax); 291 | 292 | } 293 | 294 | double tmpStgPiInterp; 295 | double tmpStgEtaAdiInterp; 296 | double tmpStgWrkInterp; 297 | double tmpStgRctInterp; 298 | double tmpWheelSpdInterp; 299 | 300 | double tmpRtrPhiInterp; 301 | double tmpStrPhiInterp; 302 | 303 | double tmpRtrDfInterp; 304 | double tmpStrDfInterp; 305 | 306 | double tmpRtrDeqInterp; 307 | double tmpStrDeqInterp; 308 | 309 | double tmpRtrDhInterp; 310 | double tmpStrDhInterp; 311 | 312 | double tmpRtrPtInAbsInterp; 313 | double tmpRtrPtInRelInterp; 314 | double tmpRtrPtOutRelInterp; 315 | 316 | double tmpStrPtInInterp; 317 | double tmpStrPtOutInterp; 318 | 319 | double tmpRtrPsInInterp; 320 | double tmpRtrPsOutInterp; 321 | 322 | double tmpStrPsInInterp; 323 | double tmpStrPsOutInterp; 324 | 325 | double tmpRtrTtInAbsInterp; 326 | double tmpRtrTtInRelInterp; 327 | double tmpRtrTtOutRelInterp; 328 | 329 | double tmpStrTtInInterp; 330 | double tmpStrTtOutInterp; 331 | 332 | double tmpRtrBetaInInterp; 333 | double tmpRtrBetaOutInterp; 334 | 335 | double tmpStrAlpInInterp; 336 | double tmpStrAlpOutInterp; 337 | 338 | double tmpRtrARInterp; 339 | double tmpStrARInterp; 340 | 341 | double tmpRtrIncInterp; 342 | double tmpStrIncInterp; 343 | 344 | double tmpRtrDevInterp; 345 | double tmpStrDevInterp; 346 | 347 | //check if pressureRatio is outside min and max bounds of pRatio array 348 | // if so using simple extrapolation at end points, else use gsl spline functions 349 | bool onlyLinrIntrp = true; 350 | if ( (pressureRatio > pRatioMax) || (pressureRatio < pRatioMin || onlyLinrIntrp ) ) { 351 | //pressureRatio is below min pRatio from array, use linear extrapolation 352 | 353 | tmpStgPiInterp = LinearInterpUnsorted(numElems, pRatio, tmpStgPi, pressureRatio, 1); 354 | tmpStgEtaAdiInterp = LinearInterpUnsorted(numElems, pRatio, tmpStgEtaAdi, pressureRatio, 1); 355 | tmpStgWrkInterp = LinearInterpUnsorted(numElems, pRatio, tmpStgWrk, pressureRatio, 1); 356 | tmpStgRctInterp = LinearInterpUnsorted(numElems, pRatio, tmpStgRct, pressureRatio, 1); 357 | tmpWheelSpdInterp = LinearInterpUnsorted(numElems, pRatio, tmpWheelSpd, pressureRatio, 1); 358 | 359 | tmpRtrPhiInterp = LinearInterpUnsorted(numElems, pRatio, tmpRtrPhi, pressureRatio, 1); 360 | tmpStrPhiInterp = LinearInterpUnsorted(numElems, pRatio, tmpStrPhi, pressureRatio, 1); 361 | 362 | tmpRtrDfInterp = LinearInterpUnsorted(numElems, pRatio, tmpRtrDf, pressureRatio, 1); 363 | tmpStrDfInterp = LinearInterpUnsorted(numElems, pRatio, tmpStrDf, pressureRatio, 1); 364 | 365 | tmpRtrDeqInterp = LinearInterpUnsorted(numElems, pRatio, tmpRtrDeq, pressureRatio, 1); 366 | tmpStrDeqInterp = LinearInterpUnsorted(numElems, pRatio, tmpStrDeq, pressureRatio, 1); 367 | 368 | tmpRtrDhInterp = LinearInterpUnsorted(numElems, pRatio, tmpRtrDh, pressureRatio, 1); 369 | tmpStrDhInterp = LinearInterpUnsorted(numElems, pRatio, tmpStrDh, pressureRatio, 1); 370 | 371 | tmpRtrPtInAbsInterp = LinearInterpUnsorted(numElems, pRatio, tmpRtrPt1Abs, pressureRatio, 1); 372 | tmpRtrPtInRelInterp = LinearInterpUnsorted(numElems, pRatio, tmpRtrPt1Rel, pressureRatio, 1); 373 | tmpRtrPtOutRelInterp = LinearInterpUnsorted(numElems, pRatio, tmpRtrPt2Rel, pressureRatio, 1); 374 | 375 | tmpStrPtInInterp = LinearInterpUnsorted(numElems, pRatio, tmpStrPt1, pressureRatio, 1); 376 | tmpStrPtOutInterp = LinearInterpUnsorted(numElems, pRatio, tmpStrPt2, pressureRatio, 1); 377 | 378 | tmpRtrPsInInterp = LinearInterpUnsorted(numElems, pRatio, tmpRtrPs1, pressureRatio, 1); 379 | tmpRtrPsOutInterp = LinearInterpUnsorted(numElems, pRatio, tmpRtrPs2, pressureRatio, 1); 380 | 381 | tmpStrPsInInterp = LinearInterpUnsorted(numElems, pRatio, tmpStrPs1, pressureRatio, 1); 382 | tmpStrPsOutInterp = LinearInterpUnsorted(numElems, pRatio, tmpStrPs2, pressureRatio, 1); 383 | 384 | tmpRtrTtInAbsInterp = LinearInterpUnsorted(numElems, pRatio, tmpRtrTt1Abs, pressureRatio, 1); 385 | tmpRtrTtInRelInterp = LinearInterpUnsorted(numElems, pRatio, tmpRtrTt1Rel, pressureRatio, 1); 386 | tmpRtrTtOutRelInterp = LinearInterpUnsorted(numElems, pRatio, tmpRtrTt2Rel, pressureRatio, 1); 387 | 388 | tmpStrTtInInterp = LinearInterpUnsorted(numElems, pRatio, tmpStrTt1, pressureRatio, 1); 389 | tmpStrTtOutInterp = LinearInterpUnsorted(numElems, pRatio, tmpStrTt2, pressureRatio, 1); 390 | 391 | tmpRtrBetaInInterp = LinearInterpUnsorted(numElems, pRatio, tmpRtrBetaIn, pressureRatio, 1); 392 | tmpRtrBetaOutInterp = LinearInterpUnsorted(numElems, pRatio, tmpRtrBetaOut, pressureRatio, 1); 393 | 394 | tmpStrAlpInInterp = LinearInterpUnsorted(numElems, pRatio, tmpStrAlpIn, pressureRatio, 1); 395 | tmpStrAlpOutInterp = LinearInterpUnsorted(numElems, pRatio, tmpStrAlpOut, pressureRatio, 1); 396 | 397 | tmpRtrARInterp = LinearInterpUnsorted(numElems, pRatio, tmpRtrAR, pressureRatio, 1); 398 | tmpStrARInterp = LinearInterpUnsorted(numElems, pRatio, tmpStrAR, pressureRatio, 1); 399 | 400 | tmpRtrIncInterp = LinearInterpUnsorted(numElems, pRatio, tmpRtrInc, pressureRatio, 1); 401 | tmpStrIncInterp = LinearInterpUnsorted(numElems, pRatio, tmpStrInc, pressureRatio, 1); 402 | 403 | tmpRtrDevInterp = LinearInterpUnsorted(numElems, pRatio, tmpRtrDev, pressureRatio, 1); 404 | tmpStrDevInterp = LinearInterpUnsorted(numElems, pRatio, tmpStrDev, pressureRatio, 1); 405 | 406 | 407 | } else { 408 | throw std::exception(); 409 | //pressureRatio is bounded by arrays, use gsl interpolation 410 | 411 | //Wm5::IntpAkimaNonuniform1 wAkimIntrp( numElems, pRatio, wInlet); 412 | //Wm5::IntpAkimaNonuniform1 etaAkimIntrp( numElems, pRatio, etaAdi); 413 | 414 | //wInterp = wAkimIntrp(pressureRatio); 415 | //etaAdiInterp = etaAkimIntrp(pressureRatio); 416 | 417 | /* 418 | //allocate spline and spline accelorator 419 | gsl_spline *spline = gsl_spline_alloc(gsl_interp_cspline, numElems); 420 | gsl_interp_accel *acc = gsl_interp_accel_alloc(); 421 | 422 | //pt0 423 | gsl_spline_init(spline, pRatio, tmpPt0, numElems); 424 | pt0Interp = gsl_spline_eval(spline, pressureRatio, acc); 425 | if ( gsl_isnan(pt0Interp) ) { 426 | //throw exception 427 | } 428 | 429 | //pt1 430 | //gsl_interp_accel_reset(acc); 431 | gsl_spline_init(spline, pRatio, tmpPt1, numElems); 432 | pt1Interp = gsl_spline_eval(spline, pressureRatio, acc); 433 | if ( gsl_isnan(pt1Interp) ) { 434 | //throw exception 435 | } 436 | 437 | //pt2 438 | //gsl_interp_accel_reset(acc); 439 | gsl_spline_init(spline, pRatio, tmpPt2, numElems); 440 | pt2Interp = gsl_spline_eval(spline, pressureRatio, acc); 441 | if ( gsl_isnan(pt2Interp) ) { 442 | //throw exception 443 | } 444 | 445 | //pt3 446 | //gsl_interp_accel_reset(acc); 447 | gsl_spline_init(spline, pRatio, tmpPt3, numElems); 448 | pt3Interp = gsl_spline_eval(spline, pressureRatio, acc); 449 | if ( gsl_isnan(pt3Interp) ) { 450 | //throw exception 451 | } 452 | 453 | //pt4 454 | //gsl_interp_accel_reset(acc); 455 | gsl_spline_init(spline, pRatio, tmpPt4, numElems); 456 | pt4Interp = gsl_spline_eval(spline, pressureRatio, acc); 457 | if ( gsl_isnan(pt4Interp) ) { 458 | //throw exception 459 | } 460 | 461 | //free the memory allocated for the spline and accelorator types 462 | gsl_spline_free(spline); 463 | gsl_interp_accel_free(acc); 464 | */ 465 | 466 | } 467 | 468 | //create new compressor stage performance type, initialize with interpolated values and return 469 | CompressorStagePerformance newStgPerf = CompressorStagePerformance(-9999, 470 | tmpRtrPtInAbsInterp, 471 | tmpRtrPtInRelInterp, 472 | tmpRtrPtOutRelInterp, 473 | tmpRtrPsInInterp, 474 | tmpRtrPsOutInterp, 475 | tmpStrPtInInterp, 476 | tmpStrPtOutInterp, 477 | tmpStrPsInInterp, 478 | tmpStrPsOutInterp, 479 | tmpRtrTtInAbsInterp, 480 | tmpRtrTtInRelInterp, 481 | tmpRtrTtOutRelInterp, 482 | tmpStrTtInInterp, 483 | tmpStrTtOutInterp, 484 | tmpRtrBetaInInterp, 485 | tmpRtrBetaOutInterp, 486 | tmpStrAlpInInterp, 487 | tmpStrAlpOutInterp, 488 | tmpStgPiInterp, 489 | tmpStgEtaAdiInterp, 490 | tmpStgWrkInterp, 491 | tmpRtrPhiInterp, 492 | tmpStrPhiInterp, 493 | tmpWheelSpdInterp, 494 | tmpRtrDfInterp, 495 | tmpRtrDeqInterp, 496 | tmpRtrDhInterp, 497 | tmpStrDfInterp, 498 | tmpStrDeqInterp, 499 | tmpStrDhInterp, 500 | tmpStgRctInterp, 501 | tmpRtrARInterp, 502 | tmpStrARInterp, 503 | numRotorAfs, 504 | numStatorAfs, 505 | tmpRtrIncInterp, 506 | tmpStrIncInterp, 507 | tmpRtrDevInterp, 508 | tmpStrDevInterp); 509 | 510 | return newStgPerf; 511 | 512 | } 513 | 514 | DiffuserPerformance CompressorSpeedLine::getDiffsrPerfForPressureRatio(double pressureRatio) { 515 | 516 | //create arrays of pressure ratio and mass flow 517 | int numElems = m_diffPerf.size(); 518 | 519 | double pRatio[numElems]; 520 | 521 | double tmpDelPqP[numElems]; 522 | 523 | double tmpPtIn[numElems]; 524 | double tmpPsIn[numElems]; 525 | double tmpTtIn[numElems]; 526 | double tmpTsIn[numElems]; 527 | double tmpMachIn[numElems]; 528 | 529 | double tmpPtExit[numElems]; 530 | double tmpPsExit[numElems]; 531 | double tmpTtExit[numElems]; 532 | double tmpTsExit[numElems]; 533 | double tmpMachExit[numElems]; 534 | 535 | double pRatioMin = 1e9; 536 | double pRatioMax = -1e9; 537 | 538 | int i = 0; 539 | int opPntNmbr = -1; 540 | std::vector vPrf = m_diffPerf; 541 | std::vector::iterator it; 542 | for ( it = vPrf.begin() ; it != vPrf.end(); ++it, ++i) { 543 | opPntNmbr = (*it).getOptPntNmbr(); 544 | pRatio[i] = _opPnts[opPntNmbr-1].getPressRatio(); 545 | 546 | tmpPtIn[i] = (*it).getPtIn(); 547 | tmpPsIn[i] = (*it).getPsIn(); 548 | tmpTtIn[i] = (*it).getTtIn(); 549 | tmpTsIn[i] = (*it).getTsIn(); 550 | tmpMachIn[i] = (*it).getMachIn(); 551 | 552 | tmpPtExit[i] = (*it).getPtExit(); 553 | tmpPsExit[i] = (*it).getPsExit(); 554 | tmpTtExit[i] = (*it).getTtExit(); 555 | tmpTsExit[i] = (*it).getTsExit(); 556 | tmpMachExit[i] = (*it).getMachExit(); 557 | 558 | tmpDelPqP[i] = (*it).getDelPqP(); 559 | 560 | pRatioMin = ((pRatio[i] < pRatioMin) ? pRatio[i] : pRatioMin); 561 | pRatioMax = ((pRatio[i] > pRatioMax) ? pRatio[i] : pRatioMax); 562 | 563 | } 564 | 565 | double tmpDelPqPInterp; 566 | 567 | double tmpPtInInterp; 568 | double tmpPsInInterp; 569 | double tmpTtInInterp; 570 | double tmpTsInInterp; 571 | double tmpMachInInterp; 572 | 573 | double tmpPtExitInterp; 574 | double tmpPsExitInterp; 575 | double tmpTtExitInterp; 576 | double tmpTsExitInterp; 577 | double tmpMachExitInterp; 578 | 579 | //check if pressureRatio is outside min and max bounds of pRatio array 580 | // if so using simple extrapolation at end points, else use gsl spline functions 581 | bool onlyLinrIntrp = true; 582 | if ( (pressureRatio > pRatioMax) || (pressureRatio < pRatioMin || onlyLinrIntrp ) ) { 583 | //pressureRatio is below min pRatio from array, use linear extrapolation 584 | 585 | tmpDelPqPInterp = LinearInterpUnsorted(numElems, pRatio, tmpDelPqP, pressureRatio, 1); 586 | tmpPtInInterp = LinearInterpUnsorted(numElems, pRatio, tmpPtIn, pressureRatio, 1); 587 | tmpPsInInterp = LinearInterpUnsorted(numElems, pRatio, tmpPsIn, pressureRatio, 1); 588 | tmpTtInInterp = LinearInterpUnsorted(numElems, pRatio, tmpTtIn, pressureRatio, 1); 589 | tmpTsInInterp = LinearInterpUnsorted(numElems, pRatio, tmpTsIn, pressureRatio, 1); 590 | tmpMachInInterp = LinearInterpUnsorted(numElems, pRatio, tmpMachIn, pressureRatio, 1); 591 | tmpPtExitInterp = LinearInterpUnsorted(numElems, pRatio, tmpPtExit, pressureRatio, 1); 592 | tmpPsExitInterp = LinearInterpUnsorted(numElems, pRatio, tmpPsExit, pressureRatio, 1); 593 | tmpTtExitInterp = LinearInterpUnsorted(numElems, pRatio, tmpTtExit, pressureRatio, 1); 594 | tmpTsExitInterp = LinearInterpUnsorted(numElems, pRatio, tmpTsExit, pressureRatio, 1); 595 | tmpMachExitInterp = LinearInterpUnsorted(numElems, pRatio, tmpMachExit, pressureRatio, 1); 596 | 597 | } else { 598 | throw std::exception(); 599 | //pressureRatio is bounded by arrays, use gsl interpolation 600 | 601 | //Wm5::IntpAkimaNonuniform1 wAkimIntrp( numElems, pRatio, wInlet); 602 | //Wm5::IntpAkimaNonuniform1 etaAkimIntrp( numElems, pRatio, etaAdi); 603 | 604 | //wInterp = wAkimIntrp(pressureRatio); 605 | //etaAdiInterp = etaAkimIntrp(pressureRatio); 606 | 607 | /* 608 | //allocate spline and spline accelorator 609 | gsl_spline *spline = gsl_spline_alloc(gsl_interp_cspline, numElems); 610 | gsl_interp_accel *acc = gsl_interp_accel_alloc(); 611 | 612 | //pt0 613 | gsl_spline_init(spline, pRatio, tmpPt0, numElems); 614 | pt0Interp = gsl_spline_eval(spline, pressureRatio, acc); 615 | if ( gsl_isnan(pt0Interp) ) { 616 | //throw exception 617 | } 618 | 619 | //pt1 620 | //gsl_interp_accel_reset(acc); 621 | gsl_spline_init(spline, pRatio, tmpPt1, numElems); 622 | pt1Interp = gsl_spline_eval(spline, pressureRatio, acc); 623 | if ( gsl_isnan(pt1Interp) ) { 624 | //throw exception 625 | } 626 | 627 | //pt2 628 | //gsl_interp_accel_reset(acc); 629 | gsl_spline_init(spline, pRatio, tmpPt2, numElems); 630 | pt2Interp = gsl_spline_eval(spline, pressureRatio, acc); 631 | if ( gsl_isnan(pt2Interp) ) { 632 | //throw exception 633 | } 634 | 635 | //pt3 636 | //gsl_interp_accel_reset(acc); 637 | gsl_spline_init(spline, pRatio, tmpPt3, numElems); 638 | pt3Interp = gsl_spline_eval(spline, pressureRatio, acc); 639 | if ( gsl_isnan(pt3Interp) ) { 640 | //throw exception 641 | } 642 | 643 | //pt4 644 | //gsl_interp_accel_reset(acc); 645 | gsl_spline_init(spline, pRatio, tmpPt4, numElems); 646 | pt4Interp = gsl_spline_eval(spline, pressureRatio, acc); 647 | if ( gsl_isnan(pt4Interp) ) { 648 | //throw exception 649 | } 650 | 651 | //free the memory allocated for the spline and accelorator types 652 | gsl_spline_free(spline); 653 | gsl_interp_accel_free(acc); 654 | */ 655 | 656 | } 657 | 658 | //create new diffuser performance instance, initialize with interpolated values and return 659 | DiffuserPerformance newDiffPerf = DiffuserPerformance(-9999, 660 | tmpDelPqPInterp, 661 | tmpPtInInterp, 662 | tmpPsInInterp, 663 | tmpTtInInterp, 664 | tmpTsInInterp, 665 | tmpMachInInterp, 666 | tmpPtExitInterp, 667 | tmpPsExitInterp, 668 | tmpTtExitInterp, 669 | tmpTsExitInterp, 670 | tmpMachExitInterp); 671 | return newDiffPerf; 672 | 673 | } 674 | 675 | InletPerformance CompressorSpeedLine::getInletPerfForPressureRatio(double pressureRatio) { 676 | 677 | //create arrays of pressure ratio and mass flow 678 | int numElems = m_inletPerf.size(); 679 | 680 | double pRatio[numElems]; 681 | 682 | double tmpDelPtqPt[numElems]; 683 | double tmpPtOut[numElems]; 684 | 685 | double pRatioMin = 1e9; 686 | double pRatioMax = -1e9; 687 | 688 | int i = 0; 689 | int opPntNmbr = -1; 690 | std::vector vPrf = m_inletPerf; 691 | std::vector::iterator it; 692 | for ( it = vPrf.begin() ; it != vPrf.end(); ++it, ++i) { 693 | opPntNmbr = (*it).getOpPntNmbr(); 694 | pRatio[i] = _opPnts[opPntNmbr-1].getPressRatio(); 695 | 696 | tmpDelPtqPt[i] = (*it).getDelPtqPtScroll(); 697 | tmpPtOut[i] = (*it).getPtOut(); 698 | 699 | pRatioMin = ((pRatio[i] < pRatioMin) ? pRatio[i] : pRatioMin); 700 | pRatioMax = ((pRatio[i] > pRatioMax) ? pRatio[i] : pRatioMax); 701 | 702 | } 703 | 704 | double tmpDelPqPInterp; 705 | double tmpPtOutInterp; 706 | 707 | //check if pressureRatio is outside min and max bounds of pRatio array 708 | // if so using simple extrapolation at end points, else use gsl spline functions 709 | bool onlyLinrIntrp = true; 710 | if ( (pressureRatio > pRatioMax) || (pressureRatio < pRatioMin || onlyLinrIntrp ) ) { 711 | //pressureRatio is below min pRatio from array, use linear extrapolation 712 | 713 | tmpDelPqPInterp = LinearInterpUnsorted(numElems, pRatio, tmpDelPtqPt, pressureRatio, 1); 714 | tmpPtOutInterp = LinearInterpUnsorted(numElems, pRatio, tmpPtOut, pressureRatio, 1); 715 | 716 | } else { 717 | throw std::exception(); 718 | //pressureRatio is bounded by arrays, use gsl interpolation 719 | 720 | //Wm5::IntpAkimaNonuniform1 wAkimIntrp( numElems, pRatio, wInlet); 721 | //Wm5::IntpAkimaNonuniform1 etaAkimIntrp( numElems, pRatio, etaAdi); 722 | 723 | //wInterp = wAkimIntrp(pressureRatio); 724 | //etaAdiInterp = etaAkimIntrp(pressureRatio); 725 | 726 | /* 727 | //allocate spline and spline accelorator 728 | gsl_spline *spline = gsl_spline_alloc(gsl_interp_cspline, numElems); 729 | gsl_interp_accel *acc = gsl_interp_accel_alloc(); 730 | 731 | //pt0 732 | gsl_spline_init(spline, pRatio, tmpPt0, numElems); 733 | pt0Interp = gsl_spline_eval(spline, pressureRatio, acc); 734 | if ( gsl_isnan(pt0Interp) ) { 735 | //throw exception 736 | } 737 | 738 | //pt1 739 | //gsl_interp_accel_reset(acc); 740 | gsl_spline_init(spline, pRatio, tmpPt1, numElems); 741 | pt1Interp = gsl_spline_eval(spline, pressureRatio, acc); 742 | if ( gsl_isnan(pt1Interp) ) { 743 | //throw exception 744 | } 745 | 746 | //pt2 747 | //gsl_interp_accel_reset(acc); 748 | gsl_spline_init(spline, pRatio, tmpPt2, numElems); 749 | pt2Interp = gsl_spline_eval(spline, pressureRatio, acc); 750 | if ( gsl_isnan(pt2Interp) ) { 751 | //throw exception 752 | } 753 | 754 | //pt3 755 | //gsl_interp_accel_reset(acc); 756 | gsl_spline_init(spline, pRatio, tmpPt3, numElems); 757 | pt3Interp = gsl_spline_eval(spline, pressureRatio, acc); 758 | if ( gsl_isnan(pt3Interp) ) { 759 | //throw exception 760 | } 761 | 762 | //pt4 763 | //gsl_interp_accel_reset(acc); 764 | gsl_spline_init(spline, pRatio, tmpPt4, numElems); 765 | pt4Interp = gsl_spline_eval(spline, pressureRatio, acc); 766 | if ( gsl_isnan(pt4Interp) ) { 767 | //throw exception 768 | } 769 | 770 | //free the memory allocated for the spline and accelorator types 771 | gsl_spline_free(spline); 772 | gsl_interp_accel_free(acc); 773 | */ 774 | 775 | } 776 | 777 | //create new inlet performance instance, initialize with interpolated values and return 778 | InletPerformance newInletPerf = InletPerformance(-9999, 779 | tmpDelPqPInterp, 780 | tmpPtOutInterp); 781 | return newInletPerf; 782 | 783 | } 784 | 785 | InletGuideVanePerformance CompressorSpeedLine::getInletGuideVanePerfForPressureRatio(double pressureRatio) { 786 | 787 | //create arrays of pressure ratio and mass flow 788 | int numElems = m_igvPerf.size(); 789 | 790 | double pRatio[numElems]; 791 | 792 | double tmpDelPtqPt[numElems]; 793 | double tmpPtOut[numElems]; 794 | double tmpAlpOut[numElems]; 795 | 796 | double pRatioMin = 1e9; 797 | double pRatioMax = -1e9; 798 | 799 | int i = 0; 800 | int opPntNmbr = -1; 801 | std::vector vPrf = m_igvPerf; 802 | std::vector::iterator it; 803 | for ( it = vPrf.begin() ; it != vPrf.end(); ++it, ++i) { 804 | opPntNmbr = (*it).getOpPntNmbr(); 805 | pRatio[i] = _opPnts[opPntNmbr-1].getPressRatio(); 806 | 807 | tmpDelPtqPt[i] = (*it).getDelPtqPt(); 808 | tmpPtOut[i] = (*it).getPtOut(); 809 | tmpAlpOut[i] = (*it).getAlpOut(); 810 | 811 | pRatioMin = ((pRatio[i] < pRatioMin) ? pRatio[i] : pRatioMin); 812 | pRatioMax = ((pRatio[i] > pRatioMax) ? pRatio[i] : pRatioMax); 813 | 814 | } 815 | 816 | double tmpDelPqPInterp; 817 | double tmpPtOutInterp; 818 | double tmpAlpOutInterp; 819 | 820 | //check if pressureRatio is outside min and max bounds of pRatio array 821 | // if so using simple extrapolation at end points, else use gsl spline functions 822 | bool onlyLinrIntrp = true; 823 | if ( (pressureRatio > pRatioMax) || (pressureRatio < pRatioMin || onlyLinrIntrp ) ) { 824 | //pressureRatio is below min pRatio from array, use linear extrapolation 825 | 826 | tmpDelPqPInterp = LinearInterpUnsorted(numElems, pRatio, tmpDelPtqPt, pressureRatio, 1); 827 | tmpPtOutInterp = LinearInterpUnsorted(numElems, pRatio, tmpPtOut, pressureRatio, 1); 828 | tmpAlpOutInterp = LinearInterpUnsorted(numElems, pRatio, tmpAlpOut, pressureRatio, 1); 829 | 830 | } else { 831 | throw std::exception(); 832 | //pressureRatio is bounded by arrays, use gsl interpolation 833 | } 834 | 835 | //create new inlet performance instance, initialize with interpolated values and return 836 | InletGuideVanePerformance newIgvPerf = InletGuideVanePerformance(-9999, 837 | tmpDelPqPInterp, 838 | tmpPtOutInterp, 839 | tmpAlpOutInterp); 840 | return newIgvPerf; 841 | 842 | } 843 | 844 | CompressorLeakagePerformance CompressorSpeedLine::getLeakagePerfForPressureRatio(int leakgIndex, double pressureRatio) 845 | { 846 | 847 | //create arrays of pressure ratio and mass flow 848 | CompressorLeakage crntLkg = m_leaks.at(leakgIndex); 849 | 850 | //create arrays of pressure ratio and mass flow 851 | int numElems = crntLkg.getOpPntPerf().size(); 852 | 853 | double pRatio[numElems]; 854 | 855 | double tmpPt[numElems]; 856 | double tmpPs[numElems]; 857 | double tmpTt[numElems]; 858 | double tmpTs[numElems]; 859 | 860 | double pRatioMin = 1e9; 861 | double pRatioMax = -1e9; 862 | 863 | int i = 0; 864 | int opPntNmbr = -1; 865 | std::vector vPrf = crntLkg.getOpPntPerf(); 866 | std::vector::iterator it; 867 | for ( it = vPrf.begin() ; it != vPrf.end(); ++it, ++i) { 868 | opPntNmbr = (*it).getOptPntNmbr(); 869 | pRatio[i] = _opPnts[opPntNmbr-1].getPressRatio(); 870 | 871 | tmpPt[i] = (*it).getPt(); 872 | tmpPs[i] = (*it).getPs(); 873 | tmpTt[i] = (*it).getTt(); 874 | tmpTs[i] = (*it).getTs(); 875 | 876 | pRatioMin = ((pRatio[i] < pRatioMin) ? pRatio[i] : pRatioMin); 877 | pRatioMax = ((pRatio[i] > pRatioMax) ? pRatio[i] : pRatioMax); 878 | 879 | } 880 | 881 | double tmpPtInterp; 882 | double tmpPsInterp; 883 | double tmpTtInterp; 884 | double tmpTsInterp; 885 | 886 | //check if pressureRatio is outside min and max bounds of pRatio array 887 | // if so using simple extrapolation at end points, else use gsl spline functions 888 | bool onlyLinrIntrp = true; 889 | if ( (pressureRatio > pRatioMax) || (pressureRatio < pRatioMin || onlyLinrIntrp ) ) { 890 | //pressureRatio is below min pRatio from array, use linear extrapolation 891 | 892 | tmpPtInterp = LinearInterpUnsorted(numElems, pRatio, tmpPt, pressureRatio, 1); 893 | tmpPsInterp = LinearInterpUnsorted(numElems, pRatio, tmpPs, pressureRatio, 1); 894 | tmpTtInterp = LinearInterpUnsorted(numElems, pRatio, tmpTt, pressureRatio, 1); 895 | tmpTsInterp = LinearInterpUnsorted(numElems, pRatio, tmpTs, pressureRatio, 1); 896 | 897 | } else { 898 | throw std::exception(); 899 | } 900 | 901 | //create new diffuser performance instance, initialize with interpolated values and return 902 | CompressorLeakagePerformance newPerf = CompressorLeakagePerformance(-9999, 903 | tmpPtInterp, 904 | tmpPsInterp, 905 | tmpTtInterp, 906 | tmpTsInterp); 907 | 908 | return newPerf; 909 | 910 | } 911 | 912 | 913 | const CompressorOperatingPoint* CompressorSpeedLine::getOpPnt(int operatingPoint) { 914 | const CompressorOperatingPoint *pntToReturn = &_opPnts[operatingPoint]; 915 | return pntToReturn; 916 | } 917 | 918 | CompressorStagePerformance CompressorSpeedLine::getStagePerfAtOpPnt(int operatingPoint, int stageNmbr) { 919 | CompressorStage crntStage = *( _stages[stageNmbr-1] ); 920 | CompressorStagePerformance stgPerf = crntStage.getOpPntPerf().at(operatingPoint); 921 | return stgPerf; 922 | } 923 | 924 | DiffuserPerformance CompressorSpeedLine::getDiffsrPerfAtOpPnt(int operatingPoint) { 925 | DiffuserPerformance diffPrf = m_diffPerf.at(operatingPoint); 926 | return diffPrf; 927 | } 928 | 929 | InletPerformance CompressorSpeedLine::getInletPerfAtOpPnt(int operatingPoint) { 930 | InletPerformance inletPrf = m_inletPerf.at(operatingPoint); 931 | return inletPrf; 932 | } 933 | 934 | InletGuideVanePerformance CompressorSpeedLine::getInletGuideVanePerfAtOpPnt(int operatingPoint) { 935 | InletGuideVanePerformance igvPrf = m_igvPerf.at(operatingPoint); 936 | return igvPrf; 937 | } 938 | 939 | CompressorLeakagePerformance CompressorSpeedLine::getLeakagePerfAtOpPnt(int leakgIndex, int operatingPoint) { 940 | CompressorLeakage crntLeakg = m_leaks.at(leakgIndex); 941 | CompressorLeakagePerformance leakPerf = crntLeakg.getOpPntPerf().at(operatingPoint); 942 | return leakPerf; 943 | } 944 | 945 | 946 | 947 | 948 | double CompressorSpeedLine::getShaftSpeed() { 949 | return _shaftSpeed; 950 | } 951 | 952 | 953 | void CompressorSpeedLine::setShaftSpeed(double shaftSpeed) { 954 | _shaftSpeed = shaftSpeed; 955 | } 956 | 957 | int CompressorSpeedLine::getNumberOfLeakages() { return (int)m_leaks.size(); } 958 | -------------------------------------------------------------------------------- /src/CompressorSpeedLine.h: -------------------------------------------------------------------------------- 1 | /* 2 | * CompressorSpeedLine.h 3 | * 4 | * Created on: May 1, 2012 5 | * Author: bachm03j 6 | */ 7 | 8 | #ifndef COMPRESSORSPEEDLINE_H_ 9 | #define COMPRESSORSPEEDLINE_H_ 10 | 11 | #include 12 | 13 | //forward declarations 14 | class CompressorOperatingPoint; 15 | class CompressorStage; 16 | class CompressorStagePerformance; 17 | class DiffuserPerformance; 18 | class InletPerformance; 19 | class InletGuideVanePerformance; 20 | class CompressorStage; 21 | class CompressorLeakage; 22 | class CompressorLeakagePerformance; 23 | 24 | class CompressorSpeedLine { 25 | 26 | public: 27 | //methods 28 | CompressorSpeedLine(); 29 | virtual ~CompressorSpeedLine(); 30 | 31 | void addOperatingPoint(CompressorOperatingPoint opPntToAdd); 32 | void addStage(CompressorStage stageToAdd); 33 | void setStages(std::vector stages); 34 | void setDiffuserPerformance(std::vector diffPerf); 35 | void setInletPerformance(std::vector diffPerf); 36 | void setInletGuideVanePerformance(std::vector diffPerf); 37 | void setLeakages(std::vector leaks); 38 | 39 | //void calcMassAndEta(double pressureRatio, double *wIn, double *etaAdiab); 40 | CompressorStagePerformance getStagePerfForPressureRatio(int stageNmbr, double pressureRatio); 41 | CompressorOperatingPoint getOpPntForPressureRatio(double pressureRatio); 42 | DiffuserPerformance getDiffsrPerfForPressureRatio(double pressureRatio); 43 | InletPerformance getInletPerfForPressureRatio(double pressureRatio); 44 | InletGuideVanePerformance getInletGuideVanePerfForPressureRatio(double pressureRatio); 45 | CompressorLeakagePerformance getLeakagePerfForPressureRatio(int leakgIndex, double pressRatio); 46 | 47 | const CompressorOperatingPoint* getOpPnt(int opertaingPoint); 48 | void getPrMassAndEtaAtOpPnt(int operatingPoint, double *pr, double *wIn, double *etaAdiab); 49 | CompressorStagePerformance getStagePerfAtOpPnt(int operatingPoint, int stageNmbr); 50 | DiffuserPerformance getDiffsrPerfAtOpPnt(int operatingPoint); 51 | InletPerformance getInletPerfAtOpPnt(int operatingPoint); 52 | InletGuideVanePerformance getInletGuideVanePerfAtOpPnt(int operatingPoint); 53 | CompressorLeakagePerformance getLeakagePerfAtOpPnt(int leakgIndex, int operatingPoint); 54 | 55 | //shaft speed properties 56 | double getShaftSpeed(); 57 | void setShaftSpeed(double shaftSpeed); 58 | 59 | int getNumberOfLeakages(); 60 | 61 | private: 62 | //members 63 | std::vector _opPnts; 64 | std::vector _stages; 65 | std::vector m_diffPerf; 66 | std::vector m_inletPerf; 67 | std::vector m_igvPerf; 68 | std::vector m_leaks; 69 | 70 | double _shaftSpeed; //rpm 71 | 72 | }; 73 | 74 | #endif /* COMPRESSORSPEEDLINE_H_ */ 75 | -------------------------------------------------------------------------------- /src/CompressorStage.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * CompressorStage.cpp 3 | * 4 | * Created on: Jul 19, 2012 5 | * Author: bachm03j 6 | */ 7 | 8 | #include "CompressorStage.h" 9 | #include "CompressorAnnulus.h" 10 | #include "CompressorAirfoilConfiguration.h" 11 | #include "StringTrimmers.h" 12 | 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | CompressorStage::CompressorStage() { 20 | // TODO Auto-generated constructor stub 21 | } 22 | 23 | CompressorStage::CompressorStage(std::string stageName) { 24 | _stgName = stageName; 25 | } 26 | 27 | CompressorStage::~CompressorStage() { 28 | // TODO Auto-generated destructor stub 29 | //printf("called compressor stage destructor\n\n"); 30 | } 31 | 32 | void CompressorStage::addPerformancePoint(int index, CompressorStagePerformance perfPntToAdd) { 33 | //increase capacity if index is greater 34 | std::vector::iterator it; 35 | 36 | it = _optPntPerf.begin(); 37 | _optPntPerf.insert(it+index, perfPntToAdd); 38 | 39 | } 40 | 41 | std::vector CompressorStage::getOpPntPerf() { return _optPntPerf; } 42 | 43 | CompressorStagePerformance CompressorStage::getOpPntPerfAtIndex(int index) { 44 | return _optPntPerf.at(index); 45 | } 46 | 47 | void CompressorStage::replaceOpPntPerfAtIndex(int index, CompressorStagePerformance newPerfPnt) { 48 | _optPntPerf.at(index) = newPerfPnt; 49 | } 50 | 51 | CompressorAirfoilConfiguration *CompressorStage::getRotor() { return _rotorConfig; } 52 | 53 | void CompressorStage::setRotor(CompressorAirfoilConfiguration *newRotor) { 54 | _rotorConfig = newRotor; 55 | } 56 | 57 | CompressorAirfoilConfiguration *CompressorStage::getStator() { return _statorConfig; } 58 | 59 | void CompressorStage::setStator(CompressorAirfoilConfiguration *newStator) { 60 | _statorConfig = newStator; 61 | } 62 | 63 | std::string CompressorStage::getStageName() { 64 | std::string rtrnStageName; 65 | char cStgName[3]; 66 | int intStgRep = atoi( _stgName.c_str() ); 67 | if ( intStgRep != 0 ) { 68 | sprintf( cStgName, "%2.2i", intStgRep ); 69 | rtrnStageName = std::string(cStgName); 70 | } else { 71 | rtrnStageName = _stgName; 72 | } 73 | return rtrnStageName; 74 | } 75 | 76 | double CompressorStage::calcXnullRotor(CompressorAnnulus *annulus) { 77 | 78 | return _rotorConfig->calcXnull(); 79 | 80 | /* 81 | int stgNumb = atoi( _stgName.c_str() ); 82 | int pntIndxLe, pntIndxTe; 83 | 84 | pntIndxLe = (stgNumb - 1) * 4; 85 | pntIndxTe = (stgNumb - 1) * 4 + 1; 86 | 87 | double xh1, xh2, xc1, xc2; //axial location of hub and casing sail points 88 | xh1 = annulus->hubPointAtIndex( pntIndxLe )->getX(); 89 | xh2 = annulus->hubPointAtIndex( pntIndxTe )->getX(); 90 | xc1 = annulus->casePointAtIndex( pntIndxLe )->getX(); 91 | xc2 = annulus->casePointAtIndex( pntIndxTe )->getX(); 92 | 93 | double xavg = (xh1 + xh2 + xc1 + xc2)/4; 94 | return xavg; 95 | */ 96 | 97 | } 98 | 99 | double CompressorStage::calcXnullStator(CompressorAnnulus *annulus) { 100 | 101 | return _statorConfig->calcXnull(); 102 | 103 | /* 104 | //TODO: bad implementation, come up with a better way to index stage numbers 105 | // since some stages are not named by number like OGV 106 | int pntIndxLe, pntIndxTe; 107 | if (( _stgName.find("IGV") != std::string::npos || _stgName.find("igv") != std::string::npos )) { 108 | throw std::exception(); 109 | pntIndxLe = 0; //this won't be right if inlet points are added 110 | pntIndxTe = 1; 111 | } else if ( _stgName.find("OGV") != std::string::npos || _stgName.find("ogv") != std::string::npos ) { 112 | pntIndxLe = annulus->getHubProfile().size()-1; 113 | pntIndxTe = annulus->getHubProfile().size()-2; 114 | } else { 115 | int stgNumb = atoi( _stgName.c_str() ); 116 | pntIndxLe = (stgNumb - 1) * 4 + 2; 117 | pntIndxTe = (stgNumb - 1) * 4 + 3; 118 | } 119 | 120 | 121 | double xh1, xh2, xc1, xc2; //axial location of hub and casing sail points 122 | xh1 = annulus->hubPointAtIndex( pntIndxLe )->getX(); 123 | xh2 = annulus->hubPointAtIndex( pntIndxTe )->getX(); 124 | xc1 = annulus->casePointAtIndex( pntIndxLe )->getX(); 125 | xc2 = annulus->casePointAtIndex( pntIndxTe )->getX(); 126 | 127 | double xavg = (xh1 + xh2 + xc1 + xc2)/4; 128 | return xavg; 129 | */ 130 | } 131 | -------------------------------------------------------------------------------- /src/CompressorStage.h: -------------------------------------------------------------------------------- 1 | /* 2 | * CompressorStage.h 3 | * 4 | * Created on: Jul 19, 2012 5 | * Author: bachm03j 6 | */ 7 | 8 | #ifndef COMPRESSORSTAGE_H_ 9 | #define COMPRESSORSTAGE_H_ 10 | 11 | #include 12 | #include 13 | #include "CompressorStagePerformance.h" 14 | 15 | class CompressorAirfoilConfiguration; 16 | class CompressorAnnulus; 17 | 18 | class CompressorStage { 19 | public: 20 | //methods 21 | CompressorStage(); 22 | CompressorStage(std::string stageName); 23 | virtual ~CompressorStage(); 24 | 25 | void addPerformancePoint(int index, CompressorStagePerformance perfPntToAdd); 26 | 27 | //accessors/properties 28 | std::vector getOpPntPerf(); 29 | CompressorStagePerformance getOpPntPerfAtIndex(int index); 30 | void replaceOpPntPerfAtIndex(int index, CompressorStagePerformance newPerfPnt); 31 | 32 | CompressorAirfoilConfiguration *getRotor(); 33 | void setRotor(CompressorAirfoilConfiguration *newRotor); 34 | 35 | CompressorAirfoilConfiguration *getStator(); 36 | void setStator(CompressorAirfoilConfiguration *newStator); 37 | 38 | std::string getStageName(); 39 | 40 | double calcXnullRotor(CompressorAnnulus *annulus); 41 | double calcXnullStator(CompressorAnnulus *annulus); 42 | 43 | private: 44 | //members 45 | std::string _stgName; 46 | std::vector _optPntPerf; 47 | 48 | CompressorAirfoilConfiguration *_rotorConfig; 49 | CompressorAirfoilConfiguration *_statorConfig; 50 | 51 | double _stgPratio; 52 | 53 | }; 54 | 55 | #endif /* COMPRESSORSTAGE_H_ */ 56 | -------------------------------------------------------------------------------- /src/CompressorStagePerformance.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * CompressorStagePerformance.cpp 3 | * 4 | * Created on: Jul 19, 2012 5 | * Author: bachm03j 6 | */ 7 | 8 | #include "CompressorStagePerformance.h" 9 | 10 | CompressorStagePerformance::CompressorStagePerformance() { 11 | // TODO Auto-generated constructor stub 12 | } 13 | 14 | CompressorStagePerformance::CompressorStagePerformance(int opPntNumber, 15 | double rotorPt1Abs, double rotorPt1Rel, double rotorPt2Rel, 16 | double rotorPs1, double rotorPs2, 17 | double statorPt1, double statorPt2, 18 | double statorPs1, double statorPs2, 19 | double rotorTt1Abs, double rotorTt1Rel, double rotorTt2Rel, 20 | double statorTt1, double statorTt2, 21 | double rotorBeta1, double rotorBeta2, double statorAlpha1, double statorAlpha2, 22 | double stagePi, double stageEtaAdb, double stageWork, double rotorPhi, 23 | double statorPhi, double wheelSpeed, 24 | double diffLiebRotor, double diffEqRatioRotor, double deHallerRotor, 25 | double diffLiebStator, double diffEqRatioStator, double deHallerStator, 26 | double stageReact, double rotorAspRat, double statorAspRat, int rotorNumAfs, int statorNumAfs, 27 | double rotorIncidence, double statorIncidence, double rotorDeviation, double statorDeviation) { 28 | 29 | m_opPntNmbr = opPntNumber; 30 | 31 | m_rtrPt1Abs = rotorPt1Abs; 32 | m_rtrPt1Rel = rotorPt1Rel; 33 | m_rtrPt2Rel = rotorPt2Rel; 34 | 35 | m_rtrPs1 = rotorPs1; 36 | m_rtrPs2 = rotorPs2; 37 | 38 | m_strPt1 = statorPt1; 39 | m_strPt2 = statorPt2; 40 | 41 | m_sttrPs1 = statorPs1; 42 | m_sttrPs2 = statorPs2; 43 | 44 | m_rtrTt1Abs = rotorTt1Abs; 45 | m_rtrTt1Rel = rotorTt1Rel; 46 | m_rtrTt2Rel = rotorTt2Rel; 47 | 48 | m_sttrTt1 = statorTt1; 49 | m_sttrTt2 = statorTt2; 50 | 51 | m_beta1 = rotorBeta1; 52 | m_beta2 = rotorBeta2; 53 | 54 | m_alpha3 = statorAlpha1; 55 | m_alpha4 = statorAlpha2; 56 | 57 | m_stgPi = stagePi; 58 | m_stgEtaAdb = stageEtaAdb; 59 | m_stgWrk = stageWork; 60 | m_rtrPhi = rotorPhi; 61 | m_sttrPhi = statorPhi; 62 | m_whlSpd = wheelSpeed; 63 | 64 | m_diffLiebRtr = diffLiebRotor; 65 | m_diffEqRatRtr = diffEqRatioRotor; 66 | m_deHallrRtr = deHallerRotor; 67 | 68 | m_diffLiebStr = diffLiebStator; 69 | m_diffEqRatStr = diffEqRatioStator; 70 | m_deHallrStr = deHallerStator; 71 | 72 | m_stgRct = stageReact; 73 | 74 | m_aspRatRtr = rotorAspRat; 75 | m_aspRatSttr = statorAspRat; 76 | 77 | m_numAfsRtr = rotorNumAfs; 78 | m_numAfsSttr = statorNumAfs; 79 | 80 | m_incRtr = rotorIncidence; 81 | m_incSttr = statorIncidence; 82 | 83 | m_devRtr = rotorDeviation; 84 | m_devSttr = statorDeviation; 85 | 86 | } 87 | 88 | CompressorStagePerformance::~CompressorStagePerformance() { 89 | // TODO Auto-generated destructor stub 90 | //printf("called compressor stage performance destructor\n\n"); 91 | } 92 | 93 | //accessors 94 | int CompressorStagePerformance::getOptPntNmbr() const { return m_opPntNmbr; } 95 | 96 | double CompressorStagePerformance::getRotorPt1Abs() const { return m_rtrPt1Abs; } 97 | double CompressorStagePerformance::getRotorPt1Rel() const { return m_rtrPt1Rel; } 98 | double CompressorStagePerformance::getRotorPt2Rel() const { return m_rtrPt2Rel; } 99 | double CompressorStagePerformance::getStatorPt1() const { return m_strPt1; } 100 | double CompressorStagePerformance::getStatorPt2() const { return m_strPt2; } 101 | 102 | double CompressorStagePerformance::getRotorPs1() const { return m_rtrPs1; } 103 | double CompressorStagePerformance::getRotorPs2() const { return m_rtrPs2; } 104 | double CompressorStagePerformance::getStatorPs1() const { return m_sttrPs1; } 105 | double CompressorStagePerformance::getStatorPs2() const { return m_sttrPs2; } 106 | 107 | double CompressorStagePerformance::getRotorTt1Abs() const { return m_rtrTt1Abs; } 108 | double CompressorStagePerformance::getRotorTt1Rel() const { return m_rtrTt1Rel; } 109 | double CompressorStagePerformance::getRotorTt2Rel() const { return m_rtrTt2Rel; } 110 | double CompressorStagePerformance::getStatorTt1() const { return m_sttrTt1; } 111 | double CompressorStagePerformance::getStatorTt2() const { return m_sttrTt2; } 112 | 113 | double CompressorStagePerformance::getRotorTs1() const { return m_rtrTs1; } 114 | double CompressorStagePerformance::getRotorTs2() const { return m_rtrTs2; } 115 | double CompressorStagePerformance::getStatorTs1() const { return m_sttrTs1; } 116 | double CompressorStagePerformance::getStatorTs2() const { return m_sttrTs2; } 117 | 118 | double CompressorStagePerformance::getRotorBeta1() const { return m_beta1; } 119 | double CompressorStagePerformance::getRotorBeta2() const { return m_beta2; } 120 | double CompressorStagePerformance::getStatorAlpha1() const { return m_alpha3; } 121 | double CompressorStagePerformance::getStatorAlpha2() const { return m_alpha4; } 122 | 123 | double CompressorStagePerformance::getRotorBeta1Metal() const { return m_beta1m; } 124 | double CompressorStagePerformance::getRotorBeta2Metal() const { return m_beta2m; } 125 | double CompressorStagePerformance::getStatorAlpha1Metal() const { return m_alpha3m; } 126 | double CompressorStagePerformance::getStatorAlpha2Metal() const { return m_alpha4m; } 127 | 128 | double CompressorStagePerformance::getStagePi() const { return m_stgPi; } 129 | double CompressorStagePerformance::getStageEtaAdiab() const { return m_stgEtaAdb; } 130 | double CompressorStagePerformance::getStageWork() const { return m_stgWrk; } 131 | double CompressorStagePerformance::getRotorPhi() const { return m_rtrPhi; } 132 | double CompressorStagePerformance::getStatorPhi() const { return m_sttrPhi; } 133 | double CompressorStagePerformance::getWheelSpeed() const { return m_whlSpd; } 134 | 135 | double CompressorStagePerformance::getDiffLiebRotor() const { return m_diffLiebRtr; } 136 | double CompressorStagePerformance::getDiffEqRatRotor() const { return m_diffEqRatRtr; } 137 | double CompressorStagePerformance::getDeHallerRotor() const { return m_deHallrRtr; } 138 | 139 | double CompressorStagePerformance::getDiffLiebStator() const { return m_diffLiebStr; } 140 | double CompressorStagePerformance::getDiffEqRatStator() const { return m_diffEqRatStr; } 141 | double CompressorStagePerformance::getDeHallerStator() const { return m_deHallrStr; } 142 | 143 | double CompressorStagePerformance::getStageReaction() const { return m_stgRct; } 144 | 145 | double CompressorStagePerformance::getRotorAspRatio() const { return m_aspRatRtr; } 146 | double CompressorStagePerformance::getStatorAspRatio() const { return m_aspRatSttr; } 147 | 148 | double CompressorStagePerformance::getRotorNumAirfoils() const {return m_numAfsRtr; } 149 | double CompressorStagePerformance::getStatorNumAirfoils() const {return m_numAfsSttr; } 150 | 151 | double CompressorStagePerformance::getRotorIncidence() const { return m_incRtr; } 152 | double CompressorStagePerformance::getStatorIncidence() const { return m_incSttr; } 153 | 154 | double CompressorStagePerformance::getRotorDeviation() const { return m_devRtr; } 155 | double CompressorStagePerformance::getStatorDeviation() const { return m_devSttr; } 156 | -------------------------------------------------------------------------------- /src/CompressorStagePerformance.h: -------------------------------------------------------------------------------- 1 | /* 2 | * CompressorStagePerformance.h 3 | * 4 | * Created on: Jul 19, 2012 5 | * Author: bachm03j 6 | */ 7 | 8 | #ifndef COMPRESSORSTAGEPERFORMANCE_H_ 9 | #define COMPRESSORSTAGEPERFORMANCE_H_ 10 | 11 | class CompressorStagePerformance { 12 | 13 | public: 14 | //methods 15 | CompressorStagePerformance(); 16 | 17 | CompressorStagePerformance(int opPntNumber, 18 | double rotorPt1Abs, 19 | double rotorPt1Rel, 20 | double rotorPt2Rel, 21 | double rotorPs1, 22 | double rotorPs2, 23 | double statorPt1, 24 | double statorPt2, 25 | double statorPs1, 26 | double statorPs2, 27 | double rotorTt1Abs, 28 | double rotorTt1Rel, 29 | double rotorTt2Rel, 30 | double statorTt1, 31 | double statorTt2, 32 | double rotorBeta1, 33 | double rotorBeta2, 34 | double statorAlpha1, 35 | double statorAlpha2, 36 | double stagePi, 37 | double stageEtaAdb, 38 | double stageWork, 39 | double rotorPhi, 40 | double statorPhi, 41 | double wheelSpeed, 42 | double diffLiebRotor, 43 | double diffEqRatioRotor, 44 | double deHallerRotor, 45 | double diffLiebStator, 46 | double diffEqRatioStator, 47 | double deHallerStator, 48 | double stageReact, 49 | double rotorAspRat, 50 | double statorAspRat, 51 | int rotorNumAfs, 52 | int statorNumAfs, 53 | double rotorIncidence, 54 | double statorIncidence, 55 | double rotorDeviation, 56 | double statorDeviation 57 | ); 58 | 59 | virtual ~CompressorStagePerformance(); 60 | 61 | //accessors (properties) 62 | int getOptPntNmbr() const; 63 | 64 | double getRotorPt1Abs() const; 65 | double getRotorPt1Rel() const; 66 | double getRotorPt2Rel() const; 67 | 68 | double getStatorPt1() const; 69 | double getStatorPt2() const; 70 | 71 | double getRotorPs1() const; 72 | double getRotorPs2() const; 73 | 74 | double getStatorPs1() const; 75 | double getStatorPs2() const; 76 | 77 | double getRotorTt1Abs() const; 78 | double getRotorTt1Rel() const; 79 | double getRotorTt2Rel() const; 80 | 81 | double getStatorTt1() const; 82 | double getStatorTt2() const; 83 | 84 | double getRotorTs1() const; 85 | double getRotorTs2() const; 86 | double getStatorTs1() const; 87 | double getStatorTs2() const; 88 | 89 | double getRotorBeta1() const; 90 | double getRotorBeta2() const; 91 | double getStatorAlpha1() const; 92 | double getStatorAlpha2() const; 93 | 94 | double getRotorBeta1Metal() const; 95 | double getRotorBeta2Metal() const; 96 | double getStatorAlpha1Metal() const; 97 | double getStatorAlpha2Metal() const; 98 | 99 | double getStagePi() const; 100 | double getStageEtaAdiab() const; 101 | double getStageWork() const; 102 | double getRotorPhi() const; 103 | double getStatorPhi() const; 104 | double getWheelSpeed() const; 105 | 106 | double getDiffLiebRotor() const; 107 | double getDiffEqRatRotor() const; 108 | double getDeHallerRotor() const; 109 | 110 | double getDiffLiebStator() const; 111 | double getDiffEqRatStator() const; 112 | double getDeHallerStator() const; 113 | 114 | double getStageReaction() const; 115 | 116 | double getRotorAspRatio() const; 117 | double getStatorAspRatio() const; 118 | 119 | double getRotorNumAirfoils() const; 120 | double getStatorNumAirfoils() const; 121 | 122 | double getRotorIncidence() const; 123 | double getStatorIncidence() const; 124 | 125 | double getRotorDeviation() const; 126 | double getStatorDeviation() const; 127 | 128 | private: 129 | //members 130 | int m_opPntNmbr; 131 | 132 | double m_rtrPt1Abs; 133 | double m_rtrPt1Rel; 134 | double m_rtrPt2Rel; 135 | double m_strPt1; 136 | double m_strPt2; 137 | 138 | double m_rtrPs1; 139 | double m_rtrPs2; 140 | double m_sttrPs1; 141 | double m_sttrPs2; 142 | 143 | double m_rtrTt1Abs; 144 | double m_rtrTt1Rel; 145 | double m_rtrTt2Rel; 146 | double m_sttrTt1; 147 | double m_sttrTt2; 148 | 149 | double m_rtrTs1; 150 | double m_rtrTs2; 151 | double m_sttrTs1; 152 | double m_sttrTs2; 153 | 154 | double m_beta1; 155 | double m_beta2; 156 | double m_alpha3; 157 | double m_alpha4; 158 | 159 | double m_stgPi; 160 | double m_stgEtaAdb; 161 | double m_stgWrk; 162 | double m_rtrPhi; 163 | double m_sttrPhi; 164 | double m_whlSpd; 165 | 166 | double m_diffLiebRtr; 167 | double m_diffEqRatRtr; 168 | double m_deHallrRtr; 169 | 170 | double m_diffLiebStr; 171 | double m_diffEqRatStr; 172 | double m_deHallrStr; 173 | 174 | double m_stgRct; 175 | 176 | double m_beta1m; 177 | double m_beta2m; 178 | double m_alpha3m; 179 | double m_alpha4m; 180 | 181 | double m_aspRatRtr; 182 | double m_aspRatSttr; 183 | 184 | double m_numAfsRtr; 185 | double m_numAfsSttr; 186 | 187 | double m_incRtr; //rotor incidence angle (deg) 188 | double m_incSttr; //stator incidence angle (deg) 189 | 190 | double m_devRtr; //rotor deviation angle (deg) 191 | double m_devSttr; //stator deviation angle (deg) 192 | 193 | }; 194 | 195 | #endif /* COMPRESSORSTAGEPERFORMANCE_H_ */ 196 | -------------------------------------------------------------------------------- /src/CompressorTwoDAirfoilConfiguration.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * CompressorTwoDAirfoilConfiguration.cpp 3 | * 4 | * Created on: Sep 11, 2012 5 | * Author: bachm03j 6 | */ 7 | 8 | #include "CompressorTwoDAirfoilConfiguration.h" 9 | #include 10 | #include 11 | 12 | //ctors and dtors 13 | 14 | CompressorTwoDAirfoilConfiguration::CompressorTwoDAirfoilConfiguration() 15 | { 16 | // TODO Auto-generated constructor stub 17 | } 18 | 19 | CompressorTwoDAirfoilConfiguration::CompressorTwoDAirfoilConfiguration(std::string airfoilName, AirfoilBehavior airfoilBehr) 20 | { 21 | _name = airfoilName; 22 | _airfoilBhvr = airfoilBehr; 23 | } 24 | 25 | CompressorTwoDAirfoilConfiguration::~CompressorTwoDAirfoilConfiguration() 26 | { 27 | // TODO Auto-generated destructor stub 28 | } 29 | 30 | 31 | void CompressorTwoDAirfoilConfiguration::addSectionConfiguration(AirfoilSectionConfiguration newSectConfig) 32 | { 33 | _sectConfigs.push_back(newSectConfig); 34 | } 35 | 36 | AirfoilSectionConfiguration CompressorTwoDAirfoilConfiguration::getSectionConfigAtIndex(int index) 37 | { 38 | //may not be the best place to do this but update the le and te 39 | // points for each section from the sail point vectors 40 | //this->updateSectionLeAndTePnts(); 41 | 42 | AirfoilSectionConfiguration configToReturn = _sectConfigs.at(index); 43 | return configToReturn; 44 | } 45 | 46 | std::vector CompressorTwoDAirfoilConfiguration::getSections() 47 | { 48 | //may not be the best place to do this but update the le and te 49 | // points for each section from the sail point vectors 50 | //this->updateSectionLeAndTePnts(); 51 | return _sectConfigs; 52 | } 53 | 54 | const AirfoilSectionConfiguration *CompressorTwoDAirfoilConfiguration::getSectionNearSpanFraction(double frac) 55 | { 56 | 57 | //may not be the best place to do this but update the le and te 58 | // points for each section from the sail point vectors 59 | //this->updateSectionLeAndTePnts(); 60 | 61 | //double rHub = _sectConfigs.at(0).getRadiusMean(); 62 | //double rTip = _sectConfigs.at(_sectConfigs.size()-1).getRadiusMean(); 63 | double rHub = (_sectConfigs.front()).getRadiusMean(); 64 | double rTip = (_sectConfigs.back()).getRadiusMean(); //Had to enclose call to back in parentheses. 65 | 66 | double span = std::abs( rTip - rHub ); 67 | double spanFrac; 68 | 69 | double delta = 1e12; 70 | double smallestDelta = delta; 71 | 72 | AirfoilSectionConfiguration sect; 73 | AirfoilSectionConfiguration *sectToReturn = 0; 74 | 75 | std::vector::iterator itSect; 76 | for ( itSect = _sectConfigs.begin(); itSect != _sectConfigs.end(); ++itSect ) { 77 | sect = (*itSect); 78 | spanFrac = std::abs( (*itSect).getRadiusMean() - rHub) / span; 79 | delta = std::abs( spanFrac - frac ); 80 | //smallestDelta = ( delta < smallestDelta ) ? delta : smallestDelta; 81 | if (delta < smallestDelta) { 82 | smallestDelta = delta; 83 | sectToReturn = &(*itSect); 84 | } 85 | 86 | } 87 | 88 | return sectToReturn; 89 | } 90 | 91 | const AirfoilSectionConfiguration *CompressorTwoDAirfoilConfiguration::getSectionAtMidspan() 92 | { 93 | return this->getSectionNearSpanFraction(0.5); 94 | } 95 | 96 | const AirfoilSectionConfiguration *CompressorTwoDAirfoilConfiguration::getSectionAtHub() 97 | { 98 | return this->getSectionNearSpanFraction(0.0); 99 | } 100 | 101 | const AirfoilSectionConfiguration *CompressorTwoDAirfoilConfiguration::getSectionAtTip() 102 | { 103 | return this->getSectionNearSpanFraction(1.0); 104 | } 105 | 106 | 107 | std::vector CompressorTwoDAirfoilConfiguration::getLeSectPoints() 108 | { 109 | std::vector lePnts; 110 | std::vector::iterator itSect; 111 | for ( itSect = _sectConfigs.begin(); itSect != _sectConfigs.end(); ++itSect ) { 112 | lePnts.push_back( (*itSect).getLePoint() ); 113 | } 114 | return lePnts; 115 | } 116 | 117 | std::vector CompressorTwoDAirfoilConfiguration::getTeSectPoints() 118 | { 119 | std::vector tePnts; 120 | std::vector::iterator itSect; 121 | for ( itSect = _sectConfigs.begin(); itSect != _sectConfigs.end(); ++itSect ) { 122 | tePnts.push_back( (*itSect).getTePoint() ); 123 | } 124 | return tePnts; 125 | } 126 | 127 | AnnulusPoint CompressorTwoDAirfoilConfiguration::getSectLePointAtIndex(int index) 128 | { 129 | AnnulusPoint lePnt = _sectConfigs.at(index).getLePoint(); 130 | return lePnt; 131 | } 132 | 133 | AnnulusPoint CompressorTwoDAirfoilConfiguration::getSectTePointAtIndex(int index) 134 | { 135 | AnnulusPoint tePnt = _sectConfigs.at(index).getTePoint(); 136 | return tePnt; 137 | } 138 | 139 | size_t CompressorTwoDAirfoilConfiguration::maxSectNo() 140 | { 141 | size_t numSects = _sectConfigs.size(); 142 | return numSects; 143 | } 144 | 145 | void CompressorTwoDAirfoilConfiguration::setLeSailPoints( const std::vector newLePoints ) { 146 | _sailPntsLe.clear(); 147 | 148 | std::vector::const_iterator it; 149 | 150 | for ( it = newLePoints.begin(); it != newLePoints.end(); ++it ) { 151 | _sailPntsLe.push_back( *it ); 152 | } 153 | } 154 | 155 | void CompressorTwoDAirfoilConfiguration::setTeSailPoints( const std::vector newTePoints ) { 156 | _sailPntsTe.clear(); 157 | std::vector::const_iterator it; 158 | for ( it = newTePoints.begin(); it != newTePoints.end(); ++it ) { 159 | _sailPntsTe.push_back( *it ); 160 | } 161 | } 162 | 163 | std::vector CompressorTwoDAirfoilConfiguration::getLeSailPoints() { return _sailPntsLe; } 164 | std::vector CompressorTwoDAirfoilConfiguration::getTeSailPoints() { return _sailPntsTe; } 165 | 166 | AnnulusPoint CompressorTwoDAirfoilConfiguration::getLeSailPointAtIndex(int index) { return _sailPntsLe.at(index); } 167 | AnnulusPoint CompressorTwoDAirfoilConfiguration::getTeSailPointAtIndex(int index) { return _sailPntsTe.at(index); } 168 | 169 | AirfoilBehavior CompressorTwoDAirfoilConfiguration::getAirfoilBehavior() { return _airfoilBhvr; } 170 | void CompressorTwoDAirfoilConfiguration::setAirfoiilBehavior(AirfoilBehavior newBehavior) { _airfoilBhvr = newBehavior; } 171 | 172 | AirfoilType CompressorTwoDAirfoilConfiguration::getAirfoilType() { return _airfoilType; } 173 | void CompressorTwoDAirfoilConfiguration::setAirfoilType(AirfoilType newAirfoilType) { _airfoilType = newAirfoilType; } 174 | 175 | int CompressorTwoDAirfoilConfiguration::getNumAirfoils() { return _numBlades; } 176 | void CompressorTwoDAirfoilConfiguration::setNumAirfoils(int numAirfoils) { _numBlades = numAirfoils; } 177 | 178 | std::string CompressorTwoDAirfoilConfiguration::getName() { return _name; } 179 | void CompressorTwoDAirfoilConfiguration::setName(std::string newName) { _name = newName; } 180 | 181 | double CompressorTwoDAirfoilConfiguration::getXnull() { return _xNull; } 182 | void CompressorTwoDAirfoilConfiguration::setXnull(double newXnull) { _xNull = newXnull; } 183 | 184 | double CompressorTwoDAirfoilConfiguration::getRotSpeed() { return _rotSpeed; } 185 | void CompressorTwoDAirfoilConfiguration::setRotSpeed(double newRotSpeed) { _rotSpeed = newRotSpeed; } 186 | 187 | double CompressorTwoDAirfoilConfiguration::getSpan() 188 | { 189 | double span = -9999; 190 | if ( !_sectConfigs.empty() ) { 191 | double rHub = (*_sectConfigs.begin()).getRadiusMean(); 192 | double rTip = (*_sectConfigs.end()).getRadiusMean(); 193 | span = std::abs( rTip - rHub ); 194 | } 195 | return span; //meters 196 | } 197 | 198 | double CompressorTwoDAirfoilConfiguration::getMassAveTempRecov() 199 | { 200 | 201 | double massFlow; 202 | double num; 203 | 204 | double sumNum = 0; 205 | double sumMass = 0; 206 | 207 | AirfoilSectionConfiguration sect; 208 | 209 | std::vector::iterator itSect; 210 | for ( size_t i = 1; i < _sectConfigs.size(); ++i ) { 211 | sect = _sectConfigs.at(i); 212 | massFlow = sect.getResult().getMassFlow(); 213 | num = (sect.getResult().getTempRecov() + _sectConfigs.at(i-1).getResult().getTempRecov()) / 2.0 * massFlow; 214 | 215 | sumNum += num; 216 | sumMass += massFlow; 217 | 218 | } 219 | 220 | double aveTemp = sumNum/sumMass; 221 | return aveTemp; 222 | } 223 | 224 | /* 225 | void CompressorTwoDAirfoilConfiguration::updateSectionLeAndTePnts() 226 | { 227 | 228 | //check that the airfoil configurations vector contains entries, otherwise 229 | // leave method 230 | if ( _sectConfigs.empty() ) return; 231 | 232 | //check that number of le and te sail points equals number of sections 233 | if ( _sailPntsLe.size() != _sectConfigs.size() ) { throw std::exception(); } 234 | if ( _sailPntsTe.size() != _sectConfigs.size() ) { throw std::exception(); } 235 | 236 | const std::string idLbl("ID"); 237 | const std::string odLbl("OD"); 238 | 239 | bool listStartsAtId; 240 | 241 | size_t iSect; 242 | std::vector::iterator itAp; 243 | 244 | 245 | // *************** ASSIGN LE POINTS ********************* 246 | 247 | //check if first point in LE sail points is OD or ID 248 | //if ( (*_sailPntsLe.begin()).getLabel().find(idLbl) != std::string::npos ) { 249 | if ( _sailPntsLe.front().getRadius() < _sailPntsLe.back().getRadius() ) { 250 | listStartsAtId = true; 251 | //} else if ( (*_sailPntsLe.begin()).getLabel().find(odLbl) != std::string::npos ) { 252 | } else { 253 | listStartsAtId = false; 254 | //} else { 255 | // throw std::exception(); //labeling is not following expected format somethings wrong 256 | } 257 | 258 | //assign each LE sail point to appropriate section config 259 | iSect = 0; 260 | for ( itAp = _sailPntsLe.begin(); itAp != _sailPntsLe.end(); ++itAp) { 261 | if ( listStartsAtId ) { 262 | (*(_sectConfigs.begin()+iSect)).setLePoint( (*itAp) ); 263 | } else { 264 | (*(_sectConfigs.rbegin()+iSect)).setLePoint( (*itAp) ); 265 | } 266 | iSect++; 267 | } 268 | 269 | 270 | // *************** ASSIGN TE POINTS ********************* 271 | 272 | //check if first point in LE sail points is OD or ID 273 | iSect = 0; 274 | //if ( (*_sailPntsTe.begin()).getLabel().find(idLbl) != std::string::npos ) { 275 | AnnulusPoint frt = _sailPntsTe.front(); 276 | AnnulusPoint bck = _sailPntsTe.back(); 277 | if ( _sailPntsTe.front().getRadius() < _sailPntsTe.back().getRadius() ) { 278 | listStartsAtId = true; 279 | } else { 280 | //} else if ( (*_sailPntsTe.begin()).getLabel().find(odLbl) != std::string::npos ) { 281 | listStartsAtId = false; 282 | //} else { 283 | // throw std::exception(); //labeling is not following expected format somethings wrong 284 | } 285 | 286 | //assign each TE sail point to appropriate section config 287 | for ( itAp = _sailPntsTe.begin(); itAp != _sailPntsTe.end(); ++itAp) { 288 | if ( listStartsAtId ) { 289 | (*(_sectConfigs.begin()+iSect)).setTePoint( (*itAp) ); 290 | } else { 291 | (*(_sectConfigs.rbegin()+iSect)).setTePoint( (*itAp) ); 292 | } 293 | iSect++; 294 | } 295 | } 296 | */ 297 | -------------------------------------------------------------------------------- /src/CompressorTwoDAirfoilConfiguration.h: -------------------------------------------------------------------------------- 1 | /* 2 | * CompressorTwoDAirfoilConfiguration.h 3 | * 4 | * Created on: Sep 11, 2012 5 | * Author: bachm03j 6 | */ 7 | 8 | #ifndef COMPRESSORTWODAIRFOILCONFIGURATION_H_ 9 | #define COMPRESSORTWODAIRFOILCONFIGURATION_H_ 10 | 11 | #include 12 | #include 13 | #include "CompressorEnumerations.h" 14 | #include "AirfoilSectionConfiguration.h" 15 | #include "AirfoilSectionResult.h" 16 | #include "AnnulusPoint.h" 17 | 18 | class CompressorTwoDAirfoilConfiguration { 19 | public: 20 | CompressorTwoDAirfoilConfiguration(); 21 | CompressorTwoDAirfoilConfiguration(std::string airfoilName, AirfoilBehavior airfoilBehr); 22 | virtual ~CompressorTwoDAirfoilConfiguration(); 23 | 24 | void addSectionConfiguration(AirfoilSectionConfiguration newSectConfig); 25 | std::vector getSections(); 26 | AirfoilSectionConfiguration getSectionConfigAtIndex(int index); 27 | const AirfoilSectionConfiguration *getSectionNearSpanFraction(double frac); 28 | const AirfoilSectionConfiguration *getSectionAtMidspan(); 29 | const AirfoilSectionConfiguration *getSectionAtHub(); 30 | const AirfoilSectionConfiguration *getSectionAtTip(); //TODO: rename to getSectionAtCase for consistency and clarity 31 | 32 | std::vector getLeSectPoints(); 33 | std::vector getTeSectPoints(); 34 | AnnulusPoint getSectLePointAtIndex(int index); 35 | AnnulusPoint getSectTePointAtIndex(int index); 36 | size_t maxSectNo(); 37 | 38 | //methods for sail point collections, 39 | // note that the number of values of sail points 40 | // coincide with those from the STARMEP out file. 41 | // but the radial values are not the same as that from the OUT file 42 | void setLeSailPoints( std::vector newLePoints ); 43 | void setTeSailPoints( std::vector newLePoints ); 44 | std::vector getLeSailPoints(); 45 | std::vector getTeSailPoints(); 46 | AnnulusPoint getLeSailPointAtIndex(int index); 47 | AnnulusPoint getTeSailPointAtIndex(int index); 48 | 49 | AirfoilBehavior getAirfoilBehavior(); 50 | void setAirfoiilBehavior(AirfoilBehavior newBehavior); 51 | 52 | AirfoilType getAirfoilType(); 53 | void setAirfoilType(AirfoilType newAirfoilType); 54 | 55 | int getNumAirfoils(); 56 | void setNumAirfoils(int numAirfoils); 57 | 58 | std::string getName(); 59 | void setName(std::string newName); 60 | 61 | double getXnull(); 62 | void setXnull(double newXnull); 63 | 64 | double getRotSpeed(); 65 | void setRotSpeed(double newRotSpeed); 66 | 67 | double getSpan(); 68 | 69 | double getMassAveTempRecov(); 70 | 71 | private: 72 | 73 | //void updateSectionLeAndTePnts(); 74 | 75 | std::string _name; 76 | 77 | std::vector _sailPntsLe; 78 | std::vector _sailPntsTe; 79 | 80 | std::vector _sectConfigs; 81 | 82 | AirfoilBehavior _airfoilBhvr; 83 | AirfoilType _airfoilType; 84 | int _numBlades; 85 | 86 | //TipClearanceSpecification _tipClrSpec; 87 | //double _tipClearance; 88 | 89 | double _xNull; //meters 90 | 91 | double _rotSpeed; //rpm 92 | 93 | }; 94 | 95 | #endif /* COMPRESSORTWODAIRFOILCONFIGURATION_H_ */ 96 | -------------------------------------------------------------------------------- /src/Diffuser.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Diffuser.cpp 3 | * 4 | * Created on: Aug 27, 2012 5 | * Author: bachm03j 6 | */ 7 | 8 | #include "Diffuser.h" 9 | 10 | Diffuser::Diffuser() { 11 | // TODO Auto-generated constructor stub 12 | 13 | } 14 | 15 | Diffuser::Diffuser(double areaRatio, double calibFactor) { 16 | _areaRatio = areaRatio; 17 | _calibFactor = calibFactor; 18 | } 19 | 20 | Diffuser::~Diffuser() { 21 | // TODO Auto-generated destructor stub 22 | } 23 | 24 | //properties 25 | double Diffuser::getAratio() { return _areaRatio; } 26 | double Diffuser::getCalibFactor() { return _calibFactor; } 27 | 28 | void Diffuser::addPerformancePoint(int index, DiffuserPerformance perfPntToAdd) { 29 | //increase capacity if index is greater 30 | std::vector::iterator it; 31 | 32 | it = _optPntPerf.begin(); 33 | _optPntPerf.insert(it+index, perfPntToAdd); 34 | 35 | } 36 | 37 | std::vector Diffuser::getOpPntPerf() { return _optPntPerf; } 38 | 39 | DiffuserPerformance Diffuser::getOpPntPerfAtIndex(int index) { return _optPntPerf.at(index); } 40 | 41 | void Diffuser::replaceOpPntPerfAtIndex(int index, DiffuserPerformance newPerfPnt) { 42 | _optPntPerf.at(index) = newPerfPnt; 43 | } 44 | -------------------------------------------------------------------------------- /src/Diffuser.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Diffuser.h 3 | * 4 | * Created on: Aug 27, 2012 5 | * Author: bachm03j 6 | */ 7 | 8 | #ifndef DIFFUSER_H_ 9 | #define DIFFUSER_H_ 10 | 11 | #include 12 | #include 13 | #include "DiffuserPerformance.h" 14 | 15 | class Diffuser { 16 | public: 17 | Diffuser(); 18 | Diffuser(double areaRatio, double calibFactor); 19 | virtual ~Diffuser(); 20 | 21 | double getAratio(); 22 | double getCalibFactor(); 23 | 24 | void addPerformancePoint(int index, DiffuserPerformance perfPntToAdd); 25 | void replaceOpPntPerfAtIndex(int index, DiffuserPerformance newPerfPnt); 26 | 27 | std::vector getOpPntPerf(); 28 | DiffuserPerformance getOpPntPerfAtIndex(int index); 29 | 30 | 31 | private: 32 | double _areaRatio; 33 | double _calibFactor; 34 | std::vector _optPntPerf; 35 | 36 | }; 37 | 38 | #endif /* DIFFUSER_H_ */ 39 | -------------------------------------------------------------------------------- /src/DiffuserPerformance.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * DiffuserPerformance.cpp 3 | * 4 | * Created on: Oct 22, 2013 5 | * Author: bachm03j 6 | */ 7 | 8 | #include "DiffuserPerformance.h" 9 | 10 | DiffuserPerformance::DiffuserPerformance() { 11 | // TODO Auto-generated constructor stub 12 | } 13 | 14 | DiffuserPerformance::DiffuserPerformance(int opPntNumber, 15 | double delPqP, 16 | double PtIn, 17 | double PsIn, 18 | double TtIn, 19 | double TsIn, 20 | double machIn, 21 | double PtExit, 22 | double PsExit, 23 | double TtExit, 24 | double TsExit, 25 | double machExit 26 | ) { 27 | m_opPntNmbr = opPntNumber; 28 | m_delPqP = delPqP, 29 | m_PtIn = PtIn; 30 | m_PsIn = PsIn; 31 | m_TtIn = TtIn; 32 | m_TsIn = TsIn; 33 | m_machIn = machIn; 34 | m_PtExit = PtExit; 35 | m_PsExit = PsExit; 36 | m_TtExit = TtExit; 37 | m_TsExit = TsExit; 38 | m_machExit = machExit; 39 | } 40 | 41 | DiffuserPerformance::~DiffuserPerformance() { 42 | // TODO Auto-generated destructor stub 43 | } 44 | 45 | int DiffuserPerformance::getOptPntNmbr() const { return m_opPntNmbr; } 46 | 47 | double DiffuserPerformance::getDelPqP() const { return m_delPqP; } 48 | 49 | double DiffuserPerformance::getPtIn() const { return m_PtIn; } 50 | double DiffuserPerformance::getPsIn() const { return m_PsIn; } 51 | double DiffuserPerformance::getTtIn() const { return m_TtIn; } 52 | double DiffuserPerformance::getTsIn() const { return m_TsIn; } 53 | double DiffuserPerformance::getMachIn() const { return m_machIn; } 54 | 55 | double DiffuserPerformance::getPtExit() const { return m_PtExit; } 56 | double DiffuserPerformance::getPsExit() const { return m_PsExit; } 57 | double DiffuserPerformance::getTtExit() const { return m_TtExit; } 58 | double DiffuserPerformance::getTsExit() const { return m_TsExit; } 59 | double DiffuserPerformance::getMachExit() const { return m_machExit; } 60 | -------------------------------------------------------------------------------- /src/DiffuserPerformance.h: -------------------------------------------------------------------------------- 1 | /* 2 | * DiffuserPerformance.h 3 | * 4 | * Created on: Oct 22, 2013 5 | * Author: bachm03j 6 | */ 7 | 8 | #ifndef DIFFUSERPERFORMANCE_H_ 9 | #define DIFFUSERPERFORMANCE_H_ 10 | 11 | class DiffuserPerformance { 12 | public: 13 | DiffuserPerformance(); 14 | 15 | DiffuserPerformance(int opPntNumber, 16 | double delPqP, 17 | double PtIn, 18 | double PsIn, 19 | double TtIn, 20 | double TsIn, 21 | double machIn, 22 | double PtExit, 23 | double PsExit, 24 | double TtExit, 25 | double TsExit, 26 | double machExit 27 | ); 28 | 29 | virtual ~DiffuserPerformance(); 30 | 31 | int getOptPntNmbr() const; 32 | 33 | double getDelPqP() const; 34 | 35 | double getPtIn() const; 36 | double getPsIn() const; 37 | double getTtIn() const; 38 | double getTsIn() const; 39 | double getMachIn() const; 40 | 41 | double getPtExit() const; 42 | double getPsExit() const; 43 | double getTtExit() const; 44 | double getTsExit() const; 45 | double getMachExit() const; 46 | 47 | 48 | private: 49 | double m_opPntNmbr; 50 | 51 | double m_delPqP; 52 | 53 | double m_PtIn; 54 | double m_PsIn; 55 | double m_TtIn; 56 | double m_TsIn; 57 | double m_machIn; 58 | 59 | double m_PtExit; 60 | double m_PsExit; 61 | double m_TtExit; 62 | double m_TsExit; 63 | double m_machExit; 64 | 65 | }; 66 | 67 | #endif /* DIFFUSERPERFORMANCE_H_ */ 68 | -------------------------------------------------------------------------------- /src/Info.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Info.h 3 | * 4 | * Created on: Dec 12, 2013 5 | * Author: bachm03j 6 | */ 7 | 8 | #ifndef INFO_H_ 9 | #define INFO_H_ 10 | 11 | namespace libSieCompInfo 12 | { 13 | const char* version = {"0.7.3"}; 14 | const char* libName = {"SieComp"}; 15 | const char* descrip = {"Library for storing compressor tool related data in an object oriented perspective."}; 16 | } 17 | 18 | 19 | #endif /* INFO_H_ */ 20 | -------------------------------------------------------------------------------- /src/Inlet.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Inlet.cpp 3 | * 4 | * Created on: Aug 27, 2012 5 | * Author: bachm03j 6 | */ 7 | 8 | #include "Inlet.h" 9 | 10 | Inlet::Inlet() { 11 | 12 | } 13 | 14 | Inlet::Inlet(double flangePressure, double scrollCalibFactor) { 15 | _scrollCalibFactor = scrollCalibFactor; 16 | _flangePressure = flangePressure; 17 | } 18 | 19 | Inlet::~Inlet() { 20 | // TODO Auto-generated destructor stub 21 | } 22 | 23 | void Inlet::addPerformancePoint(int opPnt, InletPerformance perfPntToAdd) { 24 | //increase capacity if index is greater 25 | std::vector::iterator it; 26 | 27 | it = m_opPntPerf.begin(); 28 | m_opPntPerf.insert(it+opPnt, perfPntToAdd); 29 | } 30 | 31 | std::vector Inlet::getOpPntPerf() { return m_opPntPerf; } 32 | 33 | double Inlet::getScrollCalibFactor() { return _scrollCalibFactor; } 34 | double Inlet::getFlangePressure() { return _flangePressure; } 35 | -------------------------------------------------------------------------------- /src/Inlet.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Inlet.h 3 | * 4 | * Created on: Aug 27, 2012 5 | * Author: bachm03j 6 | */ 7 | 8 | #ifndef INLET_H_ 9 | #define INLET_H_ 10 | 11 | #include 12 | #include "InletPerformance.h" 13 | 14 | class Inlet { 15 | public: 16 | Inlet(); 17 | Inlet(double flangePressure, double scrollCalibFactor); 18 | virtual ~Inlet(); 19 | 20 | double getScrollCalibFactor(); 21 | double getFlangePressure(); 22 | 23 | void addPerformancePoint(int opPnt, InletPerformance perfPntToAdd); 24 | std::vector getOpPntPerf(); 25 | 26 | private: 27 | double _scrollCalibFactor; 28 | double _flangePressure; 29 | 30 | std::vector m_opPntPerf; 31 | 32 | }; 33 | 34 | #endif /* INLET_H_ */ 35 | -------------------------------------------------------------------------------- /src/InletGuideVane.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * InletGuideVane.cpp 3 | * 4 | * Created on: Aug 27, 2012 5 | * Author: bachm03j 6 | */ 7 | 8 | #include "InletGuideVane.h" 9 | #include "CompressorAirfoilConfiguration.h" 10 | #include "Polynomial.h" 11 | #include 12 | 13 | InletGuideVane::InletGuideVane() { 14 | // TODO Auto-generated constructor stub 15 | } 16 | 17 | InletGuideVane::InletGuideVane( double anglePosition 18 | , bool userDefPtLoss, double userDeltaPtLoss 19 | , bool userDefR1AlphaFunc, double r1AlphaFuncSlope, double r1AlphaFuncYintcp ) { 20 | 21 | _anglPosn = anglePosition; 22 | 23 | _userPtLoss = userDefPtLoss; 24 | _delPtLoss = userDeltaPtLoss; 25 | 26 | _userDefR1AlphaFunc = userDefR1AlphaFunc; 27 | 28 | std::vector polyCoeffs; 29 | polyCoeffs.push_back(r1AlphaFuncYintcp); 30 | polyCoeffs.push_back(r1AlphaFuncSlope); 31 | 32 | PolynomialFit *r1AlpFunc = new PolynomialFit(polyCoeffs); 33 | _r1AlpFunc = r1AlpFunc; 34 | 35 | } 36 | 37 | 38 | InletGuideVane::~InletGuideVane() { 39 | // TODO Auto-generated destructor stub 40 | } 41 | 42 | void InletGuideVane::addPerformancePoint(int opPnt, InletGuideVanePerformance perfPntToAdd) { 43 | //increase capacity if index is greater 44 | std::vector::iterator it; 45 | 46 | it = m_opPntPerf.begin(); 47 | m_opPntPerf.insert(it+opPnt, perfPntToAdd); 48 | } 49 | 50 | std::vector InletGuideVane::getOpPntPerf() { return m_opPntPerf; } 51 | 52 | double InletGuideVane::getPosition() { return _anglPosn; } 53 | 54 | double InletGuideVane::getPtLoss() { return _delPtLoss; } 55 | 56 | void InletGuideVane::setAlphaLaw(std::vector polyCoeffs) { 57 | delete( _r1AlpFunc ); 58 | _r1AlpFunc = new PolynomialFit(polyCoeffs); 59 | } 60 | 61 | double InletGuideVane::getR1Alpha() { 62 | double r1Alp = _r1AlpFunc->calculate(_anglPosn); 63 | return r1Alp; 64 | } 65 | 66 | CompressorAirfoilConfiguration *InletGuideVane::getAirfoilConfig() { 67 | throw std::exception(); //not fully implemented yet, just a placeholder. 68 | //return _airfoilConfig; 69 | } 70 | -------------------------------------------------------------------------------- /src/InletGuideVane.h: -------------------------------------------------------------------------------- 1 | /* 2 | * InletGuideVane.h 3 | * 4 | * Created on: Aug 27, 2012 5 | * Author: bachm03j 6 | */ 7 | 8 | #ifndef INLETGUIDEVANE_H_ 9 | #define INLETGUIDEVANE_H_ 10 | 11 | #include 12 | #include "InletGuideVanePerformance.h" 13 | 14 | class PolynomialFit; 15 | class CompressorAirfoilConfiguration; 16 | 17 | class InletGuideVane { 18 | public: 19 | InletGuideVane(); 20 | InletGuideVane( double anglePosition 21 | , bool userDefPtLoss, double userDeltaPtLoss 22 | , bool userDefR1AlphaFunc, double r1AlphaFuncSlope, double r1AlphaFuncYintcp ); 23 | virtual ~InletGuideVane(); 24 | 25 | double getPosition(); 26 | void setPosition(double anglePosition); 27 | 28 | double getPtLoss(); 29 | 30 | void setAlphaLaw(std::vector polyCoeffs); 31 | 32 | double getR1Alpha(); 33 | 34 | CompressorAirfoilConfiguration *getAirfoilConfig(); 35 | 36 | void addPerformancePoint(int opPnt, InletGuideVanePerformance perfPntToAdd); 37 | std::vector getOpPntPerf(); 38 | 39 | private: 40 | 41 | double _anglPosn; //positive is closed 42 | 43 | bool _userPtLoss; 44 | double _delPtLoss; 45 | 46 | bool _userDefR1AlphaFunc; 47 | PolynomialFit *_r1AlpFunc; 48 | 49 | //not currently used by may be a good idea to reference the same airfoil configuration that exists in the 50 | // stages vector so that this object and that stage is consistent 51 | CompressorAirfoilConfiguration *m_airfoilConfig; 52 | 53 | std::vector m_opPntPerf; 54 | 55 | }; 56 | 57 | #endif /* INLETGUIDEVANE_H_ */ 58 | -------------------------------------------------------------------------------- /src/InletGuideVanePerformance.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * InletGuideVanePerformance.cpp 3 | * 4 | * Created on: Oct 31, 2012 5 | * Author: bachm03j 6 | */ 7 | 8 | #include "InletGuideVanePerformance.h" 9 | 10 | InletGuideVanePerformance::InletGuideVanePerformance(int opPntNmbr, double delPtqPt, double ptOut, double alpOut) { 11 | m_opPntNmbr = opPntNmbr; 12 | m_delPtqPt = delPtqPt; 13 | m_ptOut = ptOut; 14 | m_alpOut = alpOut; 15 | } 16 | 17 | InletGuideVanePerformance::~InletGuideVanePerformance() { 18 | // TODO Auto-generated destructor stub 19 | } 20 | 21 | int InletGuideVanePerformance::getOpPntNmbr() { return m_opPntNmbr; } 22 | double InletGuideVanePerformance::getDelPtqPt() {return m_delPtqPt; } 23 | double InletGuideVanePerformance::getPtOut() {return m_ptOut; } 24 | double InletGuideVanePerformance::getAlpOut() {return m_alpOut; } 25 | -------------------------------------------------------------------------------- /src/InletGuideVanePerformance.h: -------------------------------------------------------------------------------- 1 | /* 2 | * InletGuideVanePerformance.h 3 | * 4 | * Created on: Oct 31, 2012 5 | * Author: bachm03j 6 | */ 7 | 8 | #ifndef INLETGUIDEVANEPERFORMANCE_H_ 9 | #define INLETGUIDEVANEPERFORMANCE_H_ 10 | 11 | class InletGuideVanePerformance { 12 | public: 13 | InletGuideVanePerformance(int opPntNmbr, double delPtqPt, double ptOut, double alpOut); 14 | virtual ~InletGuideVanePerformance(); 15 | 16 | //accessors (properties) 17 | int getOpPntNmbr(); 18 | double getDelPtqPt(); 19 | double getPtOut(); 20 | double getAlpOut(); 21 | 22 | private: 23 | int m_opPntNmbr; 24 | double m_delPtqPt; 25 | double m_ptOut; 26 | double m_alpOut; 27 | 28 | }; 29 | 30 | #endif /* INLETGUIDEVANEPERFORMANCE_H_ */ 31 | -------------------------------------------------------------------------------- /src/InletPerformance.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * InletPerformance.cpp 3 | * 4 | * Created on: Oct 31, 2012 5 | * Author: bachm03j 6 | */ 7 | 8 | #include "InletPerformance.h" 9 | 10 | InletPerformance::InletPerformance(int opPntNmbr, double delPtqPt_Scroll, double ptOut) { 11 | m_opPntNmbr = opPntNmbr; 12 | m_delPtqPt_Scroll = delPtqPt_Scroll; 13 | m_ptOut = ptOut; 14 | } 15 | 16 | InletPerformance::~InletPerformance() { 17 | // TODO Auto-generated destructor stub 18 | } 19 | 20 | int InletPerformance::getOpPntNmbr() { return m_opPntNmbr; } 21 | double InletPerformance::getDelPtqPtScroll() {return m_delPtqPt_Scroll; } 22 | double InletPerformance::getPtOut() {return m_ptOut; } 23 | -------------------------------------------------------------------------------- /src/InletPerformance.h: -------------------------------------------------------------------------------- 1 | /* 2 | * InletPerformance.h 3 | * 4 | * Created on: Oct 31, 2012 5 | * Author: bachm03j 6 | */ 7 | 8 | #ifndef INLETPERFORMANCE_H_ 9 | #define INLETPERFORMANCE_H_ 10 | 11 | class InletPerformance { 12 | public: 13 | InletPerformance(int opPntNmbr, double delPtqPt_Scroll, double ptOut); 14 | virtual ~InletPerformance(); 15 | 16 | //accessors (properties) 17 | int getOpPntNmbr(); 18 | double getDelPtqPtScroll(); 19 | double getPtOut(); 20 | 21 | private: 22 | int m_opPntNmbr; 23 | double m_delPtqPt_Scroll; 24 | double m_ptOut; 25 | 26 | }; 27 | 28 | #endif /* INLETPERFORMANCE_H_ */ 29 | -------------------------------------------------------------------------------- /src/LossCorrelationData.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * LossCorrelationData.cpp 3 | * 4 | * Created on: Aug 27, 2012 5 | * Author: bachm03j 6 | */ 7 | 8 | #include "LossCorrelationData.h" 9 | 10 | LossCorrelationData::LossCorrelationData() { 11 | // TODO Auto-generated constructor stub 12 | 13 | } 14 | 15 | 16 | LossCorrelationData::LossCorrelationData(double hpaOmekor, double hpaAbkor, double cdaOmekor, double cdaDevkor 17 | , double cdaPmckor, double cdaDifkor, double cdaEchoke, double cdaEsurge, double cdaDslope 18 | , double cdaTlokor, double cdaEsukri, double cdaSmakor, double nacaOmekor 19 | , double nacaEchoke, double nacaEsurge) { 20 | 21 | _hpaOmekor = hpaOmekor; 22 | _hpaAbkor = hpaAbkor; 23 | 24 | _cdaOmekor = cdaOmekor; 25 | _cdaDevkor = cdaDevkor; 26 | _cdaPmckor = cdaPmckor; 27 | _cdaDifkor = cdaDifkor; 28 | _cdaEchoke = cdaEchoke; 29 | _cdaEsurge = cdaEsurge; 30 | _cdaDslope = cdaDslope; 31 | _cdaTlokor = cdaTlokor; 32 | _cdaEsukri = cdaEsukri; 33 | _cdaSmakor = cdaSmakor; 34 | 35 | _nacaOmekor = nacaOmekor; 36 | _nacaEchoke = nacaEchoke; 37 | _nacaEsurge = nacaEsurge; 38 | 39 | } 40 | 41 | LossCorrelationData::~LossCorrelationData() { 42 | // TODO Auto-generated destructor stub 43 | } 44 | 45 | double LossCorrelationData::getHpaOmekor() { return _hpaOmekor; }; 46 | double LossCorrelationData::getHpaAbkor() { return _hpaAbkor; }; 47 | 48 | double LossCorrelationData::getCdaOmekor() { return _cdaOmekor; }; 49 | double LossCorrelationData::getCdaDevkor() { return _cdaDevkor; }; 50 | double LossCorrelationData::getCdaPmckor() { return _cdaPmckor; }; 51 | double LossCorrelationData::getCdaDifkor() { return _cdaDifkor; }; 52 | double LossCorrelationData::getCdaEchoke() { return _cdaEchoke; }; 53 | double LossCorrelationData::getCdaEsurge() { return _cdaEsurge; }; 54 | double LossCorrelationData::getCdaDslope() { return _cdaDslope; }; 55 | double LossCorrelationData::getCdaTlokor() { return _cdaTlokor; }; 56 | double LossCorrelationData::getCdaEsukri() { return _cdaEsukri; }; 57 | double LossCorrelationData::getCdaSmakor() { return _cdaSmakor; }; 58 | 59 | double LossCorrelationData::getNacaOmekor() { return _nacaOmekor; }; 60 | double LossCorrelationData::getNacaEchoke() { return _nacaEchoke; }; 61 | double LossCorrelationData::getNacaEsurge() { return _nacaEsurge; }; 62 | -------------------------------------------------------------------------------- /src/LossCorrelationData.h: -------------------------------------------------------------------------------- 1 | /* 2 | * LossCorrelationData.h 3 | * 4 | * Created on: Aug 27, 2012 5 | * Author: bachm03j 6 | */ 7 | 8 | #ifndef LOSSCORRELATIONDATA_H_ 9 | #define LOSSCORRELATIONDATA_H_ 10 | 11 | class LossCorrelationData { 12 | public: 13 | LossCorrelationData(); 14 | LossCorrelationData(double hpaOmekor, double hpaAbkor, double cdaOmekor, double cdaDevkor 15 | , double cdaPmckor, double cdaDifkor, double cdaEchoke, double cdaEsurge, double cdaDslope 16 | , double cdaTlokor, double cdaEsukri, double cdaSmakor, double nacaOmekor 17 | , double nacaEchoke, double nacaEsurge); 18 | virtual ~LossCorrelationData(); 19 | 20 | double getHpaOmekor(); 21 | double getHpaAbkor(); 22 | 23 | double getCdaOmekor(); 24 | double getCdaDevkor(); 25 | double getCdaPmckor(); 26 | double getCdaDifkor(); 27 | double getCdaEchoke(); 28 | double getCdaEsurge(); 29 | double getCdaDslope(); 30 | double getCdaTlokor(); 31 | double getCdaEsukri(); 32 | double getCdaSmakor(); 33 | 34 | double getNacaOmekor(); 35 | double getNacaEchoke(); 36 | double getNacaEsurge(); 37 | 38 | private: 39 | double _hpaOmekor; 40 | double _hpaAbkor; 41 | 42 | double _cdaOmekor; 43 | double _cdaDevkor; 44 | double _cdaPmckor; 45 | double _cdaDifkor; 46 | double _cdaEchoke; 47 | double _cdaEsurge; 48 | double _cdaDslope; 49 | double _cdaTlokor; 50 | double _cdaEsukri; 51 | double _cdaSmakor; 52 | 53 | double _nacaOmekor; 54 | double _nacaEchoke; 55 | double _nacaEsurge; 56 | 57 | }; 58 | 59 | #endif /* LOSSCORRELATIONDATA_H_ */ 60 | -------------------------------------------------------------------------------- /src/Polynomial.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Polynomial.cpp 3 | * 4 | * Created on: Aug 27, 2012 5 | * Author: bachm03j 6 | */ 7 | 8 | 9 | #include 10 | #include "Polynomial.h" 11 | 12 | PolynomialFit::PolynomialFit() { 13 | // TODO Auto-generated constructor stub 14 | 15 | } 16 | 17 | PolynomialFit::PolynomialFit(std::vector coeffsToAdd) { 18 | 19 | //clear current coefficient vector 20 | _coeffs.clear(); 21 | 22 | std::vector::iterator it; 23 | for ( it = coeffsToAdd.begin() ; it < coeffsToAdd.end(); it++ ) { 24 | _coeffs.push_back(*it); 25 | } 26 | 27 | } 28 | 29 | PolynomialFit::~PolynomialFit() { 30 | // TODO Auto-generated destructor stub 31 | } 32 | 33 | void PolynomialFit::addCoefficient(double coeffToAdd) { 34 | _coeffs.push_back(coeffToAdd); 35 | } 36 | 37 | void PolynomialFit::replaceCoefficient(int index, double newCoeff) { 38 | _coeffs.at(index) = newCoeff; 39 | } 40 | 41 | double PolynomialFit::calculate(double x) { 42 | 43 | //not using indices to locate members of vector instead of iterator to gurauntee the order of items accessed 44 | double f = 0; 45 | size_t indx = 0; 46 | for ( indx=0; indx < _coeffs.size(); indx++ ) { 47 | f += _coeffs.at(indx) * pow(x, indx); 48 | ++ indx; 49 | } 50 | 51 | return f; 52 | 53 | } 54 | -------------------------------------------------------------------------------- /src/Polynomial.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Polynomial.h 3 | * 4 | * Created on: Aug 27, 2012 5 | * Author: bachm03j 6 | */ 7 | 8 | #ifndef POLYNOMIAL_H_ 9 | #define POLYNOMIAL_H_ 10 | 11 | #include 12 | 13 | class PolynomialFit { 14 | public: 15 | PolynomialFit(); 16 | PolynomialFit(std::vector coeffsToAdd); 17 | virtual ~PolynomialFit(); 18 | 19 | //public methods 20 | void addCoefficient(double coeffToAdd); 21 | void replaceCoefficient(int index, double newCoeff); 22 | double calculate(double x); 23 | 24 | private: 25 | std::vector _coeffs; 26 | 27 | }; 28 | 29 | #endif /* POLYNOMIALFIT_H_ */ 30 | -------------------------------------------------------------------------------- /src/StringTokenizer.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * StringTokenizer.cpp 3 | * 4 | * Created on: May 1, 2012 5 | * Author: bachm03j 6 | */ 7 | 8 | #include "StringTokenizer.h" 9 | 10 | using std::vector; 11 | using std::string; 12 | using std::stringstream; 13 | 14 | vector& split(const string &s, char delim, vector &elems) { 15 | stringstream ss(s,stringstream::in); 16 | string item; 17 | while(getline(ss, item, delim)) { 18 | elems.push_back(item); 19 | } 20 | return elems; 21 | } 22 | 23 | vector split(const string &s, char delim) { 24 | vector elems; 25 | return split(s, delim, elems); 26 | } 27 | 28 | vector removeWhiteSpaceElems(vector &elems) { 29 | 30 | vector newElems; 31 | 32 | vector::iterator it; 33 | for ( it=elems.begin() ; it != elems.end(); it++ ) { 34 | if (*it != "" && *it != " ") { 35 | newElems.push_back(*it); 36 | } 37 | } 38 | 39 | return newElems; 40 | 41 | } 42 | 43 | vector removeElemsOfString(vector &elems, const string strToRemove) { 44 | vector newElems; 45 | 46 | vector::iterator it; 47 | for ( it=elems.begin() ; it != elems.end(); it++ ) { 48 | if (*it != strToRemove) { 49 | newElems.push_back(*it); 50 | } 51 | } 52 | 53 | return newElems; 54 | } 55 | -------------------------------------------------------------------------------- /src/StringTokenizer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * StringTokenizer.h 3 | * 4 | * Created on: May 1, 2012 5 | * Author: bachm03j 6 | */ 7 | 8 | #ifndef STRINGTOKENIZER_H_ 9 | #define STRINGTOKENIZER_H_ 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | std::vector& split(const std::string &s, char delim, std::vector &elems); 16 | std::vector split(const std::string &s, char delim); 17 | std::vector removeWhiteSpaceElems(std::vector &elems); 18 | std::vector removeElemsOfString(std::vector &elems, const std::string strToRemove); 19 | 20 | #endif /* STRINGTOKENIZER_H_ */ 21 | -------------------------------------------------------------------------------- /src/StringTrimmers.h: -------------------------------------------------------------------------------- 1 | /* 2 | * StringTrimmers.h 3 | * 4 | * Created on: Jul 19, 2012 5 | * Author: bachm03j 6 | */ 7 | 8 | #ifndef STRINGTRIMMERS_H_ 9 | #define STRINGTRIMMERS_H_ 10 | 11 | #include 12 | #include 13 | #include 14 | #include 15 | 16 | 17 | // trim from start 18 | static inline std::string <rim(std::string &s) { 19 | s.erase(s.begin(), std::find_if(s.begin(), s.end(), std::not1(std::ptr_fun(std::isspace)))); 20 | return s; 21 | } 22 | 23 | // trim from end 24 | static inline std::string &rtrim(std::string &s) { 25 | s.erase(std::find_if(s.rbegin(), s.rend(), std::not1(std::ptr_fun(std::isspace))).base(), s.end()); 26 | return s; 27 | } 28 | 29 | // trim from both ends 30 | static inline std::string &trim(std::string &s) { 31 | return ltrim(rtrim(s)); 32 | } 33 | 34 | static inline bool replaceSubstring(std::string &mainString, std::string &subString, std::string &newSubString ) { 35 | bool found = false; 36 | size_t subStrSize = subString.size(); 37 | size_t subStrPos = mainString.find(subString); 38 | if (subStrPos != std::string::npos) { 39 | found = true; 40 | mainString.replace(subStrPos, subStrSize, newSubString); 41 | } 42 | 43 | return found; 44 | } 45 | 46 | static inline void stoupper(std::string& s) { 47 | std::string::iterator i = s.begin(); 48 | std::string::iterator end = s.end(); 49 | 50 | while (i != end) { 51 | *i = std::toupper((unsigned char)*i); 52 | ++i; 53 | } 54 | } 55 | 56 | static inline void stolower(std::string& s) { 57 | std::string::iterator i = s.begin(); 58 | std::string::iterator end = s.end(); 59 | 60 | while (i != end) { 61 | *i = std::tolower((unsigned char)*i); 62 | ++i; 63 | } 64 | } 65 | 66 | #endif /* STRINGTRIMMERS_H_ */ 67 | -------------------------------------------------------------------------------- /src/ThermodynamicPoint.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * ThermodynamicPoint.cpp 3 | * 4 | * Created on: May 30, 2013 5 | * Author: bachm03j 6 | */ 7 | 8 | #include "ThermodynamicPoint.h" 9 | 10 | ThermodynamicPoint::ThermodynamicPoint() { 11 | // TODO Auto-generated constructor stub 12 | 13 | } 14 | 15 | ThermodynamicPoint::~ThermodynamicPoint() { 16 | // TODO Auto-generated destructor stub 17 | } 18 | 19 | 20 | //properties 21 | 22 | std::string ThermodynamicPoint::getName() const 23 | { 24 | return m_name; 25 | } 26 | 27 | double ThermodynamicPoint::getCp() const 28 | { 29 | return m_cp; 30 | } 31 | 32 | double ThermodynamicPoint::getGamma() const 33 | { 34 | return m_gamma; 35 | } 36 | 37 | double ThermodynamicPoint::getH() const 38 | { 39 | return m_h; 40 | } 41 | 42 | double ThermodynamicPoint::getMw() const 43 | { 44 | return m_mw; 45 | } 46 | 47 | double ThermodynamicPoint::getPr() const 48 | { 49 | return m_pr; 50 | } 51 | 52 | double ThermodynamicPoint::getPress() const 53 | { 54 | return m_press; 55 | } 56 | 57 | double ThermodynamicPoint::getRho() const 58 | { 59 | return m_rho; 60 | } 61 | 62 | double ThermodynamicPoint::getS() const 63 | { 64 | return m_s; 65 | } 66 | 67 | double ThermodynamicPoint::getTemp() const 68 | { 69 | return m_temp; 70 | } 71 | 72 | double ThermodynamicPoint::getU() const 73 | { 74 | return m_u; 75 | } 76 | 77 | double ThermodynamicPoint::getVisc() const 78 | { 79 | return m_visc; 80 | } 81 | 82 | double ThermodynamicPoint::getVsonic() const 83 | { 84 | return m_vsonic; 85 | } 86 | 87 | 88 | void ThermodynamicPoint::setCp(double m_cp) 89 | { 90 | this->m_cp = m_cp; 91 | } 92 | 93 | void ThermodynamicPoint::setGamma(double m_gamma) 94 | { 95 | this->m_gamma = m_gamma; 96 | } 97 | 98 | void ThermodynamicPoint::setH(double m_h) 99 | { 100 | this->m_h = m_h; 101 | } 102 | 103 | void ThermodynamicPoint::setMw(double m_mw) 104 | { 105 | this->m_mw = m_mw; 106 | } 107 | 108 | void ThermodynamicPoint::setName(std::string m_name) 109 | { 110 | this->m_name = m_name; 111 | } 112 | 113 | void ThermodynamicPoint::setPr(double m_pr) 114 | { 115 | this->m_pr = m_pr; 116 | } 117 | 118 | void ThermodynamicPoint::setPress(double m_press) 119 | { 120 | this->m_press = m_press; 121 | } 122 | 123 | void ThermodynamicPoint::setRho(double m_rho) 124 | { 125 | this->m_rho = m_rho; 126 | } 127 | 128 | void ThermodynamicPoint::setS(double m_s) 129 | { 130 | this->m_s = m_s; 131 | } 132 | 133 | void ThermodynamicPoint::setTemp(double m_temp) 134 | { 135 | this->m_temp = m_temp; 136 | } 137 | 138 | void ThermodynamicPoint::setU(double m_u) 139 | { 140 | this->m_u = m_u; 141 | } 142 | 143 | void ThermodynamicPoint::setVisc(double m_visc) 144 | { 145 | this->m_visc = m_visc; 146 | } 147 | 148 | void ThermodynamicPoint::setVsonic(double m_vsonic) 149 | { 150 | this->m_vsonic = m_vsonic; 151 | } 152 | 153 | -------------------------------------------------------------------------------- /src/ThermodynamicPoint.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ThermodynamicPoint.h 3 | * 4 | * Created on: May 30, 2013 5 | * Author: bachm03j 6 | */ 7 | 8 | #ifndef THERMODYNAMICPOINT_H_ 9 | #define THERMODYNAMICPOINT_H_ 10 | 11 | #include 12 | 13 | class ThermodynamicPoint { 14 | 15 | public: 16 | ThermodynamicPoint(); 17 | virtual ~ThermodynamicPoint(); 18 | 19 | std::string getName() const; 20 | 21 | double getCp() const; 22 | double getGamma() const; 23 | double getH() const; 24 | double getMw() const; 25 | double getPr() const; 26 | double getPress() const; 27 | double getRho() const; 28 | double getS() const; 29 | double getTemp() const; 30 | double getU() const; 31 | double getVisc() const; 32 | double getVsonic() const; 33 | 34 | void setCp(double m_cp); 35 | void setGamma(double m_gamma); 36 | void setH(double m_h); 37 | void setMw(double m_mw); 38 | void setName(std::string m_name); 39 | void setPr(double m_pr); 40 | void setPress(double m_press); 41 | void setRho(double m_rho); 42 | void setS(double m_s); 43 | void setTemp(double m_temp); 44 | void setU(double m_u); 45 | void setVisc(double m_visc); 46 | void setVsonic(double m_vsonic); 47 | 48 | private: 49 | 50 | std::string m_name; 51 | double m_rho; // kg/m^3 52 | double m_press; // bar 53 | double m_temp; // k 54 | double m_h; // kj/kg 55 | double m_s; // kj/kg-K 56 | double m_u; // kj/kg 57 | double m_mw; // kg/kg-kmol 58 | double m_gamma; // - 59 | double m_cp; // kj/kg-k 60 | double m_vsonic; // m/s 61 | double m_visc; // kg/m-s 62 | double m_pr; 63 | 64 | }; 65 | 66 | #endif /* THERMODYNAMICPOINT_H_ */ 67 | --------------------------------------------------------------------------------