OpenWAM
Public Member Functions | Public Attributes | List of all members
TTubo Class Reference

a Finite differences pipe. More...

#include <TTubo.h>

Public Member Functions

int getNumeroTubo () const
 Gets the pipe id. More...
 
int getNodoIzq () const
 Gets the left-hand side node. More...
 
int getNodoDer () const
 Gets the right-hand side node. More...
 
int getNin ()
 
int getNumeroConductos ()
 
double getXRef ()
 
double getLongitudTotal () const
 Gets the total length of the pipe. More...
 
nmTipoTransCal getTipoTransCal ()
 
double getCoefAjustTC ()
 
double getCoefAjustFric ()
 
double getFriccion ()
 
double getEmisividad ()
 
bool getConcentrico ()
 
double getDuracionCiclo ()
 
double getNumCiclosSinInerciaTermica ()
 
nmTipoCalcTempParedTubos getTipoCalcTempPared ()
 
double getAnguloTotalCiclo ()
 
double getTExt ()
 
double getEspesorIntPrin ()
 
double getConductPrin ()
 
double getEspesorPrin ()
 
double getDensidadPrin ()
 
double getCalEspPrin ()
 
bool getHayDPFNodoDer ()
 
bool getHayDPFNodoIzq ()
 
int getNumCapas ()
 
TDPFgetDPFEntrada ()
 
TDPFgetDPFSalida ()
 
int getNodoDPFEntrada ()
 
int getNodoDPFSalida ()
 
double getTime0 () const
 Gets the current time. More...
 
void PutTime0 (double valor)
 Sets the current time. More...
 
double getTime1 () const
 Gets the time at the following time-step. More...
 
void PutTime1 (double valor)
 Sets the time after the following time-step. More...
 
double getDeltaTime () const
 Gets the time step. More...
 
void PutDeltaTime (double valor)
 Sets the time step. More...
 
double getMallado () const
 Gets the mesh size. More...
 
double GetDensidad (int i) const
 Gets the density. More...
 
double GetArea (int i) const
 Gets the cross section at a given cell. More...
 
double GetDiametro (int i) const
 Gets the cell diameter. More...
 
double GetVelocidad (int i) const
 Gets the fluid speed. More...
 
double GetAsonido (int i) const
 Gets the speed of sound. More...
 
double GetPresion (int i) const
 Gets the fluid pressure. More...
 
double GetTPTubo (int j, int i) const
 Gets the wall temperature at a given cell and node. More...
 
void PutTPTubo (int k, int i, double valor)
 Sets the wall temperature at a given cell and node. More...
 
double GetTPTuboAnt (int j, int) const
 Gets the previous wall temperature at a given cell and node. More...
 
double GetVelPro (int i) const
 Gets the integrated gas velocity. More...
 
void PutVelPro (int i, double valor)
 Sets the integrated gas velocity. More...
 
double GetCoefTurbulencia (int i) const
 Gets the turbulence coefficient. More...
 
double getTemperaturaInicial () const
 Gets the initial temperature. More...
 
double getTempWallIni () const
 Gets the initial temperature of the wall. More...
 
double getPresionInicial () const
 Gets the initial pressure. More...
 
double getVelocidadMedia () const
 Gets the mean speed. More...
 
double GetFraccionMasicaInicial (int i) const
 Gets the initial mass fraction of species i. More...
 
double GetFraccionMasicaCC (int j, int i)
 
double GetVelocidadCC (int i)
 
double GetDensidadCC (int i)
 
double GetAreaCC (int i)
 
double GetGamma (int i) const
 Gets the specific heat capacities ratio at a given cell. More...
 
double GetRMezcla (int i) const
 Gets the gas constant of the mixture at a given cell. More...
 
double GetCpMezcla (int i) const
 Gets the specific heat capacity at constant pressure at a given cell. More...
 
double GetCvMezcla (int i) const
 Gets the specific heat capacity at constant volume at a given cell. More...
 
nmFormulacionLeyes getFormulacionLeyes ()
 
double GetU0 (int i, int j)
 
double Gethi (int i)
 
double Gethe (int i)
 
stCapa GetCapa (int i)
 
int GetTipoCanal (int i)
 
void PutConcentric (double valor)
 
 TTubo (int SpeciesNumber, int j, double SimulationDuration, TBloqueMotor **Engine, nmTipoCalculoEspecies SpeciesModel, nmCalculoGamma GammaCalculation, bool ThereIsEGR)
 
 ~TTubo ()
 
void LeeDatosGeneralesTubo (const char *FileWAM, fpos_t &filepos)
 
void LeeDatosGeometricosTubo (const char *FileWAM, fpos_t &filepos, double ene, int tipomallado, TBloqueMotor **Engine)
 
void IniciaVariablesFundamentalesTubo ()
 
void IniciaVariablesTransmisionCalor (TCondicionContorno **BC, TBloqueMotor **Engine, double AmbientTemperature)
 
void EstabilidadMetodoCalculo ()
 
void CalculaVariablesFundamentales ()
 
void ActualizaValoresNuevos (TCondicionContorno **BC)
 
void ReduccionFlujoSubsonico ()
 
void ReduccionFlujoSubsonicoFCT ()
 
void ReadAverageResultsTubo (const char *FileWAM, fpos_t &filepos, bool HayMotor)
 
void HeaderAverageResults (std::stringstream &medoutput, stEspecies *DatosEspecies) const
 
void ImprimeResultadosMedios (std::stringstream &medoutput) const
 
void ReadInstantaneousResultsTubo (const char *FileWAM, fpos_t &filepos, bool HayMotor)
 
void HeaderInstantaneousResults (std::stringstream &insoutput, stEspecies *DatosEspecies) const
 
void ImprimeResultadosInstantaneos (std::stringstream &insoutput) const
 
void CalculaResultadosMedios (double Theta)
 
void CalculaResultadosInstantaneos ()
 
void SalidaGeneralTubos (stEspecies *DatosEspecies) const
 
void CalculaTemperaturaPared (TBloqueMotor **Engine, double Theta, double CrankAngle, TCondicionContorno **BC)
 
void CalculaTemperaturaParedSinMotor (TCondicionContorno **BC)
 
void AjustaPaso (double Intervalo)
 
void CalculaCaracteristicasExtremos (TCondicionContorno **BC, double DeltaTiempo)
 
double Interpola_Entropia (nmPipeEnd TipoExtremoTubo, double DeltaTiempo)
 
double Interpola_Caracteristica (double entropia, int signo, int extremo, double DeltaTiempo)
 
void ComunicacionTubo_CC (TCondicionContorno **BC)
 
void ComunicacionDPF (TCondicionContorno **CC, TDeposito **Deposito)
 
void InicializaCaracteristicas (TCondicionContorno **BC)
 
void CalculaCoeficientePeliculaExterior (TBloqueMotor **Engine, double AmbientPressure, double AmbientTemperature)
 
void CalculaResistenciasdePared (TCondicionContorno **BC)
 
void CalculaCoeficientePeliculaInterior (TCondicionContorno **BC)
 
void ActualizaPropiedadesGas ()
 
double GetFraccionMasica (int j, int i)
 

Public Attributes

double FTime0
 Time at current time step.
 
double FTime1
 Time at following time step.
 
double FDeltaTime
 Time step.
 

Detailed Description

a Finite differences pipe.

This class contains the methods, variables and attributes related with finite differences pipes.

Definition at line 116 of file TTubo.h.

Constructor & Destructor Documentation

◆ TTubo()

TTubo::TTubo ( int  SpeciesNumber,
int  j,
double  SimulationDuration,
TBloqueMotor **  Engine,
nmTipoCalculoEspecies  SpeciesModel,
nmCalculoGamma  GammaCalculation,
bool  ThereIsEGR 
)

Contructor of the pipe class

Parameters
SpeciesNumberNumber of different species considered in the simulation.
jIndex of the pipe
SimulationDurationDuration of the simulation. If there is not engine.
EnginePointer to the engine object
SpeciesModelType of species calculation
GammaCalculationType of specific heat calculation
ThereIsEGREGR specie is considered?

Definition at line 62 of file TTubo.cpp.

63  {
64 
65  if(Engine != NULL) {
66  FAnguloTotalCiclo = Engine[0]->getAngTotalCiclo();
67  } else if(Engine == NULL) {
68  FAnguloTotalCiclo = 720.;
69  FRegimenFicticio = 720. / 6. / SimulationDuration;
70  }
71 
72 #ifdef ParticulateFilter
73  FDPFEntradaTubo = NULL;
74  FDPFSalidaTubo = NULL;
75  FHayDPFNodoIzq = false;
76  FHayDPFNodoDer = false;
77 #endif
78 
79  FHayEGR = ThereIsEGR;
80  if(FHayEGR)
81  FIntEGR = 0;
82  else
83  FIntEGR = 1;
84 
85  FSUMTime = 0.;
86  FCicloTubo = 0;
87  FNumeroTubo = j + 1;
88 
89  FNumeroEspecies = SpeciesNumber;
90  FCalculoEspecies = SpeciesModel;
91  FCalculoGamma = GammaCalculation;
92  FNumEcuaciones = 3 + (FNumeroEspecies - 1 - FIntEGR);
93 
94  FComposicionInicial = NULL;
95  FFraccionMasicaEspecie = NULL;
96  FFraccionMasicaCC = NULL;
97  FVelocidadCC = NULL;
98  FDensidadCC = NULL;
99  FAreaCC = NULL;
100  FGamma = NULL;
101  FRMezcla = NULL;
102  FGamma1 = NULL;
103  FGamma3 = NULL;
104  FGamma4 = NULL;
105  FGamma5 = NULL;
106  FGamma6 = NULL;
107 
108  FDExtTramo = NULL;
109  FLTramo = NULL;
110  FDiametroTubo = NULL;
111  FDiametroD12 = NULL;
112  FDiametroS12 = NULL;
113  FDerLin = NULL;
114  FDerLin12 = NULL;
115  FDerLinArea = NULL;
116  FDerLinArea12 = NULL;
117  FArea = NULL;
118  FArea12 = NULL;
119  FPresion0 = NULL;
120  FAsonido0 = NULL;
121  FVelocidad0 = NULL;
122  FVelocidadMedia = NULL;
123  FAsonidoMedia = NULL;
124  FPresionMedia = NULL;
125  FPresion1 = NULL;
126  FAsonido1 = NULL;
127  FVelocidad1 = NULL;
128  FUt = NULL;
129  FU0 = NULL;
130  FU0Sum = NULL;
131  FU0Medio = NULL;
132  FU1 = NULL;
133  FU12 = NULL;
134  FW = NULL;
135  FV1 = NULL;
136  FV2 = NULL;
137  FUfct0 = NULL;
138  FUfct1 = NULL;
139  FUfctd = NULL;
140  FUfctad = NULL;
141  Ffl = NULL;
142  FdU = NULL;
143  FDeltaFCTd = NULL;
144  FflU = NULL;
145  FaU = NULL;
146  FVelPro = NULL;
147  FCoefTurbulencia = NULL;
148  FSUMTPTuboPro = NULL;
149  FTPTubo = NULL;
150  FTParedAnt = NULL;
151  ResultadosMedios = NULL;
152  ResultInstantaneos = NULL;
153  FNumResMedios = 0;
154  FNumResInstant = 0;
155  FNumDistSensores = 0;
156  FIntercooler = false;
157  FConcentrico = false;
158  FMod.Modelo = nmLaxWendroff;
159  FMod.SubModelo = nmNinguno;
160  FMod.OpcionSubModelo = nmNinguna;
161  FMod.FormulacionLeyes = nmSinArea;
162  /* FTVD=NULL;
163  FTVDdU=NULL;
164  FTVDpp=NULL;
165  FTVDpn=NULL;
166  FTVDrp=NULL;
167  FTVDrn=NULL;
168  FTVDphp=NULL;
169  FTVDphn=NULL;
170  FTVDGp=NULL;
171  FTVDGn=NULL; */
172  FCourantLocal = NULL;
173  Fhi = NULL;
174  Fhe = NULL;
175  Frho = NULL;
176  FRe = NULL;
177  FTVD.Bmas = NULL;
178  FTVD.Bvector = NULL;
179  FTVD.Bmen = NULL;
180  FTVD.Qmatrix = NULL;
181  FTVD.Pmatrix = NULL;
182  FTVD.gflux = NULL;
183  FTVD.Alpha = NULL;
184  FTVD.Beta = NULL;
185  FTVD.DeltaU = NULL;
186  FTVD.DeltaB = NULL;
187  FTVD.DeltaW = NULL;
188  FTVD.hLandaD = NULL;
189  FTVD.LandaD = NULL;
190  FTVD.Phi = NULL;
191  FTVD.R = NULL;
192  FTVD.W = NULL;
193 
194  FCapa = NULL;
195 
196  FResistRadInt = NULL;
197  FResistRadExt = NULL;
198  FResistAxiAnt = NULL;
199  FResistAxiPos = NULL;
200  FCapInt = NULL;
201  FCapMed = NULL;
202  FCapExt = NULL;
203 
204  FVelocidadDim = NULL;
205  FAsonidoDim = NULL;
206  FTemperature = NULL;
207  FFlowMass = NULL;
208 
209 }

◆ ~TTubo()

TTubo::~TTubo ( )

Destructor of the pipe class

Definition at line 214 of file TTubo.cpp.

214  {
215 
216  DestruyeVector(FVelocidadDim);
217  DestruyeVector(FAsonidoDim);
218  DestruyeVector(FTemperature);
219  DestruyeVector(FFlowMass);
220 
221  DestruyeVector(FComposicionInicial);
222 
223  // if(FComposicionInicial) delete[] FComposicionInicial;
224  if(FFraccionMasicaEspecie != NULL) {
225  for(int i = 0; i < FNin; i++)
226  delete[] FFraccionMasicaEspecie[i];
227  delete[] FFraccionMasicaEspecie;
228  }
229  if(FFraccionMasicaCC != NULL) {
230  for(int i = 0; i < 2; i++)
231  delete[] FFraccionMasicaCC[i];
232  delete[] FFraccionMasicaCC;
233  }
234  if(FVelocidadCC != NULL)
235  delete[] FVelocidadCC;
236  if(FDensidadCC != NULL)
237  delete[] FDensidadCC;
238  if(FAreaCC != NULL)
239  delete[] FAreaCC;
240  if(FGamma != NULL)
241  delete[] FGamma;
242  if(FRMezcla != NULL)
243  delete[] FRMezcla;
244  if(FGamma1 != NULL)
245  delete[] FGamma1;
246  if(FGamma3 != NULL)
247  delete[] FGamma3;
248  if(FGamma4 != NULL)
249  delete[] FGamma4;
250  if(FGamma5 != NULL)
251  delete[] FGamma5;
252  if(FGamma6 != NULL)
253  delete[] FGamma6;
254 
255  if(FDExtTramo != NULL)
256  delete[] FDExtTramo;
257  if(FLTramo != NULL)
258  delete[] FLTramo;
259  if(FDiametroTubo != NULL)
260  delete[] FDiametroTubo;
261  if(FDiametroD12 != NULL)
262  delete[] FDiametroD12;
263  if(FDiametroS12 != NULL)
264  delete[] FDiametroS12;
265  if(FDerLin != NULL)
266  delete[] FDerLin;
267  if(FDerLin12 != NULL)
268  delete[] FDerLin12;
269  if(FDerLinArea != NULL)
270  delete[] FDerLinArea;
271  if(FDerLinArea12 != NULL)
272  delete[] FDerLinArea12;
273  if(FArea != NULL)
274  delete[] FArea;
275  if(FArea12 != NULL)
276  delete[] FArea12;
277  if(FPresion0 != NULL)
278  delete[] FPresion0;
279  if(FAsonido0 != NULL)
280  delete[] FAsonido0;
281  if(FVelocidad0 != NULL)
282  delete[] FVelocidad0;
283  if(FVelocidadMedia != NULL)
284  delete[] FVelocidadMedia;
285  if(FAsonidoMedia != NULL)
286  delete[] FAsonidoMedia;
287  if(FPresionMedia != NULL)
288  delete[] FPresionMedia;
289  if(FPresion1 != NULL)
290  delete[] FPresion1;
291  if(FAsonido1 != NULL)
292  delete[] FAsonido1;
293  if(FVelocidad1 != NULL)
294  delete[] FVelocidad1;
295  if(Fhi != NULL)
296  delete[] Fhi;
297  if(Fhe != NULL)
298  delete[] Fhe;
299  if(Frho != NULL)
300  delete[] Frho;
301  if(FRe != NULL)
302  delete[] FRe;
303 
304  if(FUt != NULL) {
305  for(int i = 0; i < 3; i++)
306  delete[] FUt[i];
307  delete[] FUt;
308  }
309  if(FU0 != NULL) {
310  for(int i = 0; i < FNumEcuaciones; i++)
311  delete[] FU0[i];
312  delete[] FU0;
313  }
314  if(FU0Sum != NULL) {
315  for(int i = 0; i < FNumEcuaciones; i++)
316  delete[] FU0Sum[i];
317  delete[] FU0Sum;
318  }
319  if(FU0Medio != NULL) {
320  for(int i = 0; i < FNumEcuaciones; i++)
321  delete[] FU0Medio[i];
322  delete[] FU0Medio;
323  }
324  if(FU1 != NULL) {
325  for(int i = 0; i < FNumEcuaciones; i++)
326  delete[] FU1[i];
327  delete[] FU1;
328  }
329  if(FU12 != NULL) {
330  for(int i = 0; i < FNumEcuaciones; i++)
331  delete[] FU12[i];
332  delete[] FU12;
333  }
334  if(FW != NULL) {
335  for(int i = 0; i < FNumEcuaciones; i++)
336  delete[] FW[i];
337  delete[] FW;
338  }
339  if(FV1 != NULL) {
340  for(int i = 0; i < FNumEcuaciones; i++)
341  delete[] FV1[i];
342  delete[] FV1;
343  }
344  if(FV2 != NULL) {
345  for(int i = 0; i < FNumEcuaciones; i++)
346  delete[] FV2[i];
347  delete[] FV2;
348  }
349  if(FUfct0 != NULL) {
350  for(int i = 0; i < FNumEcuaciones; i++)
351  delete[] FUfct0[i];
352  delete[] FUfct0;
353  }
354  if(FUfct1 != NULL) {
355  for(int i = 0; i < FNumEcuaciones; i++)
356  delete[] FUfct1[i];
357  delete[] FUfct1;
358  }
359  if(FUfctd != NULL) {
360  for(int i = 0; i < FNumEcuaciones; i++)
361  delete[] FUfctd[i];
362  delete[] FUfctd;
363  }
364  if(FUfctad != NULL) {
365  for(int i = 0; i < FNumEcuaciones; i++)
366  delete[] FUfctad[i];
367  delete[] FUfctad;
368  }
369  if(Ffl != NULL) {
370  for(int i = 0; i < FNumEcuaciones; i++)
371  delete[] Ffl[i];
372  delete[] Ffl;
373  }
374  if(FdU != NULL) {
375  for(int i = 0; i < FNumEcuaciones; i++)
376  delete[] FdU[i];
377  delete[] FdU;
378  }
379  if(FDeltaFCTd != NULL) {
380  for(int i = 0; i < FNumEcuaciones; i++)
381  delete[] FDeltaFCTd[i];
382  delete[] FDeltaFCTd;
383  }
384  if(FflU != NULL) {
385  for(int i = 0; i < FNumEcuaciones; i++)
386  delete[] FflU[i];
387  delete[] FflU;
388  }
389  if(FaU != NULL) {
390  for(int i = 0; i < FNumEcuaciones; i++)
391  delete[] FaU[i];
392  delete[] FaU;
393  }
394  if(FVelPro != NULL)
395  delete[] FVelPro;
396  if(FCoefTurbulencia != NULL)
397  delete[] FCoefTurbulencia;
398  if(FSUMTPTuboPro != NULL) {
399  for(int i = 0; i < 2; i++) {
400  for(int j = 0; j < 3; j++) {
401  delete[] FSUMTPTuboPro[i][j];
402  }
403  delete[] FSUMTPTuboPro[i];
404  }
405  delete[] FSUMTPTuboPro;
406  }
407  if(FTPTubo != NULL) {
408  for(int i = 0; i < 3; i++)
409  delete[] FTPTubo[i];
410  delete[] FTPTubo;
411  }
412  if(FTParedAnt != NULL) {
413  for(int i = 0; i < 3; i++)
414  delete[] FTParedAnt[i];
415  delete[] FTParedAnt;
416  }
417 
418  for(int i = 0; i < FNumResMedios; i++) {
419  if(ResultadosMedios[i].FraccionSUM != NULL)
420  delete[] ResultadosMedios[i].FraccionSUM;
421  if(ResultadosMedios[i].FraccionMED != NULL)
422  delete[] ResultadosMedios[i].FraccionMED;
423  }
424  if(ResultadosMedios != NULL)
425  delete[] ResultadosMedios;
426  for(int i = 0; i < FNumResInstant; i++) {
427  if(ResultInstantaneos[i].FraccionINS != NULL)
428  delete[] ResultInstantaneos[i].FraccionINS;
429  }
430  if(ResultInstantaneos != NULL)
431  delete[] ResultInstantaneos;
432 
433  if(FCourantLocal != NULL)
434  delete[] FCourantLocal;
435 
436  for(int i = 0; i < FNumEcuaciones; i++) {
437  for(int k = 0; k < FNumEcuaciones; k++) {
438  if(FTVD.Pmatrix != NULL)
439  delete[] FTVD.Pmatrix[i][k];
440  if(FTVD.Qmatrix != NULL)
441  delete[] FTVD.Qmatrix[i][k];
442  }
443  if(FTVD.Pmatrix != NULL)
444  delete[] FTVD.Pmatrix[i];
445  if(FTVD.Qmatrix != NULL)
446  delete[] FTVD.Qmatrix[i];
447  }
448  for(int i = 0; i < FNumEcuaciones; i++) {
449  if(FTVD.Bmas != NULL)
450  delete[] FTVD.Bmas[i];
451  if(FTVD.Bmen != NULL)
452  delete[] FTVD.Bmen[i];
453  if(FTVD.Bvector != NULL)
454  delete[] FTVD.Bvector[i];
455  if(FTVD.gflux != NULL)
456  delete[] FTVD.gflux[i];
457  if(FTVD.Alpha != NULL)
458  delete[] FTVD.Alpha[i];
459  if(FTVD.Beta != NULL)
460  delete[] FTVD.Beta[i];
461  if(FTVD.DeltaU != NULL)
462  delete[] FTVD.DeltaU[i];
463  if(FTVD.DeltaB != NULL)
464  delete[] FTVD.DeltaB[i];
465  if(FTVD.DeltaW != NULL)
466  delete[] FTVD.DeltaW[i];
467  if(FTVD.hLandaD != NULL)
468  delete[] FTVD.hLandaD[i];
469  if(FTVD.LandaD != NULL)
470  delete[] FTVD.LandaD[i];
471  if(FTVD.Phi != NULL)
472  delete[] FTVD.Phi[i];
473  if(FTVD.W != NULL)
474  delete[] FTVD.W[i];
475  if(FTVD.R != NULL)
476  delete[] FTVD.R[i];
477  }
478 
479  if(FTVD.Pmatrix != NULL)
480  delete[] FTVD.Pmatrix;
481  if(FTVD.Qmatrix != NULL)
482  delete[] FTVD.Qmatrix;
483  if(FTVD.Bmas != NULL)
484  delete[] FTVD.Bmas;
485  if(FTVD.Bmen != NULL)
486  delete[] FTVD.Bmen;
487  if(FTVD.Bvector != NULL)
488  delete[] FTVD.Bvector;
489  if(FTVD.gflux != NULL)
490  delete[] FTVD.gflux;
491  if(FTVD.Alpha != NULL)
492  delete[] FTVD.Alpha;
493  if(FTVD.Beta != NULL)
494  delete[] FTVD.Beta;
495  if(FTVD.DeltaU != NULL)
496  delete[] FTVD.DeltaU;
497  if(FTVD.DeltaB != NULL)
498  delete[] FTVD.DeltaB;
499  if(FTVD.DeltaW != NULL)
500  delete[] FTVD.DeltaW;
501  if(FTVD.hLandaD != NULL)
502  delete[] FTVD.hLandaD;
503  if(FTVD.LandaD != NULL)
504  delete[] FTVD.LandaD;
505  if(FTVD.Phi != NULL)
506  delete[] FTVD.Phi;
507  if(FTVD.W != NULL)
508  delete[] FTVD.W;
509  if(FTVD.R != NULL)
510  delete[] FTVD.R;
511 
512  if(FCapa != NULL)
513  delete[] FCapa;
514 
515  if(FResistRadInt != NULL)
516  delete[] FResistRadInt;
517  if(FResistRadExt != NULL)
518  delete[] FResistRadExt;
519  if(FResistAxiAnt != NULL)
520  delete[] FResistAxiAnt;
521  if(FResistAxiPos != NULL)
522  delete[] FResistAxiPos;
523  if(FCapInt != NULL)
524  delete[] FCapInt;
525  if(FCapMed != NULL)
526  delete[] FCapMed;
527  if(FCapExt != NULL)
528  delete[] FCapExt;
529 
530 }

Member Function Documentation

◆ ActualizaPropiedadesGas()

void TTubo::ActualizaPropiedadesGas ( )

Comment

Definition at line 1170 of file TTubo.cpp.

1170  {
1171 #ifdef usetry
1172  try {
1173 #endif
1174  for(int i = 0; i < FNin; i++) {
1175  FTemperature[i] = pow2(FAsonidoDim[i]) / (FGamma[i] * FRMezcla[i]);
1176 
1177  // Calculo de Gamma y R a partir de la composicion en cada nodo.
1178  if(FCalculoEspecies == nmCalculoSimple) {
1179 
1180  FRMezcla[i] = CalculoSimpleRMezcla(FFraccionMasicaEspecie[i][0], 0, FCalculoGamma, nmMEP);
1181  double CvMezcla = CalculoSimpleCvMezcla(FTemperature[i], FFraccionMasicaEspecie[i][0], 0, FCalculoGamma, nmMEP);
1182  FGammaN = CalculoSimpleGamma(FRMezcla[i], CvMezcla, FCalculoGamma);
1183  if(abs(FGammaN - FGamma[i]) > 0.025) {
1184  FGamma[i];
1185  } else {
1186  FGamma[i] = 0.9995 * FGamma[i] + 0.0005 * FGammaN;
1187  }
1188  } else {
1189 
1190  FRMezcla[i] = CalculoCompletoRMezcla(FFraccionMasicaEspecie[i][0], FFraccionMasicaEspecie[i][1],
1191  FFraccionMasicaEspecie[i][2], 0, FCalculoGamma, nmMEP);
1192  double CpMezcla = CalculoCompletoCpMezcla(FFraccionMasicaEspecie[i][0], FFraccionMasicaEspecie[i][1],
1193  FFraccionMasicaEspecie[i][2], 0, FTemperature[i], FCalculoGamma, nmMEP);
1194  FGammaN = CalculoCompletoGamma(FRMezcla[i], CpMezcla, FCalculoGamma);
1195  if(abs(FGammaN - FGamma[i]) > 0.025) {
1196  FGamma[i];
1197  } else {
1198  FGamma[i] = 0.9995 * FGamma[i] + 0.0005 * FGammaN;
1199  }
1200 
1201  }
1202 
1203  FGamma1[i] = __Gamma::G1(FGamma[i]);
1204  FGamma3[i] = __Gamma::G3(FGamma[i]);
1205  FGamma4[i] = __Gamma::G4(FGamma[i]);
1206  FGamma5[i] = __Gamma::G5(FGamma[i]);
1207  FGamma6[i] = __Gamma::G6(FGamma[i]);
1208 
1209  Frho[i] = __units::BarToPa(FPresion0[i]) / FRMezcla[i] / FTemperature[i];
1210  }
1211 #ifdef usetry
1212  } catch(exception & N) {
1213  std::cout << "ERROR: TTubo::CalculoPropiedadesGas en el tubo: " << FNumeroTubo << std::endl;
1214  std::cout << "Tipo de error: " << N.what() << std::endl;
1215  throw Exception(N.what());
1216  }
1217 #endif
1218 }

References pow2().

Here is the call graph for this function:

◆ ActualizaValoresNuevos()

void TTubo::ActualizaValoresNuevos ( TCondicionContorno **  BC)

Comment

Parameters
BCComment

Definition at line 2256 of file TTubo.cpp.

2256  {
2257 #ifdef usetry
2258  try {
2259 #endif
2260 
2261  double a = 0., v = 0., p = 0.;
2262  double LandaIzq = 0., BetaIzq = 0., EntropiaIzq = 0.;
2263  double LandaDer = 0., BetaDer = 0., EntropiaDer = 0.;
2264  double *YIzq, *YDer;
2265 
2266  YIzq = new double[FNumeroEspecies - FIntEGR];
2267  YDer = new double[FNumeroEspecies - FIntEGR];
2268 
2269  LandaIzq = BC[FNodoIzq - 1]->GetTuboExtremo(FTuboCCNodoIzq).Landa;
2270  BetaIzq = BC[FNodoIzq - 1]->GetTuboExtremo(FTuboCCNodoIzq).Beta;
2271  EntropiaIzq = BC[FNodoIzq - 1]->GetTuboExtremo(FTuboCCNodoIzq).Entropia;
2272 
2273  TransformaContorno(LandaIzq, BetaIzq, EntropiaIzq, a, v, p, 1, FGamma1[0], FGamma3[0], FGamma4[0], FGamma5[0]);
2274  if(BC[FNodoIzq - 1]->getTipoCC() == nmBranch) {
2275  if(v < 0.) {
2276  for(int i = 0; i < FNumeroEspecies - FIntEGR; i++) {
2277  YIzq[i] = FFraccionMasicaCC[0][i];
2278  }
2279  } else {
2280  for(int i = 0; i < FNumeroEspecies - FIntEGR; i++) {
2281  YIzq[i] = BC[FNodoIzq - 1]->GetFraccionMasicaEspecie(i);
2282  }
2283  }
2284  } else {
2285  for(int i = 0; i < FNumeroEspecies - FIntEGR; i++) {
2286  YIzq[i] = BC[FNodoIzq - 1]->GetFraccionMasicaEspecie(i);
2287  }
2288  }
2289 
2290  if(FMod.FormulacionLeyes == nmSinArea)
2291  Transforma1(v, a, p, FU1, FGamma[0], FGamma1[0], YIzq, 0);
2292  else if(FMod.FormulacionLeyes == nmConArea)
2293  Transforma1Area(v, a, p, FU1, FArea[0], FGamma[0], FGamma1[0], YIzq, 0);
2294 
2295  LandaDer = BC[FNodoDer - 1]->GetTuboExtremo(FTuboCCNodoDer).Landa;
2296  BetaDer = BC[FNodoDer - 1]->GetTuboExtremo(FTuboCCNodoDer).Beta;
2297  EntropiaDer = BC[FNodoDer - 1]->GetTuboExtremo(FTuboCCNodoDer).Entropia;
2298 
2299  TransformaContorno(LandaDer, BetaDer, EntropiaDer, a, v, p, 1, FGamma1[FNin - 1], FGamma3[FNin - 1], FGamma4[FNin - 1],
2300  FGamma5[FNin - 1]);
2301  if(BC[FNodoDer - 1]->getTipoCC() == nmBranch) {
2302  if(v > 0.) {
2303  for(int i = 0; i < FNumeroEspecies - FIntEGR; i++) {
2304  YDer[i] = FFraccionMasicaCC[1][i];
2305  }
2306  } else {
2307  for(int i = 0; i < FNumeroEspecies - FIntEGR; i++) {
2308  YDer[i] = BC[FNodoDer - 1]->GetFraccionMasicaEspecie(i);
2309  }
2310  }
2311  } else {
2312  for(int i = 0; i < FNumeroEspecies - FIntEGR; i++) {
2313  YDer[i] = BC[FNodoDer - 1]->GetFraccionMasicaEspecie(i);
2314  }
2315  }
2316 
2317  if(FMod.FormulacionLeyes == nmSinArea)
2318  Transforma1(v, a, p, FU1, FGamma[FNin - 1], FGamma1[FNin - 1], YDer, FNin - 1);
2319  else if(FMod.FormulacionLeyes == nmConArea)
2320  Transforma1Area(v, a, p, FU1, FArea[FNin - 1], FGamma[FNin - 1], FGamma1[FNin - 1], YDer, FNin - 1);
2321 
2322  if(FMod.FormulacionLeyes == nmSinArea) {
2323  for(int i = 0; i < FNin; i++) {
2324  Transforma2(FVelocidad0[i], FAsonido0[i], FPresion0[i], FU1, FGamma[i], FGamma1[i], FFraccionMasicaEspecie[i], i);
2325  for(int k = 0; k < FNumEcuaciones; k++) {
2326  FU0[k][i] = FU1[k][i];
2327  }
2328  FVelocidadDim[i] = FVelocidad0[i] * __cons::ARef;
2329  FAsonidoDim[i] = FAsonido0[i] * __cons::ARef;
2330  FFlowMass[i] = FU0[1][i] * FArea[i];
2331  }
2332  } else if(FMod.FormulacionLeyes == nmConArea) {
2333  for(int i = 0; i < FNin; i++) {
2334  Transforma2Area(FVelocidad0[i], FAsonido0[i], FPresion0[i], FU1, FArea[i], FGamma[i], FGamma1[i],
2335  FFraccionMasicaEspecie[i], i);
2336  for(int k = 0; k < FNumEcuaciones; k++) {
2337  FU0[k][i] = FU1[k][i];
2338  }
2339  FVelocidadDim[i] = FVelocidad0[i] * __cons::ARef;
2340  FAsonidoDim[i] = FAsonido0[i] * __cons::ARef;
2341  FFlowMass[i] = FU0[1][i];
2342  if(FVelocidadDim[i] > FAsonidoDim[i] + 1.0e-10) {
2343  printf("Supersonic flow in pipe: %d node: %d, Mach = %lf\n", FNumeroTubo, i, FVelocidadDim[i] / FAsonidoDim[i]);
2344  }
2345 
2346  }
2347  }
2348 
2349  delete[] YIzq;
2350  delete[] YDer;
2351 #ifdef usetry
2352  }
2353 
2354  catch(exception & N) {
2355  std::cout << "ERROR: TTubo::ValoresDeContorno tubo: " << FNumeroTubo << std::endl;
2356  std::cout << "Tipo de error: " << N.what() << std::endl;
2357  throw Exception(N.what());
2358  }
2359 #endif
2360 }

◆ AjustaPaso()

void TTubo::AjustaPaso ( double  Intervalo)

Comment

Parameters
IntervaloComment

Definition at line 4393 of file TTubo.cpp.

4393  {
4394 #ifdef usetry
4395  try {
4396 #endif
4397  FTime1 = TimeEndStep;
4398  FDeltaTime = FTime1 - FTime0;
4399 #ifdef usetry
4400  } catch(exception & N) {
4401  std::cout << "ERROR: TTubo::AjustaPaso en el tubo: " << FNumeroTubo << std::endl;
4402  std::cout << "Tipo de error: " << N.what() << std::endl;
4403  throw Exception(N.what());
4404  }
4405 #endif
4406 }

References FDeltaTime, FTime0, and FTime1.

◆ CalculaCaracteristicasExtremos()

void TTubo::CalculaCaracteristicasExtremos ( TCondicionContorno **  BC,
double  DeltaTiempo 
)

Comment

Parameters
BCComment
DeltaTiempoComment

Definition at line 4411 of file TTubo.cpp.

4411  {
4412 #ifdef usetry
4413  try {
4414 #endif
4415 
4416  if(FVelocidad0[0] <= 0) {
4417  BC[FNodoIzq - 1]->PutEntropia(FTuboCCNodoIzq,
4418  Interpola_Entropia(BC[FNodoIzq - 1]->GetTuboExtremo(FTuboCCNodoIzq).TipoExtremo, DeltaTiempo));
4419  }
4420  BC[FNodoIzq - 1]->PutBeta(FTuboCCNodoIzq,
4421  Interpola_Caracteristica(BC[FNodoIzq - 1]->GetTuboExtremo(FTuboCCNodoIzq).Entropia, 1, 0, DeltaTiempo));
4422 
4423  if(FVelocidad0[FNin - 1] >= 0) {
4424  BC[FNodoDer - 1]->PutEntropia(FTuboCCNodoDer,
4425  Interpola_Entropia(BC[FNodoDer - 1]->GetTuboExtremo(FTuboCCNodoDer).TipoExtremo, DeltaTiempo));
4426  }
4427  BC[FNodoDer - 1]->PutLanda(FTuboCCNodoDer,
4428  Interpola_Caracteristica(BC[FNodoDer - 1]->GetTuboExtremo(FTuboCCNodoDer).Entropia, -1, getNin() - 1, DeltaTiempo));
4429 #ifdef usetry
4430  } catch(exception & N) {
4431  std::cout << "ERROR: TTubo::CalculaCaracteristicasExtremos en el tubo: " << FNumeroTubo << std::endl;
4432  std::cout << "Tipo de error: " << N.what() << std::endl;
4433  throw Exception(N.what());
4434  }
4435 #endif
4436 }

References Interpola_Caracteristica(), and Interpola_Entropia().

Here is the call graph for this function:

◆ CalculaCoeficientePeliculaExterior()

void TTubo::CalculaCoeficientePeliculaExterior ( TBloqueMotor **  Engine,
double  AmbientPressure,
double  AmbientTemperature 
)

Comment

Parameters
EngineComment
AmbientPressureComment
AmbientTemperatureComment

Definition at line 3349 of file TTubo.cpp.

3350  {
3351 #ifdef usetry
3352  try {
3353 #endif
3354 
3355  double dtem, temed, rhog, viscext, Re, Pr, cond, viscpared, vel, n1, n2, L;
3356 
3357  if(FTipoCalcTempPared != nmTempConstante && FCoefAjusTC != 0) {
3358 
3359  if(FTipoTransCal == nmTuboAdmision || FTipoTransCal == nmTuboEscape) {
3360  for(int i = 0; i < FNin; i++) {
3361  dtem = fabs(__units::degCToK(FTPTubo[2][i]) - FTExt);
3362  temed = (__units::degCToK(FTPTubo[2][i]) + FTExt) / 2.;
3363 
3364  // Calculo del coeficiente de pelicula exterior
3365 
3366  // Calculo de las caracteristicas del refrigerante
3367  switch(FTipRefrig) {
3368  case nmAire:
3369  // Condiciones del aire a temperatura media (temed) y 1m/s
3370  rhog = __units::BarToPa(AmbientPressure) / __R::Air / temed;
3371  // Density del aire atmosferico (se considera R=cte=287)
3372  viscext = 1.4615e-6 * pow150(temed) / (temed + 110.4);
3373  Pr = 0.7;
3374  cond = (-8.39061e-09 * temed + 7.05256e-05) * temed + 6.51528e-03;
3375  Re = rhog * 1. * (FDiametroTubo[i] + 2 * (FEspesorIntPrin + FEspesorPrin + FEspesorExtPrin)) / viscext;
3376  break;
3377  case nmAgua:
3378  // Condiciones de agua saturada a (temed) y 1m/s
3379  rhog = 980;
3380  if(temed > 373.) {
3381  viscext = 0.000282;
3382  Pr = 1.76;
3383  cond = 0.6775;
3384  } else {
3385  viscext = ((-2.632351E-09 * temed + 2.737629E-06) * temed - 9.530709E-04) * temed + 1.114642E-01;
3386  Pr = ((-2.022269E-05 * temed + 2.106518E-02) * temed - 7.340298E+00) * temed + 8.581110E+02;
3387  cond = ((9.496332E-09 * temed - 1.707697E-05) * temed + 9.183462E-03) * temed - 8.626578E-01;
3388  }
3389  Re = rhog * 1. * (FDiametroTubo[i] + 2 * (FEspesorIntPrin + FEspesorPrin + FEspesorExtPrin)) / viscext;
3390  break;
3391  default:
3392  std::cout << "WARNING: Tipo de refrigeracion mal definida en el tubo: " << FNumeroTubo << std::endl;
3393  }
3394  // Termino de conveccion de Churchill Bernstein
3395  if((2e4 < Re) && (Re < 4e5)) {
3396  n1 = 0.5;
3397  n2 = 1.;
3398  } else {
3399  n1 = 0.625;
3400  n2 = 0.8;
3401  }
3402  Fhe[i] = 0.3 + 0.62 * sqrt(Re) * cbrt(Pr) / pow025(1 + pow(0.4 / Pr, 0.666666)) * pow(1 + pow(Re / 282000, n1),
3403  n2) * cond / FDiametroTubo[i];
3404 
3405  // Termino de radiacion
3406  if(dtem != 0.) {
3407  Fhe[i] = Fhe[i] + __cons::Sigma * FEmisividad * (pow4(__units::degCToK(FTPTubo[2][i])) - pow4(FTExt)) / dtem;
3408  }
3409  Fhe[i] = Fhe[i] * FCoefExt;
3410  }
3411  } else {
3412  temed = __units::degCToK(Engine[0]->getTempRefrigerante());
3413  rhog = 980.;
3414  viscext = ((-2.632351E-09 * temed + 2.737629E-06) * temed - 9.530709E-04) * temed + 1.114642E-01;
3415  L = 1.5 * Engine[0]->getGeometria().Diametro;
3416  // Longitud caracteristica del conducto refrigerante.
3417  vel = 5.64268e-7 * Engine[0]->getRegimen() / 60. * Engine[0]->getParPotMax() / Engine[0]->getGeometria().NCilin / pow(L,
3418  2.);
3419  Re = rhog * fabs(vel) * L / 2.3 / viscext;
3420  Pr = ((-2.022269E-05 * temed + 2.106518E-02) * temed - 7.340298E+00) * temed + 8.581110E+02;
3421  cond = ((9.496332E-09 * temed - 1.707697E-05) * temed + 9.183462E-03) * temed - 8.626578E-01;
3422 
3423  for(int i = 0; i < FNin; i++) {
3424  // Condiciones del agua de refrigerante del motor.
3425  // Termino de conveccion de Seider-Tate con el termino de Cipolla.
3426 
3427  if(FTPTubo[2][i] > 100.) {
3428  viscpared = 0.000282;
3429  } else {
3430  double Tp2 = __units::degCToK(FTPTubo[2][i]);
3431  viscpared = ((-2.632351E-09 * Tp2 + 2.737629E-06) * Tp2 - 9.530709E-04) * Tp2 + 1.114642E-01;
3432  }
3433 
3434  Fhe[i] = 0.027 * (1 + 24.2 / pow(2.3, 0.7) / pow025(Re)) * pow(Re, 0.8) * cbrt(Pr) * pow(viscext / viscpared,
3435  0.14) * cond / (L / 2.3);
3436  }
3437  }
3438  }
3439 #ifdef usetry
3440  } catch(exception & N) {
3441  std::cout << "ERROR: TTubo::CalculaCoeficientePeliculaExterior en el tubo: " << FNumeroTubo << std::endl;
3442  std::cout << "Tipo de error: " << N.what() << std::endl;
3443  throw Exception(N.what());
3444  }
3445 #endif
3446 }

◆ CalculaCoeficientePeliculaInterior()

void TTubo::CalculaCoeficientePeliculaInterior ( TCondicionContorno **  BC)

Comment

Parameters
BCComment

Definition at line 3650 of file TTubo.cpp.

3650  {
3651 #ifdef usetry
3652  try {
3653 #endif
3654  double Tg = 0., cesp = 0., viscgas = 0., cond = 0., viscpared = 0.;
3655 
3656  if(FCoefAjusTC != 0) {
3657  for(int i = 0; i < FNin; i++) {
3658 
3659  Tg = FTemperature[i];
3660  cesp = FGamma[i] * FRMezcla[i] / (FGamma[i] - 1);
3661  viscgas = 1.4615e-6 * pow150(Tg) / (Tg + 110.4);
3662  cond = viscgas * cesp / 0.709;
3663  if(DoubEqZero(FVelPro[i])) {
3664  FRe[i] = 1E-06; // Para que nunca valga 0 y evitar divisiones por cero.
3665  } else {
3666  FRe[i] = Frho[i] * FVelPro[i] * FDiametroTubo[i] / viscgas;
3667  }
3668 
3669  // Calculo del coeficiente de pelicula interior
3670  switch(FTipoTransCal) {
3671  case nmTuboAdmision:
3672  // Termino de conveccion correlacion Depcick - Assanis
3673  Fhi[i] = 0.0694 * pow075(FRe[i]) * cond / FDiametroTubo[i];
3674  break;
3675  case nmPipaAdmision:
3676  // Termino de conveccion correlacion Depcick - Assanis
3677  Fhi[i] = 0.0694 * pow075(FRe[i]) * cond / FDiametroTubo[i];
3678  break;
3679  case nmTuboEscape:
3680  // Termino de conveccion correlacion M. Reyes
3681  Fhi[i] = 1.6 * pow(FRe[i], 0.4) * cond / FDiametroTubo[i] * FCoefTurbulencia[i];
3682  break;
3683  case nmPipaEscape:
3684  // Termino de conveccion correlacion de Caton + M. Reyes
3685  viscpared = 1.4615e-6 * pow150(__units::degCToK(FTPTubo[0][i])) / (__units::degCToK(FTPTubo[0][i]) + 110.4);
3686  Fhi[i] = 0.1 * pow(FRe[i], 0.8) * 0.709 * pow(viscgas / viscpared, 0.14) * cond / FDiametroTubo[i];
3687  break;
3688  default:
3689  std::cout << "WARNING: Transmision de calor mal definida en el tubo: " << FNumeroTubo << std::endl;
3690  }
3691  }
3692  } else if(FCoefAjusFric != 0) {
3693  for(int i = 0; i < FNin; i++) {
3694  Tg = FTemperature[i];
3695  viscgas = 1.4615e-6 * pow150(Tg) / (Tg + 110.4);
3696  FRe[i] = Frho[i] * FVelPro[i] * FDiametroTubo[i] / viscgas;
3697  }
3698  }
3699 #ifdef usetry
3700  } catch(exception & N) {
3701  std::cout << "ERROR: TTubo::CalculaCoeficientePeliculaInterior en el tubo: " << FNumeroTubo << std::endl;
3702  std::cout << "Tipo de error: " << N.what() << std::endl;
3703  throw Exception(N.what());
3704  }
3705 #endif
3706 }

References pow150().

Here is the call graph for this function:

◆ CalculaResistenciasdePared()

void TTubo::CalculaResistenciasdePared ( TCondicionContorno **  BC)

Comment

Parameters
BCComment

Definition at line 3451 of file TTubo.cpp.

3451  {
3452 #ifdef usetry
3453  try {
3454 #endif
3455  double Dext, Dint, DIntPrin /* ,Tmed */, Text, Tint, Rcond, Rrad, UnionEspes, UnionConduct, Cap;
3456  bool EsInterior;
3457 
3458  if(FTipoCalcTempPared != nmTempConstante && FCoefAjusTC != 0 && !FConcentrico) {
3459  for(int i = 0; i < FNin; i++) {
3460  // Calculo de las resistencias termicas radiales.
3461  EsInterior = true;
3462  Dint = FDiametroTubo[i];
3463  FResistRadInt[i] = 0;
3464  FResistRadExt[i] = 0;
3465  for(int j = 0; j < FNumCapas; j++) {
3466  Dext = Dint + 2 * FCapa[j].Espesor;
3467  if(FCapa[j].EsPrincipal == false) {
3468  Rcond = log(Dext / Dint) / __cons::Pi_x_2 / FCapa[j].Conductividad / FXref;
3469  if(EsInterior) {
3470  // Calculo de la resistencia termica radial interior.
3471  if(FCapa[j].EsFluida) {
3472  // Capa de camara de fluido.
3473  Text = __units::degCToK(FTPTubo[1][i]);
3474  Tint = __units::degCToK(FTPTubo[0][i]);
3475  // Tmed=(Text+Tint)/2;
3476  if(Tint != Text) {
3477  Rrad = (1 / FCapa[j].EmisividadInterior + Dint / Dext * (1 / FCapa[j].EmisividadExterior - 1)) /
3478  (__cons::Sigma * __cons::Pi * Dint * FXref) * (Tint - Text) / (pow4(
3479  Tint) - pow4(Text));
3480  FResistRadInt[i] += 1 / (1 / Rcond + 1 / Rrad);
3481  } else {
3482  FResistRadInt[i] += Rcond;
3483  }
3484  } else {
3485  // Capa de material.
3486  FResistRadInt[i] += Rcond;
3487  }
3488  } else {
3489  // Calculo de la resistencia termica radial exterior.
3490  // Calculo de la resistencia termica radial interior.
3491  if(FCapa[j].EsFluida) {
3492  // Capa de camara de fluido.
3493  Text = __units::degCToK(FTPTubo[2][i]);
3494  Tint = __units::degCToK(FTPTubo[1][i]);
3495  if(Tint != Text) {
3496  Rrad = (1 / FCapa[j].EmisividadInterior + Dint / Dext * (1 / FCapa[j].EmisividadExterior - 1)) /
3497  (__cons::Sigma * __cons::Pi * Dint * FXref) * (Tint - Text) / (pow4(
3498  Tint) - pow4(Text));
3499  FResistRadExt[i] += 1 / (1 / Rcond + 1 / Rrad);
3500  } else {
3501  FResistRadExt[i] += Rcond;
3502  }
3503  } else {
3504  // Capa de material.
3505  FResistRadExt[i] += Rcond;
3506  }
3507  }
3508  } else {
3509  // Calculo de la resistencia termica radial exterior e interior de la capa principal.
3510  FResistRadInt[i] += log((Dint + FCapa[j].Espesor) / Dint) / __cons::Pi_x_2 / FCapa[j].Conductividad / FXref;
3511  FResistRadExt[i] += log(Dext / (Dint + FCapa[j].Espesor)) / __cons::Pi_x_2 / FCapa[j].Conductividad / FXref;
3512  EsInterior = false;
3513  }
3514  Dint = Dext;
3515  }
3516 
3517  // Calculo de las resistencias termicas axiales.
3518  FResistAxiAnt[i] = 0;
3519  FResistAxiPos[i] = 0;
3520  DIntPrin = FDiametroTubo[i] + 2 * FEspesorIntPrin;
3521  if(i == 0) {
3522  if(BC[FNodoIzq - 1]->getTipoCC() == nmPipesConnection) {
3523  UnionEspes = dynamic_cast<TCCUnionEntreTubos*>(BC[FNodoIzq - 1])->getEspesor();
3524  UnionConduct = dynamic_cast<TCCUnionEntreTubos*>(BC[FNodoIzq - 1])->getConductividad();
3525  if(UnionConduct > 0) {
3526  FResistAxiAnt[i] = UnionEspes / UnionConduct / (__cons::Pi * (DIntPrin + FEspesorPrin) * FEspesorPrin);
3527  }
3528  }
3529  FResistAxiPos[i] = FXref / FConductPrin / (__cons::Pi * (DIntPrin + FEspesorPrin) * FEspesorPrin);
3530  }
3531 #ifdef ParticulateFilter
3532  else if(BC[FNodoIzq - 1]->getTipoCC()
3533  == nmPipeToPlenumConnection) {
3534  if(FHayDPFNodoIzq) {
3535  if(FTipoCanal[0] == 0) {
3536  // Junction to a DPF inlet channel
3537  FResistAxiAnt[i] = FDPFEntradaTubo->getAjustRAxAnt
3538  () /
3539  (Pi * FDPFEntradaTubo->getConductividadMetal
3540  () * (FDPFEntradaTubo->getDiametroEfect()
3541  + 2 * FDPFEntradaTubo->getEspesorAislante
3542  () + 2 * FDPFEntradaTubo->getEspesorAire()
3543  + FDPFEntradaTubo->getEspesorMetal())
3544  * FDPFEntradaTubo->getEspesorMetal());
3545  } else { // Junction to a DPF outlet channel
3546  FResistAxiAnt[i] = FDPFEntradaTubo->getAjustRAxPos
3547  () /
3548  (Pi * FDPFEntradaTubo->getConductividadMetal
3549  () * (FDPFEntradaTubo->getDiametroEfect()
3550  + 2 * FDPFEntradaTubo->getEspesorAislante
3551  () + 2 * FDPFEntradaTubo->getEspesorAire()
3552  + FDPFEntradaTubo->getEspesorMetal())
3553  * FDPFEntradaTubo->getEspesorMetal());
3554  }
3555  }
3556  }
3557 #endif
3558  else if(i == FNin - 1) {
3559  FResistAxiAnt[i] = FXref / FConductPrin / (__cons::Pi * (DIntPrin + FEspesorPrin) * FEspesorPrin);
3560  if(BC[FNodoDer - 1]->getTipoCC() == nmPipesConnection) {
3561  UnionEspes = dynamic_cast<TCCUnionEntreTubos*>(BC[FNodoDer - 1])->getEspesor();
3562  UnionConduct = dynamic_cast<TCCUnionEntreTubos*>(BC[FNodoDer - 1])->getConductividad();
3563  if(UnionConduct > 0) {
3564  FResistAxiPos[i] = UnionEspes / UnionConduct / (__cons::Pi * (DIntPrin + FEspesorPrin) * FEspesorPrin);
3565  }
3566  }
3567 #ifdef ParticulateFilter
3568  else if(BC[FNodoDer - 1]->getTipoCC()
3569  == nmPipeToPlenumConnection) {
3570  if(FHayDPFNodoDer) {
3571  if(FTipoCanal[1] == 0) {
3572  // Junction to a DPF inlet channel
3573  FResistAxiPos[i]
3574  = FDPFSalidaTubo->getAjustRAxAnt() /
3575  (Pi * FDPFSalidaTubo->getConductividadMetal
3576  () * (FDPFSalidaTubo->getDiametroEfect()
3577  + 2 *
3578  FDPFSalidaTubo->getEspesorAislante()
3579  + 2 * FDPFSalidaTubo->getEspesorAire()
3580  + FDPFSalidaTubo->getEspesorMetal())
3581  * FDPFSalidaTubo->getEspesorMetal());
3582  } else { // Junction to a DPF outlet channel
3583  FResistAxiPos[i]
3584  = FDPFSalidaTubo->getAjustRAxPos() /
3585  (Pi * FDPFSalidaTubo->getConductividadMetal
3586  () * (FDPFSalidaTubo->getDiametroEfect()
3587  + 2 *
3588  FDPFSalidaTubo->getEspesorAislante()
3589  + 2 * FDPFSalidaTubo->getEspesorAire()
3590  + FDPFSalidaTubo->getEspesorMetal())
3591  * FDPFSalidaTubo->getEspesorMetal());
3592  }
3593  }
3594  }
3595 #endif
3596  } else {
3597  FResistAxiAnt[i] = FXref / FConductPrin / (__cons::Pi * (DIntPrin + FEspesorPrin) * FEspesorPrin);
3598  FResistAxiPos[i] = FXref / FConductPrin / (__cons::Pi * (DIntPrin + FEspesorPrin) * FEspesorPrin);
3599  }
3600 
3601  // Calculo de las capacidades termicas.
3602  EsInterior = true;
3603  Dint = FDiametroTubo[i];
3604  FCapInt[i] = 0.;
3605  FCapMed[i] = 0.;
3606  FCapExt[i] = 0.;
3607  for(int j = 0; j < FNumCapas; j++) {
3608  Dext = Dint + 2 * FCapa[j].Espesor;
3609  if(FCapa[j].EsPrincipal == false) {
3610  if(EsInterior) {
3611  // Calculo de la capacidad termica interior.
3612  if(!FCapa[j].EsFluida) {
3613  // Capa de material.
3614  Cap = FCapa[j].Density * FCapa[j].CalorEspecifico * __geom::Ring_area(Dint, Dext) * FXref;
3615  FCapInt[i] += Cap;
3616  }
3617  } else {
3618  // Calculo de la capacidad termica exterior.
3619  if(!FCapa[j].EsFluida) {
3620  // Capa de material.
3621  Cap = FCapa[j].Density * FCapa[j].CalorEspecifico * __geom::Ring_area(Dint, Dext) * FXref;
3622  FCapExt[i] += Cap;
3623  }
3624  }
3625  } else {
3626  // Calculo de la capacidad termica exterior, media e interior de la capa principal.
3627  FCapInt[i] += FDensidadPrin * FCalEspPrin * __geom::Ring_area(DIntPrin, DIntPrin + 0.5 * FEspesorPrin) * FXref;
3628  FCapMed[i] = FDensidadPrin * FCalEspPrin * __geom::Ring_area(DIntPrin + 0.5 * FEspesorPrin,
3629  DIntPrin + 1.5 * FEspesorPrin) * FXref;
3630  FCapExt[i] += FDensidadPrin * FCalEspPrin * __geom::Ring_area(DIntPrin + 1.5 * FEspesorPrin,
3631  DIntPrin + 2 * FEspesorPrin) * FXref;
3632  EsInterior = false;
3633  }
3634  Dint = Dext;
3635  }
3636  }
3637  }
3638 #ifdef usetry
3639  } catch(exception & N) {
3640  std::cout << "ERROR: TTubo::CalculaResistenciasdePared en el tubo: " << FNumeroTubo << std::endl;
3641  std::cout << "Tipo de error: " << N.what() << std::endl;
3642  throw Exception(N.what());
3643  }
3644 #endif
3645 }

◆ CalculaResultadosInstantaneos()

void TTubo::CalculaResultadosInstantaneos ( )

Comment

Definition at line 3145 of file TTubo.cpp.

3145  {
3146  double dist = 0., d = 0., ason = 0., vel = 0., Aa = 0., ason1 = 0., vel1 = 0., Aa1 = 0., ason2 = 0., vel2 = 0.,
3147  Aa2 = 0.;
3148  int n1 = 0, n2 = 0;
3149 #ifdef usetry
3150  try {
3151 #endif
3152 
3153  if(FNumResInstant != 0) {
3154  for(int i = 0; i < FNumResInstant; i++) {
3155  dist = ResultInstantaneos[i].Distancia / FXref;
3156  n1 = (int) floor(dist);
3157  if(n1 >= FNin - 1) {
3158  if(ResultInstantaneos[i].Pressure)
3159  ResultInstantaneos[i].PresionINS = FPresion0[FNin - 1];
3160  if(ResultInstantaneos[i].Velocity)
3161  ResultInstantaneos[i].VelocidadINS = FVelocidad0[FNin - 1] * __cons::ARef;
3162  if(ResultInstantaneos[i].TemperaturaGas) {
3163  double temp = __units::KTodegC(pow2(FAsonido0[FNin - 1] * __cons::ARef) / (FGamma[FNin - 1] * FRMezcla[FNin - 1]));
3164  ResultInstantaneos[i].TemperaturaGasINS = temp;
3165  }
3166  if(ResultInstantaneos[i].FlujoMasico) {
3167  ResultInstantaneos[i].FlujoMasicoINS = FFlowMass[FNin - 1];
3168  }
3169  if(ResultInstantaneos[i].VelocidadDerecha || ResultInstantaneos[i].VelocidadIzquierda
3170  || ResultInstantaneos[i].PresionDerecha || ResultInstantaneos[i].PresionIzquierda) {
3171  ason = FAsonidoDim[FNin - 1];
3172  vel = FGamma1[FNin - 1] / 2 * FVelocidadDim[FNin - 1];
3173  Aa = ason / pow(FPresion0[FNin - 1], FGamma5[FNin - 1]);
3174  }
3175  if(ResultInstantaneos[i].VelocidadDerecha) {
3176  double VelDer = ((ason + vel) - Aa) / FGamma1[FNin - 1];
3177  ResultInstantaneos[i].VelocidadDerechaINS = VelDer;
3178  }
3179  if(ResultInstantaneos[i].VelocidadIzquierda) {
3180  double VelIzq = -((ason - vel) - Aa) / FGamma1[FNin - 1];
3181  ResultInstantaneos[i].VelocidadIzquierdaINS = VelIzq;
3182  }
3183  if(ResultInstantaneos[i].PresionDerecha) {
3184  double PreDer = pow(((ason + vel) / Aa + 1) / 2., FGamma4[FNin - 1]);
3185  ResultInstantaneos[i].PresionDerechaINS = PreDer;
3186  }
3187  if(ResultInstantaneos[i].PresionIzquierda) {
3188  double PreIzq = pow(((ason - vel) / Aa + 1) / 2., FGamma4[FNin - 1]);
3189  ResultInstantaneos[i].PresionIzquierdaINS = PreIzq;
3190  }
3191  if(ResultInstantaneos[i].NIT) {
3192  double nit = CalculaNIT(FAsonido0[FNin - 1], FVelocidad0[FNin - 1], FPresion0[FNin - 1], FDiametroTubo[FNin - 1],
3193  FGamma[FNin - 1], FRMezcla[FNin - 1]);
3194  ResultInstantaneos[i].NITINS = nit;
3195  }
3196  if(ResultInstantaneos[i].TemperaturaInternaPared)
3197  ResultInstantaneos[i].TemperaturaInternaParedINS = FTPTubo[0][FNin - 1];
3198  if(ResultInstantaneos[i].TemperaturaIntermediaPared)
3199  ResultInstantaneos[i].TemperaturaIntermediaParedINS = FTPTubo[1][FNin - 1];
3200  if(ResultInstantaneos[i].TemperaturaExternaPared)
3201  ResultInstantaneos[i].TemperaturaExternaParedINS = FTPTubo[2][FNin - 1];
3202  if(ResultInstantaneos[i].CoefPelInterior)
3203  ResultInstantaneos[i].CoefPelInteriorINS = Fhi[FNin - 1];
3204  if(ResultInstantaneos[i].FraccionMasicaEspecies) {
3205  for(int j = 0; j < FNumeroEspecies - FIntEGR; j++) {
3206  ResultInstantaneos[i].FraccionINS[j] = FFraccionMasicaEspecie[FNin - 1][j];
3207  }
3208  }
3209  if(ResultInstantaneos[i].Gamma)
3210  ResultInstantaneos[i].GammaINS = FGamma[FNin - 1];
3211  } else {
3212  n2 = n1 + 1;
3213  d = dist - (double) n1;
3214  if(ResultInstantaneos[i].Pressure) {
3215  double pres = Interpola(FPresion0[n1], FPresion0[n2], 1., d);
3216  ResultInstantaneos[i].PresionINS = pres;
3217  }
3218  if(ResultInstantaneos[i].Velocity) {
3219  double vel = Interpola(FVelocidadDim[n1], FVelocidadDim[n2], 1., d);
3220  ResultInstantaneos[i].VelocidadINS = vel;
3221  }
3222  if(ResultInstantaneos[i].TemperaturaGas) {
3223  double temp1 = FTemperature[n1];
3224  double temp2 = FTemperature[n2];
3225  double temp = Interpola(temp1, temp2, 1., d);
3226  ResultInstantaneos[i].TemperaturaGasINS = __units::KTodegC(temp);
3227  }
3228  if(ResultInstantaneos[i].FlujoMasico) {
3229  // double area1=pow(FDiametroTubo[n1],2)*__cons::Pi_4;
3230  // double dens1=FGamma[n1]*FPresion0[n1]*1e5/pow(FAsonido0[n1]*__cons::ARef,2.);
3231  double gto1 = FFlowMass[n1];
3232  // double area2=pow(FDiametroTubo[n2],2)*__cons::Pi_4;
3233  // double dens2=FGamma[n2]*FPresion0[n2]*1e5/pow(FAsonido0[n2]*__cons::ARef,2.);
3234  double gto2 = FFlowMass[n2];
3235  double gto = Interpola(gto1, gto2, 1., d);
3236  ResultInstantaneos[i].FlujoMasicoINS = gto;
3237  }
3238  if(ResultInstantaneos[i].VelocidadDerecha || ResultInstantaneos[i].VelocidadIzquierda
3239  || ResultInstantaneos[i].PresionDerecha || ResultInstantaneos[i].PresionIzquierda) {
3240  ason1 = FAsonidoDim[n1];
3241  vel1 = FGamma1[n1] / 2 * FVelocidadDim[n1];
3242  Aa1 = ason1 / pow(FPresion0[n1], FGamma5[n1]);
3243  ason2 = FAsonidoDim[n2];
3244  vel2 = FGamma1[n2] / 2 * FVelocidadDim[n2];
3245  Aa2 = ason2 / pow(FPresion0[n2], FGamma5[n2]);
3246  }
3247  if(ResultInstantaneos[i].VelocidadDerecha) {
3248  double VelDer1 = ((ason1 + vel1) - Aa1) / FGamma1[n1];
3249  double VelDer2 = ((ason2 + vel2) - Aa2) / FGamma1[n2];
3250  double VelDer = Interpola(VelDer1, VelDer2, 1., d);
3251  ResultInstantaneos[i].VelocidadDerechaINS = VelDer;
3252  }
3253  if(ResultInstantaneos[i].VelocidadIzquierda) {
3254  double VelIzq1 = -((ason1 - vel1) - Aa1) / FGamma1[n1];
3255  double VelIzq2 = -((ason2 - vel2) - Aa2) / FGamma1[n2];
3256  double VelIzq = Interpola(VelIzq1, VelIzq2, 1., d);
3257  ResultInstantaneos[i].VelocidadIzquierdaINS = VelIzq;
3258  }
3259  if(ResultInstantaneos[i].PresionDerecha) {
3260  double PreDer1 = pow(((ason1 + vel1) / Aa1 + 1) / 2., FGamma4[n1]);
3261  double PreDer2 = pow(((ason2 + vel2) / Aa2 + 1) / 2., FGamma4[n2]);
3262  double PreDer = Interpola(PreDer1, PreDer2, 1., d);
3263  ResultInstantaneos[i].PresionDerechaINS = PreDer;
3264  }
3265  if(ResultInstantaneos[i].PresionIzquierda) {
3266  double PreIzq1 = pow(((ason1 - vel1) / Aa1 + 1) / 2., FGamma4[n1]);
3267  double PreIzq2 = pow(((ason2 - vel2) / Aa2 + 1) / 2., FGamma4[n2]);
3268  double PreIzq = Interpola(PreIzq1, PreIzq2, 1., d);
3269  ResultInstantaneos[i].PresionIzquierdaINS = PreIzq;
3270  }
3271  if(ResultInstantaneos[i].NIT) {
3272  double nit1 = CalculaNIT(FAsonido0[n1], FVelocidad0[n1], FPresion0[n1], FDiametroTubo[n1], FGamma[n1], FRMezcla[n1]);
3273  double nit2 = CalculaNIT(FAsonido0[n2], FVelocidad0[n2], FPresion0[n2], FDiametroTubo[n2], FGamma[n2], FRMezcla[n2]);
3274  double nit = Interpola(nit1, nit2, 1., d);
3275  ResultInstantaneos[i].NITINS = nit;
3276  }
3277  if(ResultInstantaneos[i].TemperaturaInternaPared) {
3278  double TP = Interpola(FTPTubo[0][n1], FTPTubo[0][n2], 1., d);
3279  ResultInstantaneos[i].TemperaturaInternaParedINS = TP;
3280  }
3281  if(ResultInstantaneos[i].TemperaturaIntermediaPared) {
3282  double TP = Interpola(FTPTubo[1][n1], FTPTubo[1][n2], 1., d);
3283  ResultInstantaneos[i].TemperaturaIntermediaParedINS = TP;
3284  }
3285  if(ResultInstantaneos[i].TemperaturaExternaPared) {
3286  double TP = Interpola(FTPTubo[2][n1], FTPTubo[2][n2], 1., d);
3287  ResultInstantaneos[i].TemperaturaExternaParedINS = TP;
3288  }
3289  if(ResultInstantaneos[i].CoefPelInterior) {
3290  double hi = Interpola(Fhi[n1], Fhi[n2], 1., d);
3291  ResultInstantaneos[i].CoefPelInteriorINS = hi;
3292  }
3293  if(ResultInstantaneos[i].FraccionMasicaEspecies) {
3294  for(int j = 0; j < FNumeroEspecies - FIntEGR; j++) {
3295  double Fraccion = Interpola(FFraccionMasicaEspecie[n1][j], FFraccionMasicaEspecie[n2][j], 1., d);
3296  ResultInstantaneos[i].FraccionINS[j] = Fraccion;
3297  }
3298  }
3299  if(ResultInstantaneos[i].Gamma) {
3300  double gamma = Interpola(FGamma[n1], FGamma[n2], 1., d);
3301  ResultInstantaneos[i].GammaINS = gamma;
3302  }
3303  }
3304  }
3305 
3306  }
3307 #ifdef usetry
3308  } catch(exception & N) {
3309  std::cout << "ERROR: TTubo::CalculaResultadosInstantaneos en el tubo: " << FNumeroTubo << std::endl;
3310  std::cout << "Tipo de error: " << N.what() << std::endl;
3311  throw Exception(N.what());
3312  }
3313 #endif
3314 }

◆ CalculaResultadosMedios()

void TTubo::CalculaResultadosMedios ( double  Theta)

Comment

Parameters
ThetaComment

Definition at line 2968 of file TTubo.cpp.

2968  {
2969  double dist = 0., Vble = 0., d = 0., Rmezcla = 0., Gamma = 0., GastoPonderacion = 0.;
2970  int n1 = 0, n2 = 0;
2971 #ifdef usetry
2972  try {
2973 #endif
2974 
2975  FTiempoMedSUM += FDeltaTime;
2976 
2977  for(int i = 0; i < FNumResMedios; i++) {
2978  dist = ResultadosMedios[i].Distancia / FXref;
2979  n1 = (int) floor(dist);
2980  if(n1 >= FNin - 1) {
2981  if(ResultadosMedios[i].TemperaturaGas || ResultadosMedios[i].FraccionMasicaEspecies) {
2982  GastoPonderacion = fabs(FFlowMass[FNin - 1]);
2983  ResultadosMedios[i].PonderacionSUM += FFlowMass[FNin - 1] * FDeltaTime;
2984  ResultadosMedios[i].GastoPonderacionSUM += GastoPonderacion;
2985  }
2986  if(ResultadosMedios[i].TemperaturaGas)
2987  ResultadosMedios[i].TemperaturaGasSUM += (FTemperature[FNin - 1]) * GastoPonderacion;
2988  if(ResultadosMedios[i].Pressure)
2989  ResultadosMedios[i].PresionSUM += FPresion0[FNin - 1] * FDeltaTime;
2990  if(ResultadosMedios[i].Velocity)
2991  ResultadosMedios[i].VelocidadSUM += FVelocidadDim[FNin - 1] * FDeltaTime;
2992  if(ResultadosMedios[i].Massflow) {
2993  ResultadosMedios[i].GastoSUM += FFlowMass[i] * FDeltaTime;
2994  }
2995  if(ResultadosMedios[i].TemperaturaInternaPared)
2996  ResultadosMedios[i].TemperaturaInternaParedSUM += FTPTubo[0][FNin - 1] * FDeltaTime;
2997  if(ResultadosMedios[i].TemperaturaIntermediaPared)
2998  ResultadosMedios[i].TemperaturaIntermediaParedSUM += FTPTubo[1][FNin - 1] * FDeltaTime;
2999  if(ResultadosMedios[i].TemperaturaExternaPared)
3000  ResultadosMedios[i].TemperaturaExternaParedSUM += FTPTubo[2][FNin - 1] * FDeltaTime;
3001  if(ResultadosMedios[i].NITmedio) {
3002  double nit = CalculaNIT(FAsonido0[FNin - 1], FVelocidad0[FNin - 1], FPresion0[FNin - 1], FDiametroTubo[FNin - 1],
3003  FGamma[FNin - 1], FRMezcla[FNin - 1]);
3004  ResultadosMedios[i].NITmedioSUM += nit * FDeltaTime;
3005  }
3006  if(ResultadosMedios[i].CoefPelInterior) {
3007  ResultadosMedios[i].CoefPelInteriorSUM += Fhi[FNin - 1] * FDeltaTime;
3008  }
3009  if(ResultadosMedios[i].FraccionMasicaEspecies) {
3010  for(int j = 0; j < FNumeroEspecies - FIntEGR; j++) {
3011  ResultadosMedios[i].FraccionSUM[j] += FFraccionMasicaEspecie[FNin - 1][j] * GastoPonderacion * FDeltaTime;
3012  }
3013  }
3014  } else {
3015  n2 = n1 + 1;
3016  d = dist - (double) n1;
3017 
3018  if(ResultadosMedios[i].TemperaturaGas || ResultadosMedios[i].FraccionMasicaEspecies) {
3019  GastoPonderacion = fabs(Interpola(FFlowMass[n1], FFlowMass[n2], 1., d));
3020  ResultadosMedios[i].GastoPonderacionSUM += GastoPonderacion;
3021  ResultadosMedios[i].PonderacionSUM += GastoPonderacion * FDeltaTime;
3022  }
3023 
3024  if(ResultadosMedios[i].TemperaturaGas)
3025  Vble = Interpola(FTemperature[n1], FTemperature[n2], 1., d);
3026  ResultadosMedios[i].TemperaturaGasSUM += Vble * GastoPonderacion;
3027  if(ResultadosMedios[i].Pressure) {
3028  Vble = Interpola(FPresion0[n1], FPresion0[n2], 1., d);
3029  ResultadosMedios[i].PresionSUM += Vble * FDeltaTime;
3030  }
3031  if(ResultadosMedios[i].Velocity) {
3032  Vble = Interpola(FVelocidad0[n1], FVelocidad0[n2], 1., d);
3033  ResultadosMedios[i].VelocidadSUM += Vble * __cons::ARef * FDeltaTime;
3034  }
3035  if(ResultadosMedios[i].Massflow) {
3036  Vble = Interpola(FFlowMass[n1], FFlowMass[n2], 1., d);
3037  ResultadosMedios[i].GastoSUM += Vble * FDeltaTime;
3038  }
3039  if(ResultadosMedios[i].TemperaturaInternaPared) {
3040  Vble = Interpola(FTPTubo[0][n1], FTPTubo[0][n2], 2., d);
3041  ResultadosMedios[i].TemperaturaInternaParedSUM += Vble * FDeltaTime;
3042  }
3043  if(ResultadosMedios[i].TemperaturaIntermediaPared) {
3044  Vble = Interpola(FTPTubo[1][n1], FTPTubo[1][n2], 2., d);
3045  ResultadosMedios[i].TemperaturaIntermediaParedSUM += Vble * FDeltaTime;
3046  }
3047  if(ResultadosMedios[i].TemperaturaExternaPared) {
3048  Vble = Interpola(FTPTubo[2][n1], FTPTubo[2][n2], 2., d);
3049  ResultadosMedios[i].TemperaturaExternaParedSUM += Vble * FDeltaTime;
3050  }
3051  if(ResultadosMedios[i].NITmedio) {
3052  double a = Interpola(FAsonido0[n1], FAsonido0[n2], 1., d);
3053  double v = Interpola(FVelocidad0[n1], FVelocidad0[n2], 1., d);
3054  double p = Interpola(FPresion0[n1], FPresion0[n2], 1., d);
3055  double diam = Interpola(FDiametroTubo[n1], FDiametroTubo[n2], 1., d);
3056  Gamma = Interpola(FGamma[n1], FGamma[n2], 1., d);
3057  Rmezcla = Interpola(FRMezcla[n1], FRMezcla[n2], 1., d);
3058  double nit = CalculaNIT(a, v, p, diam, Gamma, Rmezcla);
3059  ResultadosMedios[i].NITmedioSUM += nit * FDeltaTime;
3060  }
3061  if(ResultadosMedios[i].CoefPelInterior) {
3062  Vble = Interpola(Fhi[n1], Fhi[n2], 1., d);
3063  ResultadosMedios[i].CoefPelInteriorSUM += Vble * FDeltaTime;
3064  }
3065  if(ResultadosMedios[i].FraccionMasicaEspecies) {
3066  for(int j = 0; j < FNumeroEspecies - FIntEGR; j++) {
3067  Vble = Interpola(FFraccionMasicaEspecie[n1][j], FFraccionMasicaEspecie[n2][j], 1., d);
3068  ResultadosMedios[i].FraccionSUM[j] += Vble * GastoPonderacion * FDeltaTime;
3069  }
3070  }
3071 
3072  }
3073  }
3074 
3075  if(Theta > FControlResMed * FAnguloTotalCiclo) {
3076 
3077  for(int i = 0; i < FNumResMedios; i++) {
3078  if(ResultadosMedios[i].Pressure) {
3079  ResultadosMedios[i].PresionMED = ResultadosMedios[i].PresionSUM / FTiempoMedSUM;
3080  ResultadosMedios[i].PresionSUM = 0.;
3081  }
3082  if(ResultadosMedios[i].TemperaturaGas) {
3083  if(ResultadosMedios[i].GastoPonderacionSUM != 0)
3084  ResultadosMedios[i].TemperaturaGasMED = ResultadosMedios[i].TemperaturaGasSUM / ResultadosMedios[i].GastoPonderacionSUM;
3085  else
3086  ResultadosMedios[i].TemperaturaGasMED = 0;
3087  ResultadosMedios[i].TemperaturaGasSUM = 0.;
3088  ResultadosMedios[i].GastoPonderacionSUM = 0.;
3089  }
3090  if(ResultadosMedios[i].Velocity) {
3091  ResultadosMedios[i].VelocidadMED = ResultadosMedios[i].VelocidadSUM / FTiempoMedSUM;
3092  ResultadosMedios[i].VelocidadSUM = 0.;
3093  }
3094  if(ResultadosMedios[i].Massflow) {
3095  ResultadosMedios[i].GastoMED = ResultadosMedios[i].GastoSUM / FTiempoMedSUM;
3096  ResultadosMedios[i].GastoSUM = 0.;
3097  }
3098  if(ResultadosMedios[i].TemperaturaInternaPared) {
3099  ResultadosMedios[i].TemperaturaInternaParedMED = ResultadosMedios[i].TemperaturaInternaParedSUM / FTiempoMedSUM;
3100  ResultadosMedios[i].TemperaturaInternaParedSUM = 0.;
3101  }
3102  if(ResultadosMedios[i].TemperaturaIntermediaPared) {
3103  ResultadosMedios[i].TemperaturaIntermediaParedMED = ResultadosMedios[i].TemperaturaIntermediaParedSUM / FTiempoMedSUM;
3104  ResultadosMedios[i].TemperaturaIntermediaParedSUM = 0.;
3105  }
3106  if(ResultadosMedios[i].TemperaturaExternaPared) {
3107  ResultadosMedios[i].TemperaturaExternaParedMED = ResultadosMedios[i].TemperaturaExternaParedSUM / FTiempoMedSUM;
3108  ResultadosMedios[i].TemperaturaExternaParedSUM = 0.;
3109  }
3110  if(ResultadosMedios[i].NITmedio) {
3111  ResultadosMedios[i].NITmedioMED = ResultadosMedios[i].NITmedioSUM / FTiempoMedSUM;
3112  ResultadosMedios[i].NITmedioSUM = 0.;
3113  }
3114  if(ResultadosMedios[i].CoefPelInterior) {
3115  ResultadosMedios[i].CoefPelInteriorMED = ResultadosMedios[i].CoefPelInteriorSUM / FTiempoMedSUM;
3116  ResultadosMedios[i].CoefPelInteriorSUM = 0.;
3117  }
3118  if(ResultadosMedios[i].FraccionMasicaEspecies) {
3119  for(int j = 0; j < FNumeroEspecies - FIntEGR; j++) {
3120  if(DoubEqZero(ResultadosMedios[i].PonderacionSUM)) {
3121  ResultadosMedios[i].FraccionMED[j] = 0.;
3122  } else {
3123  ResultadosMedios[i].FraccionMED[j] = ResultadosMedios[i].FraccionSUM[j] / ResultadosMedios[i].PonderacionSUM;
3124  }
3125  ResultadosMedios[i].FraccionSUM[j] = 0.;
3126  }
3127  ResultadosMedios[i].PonderacionSUM = 0.;
3128  }
3129  }
3130  FTiempoMedSUM = 0.;
3131  FControlResMed = FControlResMed + 1.;
3132  }
3133 #ifdef usetry
3134  } catch(exception & N) {
3135  std::cout << "ERROR: TTubo::CalculaResultadosMedios en el tubo: " << FNumeroTubo << std::endl;
3136  std::cout << "Tipo de error: " << N.what() << std::endl;
3137  throw Exception(N.what());
3138  }
3139 #endif
3140 }

References FDeltaTime.

◆ CalculaTemperaturaPared()

void TTubo::CalculaTemperaturaPared ( TBloqueMotor **  Engine,
double  Theta,
double  CrankAngle,
TCondicionContorno **  BC 
)

Comment

Parameters
EngineComment
ThetaComment
CrankAngleComment
BCComment

Definition at line 3711 of file TTubo.cpp.

3711  {
3712  double Tg = 0.;
3713  double zzz = 0., czz = 0., cz1 = 0., uq1 = 0.;
3714  double DeltaTTPared = 0.;
3715  double Tpant0 = 0., Tpant1 = 0., Tpant2 = 0., Tpantant = 0., Tpantpos = 0., Text = 0., Ri = 0., Re = 0., ErrorTp = 0.;
3716  bool EsPrimeraVez;
3717  int extremo = 0, nodo = 0;
3718 #ifdef usetry
3719  try {
3720 #endif
3721 
3722  DeltaTTPared = FTime1 - FTime0;
3723 
3724  for(int i = 0; i < FNin; i++) {
3725  FTParedAnt[0][i] = FTPTubo[0][i];
3726  FTParedAnt[1][i] = FTPTubo[1][i];
3727  FTParedAnt[2][i] = FTPTubo[2][i];
3728 
3729  zzz = 0.013 / DeltaTTPared;
3730  czz = 2 / (zzz + 1);
3731  uq1 = fabs(FVelocidadDim[i]);
3732  if(FTipoTransCal == nmTuboEscape)
3733  cz1 = czz;
3734  else
3735  cz1 = 1;
3736  FVelPro[i] = cz1 * uq1 + (1 - cz1) * FVelPro[i];
3737  }
3738 
3739  if(FTipoCalcTempPared != nmTempConstante && FCoefAjusTC != 0) {
3740  // Tiene que existir motor.
3741  if(Theta > FAnguloTotalCiclo) {
3742  FSUMTime += DeltaTTPared;
3743  }
3744  for(int i = 0; i < FNin; i++) {
3745  // Establece la temperatura del gas en el interior del conducto.
3746  Tg = FTemperature[i];
3747 
3748  // Establece la temperatura del fluido en el exterior del conducto.
3749  if(FTipoTransCal == nmTuboAdmision || FTipoTransCal == nmTuboEscape) {
3750  Text = FTExt;
3751  } else {
3752  Text = __units::degCToK(Engine[0]->getTempRefrigerante());
3753  }
3754 
3755  // Establece la temperatura de la pared en el instante de calculo anterior...
3756  // ...en los nodos anterior y posterior.
3757  // Tpantant=FTParedAnt[1][i]+273.;
3758  // Tpantpos=FTParedAnt[1][i]+273.;
3759  if(i == 0) {
3760  if(BC[FNodoIzq - 1]->getTipoCC() == nmPipesConnection) {
3761  if(dynamic_cast<TCCUnionEntreTubos*>(BC[FNodoIzq - 1])->getConductividad() > 0) {
3762  if(BC[FNodoIzq - 1]->GetTuboExtremo(0).Pipe->getNumeroTubo() == FNumeroTubo) {
3763  extremo = 1;
3764  if(BC[FNodoIzq - 1]->GetTuboExtremo(extremo).TipoExtremo == nmLeft) {
3765  nodo = 0;
3766  } else {
3767  nodo = BC[FNodoIzq - 1]->GetTuboExtremo(extremo).Pipe->getNin() - 1;
3768  }
3769  } else {
3770  extremo = 0;
3771  if(BC[FNodoIzq - 1]->GetTuboExtremo(extremo).TipoExtremo == nmLeft) {
3772  nodo = 0;
3773  } else {
3774  nodo = BC[FNodoIzq - 1]->GetTuboExtremo(extremo).Pipe->getNin() - 1;
3775  }
3776  }
3777  Tpantant = __units::degCToK(BC[FNodoIzq - 1]->GetTuboExtremo(extremo).Pipe->GetTPTuboAnt(1, nodo));
3778  }
3779  }
3780 #ifdef ParticulateFilter
3781  else if(BC[FNodoIzq - 1]->getTipoCC() == nmPipeToPlenumConnection) {
3782  if(FHayDPFNodoIzq) {
3783  Tpantant = __units::degCToK(FDPFEntradaTubo->GetTSuperficie
3784  (FNodoDPFEntrada, 2));
3785  }
3786  }
3787 #endif
3788  Tpantpos = __units::degCToK(FTParedAnt[1][i + 1]);
3789  } else if(i == FNin - 1) {
3790  Tpantant = __units::degCToK(FTParedAnt[1][i - 1]);
3791  if(BC[FNodoDer - 1]->getTipoCC() == nmPipesConnection) {
3792  if(dynamic_cast<TCCUnionEntreTubos*>(BC[FNodoDer - 1])->getConductividad() > 0) {
3793  if(BC[getNodoDer() - 1]->GetTuboExtremo(0).Pipe->getNumeroTubo() == FNumeroTubo) {
3794  extremo = 1;
3795  if(BC[FNodoDer - 1]->GetTuboExtremo(extremo).TipoExtremo == nmLeft) {
3796  nodo = 0;
3797  } else {
3798  nodo = BC[FNodoDer - 1]->GetTuboExtremo(extremo).Pipe->getNin() - 1;
3799  }
3800  } else {
3801  extremo = 0;
3802  if(BC[FNodoDer - 1]->GetTuboExtremo(extremo).TipoExtremo == nmLeft) {
3803  nodo = 0;
3804  } else {
3805  nodo = BC[FNodoDer - 1]->GetTuboExtremo(extremo).Pipe->getNin() - 1;
3806  }
3807  }
3808  Tpantpos = __units::degCToK(BC[FNodoDer - 1]->GetTuboExtremo(extremo).Pipe->GetTPTuboAnt(1, nodo));
3809  }
3810  }
3811 #ifdef ParticulaFilter
3812  else if(BC[FNodoDer - 1]->getTipoCC() == nmPlenum) {
3813  if(FHayDPFNodoDer) {
3814  Tpantpos = __units::degCToK(FDPFSalidaTubo->GetTSuperficie
3815  (FNodoDPFSalida, 2));
3816  }
3817  }
3818 #endif
3819  } else {
3820  Tpantant = __units::degCToK(FTParedAnt[1][i - 1]);
3821  Tpantpos = __units::degCToK(FTParedAnt[1][i + 1]);
3822  }
3823  // ...en los nodos interior, medio y exterior.
3824  Tpant0 = __units::degCToK(FTParedAnt[0][i]);
3825  Tpant1 = __units::degCToK(FTParedAnt[1][i]);
3826  Tpant2 = __units::degCToK(FTParedAnt[2][i]);
3827 
3828  // Resistencias termicas interior y exterior.
3829  if(DoubEqZero(Fhi[i])) {
3830  Ri = 100000000.;
3831  } else {
3832  Ri = 1 / __cons::Pi / FDiametroTubo[i] / Fhi[i] / FCoefAjusTC / FXref;
3833  }
3834  if(DoubEqZero(Fhe[i])) {
3835  Re = 100000000.;
3836  } else {
3837  Re = 1 / __cons::Pi / (FDiametroTubo[i] + 2 * (FEspesorIntPrin + FEspesorPrin + FEspesorExtPrin)) / Fhe[i] / FXref;
3838  }
3839  // Calculo de las temperaturas de pared.
3840  FTPTubo[2][i] = DeltaTTPared / FCapExt[i] * (1 / FResistRadExt[i] * (Tpant1 - Tpant2) + 1 / Re *
3841  (Text - Tpant2)) + Tpant2;
3842  if(FResistAxiAnt[i] > 0. && FResistAxiPos[i] > 0.) {
3843  FTPTubo[1][i] = DeltaTTPared / FCapMed[i] * (1 / FResistRadInt[i] * (Tpant0 - Tpant1) + 1 / FResistRadExt[i] *
3844  (Tpant2 - Tpant1) + 1 / FResistAxiAnt[i] * (Tpantant - Tpant1) + 1 / FResistAxiPos[i] * (Tpantpos - Tpant1)) + Tpant1;
3845  } else if(FResistAxiAnt[i] > 0.) {
3846  FTPTubo[1][i] = DeltaTTPared / FCapMed[i] * (1 / FResistRadInt[i] * (Tpant0 - Tpant1) + 1 / FResistRadExt[i] *
3847  (Tpant2 - Tpant1) + 1 / FResistAxiAnt[i] * (Tpantant - Tpant1)) + Tpant1;
3848  } else if(FResistAxiPos[i] > 0.) {
3849  FTPTubo[1][i] = DeltaTTPared / FCapMed[i] * (1 / FResistRadInt[i] * (Tpant0 - Tpant1) + 1 / FResistRadExt[i] *
3850  (Tpant2 - Tpant1) + 1 / FResistAxiPos[i] * (Tpantpos - Tpant1)) + Tpant1;
3851  } else {
3852  FTPTubo[1][i] = DeltaTTPared / FCapMed[i] * (1 / FResistRadInt[i] * (Tpant0 - Tpant1) + 1 / FResistRadExt[i] *
3853  (Tpant2 - Tpant1)) + Tpant1;
3854  }
3855  FTPTubo[0][i] = DeltaTTPared / FCapInt[i] * (1 / Ri * (Tg - Tpant0) + 1 / FResistRadInt[i] *
3856  (Tpant1 - Tpant0)) + Tpant0;
3857  for(int k = 0; k < 3; k++) {
3858  FTPTubo[k][i] = __units::KTodegC(FTPTubo[k][i]);
3859  }
3860 
3861  // Si el tipo de calculo es sin inercia termica o lleva menos de "NumCiclosSinInerciaTermica" ciclos calculando...
3862  if(FTipoCalcTempPared == nmVariableSinInerciaTermica
3863  || Theta / FAnguloTotalCiclo <= Engine[0]->getNumCiclosSinInerciaTermica()) {
3864  if(Fhi[i] != 0. && Theta > FAnguloTotalCiclo) {
3865  // Sumatorio de h*Tg*incrt intermedio(para el calculo de la integral).
3866  FSUMTPTuboPro[0][1][i] += 1 / (Ri + FResistRadInt[i]) * Tg * DeltaTTPared;
3867  // Sumatorio de h*incrt intermedio(para el calculo de la integral).
3868  FSUMTPTuboPro[1][1][i] += 1 / (Ri + FResistRadInt[i]) * DeltaTTPared;
3869  // Sumatorio de h*Tg*incrt interior(para el calculo de la integral).
3870  FSUMTPTuboPro[0][0][i] += 1 / Ri * Tg * DeltaTTPared;
3871  // Sumatorio de h*incrt interior(para el calculo de la integral).
3872  FSUMTPTuboPro[1][0][i] += 1 / Ri * DeltaTTPared;
3873  }
3874  }
3875 
3876  }
3877 
3878  // Si esta al final del ciclo...
3879  if(FCicloTubo != Engine[0]->getCiclo() && FSUMTime > 0.) {
3880  // ...si (el tipo de calculo es sin inercia termica o lleva menos de "NumCiclosSinInerciaTermica" ciclos calculando) y esta en el segundo ciclo, calcula la temperatura de convergencia
3881  if((FTipoCalcTempPared == nmVariableSinInerciaTermica
3882  || Theta / FAnguloTotalCiclo <= Engine[0]->getNumCiclosSinInerciaTermica()) && Theta > FAnguloTotalCiclo + 1) {
3883  ErrorTp = 1.;
3884  EsPrimeraVez = true;
3885  while(ErrorTp >=
3886  1) { // Itera hasta conseguir una diferencia entre las temperaturas de pared menor a 1degC entre Steps.
3887  ErrorTp = 0.;
3888  for(int i = 0; i < FNin; i++) {
3889  // Establece la temperatura de la pared en el instante de calculo anterior...
3890  // ...en los nosdos anterior y posterior.
3891  Tpantant = __units::degCToK(FTPTubo[1][i]);
3892  Tpantpos = __units::degCToK(FTPTubo[1][i]);
3893  if(i == 0) {
3894  if(BC[FNodoIzq - 1]->getTipoCC() == nmPipesConnection) {
3895  if(dynamic_cast<TCCUnionEntreTubos*>(BC[FNodoIzq - 1])->getConductividad() > 0) {
3896  if(BC[FNodoIzq - 1]->GetTuboExtremo(0).Pipe->getNumeroTubo() == FNumeroTubo) {
3897  extremo = 1;
3898  if(BC[FNodoIzq - 1]->GetTuboExtremo(extremo).TipoExtremo == nmLeft) {
3899  nodo = 0;
3900  } else {
3901  nodo = BC[FNodoIzq - 1]->GetTuboExtremo(extremo).Pipe->getNin() - 1;
3902  }
3903  } else {
3904  extremo = 0;
3905  if(BC[FNodoIzq - 1]->GetTuboExtremo(extremo).TipoExtremo == nmLeft) {
3906  nodo = 0;
3907  } else {
3908  nodo = BC[FNodoIzq - 1]->GetTuboExtremo(extremo).Pipe->getNin() - 1;
3909  }
3910  }
3911  Tpantant = __units::degCToK(BC[FNodoIzq - 1]->GetTuboExtremo(extremo).Pipe->GetTPTuboAnt(1, nodo));
3912  }
3913  }
3914 #ifdef ParticulateFilter
3915  else if
3916  (BC[FNodoIzq - 1]->getTipoCC()
3917  == nmPipeToPlenumConnection) {
3918  if(FHayDPFNodoIzq) {
3919  Tpantant =
3920  __units::degCToK(FDPFEntradaTubo->GetTSuperficie
3921  (FNodoDPFEntrada, 2));
3922  }
3923  }
3924 #endif
3925  Tpantpos = __units::degCToK(FTPTubo[1][i + 1]);
3926  } else if(i == FNin - 1) {
3927  Tpantant = __units::degCToK(FTPTubo[1][i - 1]);
3928  if(BC[FNodoDer - 1]->getTipoCC() == nmPipesConnection) {
3929  if(dynamic_cast<TCCUnionEntreTubos*>(BC[FNodoDer - 1])->getConductividad() > 0) {
3930  if(BC[FNodoDer - 1]->GetTuboExtremo(0).Pipe->getNumeroTubo() == FNumeroTubo) {
3931  extremo = 1;
3932  if(BC[FNodoDer - 1]->GetTuboExtremo(extremo).TipoExtremo == nmLeft) {
3933  nodo = 0;
3934  } else {
3935  nodo = BC[FNodoDer - 1]->GetTuboExtremo(extremo).Pipe->getNin() - 1;
3936  }
3937  } else {
3938  extremo = 0;
3939  if(BC[FNodoDer - 1]->GetTuboExtremo(extremo).TipoExtremo == nmLeft) {
3940  nodo = 0;
3941  } else {
3942  nodo = BC[FNodoDer - 1]->GetTuboExtremo(extremo).Pipe->getNin() - 1;
3943  }
3944  }
3945  Tpantpos = __units::degCToK(BC[FNodoDer - 1]->GetTuboExtremo(extremo).Pipe->GetTPTuboAnt(1, nodo));
3946  }
3947  }
3948 #ifdef ParticulateFilter
3949  else if
3950  (BC[FNodoDer - 1]->getTipoCC()
3951  == nmPipeToPlenumConnection) {
3952  if(FHayDPFNodoDer) {
3953  Tpantpos =
3954  __units::degCToK(FDPFSalidaTubo->GetTSuperficie
3955  (FNodoDPFSalida, 2));
3956  }
3957  }
3958 #endif
3959  } else {
3960  Tpantant = __units::degCToK(FTPTubo[1][i - 1]);
3961  Tpantpos = __units::degCToK(FTPTubo[1][i + 1]);
3962  }
3963 
3964  // ...en los nodos interior, medio y exterior.
3965  Tpant0 = __units::degCToK(FTPTubo[0][i]);
3966  Tpant1 = __units::degCToK(FTPTubo[1][i]);
3967  Tpant2 = __units::degCToK(FTPTubo[2][i]);
3968 
3969  if(EsPrimeraVez) {
3970  FTPTubo[1][i] = (FSUMTime * 1 / (Re + FResistRadExt[i]) * Text + FSUMTPTuboPro[0][1][i]) / (FSUMTime * 1 /
3971  (Re + FResistRadExt[i]) + FSUMTPTuboPro[1][1][i]);
3972  } else {
3973  if(FResistAxiAnt[i] > 0. && FResistAxiPos[i] > 0.) {
3974  FTPTubo[1][i] = (FSUMTime * (1 / (Re + FResistRadExt[i]) * Text + 1 / FResistAxiAnt[i] * Tpantant + 1 / FResistAxiPos[i]
3975  * Tpantpos) + FSUMTPTuboPro[0][1][i]) / (FSUMTime * (1 / (Re + FResistRadExt[i]) + 1 / FResistAxiAnt[i] + 1 /
3976  FResistAxiPos[i]) + FSUMTPTuboPro[1][1][i]);
3977  } else if(FResistAxiAnt[i] > 0.) {
3978  FTPTubo[1][i] = (FSUMTime * (1 / (Re + FResistRadExt[i]) * Text + 1 / FResistAxiAnt[i] * Tpantant) +
3979  FSUMTPTuboPro[0][1][i]) / (FSUMTime * (1 / (Re + FResistRadExt[i]) + 1 / FResistAxiAnt[i]) + FSUMTPTuboPro[1][1][i]);
3980  } else if(FResistAxiPos[i] > 0.) {
3981  FTPTubo[1][i] = (FSUMTime * (1 / (Re + FResistRadExt[i]) * Text + 1 / FResistAxiPos[i] * Tpantpos) +
3982  FSUMTPTuboPro[0][1][i]) / (FSUMTime * (1 / (Re + FResistRadExt[i]) + 1 / FResistAxiPos[i]) + FSUMTPTuboPro[1][1][i]);
3983  } else {
3984  FTPTubo[1][i] = (FSUMTime * (1 / (Re + FResistRadExt[i]) * Text) + FSUMTPTuboPro[0][1][i]) / (FSUMTime * (1 /
3985  (Re + FResistRadExt[i])) + FSUMTPTuboPro[1][1][i]);
3986  }
3987  }
3988  FTPTubo[0][i] = ((FSUMTime * 1 / FResistRadInt[i] * Tpant1 + FSUMTPTuboPro[0][0][i]) /
3989  (FSUMTime * 1 / FResistRadInt[i] + FSUMTPTuboPro[1][0][i]));
3990  FTPTubo[2][i] = (FSUMTime * (1 / Re * Text + 1 / FResistRadExt[i] * Tpant1)) / (FSUMTime *
3991  (1 / Re + 1 / FResistRadExt[i]));
3992  if(ErrorTp < fabs(Tpant1 - FTPTubo[1][i])) {
3993  ErrorTp = fabs(Tpant1 - FTPTubo[1][i]);
3994  }
3995  for(int k = 0; k < 3; k++) {
3996  FTPTubo[k][i] = __units::KTodegC(FTPTubo[k][i]);
3997  }
3998  }
3999  EsPrimeraVez = false;
4000  }
4001  }
4002  for(int i = 0; i < FNin; i++) {
4003  for(int j = 0; j < 2; j++) {
4004  for(int k = 0; k < 3; k++) {
4005  FSUMTPTuboPro[j][k][i] = 0.;
4006  }
4007  }
4008  }
4009  }
4010  }
4011 
4012  if(FTipoCalcTempPared != nmTempConstante && FCoefAjusTC != 0) {
4013  if(FCicloTubo != Engine[0]->getCiclo()) {
4014  FSUMTime = 0.;
4015  FCicloTubo = Engine[0]->getCiclo();
4016  }
4017  }
4018 #ifdef usetry
4019  } catch(exception & N) {
4020  std::cout << "ERROR: TTubo::CalculaTemperaturaPared en el tubo: " << FNumeroTubo << std::endl;
4021  std::cout << "Tipo de error: " << N.what() << std::endl;
4022  throw Exception(N.what());
4023  }
4024 #endif
4025 }

References FTime0, and FTime1.

◆ CalculaVariablesFundamentales()

void TTubo::CalculaVariablesFundamentales ( )

Comment

Definition at line 1550 of file TTubo.cpp.

1550  {
1551 #ifdef usetry
1552  try {
1553 #endif
1554  if(FMod.Modelo == nmLaxWendroff && FMod.FormulacionLeyes == nmSinArea)
1555  LaxWendroff();
1556  else if(FMod.Modelo == nmLaxWendroff && FMod.FormulacionLeyes == nmConArea) {
1557  LaxWendroffArea();
1558  if(FMod.SubModelo == nmFCT) {
1559  // ReduccionFlujoSubsonicoFCT();
1560  FluxCorrectedTransport();
1561  }
1562  } else if(FMod.Modelo == nmTVD) {
1563  TVD_Limitador();
1564  } else {
1565  std::cout << "ERROR: Metodo de calculo no implementado" << std::endl;
1566  throw Exception("");
1567  }
1568 #ifdef usetry
1569  } catch(exception & N) {
1570  std::cout << "ERROR: TTubo::CalculaVariablesFundamentales en el tubo: " << FNumeroTubo << std::endl;
1571  std::cout << "Tipo de error: " << N.what() << std::endl;
1572  throw Exception(N.what());
1573  }
1574 #endif
1575 }

◆ ComunicacionDPF()

void TTubo::ComunicacionDPF ( TCondicionContorno **  CC,
TDeposito **  Deposito 
)

Comment

Parameters
CCComment
DepositoComment

◆ ComunicacionTubo_CC()

void TTubo::ComunicacionTubo_CC ( TCondicionContorno **  BC)

Comment

Parameters
BCComment

Definition at line 861 of file TTubo.cpp.

861  {
862 #ifdef usetry
863  try {
864 #endif
865 
866  for(int i = 0; i < BC[FNodoIzq - 1]->getNumeroTubosCC(); i++) {
867  if(FNumeroTubo == BC[FNodoIzq - 1]->GetTuboExtremo(i).Pipe->getNumeroTubo()) {
868  FTuboCCNodoIzq = i;
869  }
870  }
871 
872  for(int i = 0; i < BC[FNodoDer - 1]->getNumeroTubosCC(); i++) {
873  if(FNumeroTubo == BC[FNodoDer - 1]->GetTuboExtremo(i).Pipe->getNumeroTubo()) {
874  FTuboCCNodoDer = i;
875  }
876  }
877 #ifdef usetry
878  }
879 
880  catch(exception & N) {
881  std::cout << "ERROR: TTubo::ComunicacionTubo_CC en el tubo: " << FNumeroTubo << std::endl;
882  std::cout << "Tipo de error: " << N.what() << std::endl;
883  throw Exception(N.what());
884  }
885 #endif
886 }

◆ EstabilidadMetodoCalculo()

void TTubo::EstabilidadMetodoCalculo ( )

Comment

Definition at line 1519 of file TTubo.cpp.

1519  {
1520  double VTotalMax = 0., VTotalNodo = 0.;
1521 #ifdef usetry
1522  try {
1523 #endif
1524 
1525  VTotalMax = (FAsonidoDim[0] + fabs(FVelocidadDim[0]));
1526  for(int i = 0; i < FNin; i++) {
1527  VTotalNodo = (FAsonidoDim[i] + fabs(FVelocidadDim[i]));
1528  if(VTotalNodo > VTotalMax)
1529  VTotalMax = VTotalNodo;
1530  }
1531  FDeltaTime = FCourant * FXref / VTotalMax;
1532 
1533  if(FMod.Modelo == nmTVD) {
1534  TVD_Estabilidad();
1535  }
1536 
1537  FTime0 = FTime1;
1538  FTime1 = FTime0 + FDeltaTime;
1539 #ifdef usetry
1540  } catch(exception & N) {
1541  std::cout << "ERROR: TTubo::EstabilidadMetodoCalculo en el tubo: " << FNumeroTubo << std::endl;
1542  std::cout << "Tipo de error: " << N.what() << std::endl;
1543  throw Exception(N.what());
1544  }
1545 #endif
1546 }

References FDeltaTime, FTime0, and FTime1.

◆ GetArea()

double TTubo::GetArea ( int  i) const

Gets the cross section at a given cell.

Gets the cross section at a given cell.

Parameters
iCell.
Returns
Cross section. [m ** 2]

Definition at line 5408 of file TTubo.cpp.

5408  {
5409  return FArea[i];
5410 }

◆ GetAreaCC()

double TTubo::GetAreaCC ( int  i)
inline

Return the cross section at boundary i

Parameters
iBoundary index

Definition at line 975 of file TTubo.h.

976  {
977  return FAreaCC[i];
978  }

◆ GetAsonido()

double TTubo::GetAsonido ( int  i) const

Gets the speed of sound.

Gets the speed of sound at a given cell.

Parameters
iCell.
Returns
Speed of sound. [m / s]

Definition at line 5412 of file TTubo.cpp.

5412  {
5413  return FAsonido0[i];
5414 }
Here is the caller graph for this function:

◆ GetCapa()

stCapa TTubo::GetCapa ( int  i)
inline

Return the thermal proporties in layer i

Definition at line 1045 of file TTubo.h.

1045  {
1046  return FCapa[i];
1047  }

◆ GetCoefTurbulencia()

double TTubo::GetCoefTurbulencia ( int  i) const

Gets the turbulence coefficient.

Gets the turbulence coefficient at a given cell.

Parameters
iCell.
Returns
Turbulence coefficient.

Definition at line 5416 of file TTubo.cpp.

5416  {
5417  return FCoefTurbulencia[i];
5418 }

◆ GetCpMezcla()

double TTubo::GetCpMezcla ( int  i) const

Gets the specific heat capacity at constant pressure at a given cell.

Parameters
iCell.
Returns
Specific heat capacity at constant pressure. [J / (kg * K)]

Definition at line 5420 of file TTubo.cpp.

5420  {
5421  return FCpMezcla[i];
5422 }

◆ GetCvMezcla()

double TTubo::GetCvMezcla ( int  i) const

Gets the specific heat capacity at constant volume at a given cell.

Parameters
iCell.
Returns
Specific heat capacity at constant volume. [J / (kg * K)]

Definition at line 5424 of file TTubo.cpp.

5424  {
5425  return FCvMezcla[i];
5426 }

◆ getDeltaTime()

double TTubo::getDeltaTime ( ) const

Gets the time step.

Gets the current time step.

Returns
Time step. [s]

Definition at line 5428 of file TTubo.cpp.

5428  {
5429  return FDeltaTime;
5430 }

References FDeltaTime.

◆ GetDensidad()

double TTubo::GetDensidad ( int  i) const

Gets the density.

Gets the density at a given cell.

Parameters
iCell.
Returns
Density. [kg / (m ** 3)]

Definition at line 5432 of file TTubo.cpp.

5432  {
5433  return Frho[i];
5434 }

◆ GetDensidadCC()

double TTubo::GetDensidadCC ( int  i)
inline

Return the gas density at boudary i

Parameters
iBoundary index

Definition at line 968 of file TTubo.h.

969  {
970  return FDensidadCC[i];
971  }

◆ GetDiametro()

double TTubo::GetDiametro ( int  i) const

Gets the cell diameter.

Gets the diameter at a given cell.

Parameters
iCell.
Returns
Diameter. [m]

Definition at line 5436 of file TTubo.cpp.

5436  {
5437  return FDiametroTubo[i];
5438 }

◆ getDPFEntrada()

TDPF* TTubo::getDPFEntrada ( )
inline

Return the number of wall layer

Definition at line 697 of file TTubo.h.

697  {
698  return FDPFEntradaTubo;
699  }

◆ GetFraccionMasica()

double TTubo::GetFraccionMasica ( int  j,
int  i 
)
inline

Return the value of the of the specie i mass fraction at cell j

Parameters
jCell index
iSpecie index

Definition at line 1219 of file TTubo.h.

1221  {
1222  return FFraccionMasicaEspecie[j][i];
1223  }

◆ GetFraccionMasicaCC()

double TTubo::GetFraccionMasicaCC ( int  j,
int  i 
)
inline

Return the specie i mass fraction at boundary j

Parameters
jBoundary index
iSpecie index

Definition at line 953 of file TTubo.h.

955  {
956  return FFraccionMasicaCC[j][i];
957  }

◆ GetFraccionMasicaInicial()

double TTubo::GetFraccionMasicaInicial ( int  i) const

Gets the initial mass fraction of species i.

Gets the initial mass fraction of species i.

Parameters
iSpecies id.
Returns
Mass fraction.

Definition at line 5440 of file TTubo.cpp.

5440  {
5441  return FComposicionInicial[i];
5442 }

◆ GetGamma()

double TTubo::GetGamma ( int  i) const

Gets the specific heat capacities ratio at a given cell.

Parameters
iCell.
Returns
Specific heat capacities ratio.

Definition at line 5444 of file TTubo.cpp.

5444  {
5445  return FGamma[i];
5446 }
Here is the caller graph for this function:

◆ Gethe()

double TTubo::Gethe ( int  i)
inline

Return the external heat transfer coefficient at cell i

Parameters
iCell index

Definition at line 1037 of file TTubo.h.

1038  {
1039  return Fhe[i];
1040  }

◆ Gethi()

double TTubo::Gethi ( int  i)
inline

Return the heat transfer coefficient at cell i

Parameters
iCell index

Definition at line 1029 of file TTubo.h.

1030  {
1031  return Fhi[i];
1032  }

◆ getLongitudTotal()

double TTubo::getLongitudTotal ( ) const

Gets the total length of the pipe.

Gets the total length of the pipe.

Returns
Total length of the pipe.

Definition at line 5448 of file TTubo.cpp.

5448  {
5449  return FLongitudTotal;
5450 }

◆ getMallado()

double TTubo::getMallado ( ) const

Gets the mesh size.

Gets the mesh size.

Returns
Mesh size. [m]

Definition at line 5452 of file TTubo.cpp.

5452  {
5453  return FMallado;
5454 }

◆ getNodoDer()

int TTubo::getNodoDer ( ) const

Gets the right-hand side node.

Gets the current pipe right-hand side node.

Returns
Right-hand side node.

Definition at line 5456 of file TTubo.cpp.

5456  {
5457  return FNodoDer;
5458 }

◆ getNodoIzq()

int TTubo::getNodoIzq ( ) const

Gets the left-hand side node.

Gets the current pipe left-hand side node.

Returns
Left-hand side node.

Definition at line 5460 of file TTubo.cpp.

5460  {
5461  return FNodoIzq;
5462 }

◆ getNumeroTubo()

int TTubo::getNumeroTubo ( ) const

Gets the pipe id.

Gets the current pipe id.

Returns
Pipe id.

Definition at line 5464 of file TTubo.cpp.

5464  {
5465  return FNumeroTubo;
5466 }

◆ GetPresion()

double TTubo::GetPresion ( int  i) const

Gets the fluid pressure.

Gets the fluid pressure at a given cell.

Parameters
iCell.
Returns
Fluid pressure. [m / s]

Definition at line 5468 of file TTubo.cpp.

5468  {
5469  return FPresion0[i];
5470 }
Here is the caller graph for this function:

◆ getPresionInicial()

double TTubo::getPresionInicial ( ) const

Gets the initial pressure.

Gets the initial pressure.

Returns
Initial pressure.

Definition at line 5472 of file TTubo.cpp.

5472  {
5473  return FPini;
5474 }

◆ GetRMezcla()

double TTubo::GetRMezcla ( int  i) const

Gets the gas constant of the mixture at a given cell.

Parameters
iCell.
Returns
Gas constant. [J / (kg * K)]

Definition at line 5476 of file TTubo.cpp.

5476  {
5477  return FRMezcla[i];
5478 }
Here is the caller graph for this function:

◆ getTemperaturaInicial()

double TTubo::getTemperaturaInicial ( ) const

Gets the initial temperature.

Gets the initial temperature.

Returns
Initial temperature.

Definition at line 5480 of file TTubo.cpp.

5480  {
5481  return FTini;
5482 }

◆ getTempWallIni()

double TTubo::getTempWallIni ( ) const

Gets the initial temperature of the wall.

Gets the initial temperature of the wall.

Returns
Initial temperature of the wall.

Definition at line 5484 of file TTubo.cpp.

5484  {
5485  return FTIniParedTub;
5486 }

◆ getTime0()

double TTubo::getTime0 ( ) const

Gets the current time.

Gets the current time.

Returns
Current time. [s]

Definition at line 5488 of file TTubo.cpp.

5488  {
5489  return FTime0;
5490 }

References FTime0.

◆ getTime1()

double TTubo::getTime1 ( ) const

Gets the time at the following time-step.

Gets the time at the following time-step.

Returns
Time after the following time-step. [s]

Definition at line 5492 of file TTubo.cpp.

5492  {
5493  return FTime1;
5494 }

References FTime1.

◆ GetTipoCanal()

int TTubo::GetTipoCanal ( int  i)
inline

Return the type of monolith channel connected to the duct end

Definition at line 1052 of file TTubo.h.

1052  {
1053  return FTipoCanal[i];
1054  }

◆ GetTPTubo()

double TTubo::GetTPTubo ( int  j,
int  i 
) const

Gets the wall temperature at a given cell and node.

Gets the wall temperature at a given cell and node.

Parameters
jNode.
iCell.
Returns
Wall temperature.

Definition at line 5496 of file TTubo.cpp.

5496  {
5497  // j is the wall node and i is the cell
5498  return FTPTubo[j][i];
5499 }

◆ GetTPTuboAnt()

double TTubo::GetTPTuboAnt ( int  j,
int  i 
) const

Gets the previous wall temperature at a given cell and node.

Gets the previous wall temperature at a given cell and node.

Parameters
jNode.
iCell.
Returns
Wall temperature.

Definition at line 5501 of file TTubo.cpp.

5501  {
5502  return FTParedAnt[j][i];
5503 }

◆ GetU0()

double TTubo::GetU0 ( int  i,
int  j 
)
inline

Return the valuve of the component i of the state vector at the cell j

Parameters
iEquation index
jCell index

Definition at line 1020 of file TTubo.h.

1022  {
1023  return FU0[i][j];
1024  }

◆ GetVelocidad()

double TTubo::GetVelocidad ( int  i) const

Gets the fluid speed.

Gets the fluid speed at a given cell.

Parameters
iCell.
Returns
Speed. [m / s]

Definition at line 5505 of file TTubo.cpp.

5505  {
5506  return FVelocidad0[i];
5507 }

◆ GetVelocidadCC()

double TTubo::GetVelocidadCC ( int  i)
inline

Return the gas velocity at boundary i

Parameters
iBoundary index

Definition at line 961 of file TTubo.h.

962  {
963  return FVelocidadCC[i];
964  }

◆ getVelocidadMedia()

double TTubo::getVelocidadMedia ( ) const

Gets the mean speed.

Gets the mean speed.

Returns
Mean speed. [m / s]

Definition at line 5509 of file TTubo.cpp.

5509  {
5510  return FVelMedia;
5511 }

◆ GetVelPro()

double TTubo::GetVelPro ( int  i) const

Gets the integrated gas velocity.

Gets the integrated gas velocity at a given cell.

Parameters
iCell.
Returns
Integrated gas velocity. [m / s]

Definition at line 5513 of file TTubo.cpp.

5513  {
5514  return FVelPro[i];
5515 }

◆ HeaderAverageResults()

void TTubo::HeaderAverageResults ( std::stringstream &  medoutput,
stEspecies DatosEspecies 
) const

Comment

Parameters
medoutputComment
DatosEspeciesComment

Definition at line 2569 of file TTubo.cpp.

2569  {
2570 #ifdef usetry
2571  try {
2572 #endif
2573 
2574  std::string Label;
2575  std::ostringstream TextDist;
2576  TextDist.precision(8);
2577 
2578  for(int i = 0; i < FNumResMedios; i++) {
2579  TextDist << ResultadosMedios[i].Distancia;
2580 
2581  if(ResultadosMedios[i].TemperaturaGas) {
2582  Label = "\t" + PutLabel(303) + std::to_string(FNumeroTubo) + PutLabel(316) + TextDist.str() + PutLabel(317) + PutLabel(
2583  910);
2584  medoutput << Label.c_str();
2585  }
2586  if(ResultadosMedios[i].Pressure) {
2587  Label = "\t" + PutLabel(301) + std::to_string(FNumeroTubo) + PutLabel(316) + TextDist.str() + PutLabel(317) + PutLabel(
2588  908);
2589  medoutput << Label.c_str();
2590  }
2591  if(ResultadosMedios[i].Velocity) {
2592  Label = "\t" + PutLabel(302) + std::to_string(FNumeroTubo) + PutLabel(316) + TextDist.str() + PutLabel(317) + PutLabel(
2593  909);
2594  medoutput << Label.c_str();
2595  }
2596  if(ResultadosMedios[i].Massflow) {
2597  Label = "\t" + PutLabel(304) + std::to_string(FNumeroTubo) + PutLabel(316) + TextDist.str() + PutLabel(317) + PutLabel(
2598  904);
2599  medoutput << Label.c_str();
2600  }
2601  if(ResultadosMedios[i].TemperaturaInternaPared) {
2602  Label = "\t" + PutLabel(310) + std::to_string(FNumeroTubo) + PutLabel(316) + TextDist.str() + PutLabel(317) + PutLabel(
2603  910);
2604  medoutput << Label.c_str();
2605  }
2606  if(ResultadosMedios[i].TemperaturaIntermediaPared) {
2607  Label = "\t" + PutLabel(311) + std::to_string(FNumeroTubo) + PutLabel(316) + TextDist.str() + PutLabel(317) + PutLabel(
2608  910);
2609  medoutput << Label.c_str();
2610  }
2611  if(ResultadosMedios[i].TemperaturaExternaPared) {
2612  Label = "\t" + PutLabel(312) + std::to_string(FNumeroTubo) + PutLabel(316) + TextDist.str() + PutLabel(317) + PutLabel(
2613  910);
2614  medoutput << Label.c_str();
2615  }
2616  if(ResultadosMedios[i].NITmedio) {
2617  Label = "\t" + PutLabel(309) + std::to_string(FNumeroTubo) + PutLabel(316) + TextDist.str() + PutLabel(317) + PutLabel(
2618  903);
2619  medoutput << Label.c_str();
2620  }
2621  if(ResultadosMedios[i].CoefPelInterior) {
2622  Label = "\t" + PutLabel(313) + std::to_string(FNumeroTubo) + PutLabel(316) + TextDist.str() + PutLabel(317) + PutLabel(
2623  911);
2624  medoutput << Label.c_str();
2625  }
2626  if(ResultadosMedios[i].FraccionMasicaEspecies) {
2627  for(int j = 0; j < FNumeroEspecies - FIntEGR; j++) {
2628  Label = "\t" + PutLabel(314) + DatosEspecies[j].Nombre + PutLabel(318) + std::to_string(FNumeroTubo) + PutLabel(
2629  316) + TextDist.str() + PutLabel(317) + PutLabel(901);
2630  medoutput << Label.c_str();
2631  }
2632  }
2633  }
2634 
2635 #ifdef usetry
2636  } catch(exception & N) {
2637  std::cout << "ERROR: TTubo::HeaderAverageResults en el tubo: " << FNumeroTubo << std::endl;
2638  std::cout << "Tipo de error: " << N.what() << std::endl;
2639  throw Exception(N.what());
2640  }
2641 #endif
2642 }

References PutLabel().

Here is the call graph for this function:

◆ HeaderInstantaneousResults()

void TTubo::HeaderInstantaneousResults ( std::stringstream &  insoutput,
stEspecies DatosEspecies 
) const

Comment

Parameters
insoutputComment
DatosEspeciesComment

Definition at line 2812 of file TTubo.cpp.

2812  {
2813 #ifdef usetry
2814  try {
2815 #endif
2816 
2817  std::string Label;
2818  std::ostringstream TextDist;
2819  TextDist.precision(8);
2820 
2821  for(int i = 0; i < FNumResInstant; i++) {
2822  TextDist << ResultInstantaneos[i].Distancia;
2823  if(ResultInstantaneos[i].Pressure) {
2824  Label = "\t" + PutLabel(301) + std::to_string(FNumeroTubo) + PutLabel(316) + TextDist.str() + PutLabel(317) + PutLabel(
2825  908);
2826  insoutput << Label.c_str();
2827  }
2828  if(ResultInstantaneos[i].Velocity) {
2829  Label = "\t" + PutLabel(302) + std::to_string(FNumeroTubo) + PutLabel(316) + TextDist.str() + PutLabel(317) + PutLabel(
2830  909);
2831  insoutput << Label.c_str();
2832  }
2833  if(ResultInstantaneos[i].TemperaturaGas) {
2834  Label = "\t" + PutLabel(303) + std::to_string(FNumeroTubo) + PutLabel(316) + TextDist.str() + PutLabel(317) + PutLabel(
2835  910);
2836  insoutput << Label.c_str();
2837  }
2838  if(ResultInstantaneos[i].FlujoMasico) {
2839  Label = "\t" + PutLabel(304) + std::to_string(FNumeroTubo) + PutLabel(316) + TextDist.str() + PutLabel(317) + PutLabel(
2840  904);
2841  insoutput << Label.c_str();
2842  }
2843  if(ResultInstantaneos[i].VelocidadDerecha) {
2844  Label = "\t" + PutLabel(305) + std::to_string(FNumeroTubo) + PutLabel(316) + TextDist.str() + PutLabel(317) + PutLabel(
2845  909);
2846  insoutput << Label.c_str();
2847  }
2848  if(ResultInstantaneos[i].VelocidadIzquierda) {
2849  Label = "\t" + PutLabel(306) + std::to_string(FNumeroTubo) + PutLabel(316) + TextDist.str() + PutLabel(317) + PutLabel(
2850  909);
2851  insoutput << Label.c_str();
2852  }
2853  if(ResultInstantaneos[i].PresionDerecha) {
2854  Label = "\t" + PutLabel(307) + std::to_string(FNumeroTubo) + PutLabel(316) + TextDist.str() + PutLabel(317) + PutLabel(
2855  908);
2856  insoutput << Label.c_str();
2857  }
2858  if(ResultInstantaneos[i].PresionIzquierda) {
2859  Label = "\t" + PutLabel(308) + std::to_string(FNumeroTubo) + PutLabel(316) + TextDist.str() + PutLabel(317) + PutLabel(
2860  908);
2861  insoutput << Label.c_str();
2862  }
2863  if(ResultInstantaneos[i].NIT) {
2864  Label = "\t" + PutLabel(309) + std::to_string(FNumeroTubo) + PutLabel(316) + TextDist.str() + PutLabel(317) + PutLabel(
2865  903);
2866  insoutput << Label.c_str();
2867  }
2868  if(ResultInstantaneos[i].TemperaturaInternaPared) {
2869  Label = "\t" + PutLabel(310) + std::to_string(FNumeroTubo) + PutLabel(316) + TextDist.str() + PutLabel(317) + PutLabel(
2870  910);
2871  insoutput << Label.c_str();
2872  }
2873  if(ResultInstantaneos[i].TemperaturaIntermediaPared) {
2874  Label = "\t" + PutLabel(311) + std::to_string(FNumeroTubo) + PutLabel(316) + TextDist.str() + PutLabel(317) + PutLabel(
2875  910);
2876  insoutput << Label.c_str();
2877  }
2878  if(ResultInstantaneos[i].TemperaturaExternaPared) {
2879  Label = "\t" + PutLabel(312) + std::to_string(FNumeroTubo) + PutLabel(316) + TextDist.str() + PutLabel(317) + PutLabel(
2880  910);
2881  insoutput << Label.c_str();
2882  }
2883  if(ResultInstantaneos[i].CoefPelInterior) {
2884  Label = "\t" + PutLabel(313) + std::to_string(FNumeroTubo) + PutLabel(316) + TextDist.str() + PutLabel(317) + PutLabel(
2885  911);
2886  insoutput << Label.c_str();
2887  }
2888  if(ResultInstantaneos[i].FraccionMasicaEspecies) {
2889  for(int j = 0; j < FNumeroEspecies - FIntEGR; j++) {
2890  Label = "\t" + PutLabel(314) + DatosEspecies[j].Nombre + PutLabel(318) + std::to_string(FNumeroTubo) + PutLabel(
2891  316) + TextDist.str() + PutLabel(317) + PutLabel(901);
2892  insoutput << Label.c_str();
2893  }
2894  }
2895  if(ResultInstantaneos[i].Gamma) {
2896  Label = "\t" + PutLabel(315) + std::to_string(FNumeroTubo) + PutLabel(316) + TextDist.str() + PutLabel(317) + PutLabel(
2897  901);
2898  insoutput << Label.c_str();
2899  }
2900  }
2901 
2902 #ifdef usetry
2903  } catch(exception & N) {
2904  std::cout << "ERROR: TTubo::HeaderInstantaneousResults en el tubo nÂș: " << FNumeroTubo << std::endl;
2905  std::cout << "Tipo de error: " << N.what() << std::endl;
2906  throw Exception(N.what());
2907  }
2908 #endif
2909 }

References PutLabel().

Here is the call graph for this function:

◆ ImprimeResultadosInstantaneos()

void TTubo::ImprimeResultadosInstantaneos ( std::stringstream &  insoutput) const

Comment

Parameters
insoutputComment

Definition at line 2914 of file TTubo.cpp.

2914  {
2915 #ifdef usetry
2916  try {
2917 #endif
2918 
2919  for(int i = 0; i < FNumResInstant; i++) {
2920  if(ResultInstantaneos[i].Pressure)
2921  insoutput << "\t" << ResultInstantaneos[i].PresionINS;
2922  if(ResultInstantaneos[i].Velocity)
2923  insoutput << "\t" << ResultInstantaneos[i].VelocidadINS;
2924  if(ResultInstantaneos[i].TemperaturaGas)
2925  insoutput << "\t" << ResultInstantaneos[i].TemperaturaGasINS;
2926  if(ResultInstantaneos[i].FlujoMasico)
2927  insoutput << "\t" << ResultInstantaneos[i].FlujoMasicoINS;
2928  if(ResultInstantaneos[i].VelocidadDerecha)
2929  insoutput << "\t" << ResultInstantaneos[i].VelocidadDerechaINS;
2930  if(ResultInstantaneos[i].VelocidadIzquierda)
2931  insoutput << "\t" << ResultInstantaneos[i].VelocidadIzquierdaINS;
2932  if(ResultInstantaneos[i].PresionDerecha)
2933  insoutput << "\t" << ResultInstantaneos[i].PresionDerechaINS;
2934  if(ResultInstantaneos[i].PresionIzquierda)
2935  insoutput << "\t" << ResultInstantaneos[i].PresionIzquierdaINS;
2936  if(ResultInstantaneos[i].NIT)
2937  insoutput << "\t" << ResultInstantaneos[i].NITINS;
2938  if(ResultInstantaneos[i].TemperaturaInternaPared)
2939  insoutput << "\t" << ResultInstantaneos[i].TemperaturaInternaParedINS;
2940  if(ResultInstantaneos[i].TemperaturaIntermediaPared)
2941  insoutput << "\t" << ResultInstantaneos[i].TemperaturaIntermediaParedINS;
2942  if(ResultInstantaneos[i].TemperaturaExternaPared)
2943  insoutput << "\t" << ResultInstantaneos[i].TemperaturaExternaParedINS;
2944  if(ResultInstantaneos[i].CoefPelInterior)
2945  insoutput << "\t" << ResultInstantaneos[i].CoefPelInteriorINS;
2946  if(ResultInstantaneos[i].FraccionMasicaEspecies) {
2947  for(int j = 0; j < FNumeroEspecies - FIntEGR; j++) {
2948  insoutput << "\t" << ResultInstantaneos[i].FraccionINS[j];
2949  }
2950  }
2951  if(ResultInstantaneos[i].Gamma)
2952  insoutput << "\t" << ResultInstantaneos[i].GammaINS;
2953 
2954  }
2955 
2956 #ifdef usetry
2957  } catch(exception & N) {
2958  std::cout << "ERROR: TTubo::ResultadosInstantaneos en el tubo nÂș: " << FNumeroTubo << std::endl;
2959  std::cout << "Tipo de error: " << N.what() << std::endl;
2960  throw Exception(N.what());
2961  }
2962 #endif
2963 }

◆ ImprimeResultadosMedios()

void TTubo::ImprimeResultadosMedios ( std::stringstream &  medoutput) const

Comment

Parameters
medoutputComment

Definition at line 2647 of file TTubo.cpp.

2647  {
2648 #ifdef usetry
2649  try {
2650 #endif
2651 
2652  // FILE *fich=fopen(FileSALIDA,"a");
2653 
2654  for(int i = 0; i < FNumResMedios; i++) {
2655  if(ResultadosMedios[i].TemperaturaGas)
2656  medoutput << "\t" << __units::KTodegC(ResultadosMedios[i].TemperaturaGasMED);
2657  if(ResultadosMedios[i].Pressure)
2658  medoutput << "\t" << ResultadosMedios[i].PresionMED;
2659  if(ResultadosMedios[i].Velocity)
2660  medoutput << "\t" << ResultadosMedios[i].VelocidadMED;
2661  if(ResultadosMedios[i].Massflow)
2662  medoutput << "\t" << ResultadosMedios[i].GastoMED;
2663  if(ResultadosMedios[i].TemperaturaInternaPared)
2664  medoutput << "\t" << ResultadosMedios[i].TemperaturaInternaParedMED;
2665  if(ResultadosMedios[i].TemperaturaIntermediaPared)
2666  medoutput << "\t" << ResultadosMedios[i].TemperaturaIntermediaParedMED;
2667  if(ResultadosMedios[i].TemperaturaExternaPared)
2668  medoutput << "\t" << ResultadosMedios[i].TemperaturaExternaParedMED;
2669  if(ResultadosMedios[i].NITmedio)
2670  medoutput << "\t" << ResultadosMedios[i].NITmedioMED;
2671  if(ResultadosMedios[i].CoefPelInterior)
2672  medoutput << "\t" << ResultadosMedios[i].CoefPelInteriorMED;
2673  if(ResultadosMedios[i].FraccionMasicaEspecies) {
2674  for(int j = 0; j < FNumeroEspecies - FIntEGR; j++) {
2675  medoutput << "\t" << ResultadosMedios[i].FraccionMED[j];
2676  }
2677  }
2678  }
2679 
2680 #ifdef usetry
2681  } catch(exception & N) {
2682  std::cout << "ERROR: TTubo::ResultadosMedios en el tubo: " << FNumeroTubo << std::endl;
2683  std::cout << "Tipo de error: " << N.what() << std::endl;
2684  throw Exception(N.what());
2685  }
2686 #endif
2687 }

◆ InicializaCaracteristicas()

void TTubo::InicializaCaracteristicas ( TCondicionContorno **  BC)

Comment

Parameters
BCComment

Definition at line 4734 of file TTubo.cpp.

4734  {
4735 #ifdef usetry
4736  try {
4737 #endif
4738 
4739  BC[FNodoIzq - 1]->PutLanda(FTuboCCNodoIzq, FAsonido0[0] + FGamma3[0] * FVelocidad0[0]);
4740  BC[FNodoIzq - 1]->PutBeta(FTuboCCNodoIzq, FAsonido0[0] - FGamma3[0] * FVelocidad0[0]);
4741  BC[FNodoIzq - 1]->PutEntropia(FTuboCCNodoIzq, FAsonido0[0] / pow(FPresion0[0], FGamma5[0]));
4742 
4743  BC[FNodoDer - 1]->PutLanda(FTuboCCNodoDer, FAsonido0[FNin - 1] + FGamma3[FNin - 1] * FVelocidad0[FNin - 1]);
4744  BC[FNodoDer - 1]->PutBeta(FTuboCCNodoDer, FAsonido0[FNin - 1] - FGamma3[FNin - 1] * FVelocidad0[FNin - 1]);
4745  BC[FNodoDer - 1]->PutEntropia(FTuboCCNodoDer, FAsonido0[FNin - 1] / pow(FPresion0[FNin - 1], FGamma5[FNin - 1]));
4746 #ifdef usetry
4747  } catch(exception & N) {
4748  std::cout << "ERROR: TTubo::InicializaCaracteristicas tubo:" << FNumeroTubo << std::endl;
4749  std::cout << "Tipo de error: " << N.what() << std::endl;
4750  throw Exception(N.what());
4751  }
4752 #endif
4753 }

◆ IniciaVariablesFundamentalesTubo()

void TTubo::IniciaVariablesFundamentalesTubo ( )

Comment

Definition at line 961 of file TTubo.cpp.

961  {
962 #ifdef usetry
963  try {
964 #endif
965  double RMezclaIni = 0., CpMezclaIni = 0., CvMezclaIni = 0., GammaIni = 0.;
966 
967  FPresion0 = new double[FNin];
968  FAsonido0 = new double[FNin];
969  FVelocidad0 = new double[FNin];
970  FPresion1 = new double[FNin];
971  FAsonido1 = new double[FNin];
972  FVelocidadMedia = new double[FNin];
973  FPresionMedia = new double[FNin];
974  FAsonidoMedia = new double[FNin];
975  FVelocidad1 = new double[FNin];
976 
977  FVelocidadDim = new double[FNin];
978  FAsonidoDim = new double[FNin];
979  FTemperature = new double[FNin];
980  FFlowMass = new double[FNin];
981 
982  FFraccionMasicaEspecie = new double*[FNin];
983  for(int i = 0; i < FNin; i++)
984  FFraccionMasicaEspecie[i] = new double[FNumeroEspecies - FIntEGR];
985  FFraccionMasicaCC = new double*[2];
986  for(int i = 0; i < 2; i++)
987  FFraccionMasicaCC[i] = new double[FNumeroEspecies - FIntEGR];
988  FVelocidadCC = new double[2];
989  FDensidadCC = new double[2];
990  FAreaCC = new double[2];
991  FGamma = new double[FNin];
992  FGamma1 = new double[FNin];
993  FGamma3 = new double[FNin];
994  FGamma4 = new double[FNin];
995  FGamma5 = new double[FNin];
996  FGamma6 = new double[FNin];
997  FRMezcla = new double[FNin];
998 
999  FUt = new double*[3];
1000  for(int i = 0; i < 3; i++)
1001  FUt[i] = new double[FNin];
1002  FU0 = new double*[FNumEcuaciones];
1003  for(int i = 0; i < FNumEcuaciones; i++)
1004  FU0[i] = new double[FNin];
1005  FU0Sum = new double*[FNumEcuaciones];
1006  for(int i = 0; i < FNumEcuaciones; i++)
1007  FU0Sum[i] = new double[FNin];
1008  for(int i = 0; i < FNin; i++) {
1009  for(int k = 0; k < FNumEcuaciones; k++) {
1010  FU0Sum[k][i] = 0;
1011  }
1012  }
1013  FU0Medio = new double*[FNumEcuaciones];
1014  for(int i = 0; i < FNumEcuaciones; i++)
1015  FU0Medio[i] = new double[FNin];
1016  FU1 = new double*[FNumEcuaciones];
1017  for(int i = 0; i < FNumEcuaciones; i++)
1018  FU1[i] = new double[FNin];
1019  FU12 = new double*[FNumEcuaciones];
1020  for(int i = 0; i < FNumEcuaciones; i++)
1021  FU12[i] = new double[FNin];
1022  FW = new double*[FNumEcuaciones];
1023  for(int i = 0; i < FNumEcuaciones; i++)
1024  FW[i] = new double[FNin];
1025  FV1 = new double*[FNumEcuaciones];
1026  for(int i = 0; i < FNumEcuaciones; i++)
1027  FV1[i] = new double[FNin];
1028  FV2 = new double*[FNumEcuaciones];
1029  for(int i = 0; i < FNumEcuaciones; i++)
1030  FV2[i] = new double[FNin];
1031  if(FMod.SubModelo == nmFCT) {
1032  FUfct0 = new double*[FNumEcuaciones];
1033  for(int i = 0; i < FNumEcuaciones; i++)
1034  FUfct0[i] = new double[FNin + 1];
1035  FUfct1 = new double*[FNumEcuaciones];
1036  for(int i = 0; i < FNumEcuaciones; i++)
1037  FUfct1[i] = new double[FNin + 1];
1038  FUfctd = new double*[FNumEcuaciones];
1039  for(int i = 0; i < FNumEcuaciones; i++)
1040  FUfctd[i] = new double[FNin + 1];
1041  FUfctad = new double*[FNumEcuaciones];
1042  for(int i = 0; i < FNumEcuaciones; i++)
1043  FUfctad[i] = new double[FNin + 1];
1044  Ffl = new double*[FNumEcuaciones];
1045  for(int i = 0; i < FNumEcuaciones; i++)
1046  Ffl[i] = new double[FNin + 1];
1047  FdU = new double*[FNumEcuaciones];
1048  for(int i = 0; i < FNumEcuaciones; i++)
1049  FdU[i] = new double[FNin + 1];
1050  FDeltaFCTd = new double*[FNumEcuaciones];
1051  for(int i = 0; i < FNumEcuaciones; i++)
1052  FDeltaFCTd[i] = new double[FNin + 1];
1053  FflU = new double*[FNumEcuaciones];
1054  for(int i = 0; i < FNumEcuaciones; i++)
1055  FflU[i] = new double[FNin + 1];
1056  FaU = new double*[FNumEcuaciones];
1057  for(int i = 0; i < FNumEcuaciones; i++)
1058  FaU[i] = new double[FNin + 1];
1059  }
1060 
1061  Frho = new double[FNin];
1062  FRe = new double[FNin];
1063 
1064  if(FMod.Modelo == nmTVD)
1065  DimensionaTVD();
1066 
1067  FDerLin = new double[FNin - 1];
1068  FDerLin12 = new double[FNin - 1];
1069 
1070  FDerLinArea = new double[FNin - 1];
1071  FDerLinArea12 = new double[FNin - 1];
1072 
1073  FTime0 = 0.;
1074  FTime1 = 0.;
1075  FDeltaTime = 0.;
1076 
1077  for(int i = 0; i < FNin - 1; i++) {
1078  FDerLin[i] = DerLinF(FDiametroTubo[i], FDiametroTubo[i + 1], FXref);
1079  FDerLinArea[i] = DerLinFArea(FArea[i], FArea[i + 1], FXref);
1080  }
1081 
1082  for(int i = 1; i < FNin - 1; i++) {
1083  FDerLin12[i] = DerLinF(FDiametroD12[i], FDiametroD12[i - 1], FXref);
1084  FDerLinArea12[i] = DerLinFArea(FArea12[i - 1], FArea12[i], FXref);
1085  }
1086 
1087  // Calculo de Gamma y R para la composicion inicial.
1088  if(FCalculoEspecies == nmCalculoCompleto) {
1089 
1090  RMezclaIni = CalculoCompletoRMezcla(FComposicionInicial[0], FComposicionInicial[1], FComposicionInicial[2], 0,
1091  FCalculoGamma, nmMEP);
1092  CpMezclaIni = CalculoCompletoCpMezcla(FComposicionInicial[0], FComposicionInicial[1], FComposicionInicial[2], 0,
1093  __units::degCToK(FTini), FCalculoGamma, nmMEP);
1094  GammaIni = CalculoCompletoGamma(RMezclaIni, CpMezclaIni, FCalculoGamma);
1095 
1096  } else if(FCalculoEspecies == nmCalculoSimple) {
1097 
1098  RMezclaIni = CalculoSimpleRMezcla(FComposicionInicial[0], FComposicionInicial[1], FCalculoGamma, nmMEP);
1099  CvMezclaIni = CalculoSimpleCvMezcla(__units::degCToK(FTini), FComposicionInicial[0], FComposicionInicial[1],
1100  FCalculoGamma, nmMEP);
1101  GammaIni = CalculoSimpleGamma(RMezclaIni, CvMezclaIni, FCalculoGamma);
1102 
1103  }
1104 
1105  for(int j = 0; j < FNumeroEspecies - FIntEGR; j++) {
1106  FFraccionMasicaCC[0][j] = FComposicionInicial[j];
1107  FFraccionMasicaCC[1][j] = FComposicionInicial[j];
1108  }
1109 
1110  double viscgas = 1.4615e-6 * pow150(__units::degCToK(FTini)) / (__units::degCToK(FTini) + 110.4);
1111 
1112  for(int i = 0; i < FNin; i++) {
1113 
1114  for(int j = 0; j < FNumeroEspecies - FIntEGR; j++) {
1115  FFraccionMasicaEspecie[i][j] = FComposicionInicial[j];
1116  }
1117  FRMezcla[i] = RMezclaIni;
1118  FGamma[i] = GammaIni;
1119  FGamma1[i] = __Gamma::G1(FGamma[i]);
1120  FGamma3[i] = __Gamma::G3(FGamma[i]);
1121  FGamma4[i] = __Gamma::G4(FGamma[i]);
1122  FGamma5[i] = __Gamma::G5(FGamma[i]);
1123  FGamma6[i] = __Gamma::G6(FGamma[i]);
1124 
1125  FPresion0[i] = FPini;
1126  FTemperature[i] = __units::degCToK(FTini);
1127  FAsonidoDim[i] = sqrt(__units::degCToK(FTini) * FGamma[i] * FRMezcla[i]);
1128  FAsonido0[i] = FAsonidoDim[i] / __cons::ARef;
1129  FVelocidadDim[i] = FVelMedia;
1130  FVelocidad0[i] = FVelMedia / __cons::ARef;
1131  FPresion1[i] = FPini;
1132  FAsonido1[i] = FAsonido0[i];
1133  FVelocidad1[i] = FVelocidad0[i];
1134  FFlowMass[i] = FArea[i] * FVelocidadDim[i] * __units::BarToPa(FPresion0[i]) / FRMezcla[i] / FTemperature[i];
1135 
1136  if(FMod.FormulacionLeyes == nmSinArea) {
1137  Transforma1(FVelocidad0[i], FAsonido0[i], FPresion0[i], FU0, FGamma[i], FGamma1[i], FFraccionMasicaEspecie[i], i);
1138 
1139  Transforma1(FVelocidad1[i], FAsonido1[i], FPresion1[i], FU1, FGamma[i], FGamma1[i], FFraccionMasicaEspecie[i], i);
1140 
1141  Frho[i] = FU0[0][i];
1142  } else if(FMod.FormulacionLeyes == nmConArea) {
1143  Transforma1Area(FVelocidad0[i], FAsonido0[i], FPresion0[i], FU0, FArea[i], FGamma[i], FGamma1[i],
1144  FFraccionMasicaEspecie[i], i);
1145 
1146  Transforma1Area(FVelocidad1[i], FAsonido1[i], FPresion1[i], FU1, FArea[i], FGamma[i], FGamma1[i],
1147  FFraccionMasicaEspecie[i], i);
1148 
1149  Frho[i] = FU0[0][i] / FArea[i];
1150  }
1151 
1152  else {
1153  std::cout << "ERROR: El tipo de formulacion de las leyes de conservacion no esta bien definido" << std::endl;
1154  throw Exception("");
1155  }
1156  FRe[i] = Frho[i] * FVelocidadDim[i] * FDiametroTubo[i] / viscgas;
1157  }
1158 #ifdef usetry
1159  } catch(exception & N) {
1160  std::cout << "ERROR: TTubo::IniciaVariableFundamentalesTubo en el tubo: " << FNumeroTubo << std::endl;
1161  std::cout << "Tipo de error: " << N.what() << std::endl;
1162  throw Exception(N.what());
1163  }
1164 #endif
1165 }

References FDeltaTime, FTime0, and FTime1.

◆ IniciaVariablesTransmisionCalor()

void TTubo::IniciaVariablesTransmisionCalor ( TCondicionContorno **  BC,
TBloqueMotor **  Engine,
double  AmbientTemperature 
)

Comment

Parameters
BCComment
EngineComment
AmbientTemperatureComment

Definition at line 1452 of file TTubo.cpp.

1452  {
1453  double dist1 = 0., dist2 = 0.;
1454 #ifdef usetry
1455  try {
1456 #endif
1457 
1458  Fhi = new double[FNin];
1459  Fhe = new double[FNin];
1460  FVelPro = new double[FNin];
1461  FCoefTurbulencia = new double[FNin];
1462  FSUMTPTuboPro = new double**[2];
1463  for(int i = 0; i < 2; i++)
1464  FSUMTPTuboPro[i] = new double*[3];
1465  for(int i = 0; i < 2; i++) {
1466  for(int j = 0; j < 3; j++) {
1467  FSUMTPTuboPro[i][j] = new double[FNin];
1468  }
1469  }
1470  FTPTubo = new double*[3];
1471  for(int i = 0; i < 3; i++)
1472  FTPTubo[i] = new double[FNin];
1473  FTParedAnt = new double*[3];
1474  for(int i = 0; i < 3; i++)
1475  FTParedAnt[i] = new double[FNin];
1476 
1477  for(int i = 0; i < FNin; i++) {
1478  dist1 = FXref * (double) i + BC[FNodoIzq - 1]->getPosicionNodo();
1479  dist2 = FXref * (double)(FNin - 1 - i) + BC[FNodoDer - 1]->getPosicionNodo();
1480  if(Minimo(dist1, dist2) >= 10000.)
1481  FCoefTurbulencia[i] = 1.;
1482  else
1483  FCoefTurbulencia[i] = 1. + 3. * exp(-Minimo(dist1, dist2) / (4 * FDiametroTubo[i]));
1484  for(int j = 0; j < 3; j++) {
1485  FTPTubo[j][i] = FTIniParedTub;
1486  FTParedAnt[j][i] = FTIniParedTub;
1487  }
1488  for(int k = 0; k < 2; k++) {
1489  for(int j = 0; j < 3; j++) {
1490  FSUMTPTuboPro[k][j][i] = 0.;
1491  }
1492  }
1493  FVelPro[i] = 5.;
1494  Fhi[i] = 0.;
1495  Fhe[i] = 0.;
1496 
1497  }
1498  if(FTipoCalcTempPared != nmTempConstante) {
1499  if(FTipoTransCal == nmPipaAdmision || FTipoTransCal == nmPipaEscape) {
1500  FTExt = __units::degCToK(Engine[0]->getTempRefrigerante());
1501  } else {
1502  if(FTipRefrig == nmAgua)
1503  FTExt = __units::degCToK(FTRefrigerante);
1504  else
1505  FTExt = __units::degCToK(AmbientTemperature);
1506  }
1507  }
1508 #ifdef usetry
1509  } catch(exception & N) {
1510  std::cout << "ERROR: TTubo::IniciaVariablesTransmisionCalor en el tubo: " << FNumeroTubo << std::endl;
1511  std::cout << "Tipo de error: " << N.what() << std::endl;
1512  throw Exception(N.what());
1513  }
1514 #endif
1515 }

◆ Interpola_Caracteristica()

double TTubo::Interpola_Caracteristica ( double  entropia,
int  signo,
int  extremo,
double  DeltaTiempo 
)

Comment

Parameters
entropiaComment
signoComment
extremoComment
DeltaTiempoComment

Definition at line 4584 of file TTubo.cpp.

4584  {
4585 #ifdef usetry
4586  try {
4587 #endif
4588 
4589  double dtdx = DeltaTiempo / FXref;
4590  int ind = extremo;
4591  double caracteristica = 0.;
4592  double velocidadp = 0.;
4593  double asonidop = 0.;
4594 
4595  if(DeltaTiempo < 1e-15) {
4596  Calculo_Caracteristica(caracteristica, velocidadp, asonidop, ind, 0., signo, entropia, DeltaTiempo);
4597  } else {
4598 
4599  dtdx = DeltaTiempo / FXref;
4600 
4601  int ind1 = ind + signo;
4602 
4603  stCharOrigin CharOrigin(FU0[0][ind], FU0[1][ind], FU0[2][ind], FU0[0][ind1], FU0[1][ind1], FU0[2][ind1], FGamma[ind],
4604  FGamma[ind1], dtdx, signo);
4605 
4606  double dist = zbrent(CharOrigin, 0., 1., 1e-5);
4607 
4608  Calculo_Caracteristica(caracteristica, velocidadp, asonidop, ind, dist, signo, entropia, DeltaTiempo);
4609  }
4610  return caracteristica / __cons::ARef;
4611 #ifdef usetry
4612  } catch(exception & N) {
4613  std::cout << "ERROR: TTubo::Interpola_Caracteristica " << FNumeroTubo << std::endl;
4614  std::cout << "Tipo de error: " << N.what() << std::endl;
4615  throw Exception(N.what());
4616  }
4617 #endif
4618 }

References zbrent().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Interpola_Entropia()

double TTubo::Interpola_Entropia ( nmPipeEnd  TipoExtremoTubo,
double  DeltaTiempo 
)

Comment

Parameters
TipoExtremoTuboComment
DeltaTiempoComment

Definition at line 4441 of file TTubo.cpp.

4441  {
4442 #ifdef usetry
4443  try {
4444 #endif
4445 
4446  int signo = 1;
4447  int extremo = 0;
4448  int indiceCC = 0;
4449 
4450  if(TipoExtremoTubo == nmRight) { // PipeEnd Derecho
4451  signo = -1;
4452  extremo = FNin - 1;
4453  indiceCC = 1;
4454  }
4455  double dtdx = DeltaTiempo / FXref;
4456  int ind = extremo;
4457  double entropia = 0.;
4458  double velocidadp = 0.;
4459  double asonidop = 0.;
4460 
4461  if(DeltaTiempo < 1e-15 || DoubEqZero(FVelocidadDim[extremo])) {
4462 
4463  Calculo_Entropia(entropia, velocidadp, extremo, 0., signo, DeltaTiempo, indiceCC);
4464 
4465  } else {
4466  int ind1 = ind + signo;
4467 
4468  stPathOrigin PathOrigin(FU0[0][ind], FU0[1][ind], FU0[0][ind1], FU0[1][ind1], dtdx, signo);
4469 
4470  double dist = zbrent(PathOrigin, 0., 1., 1e-5);
4471 
4472  Calculo_Entropia(entropia, velocidadp, ind, dist, signo, DeltaTiempo, indiceCC);
4473 
4474  }
4475 
4476  return entropia / __cons::ARef;
4477 #ifdef usetry
4478  } catch(exception & N) {
4479  std::cout << "ERROR: TTubo::Interpola_Entropia: " << std::endl;
4480  std::cout << "Tipo de error: " << N.what() << std::endl;
4481  throw Exception(N.what());
4482  }
4483 #endif
4484 }
Here is the caller graph for this function:

◆ LeeDatosGeneralesTubo()

void TTubo::LeeDatosGeneralesTubo ( const char *  FileWAM,
fpos_t &  filepos 
)

Comment

Parameters
FileWAMComment
fileposComment

Definition at line 535 of file TTubo.cpp.

535  {
536 #ifdef usetry
537  try {
538 #endif
539  int TipTC = 0, Concentrico;
540  int metodo[4];
541  double fracciontotal = 0.;
542 
543  FILE *fich = fopen(FileWAM, "r");
544  fsetpos(fich, &filepos);
545 
546  fscanf(fich, "%d %d %d %d", &FNodoIzq, &FNodoDer, &FNTramos, &FNumeroConductos);
547  fscanf(fich, "%lf ", &FFriccion);
548  fscanf(fich, "%lf %lf %lf %lf ", &FTIniParedTub, &FTini, &FPini, &FVelMedia);
549  fscanf(fich, "%d %lf %lf ", &TipTC, &FCoefAjusTC, &FCoefAjusFric);
550 
551  switch(TipTC) {
552  case 1:
553  FTipoTransCal = nmTuboAdmision;
554  break;
555  case 2:
556  FTipoTransCal = nmTuboEscape;
557  break;
558  case 3:
559  FTipoTransCal = nmPipaEscape;
560  break;
561  case 4:
562  FTipoTransCal = nmPipaAdmision;
563  break;
564  }
565 
566  FComposicionInicial = new double[FNumeroEspecies - FIntEGR];
567  for(int i = 0; i < FNumeroEspecies - 1; i++) {
568  fscanf(fich, "%lf ", &FComposicionInicial[i]);
569  fracciontotal += FComposicionInicial[i];
570  }
571  if(FHayEGR) {
572  if(FCalculoEspecies == nmCalculoCompleto) {
573  if(FComposicionInicial[0] > 0.2)
574  FComposicionInicial[FNumeroEspecies - 1] = 0.;
575  else
576  FComposicionInicial[FNumeroEspecies - 1] = 1.;
577  } else {
578  if(FComposicionInicial[0] > 0.5)
579  FComposicionInicial[FNumeroEspecies - 1] = 1.;
580  else
581  FComposicionInicial[FNumeroEspecies - 1] = 0.;
582  }
583  }
584 
585  if(fracciontotal > 1 + 1.e-10 && fracciontotal < 1 - 1e-10) {
586  std::cout << "ERROR: Total mass fraction must be equal to 1. Check input data for pipe " << FNumeroTubo << std::endl;
587  throw Exception(" ");
588  }
589 
590  fscanf(fich, "%lf %d ", &FMallado, &FTctpt);
591 
592  switch(FTctpt) {
593  case 0:
594  FTipoCalcTempPared = nmVariableConInerciaTermica;
595  break;
596  case 1:
597  FTipoCalcTempPared = nmVariableSinInerciaTermica;
598  break;
599  case 2:
600  FTipoCalcTempPared = nmTempConstante;
601  break;
602  }
603 
604  fscanf(fich, "%d ", &metodo[0]);
605 
606  if(metodo[0] == 0) {
607  FMod.Modelo = nmLaxWendroff;
608  fscanf(fich, "%d ", &metodo[1]);
609  if(metodo[1] == 0) {
610  // Lax&Wendroff
611  metodo[3] = 1;
612  switch(metodo[3]) {
613  case 0:
614  FMod.FormulacionLeyes = nmSinArea;
615  break;
616  case 1:
617  FMod.FormulacionLeyes = nmConArea;
618  break;
619  }
620  }
621 
622  if(metodo[1] == 1) {
623  // Lax&Wendroff + FCT
624  FMod.FormulacionLeyes = nmConArea;
625  FMod.SubModelo = nmFCT;
626  fscanf(fich, "%d ", &metodo[2]);
627  switch(metodo[2]) {
628  case 0:
629  FMod.OpcionSubModelo = nmDDNAD;
630  FMod.Difusion = nmDamping;
631  FMod.Antidifusion = nmNaive;
632  break;
633  case 1:
634  FMod.OpcionSubModelo = nmDDPAD;
635  FMod.Difusion = nmDamping;
636  FMod.Antidifusion = nmPhoenical;
637  break;
638  case 2:
639  FMod.OpcionSubModelo = nmDDEAD;
640  FMod.Difusion = nmDamping;
641  FMod.Antidifusion = nmExplicit;
642  break;
643  case 3:
644  FMod.OpcionSubModelo = nmDSNAD;
645  FMod.Difusion = nmSmoothing;
646  FMod.Antidifusion = nmNaive;
647  break;
648  case 4:
649  FMod.OpcionSubModelo = nmDSPAD;
650  FMod.Difusion = nmSmoothing;
651  FMod.Antidifusion = nmPhoenical;
652  break;
653  case 5:
654  FMod.OpcionSubModelo = nmDSEAD;
655  FMod.Difusion = nmSmoothing;
656  FMod.Antidifusion = nmPhoenical;
657  break;
658  }
659  }
660  } else if(metodo[0] == 2) {
661  FMod.Modelo = nmTVD;
662  FMod.FormulacionLeyes = nmConArea;
663  }
664 
665  fscanf(fich, "%lf ", &FCourant);
666 
667  fgetpos(fich, &filepos);
668  fclose(fich);
669 #ifdef usetry
670  } catch(exception & N) {
671  std::cout << "ERROR: TTubo::LeeDatosGeneralesTubo en el tubo: " << FNumeroTubo << std::endl;
672  std::cout << "Tipo de error: " << N.what() << std::endl;
673  throw Exception(N.what());
674  }
675 #endif
676 }

◆ LeeDatosGeometricosTubo()

void TTubo::LeeDatosGeometricosTubo ( const char *  FileWAM,
fpos_t &  filepos,
double  ene,
int  tipomallado,
TBloqueMotor **  Engine 
)

Comment

Parameters
FileWAMComment
fileposComment
eneComment
tipomalladoComment
EngineComment

Definition at line 681 of file TTubo.cpp.

682  {
683  double EspesorPrin = 0.;
684  int EsPrincipal = 0, refrigerante = 0, EsFluida = 0;
685  int datoWAMer = 0;
686 
687  FDExtTramo = new double[FNTramos + 1];
688  FLTramo = new double[FNTramos + 1];
689 #ifdef usetry
690  try {
691 #endif
692 
693  FILE *fich = fopen(FileWAM, "r");
694  fsetpos(fich, &filepos);
695 
696  switch(tipomallado) {
697  case 1:
698  FTipoMallado = nmDistancia;
699  break;
700  case 2:
701  FTipoMallado = nmAngular;
702  break;
703  }
704 
705  if(FTipoMallado == nmAngular && ene < 0.) {
706  std::cout << "ERROR: El mallado no puede ser angular al no existir motor.Pipe: " << FNumeroTubo << std::endl;
707  throw Exception("");
708  }
709 
710  fscanf(fich, "%lf ", &FDExtTramo[0]);
711  for(int i = 1; i <= FNTramos; i++) {
712  fscanf(fich, "%lf %lf ", &FLTramo[i], &FDExtTramo[i]);
713  }
714  CalculoPuntosMalla(ene);
715 
716  if(FTipoCalcTempPared != nmTempConstante) {
717  FResistRadInt = new double[FNin];
718  FResistRadExt = new double[FNin];
719  FResistAxiAnt = new double[FNin];
720  FResistAxiPos = new double[FNin];
721  FCapInt = new double[FNin];
722  FCapMed = new double[FNin];
723  FCapExt = new double[FNin];
724 
725  if(Engine == NULL) {
726  fscanf(fich, "%lf %d ", &FDuracionCiclo, &FNumCiclosSinInerciaTermica);
727  }
728 
729  if(FTipoTransCal != nmPipaEscape && FTipoTransCal != nmPipaAdmision) {
730  fscanf(fich, "%lf %lf %d ", &FCoefExt, &FEmisividad, &refrigerante);
731  switch(refrigerante) {
732  case 0:
733  FTipRefrig = nmAire;
734  break;
735  case 1:
736  FTipRefrig = nmAgua;
737  break;
738  }
739  if(FTipRefrig == nmAgua)
740  fscanf(fich, "%lf ", &FTRefrigerante); /* Esta en degC */
741  } else {
742  FCoefExt = 1.;
743  FEmisividad = 0.5;
744  fscanf(fich, "%d", &datoWAMer);
745  }
746 
747  fscanf(fich, "%d ", &FNumCapas);
748  FCapa = new stCapa[FNumCapas];
749  EspesorPrin = 0.;
750  for(int i = 0; i < FNumCapas; i++) {
751  fscanf(fich, "%d %d ", &EsPrincipal, &EsFluida);
752  EsPrincipal == 0 ? FCapa[i].EsPrincipal = false : FCapa[i].EsPrincipal = true;
753  EsFluida == 0 ? FCapa[i].EsFluida = false : FCapa[i].EsFluida == true;
754  if(FCapa[i].EsFluida) {
755  fscanf(fich, "%lf %lf ", &FCapa[i].EmisividadInterior, &FCapa[i].EmisividadExterior);
756  } else {
757  fscanf(fich, "%lf %lf %lf %lf ", &FCapa[i].Density, &FCapa[i].CalorEspecifico, &FCapa[i].Conductividad,
758  &FCapa[i].Espesor);
759  fscanf(fich, "%lf %lf ", &FCapa[i].EmisividadInterior, &FCapa[i].EmisividadExterior);
760  }
761  if(FCapa[i].EsPrincipal) {
762  FEspesorIntPrin = EspesorPrin;
763  FEspesorPrin = FCapa[i].Espesor;
764  FDensidadPrin = FCapa[i].Density;
765  FCalEspPrin = FCapa[i].CalorEspecifico;
766  FConductPrin = FCapa[i].Conductividad;
767  EspesorPrin = 0.;
768  } else {
769  EspesorPrin += FCapa[i].Espesor;
770  }
771  }
772  // }
773  FEspesorExtPrin = EspesorPrin;
774  } else if(FTipoTransCal == nmPipaEscape || FTipoTransCal == nmPipaAdmision) {
775  fscanf(fich, "%d", &datoWAMer);
776  }
777 
778  fgetpos(fich, &filepos);
779  fclose(fich);
780 #ifdef usetry
781  } catch(exception & N) {
782  std::cout << "ERROR: TTubo::LeeDatosGeometricoTubo en el tubo: " << FNumeroTubo << std::endl;
783  std::cout << "Tipo de error: " << N.what() << std::endl;
784  throw Exception(N.what());
785  }
786 #endif
787 }

◆ PutDeltaTime()

void TTubo::PutDeltaTime ( double  valor)

Sets the time step.

Sets the current time step.

Parameters
valorTime-step. [s]

Definition at line 5517 of file TTubo.cpp.

5517  {
5518  FDeltaTime = valor;
5519 }

References FDeltaTime.

◆ PutTime0()

void TTubo::PutTime0 ( double  valor)

Sets the current time.

Sets the current time.

Parameters
valorCurrent time. [s]

Definition at line 5521 of file TTubo.cpp.

5521  {
5522  FTime0 = valor;
5523 }

References FTime0.

◆ PutTime1()

void TTubo::PutTime1 ( double  valor)

Sets the time after the following time-step.

Sets the time after the following time-step.

Parameters
valorTime after the following time-step. [s]

Definition at line 5525 of file TTubo.cpp.

5525  {
5526  FTime1 = valor;
5527 }

References FTime1.

◆ PutTPTubo()

void TTubo::PutTPTubo ( int  k,
int  i,
double  valor 
)

Sets the wall temperature at a given cell and node.

Sets the wall temperature at a given cell and node.

Parameters
kNode.
iCell.
valorWall temperature.

Definition at line 5529 of file TTubo.cpp.

5529  {
5530  FTPTubo[k][i] = valor;
5531 }

◆ PutVelPro()

void TTubo::PutVelPro ( int  i,
double  valor 
)

Sets the integrated gas velocity.

Sets the integrated gas velocity at a given cell.

Parameters
iCell.
valorIntegrated gas velocity. [m / s]

Definition at line 5533 of file TTubo.cpp.

5533  {
5534  FVelPro[i] = valor;
5535 }

◆ ReadAverageResultsTubo()

void TTubo::ReadAverageResultsTubo ( const char *  FileWAM,
fpos_t &  filepos,
bool  HayMotor 
)

Comment

Parameters
FileWAMComment
fileposComment
HayMotorComment

Definition at line 2456 of file TTubo.cpp.

2456  {
2457  int NumVars = 0, TipoVar = 0;
2458 #ifdef usetry
2459  try {
2460 #endif
2461 
2462  FILE *fich = fopen(FileWAM, "r");
2463  fsetpos(fich, &filepos);
2464 
2465  fscanf(fich, "%d ", &FNumResMedios);
2466  ResultadosMedios = new stResMediosTubo[FNumResMedios];
2467  FTiempoMedSUM = 0.;
2468  FControlResMed = 1;
2469 
2470  for(int i = 0; i < FNumResMedios; i++) {
2471  ResultadosMedios[i].TemperaturaGas = false;
2472  ResultadosMedios[i].TemperaturaGasSUM = 0.;
2473  ResultadosMedios[i].TemperaturaGasMED = 0;
2474  ResultadosMedios[i].Pressure = false;
2475  ResultadosMedios[i].PresionSUM = 0.;
2476  ResultadosMedios[i].PresionMED = 0.;
2477  ResultadosMedios[i].Velocity = false;
2478  ResultadosMedios[i].VelocidadSUM = 0.;
2479  ResultadosMedios[i].VelocidadMED = 0.;
2480  ResultadosMedios[i].Massflow = false;
2481  ResultadosMedios[i].GastoSUM = 0.;
2482  ResultadosMedios[i].GastoMED = 0.;
2483  ResultadosMedios[i].TemperaturaInternaPared = false;
2484  ResultadosMedios[i].TemperaturaInternaParedSUM = 0.;
2485  ResultadosMedios[i].TemperaturaInternaParedMED = 0.;
2486  ResultadosMedios[i].TemperaturaIntermediaPared = false;
2487  ResultadosMedios[i].TemperaturaIntermediaParedSUM = 0.;
2488  ResultadosMedios[i].TemperaturaIntermediaParedMED = 0.;
2489  ResultadosMedios[i].TemperaturaExternaPared = false;
2490  ResultadosMedios[i].TemperaturaExternaParedSUM = 0.;
2491  ResultadosMedios[i].TemperaturaExternaParedMED = 0.;
2492  ResultadosMedios[i].NITmedio = false;
2493  ResultadosMedios[i].NITmedioSUM = 0;
2494  ResultadosMedios[i].NITmedioMED = 0;
2495  ResultadosMedios[i].CoefPelInterior = false;
2496  ResultadosMedios[i].CoefPelInteriorSUM = 0.;
2497  ResultadosMedios[i].CoefPelInteriorMED = 0.;
2498  ResultadosMedios[i].FraccionMasicaEspecies = false;
2499  ResultadosMedios[i].FraccionSUM = new double[FNumeroEspecies - FIntEGR];
2500  ResultadosMedios[i].FraccionMED = new double[FNumeroEspecies - FIntEGR];
2501  for(int j = 0; j < FNumeroEspecies - FIntEGR; j++) {
2502  ResultadosMedios[i].FraccionSUM[j] = 0.;
2503  ResultadosMedios[i].FraccionMED[j] = 0.;
2504  }
2505  ResultadosMedios[i].PonderacionSUM = 0.;
2506  ResultadosMedios[i].GastoPonderacionSUM = 0.;
2507 
2508  fscanf(fich, "%lf %d ", &ResultadosMedios[i].Distancia, &NumVars);
2509 
2510  for(int j = 0; j < NumVars; j++) {
2511  fscanf(fich, "%d ", &TipoVar);
2512  switch(TipoVar) {
2513  case 0:
2514  ResultadosMedios[i].TemperaturaGas = true;
2515  break;
2516  case 1:
2517  ResultadosMedios[i].Pressure = true;
2518  break;
2519  case 2:
2520  ResultadosMedios[i].Velocity = true;
2521  break;
2522  case 3:
2523  ResultadosMedios[i].Massflow = true;
2524  break;
2525  case 4:
2526  ResultadosMedios[i].TemperaturaInternaPared = true;
2527  break;
2528  case 5:
2529  ResultadosMedios[i].TemperaturaIntermediaPared = true;
2530  break;
2531  case 6:
2532  ResultadosMedios[i].TemperaturaExternaPared = true;
2533  break;
2534  case 7:
2535  ResultadosMedios[i].NITmedio = true;
2536  if(!HayMotor) {
2537  std::cout << "ERROR: No puedes pedir el NIT como resultado si no hay motor" << std::endl;
2538  throw Exception(" ");
2539  }
2540  break;
2541  case 8:
2542  ResultadosMedios[i].CoefPelInterior = true;
2543  break;
2544  case 9:
2545  ResultadosMedios[i].FraccionMasicaEspecies = true;
2546  break;
2547  default:
2548  std::cout << "WARNING: El tipo de variable seleccionada para la salida de resultados medios no es valida" << std::endl;
2549  };
2550 
2551  }
2552 
2553  }
2554 
2555  fgetpos(fich, &filepos);
2556  fclose(fich);
2557 #ifdef usetry
2558  } catch(exception & N) {
2559  std::cout << "ERROR: TTubo::ReadAverageResults en el tubo: " << FNumeroTubo << std::endl;
2560  std::cout << "Tipo de error: " << N.what() << std::endl;
2561  throw Exception(N.what());
2562  }
2563 #endif
2564 }

◆ ReadInstantaneousResultsTubo()

void TTubo::ReadInstantaneousResultsTubo ( const char *  FileWAM,
fpos_t &  filepos,
bool  HayMotor 
)

Comment

Parameters
FileWAMComment
fileposComment
HayMotorComment

Definition at line 2691 of file TTubo.cpp.

2691  {
2692  int NumVars = 0, TipoVar = 0;
2693 #ifdef usetry
2694  try {
2695 #endif
2696 
2697  FILE *fich = fopen(FileWAM, "r");
2698  fsetpos(fich, &filepos);
2699 
2700  fscanf(fich, "%d ", &FNumResInstant); // Puntos del tubo en los que se piden resultados instantaneos
2701  ResultInstantaneos = new stResInstantTubo[FNumResInstant];
2702 
2703  for(int i = 0; i < FNumResInstant; i++) {
2704  ResultInstantaneos[i].Pressure = false;
2705  ResultInstantaneos[i].PresionINS = 0.;
2706  ResultInstantaneos[i].Velocity = false;
2707  ResultInstantaneos[i].VelocidadINS = 0.;
2708  ResultInstantaneos[i].TemperaturaGas = false;
2709  ResultInstantaneos[i].TemperaturaGasINS = 0.;
2710  ResultInstantaneos[i].FlujoMasico = false;
2711  ResultInstantaneos[i].FlujoMasicoINS = 0.;
2712  ResultInstantaneos[i].VelocidadDerecha = false;
2713  ResultInstantaneos[i].VelocidadDerechaINS = 0.;
2714  ResultInstantaneos[i].VelocidadIzquierda = false;
2715  ResultInstantaneos[i].VelocidadIzquierdaINS = 0.;
2716  ResultInstantaneos[i].PresionDerecha = false;
2717  ResultInstantaneos[i].PresionDerechaINS = 0.;
2718  ResultInstantaneos[i].PresionIzquierda = false;
2719  ResultInstantaneos[i].PresionIzquierdaINS = 0.;
2720  ResultInstantaneos[i].NIT = false;
2721  ResultInstantaneos[i].NITINS = 0.;
2722  ResultInstantaneos[i].TemperaturaInternaPared = false;
2723  ResultInstantaneos[i].TemperaturaInternaParedINS = 0.;
2724  ResultInstantaneos[i].TemperaturaIntermediaPared = false;
2725  ResultInstantaneos[i].TemperaturaIntermediaParedINS = 0.;
2726  ResultInstantaneos[i].TemperaturaExternaPared = false;
2727  ResultInstantaneos[i].TemperaturaExternaParedINS = 0.;
2728  ResultInstantaneos[i].CoefPelInterior = false;
2729  ResultInstantaneos[i].CoefPelInteriorINS = 0.;
2730  ResultInstantaneos[i].FraccionMasicaEspecies = false;
2731  ResultInstantaneos[i].FraccionINS = new double[FNumeroEspecies - FIntEGR];
2732  ResultInstantaneos[i].Gamma = false;
2733  for(int j = 0; j < FNumeroEspecies - FIntEGR; j++) {
2734  ResultInstantaneos[i].FraccionINS[j] = 0.;
2735  }
2736 
2737  fscanf(fich, "%lf %d ", &ResultInstantaneos[i].Distancia, &NumVars);
2738 
2739  for(int j = 0; j < NumVars; j++) {
2740  fscanf(fich, "%d ", &TipoVar);
2741  switch(TipoVar) {
2742  case 0:
2743  ResultInstantaneos[i].Pressure = true;
2744  break;
2745  case 1:
2746  ResultInstantaneos[i].Velocity = true;
2747  break;
2748  case 2:
2749  ResultInstantaneos[i].TemperaturaGas = true;
2750  break;
2751  case 3:
2752  ResultInstantaneos[i].FlujoMasico = true;
2753  break;
2754  case 4:
2755  ResultInstantaneos[i].VelocidadDerecha = true;
2756  break;
2757  case 5:
2758  ResultInstantaneos[i].VelocidadIzquierda = true;
2759  break;
2760  case 6:
2761  ResultInstantaneos[i].PresionDerecha = true;
2762  break;
2763  case 7:
2764  ResultInstantaneos[i].PresionIzquierda = true;
2765  break;
2766  case 8:
2767  ResultInstantaneos[i].NIT = true;
2768  if(!HayMotor) {
2769  std::cout << "ERROR: No puedes pedir el NIT como resultado si no hay motor" << std::endl;
2770  throw Exception(" ");
2771  }
2772  break;
2773  case 9:
2774  ResultInstantaneos[i].TemperaturaInternaPared = true;
2775  break;
2776  case 10:
2777  ResultInstantaneos[i].TemperaturaIntermediaPared = true;
2778  break;
2779  case 11:
2780  ResultInstantaneos[i].TemperaturaExternaPared = true;
2781  break;
2782  case 12:
2783  ResultInstantaneos[i].CoefPelInterior = true;
2784  break;
2785  case 13:
2786  ResultInstantaneos[i].FraccionMasicaEspecies = true;
2787  break;
2788  case 14:
2789  ResultInstantaneos[i].Gamma = true;
2790  break;
2791  default:
2792  std::cout << "WARNING: El tipo de variable seleccionada para la salida de resultados instantaneos no es valida" <<
2793  std::endl;
2794  }
2795  }
2796  }
2797 
2798  fgetpos(fich, &filepos);
2799  fclose(fich);
2800 #ifdef usetry
2801  } catch(exception & N) {
2802  std::cout << "ERROR: TTubo::ReadInstantaneousResults en el tubo: " << FNumeroTubo << std::endl;
2803  std::cout << "Tipo de error: " << N.what() << std::endl;
2804  throw Exception(N.what());
2805  }
2806 #endif
2807 }

◆ ReduccionFlujoSubsonico()

void TTubo::ReduccionFlujoSubsonico ( )

Comment

Definition at line 2390 of file TTubo.cpp.

2390  {
2391  double Machx = 0., Machy = 0., Velocidady = 0., Sonidoy = 0.;
2392 #ifdef usetry
2393  try {
2394 #endif
2395 
2396  for(int i = 0; i < FNin; i++) {
2397  Machx = FVelocidad0[i] / FAsonido0[i];
2398  if(-1. >= Machx || Machx > 1.) {
2399  Machy = Machx / fabs(Machx) * sqrt((pow2(Machx) + 2. / FGamma1[i]) / (FGamma4[i] * pow2(Machx) - 1.));
2400  Sonidoy = FAsonido0[i] * sqrt((FGamma1[i] / 2. * pow2(Machx) + 1.) / (FGamma1[i] / 2. * pow2(Machy) + 1.));
2401 
2402  Velocidady = Sonidoy * Machy;
2403  FAsonido0[i] = Sonidoy;
2404  FVelocidad0[i] = Velocidady;
2405  }
2406  }
2407 #ifdef usetry
2408  } catch(exception & N) {
2409  std::cout << "ERROR: TTubo::ReduccionFlujoSubsonico en el tubo: " << FNumeroTubo << std::endl;
2410  std::cout << "Tipo de error: " << N.what() << std::endl;
2411  throw Exception(N.what());
2412  }
2413 #endif
2414 }

References pow2().

Here is the call graph for this function:

◆ ReduccionFlujoSubsonicoFCT()

void TTubo::ReduccionFlujoSubsonicoFCT ( )

Comment

Definition at line 2419 of file TTubo.cpp.

2419  {
2420  double Machx = 0., Machy = 0., Velocidady = 0., Sonidoy = 0.;
2421  double velocidad = 0., asonido = 0., presion = 0.;
2422 #ifdef usetry
2423  try {
2424 #endif
2425 
2426  for(int i = 1; i < FNin - 1; i++) {
2427  velocidad = FU1[1][i] / FU1[0][i] / __cons::ARef;
2428  presion = __units::PaToBar((FU1[2][i] - FU1[1][i] * velocidad * __cons::ARef / 2.0) * FGamma1[i] / FArea[i]);
2429  asonido = sqrt(FGamma[i] * __units::BarToPa(presion) * FArea[i] / FU1[0][i] / __cons::ARef2);
2430  Machx = velocidad / asonido;
2431  if(-1. >= Machx || Machx > 1.) {
2432  Machy = Machx / fabs(Machx) * sqrt((pow2(Machx) + 2. / FGamma1[i]) / (FGamma4[i] * pow2(Machx) - 1.));
2433  Sonidoy = asonido * sqrt((FGamma1[i] / 2. * pow2(Machx) + 1.) / (FGamma1[i] / 2. * pow2(Machy) + 1.));
2434 
2435  Velocidady = Sonidoy * Machy;
2436  asonido = Sonidoy;
2437  velocidad = Velocidady;
2438  FU1[0][i] = FGamma[i] * __units::BarToPa(presion) / pow2(asonido * __cons::ARef) * FArea[i];
2439  FU1[1][i] = FU1[0][i] * velocidad * __cons::ARef;
2440  FU1[2][i] = FArea[i] * __units::BarToPa(presion) / FGamma1[i] + FU1[1][i] * velocidad * __cons::ARef / 2.0;
2441 
2442  }
2443  }
2444 #ifdef usetry
2445  } catch(exception & N) {
2446  std::cout << "ERROR: TTubo::ReduccionFlujoSubsonicoFCT en el tubo: " << FNumeroTubo << std::endl;
2447  std::cout << "Tipo de error: " << N.what() << std::endl;
2448  throw Exception(N.what());
2449  }
2450 #endif
2451 }

◆ SalidaGeneralTubos()

void TTubo::SalidaGeneralTubos ( stEspecies DatosEspecies) const

Comment

Parameters
DatosEspeciesComment

Definition at line 4343 of file TTubo.cpp.

4343  {
4344 #ifdef usetry
4345  try {
4346 #endif
4347  if(FNumResMedios > 0) {
4348  printf("__________________________________\n");
4349  printf(" AVERAGE RESULTS IN PIPES \n");
4350  printf("__________________________________\n\n\n");
4351  for(int i = 0; i < FNumResMedios; i++) {
4352  std::cout << "Average results in point " << i << " place in pipe " << FNumeroTubo;
4353  std::cout << " at " << ResultadosMedios[i].Distancia << " metres from left end" << std::endl;
4354  if(ResultadosMedios[i].TemperaturaGas)
4355  std::cout << "Average Temperature = " << ResultadosMedios[i].TemperaturaGasMED << " C" << std::endl;
4356  if(ResultadosMedios[i].Pressure)
4357  std::cout << "Average Pressure = " << ResultadosMedios[i].PresionMED << " bar" << std::endl;
4358  if(ResultadosMedios[i].Velocity)
4359  std::cout << "Average Velocity = " << ResultadosMedios[i].VelocidadMED << " m/s" << std::endl;
4360  if(ResultadosMedios[i].Massflow)
4361  std::cout << "Average Massflow = " << ResultadosMedios[i].GastoMED << " kg/s" << std::endl;
4362  if(ResultadosMedios[i].NITmedio)
4363  std::cout << "NIT Medio = " << ResultadosMedios[i].NITmedioMED << " Watts" << std::endl << std::endl;
4364  // std::cout << "Fraccion Masica Media de " << DatosEspecies[i].Nombre << ": " << ResultadosMedios[i].FraccionMED[i] << std::endl;
4365  }
4366  }
4367 #ifdef usetry
4368  } catch(exception & N) {
4369  std::cout << "ERROR: TTubo::SalidaGeneralTubos en el tubo nÂș: " << FNumeroTubo << std::endl;
4370  std::cout << "Tipo de error: " << N.what() << std::endl;
4371  throw Exception(N.what());
4372  }
4373 #endif
4374 }

The documentation for this class was generated from the following files:
zbrent
double zbrent(T &func, const double &x1, const double &x2, const double &tol)
Solves a function using Brent's method.
Definition: Math_wam.h:352
TTubo::getNodoDer
int getNodoDer() const
Gets the right-hand side node.
Definition: TTubo.cpp:5456
stPathOrigin
Definition: BoundaryFunctions.h:545
TTubo::FTime1
double FTime1
Time at following time step.
Definition: TTubo.h:734
pow075
T pow075(T x)
Returns x to the power of 0.75.
Definition: Math_wam.h:153
stCapa
Definition: Globales.h:1394
pow150
T pow150(T x)
Returns x to the power of 1.5.
Definition: Math_wam.h:140
TTubo::Interpola_Caracteristica
double Interpola_Caracteristica(double entropia, int signo, int extremo, double DeltaTiempo)
Definition: TTubo.cpp:4584
TTubo::FDeltaTime
double FDeltaTime
Time step.
Definition: TTubo.h:754
pow025
T pow025(T x)
Returns x to the power of 0.25.
Definition: Math_wam.h:127
PutLabel
std::string PutLabel(int idx)
Returns an integer.
Definition: labels.cpp:475
stResInstantTubo
Definition: Globales.h:795
Exception
Custom exception class.
Definition: Exception.hpp:39
pow4
T pow4(T x)
Returns x to the power of 4.
Definition: Math_wam.h:114
TTubo::FTime0
double FTime0
Time at current time step.
Definition: TTubo.h:712
stResMediosTubo
Definition: Globales.h:756
stCharOrigin
Definition: BoundaryFunctions.h:517
pow2
T pow2(T x)
Returns x to the power of 2.
Definition: Math_wam.h:88
TCCUnionEntreTubos
Definition: TCCUnionEntreTubos.h:37
TTubo::Interpola_Entropia
double Interpola_Entropia(nmPipeEnd TipoExtremoTubo, double DeltaTiempo)
Definition: TTubo.cpp:4441