1 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 // + This file is part of enGrid. +
5 // + Copyright 2008-2016 enGits GmbH +
7 // + enGrid is free software: you can redistribute it and/or modify +
8 // + it under the terms of the GNU General Public License as published by +
9 // + the Free Software Foundation, either version 3 of the License, or +
10 // + (at your option) any later version. +
12 // + enGrid is distributed in the hope that it will be useful, +
13 // + but WITHOUT ANY WARRANTY; without even the implied warranty of +
14 // + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +
15 // + GNU General Public License for more details. +
17 // + You should have received a copy of the GNU General Public License +
18 // + along with enGrid. If not, see <http://www.gnu.org/licenses/>. +
20 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
22 #include "guiypluscalculator.h"
24 GuiYPlusCalculator::GuiYPlusCalculator()
26 m_Ui
.m_LineEditL
->setValidator(new QDoubleValidator());
27 m_Ui
.m_LineEditRe
->setValidator(new QDoubleValidator());
28 m_Ui
.m_LineEditMu
->setValidator(new QDoubleValidator());
29 m_Ui
.m_LineEditU
->setValidator(new QDoubleValidator());
30 m_Ui
.m_LineEditRho
->setValidator(new QDoubleValidator());
31 m_Ui
.m_LineEditY
->setValidator(new QDoubleValidator());
32 m_Ui
.m_LineEditYPlus
->setValidator(new QDoubleValidator());
33 connect(m_Ui
.m_LineEditL
, SIGNAL(editingFinished()), this, SLOT(changedL()));
34 connect(m_Ui
.m_LineEditMu
, SIGNAL(editingFinished()), this, SLOT(changedMu()));
35 connect(m_Ui
.m_LineEditRe
, SIGNAL(editingFinished()), this, SLOT(changedRe()));
36 connect(m_Ui
.m_LineEditRho
, SIGNAL(editingFinished()), this, SLOT(changedRho()));
37 connect(m_Ui
.m_LineEditU
, SIGNAL(editingFinished()), this, SLOT(changedU()));
38 connect(m_Ui
.m_LineEditY
, SIGNAL(editingFinished()), this, SLOT(changedY()));
39 connect(m_Ui
.m_LineEditYPlus
, SIGNAL(editingFinished()), this, SLOT(changedYPlus()));
40 connect(m_Ui
.m_ComboBoxFlowType
, SIGNAL(currentIndexChanged(QString
)), this, SLOT(changedFlowType(QString
)));
43 double GuiYPlusCalculator::cfPlate(double Re_x
)
45 return 0.455/pow(log(0.06*Re_x
), 2.0);
48 double GuiYPlusCalculator::cfPipe(double Re
)
51 for (int iter
= 0; iter
< 100; ++iter
) {
52 lam
= 1.0/pow((2*log10(Re
*sqrt(lam
)) - 0.8), 2.0);
57 void GuiYPlusCalculator::before()
59 m_Calculating
= false;
60 m_ExternalFlow
= false;
65 void GuiYPlusCalculator::getValues()
68 m_L
= m_Ui
.m_LineEditL
->text().toDouble();
69 m_U
= m_Ui
.m_LineEditU
->text().toDouble();
70 m_Re
= m_Ui
.m_LineEditRe
->text().toDouble();
71 m_Mu
= m_Ui
.m_LineEditMu
->text().toDouble();
72 m_Rho
= m_Ui
.m_LineEditRho
->text().toDouble();
73 m_Y
= m_Ui
.m_LineEditY
->text().toDouble();
74 m_YPlus
= m_Ui
.m_LineEditYPlus
->text().toDouble();
75 m_ExternalFlow
= m_Ui
.m_ComboBoxFlowType
->currentText() == "external";
78 void GuiYPlusCalculator::setValues()
81 num
.setNum(m_L
); m_Ui
.m_LineEditL
->setText(num
);
82 num
.setNum(m_U
); m_Ui
.m_LineEditU
->setText(num
);
83 num
.setNum(m_Re
); m_Ui
.m_LineEditRe
->setText(num
);
84 num
.setNum(m_Mu
); m_Ui
.m_LineEditMu
->setText(num
);
85 num
.setNum(m_Rho
); m_Ui
.m_LineEditRho
->setText(num
);
86 num
.setNum(m_Y
); m_Ui
.m_LineEditY
->setText(num
);
87 num
.setNum(m_YPlus
); m_Ui
.m_LineEditYPlus
->setText(num
);
88 m_Calculating
= false;
91 void GuiYPlusCalculator::calc()
93 double nu
= m_Mu
/m_Rho
;
95 double cf
= cfPlate(m_Re
);
96 if (!m_ExternalFlow
) {
99 m_YPlus
= m_U
*m_Y
/nu
*sqrt(0.5*cf
);
103 void GuiYPlusCalculator::changedFlowType(QString
)
112 void GuiYPlusCalculator::changedL()
121 void GuiYPlusCalculator::changedMu()
130 void GuiYPlusCalculator::changedRe()
136 m_Re
= m_Ui
.m_LineEditRe
->text().toDouble();
137 m_U
= m_Re
*m_Mu
/(m_Rho
*m_L
);
141 void GuiYPlusCalculator::changedRho()
147 m_Rho
= m_Ui
.m_LineEditRho
->text().toDouble();
151 void GuiYPlusCalculator::changedU()
160 void GuiYPlusCalculator::changedY()
169 void GuiYPlusCalculator::changedYPlus()
175 double nu
= m_Mu
/m_Rho
;
177 double cf
= cfPlate(m_Re
);
178 if (!m_ExternalFlow
) {
181 m_YPlus
= m_Ui
.m_LineEditYPlus
->text().toDouble();
182 m_Y
= sqrt(2.0/cf
)*m_YPlus
*nu
/m_U
;