OpenWAM
TCCDescargaExtremoAbierto.h
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 #ifndef TCCDescargaExtremoAbiertoH
30 #define TCCDescargaExtremoAbiertoH
31 
32 #include "TCondicionContorno.h"
33 
34 //#include <cmath>
35 #ifdef __BORLANDC__
36 #include <vcl.h>
37 #endif
38 #include <cstdio>
39 #include <iostream>
40 // ---------------------------------------------------------------------------
41 // ---------------------------------------------------------------------------
42 
44  private:
45 
46  int FNodoFin; // Nodo del extremo del tubo que conecta con la condicion de contorno.
47  int FIndiceCC; // Posicion del vector para tomar datos del tubo para la BC (0 Nodo izquierdo; 1 Nodo derecho)
48  double *FComposicion; // Composicion de la atmasfera,el remanso o el deposito matlab(este inicialmente);
49  double FPressure; // Presion de descarga.
50  double FPref; // Presion de referencia.
51  double FTemperaturaDep; // Temperature en la atmasfera o remanso. (degC)
52  double FPerdidaExtremo; // Coeficiente de perdidas en el extremo del tubo.
53  double FVelocidadSonidoDep; // Velocity del sonido en el deposito adimensional.
54  nmTipoDescarga FTipoDescarga;
55 
56  double FGamma3; // Son expresiones con Gamma. Se usan estas variables para no calcularlas tantas veces por instante de tiempo en la misma funcion.
57  bool FModeladoEscape;
58 
59  double *FCC; // Caracteristica conocida del tubo.
60  double *FCD; // Caracteristica desconocida del tubo.
61 
62  // void PutPresion(double valor);
63  // void PutTemperatura(double valor);
64 
65  public:
66 
67  void PutComposicion(int i, double valor) {
68  FFraccionMasicaEspecie[i] = valor;
69  }
70 
71  void PutPresion(double valor) {
72 
73  FPressure = valor;
74 
75  }
76 
77  void PutTemperatura(double valor) {
78  try {
79  double RMezclaDep, CvMezclaDep, CpMezclaDep, GammaDep;
80 
81  FTemperaturaDep = valor;
82  if(FCalculoEspecies == nmCalculoCompleto) {
83 
84  RMezclaDep = CalculoCompletoRMezcla(FComposicion[0], FComposicion[1], FComposicion[2], 0, FCalculoGamma, nmMEP);
85  CpMezclaDep = CalculoCompletoCpMezcla(FComposicion[0], FComposicion[1], FComposicion[2], 0, FTemperaturaDep,
86  FCalculoGamma, nmMEP);
87  GammaDep = CalculoCompletoGamma(RMezclaDep, CpMezclaDep, FCalculoGamma);
88 
89  } else if(FCalculoEspecies == nmCalculoSimple) {
90 
91  RMezclaDep = CalculoSimpleRMezcla(FComposicion[0], 0, FCalculoGamma, nmMEP);
92  CvMezclaDep = CalculoSimpleCvMezcla(FTemperaturaDep, FComposicion[0], 0, FCalculoGamma, nmMEP);
93  GammaDep = CalculoSimpleGamma(RMezclaDep, CvMezclaDep, FCalculoGamma);
94 
95  }
96  FVelocidadSonidoDep = sqrt(FTemperaturaDep * GammaDep * RMezclaDep) / __cons::ARef;
97  } catch(exception & N) {
98  std::cout << "ERROR: TCCDescargaExtremoAbierto::PutTemperatura en la condicion de contorno: " << FNumeroCC << std::endl;
99  std::cout << "Tipo de error: " << N.what() << std::endl;
100  throw Exception(N.what());
101  }
102  }
103 
104  TCCDescargaExtremoAbierto(nmTypeBC TipoCC, int numCC, nmTipoCalculoEspecies SpeciesModel, int numeroespecies,
105  nmCalculoGamma GammaCalculation, bool ThereIsEGR);
106 
108 
109  void CalculaCondicionContorno(double Time);
110 
111  void ReadBoundaryData(const char *FileWAM, fpos_t &filepos, int NumberOfPipes, TTubo **Pipe, int nDPF, TDPF **DPF);
112 
113  void AsignAmbientConditions(double Tamb, double Pamb, double *AtmosphericComposition);
114 
115  void TuboCalculandose(int TuboActual) {
116  }
117  ;
118 
119 };
120 
121 #endif
TTubo
a Finite differences pipe.
Definition: TTubo.h:116
TCCDescargaExtremoAbierto
Definition: TCCDescargaExtremoAbierto.h:43
TDPF
Definition: TDPF.h:45
TCondicionContorno
Definition: TCondicionContorno.h:54
Exception
Custom exception class.
Definition: Exception.hpp:39