Skip to content

Commit fb2add3

Browse files
committed
Updated dependent scattering warning message
1 parent 400ede7 commit fb2add3

4 files changed

Lines changed: 98 additions & 32 deletions

File tree

src/app/dialog/mainwindowsupport.cpp

Lines changed: 93 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ void MainWindowSupport::ProcessMonoDisperse(Ui_MainWindow *ui, Parameters *para)
333333
if(mCalc->CheckIndependentScattering(para, clearanceToWavelength, sizeParameter, volFraction,
334334
criticalWavelength, strRegime, flagVolFrac))
335335
{
336-
DisplayScatteringRegimeWarning(clearanceToWavelength, sizeParameter, volFraction, criticalWavelength, strRegime);
336+
PrepareScatteringRegimeWarning(clearanceToWavelength, sizeParameter, volFraction, criticalWavelength, strRegime);
337337
}
338338
}
339339

@@ -363,7 +363,7 @@ void MainWindowSupport::ProcessPolyDisperse(Ui_MainWindow *ui, Parameters *para)
363363
if(mCalc->CheckIndependentScattering(para, clearanceToWavelength, sizeParameter, volFraction,
364364
criticalWavelength, strRegime, flagVolFrac))
365365
{
366-
DisplayScatteringRegimeWarning(clearanceToWavelength, sizeParameter, volFraction, criticalWavelength, strRegime);
366+
PrepareScatteringRegimeWarning(clearanceToWavelength, sizeParameter, volFraction, criticalWavelength, strRegime);
367367
}
368368
}
369369

@@ -623,42 +623,109 @@ void MainWindowSupport::ReadCustomData(Parameters *para, QString fileName, bool
623623
}
624624
}
625625

626-
void MainWindowSupport::DisplayScatteringRegimeWarning(double clearanceToWavelength, double sizeParameter,
626+
//Prepare Scattering Regime Warning
627+
void MainWindowSupport::PrepareScatteringRegimeWarning(double clearanceToWavelength, double sizeParameter,
627628
double volFraction, double criticalWavelength,
628629
QString strRegime)
629630
{
630-
QString strTienDorlen = (clearanceToWavelength > 0.5)
631-
? "<font color='green'>Independent</font>"
632-
: "<font color='red'>Dependent</font>";
631+
QString strClearance = QString::number(clearanceToWavelength, 'f', 3);
633632

634-
QString strGaly = "<font color='red'>Dependent</font>";
633+
// Logic, Threshold Strings and Hyperlink for Tien and Drolen
634+
bool isIndependentTien = (clearanceToWavelength > 0.5);
635+
QString strTienResult = isIndependentTien ?
636+
QString("<font color='green'>Independent</font> (c/&lambda;=%1)").arg(strClearance) :
637+
QString("<font color='red'>Dependent</font> (c/&lambda;=%1)").arg(strClearance);
638+
QString strTienCriteria = "c/&lambda; > 0.5";
639+
QString strTienDorlenLink = "<a href='https://doi.org/10.1615/AnnualRevHeatTransfer.v1.30' style='color: #0000EE;'>Tien and Drolen (1987)</a>";
635640

641+
// Logic, Threshold Strings and Hyperlink for Galy et al.
642+
bool isIndependentGaly = false;
643+
QString strGalyCriteria;
644+
QString strGalyLink = "<a href='https://doi.org/10.1016/j.jqsrt.2020.106924' style='color: #0000EE;'>Galy et al. (2020)</a>";
645+
646+
if (volFraction <= 0.006)
647+
{
648+
if (sizeParameter > 0.388)
649+
{
650+
if (sizeParameter <= 2.0)
651+
{
652+
isIndependentGaly = (clearanceToWavelength > 2.0);
653+
strGalyCriteria = "c/&lambda; > 2.0 (0.388 &le; &chi; &le; 2)";
654+
}
655+
else
656+
{
657+
isIndependentGaly = (clearanceToWavelength > 5.0);
658+
strGalyCriteria = "c/&lambda; > 5.0 (&chi; > 2)";
659+
}
660+
}
661+
else
662+
{
663+
isIndependentGaly = true;
664+
strGalyCriteria = "Independent (&chi; &le; 0.388)";
665+
}
666+
}
667+
else
668+
{
669+
if (sizeParameter <= 2.0)
670+
{
671+
isIndependentGaly = (clearanceToWavelength > 2.0);
672+
strGalyCriteria = "c/&lambda; > 2.0 (&chi; &le; 2)";
673+
}
674+
else
675+
{
676+
isIndependentGaly = (clearanceToWavelength > 5.0);
677+
strGalyCriteria = "c/&lambda; > 5.0 (&chi; > 2)";
678+
}
679+
}
680+
QString strGalyResult = isIndependentGaly ?
681+
QString("<font color='green'>Independent</font> (c/&lambda;=%1)").arg(strClearance) :
682+
QString("<font color='red'>Dependent</font> (c/&lambda;=%1)").arg(strClearance);
683+
684+
// --- Detailed Context Section ---
685+
QString strRegimeContext =
686+
"<b>Regime Definitions:</b><br>"
687+
"• Low Concentration Regime:<b> f<sub>v</sub> &le; 0.006</b><br>"
688+
"• Transitional Regime:<b> 0.006 &lt; f<sub>v</sub> &le; 0.1</b><br>"
689+
"• High Concentration Regime:<b> f<sub>v</sub> &gt; 0.1</b>";
690+
691+
692+
// --- Constructing the Message ---
636693
QString msg = QString(
637-
"<b>Dependent Scattering Warning</b><br>"
638-
"The current configuration deviates from the independent scattering regime. "
639-
"Since MieSimulatorGUI is best suited for dilute mixtures, results at this "
640-
"concentration should be interpreted with caution.<br><br>"
641-
"<b>Independent or Dependent:</b><br>"
642-
"• Per <b>Tien and Drolen (1987):</b> %1<br>"
643-
"• Per <b>Galy et al. (2020):</b> %2<br><br>"
644-
"<b>Details:</b><br>"
645-
"• <b>Regime:</b> %3<br>"
646-
"• <b>Volume Fraction:</b> %4<br>"
647-
"• <b>Critical Wavelength:</b> %5<br>"
648-
"• <b>Size Parameter:</b> %6<br>"
649-
"• <b>Clearance/Wavelength Ratio:</b> %7"
694+
"<h3>Dependent Scattering Warning</h3>"
695+
"The current parameters suggest <b>dependent</b> scattering effects in the <b>%1</b>. "
696+
"Results should be interpreted with caution.<br><br>"
697+
698+
"<b>Current Parameters:</b><br>"
699+
"• Volume Fraction (<b>f<sub>v</sub></b>) = <b>%8</b><br>"
700+
"• Size Parameter (<b>&chi;</b>) = <b>%9</b> at Wavelength (<b>&lambda;</b>) = <b>%11 nm</b><br>"
701+
"• Clearance to Wavelength Ratio (<b>c/&lambda;</b>) = <b>%10</b><br>"
702+
703+
"<table border='1' cellspacing='0' cellpadding='4' style='border-collapse: collapse; width: 100%;'>"
704+
" <tr bgcolor='#f2f2f2'>"
705+
" <td><b>Source</b></td>"
706+
" <td><b>Independence Rules</b></td>"
707+
" <td><b>Assessment</b></td>"
708+
" </tr>"
709+
" <tr><td>%2</td><td>%3</td><td>%4</td></tr>"
710+
" <tr><td>%5</td><td>%6</td><td>%7</td></tr>"
711+
"</table><br><br>"
712+
713+
"%12"
650714
)
651-
.arg(strTienDorlen)
652-
.arg(strGaly)
653715
.arg(strRegime)
654-
.arg(volFraction, 0, 'g', 6)
655-
.arg(criticalWavelength, 0, 'g', 6)
656-
.arg(sizeParameter, 0, 'g', 6)
657-
.arg(clearanceToWavelength, 0, 'g', 6);
716+
.arg(strTienDorlenLink).arg(strTienCriteria).arg(strTienResult)
717+
.arg(strGalyLink).arg(strGalyCriteria).arg(strGalyResult)
718+
.arg(volFraction, 0, 'g', 4)
719+
.arg(sizeParameter, 0, 'g', 3)
720+
.arg(clearanceToWavelength, 0, 'f', 3)
721+
.arg(criticalWavelength, 0, 'g', 5)
722+
.arg(strRegimeContext);
658723

659724
DisplayWarning(msg);
660725
}
661726

727+
728+
662729
// Display warning message
663730
void MainWindowSupport::DisplayWarning(QString warningMessage)
664731
{

src/app/dialog/mainwindowsupport.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,10 @@ class MainWindowSupport
2323
void DisableWidgetsDuringSimulation(Ui_MainWindow *ui, Parameters *para, bool flag);
2424
void DisableWidgetsDuringCustomPolyDisperseData(Ui_MainWindow *ui, bool flag);
2525
void ReadCustomData(Parameters * para, QString fileName, bool * dataValidFlag);
26-
void DisplayWarning(QString warningMessage);
27-
// Display dependent scattering warning
28-
void DisplayScatteringRegimeWarning(double clearanceToWavelength, double sizeParameter,
26+
void PrepareScatteringRegimeWarning(double clearanceToWavelength, double sizeParameter,
2927
double volFraction, double criticalWavelength,
3028
QString strRegime);
29+
void DisplayWarning(QString warningMessage);
3130

3231
private:
3332
Calculate *mCalc;

src/app/parameters.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ ParameterValidationResult Parameters::CheckValidityCommonParameters(
142142
if (volFraction >= 0.74048) //Maximum packing factor = PI/(3*sqrt(2))
143143
{
144144
result.isValid = false;
145-
result.errorMessage = "Volume Fraction must not exceed the maximum packing factor.";
145+
result.errorMessage = "Volume Fraction must not exceed the maximum packing factor (~0.74).";
146146
return result;
147147
}
148148
}

src/test/test_parameters.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ void TestParameters::test_CheckValidityCommonParameters_invalidVolFractionUpperL
153153
mPara->volFraction = 1.1;
154154
ParameterValidationResult result = mPara->CheckValidityCommonParameters(false, false, true);
155155
QVERIFY(!result.isValid);
156-
QCOMPARE(result.errorMessage, QString("Volume Fraction must not exceed the maximum packing factor."));
156+
QCOMPARE(result.errorMessage, QString("Volume Fraction must not exceed the maximum packing factor (~0.74)."));
157157
}
158158

159159
// Test case: Mean radius is too large
@@ -191,7 +191,7 @@ void TestParameters::test_CheckValidityCommonParameters_volFractionAtLimit()
191191
mPara->volFraction = 0.74048;
192192
ParameterValidationResult result = mPara->CheckValidityCommonParameters(false, false, true);
193193
QVERIFY(!result.isValid);
194-
QCOMPARE(result.errorMessage, QString("Volume Fraction must not exceed the maximum packing factor."));
194+
QCOMPARE(result.errorMessage, QString("Volume Fraction must not exceed the maximum packing factor (~0.74)."));
195195
}
196196

197197
// Test case: Mean radius is too small (Distribution Parameters)

0 commit comments

Comments
 (0)