OpenWAM
TCompIsoReg.cpp
1 /* --------------------------------------------------------------------------------*\
2 ==========================|
3  \\ /\ /\ // O pen | OpenWAM: The Open Source 1D Gas-Dynamic Code
4  \\ | X | // W ave |
5  \\ \/_\/ // A ction | CMT-Motores Termicos / Universidad Politecnica Valencia
6  \\/ \// M odel |
7  ----------------------------------------------------------------------------------
8  License
9 
10  This file is part of OpenWAM.
11 
12  OpenWAM is free software: you can redistribute it and/or modify
13  it under the terms of the GNU General Public License as published by
14  the Free Software Foundation, either version 3 of the License, or
15  (at your option) any later version.
16 
17  OpenWAM is distributed in the hope that it will be useful,
18  but WITHOUT ANY WARRANTY; without even the implied warranty of
19  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  GNU General Public License for more details.
21 
22  You should have received a copy of the GNU General Public License
23  along with OpenWAM. If not, see <http://www.gnu.org/licenses/>.
24 
25 
26  \*-------------------------------------------------------------------------------- */
27 
28 // ---------------------------------------------------------------------------
29 #pragma hdrstop
30 
31 #include "TCompIsoReg.h"
32 
33 // ---------------------------------------------------------------------------
34 
35 TCompIsoReg::TCompIsoReg(double Reg, dVector Mass, dVector RC, dVector Eff) {
36  stPolar Convert2Polar;
37 
38  fRegimen = Reg;
39  fCorrectedMass = Mass;
40  fCompRatio = RC;
41  fEfficiency = Eff;
42  CurvaRC = new Hermite_interp(fCorrectedMass, fCompRatio);
43  CurvaEf = new Hermite_interp(fCorrectedMass, fEfficiency);
44 
45  fAngulo.resize(fCorrectedMass.size());
46  fModulo.resize(fCorrectedMass.size());
47  int k = 0;
48 
49  for(int i = fCorrectedMass.size() - 1; i >= 0; i--) {
50  Convert2Polar(fCorrectedMass[i], fCompRatio[i] - 1.);
51  fAngulo[k] = Convert2Polar.Ang;
52  if(k > 0) {
53  if(fAngulo[k] < atan((fCompRatio[i] - fCompRatio[i - 1]) / (fCorrectedMass[i] - fCorrectedMass[i - 1]))) {
54  std::cout << "error interpolacion polar" << std::endl;
55  }
56  }
57  fModulo[k] = Convert2Polar.Mod;
58  k++;
59  }
60  fAngMax = MaxComponent(fAngulo);
61  fAngMin = MaxComponent(fAngulo);
62 
63  CurvaPol = new Hermite_interp(fAngulo, fModulo);
64 
65 }
66 
67 TCompIsoReg::~TCompIsoReg() {
68  delete CurvaRC;
69  delete CurvaEf;
70 
71 }
72 
73 double TCompIsoReg::CompRatio(double Mass) {
74  return CurvaRC->interp(Mass);
75 }
76 
77 double TCompIsoReg::Efficiency(double Mass) {
78  return CurvaEf->interp(Mass);
79 }
80 
81 double TCompIsoReg::CompRatioPol(double Ang) {
82  return CurvaPol->interp(Ang);
83 }
84 
85 double TCompIsoReg::AnguloMaximo() {
86  return fAngMax;
87 }
88 
89 double TCompIsoReg::AnguloMinimo() {
90  return fAngMin;
91 }
92 
93 #pragma package(smart_init)
Hermite_interp
Definition: Math_wam.h:311
dVector
std::vector< double > dVector
Double vector.
Definition: Math_wam.h:70
stPolar
Definition: Math_wam.h:263