00001
00023 #ifndef DATA_H
00024 #define DATA_H
00025
00026 #include <QDebug>
00027 #include <QDataStream>
00028 #include <QStringList>
00029 #include <QTextStream>
00030 #include <QVariant>
00031 #include <math.h>
00032 #include <iostream>
00033
00034 #include "../MultiPhase/src/defines.h"
00035
00036
00037 enum variable_t {
00038 VARIABLE_USG = 0,
00039 VARIABLE_USL = 1,
00040 VARIABLE_LIQUIDDENSITY = 2,
00041 VARIABLE_LIQUIDVISCOSITY = 3,
00042 VARIABLE_GASDENSITY = 4,
00043 VARIABLE_GASVISCOSITY = 5,
00044 VARIABLE_GASTEMPERATURE = 6,
00045 VARIABLE_GASPRESSURE = 7,
00046 VARIABLE_SURFACETENSION = 8,
00047 VARIABLE_ANGLE = 9,
00048 VARIABLE_DIAMETER = 10,
00049 VARIABLE_ROUGHNESS = 11
00050 };
00051
00052 enum regimetype_t {
00053 REGIME_ANNULAR = 0,
00054 REGIME_DISPERSED = 1,
00055 REGIME_SLUG = 2,
00056 REGIME_STRATIFIED = 3,
00057
00058 REGIME_CHURN = 4,
00059 REGIME_PLUG = 5,
00060 REGIME_BUBBLE = 6,
00061 REGIME_WISPY_ANNULAR = 7,
00062 REGIME_STRATIFIED_WAVE = 8,
00063 REGIME_ANNULAR_DISPERSED = 9,
00064
00065 REGIME_DYNAMIC_MINIMUM_HOLDUP = 10
00066 };
00067
00068 class Data {
00069 public:
00070 Data();
00071 Data(const Data *copyData);
00072 bool equals(Data *compareWith) const;
00073
00074
00075 inline double alpha() const { return _alpha;}
00076 inline double angle() const { return _angle;}
00077 inline double angleRad() const { return (_angle * PI / 180); }
00078 inline double viscosityLiquid() const { return _viscosityLiquid;}
00079 inline double viscosityGas() const { return _viscosityGas;}
00080 inline double densityLiquid() const { return _densityLiquid;}
00081 inline double densityGas() const { return _densityGas;}
00082 inline double pressureGas() const { return _pressureGas;}
00083 inline double temperatureGas() const { return _temperatureGas;}
00084 inline double surfaceTension() const { return _surfaceTension;}
00085 inline double Usl() const { return _Usl;}
00086 inline double Usg() const { return _Usg;}
00087 inline double diameter() const { return _diameter;}
00088 inline double roughness() const { return _roughness;}
00089 inline double variable() const { return *_variable; }
00090 inline double variableMax() const { return _variableMax; }
00091 inline double variableMin() const { return _variableMin; }
00092 inline regimetype_t regimeType() const { return _regimeType; }
00093 inline variable_t variableType() const { return _variableType; }
00094
00095
00096 inline double slipRelationParameter() const { if (angle() > 60) { return 1.0; } else { return 0.95; } };
00097
00098 inline QString alphaName() const { return QString("Alpha"); }
00099 inline QString angleName() const { return QString("Angle");}
00100 inline QString viscosityLiquidName() const { return QString("Liquid Viscosity");}
00101 inline QString viscosityGasName() const { return QString("Gas Viscosity");}
00102 inline QString densityLiquidName() const { return QString("Liquid Density");}
00103 inline QString densityGasName() const { return QString("Gas Density");}
00104 inline QString pressureGasName() const { return QString("Gas Pressure");}
00105 inline QString temperatureGasName() const { return QString("Gas Temperature");}
00106 inline QString surfaceTensionName() const { return QString("Surface Tension");}
00107 inline QString UslName() const { return QString("Usl");}
00108 inline QString UsgName() const { return QString("Usg");}
00109 inline QString diameterName() const { return QString("Diameter");}
00110 inline QString roughnessName() const { return QString("Roughness");}
00111 inline QString regimeName() const { return _regimeName; }
00112 inline QString variableName() const { return _variableName; }
00113 QString regimeNameShort(int length) const;
00114 inline QString regimeTransitionName() const { return _regimeTransitionName; }
00115
00116 inline double Ul() const { return _Usl/(1-_alpha); }
00117 inline double Ug() const { return _Usg/_alpha; }
00118 inline double area() const { return 3.1415*_diameter*_diameter/4; };
00119
00120 double reynoldsLiquid();
00121 inline double reynoldsGas() {return densityGas()*Ug()*hdiameterGas()/viscosityGas();}
00122 inline double hdiameterLiquid() { return 1.0; }
00123 inline double hdiameterGas() { return 1.0; }
00124 inline double hdiameter() { return 1.0; }
00125
00126 void setAlpha(double alpha);
00127 void setVariable(double variable);
00128 void setAngle(double angle);
00129 void setViscosityLiquid(double viscosityLiquid);
00130 void setViscosityGas(double viscosityGas);
00131 void setDensityLiquid(double densityLiquid);
00132 void setDensityGas(double densityGas);
00133 void setPressureGas(double pressureGas);
00134 void setTemperatureGas(double temperatureGas);
00135 void setSurfaceTension(double surfaceTension);
00136 inline void setUsl(double Usl) { _Usl = Usl; };
00137 void setUsg(double Usg);
00138 void setDiameter(double diameter);
00139 void setRoughness(double roughness);
00140
00141 void setVariableMin(double variableMin);
00142 void setVariableMax(double variableMax);
00143 void setVariableType(variable_t variableType);
00144 void setRegimeType(regimetype_t regimeType);
00145 void setRegimeTransitionName(QString regimeTransitionName);
00146
00147 void writeData(QTextStream &out, bool flow = true) const;
00148 static Data * readData(QString dataStream, bool flow = true);
00149
00150 QString dataInformation() const;
00151
00152 private:
00153 double _alpha;
00154 double _angle;
00155 double _viscosityLiquid;
00156 double _viscosityGas;
00157 double _densityLiquid;
00158 double _densityGas;
00159 double _pressureGas;
00160 double _temperatureGas;
00161 double _surfaceTension;
00162 double _Usl;
00163 double _Usg;
00164 double _diameter;
00165 double _roughness;
00166 double *_variable;
00167 double _variableMin;
00168 double _variableMax;
00169 QString _variableName;
00170 QString _regimeTransitionName;
00171 variable_t _variableType;
00172 QString _regimeName;
00173 regimetype_t _regimeType;
00174 };
00175
00176 #endif // DATA_H
00177
00178 #ifndef QT_NO_DEBUG_STREAM
00179 QDebug operator<<(QDebug dbg, const Data &d);
00180 #endif