diff --git a/testApp/chemFoam.C b/testApp/chemFoam.C index e21e2e4..b9b2470 100644 --- a/testApp/chemFoam.C +++ b/testApp/chemFoam.C @@ -94,6 +94,7 @@ class LogWriter Info << name << ", T = " << T << " relative error = " << (100. * relError(ofVal, ctVal)) << " %"<< endl; errorCount_++; } + testCount_++; post_ << T << token::TAB @@ -151,10 +152,6 @@ int main(int argc, char *argv[]) Info<< "\nTemperature Loop\n" << endl; - label errorCount = 0; - - label testCount = 0; - forAll(T, i) { // OpenFOAM diffusivity model @@ -204,51 +201,38 @@ int main(int argc, char *argv[]) forAll(thermo.composition().species(), k) { - if (exceedTolerence(relError(diff.D(k)[0], Dc[k]))) - { - Info << thermo.composition().species()[k] << ", T = " << thermo.T()[0] - << " relative error = " << (100. * relError(diff.D(k)[0], Dc[k])) << " %" << endl; - errorCount++; - } - testCount++; - - post<< thermo.T()[0] << token::TAB - << thermo.composition().species()[k] << token::TAB - << diff.D(k)[0] << token::TAB - << Dc[k] << token::TAB - << 100*(relError(diff.D(k)[0], Dc[k])) << endl; + logWriter + ( + thermo.composition().species()[k], + thermo.T()[0], + diff.D(k)[0], + Dc[k] + ) + ; } - if (exceedTolerence(relError(diff.mu()[0], tr_->viscosity()))) - { - Info << "mu, T = " << thermo.T()[0] << " relative error = " << (100. * relError(diff.mu()[0], tr_->viscosity())) << " %"<< endl; - errorCount++; - } - testCount++; + logWriter + ( + "mu", + thermo.T()[0], + diff.mu()[0], + tr_->viscosity() + ) + ; - post<< thermo.T()[0] << token::TAB - << "mu" << token::TAB - << diff.mu()[0] << token::TAB - << tr_->viscosity() << token::TAB - << 100*(relError(diff.mu()[0], tr_->viscosity())) << endl; - - if (exceedTolerence(relError(diff.k()[0], tr_->thermalConductivity()))) - { - Info << "k, T = " << thermo.T()[0] << " relative error = " << (100. * relError(diff.k()[0], tr_->thermalConductivity())) << " %"<< endl; - errorCount++; - } - testCount++; - - post<< thermo.T()[0] << token::TAB - << "k" << token::TAB - << diff.k()[0] << token::TAB - << tr_->thermalConductivity() << token::TAB - << 100*(relError(diff.k()[0], tr_->thermalConductivity())) << endl; + logWriter + ( + "k", + thermo.T()[0], + diff.k()[0], + tr_->thermalConductivity() + ) + ; } - Info << errorCount << " / " << testCount << " End" << nl << endl; + Info << logWriter.numErrors() << " / " << logWriter.numTests() << " End" << nl << endl; - if (errorCount == 0) + if (logWriter.numErrors() == 0) { return 0; }